This repository was archived by the owner on Mar 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrow-helper.php
82 lines (70 loc) · 1.55 KB
/
grow-helper.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Plugin Name: Grow Helper
* Plugin URI: https://woogrowp2.wordpress.com/
* Description: Test
* Version: 0.1.0
* Author: Grow
* Author URI: https://woogrowp2.wordpress.com/
* Text Domain: grow-helper
* WC requires at least: 2.6.0
* WC tested up to: 5.5.0.
*/
class Grow_Helper
{
/**
* Current version of Grow Helper.
*/
public $version = '0.1.0';
/**
* URL dir for plugin.
*/
public $url;
/**
* The single instance of the class.
*/
protected static $_instance = null;
/**
* Main Helper Instance.
*
* Ensures only one instance of the Helper is loaded or can be loaded.
*
* @return Helper - Main instance.
*/
public static function instance()
{
if (is_null(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Constructor.
*/
public function __construct()
{
add_action('plugins_loaded', array($this, 'init'));
// Set URL
$this->url = plugin_dir_url(__FILE__);
}
/**
* Start plugin.
*/
public function init()
{
if (class_exists('WooCommerce')) {
// Require files for the plugin
require_once 'inc/custom.php';
}
// Plugin textdomain
load_plugin_textdomain('grow-helper', false, basename(dirname(__FILE__)).'/languages/');
}
}
/**
* For plugin-wide access to initial instance.
*/
function Grow_Helper()
{
return Grow_Helper::instance();
}
Grow_Helper();