@@ -30,11 +30,18 @@ function fb_insights_page() {
30
30
* with the Facebook plugin (due to Open Graph).
31
31
*/
32
32
function fb_notify_user_of_plugin_conflicts () {
33
+ $ og_conflicting_plugins = apply_filters ( 'fb_conflicting_plugins ' , array (
34
+ 'http://wordpress.org/extend/plugins/facebook/ ' ,
35
+ 'http://wordpress.org/extend/plugins/opengraph/ ' ,
36
+ 'http://yoast.com/wordpress/seo/#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wpseoplugin ' ,
37
+ 'http://wordbooker.tty.org.uk ' ,
38
+ 'http://ottopress.com/wordpress-plugins/simple-facebook-connect/ ' ,
39
+ 'http://www.whiletrue.it ' ,
40
+ 'http://aaroncollegeman.com/sharepress '
41
+ ) );
33
42
34
- // store list of conflicts separately for cleaner data vs. logic
35
- include_once ( dirname (__FILE__ ) . '/conflicting-plugins.php ' );
36
-
37
- if ( empty ( $ og_conflicting_plugins_static ) )
43
+ // allow for short circuit
44
+ if ( ! is_array ( $ og_conflicting_plugins ) || empty ( $ og_conflicting_plugins ) )
38
45
return ;
39
46
40
47
//fetch activated plugins
@@ -44,19 +51,22 @@ function fb_notify_user_of_plugin_conflicts() {
44
51
45
52
// iterate through activated plugins, checking if they are in the list of conflict plugins
46
53
foreach ( $ plugins_list as $ val ) {
47
- $ plugin_data = get_plugin_data (WP_PLUGIN_DIR . '/ ' . $ val );
54
+ $ plugin_data = get_plugin_data ( WP_PLUGIN_DIR . '/ ' . $ val );
55
+ if ( ! ( array_key_exists ( 'PluginURI ' , $ plugin_data ) && array_key_exists ( 'Name ' , $ plugin_data ) ) )
56
+ continue ;
57
+
48
58
$ plugin_uri = $ plugin_data ['PluginURI ' ];
49
59
50
60
if ( $ plugin_uri === 'http://wordpress.org/extend/plugins/facebook/ ' )
51
61
continue ;
52
-
53
- if ( in_array ( $ plugin_uri , $ og_conflicting_plugins_static , true ) )
62
+
63
+ if ( in_array ( $ plugin_uri , $ og_conflicting_plugins , true ) )
54
64
$ conflicting_plugins [] = $ plugin_data ['Name ' ];
55
65
}
56
66
57
67
//if there are more than 1 plugins relying on Open Graph, warn the user on this plugins page
58
68
if ( ! empty ( $ conflicting_plugins ) ) {
59
- fb_admin_dialog ( sprintf ( __ ( 'You have plugins installed that could potentially conflict with the Facebook plugin. Please consider disabling the following plugins on the %s: ' , 'facebook ' ) . '<br /> ' . implode ( ', ' , $ conflicting_plugins ), '<a href="plugins.php" aria-label="Plugins 0" > ' . esc_html ( __ ( 'Plugins Settings page ' , 'facebook ' ) ) . '</a> ' ), true );
69
+ fb_admin_dialog ( sprintf ( __ ( 'You have plugins installed that could potentially conflict with the Facebook plugin. Please consider disabling the following plugins on the %s: ' , 'facebook ' ) . '<br /> ' . implode ( ', ' , $ conflicting_plugins ), '<a href="plugins.php"> ' . esc_html ( __ ( 'Plugins Settings page ' , 'facebook ' ) ) . '</a> ' ), true );
60
70
}
61
71
}
62
72
add_action ( 'fb_notify_plugin_conflicts ' , 'fb_notify_user_of_plugin_conflicts ' );
0 commit comments