[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.135.212.80: ~ $
<?php
/**
 * Validation module.
 */
class RWMB_Validation {
	public function __construct() {
		add_action( 'rwmb_after', [ $this, 'rules' ] );
		add_action( 'rwmb_enqueue_scripts', [ $this, 'enqueue' ] );
	}

	/**
	 * Output validation rules of each meta box.
	 * The rules are outputted in [data-validation] attribute of an hidden <script> and will be converted into JSON by JS.
	 */
	public function rules( RW_Meta_Box $meta_box ) {
		$settings = $meta_box->meta_box;
		if ( empty( $settings['validation'] ) ) {
			return;
		}

		$prefix     = $settings['prefix'] ?? ''; // Get field ID prefix from the builder.
		$fields     = $settings['fields'];
		$validation = $settings['validation'];
		$ids        = wp_list_pluck( $fields, 'id' ); // Don't use array_column() as it doesn't preserve keys.

		// Add prefix for validation rules.
		foreach ( $validation as &$rules ) {
			$rules = array_combine(
				array_map( function ( $key ) use ( $fields, $prefix, $ids ) {
					$id    = $prefix . $key;
					$index = array_search( $id, $ids, true );

					if ( $index === false ) {
						return $id;
					}

					$field = $fields[ $index ];

					if ( in_array( $field['type'], [ 'file', 'image' ], true ) ) {
						return $field['clone'] ? $field['index_name'] : $field['input_name'];
					}

					return $id;
				}, array_keys( $rules ) ),
				$rules
			);
		}

		echo '<script type="text/html" class="rwmb-validation" data-validation="' . esc_attr( wp_json_encode( $validation ) ) . '"></script>';
	}

	public function enqueue() {
		wp_enqueue_script( 'jquery-validation', RWMB_JS_URL . 'validation/jquery.validate.js', [ 'jquery' ], '1.20.0', true );
		wp_enqueue_script( 'jquery-validation-additional-methods', RWMB_JS_URL . 'validation/additional-methods.js', [ 'jquery-validation' ], '1.20.0', true );
		wp_enqueue_script( 'rwmb-validation', RWMB_JS_URL . 'validation/validation.js', [ 'jquery-validation-additional-methods', 'rwmb' ], RWMB_VER, true );

		$locale       = determine_locale();
		$locale_short = substr( $locale, 0, 2 );
		$locale       = file_exists( RWMB_DIR . "js/validation/i18n/messages_$locale.js" ) ? $locale : $locale_short;

		if ( file_exists( RWMB_DIR . "js/validation/i18n/messages_$locale.js" ) ) {
			wp_enqueue_script( 'jquery-validation-i18n', RWMB_JS_URL . "validation/i18n/messages_$locale.js", [ 'jquery-validation-additional-methods' ], '1.20.0', true );
		}

		RWMB_Helpers_Field::localize_script_once( 'rwmb-validation', 'rwmbValidation', [
			'message' => esc_html( apply_filters( 'rwmb_validation_message_string', __( 'Please correct the errors highlighted below and try again.', 'meta-box' ) ) ),
		] );
	}
}

Filemanager

Name Type Size Permission Actions
about Folder 0755
fields Folder 0755
helpers Folder 0755
interfaces Folder 0755
storages Folder 0755
templates Folder 0755
walkers Folder 0755
autoloader.php File 1.49 KB 0644
clone.php File 3.5 KB 0644
core.php File 2.53 KB 0644
field-registry.php File 1.63 KB 0644
field.php File 17.95 KB 0644
functions.php File 9.5 KB 0644
loader.php File 3.97 KB 0644
media-modal.php File 3.09 KB 0644
meta-box-registry.php File 1.28 KB 0644
meta-box.php File 12 KB 0644
request.php File 2.35 KB 0644
sanitizer.php File 8.14 KB 0644
shortcode.php File 2.55 KB 0644
storage-registry.php File 418 B 0644
validation.php File 2.59 KB 0644
wpml.php File 3.48 KB 0644