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

@@ -84,13 +84,13 @@ class WPSEO_Taxonomy_Columns {
$new_columns[ $column_name ] = $column_value;
if ( $column_name === 'description' && $this->analysis_seo->is_enabled() ) {
$new_columns['wpseo-score'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="yoast-column-seo-score yoast-column-header-has-tooltip"><span class="screen-reader-text">' .
__( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
$new_columns['wpseo-score'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="yoast-column-seo-score yoast-column-header-has-tooltip"><span class="screen-reader-text">'
. __( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
}
if ( $column_name === 'description' && $this->analysis_readability->is_enabled() ) {
$new_columns['wpseo-score-readability'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="yoast-column-readability yoast-column-header-has-tooltip"><span class="screen-reader-text">' .
__( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
$new_columns['wpseo-score-readability'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="yoast-column-readability yoast-column-header-has-tooltip"><span class="screen-reader-text">'
. __( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
}
}
@@ -125,18 +125,16 @@ class WPSEO_Taxonomy_Columns {
* @return string|null The current taxonomy or null when it is not set.
*/
public function get_current_taxonomy() {
// phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
// phpcs:disable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( ! empty( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) {
if ( isset( $_POST['taxonomy'] ) && is_string( $_POST['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_POST['taxonomy'] ) );
}
}
else {
if ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) );
}
elseif ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) );
}
// phpcs:enable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
// phpcs:enable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended
return null;
}
@@ -146,18 +144,16 @@ class WPSEO_Taxonomy_Columns {
* @return string|null
*/
private function get_taxonomy() {
// phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
// phpcs:disable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( wp_doing_ajax() ) {
if ( isset( $_POST['taxonomy'] ) && is_string( $_POST['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_POST['taxonomy'] ) );
}
}
else {
if ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) );
}
elseif ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) );
}
// phpcs:enable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
// phpcs:enable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended
return null;
}

View File

@@ -60,8 +60,8 @@ class WPSEO_Taxonomy_Fields_Presenter {
$label = $this->get_label( $field_configuration['label'], $esc_field_name );
$field = $this->get_field( $field_configuration['type'], $esc_field_name, $this->get_field_value( $field_name ), $options );
$help_content = isset( $field_configuration['options']['help'] ) ? $field_configuration['options']['help'] : '';
$help_button_text = isset( $field_configuration['options']['help-button'] ) ? $field_configuration['options']['help-button'] : '';
$help_content = ( $field_configuration['options']['help'] ?? '' );
$help_button_text = ( $field_configuration['options']['help-button'] ?? '' );
$help = new WPSEO_Admin_Help_Panel( $field_name, $help_button_text, $help_content );
return $this->parse_row( $label, $help, $field );
@@ -110,28 +110,28 @@ class WPSEO_Taxonomy_Fields_Presenter {
$field .= '<textarea class="large-text" rows="' . esc_attr( $rows ) . '" id="' . $field_name . '" name="' . $field_name . '"' . $aria_describedby . '>' . esc_textarea( $field_value ) . '</textarea>';
break;
case 'upload':
$field .= '<input' .
' id="' . $field_name . '"' .
' type="text"' .
' size="36"' .
' name="' . $field_name . '"' .
' value="' . esc_attr( $field_value ) . '"' . $aria_describedby . '' .
' readonly="readonly"' .
' /> ';
$field .= '<input' .
' id="' . esc_attr( $field_name ) . '_button"' .
' class="wpseo_image_upload_button button"' .
' data-target="' . esc_attr( $field_name ) . '"' .
' data-target-id="hidden_' . esc_attr( $field_name ) . '-id"' .
' type="button"' .
' value="' . esc_attr__( 'Upload Image', 'wordpress-seo' ) . '"' .
' /> ';
$field .= '<input' .
' id="' . esc_attr( $field_name ) . '_button"' .
' class="wpseo_image_remove_button button"' .
' type="button"' .
' value="' . esc_attr__( 'Clear Image', 'wordpress-seo' ) . '"' .
' />';
$field .= '<input'
. ' id="' . $field_name . '"'
. ' type="text"'
. ' size="36"'
. ' name="' . $field_name . '"'
. ' value="' . esc_attr( $field_value ) . '"' . $aria_describedby . ''
. ' readonly="readonly"'
. ' /> ';
$field .= '<input'
. ' id="' . esc_attr( $field_name ) . '_button"'
. ' class="wpseo_image_upload_button button"'
. ' data-target="' . esc_attr( $field_name ) . '"'
. ' data-target-id="hidden_' . esc_attr( $field_name ) . '-id"'
. ' type="button"'
. ' value="' . esc_attr__( 'Upload Image', 'wordpress-seo' ) . '"'
. ' /> ';
$field .= '<input'
. ' id="' . esc_attr( $field_name ) . '_button"'
. ' class="wpseo_image_remove_button button"'
. ' type="button"'
. ' value="' . esc_attr__( 'Clear Image', 'wordpress-seo' ) . '"'
. ' />';
break;
case 'select':
if ( is_array( $options ) && $options !== [] ) {

View File

@@ -98,7 +98,7 @@ class WPSEO_Taxonomy_Fields {
/**
* Filter: 'wpseo_taxonomy_content_fields' - Adds the possibility to register additional content fields.
*
* @api array - The additional fields.
* @param array $additional_fields The additional fields.
*/
$additional_fields = apply_filters( 'wpseo_taxonomy_content_fields', [] );

View File

@@ -70,6 +70,8 @@ class WPSEO_Taxonomy_Metabox {
/**
* Shows the Yoast SEO metabox for the term.
*
* @return void
*/
public function display() {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $this->get_product_title() returns a hard-coded string.

View File

@@ -60,6 +60,8 @@ class WPSEO_Taxonomy {
/**
* Add hooks late enough for taxonomy object to be available for checks.
*
* @return void
*/
public function admin_init() {
@@ -80,6 +82,8 @@ class WPSEO_Taxonomy {
* Show the SEO inputs for term.
*
* @param stdClass|WP_Term $term Term to show the edit boxes for.
*
* @return void
*/
public function term_metabox( $term ) {
if ( WPSEO_Metabox::is_internet_explorer() ) {
@@ -121,6 +125,8 @@ class WPSEO_Taxonomy {
* Queue assets for taxonomy screens.
*
* @since 1.5.0
*
* @return void
*/
public function admin_enqueue_scripts() {
@@ -165,7 +171,7 @@ class WPSEO_Taxonomy {
],
'shortcodes' => [
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
'wpseo_filter_shortcodes_nonce' => \wp_create_nonce( 'wpseo-filter-shortcodes' ),
'wpseo_filter_shortcodes_nonce' => wp_create_nonce( 'wpseo-filter-shortcodes' ),
],
],
'worker' => [
@@ -180,10 +186,10 @@ class WPSEO_Taxonomy {
'choose_image' => __( 'Use Image', 'wordpress-seo' ),
],
'metabox' => $this->localize_term_scraper_script( $tag_id ),
'userLanguageCode' => WPSEO_Language_Utils::get_language( \get_user_locale() ),
'userLanguageCode' => WPSEO_Language_Utils::get_language( get_user_locale() ),
'isTerm' => true,
'postId' => $tag_id,
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage' ),
'usedKeywordsNonce' => wp_create_nonce( 'wpseo-keyword-usage' ),
'linkParams' => WPSEO_Shortlinker::get_query_params(),
];
$asset_manager->localize_script( 'term-edit', 'wpseoScriptData', $script_data );
@@ -201,6 +207,8 @@ class WPSEO_Taxonomy {
* @param int $term_id ID of the term to save data for.
* @param int $tt_id The taxonomy_term_id for the term.
* @param string $taxonomy The taxonomy the term belongs to.
*
* @return void
*/
public function update_term( $term_id, $tt_id, $taxonomy ) {
// Bail if this is a multisite installation and the site has been switched.
@@ -213,8 +221,8 @@ class WPSEO_Taxonomy {
foreach ( WPSEO_Taxonomy_Meta::$defaults_per_term as $key => $default ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: Nonce is already checked by WordPress before executing this action.
if ( isset( $_POST[ $key ] ) && is_string( $_POST[ $key ] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: $data is getting sanitized later.
$data = \wp_unslash( $_POST[ $key ] );
// phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: $data is getting sanitized later.
$data = wp_unslash( $_POST[ $key ] );
$new_meta_data[ $key ] = ( $key !== 'wpseo_canonical' ) ? WPSEO_Utils::sanitize_text_field( $data ) : WPSEO_Utils::sanitize_url( $data );
}
@@ -252,6 +260,8 @@ class WPSEO_Taxonomy {
/**
* Allows post-kses-filtered HTML in term descriptions.
*
* @return void
*/
public function custom_category_descriptions_allow_html() {
remove_filter( 'term_description', 'wp_kses_data' );
@@ -262,6 +272,8 @@ class WPSEO_Taxonomy {
/**
* Output the WordPress editor.
*
* @return void
*/
public function custom_category_description_editor() {
wp_editor( '', 'description' );
@@ -389,7 +401,7 @@ class WPSEO_Taxonomy {
private static function get_tag_id() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['tag_ID'] ) && is_string( $_GET['tag_ID'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are casting to an integer.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are casting to an integer.
$tag_id = (int) wp_unslash( $_GET['tag_ID'] );
if ( $tag_id > 0 ) {
return $tag_id;