Skip to content

Commit fc15e77

Browse files
committed
Merge branch 'trunk' into 552-add-error-descriptions-to-url-fields
2 parents 53791f4 + fa0b50b commit fc15e77

File tree

10 files changed

+332
-191
lines changed

10 files changed

+332
-191
lines changed

admin/views/licenses.php

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@
107107

108108
/* translators: %1$s expands to Yoast SEO. */
109109
$wpseo_extensions_header = sprintf( __( '%1$s Extensions', 'wordpress-seo' ), 'Yoast SEO' );
110-
$new_tab_message = '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
110+
$new_tab_message = sprintf(
111+
'<span class="screen-reader-text">%1$s</span>',
112+
esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' )
113+
);
111114

112115
?>
113116

@@ -120,8 +123,9 @@
120123
<h2>
121124
<?php
122125
printf(
123-
/* translators: %1$s expands to Yoast SEO Premium */
126+
/* translators: 1: expands to Yoast SEO Premium */
124127
esc_html__( '%1$s, take your optimization to the next level!', 'wordpress-seo' ),
128+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
125129
'<span class="yoast-heading-highlight">' . $premium_extension->get_title() . '</span>'
126130
);
127131
?>
@@ -157,8 +161,13 @@
157161
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>"
158162
class="yoast-link--license">
159163
<?php
160-
/* translators: %s expands to the extension title */
161-
printf( esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ), $premium_extension->get_title() );
164+
printf(
165+
/* translators: %s expands to the extension title */
166+
esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ),
167+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
168+
$premium_extension->get_title()
169+
);
170+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
162171
echo $new_tab_message;
163172
?>
164173
</a>
@@ -167,8 +176,13 @@ class="yoast-link--license">
167176
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>"
168177
class="yoast-link--license">
169178
<?php
170-
/* translators: %s expands to the extension title */
171-
printf( esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ), $premium_extension->get_title() );
179+
printf(
180+
/* translators: %s expands to the extension title */
181+
esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ),
182+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
183+
$premium_extension->get_title()
184+
);
185+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
172186
echo $new_tab_message;
173187
?>
174188
</a>
@@ -179,8 +193,13 @@ class="yoast-link--license">
179193
<a target="_blank" href="<?php echo esc_url( $premium_extension->get_buy_url() ); ?>"
180194
class="yoast-button-upsell">
181195
<?php
182-
/* translators: $s expands to Yoast SEO Premium */
183-
printf( esc_html__( 'Buy %s', 'wordpress-seo' ), $premium_extension->get_title() );
196+
printf(
197+
/* translators: $s expands to Yoast SEO Premium */
198+
esc_html__( 'Buy %s', 'wordpress-seo' ),
199+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
200+
$premium_extension->get_title()
201+
);
202+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
184203
echo $new_tab_message;
185204
echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
186205
?>
@@ -190,12 +209,14 @@ class="yoast-button-upsell">
190209
class="yoast-link--more-info">
191210
<?php
192211
printf(
193-
/* translators: Text between %1$s and %2$s will only be shown to screen readers. %3$s expands to the product name. */
212+
/* translators: Text between 1: and 2: will only be shown to screen readers. 3: expands to the product name. */
194213
esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ),
195214
'<span class="screen-reader-text">',
196215
'</span>',
216+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
197217
$premium_extension->get_title()
198218
);
219+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
199220
echo $new_tab_message;
200221
?>
201222
</a>
@@ -212,12 +233,16 @@ class="yoast-link--more-info">
212233
<section class="yoast-promo-extensions">
213234
<h2>
214235
<?php
215-
/* translators: %1$s expands to Yoast SEO */
216-
$yoast_seo_extensions = sprintf( __( '%1$s extensions', 'wordpress-seo' ), 'Yoast SEO' );
236+
/* translators: 1: expands to Yoast SEO */
237+
$yoast_seo_extensions = sprintf( esc_html__( '%1$s extensions', 'wordpress-seo' ), 'Yoast SEO' );
217238
$yoast_seo_extensions = '<span class="yoast-heading-highlight">' . $yoast_seo_extensions . '</span>';
218239

219-
/* translators: %1$s expands to Yoast SEO extensions */
220-
printf( esc_html__( '%1$s to optimize your site even further', 'wordpress-seo' ), $yoast_seo_extensions );
240+
printf(
241+
/* translators: 1: expands to Yoast SEO extensions */
242+
esc_html__( '%1$s to optimize your site even further', 'wordpress-seo' ),
243+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $yoast_seo_extensions is properly escaped.
244+
$yoast_seo_extensions
245+
);
221246
?>
222247
</h2>
223248

