Skip to content

Commit 4ab6b5a

Browse files
committed
Merge pull request facebookarchive#278 from niallkennedy/conflicts
remove array of potentially conflicting plugins
2 parents 079ead5 + b0265a0 commit 4ab6b5a

File tree

2 files changed

+18
-157
lines changed

2 files changed

+18
-157
lines changed

conflicting-plugins.php

-149
This file was deleted.

fb-admin-menu.php

+18-8
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ function fb_insights_page() {
3030
* with the Facebook plugin (due to Open Graph).
3131
*/
3232
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+
) );
3342

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 ) )
3845
return;
3946

4047
//fetch activated plugins
@@ -44,19 +51,22 @@ function fb_notify_user_of_plugin_conflicts() {
4451

4552
// iterate through activated plugins, checking if they are in the list of conflict plugins
4653
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+
4858
$plugin_uri = $plugin_data['PluginURI'];
4959

5060
if( $plugin_uri === 'http://wordpress.org/extend/plugins/facebook/' )
5161
continue;
52-
53-
if( in_array( $plugin_uri, $og_conflicting_plugins_static, true ) )
62+
63+
if( in_array( $plugin_uri, $og_conflicting_plugins, true ) )
5464
$conflicting_plugins[] = $plugin_data['Name'];
5565
}
5666

5767
//if there are more than 1 plugins relying on Open Graph, warn the user on this plugins page
5868
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);
6070
}
6171
}
6272
add_action( 'fb_notify_plugin_conflicts', 'fb_notify_user_of_plugin_conflicts' );

0 commit comments

Comments
 (0)