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

@@ -93,7 +93,6 @@ class Crawl_Cleanup_Helper {
*
* @param array $allowed_extravars The list of the allowed vars (empty by default).
*/
$allowed_extravars = \apply_filters( 'Yoast\WP\SEO\allowlist_permalink_vars', $default_allowed_extravars );
$clean_permalinks_extra_variables = $this->options_helper->get( 'clean_permalinks_extra_variables' );
@@ -156,7 +155,7 @@ class Crawl_Cleanup_Helper {
}
// Fix reply to comment links, whoever decided this should be a GET variable?
// phpcs:ignore WordPress.Security -- We know this is scary.
// phpcs:ignore WordPress.Security -- We know this is scary.
if ( isset( $_SERVER['REQUEST_URI'] ) && \preg_match( '`(\?replytocom=[^&]+)`', \sanitize_text_field( $_SERVER['REQUEST_URI'] ), $matches ) ) {
$proper_url .= \str_replace( '?replytocom=', '#comment-', $matches[0] );
}

View File

@@ -90,7 +90,7 @@ class Current_Page_Helper {
/**
* Filter: Allow changing the default page id.
*
* @api int $page_id The default page id.
* @param int $page_id The default page id.
*/
return \apply_filters( 'wpseo_frontend_page_type_simple_page_id', 0 );
}
@@ -414,7 +414,7 @@ class Current_Page_Helper {
public function is_yoast_seo_page() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['page'] ) && \is_string( $_GET['page'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are only using the variable in the strpos function.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are only using the variable in the strpos function.
$current_page = \wp_unslash( $_GET['page'] );
return \strpos( $current_page, 'wpseo_' ) === 0;
}
@@ -485,9 +485,8 @@ class Current_Page_Helper {
$wp_query = $this->wp_query_wrapper->get_main_query();
$term = $wp_query->get_queried_object();
$queried_terms = $wp_query->tax_query->queried_terms;
if ( is_null( $term ) || empty( $queried_terms[ $term->taxonomy ]['terms'] ) ) {
if ( \is_null( $term ) || empty( $queried_terms[ $term->taxonomy ]['terms'] ) ) {
return 0;
}

View File

@@ -108,6 +108,8 @@ class Indexable_Helper {
* @required
*
* @param Indexable_Repository $repository The indexable repository.
*
* @return void
*/
public function set_indexable_repository( Indexable_Repository $repository ) {
$this->repository = $repository;
@@ -161,6 +163,8 @@ class Indexable_Helper {
* @param string|null $type The type of the indexable.
* @param string|null $subtype The subtype. Can be null.
* @param string $reason The reason that the permalink has been changed.
*
* @return void
*/
public function reset_permalink_indexables( $type = null, $subtype = null, $reason = Indexing_Reasons::REASON_PERMALINK_SETTINGS ) {
$result = $this->repository->reset_permalink( $type, $subtype );

View File

@@ -90,6 +90,8 @@ class Indexing_Helper {
* @param Indexable_General_Indexation_Action $general_indexation The general indexing (homepage etc) action.
* @param Post_Link_Indexing_Action $post_link_indexing_action The post crosslink indexing action.
* @param Term_Link_Indexing_Action $term_link_indexing_action The term crossling indexing action.
*
* @return void
*/
public function set_indexing_actions(
Indexable_Post_Indexation_Action $post_indexation,
@@ -118,6 +120,8 @@ class Indexing_Helper {
* @required
*
* @param Indexable_Repository $indexable_repository The indexable repository.
*
* @return void
*/
public function set_indexable_repository(
Indexable_Repository $indexable_repository
@@ -171,6 +175,8 @@ class Indexing_Helper {
/**
* Removes any pre-existing notification, so that a new notification (with a possible new reason) can be added.
*
* @return void
*/
protected function remove_indexing_notification() {
$this->notification_center->remove_notification_by_id(

View File

@@ -55,9 +55,8 @@ class Image_Helper {
/**
* Filter: 'wpseo_opengraph_is_valid_image_url' - Allows extra validation for an image url.
*
* @api bool - Current validation result.
*
* @param string $url The image url to validate.
* @param bool $is_valid Current validation result.
* @param string $url The image url to validate.
*/
return (bool) \apply_filters( 'wpseo_opengraph_is_valid_image_url', $is_valid, $image['url'] );
}
@@ -80,7 +79,7 @@ class Image_Helper {
* can be used to add an image size that needs to be taken into consideration
* within our own logic.
*
* @api string|false $size Size string.
* @param string|false $size Size string.
*/
return \apply_filters( 'wpseo_opengraph_image_size', null );
}

View File

@@ -76,7 +76,7 @@ class Options_Helper {
/**
* Filter: 'wpseo_replacements_filter_sep' - Allow customization of the separator character(s).
*
* @api string $replacement The current separator.
* @param string $replacement The current separator.
*/
return \apply_filters( 'wpseo_replacements_filter_sep', $replacement );
}

View File

@@ -49,7 +49,7 @@ class Pagination_Helper {
/**
* Filter: 'wpseo_disable_adjacent_rel_links' - Allows disabling of Yoast adjacent links if this is being handled by other code.
*
* @api bool $links_generated Indicates if other code has handled adjacent links.
* @param bool $links_generated Indicates if other code has handled adjacent links.
*/
return \apply_filters( 'wpseo_disable_adjacent_rel_links', false );
}
@@ -196,7 +196,7 @@ class Pagination_Helper {
$key_query_loop = $this->get_key_query_loop();
if ( $key_query_loop ) {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Recommended -- Validated in get_key_query_loop().
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated,WordPress.Security.NonceVerification.Recommended -- Validated in get_key_query_loop().
$page_number = (int) $_GET[ $key_query_loop ];
if ( $page_number > 1 ) {
return $page_number;

View File

@@ -53,6 +53,8 @@ class Post_Helper {
* @required
*
* @param Indexable_Repository $repository The indexable repository.
*
* @return void
*/
public function set_indexable_repository( Indexable_Repository $repository ) {
$this->repository = $repository;
@@ -219,7 +221,7 @@ class Post_Helper {
/**
* Filter: 'wpseo_public_post_statuses' - List of public post statuses.
*
* @api array $post_statuses Post status list, defaults to array( 'publish' ).
* @param array $post_statuses Post status list, defaults to array( 'publish' ).
*/
return \apply_filters( 'wpseo_public_post_statuses', [ 'publish' ] );
}

View File

@@ -80,7 +80,7 @@ class Post_Type_Helper {
/**
* Filter: 'wpseo_accessible_post_types' - Allow changing the accessible post types.
*
* @api array $post_types The public post types.
* @param array $post_types The public post types.
*/
$post_types = \apply_filters( 'wpseo_accessible_post_types', $post_types );
@@ -103,7 +103,7 @@ class Post_Type_Helper {
* Filter: 'wpseo_indexable_excluded_post_types' - Allows excluding posts of a certain post
* type from being saved to the indexable table.
*
* @api array $excluded_post_types The currently excluded post types that indexables will not be created for.
* @param array $excluded_post_types The currently excluded post types that indexables will not be created for.
*/
$excluded_post_types = \apply_filters( 'wpseo_indexable_excluded_post_types', [] );
@@ -176,7 +176,7 @@ class Post_Type_Helper {
* Filter: 'wpseo_indexable_forced_included_post_types' - Allows force including posts of a certain post
* type to be saved to the indexable table.
*
* @api array $included_post_types The currently included post types that indexables will be created for.
* @param array $included_post_types The currently included post types that indexables will be created for.
*/
$filtered_included_post_types = \apply_filters( 'wpseo_indexable_forced_included_post_types', $included_post_types );

View File

@@ -24,8 +24,7 @@ class Primary_Term_Helper {
/**
* Filters which taxonomies for which the user can choose the primary term.
*
* @api array $taxonomies An array of taxonomy objects that are primary_term enabled.
*
* @param array $taxonomies An array of taxonomy objects that are primary_term enabled.
* @param string $post_type The post type for which to filter the taxonomies.
* @param array $all_taxonomies All taxonomies for this post types, even ones that don't have primary term
* enabled.

View File

@@ -15,6 +15,8 @@ class Redirect_Helper {
* @param string $location The path to redirect to.
* @param int $status The status code to use.
* @param string $reason The reason for the redirect.
*
* @return void
*/
public function do_unsafe_redirect( $location, $status = 302, $reason = 'Yoast SEO' ) {
// phpcs:ignore WordPress.Security.SafeRedirect -- intentional, function has been renamed to make unsafe more clear.
@@ -30,6 +32,8 @@ class Redirect_Helper {
* @param string $location The path to redirect to.
* @param int $status The status code to use.
* @param string $reason The reason for the redirect.
*
* @return void
*/
public function do_safe_redirect( $location, $status = 302, $reason = 'Yoast SEO' ) {
\wp_safe_redirect( $location, $status, $reason );
@@ -43,6 +47,8 @@ class Redirect_Helper {
* @codeCoverageIgnore It only wraps a WordPress function.
*
* @param string $header The header to set.
*
* @return void
*/
public function set_header( $header ) {
\header( $header );
@@ -55,6 +61,8 @@ class Redirect_Helper {
* @codeCoverageIgnore It only wraps a WordPress function.
*
* @param string $header The header to remove.
*
* @return void
*/
public function remove_header( $header ) {
\header_remove( $header );

View File

@@ -22,7 +22,8 @@ class Language_Helper {
/**
* Filter: 'wpseo_schema_piece_language' - Allow changing the Schema piece language.
*
* @api string $type The Schema piece language.
* @param string $type The Schema piece language.
* @param array $data The Schema piece data.
*/
$data['inLanguage'] = \apply_filters( 'wpseo_schema_piece_language', \get_bloginfo( 'language' ), $data );

View File

@@ -110,6 +110,8 @@ class Replace_Vars_Helper {
*
* @param string $variable The replace variable.
* @param string $value The value that the variable should be replaced with.
*
* @return void
*/
protected function register_replacement( $variable, $value ) {
$this->replace_vars->safe_register_replacement(
@@ -126,7 +128,7 @@ class Replace_Vars_Helper {
* @return Closure A function that returns the given value.
*/
protected function get_identity_function( $value ) {
return static function() use ( $value ) {
return static function () use ( $value ) {
return $value;
};
}

View File

@@ -61,6 +61,8 @@ class Short_Link_Helper {
* Echoes a version of the URL with a utm_content with the current version.
*
* @param string $url The URL to build upon.
*
* @return void
*/
public function show( $url ) {
echo \esc_url( $this->get( $url ) );

View File

@@ -224,7 +224,7 @@ class Social_Profiles_Helper {
if ( $field_name === 'other_social_urls' ) {
$other_social_urls = \array_filter(
$social_profiles[ $field_name ],
static function( $other_social_url ) {
static function ( $other_social_url ) {
return $other_social_url !== '';
}
);

View File

@@ -36,7 +36,7 @@ class Image_Helper {
/**
* Filter: 'wpseo_twitter_image_size' - Allow changing the Twitter Card image size.
*
* @api string $featured_img Image size string.
* @param string $featured_img Image size string.
*/
return (string) \apply_filters( 'wpseo_twitter_image_size', 'full' );
}

View File

@@ -33,7 +33,7 @@ class Wpdb_Helper {
* @return bool Whether the table exists.
*/
public function table_exists( $table ) {
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: There is no unescaped user input.
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: There is no unescaped user input.
$table_exists = $this->wpdb->get_var( "SHOW TABLES LIKE '{$table}'" );
if ( \is_wp_error( $table_exists ) || \is_null( $table_exists ) ) {
return false;