layer_url' ) ); $size = Helper::get_post_meta( 'twitter_player_size' ); if ( $size ) { $size = Arr::from_string( $size, 'x' ); if ( isset( $size[1] ) ) { $twitter_meta['twitter:player:width'] = (int) $size[0]; $twitter_meta['twitter:player:height'] = (int) $size[1]; } } $this->tag( 'twitter:player:stream', Helper::get_post_meta( 'twitter_player_stream' ) ); $this->tag( 'twitter:player:stream:content_type', Helper::get_post_meta( 'twitter_player_stream_ctype' ) ); } /** * Output the title. */ public function title() { $this->tag( 'twitter:title', trim( $this->get_title() ) ); } /** * Output the description. */ public function description() { $this->tag( 'twitter:description', trim( $this->get_description() ) ); } /** * Output the Twitter account for the site. */ public function website() { $this->site = Helper::get_settings( 'titles.twitter_author_names' ); if ( Str::is_non_empty( $this->site ) ) { $this->tag( 'twitter:site', '@' . $this->site ); } } /** * Output the image for Twitter. * * Only used when OpenGraph is inactive or Summary Large Image card is chosen. */ public function image() { $images = new Image( false, $this ); foreach ( $images->get_images() as $image_url => $image_meta ) { $overlay = $this->get_overlay_image( $this->prefix ); if ( $overlay && ! empty( $image_meta['id'] ) ) { $secret = $images->generate_secret( $image_meta['id'], $overlay ); $image_url = admin_url( "admin-ajax.php?action=rank_math_overlay_thumb&id={$image_meta['id']}&type={$overlay}&hash={$secret}" ); } $this->tag( 'twitter:image', esc_url_raw( $image_url ) ); } } /** * Outputs the authors twitter handle. */ public function article_author() { $author = Helper::get_user_meta( 'twitter_author', $GLOBALS['post']->post_author ); $author = $author ? $author : get_user_meta( $GLOBALS['post']->post_author, 'twitter', true ); $author = $this->get_twitter_id( ltrim( trim( $author ), '@' ) ); if ( Str::is_non_empty( $author ) ) { $this->tag( 'twitter:creator', '@' . $author ); } elseif ( Str::is_non_empty( $this->site ) ) { $this->tag( 'twitter:creator', '@' . $this->site ); } } /** * Determines the twitter card type for the current page */ private function determine_card_type() { $this->type = Helper::get_post_meta( 'twitter_card_type' ); $this->type = $this->type ? $this->type : Helper::get_settings( 'titles.twitter_card_type' ); /** * Allow changing the Twitter Card type as output in the Twitter card. * * @param string $this->type */ $this->type = $this->do_filter( 'opengraph/twitter/card_type', $this->type ); } /** * Determines whether the card type is of a type currently allowed by Twitter * * @link https://dev.twitter.com/cards/types */ private function sanitize_card_type() { if ( ! in_array( $this->type, [ 'summary', 'summary_large_image', 'app', 'player' ], true ) ) { $this->type = 'summary'; } } /** * Checks if the given ID is actually an ID or a URL and if URL, distills the ID from it. * * Solves issues with filters returning URLs and theme's/other plugins also adding a user meta * twitter field which expects URL rather than an ID (which is what we expect). * * @param string $id Twitter ID or URL. * * @return string|bool Twitter ID or false if it failed to get a valid Twitter ID. */ private function get_twitter_id( $id ) { if ( preg_match( '`([A-Za-z0-9_]{1,25})$`', $id, $match ) ) { return $match[1]; } return false; } /** * Remove archive tags. */ private function remove_tags() { $this->remove_action( 'rank_math/opengraph/twitter', 'title', 10 ); $this->remove_action( 'rank_math/opengraph/twitter', 'description', 11 ); $this->remove_action( 'rank_math/opengraph/twitter', 'image', 30 ); } }
Fatal error: Uncaught Error: Class "RankMath\OpenGraph\Twitter" not found in /htdocs/le-blog.fr/wp-content/plugins/seo-by-rank-math/includes/frontend/class-frontend.php:96 Stack trace: #0 /htdocs/le-blog.fr/wp-includes/class-wp-hook.php(341): RankMath\Frontend\Frontend->integrations(Object(WP)) #1 /htdocs/le-blog.fr/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #2 /htdocs/le-blog.fr/wp-includes/plugin.php(570): WP_Hook->do_action(Array) #3 /htdocs/le-blog.fr/wp-includes/class-wp.php(838): do_action_ref_array('wp', Array) #4 /htdocs/le-blog.fr/wp-includes/functions.php(1343): WP->main('') #5 /htdocs/le-blog.fr/wp-blog-header.php(16): wp() #6 /htdocs/le-blog.fr/index.php(17): require('/htdocs/le-blog...') #7 {main} thrown in /htdocs/le-blog.fr/wp-content/plugins/seo-by-rank-math/includes/frontend/class-frontend.php on line 96