-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathppb-mobile-editing.php
executable file
·172 lines (144 loc) · 3.44 KB
/
ppb-mobile-editing.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
/*
Plugin Name: PPB Mobile Editing
Plugin URI: http://pootlepress.com/
Description: Boilerplate for fast track Pootle Page Builder Addon Development
Author: Shramee
Version: 1.0.0
Author URI: http://shramee.com/
@developer shramee <[email protected]>
*/
/** Plugin admin class */
require 'inc/class-admin.php';
/** Plugin public class */
require 'inc/class-public.php';
/**
* PPB Mobile Editing main class
* @static string $token Plugin token
* @static string $file Plugin __FILE__
* @static string $url Plugin root dir url
* @static string $path Plugin root dir path
* @static string $version Plugin version
*/
class PPB_Mobile_Editing {
/**
* @var PPB_Mobile_Editing Instance
* @access private
* @since 1.0.0
*/
private static $_instance = null;
/**
* @var string Token
* @access public
* @since 1.0.0
*/
public static $token;
/**
* @var string Version
* @access public
* @since 1.0.0
*/
public static $version;
/**
* @var string Plugin main __FILE__
* @access public
* @since 1.0.0
*/
public static $file;
/**
* @var string Plugin directory url
* @access public
* @since 1.0.0
*/
public static $url;
/**
* @var string Plugin directory path
* @access public
* @since 1.0.0
*/
public static $path;
/**
* @var PPB_Mobile_Editing_Admin Instance
* @access public
* @since 1.0.0
*/
public $admin;
/**
* @var PPB_Mobile_Editing_Public Instance
* @access public
* @since 1.0.0
*/
public $public;
/**
* Main PPB Mobile Editing Instance
*
* Ensures only one instance of Storefront_Extension_Boilerplate is loaded or can be loaded.
*
* @since 1.0.0
* @return PPB_Mobile_Editing instance
*/
public static function instance( $file ) {
if ( null == self::$_instance ) {
self::$_instance = new self( $file );
}
return self::$_instance;
} // End instance()
/**
* Constructor function.
* @param string $file __FILE__ of the main plugin
* @access private
* @since 1.0.0
*/
private function __construct( $file ) {
self::$token = 'ppb-mobile-editing';
self::$file = $file;
self::$url = plugin_dir_url( $file );
self::$path = plugin_dir_path( $file );
self::$version = '1.0.0';
add_action( 'init', array( $this, 'init' ) );
} // End __construct()
/**
* Initiates the plugin
* @action init
* @since 1.0.0
*/
public function init() {
if ( class_exists( 'Pootle_Page_Builder' ) ) {
//Initiate admin
$this->_admin();
//Initiate public
$this->_public();
//Mark this add on as active
add_filter( 'pootlepb_installed_add_ons', array( $this, 'add_on_active' ) );
}
} // End init()
/**
* Initiates admin class and adds admin hooks
* @since 1.0.0
*/
private function _admin() {
//Instantiating admin class
$this->admin = PPB_Mobile_Editing_Admin::instance();
}
/**
* Initiates public class and adds public hooks
* @since 1.0.0
*/
private function _public() {
//Instantiating public class
$this->public = PPB_Mobile_Editing_Public::instance();
} // End enqueue()
/**
* Marks this add on as active on
* @param array $active Active add ons
* @return array Active add ons
* @since 1.0.0
*/
public function add_on_active( $active ) {
// To allows ppb add ons page to fetch name, description etc.
$active[ self::$token ] = self::$file;
return $active;
}
}
/** Intantiating main plugin class */
PPB_Mobile_Editing::instance( __FILE__ );