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