*/ public static function signatures() { return array( 'yoast' => array( 'name' => 'Yoast SEO', 'constant' => 'WPSEO_VERSION', 'basename' => 'wordpress-seo/wp-seo.php', ), 'rank-math' => array( 'name' => 'Rank Math SEO', 'constant' => 'RANK_MATH_VERSION', 'basename' => 'seo-by-rank-math/rank-math.php', ), 'aioseo' => array( 'name' => 'All in One SEO', 'constant' => 'AIOSEO_VERSION', 'basename' => 'all-in-one-seo-pack/all_in_one_seo_pack.php', ), 'seopress' => array( 'name' => 'SEOPress', 'constant' => 'SEOPRESS_VERSION', 'basename' => 'wp-seopress/seopress.php', ), 'tsf' => array( 'name' => 'The SEO Framework', 'constant' => 'THE_SEO_FRAMEWORK_VERSION', 'basename' => 'autodescription/autodescription.php', ), 'slim-seo' => array( 'name' => 'Slim SEO', 'constant' => 'SLIM_SEO_VER', 'basename' => 'slim-seo/slim-seo.php', ), 'smartcrawl' => array( 'name' => 'SmartCrawl', 'constant' => 'SMARTCRAWL_VERSION', 'basename' => 'smartcrawl-seo/wpmu-dev-seo.php', ), 'squirrly' => array( 'name' => 'Squirrly SEO', 'constant' => 'SQ_VERSION', 'basename' => 'squirrly-seo/squirrly.php', ), ); } /** * Active SEO plugins found, keyed by id, with the evidence for each. * * @return array */ public function detect() { $active = (array) get_option( 'active_plugins', array() ); if ( is_multisite() ) { $active = array_merge( $active, array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) ) ); } $found = array(); // Safe mode is decided on plugins_loaded; translations may only load from init on. $translate = did_action( 'init' ) > 0; foreach ( self::signatures() as $id => $sig ) { if ( defined( $sig['constant'] ) ) { $found[ $id ] = array( 'name' => $sig['name'], /* translators: %s: PHP constant name */ 'evidence' => sprintf( $translate ? __( 'Constant %s is defined.', 'orbitstem-seo' ) : 'Constant %s is defined.', $sig['constant'] ), ); } elseif ( in_array( $sig['basename'], $active, true ) ) { $found[ $id ] = array( 'name' => $sig['name'], /* translators: %s: plugin file path */ 'evidence' => sprintf( $translate ? __( 'Plugin %s is active.', 'orbitstem-seo' ) : 'Plugin %s is active.', $sig['basename'] ), ); } } /** * Filters the detected SEO plugins. * * @param array $found Detected plugins keyed by id. */ return apply_filters( 'orbitstem_seo_detected_seo_plugins', $found ); } /** * Whether any other SEO plugin is active. * * @return bool */ public function has_conflicts() { return array() !== $this->detect(); } }