PluginProbe
CSS & JavaScript Toolbox / 6.1.2
CSS & JavaScript Toolbox v6.1.2
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / css-js-toolbox.class.php

css-js-toolbox.class.php in CSS & JavaScript Toolbox 6.1.2, at css-js-toolbox.class.php

243 lines 5.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 /** Change active profile to development state */
10 define('CJTOOLBOX_PROFILE_DEVELOPMENT', 'development');
11
12 /** Change active profile to production state */
13 define('CJTOOLBOX_PROFILE_PRODUCTION', 'production');
14
15 /** Set development state */
16 define('CJTOOLBOX_ACTIVE_PROFILE', CJTOOLBOX_PROFILE_DEVELOPMENT);
17
18 /** MVC library framework */
19 define('CJTOOLBOX_MVC_FRAMEWOK', CJTOOLBOX_INCLUDE_PATH . '/mvc');
20
21 /** Models dir path */
22 define('CJTOOLBOX_MODELS_PATH', CJTOOLBOX_PATH . '/models');
23
24 /** Tables dir path */
25 define('CJTOOLBOX_TABLES_PATH', CJTOOLBOX_PATH . '/tables');
26
27 /** Models views path */
28 define('CJTOOLBOX_VIEWS_PATH', CJTOOLBOX_PATH . '/views');
29
30 /** Views controllers path */
31 define('CJTOOLBOX_CONTROLLERS_PATH', CJTOOLBOX_PATH . '/controllers');
32
33 /** URI to CJT Plugin dir */
34 define('CJTOOLBOX_URL', WP_PLUGIN_URL . '/' . CJTOOLBOX_NAME );
35
36 /** URI to CJT Views directory */
37 define('CJTOOLBOX_VIEWS_URL', CJTOOLBOX_URL . '/views');
38
39 /** HTML Components URI */
40 define('CJTOOLBOX_HTML_CONPONENTS_URL', CJTOOLBOX_URL . '/framework/html/components');
41
42 /**
43 * CJT Core class.
44 *
45 * @package CJT
46 * @author Original Developer
47 * @version 0.3
48 */
49 class cssJSToolbox extends CJTHookableClass {
50
51 /**
52 *
53 */
54 const CJT_WEB_SITE_DOMAIN = 'css-javascript-toolbox.com';
55
56 /**
57 * put your comment there...
58 *
59 * @todo remove this and use configuration instead
60 *
61 * @var mixed
62 */
63 public static $config = null;
64
65 /**
66 * put your comment there...
67 *
68 * @var mixed
69 */
70 private $dbDriver;
71
72 /**
73 * Reference of CJT Plugin object.
74 *
75 * @var cssJSToolbox
76 */
77 public static $instance = null;
78
79 /**
80 * put your comment there...
81 *
82 * @var mixed
83 */
84 protected static $ongettext = array('parameters' => array('text'));
85
86 /**
87 * put your comment there...
88 *
89 * @var mixed
90 */
91 protected static $onimport = array('parameters' => array('vpaths'));
92
93 /**
94 * put your comment there...
95 *
96 * @var mixed
97 */
98 protected static $oninstantiate = array('parameters' => array('instance'));
99
100 /**
101 * put your comment there...
102 *
103 * @var mixed
104 */
105 protected $onloadconfiguration = array('parameters' => array('configuration'));
106
107 /**
108 * put your comment there...
109 *
110 * @var mixed
111 */
112 protected $onloaddbdriver = array('parameters' => array('dbdriver'));
113
114 /**
115 * put your comment there...
116 *
117 * @var mixed
118 */
119 protected static $onresolvepath = array('parameters' => array('path', 'vpath'));
120
121 /**
122 * Initialize Plugin.
123 *
124 * @return void
125 */
126 protected function __construct() {
127 // Initialize hookable!
128 parent::__construct();
129 // Load configuration.
130 self::$config = $this->onloadconfiguration(require(self::resolvePath('configuration.inc.php')));
131 // Initialize vars!
132 self::import('framework:db:mysql:queue-driver.inc.php');
133 $this->dbDriver = $this->onloaddbdriver(new CJTMYSQLQueueDriver($GLOBALS['wpdb']));
134 }
135
136 /**
137 * put your comment there...
138 *
139 */
140 public static function getCJTWebSiteURL($path = null) {
141 $domain = self::CJT_WEB_SITE_DOMAIN;
142 return "http://{$domain}/{$path}";
143 }
144
145 /**
146 * put your comment there...
147 *
148 */
149 public function getDBDriver() {
150 return $this->dbDriver;
151 }
152
153 /**
154 * Get CJT Plugin object.
155 *
156 * @return cssJSToolbox
157 */
158 public static function getInstance() {
159 if (!self::$instance) {
160 self::$instance = self::trigger('cssJSToolbox.instantiate', (new cssJSToolbox()));
161 }
162 return self::$instance;
163 }
164
165 /**
166 * put your comment there...
167 *
168 */
169 public static function getSecurityToken() {
170 return wp_create_nonce(CJTController::NONCE_ACTION);
171 }
172
173 /**
174 * put your comment there...
175 *
176 * @param mixed $text
177 */
178 public static function getText($text) {
179 // Make sure to don't use $this while calling!
180 // $this might be an object other than CssJSToolbox!
181 return self::__callStatic('cssJSToolbox.ongettext', array(__($text, CJTOOLBOX_TEXT_DOMAIN)));
182 }
183
184 /**
185 * put your comment there...
186 *
187 * @param mixed $path
188 */
189 public static function getURI($vPath, $uriBase = null) {
190 // PHP wrapper however its not imlpemented as wrapper yet
191 // because this is not the point right now!
192 if (strpos($vPath, 'extension://') === 0) {
193 // Expression for getting plugin/extension name!
194 $exp = '/^extension\:\/\/([^\/]+)/';
195 preg_match($exp, $vPath, $extensionPath);
196 // Get base URI + removing extension:// wrapper!
197 $uriBase = plugins_url($extensionPath[1]);
198 $uri = self::getURI(preg_replace($exp, '', $vPath), $uriBase);
199 }
200 else {
201 // Translate Virtual path to real path.
202 $path = str_replace(':', '/', $vPath);
203 // Get full URI.
204 if (!isset($uriBase)) {
205 $uriBase = plugin_dir_url(__FILE__);
206 }
207 $uri = "{$uriBase}{$path}";
208 }
209 return $uri;
210 }
211
212 /**
213 * put your comment there...
214 *
215 */
216 public static function import() {
217 // Initialize!
218 $params = func_get_args();
219 // Allow vriables list parameters.
220 $vPaths = self::trigger('cssJSToolbox.import', $params);
221 foreach ($vPaths as $vPath) {
222 // Import file.
223 require_once self::resolvePath($vPath);
224 }
225 }
226
227 /**
228 * put your comment there...
229 *
230 * @param mixed $vPath
231 * @param mixed $base
232 */
233 public static function resolvePath($vPath, $base = CJTOOLBOX_PATH) {
234 // Replace all :'s with /'s.
235 $path = str_replace(':', '/', $vPath);
236 $path = "{$base}/{$path}";
237 return self::trigger('cssJSToolbox.resolvepath', $path, $vPath);
238 }
239
240 }// End Class
241
242 // Hookable!
243 cssJSToolbox::define('cssJSToolbox', array('hookType' => CJTWordpressEvents::HOOK_FILTER));