WPSEO_Option::validate
Validate the option.
Метод класса: WPSEO_Option{}
Хуков нет.
Возвращает
Массив. Validated new value for the option.
Использование
$WPSEO_Option = new WPSEO_Option(); $WPSEO_Option->validate( $option_value );
- $option_value(разное) (обязательный)
- The unvalidated new value for the option.
Код WPSEO_Option::validate() WPSEO Option::validate Yoast 27.6
public function validate( $option_value ) {
$clean = $this->get_defaults();
/* Return the defaults if the new value is empty. */
if ( ! is_array( $option_value ) || $option_value === [] ) {
return $clean;
}
$option_value = array_map( [ 'WPSEO_Utils', 'trim_recursive' ], $option_value );
$old = $this->get_original_option();
if ( ! is_array( $old ) ) {
$old = [];
}
$old = array_merge( $clean, $old );
$clean = $this->validate_option( $option_value, $clean, $old );
// Prevent updates to variables that are disabled via the override option.
$clean = $this->prevent_disabled_options_update( $clean, $old );
/* Retain the values for variable array keys even when the post type/taxonomy is not yet registered. */
if ( isset( $this->variable_array_key_patterns ) ) {
$clean = $this->retain_variable_keys( $option_value, $clean );
}
$this->remove_default_filters();
return $clean;
}