Merged in feature/314-dev-dev01 (pull request #24)

auto-patch  314-dev-dev01-2024-01-25T04_09_02

* auto-patch  314-dev-dev01-2024-01-25T04_09_02
This commit is contained in:
Tony Volpe
2024-01-25 04:11:47 +00:00
parent 6b67473553
commit 68dbe860e9
540 changed files with 3445 additions and 2131 deletions

View File

@@ -182,6 +182,8 @@ class WPSEO_Option_Titles extends WPSEO_Option {
/**
* Make sure we can recognize the right action for the double cleaning.
*
* @return void
*/
public function end_of_init() {
do_action( 'wpseo_double_clean_titles' );
@@ -211,7 +213,7 @@ class WPSEO_Option_Titles extends WPSEO_Option {
/**
* Allow altering the array with separator options.
*
* @api array $separator_options Array with the separator options.
* @param array $separator_options Array with the separator options.
*/
$filtered_separators = apply_filters( 'wpseo_separator_options', $separators );
@@ -234,7 +236,7 @@ class WPSEO_Option_Titles extends WPSEO_Option {
$separator_options = [];
foreach ( $separators as $key => $label ) {
$aria_label = isset( $separator_list[ $key ]['label'] ) ? $separator_list[ $key ]['label'] : '';
$aria_label = ( $separator_list[ $key ]['label'] ?? '' );
$separator_options[ $key ] = [
'label' => $label,
@@ -640,7 +642,7 @@ class WPSEO_Option_Titles extends WPSEO_Option {
*
* Make sure when you filter this to also filter `wpseo_schema_article_types_labels`.
*
* @api array $schema_article_types The available schema article types.
* @param array $schema_article_types The available schema article types.
*/
if ( array_key_exists( $dirty[ $key ], apply_filters( 'wpseo_schema_article_types', Schema_Types::ARTICLE_TYPES ) ) ) {
$clean[ $key ] = $dirty[ $key ];
@@ -845,10 +847,8 @@ class WPSEO_Option_Titles extends WPSEO_Option {
if ( ! isset( $post_type_names[ $tax ] ) && isset( $option_value[ $old_prefix . $tax ] ) ) {
unset( $option_value[ $old_prefix . $tax ] );
}
else {
if ( isset( $post_type_names[ $tax ] ) && ! isset( $option_value[ $old_prefix . $tax ] ) ) {
$option_value[ $old_prefix . $tax ] = $original[ $old_prefix . $tax ];
}
elseif ( isset( $post_type_names[ $tax ] ) && ! isset( $option_value[ $old_prefix . $tax ] ) ) {
$option_value[ $old_prefix . $tax ] = $original[ $old_prefix . $tax ];
}
if ( $old_prefix === 'tax-hideeditbox-' ) {
@@ -929,7 +929,7 @@ class WPSEO_Option_Titles extends WPSEO_Option {
/**
* Allow altering the array with variable array key patterns.
*
* @api array $patterns Array with the variable array key patterns.
* @param array $patterns Array with the variable array key patterns.
*/
$patterns = apply_filters( 'wpseo_option_titles_variable_array_key_patterns', $patterns );
@@ -1020,7 +1020,7 @@ class WPSEO_Option_Titles extends WPSEO_Option {
/**
* Allows altering the separator options array.
*
* @api array $separators Array with the separator options.
* @param array $separators Array with the separator options.
*/
$separator_list = apply_filters( 'wpseo_separator_option_list', $separators );

View File

@@ -219,7 +219,7 @@ class WPSEO_Option_Wpseo extends WPSEO_Option {
/**
* Filter: 'wpseo_enable_tracking' - Enables the data tracking of Yoast SEO Premium.
*
* @api string $is_enabled The enabled state. Default is false.
* @param string $is_enabled The enabled state. Default is false.
*/
$this->defaults['tracking'] = apply_filters( 'wpseo_enable_tracking', false );
@@ -469,7 +469,7 @@ class WPSEO_Option_Wpseo extends WPSEO_Option {
if ( is_array( $items ) ) {
foreach ( $items as $item_key => $item ) {
if ( ! \is_string( $item_key ) || ! \is_numeric( $item ) ) {
if ( ! is_string( $item_key ) || ! is_numeric( $item ) ) {
unset( $items[ $item_key ] );
}
}

View File

@@ -61,7 +61,7 @@ abstract class WPSEO_Option {
*
* @var string
*/
const ALLOW_KEY_PREFIX = 'allow_';
public const ALLOW_KEY_PREFIX = 'allow_';
/**
* Option name - MUST be set in concrete class and set to public.
@@ -186,9 +186,6 @@ abstract class WPSEO_Option {
*/
add_filter( 'sanitize_option_' . $this->option_name, [ $this, 'validate' ] );
// Flushes the rewrite rules when option is updated.
add_action( 'update_option_' . $this->option_name, [ 'WPSEO_Utils', 'clear_rewrites' ] );
/* Register our option for the admin pages */
add_action( 'admin_init', [ $this, 'register_setting' ] );
@@ -296,6 +293,8 @@ abstract class WPSEO_Option {
* @param array $dirty Dirty data with the new values.
* @param array $old Old data.
* @param array $clean Clean data by reference, normally the default values.
*
* @return void
*/
public function validate_verification_string( $key, $dirty, $old, &$clean ) {
if ( isset( $dirty[ $key ] ) && $dirty[ $key ] !== '' ) {
@@ -371,6 +370,8 @@ abstract class WPSEO_Option {
* @param array $dirty Dirty data with the new values.
* @param array $old Old data.
* @param array $clean Clean data by reference, normally the default values.
*
* @return void
*/
public function validate_url( $key, $dirty, $old, &$clean ) {
if ( isset( $dirty[ $key ] ) && $dirty[ $key ] !== '' ) {
@@ -870,7 +871,7 @@ abstract class WPSEO_Option {
/**
* Check whether a given array key conforms to one of the variable array key patterns for this option.
*
* @usedby validate_option() methods for options with variable array keys.
* @used-by validate_option() methods for options with variable array keys.
*
* @param string $key Array key to check.
*

View File

@@ -66,6 +66,8 @@ class WPSEO_Options {
/**
* Register our hooks.
*
* @return void
*/
public function register_hooks() {
add_action( 'registered_taxonomy', [ $this, 'clear_cache' ] );
@@ -91,6 +93,8 @@ class WPSEO_Options {
* Registers an option to the options list.
*
* @param WPSEO_Option $option_instance Instance of the option.
*
* @return void
*/
public static function register_option( WPSEO_Option $option_instance ) {
$option_name = $option_instance->get_option_name();
@@ -200,7 +204,7 @@ class WPSEO_Options {
/**
* Filter: wpseo_options - Allow developers to change the option name to include.
*
* @api array The option names to include in get_all and reset().
* @param array $option_names The option names to include in get_all and reset().
*/
return apply_filters( 'wpseo_options', $option_names );
}
@@ -283,6 +287,8 @@ class WPSEO_Options {
/**
* Resets the cache to null.
*
* @return void
*/
public static function clear_cache() {
static::$option_values = null;
@@ -290,6 +296,8 @@ class WPSEO_Options {
/**
* Primes our cache.
*
* @return void
*/
private static function prime_cache() {
static::$option_values = static::get_all();

View File

@@ -119,6 +119,8 @@ class WPSEO_Taxonomy_Meta extends WPSEO_Option {
/**
* Add extra default options received from a filter.
*
* @return void
*/
public function enrich_defaults() {
$extra_defaults_per_term = apply_filters( 'wpseo_add_extra_taxmeta_term_defaults', [] );
@@ -291,7 +293,7 @@ class WPSEO_Taxonomy_Meta extends WPSEO_Option {
break;
}
$clean[ $key ] = apply_filters( 'wpseo_sanitize_tax_meta_' . $key, $clean[ $key ], ( isset( $meta_data[ $key ] ) ? $meta_data[ $key ] : null ), ( isset( $old_meta[ $key ] ) ? $old_meta[ $key ] : null ) );
$clean[ $key ] = apply_filters( 'wpseo_sanitize_tax_meta_' . $key, $clean[ $key ], ( $meta_data[ $key ] ?? null ), ( $old_meta[ $key ] ?? null ) );
}
// Only save the non-default values.
@@ -438,6 +440,8 @@ class WPSEO_Taxonomy_Meta extends WPSEO_Option {
* @param int $term_id ID of the term to save data for.
* @param string $taxonomy The taxonomy the term belongs to.
* @param array $meta_values The values that will be saved.
*
* @return void
*/
public static function set_values( $term_id, $taxonomy, array $meta_values ) {
/* Validate the post values */
@@ -454,6 +458,8 @@ class WPSEO_Taxonomy_Meta extends WPSEO_Option {
* @param string $taxonomy The taxonomy the term belongs to.
* @param string $meta_key The target meta key to store the value in.
* @param string $meta_value The value of the target meta key.
*
* @return void
*/
public static function set_value( $term_id, $taxonomy, $meta_key, $meta_value ) {
@@ -496,6 +502,8 @@ class WPSEO_Taxonomy_Meta extends WPSEO_Option {
* @param int $term_id ID of the term to save data for.
* @param string $taxonomy The taxonomy the term belongs to.
* @param array $clean Array with clean values.
*
* @return void
*/
private static function save_clean_values( $term_id, $taxonomy, array $clean ) {
$tax_meta = self::get_tax_meta();
@@ -530,6 +538,8 @@ class WPSEO_Taxonomy_Meta extends WPSEO_Option {
* Saving the tax meta values to the database.
*
* @param array $tax_meta Array with the meta values for taxonomy.
*
* @return void
*/
private static function save_tax_meta( $tax_meta ) {
update_option( self::$name, $tax_meta );