Advertisement
polosatique

Untitled

Apr 13th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. /**
  2. *  Activation Class
  3. **/
  4. if ( ! class_exists( 'WC_CPInstallCheck' ) ) {
  5.   class WC_CPInstallCheck {
  6.         static function install() {
  7.             /**
  8.             * Check if WooCommerce & Cubepoints are active
  9.             **/
  10.             // !is_plugin_active('woocommerce/woocommerce.php')
  11.             if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ||
  12.                     !in_array( 'cubepoints/cubepoints.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
  13.                
  14.                 // Deactivate the plugin
  15.                 deactivate_plugins(__FILE__);
  16.                
  17.                 // Throw an error in the wordpress admin console
  18.                 $error_message = __('This plugin requires <a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce</a> &amp; <a href="http://wordpress.org/extend/plugins/cubepoints/">Cubepoints</a> plugins to be active!', 'woocommerce');
  19.                 die($error_message);
  20.                
  21.             }
  22.         }
  23.     }
  24. }
  25.  
  26. register_activation_hook( __FILE__, array('WC_CPInstallCheck', 'install') );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement