D, $this->thumbnailSize ) : ''; } /** * Returns the first image found in the post content. * * @since 4.0.0 * * @return string The image URL. */ private function getFirstImageInContent() { $cachedImage = $this->getCachedImage(); if ( $cachedImage ) { return $cachedImage; } $postContent = aioseo()->helpers->getPostContent( $this->post ); preg_match_all( '||i', $postContent, $matches ); // Ignore cover block background image - WP >= 5.7. if ( ! empty( $matches[0] ) && apply_filters( 'aioseo_social_image_ignore_cover_block', true, $this->post, $matches ) ) { foreach ( $matches[0] as $key => $match ) { if ( false !== stripos( $match, 'wp-block-cover__image-background' ) ) { unset( $matches[1][ $key ] ); } } } return ! empty( $matches[1] ) ? current( $matches[1] ) : ''; } /** * Returns the author avatar. * * @since 4.0.0 * * @return string The image URL. */ private function getAuthorAvatar() { $avatar = get_avatar( $this->post->post_author, 300 ); preg_match( "/src='(.*?)'/i", $avatar, $matches ); return ! empty( $matches[1] ) ? $matches[1] : ''; } /** * Returns the first available image. * * @since 4.0.0 * * @return string The image URL. */ private function getFirstAvailableImage() { // Disable the cache. $this->useCache = false; $image = $this->getCustomFieldImage(); if ( ! $image ) { $image = $this->getFeaturedImage(); } if ( ! $image ) { $image = $this->getFirstAttachedImage(); } if ( ! $image ) { $image = $this->getFirstImageInContent(); } if ( ! $image && 'twitter' === strtolower( $this->type ) ) { $image = aioseo()->options->social->twitter->homePage->image; } // Enable the cache. $this->useCache = true; return $image ? $image : aioseo()->options->social->facebook->homePage->image; } /** * Returns the image from a custom field. * * @since 4.0.0 * * @return string The image URL. */ private function getCustomFieldImage() { $cachedImage = $this->getCachedImage(); if ( $cachedImage ) { return $cachedImage; } $prefix = 'facebook' === strtolower( $this->type ) ? 'og_' : 'twitter_'; $aioseoPost = Models\Post::getPost( $this->post->ID ); $customFields = ! empty( $aioseoPost->{ $prefix . 'image_custom_fields' } ) ? $aioseoPost->{ $prefix . 'image_custom_fields' } : aioseo()->options->social->{$this->type}->general->customFieldImagePosts; if ( ! $customFields ) { return ''; } $customFields = explode( ',', $customFields ); foreach ( $customFields as $customField ) { $image = get_post_meta( $this->post->ID, $customField, true ); if ( ! empty( $image ) ) { return is_numeric( $image ) ? wp_get_attachment_image_src( $image, $this->thumbnailSize ) : $image; } } return ''; } /** * Returns the cached image if there is one. * * @since 4.1.6.2 * * @param \WP_Term $object The object for which we need to get the cached image. * @return string|array The image URL or data. */ protected function getCachedImage( $object = null ) { if ( null === $object ) { // This isn't null if we call it from the Pro class. $object = $this->post; } $metaData = aioseo()->meta->metaData->getMetaData( $object ); switch ( $this->type ) { case 'facebook': if ( ! empty( $metaData->og_image_url ) && $this->useCache ) { return aioseo()->meta->metaData->getCachedOgImage( $metaData ); } break; case 'twitter': if ( ! empty( $metaData->twitter_image_url ) && $this->useCache ) { return $metaData->twitter_image_url; } break; default: break; } return ''; } }
Fatal error: Uncaught Error: Class "AIOSEO\Plugin\Common\Social\Image" not found in /htdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Social/Social.php:68 Stack trace: #0 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(299): AIOSEO\Plugin\Common\Social\Social->__construct() #1 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(97): AIOSEO\Plugin\AIOSEO->load() #2 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(76): AIOSEO\Plugin\AIOSEO->init() #3 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(414): AIOSEO\Plugin\AIOSEO::instance() #4 /htdocs/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php(96): aioseo() #5 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...') #6 /htdocs/wp-config.php(85): 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/all-in-one-seo-pack/app/Common/Social/Social.php on line 68