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