PluginProbe
CSS & JavaScript Toolbox / 7.2
CSS & JavaScript Toolbox v7.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 7.2, at css-js-toolbox.class.php

248 lines 5.5 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_SCRTIPS_WEB_SITE_DOMAIN = 'cjt-scripts.com';
55
56 /**
57 *
58 */
59 const CJT_WEB_SITE_DOMAIN = 'css-javascript-toolbox.com';
60
61 /**
62 * put your comment there...
63 *
64 * @todo remove this and use configuration instead
65 *
66 * @var mixed
67 */
68 public static $config = null;
69
70 /**
71 * put your comment there...
72 *
73 * @var mixed
74 */
75 private $dbDriver;
76
77 /**
78 * Reference of CJT Plugin object.
79 *
80 * @var cssJSToolbox
81 */
82 public static $instance = null;
83
84 /**
85 * put your comment there...
86 *
87 * @var mixed
88 */
89 protected static $ongettext = array('parameters' => array('text'));
90
91 /**
92 * put your comment there...
93 *
94 * @var mixed
95 */
96 protected static $onimport = array('parameters' => array('vpaths'));
97
98 /**
99 * put your comment there...
100 *
101 * @var mixed
102 */
103 protected static $oninstantiate = array('parameters' => array('instance'));
104
105 /**
106 * put your comment there...
107 *
108 * @var mixed
109 */
110 protected $onloadconfiguration = array('parameters' => array('configuration'));
111
112 /**
113 * put your comment there...
114 *
115 * @var mixed
116 */
117 protected $onloaddbdriver = array('parameters' => array('dbdriver'));
118
119 /**
120 * put your comment there...
121 *
122 * @var mixed
123 */
124 protected static $onresolvepath = array('parameters' => array('path', 'vpath'));
125
126 /**
127 * Initialize Plugin.
128 *
129 * @return void
130 */
131 protected function __construct() {
132 // Initialize hookable!
133 parent::__construct();
134 // Load configuration.
135 self::$config = $this->onloadconfiguration(require(self::resolvePath('configuration.inc.php')));
136 // Initialize vars!
137 self::import('framework:db:mysql:queue-driver.inc.php');
138 $this->dbDriver = $this->onloaddbdriver(new CJTMYSQLQueueDriver($GLOBALS['wpdb']));
139 }
140
141 /**
142 * put your comment there...
143 *
144 */
145 public static function getCJTWebSiteURL($path = null) {
146 $domain = self::CJT_WEB_SITE_DOMAIN;
147 return "http://{$domain}/{$path}";
148 }
149
150 /**
151 * put your comment there...
152 *
153 */
154 public function getDBDriver() {
155 return $this->dbDriver;
156 }
157
158 /**
159 * Get CJT Plugin object.
160 *
161 * @return cssJSToolbox
162 */
163 public static function getInstance() {
164 if (!self::$instance) {
165 self::$instance = self::trigger('cssJSToolbox.instantiate', (new cssJSToolbox()));
166 }
167 return self::$instance;
168 }
169
170 /**
171 * put your comment there...
172 *
173 */
174 public static function getSecurityToken() {
175 return wp_create_nonce(CJTController::NONCE_ACTION);
176 }
177
178 /**
179 * put your comment there...
180 *
181 * @param mixed $text
182 */
183 public static function getText($text) {
184 // Make sure to don't use $this while calling!
185 // $this might be an object other than CssJSToolbox!
186 return self::__callStatic('cssJSToolbox.ongettext', array(__($text, CJTOOLBOX_TEXT_DOMAIN)));
187 }
188
189 /**
190 * put your comment there...
191 *
192 * @param mixed $path
193 */
194 public static function getURI($vPath, $uriBase = null) {
195 // PHP wrapper however its not imlpemented as wrapper yet
196 // because this is not the point right now!
197 if (strpos($vPath, 'extension://') === 0) {
198 // Expression for getting plugin/extension name!
199 $exp = '/^extension\:\/\/([^\/]+)/';
200 preg_match($exp, $vPath, $extensionPath);
201 // Get base URI + removing extension:// wrapper!
202 $uriBase = plugins_url($extensionPath[1]);
203 $uri = self::getURI(preg_replace($exp, '', $vPath), $uriBase);
204 }
205 else {
206 // Translate Virtual path to real path.
207 $path = str_replace(':', '/', $vPath);
208 // Get full URI.
209 if (!isset($uriBase)) {
210 $uriBase = plugin_dir_url(__FILE__);
211 }
212 $uri = "{$uriBase}{$path}";
213 }
214 return $uri;
215 }
216
217 /**
218 * put your comment there...
219 *
220 */
221 public static function import() {
222 // Initialize!
223 $params = func_get_args();
224 // Allow vriables list parameters.
225 $vPaths = self::trigger('cssJSToolbox.import', $params);
226 foreach ($vPaths as $vPath) {
227 // Import file.
228 require_once self::resolvePath($vPath);
229 }
230 }
231
232 /**
233 * put your comment there...
234 *
235 * @param mixed $vPath
236 * @param mixed $base
237 */
238 public static function resolvePath($vPath, $base = CJTOOLBOX_PATH) {
239 // Replace all :'s with /'s.
240 $path = str_replace(':', '/', $vPath);
241 $path = "{$base}/{$path}";
242 return self::trigger('cssJSToolbox.resolvepath', $path, $vPath);
243 }
244
245 }// End Class
246
247 // Hookable!
248 cssJSToolbox::define('cssJSToolbox', array('hookType' => CJTWordpressEvents::HOOK_FILTER));