PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.6 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 All 130 releases
← All changes | inc/options/class-wpseo-option-social.php +9 -24 19.0 → trunk View file →
@@ -44,8 +44,9 @@
44 44 'twitter_card_type' => 'summary_large_image',
45 45 'youtube_url' => '',
46 46 'wikipedia_url' => '',
47 47 'other_social_urls' => [],
48 + 'mastodon_url' => '',
48 49 ];
49 50
50 51 /**
51 52 * Array of sub-options which should not be overloaded with multi-site defaults.
@@ -68,10 +69,10 @@
68 69 *
69 70 * @var array
70 71 */
71 72 public static $twitter_card_types = [
72 - 'summary' => '',
73 73 'summary_large_image' => '',
74 + // 'summary' => '',
74 75 // 'photo' => '',
75 76 // 'gallery' => '',
76 77 // 'app' => '',
77 78 // 'player' => '',
@@ -105,10 +106,9 @@
105 106 *
106 107 * @return void
107 108 */
108 109 public function translate_defaults() {
109 - self::$twitter_card_types['summary'] = __( 'Summary', 'wordpress-seo' );
110 - self::$twitter_card_types['summary_large_image'] = __( 'Summary with large image', 'wordpress-seo' );
110 + self::$twitter_card_types['summary_large_image'] = 'Summary with large image';
111 111 }
112 112
113 113 /**
114 114 * Validate the option.
@@ -151,8 +151,9 @@
151 151 case 'og_default_image':
152 152 case 'og_frontpage_image':
153 153 case 'youtube_url':
154 154 case 'wikipedia_url':
155 + case 'mastodon_url':
155 156 $this->validate_url( $key, $dirty, $old, $clean );
156 157 break;
157 158
158 159 case 'pinterestverify':
@@ -166,27 +167,13 @@
166 167
167 168 if ( $twitter_id ) {
168 169 $clean[ $key ] = $twitter_id;
169 170 }
170 - else {
171 - if ( isset( $old[ $key ] ) && $old[ $key ] !== '' ) {
171 + elseif ( isset( $old[ $key ] ) && $old[ $key ] !== '' ) {
172 172 $twitter_id = sanitize_text_field( ltrim( $old[ $key ], '@' ) );
173 - if ( preg_match( '`^[A-Za-z0-9_]{1,25}$`', $twitter_id ) ) {
174 - $clean[ $key ] = $twitter_id;
175 - }
173 + if ( preg_match( '`^[A-Za-z0-9_]{1,25}$`', $twitter_id ) ) {
174 + $clean[ $key ] = $twitter_id;
176 175 }
177 - if ( function_exists( 'add_settings_error' ) ) {
178 - add_settings_error(
179 - $this->group_name, // Slug title of the setting.
180 - $key, // Suffix-ID for the error message box.
181 - sprintf(
182 - /* translators: %s expands to a twitter user name. */
183 - __( '%s does not seem to be a valid Twitter Username. Please correct.', 'wordpress-seo' ),
184 - '<strong>' . esc_html( sanitize_text_field( $dirty[ $key ] ) ) . '</strong>'
185 - ), // The error message.
186 - 'error' // Message type.
187 - );
188 - }
189 176 }
190 177 unset( $twitter_id );
191 178
192 179 Yoast_Input_Validation::add_dirty_value_to_settings_errors( $key, $dirty[ $key ] );
@@ -254,10 +241,9 @@
254 241 *
255 242 * @return string|false The validated URL or false if the URL is not valid.
256 243 */
257 244 public function validate_social_url( $url ) {
258 - $submitted_url = trim( htmlspecialchars( $url, ENT_COMPAT, get_bloginfo( 'charset' ), true ) );
259 - $validated_url = filter_var( WPSEO_Utils::sanitize_url( $submitted_url ), FILTER_VALIDATE_URL );
245 + $validated_url = filter_var( WPSEO_Utils::sanitize_url( trim( $url ) ), FILTER_VALIDATE_URL );
260 246
261 247 return $validated_url;
262 248 }
263 249
@@ -284,9 +270,9 @@
284 270 if ( preg_match( '`^[A-Za-z0-9_]{1,25}$`', $twitter_id ) ) {
285 271 return $twitter_id;
286 272 }
287 273
288 - if ( preg_match( '`^http(?:s)?://(?:www\.)?twitter\.com/(?P<handle>[A-Za-z0-9_]{1,25})/?$`', $twitter_id, $matches ) ) {
274 + if ( preg_match( '`^http(?:s)?://(?:www\.)?(?:twitter|x)\.com/(?P<handle>[A-Za-z0-9_]{1,25})/?$`', $twitter_id, $matches ) ) {
289 275 return $matches['handle'];
290 276 }
291 277
292 278 return false;
@@ -329,9 +315,8 @@
329 315 }
330 316 unset( $move, $key );
331 317 }
332 318 unset( $old_option );
333 -
334 319
335 320 return $option_value;
336 321 }
337 322 }