mbcreation

WooCommerce plugin skeleton

May 22nd, 2014
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Plugin Name: My WooCommerce Plugin
  5.  *
  6.  */
  7.  
  8.  
  9. if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
  10.  
  11.  
  12. /**
  13.  * My_WooCommerce_Plugin
  14.  *
  15.  * @since 1.0
  16.  */
  17.  
  18. if ( ! class_exists( 'My_WooCommerce_Plugin' ) ) {
  19.  
  20. class My_WooCommerce_Plugin {
  21.  
  22.         function __construct(){
  23.  
  24.             add_action('plugins_loaded', array(&$this, 'hooks') );
  25.             register_activation_hook( __FILE__ , array(&$this , 'install' ) );
  26.  
  27.         }
  28.  
  29.         public function hooks(){
  30.  
  31.             // Arrêter l'execution du plugin si WooCommerce n'exite plus.
  32.            
  33.             if( !class_exists( 'Woocommerce' ) )
  34.             return;
  35.  
  36.         }
  37.  
  38.         public function install(){
  39.  
  40.             // Ne pas installer le plugin si WooCommerce n'est pas installer.
  41.  
  42.             if( !class_exists( 'Woocommerce' ) )
  43.             wp_die('WooCommerce extension not found !');
  44.  
  45.         }
  46.  
  47.  
  48.  
  49.     }
  50.    
  51.     $load = new My_WooCommerce_Plugin();
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment