| @@ -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' ); |
| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | |
| 17 | 17 | /** Set development state */ |
| 18 | 18 | define( |
| 19 | 19 | 'CJTOOLBOX_ACTIVE_PROFILE', |
| 20 | - getenv('ecm-active-profile') ? | |
| 20 | + getenv('ecm-active-profile') ? | |
| 21 | 21 | getenv('ecm-active-profile') : |
| 22 | 22 | CJTOOLBOX_PROFILE_PRODUCTION |
| 23 | 23 | ); |
| 24 | 24 | |
| @@ -23,9 +23,9 @@ | ||
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | define( |
| 26 | 26 | 'CJTOOLBOX_ACTIVE_SERVICES_API_PROFILE', |
| 27 | - getenv('ecm-active-services-api-profile') ? | |
| 27 | + getenv('ecm-active-services-api-profile') ? | |
| 28 | 28 | getenv('ecm-active-services-api-profile') : |
| 29 | 29 | CJTOOLBOX_PROFILE_PRODUCTION |
| 30 | 30 | ); |
| 31 | 31 | |
| @@ -54,40 +54,40 @@ | ||
| 54 | 54 | define( 'CJTOOLBOX_HTML_CONPONENTS_URL', CJTOOLBOX_URL . '/framework/html/components' ); |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * CJT Core class. |
| 58 | -* | |
| 58 | +* | |
| 59 | 59 | * @package CJT |
| 60 | 60 | * @author Original Developer |
| 61 | 61 | * @version 0.3 |
| 62 | 62 | */ |
| 63 | -class cssJSToolbox extends CJTHookableClass | |
| 63 | +class cssJSToolbox extends CJTHookableClass | |
| 64 | 64 | { |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * | |
| 67 | + * | |
| 68 | 68 | */ |
| 69 | 69 | const CJT_WEB_SITE_DOMAIN = 'easy-code-manager.com'; |
| 70 | - | |
| 70 | + | |
| 71 | 71 | /** |
| 72 | 72 | * put your comment there... |
| 73 | - * | |
| 73 | + * | |
| 74 | 74 | * @todo remove this and use configuration instead |
| 75 | - * | |
| 75 | + * | |
| 76 | 76 | * @var mixed |
| 77 | 77 | */ |
| 78 | 78 | public static $config = null; |
| 79 | - | |
| 79 | + | |
| 80 | 80 | /** |
| 81 | 81 | * put your comment there... |
| 82 | - * | |
| 82 | + * | |
| 83 | 83 | * @var mixed |
| 84 | 84 | */ |
| 85 | 85 | private $dbDriver; |
| 86 | - | |
| 86 | + | |
| 87 | 87 | /** |
| 88 | 88 | * Reference of CJT Plugin object. |
| 89 | - * | |
| 89 | + * | |
| 90 | 90 | * @var cssJSToolbox |
| 91 | 91 | */ |
| 92 | 92 | public static $instance = null; |
| 93 | 93 | |
| @@ -92,37 +92,37 @@ | ||
| 92 | 92 | public static $instance = null; |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * put your comment there... |
| 96 | - * | |
| 96 | + * | |
| 97 | 97 | * @var mixed |
| 98 | 98 | */ |
| 99 | 99 | protected static $ongettext = array( 'parameters' => array( 'text' ) ); |
| 100 | - | |
| 100 | + | |
| 101 | 101 | /** |
| 102 | 102 | * put your comment there... |
| 103 | - * | |
| 103 | + * | |
| 104 | 104 | * @var mixed |
| 105 | 105 | */ |
| 106 | 106 | protected static $onimport = array( 'parameters' => array( 'vpaths' ) ); |
| 107 | - | |
| 107 | + | |
| 108 | 108 | /** |
| 109 | 109 | * put your comment there... |
| 110 | - * | |
| 110 | + * | |
| 111 | 111 | * @var mixed |
| 112 | 112 | */ |
| 113 | 113 | protected static $oninstantiate = array( 'parameters' => array( 'instance' ) ); |
| 114 | - | |
| 114 | + | |
| 115 | 115 | /** |
| 116 | 116 | * put your comment there... |
| 117 | - * | |
| 117 | + * | |
| 118 | 118 | * @var mixed |
| 119 | 119 | */ |
| 120 | 120 | protected $onloadconfiguration = array( 'parameters' => array( 'configuration' ) ); |
| 121 | - | |
| 121 | + | |
| 122 | 122 | /** |
| 123 | 123 | * put your comment there... |
| 124 | - * | |
| 124 | + * | |
| 125 | 125 | * @var mixed |
| 126 | 126 | */ |
| 127 | 127 | protected $onloaddbdriver = array( 'parameters' => array( 'dbdriver' ) ); |
| 128 | 128 | |
| @@ -127,51 +127,51 @@ | ||
| 127 | 127 | protected $onloaddbdriver = array( 'parameters' => array( 'dbdriver' ) ); |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * put your comment there... |
| 131 | - * | |
| 131 | + * | |
| 132 | 132 | * @var mixed |
| 133 | 133 | */ |
| 134 | 134 | protected static $onresolvepath = array( 'parameters' => array( 'path', 'vpath' ) ); |
| 135 | - | |
| 135 | + | |
| 136 | 136 | /** |
| 137 | 137 | * put your comment there... |
| 138 | - * | |
| 138 | + * | |
| 139 | 139 | * @param mixed $text |
| 140 | 140 | */ |
| 141 | 141 | public static function __( $text ) |
| 142 | 142 | { |
| 143 | - | |
| 143 | + | |
| 144 | 144 | // Get formats as single args |
| 145 | 145 | $args = func_get_args(); |
| 146 | 146 | array_shift($args); |
| 147 | - | |
| 147 | + | |
| 148 | 148 | $localTxt = self::getText($text); |
| 149 | - | |
| 149 | + | |
| 150 | 150 | // Return formatted text |
| 151 | 151 | if (!empty($args)) |
| 152 | 152 | { |
| 153 | - | |
| 153 | + | |
| 154 | 154 | // Shift localized text into first array items |
| 155 | 155 | array_unshift($args, $localTxt); |
| 156 | - | |
| 156 | + | |
| 157 | 157 | // Replacements |
| 158 | 158 | $localTxt = call_user_func_array('sprintf', $args); |
| 159 | 159 | } |
| 160 | - | |
| 160 | + | |
| 161 | 161 | return $localTxt; |
| 162 | 162 | } |
| 163 | - | |
| 163 | + | |
| 164 | 164 | /** |
| 165 | - * Initialize Plugin. | |
| 166 | - * | |
| 165 | + * Initialize Plugin. | |
| 166 | + * | |
| 167 | 167 | * @return void |
| 168 | 168 | */ |
| 169 | - protected function __construct() | |
| 169 | + protected function __construct() | |
| 170 | 170 | { |
| 171 | - | |
| 171 | + | |
| 172 | 172 | parent::__construct(); |
| 173 | - | |
| 173 | + | |
| 174 | 174 | // When in development stage display everything |
| 175 | 175 | if ((CJTOOLBOX_ACTIVE_PROFILE == CJTOOLBOX_PROFILE_DEVELOPMENT) && |
| 176 | 176 | defined('WP_DEBUG') && |
| 177 | 177 | WP_DEBUG) |
| @@ -176,49 +176,49 @@ | ||
| 176 | 176 | defined('WP_DEBUG') && |
| 177 | 177 | WP_DEBUG) |
| 178 | 178 | { |
| 179 | 179 | ini_set('error_reporting', E_ALL); |
| 180 | - ini_set('display_errors', 'On'); | |
| 180 | + ini_set('display_errors', 'On'); | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // Load configuration. |
| 184 | 184 | self::$config = $this->onloadconfiguration( require( self::resolvePath( 'configuration.inc.php' ) ) ); |
| 185 | - | |
| 185 | + | |
| 186 | 186 | self::import( 'framework:db:mysql:queue-driver.inc.php' ); |
| 187 | - | |
| 187 | + | |
| 188 | 188 | $this->dbDriver = $this->onloaddbdriver( new CJTMYSQLQueueDriver( $GLOBALS[ 'wpdb' ] ) ); |
| 189 | 189 | } |
| 190 | - | |
| 190 | + | |
| 191 | 191 | /** |
| 192 | 192 | * put your comment there... |
| 193 | - * | |
| 193 | + * | |
| 194 | 194 | */ |
| 195 | - public static function getCJTWebSiteURL( $path = null ) | |
| 195 | + public static function getCJTWebSiteURL( $path = null ) | |
| 196 | 196 | { |
| 197 | 197 | $domain = self::CJT_WEB_SITE_DOMAIN; |
| 198 | - | |
| 199 | - return "http://{$domain}/{$path}"; | |
| 198 | + | |
| 199 | + return "https://{$domain}/{$path}"; | |
| 200 | 200 | } |
| 201 | - | |
| 201 | + | |
| 202 | 202 | /** |
| 203 | 203 | * put your comment there... |
| 204 | - * | |
| 204 | + * | |
| 205 | 205 | * @returns CJTMYSQLQueueDriver |
| 206 | 206 | */ |
| 207 | - public function & getDBDriver() | |
| 207 | + public function & getDBDriver() | |
| 208 | 208 | { |
| 209 | - return $this->dbDriver; | |
| 209 | + return $this->dbDriver; | |
| 210 | 210 | } |
| 211 | - | |
| 211 | + | |
| 212 | 212 | /** |
| 213 | 213 | * put your comment there... |
| 214 | - * | |
| 214 | + * | |
| 215 | 215 | */ |
| 216 | 216 | public function getPluginTitles() |
| 217 | 217 | { |
| 218 | - | |
| 218 | + | |
| 219 | 219 | static $pluginTitles; |
| 220 | - | |
| 220 | + | |
| 221 | 221 | if (!$pluginTitles) |
| 222 | 222 | { |
| 223 | 223 | $pluginTitles = array |
| 224 | 224 | ( |
| @@ -223,42 +223,42 @@ | ||
| 223 | 223 | $pluginTitles = array |
| 224 | 224 | ( |
| 225 | 225 | cssJSToolbox::__('Easy Code Manager'), |
| 226 | 226 | cssJSToolbox::__('ECM') |
| 227 | - ); | |
| 227 | + ); | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | return $pluginTitles; |
| 231 | 231 | } |
| 232 | - | |
| 232 | + | |
| 233 | 233 | /** |
| 234 | 234 | * Get CJT Plugin object. |
| 235 | - * | |
| 235 | + * | |
| 236 | 236 | * @return cssJSToolbox |
| 237 | 237 | */ |
| 238 | - public static function & getInstance() | |
| 238 | + public static function & getInstance() | |
| 239 | 239 | { |
| 240 | - | |
| 240 | + | |
| 241 | 241 | if ( ! self::$instance ) |
| 242 | 242 | { |
| 243 | 243 | self::$instance = self::trigger( 'cssJSToolbox.instantiate', ( new cssJSToolbox() ) ); |
| 244 | 244 | } |
| 245 | - | |
| 245 | + | |
| 246 | 246 | return self::$instance; |
| 247 | 247 | } |
| 248 | - | |
| 248 | + | |
| 249 | 249 | /** |
| 250 | 250 | * put your comment there... |
| 251 | - * | |
| 251 | + * | |
| 252 | 252 | */ |
| 253 | - public static function getSecurityToken() | |
| 253 | + public static function getSecurityToken() | |
| 254 | 254 | { |
| 255 | 255 | return wp_create_nonce( CJTController::NONCE_ACTION ); |
| 256 | 256 | } |
| 257 | - | |
| 257 | + | |
| 258 | 258 | /** |
| 259 | 259 | * put your comment there... |
| 260 | - * | |
| 260 | + * | |
| 261 | 261 | */ |
| 262 | 262 | public function getServiesClientAPI() |
| 263 | 263 | { |
| 264 | 264 | // Services API Address would be Local in Development |
| @@ -265,107 +265,107 @@ | ||
| 265 | 265 | // ,and CJT Web Site on Production |
| 266 | 266 | $apiUrl = ( CJTOOLBOX_ACTIVE_SERVICES_API_PROFILE == CJTOOLBOX_PROFILE_PRODUCTION) ? |
| 267 | 267 | self::getCJTWebSiteURL() : |
| 268 | 268 | home_url(); |
| 269 | - | |
| 269 | + | |
| 270 | 270 | return CJTServicesClient::getInstance($apiUrl); |
| 271 | 271 | } |
| 272 | - | |
| 272 | + | |
| 273 | 273 | /** |
| 274 | 274 | * put your comment there... |
| 275 | - * | |
| 275 | + * | |
| 276 | 276 | * @param mixed $text |
| 277 | 277 | */ |
| 278 | - private static function getText( $text ) | |
| 278 | + private static function getText( $text ) | |
| 279 | 279 | { |
| 280 | 280 | // Make sure to don't use $this while calling! |
| 281 | 281 | // $this might be an object other than CssJSToolbox! |
| 282 | 282 | return self::__callStatic( 'cssJSToolbox.ongettext', array( __( $text, CJTOOLBOX_TEXT_DOMAIN ) ) ); |
| 283 | 283 | } |
| 284 | - | |
| 284 | + | |
| 285 | 285 | /** |
| 286 | 286 | * put your comment there... |
| 287 | - * | |
| 287 | + * | |
| 288 | 288 | * @param mixed $path |
| 289 | 289 | */ |
| 290 | - public static function getURI( $vPath, $uriBase = null ) | |
| 290 | + public static function getURI( $vPath, $uriBase = null ) | |
| 291 | 291 | { |
| 292 | 292 | // PHP wrapper however its not imlpemented as wrapper yet |
| 293 | 293 | // because this is not the point right now! |
| 294 | - if ( strpos( $vPath, 'extension://' ) === 0) | |
| 294 | + if ( strpos( $vPath, 'extension://' ) === 0) | |
| 295 | 295 | { |
| 296 | 296 | // Expression for getting plugin/extension name! |
| 297 | 297 | $exp = '/^extension\:\/\/([^\/]+)/'; |
| 298 | 298 | preg_match( $exp, $vPath, $extensionPath ); |
| 299 | - | |
| 299 | + | |
| 300 | 300 | // Get base URI + removing extension:// wrapper! |
| 301 | 301 | $uriBase = plugins_url( $extensionPath[ 1 ] ); |
| 302 | - | |
| 302 | + | |
| 303 | 303 | $uri = self::getURI( preg_replace( $exp, '', $vPath ), $uriBase ); |
| 304 | - | |
| 305 | - } | |
| 306 | - else | |
| 304 | + | |
| 305 | + } | |
| 306 | + else | |
| 307 | 307 | { |
| 308 | 308 | // Translate Virtual path to real path. |
| 309 | 309 | $path = str_replace( ':', '/', $vPath ); |
| 310 | - | |
| 310 | + | |
| 311 | 311 | // Get full URI. |
| 312 | - if ( ! isset( $uriBase ) ) | |
| 312 | + if ( ! isset( $uriBase ) ) | |
| 313 | 313 | { |
| 314 | - | |
| 314 | + | |
| 315 | 315 | $uriBase = plugin_dir_url( __FILE__ ); |
| 316 | - | |
| 316 | + | |
| 317 | 317 | } |
| 318 | - | |
| 319 | - $uri = "{$uriBase}{$path}"; | |
| 318 | + | |
| 319 | + $uri = "{$uriBase}{$path}"; | |
| 320 | 320 | } |
| 321 | - | |
| 321 | + | |
| 322 | 322 | return $uri; |
| 323 | 323 | } |
| 324 | - | |
| 324 | + | |
| 325 | 325 | /** |
| 326 | 326 | * put your comment there... |
| 327 | - * | |
| 327 | + * | |
| 328 | 328 | */ |
| 329 | - public static function import() | |
| 329 | + public static function import() | |
| 330 | 330 | { |
| 331 | 331 | |
| 332 | 332 | $params = func_get_args(); |
| 333 | - | |
| 333 | + | |
| 334 | 334 | // Allow vriables list parameters. |
| 335 | 335 | $vPaths = self::trigger( 'cssJSToolbox.import', $params ); |
| 336 | - foreach ( $vPaths as $vPath ) | |
| 336 | + foreach ( $vPaths as $vPath ) | |
| 337 | 337 | { |
| 338 | 338 | require_once self::resolvePath( $vPath ); |
| 339 | 339 | } |
| 340 | - | |
| 340 | + | |
| 341 | 341 | } |
| 342 | - | |
| 342 | + | |
| 343 | 343 | /** |
| 344 | 344 | * put your comment there... |
| 345 | - * | |
| 345 | + * | |
| 346 | 346 | * @param mixed $vPath |
| 347 | 347 | * @param mixed $base |
| 348 | 348 | */ |
| 349 | - public static function resolvePath( $vPath, $base = CJTOOLBOX_PATH ) | |
| 349 | + public static function resolvePath( $vPath, $base = CJTOOLBOX_PATH ) | |
| 350 | 350 | { |
| 351 | 351 | // Resolve CJT extensions path |
| 352 | - if ( strpos( $vPath, 'extension://' ) === 0 ) | |
| 352 | + if ( strpos( $vPath, 'extension://' ) === 0 ) | |
| 353 | 353 | { |
| 354 | 354 | // Remove extension wrapper |
| 355 | 355 | $vPath = str_replace( 'extension://', '', $vPath ); |
| 356 | - | |
| 356 | + | |
| 357 | 357 | // Point to plugin directory |
| 358 | 358 | $base = WP_PLUGIN_DIR; |
| 359 | - | |
| 359 | + | |
| 360 | 360 | } |
| 361 | 361 | // Replace all :'s with /'s. |
| 362 | 362 | $path = str_replace( ':', '/', $vPath ); |
| 363 | 363 | $path = "{$base}/{$path}"; |
| 364 | - | |
| 364 | + | |
| 365 | 365 | return self::trigger( 'cssJSToolbox.resolvepath', $path, $vPath ); |
| 366 | 366 | } |
| 367 | - | |
| 367 | + | |
| 368 | 368 | }// End Class |
| 369 | 369 | |
| 370 | 370 | // Hookable! |
| 371 | 371 | cssJSToolbox::define( 'cssJSToolbox', array( 'hookType' => CJTWordpressEvents::HOOK_FILTER ) ); |