-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwc_importer.php
59 lines (50 loc) · 1.25 KB
/
wc_importer.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
<?php
/*
Plugin Name: WC Importer
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: WC - Product Importer.
Version: 1.0
Author: buddyboss
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit;
class WC_Importer{
var $plugin_url;
var $plugin_dir;
var $plugin_prefix;
var $plugin_version;
var $domain;
var $c; //contain the classes
function __construct() {
$this->plugin_version = '1.0';
$this->plugin_dir = plugin_dir_path( __FILE__ );
$this->plugin_url = plugin_dir_url( __FILE__ );
$this->plugin_prefix = 'wc_importer';
$this->domain = 'wc_importer';
$this->c = new stdClass();
//register all hooks.
$this->load_classes();
}
function load_classes() {
if ( class_exists( 'WP_CLI' ) ) {
include $this->plugin_dir . 'includes/wc_product_importer.php';
WP_CLI::add_command( 'wc-product', 'WC_Product_CLI_Importer' );
}
}
}
/*
* Easy to call function.
**/
function wc_importer() {
global $wc_importer;
return $wc_importer;
}
function wc_importer_init(){
global $wc_importer;
//load the main class
$wc_importer = new WC_Importer();
}
add_action( 'plugins_loaded', 'wc_importer_init' );