@@ -241,8 +266,13 @@ class="yoast-link--more-info">
241266
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>"
242267
class="yoast-link--license">
243268
<?php
244-
/* translators: %s expands to the extension title */
245-
printf( esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ), $extension->get_title() );
269+
printf(
270+
/* translators: %s expands to the extension title */
271+
esc_html__( 'Manage your %s subscription on MyYoast', 'wordpress-seo' ),
272+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
273+
$extension->get_title()
274+
);
275+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
246276
echo $new_tab_message;
247277
?>
248278
</a>
@@ -251,8 +281,13 @@ class="yoast-link--license">
251281
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13i' ); ?>"
252282
class="yoast-link--license">
253283
<?php
254-
/* translators: %s expands to the extension title */
255-
printf( esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ), $extension->get_title() );
284+
printf(
285+
/* translators: %s expands to the extension title */
286+
esc_html__( 'Activate %s for your site on MyYoast', 'wordpress-seo' ),
287+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
288+
$extension->get_title()
289+
);
290+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
256291
echo $new_tab_message;
257292
?>
258293
</a>
@@ -261,8 +296,13 @@ class="yoast-link--license">
261296
<a target="_blank" class="yoast-button-upsell"
262297
href="<?php echo esc_url( $extension->get_buy_url() ); ?>">
263298
<?php
264-
/* translators: %s expands to the product name */
265-
printf( esc_html__( 'Buy %s', 'wordpress-seo' ), $extension->get_buy_button() );
299+
printf(
300+
/* translators: %s expands to the product name */
301+
esc_html__( 'Buy %s', 'wordpress-seo' ),
302+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The possible `get_buy_button` values are hardcoded (buy_button or title); only passed through the WPSEO_Extensions class.
303+
$extension->get_buy_button()
304+
);
305+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
266306
echo $new_tab_message;
267307
echo '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
268308
?>
@@ -272,12 +312,14 @@ class="yoast-link--license">
272312
href="<?php echo esc_url( $extension->get_info_url() ); ?>">
273313
<?php
274314
printf(
275-
/* translators: Text between %1$s and %2$s will only be shown to screen readers. %3$s expands to the product name. */
315+
/* translators: Text between 1: and 2: will only be shown to screen readers. 3: expands to the product name. */
276316
esc_html__( 'More information %1$sabout %3$s%2$s', 'wordpress-seo' ),
277317
'<span class="screen-reader-text">',
278318
'</span>',
319+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
279320
$extension->get_title()
280321
);
322+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $new_tab_message is properly escaped.
281323
echo $new_tab_message;
282324
?>
283325
</a>

admin/views/tool-bulk-editor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ function wpseo_get_rendered_tab( $table, $id ) {
119119

120120
?>
121121
<script>
122+
// phpcs:ignore WordPress.Security.OutputEscaping -- WPSEO_Utils::format_json_encode is safe.
122123
var wpseoBulkEditorNonce = <?php echo WPSEO_Utils::format_json_encode( wp_create_nonce( 'wpseo-bulk-editor' ) ); ?>;
123124

124125
// eslint-disable-next-line

admin/views/tool-import-export.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@
7474
$status = 'updated';
7575
}
7676

77-
echo '<div id="message" class="message ', $status, '"><p>', esc_html( $msg ), '</p></div>';
77+
$class = 'message ' . $status;
78+
79+
echo '<div id="message" class="', esc_attr( $status ), '"><p>', esc_html( $msg ), '</p></div>';
7880
}
7981
}
8082

inc/class-wpseo-utils.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,22 @@ public static function extend_kses_post_with_forms( $allowed_post_tags ) {
13641364
return array_merge_recursive( $allowed_post_tags, $input_tags );
13651365
}
13661366

1367+
/**
1368+
* Gets an array of enabled features.
1369+
*
1370+
* @return string[] The array of enabled features.
1371+
*/
1372+
public static function retrieve_enabled_features() {
1373+
$enabled_features = array();
1374+
if ( defined( 'YOAST_SEO_ENABLED_FEATURES' ) ) {
1375+
$enabled_features = preg_split( '/,\W*/', YOAST_SEO_ENABLED_FEATURES );
1376+
}
1377+
// Make the array of enabled features filterable, so features can be enabled at will.
1378+
$enabled_features = apply_filters( 'wpseo_enable_feature', $enabled_features );
1379+
1380+
return $enabled_features;
1381+
}
1382+
13671383
/* ********************* DEPRECATED METHODS ********************* */
13681384

13691385
/**
@@ -1404,20 +1420,4 @@ public static function get_user_locale() {
14041420

14051421
return WPSEO_Language_Utils::get_user_locale();
14061422
}
1407-
1408-
/**
1409-
* Gets an array of enabled features.
1410-
*
1411-
* @return string[] The array of enabled features.
1412-
*/
1413-
public static function retrieve_enabled_features() {
1414-
$enabled_features = array();
1415-
if ( defined( 'YOAST_SEO_ENABLED_FEATURES' ) ) {
1416-
$enabled_features = preg_split( '/,\W*/', YOAST_SEO_ENABLED_FEATURES );
1417-
}
1418-
// Make the array of enabled features filterable, so features can be enabled at will.
1419-
$enabled_features = apply_filters( 'wpseo_enable_feature', $enabled_features );
1420-
1421-
return $enabled_features;
1422-
}
14231423
}

