PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.3
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 / admin / class-plugin-conflict.php

class-plugin-conflict.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.3, at admin/class-plugin-conflict.php

93 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin
6 * @since 1.7.0
7 */
8
9 use Yoast\WP\SEO\Config\Conflicting_Plugins;
10
11 /**
12 * Contains list of conflicting plugins.
13 */
14 class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {
15
16 /**
17 * The plugins must be grouped per section.
18 *
19 * It's possible to check for each section if there are conflicting plugin.
20 *
21 * NOTE: when changing this array, be sure to update the array in Conflicting_Plugins_Service too.
22 *
23 * @var array
24 */
25 protected $plugins = [
26 // The plugin which are writing OG metadata.
27 'open_graph' => Conflicting_Plugins::OPEN_GRAPH_PLUGINS,
28 'xml_sitemaps' => Conflicting_Plugins::XML_SITEMAPS_PLUGINS,
29 'cloaking' => Conflicting_Plugins::CLOAKING_PLUGINS,
30 'seo' => Conflicting_Plugins::SEO_PLUGINS,
31 ];
32
33 /**
34 * Overrides instance to set with this class as class.
35 *
36 * @param string $class_name Optional class name.
37 *
38 * @return Yoast_Plugin_Conflict
39 */
40 public static function get_instance( $class_name = __CLASS__ ) {
41 return parent::get_instance( $class_name );
42 }
43
44 /**
45 * After activating any plugin, this method will be executed by a hook.
46 *
47 * If the activated plugin is conflicting with ours a notice will be shown.
48 *
49 * @param string|bool $plugin Optional plugin basename to check.
50 */
51 public static function hook_check_for_plugin_conflicts( $plugin = false ) {
52 // The instance of the plugin.
53 $instance = self::get_instance();
54
55 // Only add the plugin as an active plugin if $plugin isn't false.
56 if ( $plugin && is_string( $plugin ) ) {
57 $instance->add_active_plugin( $instance->find_plugin_category( $plugin ), $plugin );
58 }
59
60 $plugin_sections = [];
61
62 // Only check for open graph problems when they are enabled.
63 if ( WPSEO_Options::get( 'opengraph' ) ) {
64 /* translators: %1$s expands to Yoast SEO, %2$s: 'Facebook' plugin name of possibly conflicting plugin with regard to creating OpenGraph output. */
65 $plugin_sections['open_graph'] = __( 'Both %1$s and %2$s create Open Graph output, which might make Facebook, Twitter, LinkedIn and other social networks use the wrong texts and images when your pages are being shared.', 'wordpress-seo' )
66 . '<br/><br/>'
67 . '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_social#top#facebook' ) . '">'
68 /* translators: %1$s expands to Yoast SEO. */
69 . sprintf( __( 'Configure %1$s\'s Open Graph settings', 'wordpress-seo' ), 'Yoast SEO' )
70 . '</a>';
71 }
72
73 // Only check for XML conflicts if sitemaps are enabled.
74 if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
75 /* translators: %1$s expands to Yoast SEO, %2$s: 'Google XML Sitemaps' plugin name of possibly conflicting plugin with regard to the creation of sitemaps. */
76 $plugin_sections['xml_sitemaps'] = __( 'Both %1$s and %2$s can create XML sitemaps. Having two XML sitemaps is not beneficial for search engines and might slow down your site.', 'wordpress-seo' )
77 . '<br/><br/>'
78 . '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_dashboard#top#features' ) . '">'
79 /* translators: %1$s expands to Yoast SEO. */
80 . sprintf( __( 'Toggle %1$s\'s XML Sitemap', 'wordpress-seo' ), 'Yoast SEO' )
81 . '</a>';
82 }
83
84 /* translators: %2$s expands to 'RS Head Cleaner' plugin name of possibly conflicting plugin with regard to differentiating output between search engines and normal users. */
85 $plugin_sections['cloaking'] = __( 'The plugin %2$s changes your site\'s output and in doing that differentiates between search engines and normal users, a process that\'s called cloaking. We highly recommend that you disable it.', 'wordpress-seo' );
86
87 /* translators: %1$s expands to Yoast SEO, %2$s: 'SEO' plugin name of possibly conflicting plugin with regard to the creation of duplicate SEO meta. */
88 $plugin_sections['seo'] = __( 'Both %1$s and %2$s manage the SEO of your site. Running two SEO plugins at the same time is detrimental.', 'wordpress-seo' );
89
90 $instance->check_plugin_conflicts( $plugin_sections );
91 }
92 }
93