PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.7
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.7
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / plugins-tab / domain / plugin-detector.php

plugin-detector.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.7, at src/plugins-tab/domain/plugin-detector.php

40 lines 1011 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
4 namespace Yoast\WP\SEO\Plugins_Tab\Domain;
5
6 /**
7 * Detects whether a plugin is a Yoast plugin by checking its author information.
8 */
9 class Plugin_Detector {
10
11 /**
12 * The string to look for in the plugin's AuthorName field.
13 *
14 * @var string
15 */
16 public const AUTHOR_IDENTIFIER = 'Team Yoast';
17
18 /**
19 * The minimum number of Yoast plugins required to show the tab.
20 *
21 * @var int
22 */
23 public const MINIMUM_FOR_TAB = 2;
24
25 /**
26 * Checks whether a plugin is a Yoast plugin based on its author data.
27 *
28 * @param array<string, string> $plugin_data The plugin data array.
29 *
30 * @return bool Whether the plugin is a Yoast plugin.
31 */
32 public function is_yoast_plugin( array $plugin_data ): bool {
33 if ( ! isset( $plugin_data['AuthorName'] ) || ! \is_string( $plugin_data['AuthorName'] ) ) {
34 return false;
35 }
36
37 return \str_contains( $plugin_data['AuthorName'], self::AUTHOR_IDENTIFIER );
38 }
39 }
40