class-plugin-conflict.php 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin
  6. * @since 1.7.0
  7. */
  8. /**
  9. * Contains list of conflicting plugins.
  10. */
  11. class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {
  12. /**
  13. * The plugins must be grouped per section.
  14. *
  15. * It's possible to check for each section if there are conflicting plugin
  16. *
  17. * @var array
  18. */
  19. protected $plugins = [
  20. // The plugin which are writing OG metadata.
  21. 'open_graph' => [
  22. '2-click-socialmedia-buttons/2-click-socialmedia-buttons.php',
  23. // 2 Click Social Media Buttons.
  24. 'add-link-to-facebook/add-link-to-facebook.php', // Add Link to Facebook.
  25. 'add-meta-tags/add-meta-tags.php', // Add Meta Tags.
  26. 'easy-facebook-share-thumbnails/esft.php', // Easy Facebook Share Thumbnail.
  27. 'facebook/facebook.php', // Facebook (official plugin).
  28. 'facebook-awd/AWD_facebook.php', // Facebook AWD All in one.
  29. 'facebook-featured-image-and-open-graph-meta-tags/fb-featured-image.php',
  30. // Facebook Featured Image & OG Meta Tags.
  31. 'facebook-meta-tags/facebook-metatags.php', // Facebook Meta Tags.
  32. 'wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php',
  33. // Facebook Open Graph Meta Tags for WordPress.
  34. 'facebook-revised-open-graph-meta-tag/index.php', // Facebook Revised Open Graph Meta Tag.
  35. 'facebook-thumb-fixer/_facebook-thumb-fixer.php', // Facebook Thumb Fixer.
  36. 'facebook-and-digg-thumbnail-generator/facebook-and-digg-thumbnail-generator.php',
  37. // Fedmich's Facebook Open Graph Meta.
  38. 'network-publisher/networkpub.php', // Network Publisher.
  39. 'nextgen-facebook/nextgen-facebook.php', // NextGEN Facebook OG.
  40. 'opengraph/opengraph.php', // Open Graph.
  41. 'open-graph-protocol-framework/open-graph-protocol-framework.php',
  42. // Open Graph Protocol Framework.
  43. 'seo-facebook-comments/seofacebook.php', // SEO Facebook Comments.
  44. 'sexybookmarks/sexy-bookmarks.php', // Shareaholic.
  45. 'shareaholic/sexy-bookmarks.php', // Shareaholic.
  46. 'sharepress/sharepress.php', // SharePress.
  47. 'simple-facebook-connect/sfc.php', // Simple Facebook Connect.
  48. 'social-discussions/social-discussions.php', // Social Discussions.
  49. 'social-sharing-toolkit/social_sharing_toolkit.php', // Social Sharing Toolkit.
  50. 'socialize/socialize.php', // Socialize.
  51. 'only-tweet-like-share-and-google-1/tweet-like-plusone.php',
  52. // Tweet, Like, Google +1 and Share.
  53. 'wordbooker/wordbooker.php', // Wordbooker.
  54. 'wpsso/wpsso.php', // WordPress Social Sharing Optimization.
  55. 'wp-caregiver/wp-caregiver.php', // WP Caregiver.
  56. 'wp-facebook-like-send-open-graph-meta/wp-facebook-like-send-open-graph-meta.php',
  57. // WP Facebook Like Send & Open Graph Meta.
  58. 'wp-facebook-open-graph-protocol/wp-facebook-ogp.php', // WP Facebook Open Graph protocol.
  59. 'wp-ogp/wp-ogp.php', // WP-OGP.
  60. 'zoltonorg-social-plugin/zosp.php', // Zolton.org Social Plugin.
  61. ],
  62. 'xml_sitemaps' => [
  63. 'google-sitemap-plugin/google-sitemap-plugin.php',
  64. // Google Sitemap (BestWebSoft).
  65. 'xml-sitemaps/xml-sitemaps.php',
  66. // XML Sitemaps (Denis de Bernardy and Mike Koepke).
  67. 'bwp-google-xml-sitemaps/bwp-simple-gxs.php',
  68. // Better WordPress Google XML Sitemaps (Khang Minh).
  69. 'google-sitemap-generator/sitemap.php',
  70. // Google XML Sitemaps (Arne Brachhold).
  71. 'xml-sitemap-feed/xml-sitemap.php',
  72. // XML Sitemap & Google News feeds (RavanH).
  73. 'google-monthly-xml-sitemap/monthly-xml-sitemap.php',
  74. // Google Monthly XML Sitemap (Andrea Pernici).
  75. 'simple-google-sitemap-xml/simple-google-sitemap-xml.php',
  76. // Simple Google Sitemap XML (iTx Technologies).
  77. 'another-simple-xml-sitemap/another-simple-xml-sitemap.php',
  78. // Another Simple XML Sitemap.
  79. 'xml-maps/google-sitemap.php',
  80. // Xml Sitemap (Jason Martens).
  81. 'google-xml-sitemap-generator-by-anton-dachauer/adachauer-google-xml-sitemap.php',
  82. // Google XML Sitemap Generator by Anton Dachauer (Anton Dachauer).
  83. 'wp-xml-sitemap/wp-xml-sitemap.php',
  84. // WP XML Sitemap (Team Vivacity).
  85. 'sitemap-generator-for-webmasters/sitemap.php',
  86. // Sitemap Generator for Webmasters (iwebslogtech).
  87. 'xml-sitemap-xml-sitemapcouk/xmls.php',
  88. // XML Sitemap - XML-Sitemap.co.uk (Simon Hancox).
  89. 'sewn-in-xml-sitemap/sewn-xml-sitemap.php',
  90. // Sewn In XML Sitemap (jcow).
  91. 'rps-sitemap-generator/rps-sitemap-generator.php',
  92. // RPS Sitemap Generator (redpixelstudios).
  93. ],
  94. 'cloaking' => [
  95. 'rs-head-cleaner/rs-head-cleaner.php',
  96. // RS Head Cleaner Plus https://wordpress.org/plugins/rs-head-cleaner/.
  97. 'rs-head-cleaner-lite/rs-head-cleaner-lite.php',
  98. // RS Head Cleaner Lite https://wordpress.org/plugins/rs-head-cleaner-lite/.
  99. ],
  100. 'seo' => [
  101. 'all-in-one-seo-pack/all_in_one_seo_pack.php', // All in One SEO Pack.
  102. 'seo-ultimate/seo-ultimate.php', // SEO Ultimate.
  103. ],
  104. ];
  105. /**
  106. * Overrides instance to set with this class as class.
  107. *
  108. * @param string $class_name Optional class name.
  109. *
  110. * @return Yoast_Plugin_Conflict
  111. */
  112. public static function get_instance( $class_name = __CLASS__ ) {
  113. return parent::get_instance( $class_name );
  114. }
  115. /**
  116. * After activating any plugin, this method will be executed by a hook.
  117. *
  118. * If the activated plugin is conflicting with ours a notice will be shown.
  119. *
  120. * @param string|bool $plugin Optional plugin basename to check.
  121. */
  122. public static function hook_check_for_plugin_conflicts( $plugin = false ) {
  123. // The instance of itself.
  124. $instance = self::get_instance();
  125. // Only add plugin as active plugin if $plugin isn't false.
  126. if ( $plugin && is_string( $plugin ) ) {
  127. // Because it's just activated.
  128. $instance->add_active_plugin( $instance->find_plugin_category( $plugin ), $plugin );
  129. }
  130. $plugin_sections = [];
  131. // Only check for open graph problems when they are enabled.
  132. if ( WPSEO_Options::get( 'opengraph' ) ) {
  133. /* translators: %1$s expands to Yoast SEO, %2$s: 'Facebook' plugin name of possibly conflicting plugin with regard to creating OpenGraph output. */
  134. $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' )
  135. . '<br/><br/>'
  136. . '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_social#top#facebook' ) . '">'
  137. /* translators: %1$s expands to Yoast SEO. */
  138. . sprintf( __( 'Configure %1$s\'s Open Graph settings', 'wordpress-seo' ), 'Yoast SEO' )
  139. . '</a>';
  140. }
  141. // Only check for XML conflicts if sitemaps are enabled.
  142. if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
  143. /* 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. */
  144. $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' )
  145. . '<br/><br/>'
  146. . '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_dashboard#top#features' ) . '">'
  147. /* translators: %1$s expands to Yoast SEO. */
  148. . sprintf( __( 'Toggle %1$s\'s XML Sitemap', 'wordpress-seo' ), 'Yoast SEO' )
  149. . '</a>';
  150. }
  151. /* 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. */
  152. $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' );
  153. /* 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. */
  154. $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' );
  155. $instance->check_plugin_conflicts( $plugin_sections );
  156. }
  157. }