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