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 +101 -162 trunk6.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,225 +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 = [ 'parameters' => [ '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 = [ 'parameters' => [ '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 = [ 'parameters' => [ '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 = [ 'parameters' => [ '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 = [ 'parameters' => [ '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 = [ 'parameters' => [ '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 - {
214 - // Simply return text without any translation attempts
215 - return $text;
178 + public 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)));
216 182 }
217 -
183 +
218 184 /**
219 185 * put your comment there...
220 - *
186 + *
221 187 * @param mixed $path
222 188 */
223 - public static function getURI( $vPath, $uriBase = null )
224 - {
189 + public static function getURI($vPath, $uriBase = null) {
225 190 // PHP wrapper however its not imlpemented as wrapper yet
226 191 // because this is not the point right now!
227 - if ( strpos( $vPath, 'extension://' ) === 0)
228 - {
192 + if (strpos($vPath, 'extension://') === 0) {
229 193 // Expression for getting plugin/extension name!
230 194 $exp = '/^extension\:\/\/([^\/]+)/';
231 - preg_match( $exp, $vPath, $extensionPath );
232 -
195 + preg_match($exp, $vPath, $extensionPath);
233 196 // Get base URI + removing extension:// wrapper!
234 - $uriBase = plugins_url( $extensionPath[ 1 ] );
235 -
236 - $uri = self::getURI( preg_replace( $exp, '', $vPath ), $uriBase );
237 -
238 - }
239 - else
240 - {
197 + $uriBase = plugins_url($extensionPath[1]);
198 + $uri = self::getURI(preg_replace($exp, '', $vPath), $uriBase);
199 + }
200 + else {
241 201 // Translate Virtual path to real path.
242 - $path = str_replace( ':', '/', $vPath );
243 -
202 + $path = str_replace(':', '/', $vPath);
244 203 // Get full URI.
245 - if ( ! isset( $uriBase ) )
246 - {
247 -
248 - $uriBase = plugin_dir_url( __FILE__ );
249 -
204 + if (!isset($uriBase)) {
205 + $uriBase = plugin_dir_url(__FILE__);
250 206 }
251 -
252 - $uri = "{$uriBase}{$path}";
207 + $uri = "{$uriBase}{$path}";
253 208 }
254 -
255 209 return $uri;
256 210 }
257 -
211 +
258 212 /**
259 213 * put your comment there...
260 - *
214 + *
261 215 */
262 - public static function import()
263 - {
264 -
216 + public static function import() {
217 + // Initialize!
265 218 $params = func_get_args();
266 -
267 219 // Allow vriables list parameters.
268 - $vPaths = self::trigger( 'cssJSToolbox.import', $params );
269 - foreach ( $vPaths as $vPath )
270 - {
271 - 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);
272 224 }
273 -
274 225 }
275 -
226 +
276 227 /**
277 228 * put your comment there...
278 - *
229 + *
279 230 * @param mixed $vPath
280 231 * @param mixed $base
281 232 */
282 - public static function resolvePath( $vPath, $base = CJTOOLBOX_PATH )
283 - {
284 - // Resolve CJT extensions path
285 - if ( strpos( $vPath, 'extension://' ) === 0 )
286 - {
287 - // Remove extension wrapper
288 - $vPath = str_replace( 'extension://', '', $vPath );
289 -
290 - // Point to plugin directory
291 - $base = WP_PLUGIN_DIR;
292 -
293 - }
233 + public static function resolvePath($vPath, $base = CJTOOLBOX_PATH) {
294 234 // Replace all :'s with /'s.
295 - $path = str_replace( ':', '/', $vPath );
235 + $path = str_replace(':', '/', $vPath);
296 236 $path = "{$base}/{$path}";
297 -
298 - return self::trigger( 'cssJSToolbox.resolvepath', $path, $vPath );
237 + return self::trigger('cssJSToolbox.resolvepath', $path, $vPath);
299 238 }
300 -
239 +
301 240 }// End Class
302 241
303 242 // Hookable!
304 -cssJSToolbox::define( 'cssJSToolbox', array( 'hookType' => CJTWordpressEvents::HOOK_FILTER ) );
243 +cssJSToolbox::define('cssJSToolbox', array('hookType' => CJTWordpressEvents::HOOK_FILTER));