Example #1
0
function Wootan_init($file)
{
    require_once 'Wootan_Plugin.php';
    $aPlugin = new Wootan_Plugin();
    // Install the plugin
    // NOTE: this file gets run each time you *activate* the plugin.
    // So in WP when you "install" the plugin, all that does it dump its files in the plugin-templates directory
    // but it does not call any of its code.
    // So here, the plugin tracks whether or not it has run its install operation, and we ensure it is run only once
    // on the first activation
    if (!$aPlugin->isInstalled()) {
        $aPlugin->install();
    } else {
        // Perform any version-upgrade activities prior to activation (e.g. database changes)
        $aPlugin->upgrade();
    }
    // Add callbacks to hooks
    $aPlugin->addActionsAndFilters();
    if (!$file) {
        $file = __FILE__;
    }
    // Register the Plugin Activation Hook
    register_activation_hook($file, array(&$aPlugin, 'activate'));
    // Register the Plugin Deactivation Hook
    register_deactivation_hook($file, array(&$aPlugin, 'deactivate'));
}
 /**
  * Constructor.
  */
 public function __construct($instance_id = 0)
 {
     require_once 'Wootan_Plugin.php';
     if (WOOTAN_DEBUG) {
         error_log('wootan debugging enabled');
     }
     $this->tree = Lasercommerce_Tier_Tree::instance();
     $this->wootan = Wootan_Plugin::instance();
     $this->id = 'TechnoTan_Shipping';
     $this->instance_id = absint($instance_id);
     $this->method_title = __('TechnoTan Shipping');
     $this->title = __('TechnoTan Shipping');
     $this->method_description = __("Send by TechnoTan's road or air shipping otions");
     $this->supports = array('shipping-zones', 'instance-settings', 'instance-settings-modal', 'settings');
     $this->init();
     add_action('woocommerce_update_options_shipping_' . $this->id, array($this, 'process_admin_options'));
 }
Example #3
0
 public static function init()
 {
     if (self::$instance == null) {
         self::$instance = new Wootan_Plugin();
     }
 }