inc/options/class-wpseo-option.php

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,16 @@ public function validate_verification_string( $key, $dirty, $old, &$clean ) {
305305
if ( isset( $old[ $key ] ) && preg_match( $regex, $old[ $key ] ) ) {
306306
$clean[ $key ] = $old[ $key ];
307307
}
308-
add_settings_error(
309-
$this->group_name, // Slug title of the setting.
310-
$key, // Suffix-ID for the error message box. WordPress prepends `setting-error-`.
311-
/* translators: 1: Verification string from user input; 2: Service name. */
312-
sprintf( __( '%1$s does not seem to be a valid %2$s verification string. Please correct.', 'wordpress-seo' ), '<strong>' . esc_html( $meta ) . '</strong>', $service ), // The error message.
313-
'notice-error' // CSS class for the WP notice, either the legacy 'error' / 'updated' or the new `notice-*` ones.
314-
);
308+
309+
if ( function_exists( 'add_settings_error' ) ) {
310+
add_settings_error(
311+
$this->group_name, // Slug title of the setting.
312+
$key, // Suffix-ID for the error message box. WordPress prepends `setting-error-`.
313+
/* translators: 1: Verification string from user input; 2: Service name. */
314+
sprintf( __( '%1$s does not seem to be a valid %2$s verification string. Please correct.', 'wordpress-seo' ), '<strong>' . esc_html( $meta ) . '</strong>', $service ), // The error message.
315+
'notice-error' // CSS class for the WP notice, either the legacy 'error' / 'updated' or the new `notice-*` ones.
316+
);
317+
}
315318

316319
Yoast_Input_Validation::add_dirty_value_to_settings_errors( $key, $meta );
317320
}
@@ -414,16 +417,19 @@ public function validate_facebook_app_id( $key, $dirty, $old, &$clean ) {
414417
if ( isset( $old[ $key ] ) && $old[ $key ] !== '' ) {
415418
$clean[ $key ] = $old[ $key ];
416419
}
417-
add_settings_error(
418-
$this->group_name, // Slug title of the setting.
419-
$key, // Suffix-ID for the error message box. WordPress prepends `setting-error-`.
420-
sprintf(
420+
421+
if ( function_exists( 'add_settings_error' ) ) {
422+
add_settings_error(
423+
$this->group_name, // Slug title of the setting.
424+
$key, // Suffix-ID for the error message box. WordPress prepends `setting-error-`.
425+
sprintf(
421426
/* translators: %s expands to an invalid Facebook App ID. */
422-
__( '%s does not seem to be a valid Facebook App ID. Please correct.', 'wordpress-seo' ),
423-
'<strong>' . esc_html( $dirty[ $key ] ) . '</strong>'
424-
), // The error message.
425-
'notice-error' // CSS class for the WP notice, either the legacy 'error' / 'updated' or the new `notice-*` ones.
426-
);
427+
__( '%s does not seem to be a valid Facebook App ID. Please correct.', 'wordpress-seo' ),
428+
'<strong>' . esc_html( $dirty[ $key ] ) . '</strong>'
429+
), // The error message.
430+
'notice-error' // CSS class for the WP notice, either the legacy 'error' / 'updated' or the new `notice-*` ones.
431+
);
432+
}
427433

428434
Yoast_Input_Validation::add_dirty_value_to_settings_errors( $key, $dirty[ $key ] );
429435
}

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@
103103
"@wordpress/is-shallow-equal": "^1.2.0",
104104
"@wordpress/rich-text": "^3.2.2",
105105
"@wordpress/url": "^2.5.0",
106-
"@yoast/algolia-search-box": "^1.5.0-rc.0",
107-
"@yoast/analysis-report": "^0.6.0-rc.0",
108-
"@yoast/components": "^0.6.0-rc.0",
109-
"@yoast/configuration-wizard": "^1.5.0-rc.0",
110-
"@yoast/helpers": "^0.4.0-rc.2",
111-
"@yoast/search-metadata-previews": "^1.8.0-rc.0",
112-
"@yoast/style-guide": "^0.4.0-rc.1",
106+
"@yoast/algolia-search-box": "^1.6.0-rc.0",
107+
"@yoast/analysis-report": "^0.7.0-rc.0",
108+
"@yoast/components": "^0.7.0-rc.0",
109+
"@yoast/configuration-wizard": "^1.6.0-rc.0",
110+
"@yoast/helpers": "^0.5.0-rc.0",
111+
"@yoast/search-metadata-previews": "^1.9.0-rc.0",
112+
"@yoast/style-guide": "^0.5.0-rc.0",
113113
"a11y-speak": "git+https://github.com/Yoast/a11y-speak.git#master",
114114
"babel-polyfill": "^6.26.0",
115115
"draft-js": "^0.10.5",
@@ -132,10 +132,10 @@
132132
"redux-thunk": "^2.2.0",
133133
"select2": "^4.0.5",
134134
"styled-components": "^4.2.0",
135-
"yoast-components": "^4.32.0-rc.0",
136-
"yoastseo": "^1.59.0-rc.0"
135+
"yoast-components": "^4.33.0-rc.0",
136+
"yoastseo": "^1.60.0-rc.0"
137137
},
138138
"yoast": {
139-
"pluginVersion": "12.1-RC4"
139+
"pluginVersion": "12.2-RC1"
140140
}
141141
}

0 commit comments

Comments
 (0)