forked from kilbot/WooCommerce-POS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
woocommerce-pos.php
62 lines (54 loc) · 1.8 KB
/
woocommerce-pos.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* Plugin Name: WooCommerce POS
* Plugin URI: https://wordpress.org/plugins/woocommerce-pos/
* Description: A simple front-end for taking WooCommerce orders at the Point of Sale. Requires <a href="http://wordpress.org/plugins/woocommerce/">WooCommerce</a>.
* Version: 0.5.0-beta
* Author: kilbot
* Author URI: http://wcpos.com
* Text Domain: woocommerce-pos
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages
*
* @package WooCommerce POS
* @author Paul Kilmurray <[email protected]>
* @link http://woopos.com.au
*
*/
namespace WC_POS;
/**
* Define plugin constants.
*/
define( __NAMESPACE__ . '\VERSION', '0.5.0-beta' );
define( __NAMESPACE__ . '\PLUGIN_NAME', 'woocommerce-pos' );
define( __NAMESPACE__ . '\PLUGIN_FILE', plugin_basename( __FILE__ ) ); // 'woocommerce-pos/woocommerce-pos.php'
define( __NAMESPACE__ . '\PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
define( __NAMESPACE__ . '\PLUGIN_URL', trailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
/**
* Autoloader
*/
if ( !function_exists( 'spl_autoload_register' ) ) {
return;
}
spl_autoload_register( __NAMESPACE__ . '\\autoload' );
function autoload( $cls ) {
$cls = ltrim( $cls, '\\' );
if( substr( $cls, 0, strlen( __NAMESPACE__ ) ) !== __NAMESPACE__ ) {
return;
}
$cls = str_replace( __NAMESPACE__, '', $cls );
$file = PLUGIN_PATH . 'includes' . str_replace( '\\', DIRECTORY_SEPARATOR, strtolower( $cls ) ) . '.php';
if(is_readable($file)){
require_once( $file );
}
}
/**
* Activate plugin
*/
new Admin\Notices(); // init notices for sanity checks
new Activator();
/**
* Deactivate plugin
*/
new Deactivator();