/* Twitter user name. */ case 'twitter_site': if ( isset( $dirty[ $key ] ) && $dirty[ $key ] !== '' ) { $twitter_id = $this->validate_twitter_id( $dirty[ $key ] ); if ( $twitter_id ) { $clean[ $key ] = $twitter_id; } elseif ( isset( $old[ $key ] ) && $old[ $key ] !== '' ) { $twitter_id = sanitize_text_field( ltrim( $old[ $key ], '@' ) ); if ( preg_match( '`^[A-Za-z0-9_]{1,25}$`', $twitter_id ) ) { $clean[ $key ] = $twitter_id; } } unset( $twitter_id ); Yoast_Input_Validation::add_dirty_value_to_settings_errors( $key, $dirty[ $key ] ); } break; case 'twitter_card_type': if ( isset( $dirty[ $key ], self::$twitter_card_types[ $dirty[ $key ] ] ) && $dirty[ $key ] !== '' ) { $clean[ $key ] = $dirty[ $key ]; } break; /* Boolean fields. */ case 'opengraph': case 'twitter': $clean[ $key ] = ( isset( $dirty[ $key ] ) ? WPSEO_Utils::validate_bool( $dirty[ $key ] ) : false ); break; /* Array fields. */ case 'other_social_urls': if ( isset( $dirty[ $key ] ) ) { $items = $dirty[ $key ]; if ( ! is_array( $items ) ) { $items = json_decode( $dirty[ $key ], true ); } if ( is_array( $items ) ) { foreach ( $items as $item_key => $item ) { $validated_url = $this->validate_social_url( $item ); if ( $validated_url === false ) { // Restore the previous URL values, if any. $old_urls = ( isset( $old[ $key ] ) ) ? $old[ $key ] : []; foreach ( $old_urls as $old_item_key => $old_url ) { if ( $old_url !== '' ) { $url = WPSEO_Utils::sanitize_url( $old_url ); if ( $url !== '' ) { $clean[ $key ][ $old_item_key ] = $url; } } } break; } // The URL format is valid, let's sanitize it. $url = WPSEO_Utils::sanitize_url( $validated_url ); if ( $url !== '' ) { $clean[ $key ][ $item_key ] = $url; } } } } break; } } return $clean; } /** * Validates a social URL. * * @param string $url The url to be validated. * * @return string|false The validated URL or false if the URL is not valid. */ public function validate_social_url( $url ) { $validated_url = filter_var( WPSEO_Utils::sanitize_url( trim( $url ) ), FILTER_VALIDATE_URL ); return $validated_url; } /** * Validates a twitter id. * * @param string $twitter_id The twitter id to be validated. * @param bool $strip_at_sign Whether or not to strip the `@` sign. * * @return string|false The validated twitter id or false if it is not valid. */ public function validate_twitter_id( $twitter_id, $strip_at_sign = true ) { $twitter_id = ( $strip_at_sign ) ? sanitize_text_field( ltrim( $twitter_id, '@' ) ) : sanitize_text_field( $twitter_id ); /* * From the Twitter documentation about twitter screen names: * Typically a maximum of 15 characters long, but some historical accounts * may exist with longer names. * A username can only contain alphanumeric characters (letters A-Z, numbers 0-9) * with the exception of underscores. * * @link https://support.twitter.com/articles/101299-why-can-t-i-register-certain-usernames */ if ( preg_match( '`^[A-Za-z0-9_]{1,25}$`', $twitter_id ) ) { return $twitter_id; } if ( preg_match( '`^http(?:s)?://(?:www\.)?(?:twitter|x)\.com/(?P[A-Za-z0-9_]{1,25})/?$`', $twitter_id, $matches ) ) { return $matches['handle']; } return false; } /** * Clean a given option value. * * @param array $option_value Old (not merged with defaults or filtered) option value to * clean according to the rules for this option. * @param string|null $current_version Optional. Version from which to upgrade, if not set, * version specific upgrades will be disregarded. * @param array|null $all_old_option_values Optional. Only used when importing old options to have * access to the real old values, in contrast to the saved ones. * * @return array Cleaned option. */ protected function clean_option( $option_value, $current_version = null, $all_old_option_values = null ) { /* Move options from very old option to this one. */ $old_option = null; if ( isset( $all_old_option_values ) ) { // Ok, we have an import. if ( isset( $all_old_option_values['wpseo_indexation'] ) && is_array( $all_old_option_values['wpseo_indexation'] ) && $all_old_option_values['wpseo_indexation'] !== [] ) { $old_option = $all_old_option_values['wpseo_indexation']; } } else { $old_option = get_option( 'wpseo_indexation' ); } if ( is_array( $old_option ) && $old_option !== [] ) { $move = [ 'opengraph', ]; foreach ( $move as $key ) { if ( isset( $old_option[ $key ] ) && ! isset( $option_value[ $key ] ) ) { $option_value[ $key ] = $old_option[ $key ]; } } unset( $move, $key ); } unset( $old_option ); return $option_value; } }
Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class "WPSEO_Option_Social" not found in /htdocs/wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php:63 Stack trace: #0 /htdocs/wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php(86): WPSEO_Options->__construct() #1 /htdocs/wp-content/plugins/wordpress-seo/wp-seo-main.php(339): WPSEO_Options::get_instance() #2 /htdocs/wp-includes/class-wp-hook.php(324): wpseo_init('') #3 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #4 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /htdocs/wp-settings.php(555): do_action('plugins_loaded') #6 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #7 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #8 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #9 /htdocs/index.php(17): require('/htdocs/wp-blog...') #10 {main} thrown in /htdocs/wp-content/plugins/wordpress-seo/inc/options/class-wpseo-options.php on line 63