Skip to content

Commit 2434f2f

Browse files
committed
introduced
1 parent 1551adb commit 2434f2f

File tree

2 files changed

+69
-9
lines changed

2 files changed

+69
-9
lines changed

autoload.php

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,72 @@
88

99
final class PLUGIN_BUILD {
1010

11+
/**
12+
* @var String
13+
*/
14+
protected $version = '1.2.1';
15+
1116

17+
/**
18+
* Plugin Instance.
19+
*
20+
* @var PLUGIN_BUILD the PLUGIN Instance
21+
*/
22+
protected static $_instance;
23+
24+
25+
/**
26+
* Text domain to be used throughout the plugin
27+
*
28+
* @var String
29+
*/
1230
protected static $text_domain = 'textdomain';
13-
protected static $php_ver_allowed = '5.4';
31+
32+
33+
/**
34+
* Minimum PHP version allowed for the plugin
35+
*
36+
* @var String
37+
*/
38+
protected static $php_ver_allowed = '5.3';
39+
40+
41+
/**
42+
* DB tabble used in plugin
43+
*
44+
* @var String
45+
*/
1446
protected static $plugin_table = 'plugin_db_table_name';
1547

1648

49+
/**
50+
* Plugin listing page links, along with Deactivate
51+
*
52+
* @var Array
53+
*/
54+
protected static $plugin_page_links = array(
55+
array(
56+
'slug' => '',
57+
'label' => ''
58+
) );
59+
60+
61+
/**
62+
* Main Plugin Instance.
63+
*
64+
* @return PLUGIN_BUILD
65+
*/
66+
public static function instance() {
67+
68+
if ( is_null( self::$_instance ) ) {
69+
self::$_instance = new self();
70+
self::$_instance->init();
71+
}
72+
73+
return self::$_instance;
74+
}
75+
76+
1777
/**
1878
* Install plugin setup
1979
*
@@ -26,12 +86,7 @@ public function installation() {
2686
$install = new PLUGIN_INSTALL();
2787
$install->text_domain = self::$text_domain;
2888
$install->php_ver_allowed = self::$php_ver_allowed;
29-
$install->plugin_page_links = array(
30-
array(
31-
'slug' => '',
32-
'label' => ''
33-
),
34-
);
89+
$install->plugin_page_links = self::$plugin_page_links;
3590
$install->execute();
3691
}
3792
}
@@ -253,7 +308,7 @@ public function helpers() {
253308
*
254309
* @return Void
255310
*/
256-
public function __construct() {
311+
public function init() {
257312

258313
$this->helpers();
259314
$this->functionality();

wp-plugin-framework.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@
3030

3131
//The Plugin
3232
require_once( 'autoload.php' );
33-
if ( class_exists( 'PLUGIN_BUILD' ) ) new PLUGIN_BUILD(); ?>
33+
function plugin() {
34+
if ( class_exists( 'PLUGIN_BUILD' ) ) return PLUGIN_BUILD::instance();
35+
}
36+
37+
global $plugin;
38+
$plugin = plugin(); ?>

0 commit comments

Comments
 (0)