$post = aioseo()->helpers->getPost(); $metaData = aioseo()->meta->metaData->getMetaData(); if ( ! empty( $metaData->keywords ) ) { $keywords = $this->extractMetaKeywords( $metaData->keywords ); } if ( $post ) { if ( aioseo()->options->searchAppearance->advanced->useTagsForMetaKeywords ) { $keywords = array_merge( $keywords, aioseo()->helpers->getAllTags( $post->ID ) ); } if ( aioseo()->options->searchAppearance->advanced->useCategoriesForMetaKeywords && ! is_page() ) { $keywords = array_merge( $keywords, aioseo()->helpers->getAllCategories( $post->ID ) ); } } return $keywords; } /** * Prepares the keywords for display. * * @since 4.0.0 * * @param array $keywords Raw keywords. * @return string A list of prepared keywords, comma-separated. */ protected function prepareKeywords( $keywords ) { $keywords = $this->getUniqueKeywords( $keywords ); $keywords = trim( $keywords ); $keywords = aioseo()->helpers->internationalize( $keywords ); $keywords = stripslashes( $keywords ); $keywords = str_replace( '"', '', $keywords ); $keywords = wp_filter_nohtml_kses( $keywords ); return apply_filters( 'aioseo_keywords', $keywords ); } /** * Returns an array of keywords, based on a stringified list separated by commas. * * @since 4.0.0 * * @param string $keywords The keywords string. * @return array The keywords. */ public function keywordStringToList( $keywords ) { $keywords = str_replace( '"', '', $keywords ); return ! empty( $keywords ) ? explode( ',', $keywords ) : []; } /** * Returns a stringified list of unique keywords, separated by commas. * * @since 4.0.0 * * @param array $keywords The keywords. * @param boolean $toString Whether or not to turn it into a comma separated string. * @return string The keywords string. */ public function getUniqueKeywords( $keywords, $toString = true ) { $keywords = $this->keywordsToLowerCase( $keywords ); return $toString ? implode( ',', $keywords ) : $keywords; } /** * Returns the keywords in lowercase. * * @since 4.0.0 * * @param array $keywords The keywords. * @return array The formatted keywords. */ private function keywordsToLowerCase( $keywords ) { $smallKeywords = []; if ( ! is_array( $keywords ) ) { $keywords = $this->keywordStringToList( $keywords ); } if ( ! empty( $keywords ) ) { foreach ( $keywords as $keyword ) { $smallKeywords[] = trim( aioseo()->helpers->toLowercase( $keyword ) ); } } return array_unique( $smallKeywords ); } /** * Extract keywords and then return as a string. * * @since 4.0.0 * * @param array|string $keywords An array of keywords or a json string. * @return array An array of keywords that were extracted. */ public function extractMetaKeywords( $keywords ) { $extracted = []; $keywords = is_string( $keywords ) ? json_decode( $keywords ) : $keywords; if ( ! empty( $keywords ) ) { foreach ( $keywords as $keyword ) { $extracted[] = trim( $keyword->value ); } } return $extracted; } }
Fatal error: Uncaught Error: Class "AIOSEO\Plugin\Common\Meta\Keywords" not found in /htdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Meta/Meta.php:71 Stack trace: #0 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(298): AIOSEO\Plugin\Common\Meta\Meta->__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/Meta/Meta.php on line 71