PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | admin/class-yoast-input-validation.php +27 -101 18.228.5 View file →
@@ -16,9 +16,9 @@
16 16 * The error descriptions.
17 17 *
18 18 * @since 12.1
19 19 *
20 - * @var array
20 + * @var array<string, string>
21 21 */
22 22 private static $error_descriptions = [];
23 23
24 24 /**
@@ -63,9 +63,9 @@
63 63 return sprintf(
64 64 /* translators: %1$s: amount of errors, %2$s: the admin page title */
65 65 _n( 'The form contains %1$s error. %2$s', 'The form contains %1$s errors. %2$s', $error_count, 'wordpress-seo' ),
66 66 number_format_i18n( $error_count ),
67 - $admin_title
67 + $admin_title,
68 68 );
69 69 }
70 70
71 71 return $admin_title;
@@ -94,96 +94,33 @@
94 94
95 95 /**
96 96 * Sets the error descriptions.
97 97 *
98 - * @since 12.1
98 + * @since 12.1
99 + * @deprecated 23.3
100 + * @codeCoverageIgnore
99 101 *
100 - * @param array $descriptions An associative array of error descriptions.
101 - * For each entry, the key must be the setting variable.
102 + * @param array<string, string> $descriptions An associative array of error descriptions.
103 + * For each entry, the key must be the setting variable.
104 + *
105 + * @return void
102 106 */
103 - public static function set_error_descriptions( $descriptions = [] ) {
104 - $defaults = [
105 - 'baiduverify' => sprintf(
106 - /* translators: %s: additional message with the submitted invalid value */
107 - esc_html__( 'Baidu verification codes can only contain letters, numbers, hyphens, and underscores. %s', 'wordpress-seo' ),
108 - self::get_dirty_value_message( 'baiduverify' )
109 - ),
110 - 'facebook_site' => sprintf(
111 - /* translators: %s: additional message with the submitted invalid value */
112 - esc_html__( 'Please check the format of the Facebook Page URL you entered. %s', 'wordpress-seo' ),
113 - self::get_dirty_value_message( 'facebook_site' )
114 - ),
115 - 'googleverify' => sprintf(
116 - /* translators: %s: additional message with the submitted invalid value */
117 - esc_html__( 'Google verification codes can only contain letters, numbers, hyphens, and underscores. %s', 'wordpress-seo' ),
118 - self::get_dirty_value_message( 'googleverify' )
119 - ),
120 - 'instagram_url' => sprintf(
121 - /* translators: %s: additional message with the submitted invalid value */
122 - esc_html__( 'Please check the format of the Instagram URL you entered. %s', 'wordpress-seo' ),
123 - self::get_dirty_value_message( 'instagram_url' )
124 - ),
125 - 'linkedin_url' => sprintf(
126 - /* translators: %s: additional message with the submitted invalid value */
127 - esc_html__( 'Please check the format of the Linkedin URL you entered. %s', 'wordpress-seo' ),
128 - self::get_dirty_value_message( 'linkedin_url' )
129 - ),
130 - 'msverify' => sprintf(
131 - /* translators: %s: additional message with the submitted invalid value */
132 - esc_html__( 'Bing confirmation codes can only contain letters from A to F, numbers, hyphens, and underscores. %s', 'wordpress-seo' ),
133 - self::get_dirty_value_message( 'msverify' )
134 - ),
135 - 'myspace_url' => sprintf(
136 - /* translators: %s: additional message with the submitted invalid value */
137 - esc_html__( 'Please check the format of the MySpace URL you entered. %s', 'wordpress-seo' ),
138 - self::get_dirty_value_message( 'myspace_url' )
139 - ),
140 - 'pinterest_url' => sprintf(
141 - /* translators: %s: additional message with the submitted invalid value */
142 - esc_html__( 'Please check the format of the Pinterest URL you entered. %s', 'wordpress-seo' ),
143 - self::get_dirty_value_message( 'pinterest_url' )
144 - ),
145 - 'pinterestverify' => sprintf(
146 - /* translators: %s: additional message with the submitted invalid value */
147 - esc_html__( 'Pinterest confirmation codes can only contain letters from A to F, numbers, hyphens, and underscores. %s', 'wordpress-seo' ),
148 - self::get_dirty_value_message( 'pinterestverify' )
149 - ),
150 - 'twitter_site' => sprintf(
151 - /* translators: %s: additional message with the submitted invalid value */
152 - esc_html__( 'Twitter usernames can only contain letters, numbers, and underscores. %s', 'wordpress-seo' ),
153 - self::get_dirty_value_message( 'twitter_site' )
154 - ),
155 - 'wikipedia_url' => sprintf(
156 - /* translators: %s: additional message with the submitted invalid value */
157 - esc_html__( 'Please check the format of the Wikipedia URL you entered. %s', 'wordpress-seo' ),
158 - self::get_dirty_value_message( 'wikipedia_url' )
159 - ),
160 - 'yandexverify' => sprintf(
161 - /* translators: %s: additional message with the submitted invalid value */
162 - esc_html__( 'Yandex confirmation codes can only contain letters from A to F, numbers, hyphens, and underscores. %s', 'wordpress-seo' ),
163 - self::get_dirty_value_message( 'yandexverify' )
164 - ),
165 - 'youtube_url' => sprintf(
166 - /* translators: %s: additional message with the submitted invalid value */
167 - esc_html__( 'Please check the format of the Youtube URL you entered. %s', 'wordpress-seo' ),
168 - self::get_dirty_value_message( 'youtube_url' )
169 - ),
170 - ];
171 -
172 - $descriptions = wp_parse_args( $descriptions, $defaults );
173 -
174 - self::$error_descriptions = $descriptions;
107 + public static function set_error_descriptions( $descriptions = [] ) { // @phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable, Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Needed for BC.
108 + _deprecated_function( __METHOD__, 'Yoast SEO 23.3' );
175 109 }
176 110
177 111 /**
178 112 * Gets all the error descriptions.
179 113 *
180 - * @since 12.1
114 + * @since 12.1
115 + * @deprecated 23.3
116 + * @codeCoverageIgnore
181 117 *
182 - * @return array An associative array of error descriptions.
118 + * @return array<string, string> An associative array of error descriptions.
183 119 */
184 120 public static function get_error_descriptions() {
185 - return self::$error_descriptions;
121 + _deprecated_function( __METHOD__, 'Yoast SEO 23.3' );
122 + return [];
186 123 }
187 124
188 125 /**
189 126 * Gets a specific error description.
@@ -282,23 +219,18 @@
282 219
283 220 /**
284 221 * Gets an invalid submitted value.
285 222 *
286 - * @since 12.1
223 + * @since 12.1
224 + * @deprecated 23.3
225 + * @codeCoverageIgnore
287 226 *
288 227 * @param string $error_code Code of the error set via `add_settings_error()`, normally the variable name.
289 228 *
290 229 * @return string The submitted invalid input field value.
291 230 */
292 - public static function get_dirty_value( $error_code ) {
293 - $errors = get_settings_errors();
294 -
295 - foreach ( $errors as $error ) {
296 - if ( $error['code'] === $error_code && isset( $error['yoast_dirty_value'] ) ) {
297 - return $error['yoast_dirty_value'];
298 - }
299 - }
300 -
231 + public static function get_dirty_value( $error_code ) { // @phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable, Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Needed for BC.
232 + _deprecated_function( __METHOD__, 'Yoast SEO 23.3' );
301 233 return '';
302 234 }
303 235
304 236 /**
@@ -303,24 +235,18 @@
303 235
304 236 /**
305 237 * Gets a specific invalid value message.
306 238 *
307 - * @since 12.1
239 + * @since 12.1
240 + * @deprecated 23.3
241 + * @codeCoverageIgnore
308 242 *
309 243 * @param string $error_code Code of the error set via `add_settings_error()`, normally the variable name.
310 244 *
311 245 * @return string The error invalid value message or empty string.
312 246 */
313 - public static function get_dirty_value_message( $error_code ) {
314 - $dirty_value = self::get_dirty_value( $error_code );
315 -
316 - if ( $dirty_value ) {
317 - return sprintf(
318 - /* translators: %s: form value as submitted. */
319 - esc_html__( 'The submitted value was: %s', 'wordpress-seo' ),
320 - esc_html( $dirty_value )
321 - );
322 - }
247 + public static function get_dirty_value_message( $error_code ) { // @phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable, Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Needed for BC.
248 + _deprecated_function( __METHOD__, 'Yoast SEO 23.3' );
323 249
324 250 return '';
325 251 }
326 252 }