コード例 #1
0
 /**
  * Singleton Pattern.
  *
  * @since 1.0.0
  *
  * @return WooCommerceWholeSalePrices
  */
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Text Domain:    woocommerce-wholesale-prices
*/

// This file is the main plugin boot loader

/**
 * Check if WooCommerce is active
 **/
if ( in_array( 'woocommerce/woocommerce.php' , apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {

    // Include Necessary Files
    require_once ( 'woocommerce-wholesale-prices.options.php' );
    require_once ( 'woocommerce-wholesale-prices.plugin.php' );

    // Get Instance of Main Plugin Class
    $wc_wholesale_prices = WooCommerceWholeSalePrices::getInstance();
    $GLOBALS[ 'wc_wholesale_prices' ] = $wc_wholesale_prices;

    // Load Plugin Text Domain
    add_action( 'plugins_loaded' , array( $wc_wholesale_prices , 'loadPluginTextDomain' ) );

    // Register Activation Hook
    register_activation_hook( __FILE__ , array( $wc_wholesale_prices , 'init' ) );

    // Register Deactivation Hook
    register_deactivation_hook( __FILE__ , array( $wc_wholesale_prices , 'terminate' ) );

    //  Register AJAX Call Handlers
    add_action( 'init' , array( $wc_wholesale_prices , 'registerAJAXCAllHandlers' ) );

    // Load Backend CSS and JS