woocommerce-advanced-ordernumbers.php 2.34 KB
Newer Older
1 2
<?php
/**
3 4
 * Plugin Name: Woocommerce Advanced Ordernumbers
 * Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
5
 * Description: Lets the user freely configure the order numbers in WooCommerce.
6
 * Version: 1.2
7
 * Author: Open Tools
8 9 10 11
 * Author URI: http://open-tools.net
 * Text Domain: woocommerce-advanced-ordernumbers
 * Domain Path: 
 * License: GPL2+
12
 * Network: true
13 14 15 16 17 18 19
 WC requires at least: 2.2
WC tested up to: 2.3
*/

if ( ! defined( 'ABSPATH' ) ) { 
	exit; // Exit if accessed directly
}
20 21 22 23 24
// Define a global flag so the basic plugin can deactivate itself if this plugin is loaded
if ( !defined('OPENTOOLS_ADVANCED_ORDERNUMBERS') ) {
	define ('OPENTOOLS_ADVANCED_ORDERNUMBERS', true);
}

25 26 27 28 29 30 31 32 33 34 35 36 37
// *****************************************************************
// * PLUGIN UPDATES
// *****************************************************************
require 'opentools-update-checker.php';
$myUpdateChecker = new OpenToolsPluginUpdateChecker(
    'http://www.open-tools.net/UpdateServer/index.php?package=WooCommerce&extension=AdvancedOrdernumbers',
    __FILE__,
    'woocommerce-advanced-ordernumbers'
);
// $myUpdateChecker->checkForUpdates();
// *****************************************************************


38
function otaon_is_wc_active() {
39 40 41 42
// Makes sure the plugin is defined before trying to use it
	if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
		require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
	}
43 44 45 46 47 48
	return 
		in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) 
		|| 
		is_plugin_active_for_network( 'woocommerce/woocommerce.php' );
}

49 50 51
/**
 * Check if WooCommerce is active
 **/
52
if ( otaon_is_wc_active() ) {
53

54
	if (file_exists(plugin_dir_path( __FILE__ ) . '/ordernumbers_woocommerce.php') && !class_exists("OpenToolsOrdernumbers")) {
55
		require_once( plugin_dir_path( __FILE__ ) . '/ordernumbers_woocommerce.php');
56 57 58
	} 
	if (!class_exists("OpenToolsOrdernumbersBasic"))
		require_once( plugin_dir_path( __FILE__ ) . '/ordernumbers_woocommerce_basic.php');
59

60 61

	// instantiate the plugin class
62
	if (class_exists("OpenToolsOrdernumbers")) {
63 64 65
		$ordernumber_plugin = new OpenToolsOrdernumbers(plugin_basename(__FILE__));
	} elseif (class_exists("OpenToolsOrdernumbersBasic")) {
		$ordernumber_plugin = new OpenToolsOrdernumbersBasic(plugin_basename(__FILE__));
66
	}
67

68 69
 
}