WordPress.org

Plugin Directory

Changeset 484708


Ignore:
Timestamp:
01/04/12 21:03:16 (2 years ago)
Author:
ipublicis
Message:

Auto-deactivation when WPFR is not installed and active.

Location:
author-box-2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • author-box-2/tags/2.0.4/authorbox.php

    r484661 r484708  
    3030 * Check if the framework plugin is active 
    3131 */ 
    32 $plugins = get_option( 'active_plugins' ); 
    33 $required_plugin = 'wordpress-plugin-framework-reloaded/wordpress-plugin-framework-reloaded.php'; 
    34 if ( !in_array( $required_plugin , $plugins ) ) { 
    35     $wpfr = '<a href="http://wordpress.org/extend/plugins/wordpress-plugin-framework-reloaded/" target="_blank">Wordpress Plugin Framework Reloaded</a>'; 
    36     $dieMessage  = sprintf( __( 'The %s plugin must be installed and active.', 'author-box-2' ), $wpfr ); 
    37     $notice = "<div id=\"message\" class=\"error fade\"><p><strong>Author Box Reloaded</strong></p>". 
    38                     "<p>".$dieMessage."</p></div>\n"; 
    39     add_action( 'admin_notices', create_function( '', "echo '$notice';" ) ); 
    40 }  
     32if( is_admin() ) {  
     33    $required_plugin = 'wordpress-plugin-framework-reloaded/wordpress-plugin-framework-reloaded.php'; 
     34    include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
     35    if ( ! is_plugin_active( $required_plugin ) ) { 
     36        deactivate_plugins( plugin_basename( __FILE__ ) ); 
     37        $wpfr = '<a href="http://wordpress.org/extend/plugins/wordpress-plugin-framework-reloaded/" target="_blank">Wordpress Plugin Framework Reloaded</a>'; 
     38        $dieMessage  = sprintf( __( 'The %s plugin must be installed and active, so this plugin was also <strong>deactivated</strong>.', 'author-box-2' ), $wpfr ); 
     39        $notice = "<div id=\"message\" class=\"error fade\"><p><strong>Author Box Reloaded</strong></p>\n". 
     40                        "<p>".$dieMessage."</p>\n</p></div>\n"; 
     41        add_action( 'admin_notices', create_function( '', "echo '$notice';" ) ); 
     42    }  
     43} 
    4144 
    4245/** 
  • author-box-2/trunk/authorbox.php

    r484661 r484708  
    3030 * Check if the framework plugin is active 
    3131 */ 
    32 $plugins = get_option( 'active_plugins' ); 
    33 $required_plugin = 'wordpress-plugin-framework-reloaded/wordpress-plugin-framework-reloaded.php'; 
    34 if ( !in_array( $required_plugin , $plugins ) ) { 
    35     $wpfr = '<a href="http://wordpress.org/extend/plugins/wordpress-plugin-framework-reloaded/" target="_blank">Wordpress Plugin Framework Reloaded</a>'; 
    36     $dieMessage  = sprintf( __( 'The %s plugin must be installed and active.', 'author-box-2' ), $wpfr ); 
    37     $notice = "<div id=\"message\" class=\"error fade\"><p><strong>Author Box Reloaded</strong></p>". 
    38                     "<p>".$dieMessage."</p></div>\n"; 
    39     add_action( 'admin_notices', create_function( '', "echo '$notice';" ) ); 
    40 }  
     32if( is_admin() ) {  
     33    $required_plugin = 'wordpress-plugin-framework-reloaded/wordpress-plugin-framework-reloaded.php'; 
     34    include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
     35    if ( ! is_plugin_active( $required_plugin ) ) { 
     36        deactivate_plugins( plugin_basename( __FILE__ ) ); 
     37        $wpfr = '<a href="http://wordpress.org/extend/plugins/wordpress-plugin-framework-reloaded/" target="_blank">Wordpress Plugin Framework Reloaded</a>'; 
     38        $dieMessage  = sprintf( __( 'The %s plugin must be installed and active, so this plugin was also <strong>deactivated</strong>.', 'author-box-2' ), $wpfr ); 
     39        $notice = "<div id=\"message\" class=\"error fade\"><p><strong>Author Box Reloaded</strong></p>\n". 
     40                        "<p>".$dieMessage."</p>\n</p></div>\n"; 
     41        add_action( 'admin_notices', create_function( '', "echo '$notice';" ) ); 
     42    }  
     43} 
    4144 
    4245/** 
Note: See TracChangeset for help on using the changeset viewer.