CSS & JavaScript Toolbox - Version 6.0.14

Version Description

  • Add: Accept Shortcode parameters and segments. Provide PHP framework for code blocks to define, validate and reading Shortcode parameters.
  • Add: Allow using block 'name' in additional to 'id' when using Shortcodes.
  • Fix: Failed to work with non-ascii (e.g Arabic) characters.
  • Enhance: Viewing block info is now showing Shortcode using block 'name' instead of 'id'.
  • Enhance: Embedded Shortcode with its closing tag as the Shortcode content is now being used by the handler blocks.
  • Enhance: Revert block Shortcode 'force' parameter default value to 'true' therefoe allow using multiple Shortcode for the same block without setting 'force' attribute.
Download this release

Release Info

Developer xpointer
Plugin Icon 128x128 CSS & JavaScript Toolbox
Version 6.0.14
Comparing to
See all releases

Code changes from version 6.0.13 to 6.0.14

controllers/blocks-coupling.php CHANGED
@@ -43,6 +43,20 @@ class CJTBlocksCouplingController extends CJTController {
43
  */
44
  protected $filters = null;
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * put your comment there...
48
  *
@@ -162,6 +176,12 @@ class CJTBlocksCouplingController extends CJTController {
162
  * @return void
163
  */
164
  public function __construct() {
 
 
 
 
 
 
165
  // Initialize controller.
166
  parent::__construct(false);
167
  // Import related libraries
@@ -176,6 +196,20 @@ class CJTBlocksCouplingController extends CJTController {
176
  add_shortcode('cjtoolbox', array(&$this, 'shortcode'));
177
  }
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  /**
180
  * put your comment there...
181
  *
@@ -247,7 +281,6 @@ class CJTBlocksCouplingController extends CJTController {
247
  }
248
  }
249
  // For every location store blocks code into single string
250
- /** @todo Use method other data:// wrapper, its only available in Hight version of PHP (5.3 or so!) */
251
  $evaluatedCode = CJTPHPCodeEvaluator::getInstance($block)->exec()->getOutput();
252
  /** @todo Include Debuging info only if we're in debuging mode! */
253
  if (1) {
@@ -255,7 +288,7 @@ class CJTBlocksCouplingController extends CJTController {
255
  }
256
  $this->blocks['code'][$block->location] .= $this->onappendcode($evaluatedCode);
257
  // Store all used Ids in the CORRECT ORDER.
258
- $this->onActionIds[] = $blockId;
259
  }
260
  }
261
  // Return true if there is at least 1 block return within the set.
@@ -278,7 +311,15 @@ class CJTBlocksCouplingController extends CJTController {
278
  public function getFilters() {
279
  return $this->ongetfilters($this->filters);
280
  }
281
-
 
 
 
 
 
 
 
 
282
  /**
283
  * put your comment there...
284
  *
@@ -296,6 +337,14 @@ class CJTBlocksCouplingController extends CJTController {
296
  return $url;
297
  }
298
 
 
 
 
 
 
 
 
 
299
  /**
300
  * put your comment there...
301
  *
@@ -305,23 +354,22 @@ class CJTBlocksCouplingController extends CJTController {
305
  // The wrong call won't has $wp_query object set,
306
  // but this is only valid at Front end.
307
  if (!is_admin() && !$GLOBALS['wp_query']) {
308
- return;
309
  }
310
- // Get cache or get blocks if not cached.
311
- // If there is no cache or no blocks for output
312
- // do nothing.
313
- if ($this->getCached() || $this->getBlocks()) {
314
- $actionsPrefix = is_admin() ? 'admin' : 'wp';
315
- // Output blocks on various locations!
316
- add_action("{$actionsPrefix}_head", array(&$this, 'outputBlocks'), 30);
317
- add_action("{$actionsPrefix}_footer", array(&$this, 'outputBlocks'), 30);
 
 
 
 
 
318
  }
319
- // Make sure this is executed only once.
320
- // Sometimes wp hook run on backend and sometimes its not.
321
- // This method handle both front and backend requests.
322
- // Simply remove all hooks to ensure its run only one time.
323
- remove_action('wp', array(&$this, 'initCoupling'));
324
- remove_action('admin_init', array(&$this, 'initCoupling'));
325
  }
326
 
327
  /**
@@ -446,52 +494,31 @@ class CJTBlocksCouplingController extends CJTController {
446
  }
447
 
448
  /**
449
- * put your comment there...
 
 
 
 
 
 
 
450
  *
451
  * @param mixed $attributes
452
  */
453
- public function shortcode($attributes) {
454
- // Initialize vars.
455
- $replacement = '';
456
- // Default Class.
457
- if (!isset($attributes['class'])) {
458
- $class = 'block';
459
- }
460
- switch ($class) {
461
- case 'block':
462
- // Get is the default "operation"!
463
- if (!isset($attributes['op'])) {
464
- $attributes['op'] = 'get';
465
- }
466
- switch ($attributes['op']) {
467
- case 'get':
468
- // Import dependecies.
469
- cssJSToolbox::import('framework:db:mysql:xtable.inc.php', 'framework:php:evaluator:evaluator.inc.php');
470
- // Output block if 'force="true" or only if it wasn't already in the header/footer!
471
- if ((((isset($attributes['force'])) && ($attributes['force'] == "true")) || !in_array($attributes['id'], $this->onActionIds))) {
472
- // Id is being used!
473
- if ((isset($attributes['force'])) && ($attributes['force'] != 'true')) {
474
- $this->onActionIds[] = (int) $attributes['id'];
475
- }
476
- // Get block code.
477
- $block = CJTxTable::getInstance('block')
478
- ->set('id', $attributes['id'])
479
- ->load();
480
- // Only ACTIVE blocks!
481
- if ($block->get('state') != 'active') {
482
- return;
483
- }
484
- // Get block code, execute it as PHP!
485
- $replacement = CJTPHPCodeEvaluator::getInstance($block->getData())->exec()->getOutput();
486
- }
487
- break;
488
- }
489
- break;
490
- default:
491
- $replacement = cssJSToolbox::getText('Shortcode Type is not supported!! Only (block) type is currently available!!!');
492
- break;
493
- }
494
- return $replacement;
495
  }
496
 
497
  } // End class.
43
  */
44
  protected $filters = null;
45
 
46
+ /**
47
+ * put your comment there...
48
+ *
49
+ * @var mixed
50
+ */
51
+ protected $hasRun = false;
52
+
53
+ /**
54
+ * put your comment there...
55
+ *
56
+ * @var mixed
57
+ */
58
+ protected static $instance = null;
59
+
60
  /**
61
  * put your comment there...
62
  *
176
  * @return void
177
  */
178
  public function __construct() {
179
+ // Only one instance is allowed.
180
+ if (self::$instance) {
181
+ throw new Exception('Trying to instantiate multiple coupling instances!!');
182
+ }
183
+ // Hold the single instance we've!
184
+ self::$instance = $this;
185
  // Initialize controller.
186
  parent::__construct(false);
187
  // Import related libraries
196
  add_shortcode('cjtoolbox', array(&$this, 'shortcode'));
197
  }
198
 
199
+ /**
200
+ * put your comment there...
201
+ *
202
+ * @param mixed $id
203
+ */
204
+ public function addOnActionIds($id) {
205
+ // Add ID is not exists.
206
+ if (!in_array($id, $this->onActionIds)) {
207
+ $this->onActionIds[] = $id;
208
+ }
209
+ // Chaining.
210
+ return $this;
211
+ }
212
+
213
  /**
214
  * put your comment there...
215
  *
281
  }
282
  }
283
  // For every location store blocks code into single string
 
284
  $evaluatedCode = CJTPHPCodeEvaluator::getInstance($block)->exec()->getOutput();
285
  /** @todo Include Debuging info only if we're in debuging mode! */
286
  if (1) {
288
  }
289
  $this->blocks['code'][$block->location] .= $this->onappendcode($evaluatedCode);
290
  // Store all used Ids in the CORRECT ORDER.
291
+ $this->addOnActionIds($blockId);
292
  }
293
  }
294
  // Return true if there is at least 1 block return within the set.
311
  public function getFilters() {
312
  return $this->ongetfilters($this->filters);
313
  }
314
+
315
+ /**
316
+ * put your comment there...
317
+ *
318
+ */
319
+ public function getOnActionIds() {
320
+ return $this->onActionIds;
321
+ }
322
+
323
  /**
324
  * put your comment there...
325
  *
337
  return $url;
338
  }
339
 
340
+ /**
341
+ * put your comment there...
342
+ *
343
+ */
344
+ public function hasOnActionIds() {
345
+ return !empty($this->onActionIds);
346
+ }
347
+
348
  /**
349
  * put your comment there...
350
  *
354
  // The wrong call won't has $wp_query object set,
355
  // but this is only valid at Front end.
356
  if (!is_admin() && !$GLOBALS['wp_query']) {
357
+ return;
358
  }
359
+ // Don't run twice!
360
+ if (!$this->hasRun) {
361
+ // Stop running it again!
362
+ $this->hasRun = true;
363
+ // Get cache or get blocks if not cached.
364
+ // If there is no cache or no blocks for output
365
+ // do nothing.
366
+ if ($this->getCached() || $this->getBlocks()) {
367
+ $actionsPrefix = is_admin() ? 'admin' : 'wp';
368
+ // Output blocks on various locations!
369
+ add_action("{$actionsPrefix}_head", array(&$this, 'outputBlocks'), 30);
370
+ add_action("{$actionsPrefix}_footer", array(&$this, 'outputBlocks'), 30);
371
+ }
372
  }
 
 
 
 
 
 
373
  }
374
 
375
  /**
494
  }
495
 
496
  /**
497
+ * Wordpress do shortcode callback for
498
+ * CJT Shortcodes ([cjtoolbox ....])!
499
+ *
500
+ * This method role is to load the shortcode routines
501
+ * in order to handle the request.
502
+ *
503
+ * It doesn't do anything except deferring the shortcode
504
+ * codes from loaded until shortcode is really used!
505
  *
506
  * @param mixed $attributes
507
  */
508
+ public function shortcode($attributes, $content) {
509
+ // Instantiate Shortcode handler class.
510
+ cssJSToolbox::import('controllers:coupling:shortcode:shortcode.php');
511
+ $shortcode = new CJT_Controllers_Coupling_Shortcode($attributes, $content);
512
+ // Return Shortcode replacement!
513
+ return ((string) $shortcode);
514
+ }
515
+
516
+ /**
517
+ * put your comment there...
518
+ *
519
+ */
520
+ public static function & theInstance() {
521
+ return self::$instance;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  }
523
 
524
  } // End class.
controllers/blocks.php CHANGED
@@ -72,6 +72,13 @@ class CJTBlocksController extends CJTController {
72
  *
73
  */
74
  protected function installAction() {
 
 
 
 
 
 
 
75
  echo parent::displayAction();
76
  }
77
 
72
  *
73
  */
74
  protected function installAction() {
75
+ // Initialize.
76
+ $model = $this->getModel('installer');
77
+ // Do fresh installation if the installed version and the
78
+ // current version doesn't share the same release and edition signs.
79
+ if ($model->isUpgrade() && $model->isCommonRelease()) {
80
+ $this->request['layout'] = 'upgrade';
81
+ }
82
  echo parent::displayAction();
83
  }
84
 
controllers/coupling/shortcode/block/block.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ /**
10
+ * Handle block Shortcode.
11
+ */
12
+ class CJT_Controllers_Coupling_Shortcode_Block extends CJTHookableClass {
13
+
14
+ /**
15
+ * put your comment there...
16
+ *
17
+ * @var mixed
18
+ */
19
+ protected $attributes;
20
+
21
+ /**
22
+ * put your comment there...
23
+ *
24
+ * @var mixed
25
+ */
26
+ protected $content = null;
27
+
28
+ /**
29
+ * put your comment there...
30
+ *
31
+ * @var mixed
32
+ */
33
+ protected $options = array('force' => 'true', 'tag' => 'span');
34
+
35
+ /**
36
+ * put your comment there...
37
+ *
38
+ * @var mixed
39
+ */
40
+ protected $parameters = array();
41
+
42
+ /**
43
+ * put your comment there...
44
+ *
45
+ * @param mixed $attributes
46
+ * @param mixed $content
47
+ * @return CJT_Controllers_Coupling_Shortcode_Block
48
+ */
49
+ public function __construct($attributes, $content) {
50
+ // Hookable initiaization.
51
+ parent::__construct();
52
+ // Initialize.
53
+ $this->attributes = $attributes;
54
+ $this->content = $content;
55
+ }
56
+
57
+ /**
58
+ * put your comment there...
59
+ *
60
+ */
61
+ public function __toString() {
62
+ // Initialize.
63
+ $replacement = '';
64
+ $model = CJTModel::getInstance('coupling');
65
+ // Get shortcode options.
66
+ $this->options = array_merge($this->options, array_intersect_key($this->attributes, $this->options));
67
+ // Get shortcode parameters.
68
+ $this->parameters = array_diff_key($this->attributes, array_flip(array('force', 'tag', 'name', 'id')));
69
+ // Get Block fields to be used to query the block.
70
+ $blockQueryFields = array_intersect_key($this->attributes, array_flip(array('id', 'name')));
71
+ $coupling =& CJTBlocksCouplingController::theInstance();
72
+ // Import dependecies.
73
+ cssJSToolbox::import('framework:db:mysql:xtable.inc.php', 'framework:php:evaluator:evaluator.inc.php');
74
+ // Query block.
75
+ $block = CJTxTable::getInstance('block')
76
+ ->setData($blockQueryFields) // Set Creteria fields!
77
+ ->load(array_keys($blockQueryFields)); // Load using Creteria fields.
78
+ // Get block code if exists and is active block.
79
+ if ($block->get('id')) {
80
+ if ($block->get('state') == 'active') {
81
+ // Get stdCLass copy.
82
+ $block = $block->getData();
83
+ // Output block if 'force="true" or only if it wasn't already in the header/footer!
84
+ if (($this->options['force'] == 'true') || !in_array($block->id, $coupling->getOnActionIds())) {
85
+ // Id is being used!
86
+ $coupling->addOnActionIds((int) $block->id);
87
+ // CJT Block Standard Parameters object.
88
+ cssJSToolbox::import('framework:developer:interface:block:shortcode:shortcode.php');
89
+ $spi = new CJT_Framework_Developer_Interface_Block_Shortcode($block, $this->parameters, $this->content);
90
+ // Get block code, execute it as PHP!
91
+ $blockCode = CJTPHPCodeEvaluator::getInstance($block)->exec(array('cb' => $spi))->getOutput();
92
+ // CJT Shortcode markup interface (CSMI)!
93
+ // CSMI is HTML markup to identify the CJT block Shortcode replacement.
94
+ $replacement = "<{$this->options['tag']} id='{$spi->containerElementId()}' class='csmi csmi-bid-{$block->id} csmi-{$block->name}'>{$this->content}{$blockCode}</{$this->options['tag']}>";
95
+ }
96
+ }
97
+ }
98
+ else { // Invalid Shortcode block query!
99
+ $replacement = cssJSToolbox::getText('Could not find block specified! Please check out the Shortcode parameters.');
100
+ }
101
+ // Return shortcode replacement string.
102
+ return $replacement;
103
+ }
104
+
105
+ } // End class.
106
+
107
+ // Hookable!
108
+ CJT_Controllers_Coupling_Shortcode_Block::define('CJT_Controllers_Coupling_Shortcode_Block');
controllers/coupling/shortcode/shortcode.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ /**
10
+ *
11
+ *
12
+ * This is the first class name build for using autoload!
13
+ * Autoload is not being supported yet however this is the first
14
+ * class on the plain!!!!
15
+ */
16
+ class CJT_Controllers_Coupling_Shortcode extends CJTHookableClass {
17
+
18
+ /**
19
+ * put your comment there...
20
+ *
21
+ * @var mixed
22
+ */
23
+ protected $attributes;
24
+
25
+ /**
26
+ * put your comment there...
27
+ *
28
+ * @var mixed
29
+ */
30
+ protected $content = null;
31
+
32
+ /**
33
+ * put your comment there...
34
+ *
35
+ * @param mixed $attributes
36
+ * @param mixed $content
37
+ * @return CJT_Controllers_Coupling_Shortcode
38
+ */
39
+ public function __construct($attributes, $content) {
40
+ // Hookable initialization!
41
+ parent::__construct();
42
+ // Initialize.
43
+ $this->attributes = $attributes;
44
+ $this->content = $content;
45
+ }
46
+
47
+ /**
48
+ * put your comment there...
49
+ *
50
+ */
51
+ public function __toString() {
52
+ // Initialize.
53
+ $attributes =& $this->attributes;
54
+ // Default Class.
55
+ if (!isset($attributes['class'])) {
56
+ $shortcodeClass = 'block';
57
+ }
58
+ // Get Shortcode class file, check existance!
59
+ $shortcodeClassFile = cssJSToolbox::resolvePath('controllers:coupling:shortcode:block:block.php');
60
+ if (!file_exists($shortcodeClassFile)) {
61
+ throw new Exception('Shortcode Type is not supported!! Only (block) type is currently available!!!');
62
+ }
63
+ // Import shortcodee handler file.
64
+ require_once $shortcodeClassFile;
65
+ // Import class.
66
+ $className = "CJT_Controllers_Coupling_Shortcode_{$shortcodeClass}";
67
+ // Load shortcode 'CLASS' handler.
68
+ $shortcode = new $className($this->attributes, $this->content);
69
+ // Return Shortcode replacements.
70
+ return ((string) $shortcode);
71
+ }
72
+
73
+ } // End class
74
+
75
+ // Hookable!
76
+ CJT_Controllers_Coupling_Shortcode::define('CJT_Controllers_Coupling_Shortcode');
css-js-toolbox.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: CSS & JavaScript Toolbox
4
  Plugin URI: http://css-javascript-toolbox.com/css-javascript-toolbox-free
5
  Description: CJT Plugin for WordPress to easily add custom CSS and JavaScript to individual pages
6
- Version: 6.0.13
7
  Author: Wipeout Media
8
  Author URI: http://css-javascript-toolbox.com/
9
 
@@ -86,12 +86,12 @@ class CJTPlugin extends CJTHookableClass {
86
  /**
87
  *
88
  */
89
- const DB_VERSION = '1.0-CE';
90
 
91
  /**
92
  *
93
  */
94
- const VERSION = '6.0 CE' ;
95
 
96
  /**
97
  *
3
  Plugin Name: CSS & JavaScript Toolbox
4
  Plugin URI: http://css-javascript-toolbox.com/css-javascript-toolbox-free
5
  Description: CJT Plugin for WordPress to easily add custom CSS and JavaScript to individual pages
6
+ Version: 6.0.14
7
  Author: Wipeout Media
8
  Author URI: http://css-javascript-toolbox.com/
9
 
86
  /**
87
  *
88
  */
89
+ const DB_VERSION = '1.1-CE';
90
 
91
  /**
92
  *
93
  */
94
+ const VERSION = '6.0.14 CE';
95
 
96
  /**
97
  *
framework/developer/interface/block/parameters/parameters.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ /**
10
+ *
11
+ */
12
+ class CJT_Framework_Developer_Interface_Block_Parameters {
13
+
14
+ /**
15
+ * put your comment there...
16
+ *
17
+ * @var mixed
18
+ */
19
+ protected $params = array();
20
+
21
+ /**
22
+ * put your comment there...
23
+ *
24
+ * @var mixed
25
+ */
26
+ protected $uParams = null;
27
+
28
+ /**
29
+ * put your comment there...
30
+ *
31
+ * @param mixed $params
32
+ * @return CJT_Framework_Developer_Interface_Block_Parameters
33
+ */
34
+ public function __construct($params) {
35
+ $this->uParams = $params;
36
+ }
37
+
38
+ /**
39
+ * put your comment there...
40
+ *
41
+ * @param mixed $name
42
+ * @param mixed $type
43
+ * @param mixed $default
44
+ */
45
+ public function add($name, $type, $default = null) {
46
+ // Add to params definition list.
47
+ // Use lower case for ket as Wordpress shortcode parameters
48
+ // is always transformed to lowercase.
49
+ $this->params[strtolower($name)] = array('name' => $name, 'type' => $type, 'default' => $default);
50
+ // Chaining.
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ * put your comment there...
56
+ *
57
+ * @param mixed $name
58
+ */
59
+ public function get($name) {
60
+ // Allow writing it in the original case inside the code
61
+ // however its only retrived by the lowercvase letter.
62
+ return $this->uParams[strtolower($name)];
63
+ }
64
+
65
+ /**
66
+ * put your comment there...
67
+ *
68
+ */
69
+ public function & getArray() {
70
+ return $this->uParams;
71
+ }
72
+
73
+ /**
74
+ * put your comment there...
75
+ *
76
+ */
77
+ public function & getDefinition() {
78
+ return $this->params;
79
+ }
80
+
81
+ /**
82
+ * put your comment there...
83
+ *
84
+ * @param mixed $excludes
85
+ * @return CJT_Framework_Developer_Interface_Block_Parameters_Transform_Json
86
+ */
87
+ public function json($excludes = null) {
88
+ // Internal json trnsformer object caching!
89
+ cssJSToolbox::import('framework:developer:interface:block:parameters:transform:json:json.php');
90
+ return new CJT_Framework_Developer_Interface_Block_Parameters_Transform_Json($this, $excludes);
91
+ }
92
+
93
+ /**
94
+ * put your comment there...
95
+ *
96
+ */
97
+ public function validate() {
98
+ // Get params definition copy!
99
+ $dParams = $this->params;
100
+ // Validate passed parameters agianst the definition.
101
+ foreach ($this->uParams as $name => & $value) {
102
+ // Check parameter existance.
103
+ if (!isset($this->params[$name])) {
104
+ // Warn user that the parameter is not exists!
105
+ echo cssJSToolbox::getText("Invalid Block Shortcode parameters [{$name}]");
106
+ // Remove from list.
107
+ unset($this->uParams[$name]);
108
+ }
109
+ // Get parameter type.
110
+ $type = $dParams[$name]['type'];
111
+ // Cast to correct type.
112
+ switch ($type) {
113
+ case 'array':
114
+ case 'object':
115
+ // Convert CJT JSON Array and Object to JSON object.
116
+ $value = str_replace(array('{A', '{O', 'A}', 'O}'), array('[', '[', ']', ']'), $value);
117
+ // Get PHP var for JSON text!
118
+ $value = json_decode($value);
119
+ break;
120
+ case 'boolean':
121
+ // Case boolean from string.
122
+ $value = ($value == "true") ? true: false;
123
+ break;
124
+ default:
125
+ // PHP native cast.
126
+ settype($value, $type);
127
+ break;
128
+ }
129
+ // As the parameter is passed by user don't need the default.
130
+ unset($dParams[$name]);
131
+ }
132
+ // Get other parameters not passed by user!
133
+ // Get only parameters with default value !== null.
134
+ foreach ($dParams as $name => $param) {
135
+ if ($param['default'] !== null) {
136
+ $this->uParams[$name] = $param['default'];
137
+ }
138
+ }
139
+ // Chaining.
140
+ return $this;
141
+ }
142
+
143
+ } // End class.
framework/developer/interface/block/parameters/transform/json/json.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ /**
10
+ *
11
+ */
12
+ class CJT_Framework_Developer_Interface_Block_Parameters_Transform_Json {
13
+
14
+ /**
15
+ * put your comment there...
16
+ *
17
+ * @var mixed
18
+ */
19
+ protected $excludes = null;
20
+
21
+ /**
22
+ * put your comment there...
23
+ *
24
+ * @var CJT_Framework_Developer_Interface_Block_Parameters
25
+ */
26
+ protected $params = null;
27
+
28
+ /**
29
+ * put your comment there...
30
+ *
31
+ * @param CJT_Framework_Developer_Interface_Block_Parameters $params
32
+ * @return CJT_Framework_Developer_Interface_Block_Parameters_Transform_Json
33
+ */
34
+ public function __construct($params, $excludes) {
35
+ // Initialize.
36
+ $this->params = $params;
37
+ $this->excludes = explode(',', $excludes);
38
+ }
39
+
40
+ /**
41
+ * put your comment there...
42
+ *
43
+ */
44
+ public function __toString() {
45
+ // Initialize.
46
+ $params = array();
47
+ // Get all passed parameters as array!
48
+ // Remove excluded list.
49
+ $uParams = array_diff_key($this->params->getArray(), array_flip($this->excludes));
50
+ $definition =& $this->params->getDefinition();
51
+ // Get values for all parameters required to be represented as json object.
52
+ foreach ($uParams as $name => & $value) {
53
+ // Use Character case as defined in the parameters
54
+ // definition other than the user passed parameter name.
55
+ // User parameter read in lowercase other than the original.
56
+ $params[$definition[$name]['name']] = $value;
57
+ }
58
+ // Javascript Object Notation.
59
+ return json_encode((object) $params);
60
+ }
61
+
62
+ } // End class.
framework/developer/interface/block/shortcode/segments/segments.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ /**
10
+ *
11
+ */
12
+ class CJT_Framework_Developer_Interface_Block_Shortcode_Segments extends CJT_Framework_Developer_Interface_Block_Parameters {
13
+
14
+ /**
15
+ * put your comment there...
16
+ *
17
+ * @var mixed
18
+ */
19
+ protected $content = null;
20
+
21
+ /**
22
+ * put your comment there...
23
+ *
24
+ * @param mixed $content
25
+ * @return CJT_Framework_Developer_Interface_Block_Shortcode_Segments
26
+ */
27
+ public function __construct(& $content) {
28
+ // Initialize.
29
+ $this->content =& $content;
30
+ // Initialize parent.
31
+ parent::__construct(array());
32
+ }
33
+
34
+ /**
35
+ * put your comment there...
36
+ *
37
+ */
38
+ public function validate() {
39
+ // Read segments from Shortcode content.
40
+ $segments = preg_split('/(\w+)\=\:\s+/', $this->content, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
41
+ // All even indexes if for segment names and
42
+ // odd index for values.
43
+ for ($index = 0; $index < count($segments); $index+=2) {
44
+ // Get key from current item and value from the next.
45
+ $this->uParams[$segments[$index]] = $segments[$index + 1];
46
+ }
47
+ // Parent vaidation.
48
+ return parent::validate();
49
+ }
50
+
51
+ } // End class.
framework/developer/interface/block/shortcode/shortcode.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ /**
10
+ *
11
+ */
12
+ class CJT_Framework_Developer_Interface_Block_Shortcode {
13
+
14
+ /**
15
+ * put your comment there...
16
+ *
17
+ * @var mixed
18
+ */
19
+ protected $bcid;
20
+
21
+ /**
22
+ * put your comment there...
23
+ *
24
+ * @var mixed
25
+ */
26
+ protected $block = null;
27
+
28
+ /**
29
+ * put your comment there...
30
+ *
31
+ * @var mixed
32
+ */
33
+ protected $containerElementId = null;
34
+
35
+ /**
36
+ * put your comment there...
37
+ *
38
+ * @var mixed
39
+ */
40
+ protected $content = null;
41
+
42
+ /**
43
+ * put your comment there...
44
+ *
45
+ * @var mixed
46
+ */
47
+ protected $parameters = null;
48
+
49
+ /**
50
+ * put your comment there...
51
+ *
52
+ * @var CJT_Framework_Developer_Interface_Block_Shortcode_Segments
53
+ */
54
+ protected $segments = null;
55
+
56
+ /**
57
+ * put your comment there...
58
+ *
59
+ * @param mixed $block
60
+ * @param mixed $parameters
61
+ * @param mixed $content
62
+ * @return CJT_Framework_Developer_Interface_Block_Shortcode
63
+ */
64
+ public function __construct($block, $parameters, & $content) {
65
+ // Initialize.
66
+ $this->block = $block;
67
+ $this->content =& $content;
68
+ cssJSToolbox::import('framework:developer:interface:block:parameters:parameters.php');
69
+ $this->parameters = new CJT_Framework_Developer_Interface_Block_Parameters($parameters);
70
+ cssJSToolbox::import('framework:developer:interface:block:shortcode:segments:segments.php');
71
+ $this->segments = new CJT_Framework_Developer_Interface_Block_Shortcode_Segments($this->cleanContent());
72
+ // Generate Shortcode block container id.
73
+ $this->bcid = md5(microtime());
74
+ // Build block container element id.
75
+ $this->containerElementId = "csmi-{$this->bcid}";
76
+ }
77
+
78
+ /**
79
+ * put your comment there...
80
+ *
81
+ */
82
+ public function bcid() {
83
+ return $this->bcid;
84
+ }
85
+
86
+ /**
87
+ * put your comment there...
88
+ *
89
+ */
90
+ public function block() {
91
+ return $this->block;
92
+ }
93
+
94
+ /**
95
+ * put your comment there...
96
+ *
97
+ */
98
+ public function & cleanContent() {
99
+ // Shortcode content.
100
+ $content = $this->content();
101
+ // Strip <BR /> tags added by Wordpress.
102
+ $content = str_replace("<br />\n", "\n", $content);
103
+ // Remove first and last.
104
+ $content = preg_replace(array('/^\xA/', '/\xA$/'), '', $content);;
105
+ return $content;
106
+ }
107
+
108
+ /**
109
+ * put your comment there...
110
+ *
111
+ */
112
+ public function containerElementId() {
113
+ return $this->containerElementId;
114
+ }
115
+
116
+ /**
117
+ * put your comment there...
118
+ *
119
+ * @param mixed $new
120
+ */
121
+ public function content($value = null) {
122
+ // Return content until its a __setter_.
123
+ $result = $this->content;
124
+ // Set value if apssed.
125
+ if ($value !== null) {
126
+ $this->content = $value;
127
+ $result = $this;
128
+ }
129
+ return $result;
130
+ }
131
+
132
+ /**
133
+ * put your comment there...
134
+ *
135
+ */
136
+ public function fw() {
137
+ static $fw = null;
138
+ // Instantiate framework only when used.
139
+ if (!$fw) {
140
+ cssJSToolbox::import('framework:developer:developer.php');
141
+ $fw = new CJT_Framework_Developer($this->block);
142
+ }
143
+ return $fw;
144
+ }
145
+
146
+ /**
147
+ * put your comment there...
148
+ *
149
+ */
150
+ public function params() {
151
+ return $this->parameters;
152
+ }
153
+
154
+ /**
155
+ * put your comment there...
156
+ *
157
+ */
158
+ public function segments() {
159
+ return $this->segments;
160
+ }
161
+
162
+ /**
163
+ * put your comment there...
164
+ *
165
+ * @param mixed $done
166
+ */
167
+ public function write($done = null) {
168
+ if ($done) {
169
+ $this->content(ob_get_clean());
170
+ }
171
+ else {
172
+ ob_start();
173
+ }
174
+ return $this;
175
+ }
176
+
177
+ } // End class.
framework/mvc/controller.inc.php CHANGED
@@ -182,7 +182,7 @@ abstract class CJTController extends CJTHookableClass {
182
  */
183
  protected function displayAction() {
184
  // Get view layout!
185
- $layout = isset($_REQUEST['layout']) ? $_REQUEST['layout'] : 'default';
186
  ob_start();
187
  $this->view->display($layout);
188
  $content = ob_get_clean();
182
  */
183
  protected function displayAction() {
184
  // Get view layout!
185
+ $layout = isset($this->request['layout']) ? $this->request['layout'] : 'default';
186
  ob_start();
187
  $this->view->display($layout);
188
  $content = ob_get_clean();
includes/installer/installer/db/mysql/structure.sql CHANGED
@@ -19,7 +19,7 @@ CREATE TABLE IF NOT EXISTS `#__cjtoolbox_backups` (
19
  `id` int(11) NOT NULL AUTO_INCREMENT,
20
  PRIMARY KEY (`id`),
21
  UNIQUE KEY `name` (`name`)
22
- );
23
 
24
  /*
25
  * Blocks Table Structure!
@@ -45,7 +45,7 @@ CREATE TABLE IF NOT EXISTS `#__cjtoolbox_blocks` (
45
  PRIMARY KEY (`id`),
46
  UNIQUE KEY `name` (`name`,`backupId`),
47
  KEY `pinPoint` (`pinPoint`,`state`,`location`,`type`,`parent`)
48
- );
49
 
50
  /*
51
  * Blocks Pins table Structure!
@@ -57,4 +57,4 @@ CREATE TABLE IF NOT EXISTS `#__cjtoolbox_block_pins` (
57
  `value` int(11) NOT NULL,
58
  `attributes` int(4) NOT NULL DEFAULT '0',
59
  PRIMARY KEY (`blockId`,`pin`,`value`)
60
- )
19
  `id` int(11) NOT NULL AUTO_INCREMENT,
20
  PRIMARY KEY (`id`),
21
  UNIQUE KEY `name` (`name`)
22
+ ) CHARACTER SET = utf8, COLLATE=utf8_general_ci;
23
 
24
  /*
25
  * Blocks Table Structure!
45
  PRIMARY KEY (`id`),
46
  UNIQUE KEY `name` (`name`,`backupId`),
47
  KEY `pinPoint` (`pinPoint`,`state`,`location`,`type`,`parent`)
48
+ ) CHARACTER SET = utf8, COLLATE=utf8_general_ci;
49
 
50
  /*
51
  * Blocks Pins table Structure!
57
  `value` int(11) NOT NULL,
58
  `attributes` int(4) NOT NULL DEFAULT '0',
59
  PRIMARY KEY (`blockId`,`pin`,`value`)
60
+ ) CHARACTER SET = utf8, COLLATE=utf8_general_ci
includes/installer/upgrade/1.0-CE/db/mysql/structure.sql ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /* Upgrade database collation to unicode_general_ci */
2
+ ALTER TABLE #__cjtoolbox_backups CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
3
+ ALTER TABLE #__cjtoolbox_blocks CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
4
+ ALTER TABLE #__cjtoolbox_block_pins CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci
includes/installer/upgrade/1.0-CE/upgrade.class.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ /**
10
+ *
11
+ */
12
+ class CJTV10CEUpgrade {
13
+
14
+ /**
15
+ * put your comment there...
16
+ *
17
+ */
18
+ public function database() {
19
+ // Upgrade database tables.
20
+ cssJSToolbox::import('framework:installer:dbfile.class.php');
21
+ CJTDBFileInstaller::getInstance(cssJSToolbox::resolvePath('includes:installer:upgrade:1.0-CE:db:mysql:structure.sql'))->exec();
22
+ // Chaining.
23
+ return $this;
24
+ }
25
+
26
+ /**
27
+ * put your comment there...
28
+ *
29
+ */
30
+ public function finalize() {
31
+ // Upgrade database internal version number using
32
+ // installer class.
33
+ cssJSToolbox::import('includes:installer:installer:installer.class.php');
34
+ CJTInstaller::getInstance()->finalize();
35
+ // Chaining.
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * put your comment there...
41
+ *
42
+ */
43
+ public static function getInstance() {
44
+ return new CJTV10CEUpgrade();
45
+ }
46
+
47
+ } // End class.
models/blocks.php CHANGED
@@ -192,7 +192,7 @@ class CJTBlocksModel {
192
  $info = reset($info);
193
  $info->owner = get_userdata($info->owner);
194
  // Set shortcode name.
195
- $info->shortcode = "[cjtoolbox id='{$info->id}']";
196
  return $info;
197
  }
198
 
192
  $info = reset($info);
193
  $info->owner = get_userdata($info->owner);
194
  // Set shortcode name.
195
+ $info->shortcode = "[cjtoolbox name='{$info->name}']";
196
  return $info;
197
  }
198
 
models/installer.php CHANGED
@@ -173,6 +173,27 @@ class CJTInstallerModel {
173
  return $result;
174
  }
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  /**
177
  * put your comment there...
178
  *
173
  return $result;
174
  }
175
 
176
+ /**
177
+ * put your comment there...
178
+ *
179
+ */
180
+ public function isCommonRelease() {
181
+ // Check weather the current installed version is in the same
182
+ // release with the running version.
183
+ // Get instaleled version components.
184
+ $ivComponent = explode('.', str_replace('-', '.', $this->getInstalledDbVersion()));
185
+ $nvComponent = explode('.', str_replace('-', '.', CJTPlugin::DB_VERSION));
186
+ // Use PE-Edition sign if not sign used!
187
+ if (!isset($ivComponent[2])) {
188
+ $ivComponent[2] = 'PE';
189
+ }
190
+ if (!isset($nvComponent[2])) {
191
+ $nvComponent[2] = 'PE';
192
+ }
193
+ // TRUE if same, FALSE otherwise.
194
+ return (($ivComponent[0] == $nvComponent[0]) && ($ivComponent[2] == $nvComponent[2]));
195
+ }
196
+
197
  /**
198
  * put your comment there...
199
  *
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
  === CSS & JavaScript Toolbox ===
2
  Contributors: wipeoutmedia
3
- Author URL: http://css-javascript-toolbox.com/
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EWDWF75JHT9Q6
5
  Tags: plug, customise, style, scripts, hack, Wordpress, contribute, enhancing, HTML, CSS, Javascript, PHP, execute, display, output, header, footer, apply, requests, match, hook, run
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Requires at least: 3.3
9
  Tested up to: 3.5.1
10
- Stable tag: 6.0.13
11
 
12
  Easily add custom CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them wherever you want.
13
 
@@ -127,6 +127,14 @@ Sometimes a bug decides to rear its ugly head and when this happens, this is whe
127
 
128
  == Changelog ==
129
 
 
 
 
 
 
 
 
 
130
  = 6.0.13 =
131
  * Fix: CJT hijacks Plugins page after activate or deactivate a Plugin.
132
 
1
  === CSS & JavaScript Toolbox ===
2
  Contributors: wipeoutmedia
3
+ Author URL: http://css-javascript-toolbox.com
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EWDWF75JHT9Q6
5
  Tags: plug, customise, style, scripts, hack, Wordpress, contribute, enhancing, HTML, CSS, Javascript, PHP, execute, display, output, header, footer, apply, requests, match, hook, run
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Requires at least: 3.3
9
  Tested up to: 3.5.1
10
+ Stable tag: 6.0.14
11
 
12
  Easily add custom CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them wherever you want.
13
 
127
 
128
  == Changelog ==
129
 
130
+ = 6.0.14 =
131
+ * Add: Accept Shortcode parameters and segments. Provide PHP framework for code blocks to define, validate and reading Shortcode parameters.
132
+ * Add: Allow using block 'name' in additional to 'id' when using Shortcodes.
133
+ * Fix: Failed to work with non-ascii (e.g Arabic) characters.
134
+ * Enhance: Viewing block info is now showing Shortcode using block 'name' instead of 'id'.
135
+ * Enhance: Embedded Shortcode with its closing tag as the Shortcode content is now being used by the handler blocks.
136
+ * Enhance: Revert block Shortcode 'force' parameter default value to 'true' therefoe allow using multiple Shortcode for the same block without setting 'force' attribute.
137
+
138
  = 6.0.13 =
139
  * Fix: CJT hijacks Plugins page after activate or deactivate a Plugin.
140
 
views/blocks/block/tmpl/edit.html.tmpl CHANGED
@@ -25,7 +25,7 @@ defined('ABSPATH') or die("Access denied");
25
  <div class="cjcontainer">
26
  <div class="cjcodeblock">
27
  <div class="datablock">
28
- <textarea class="initCode" style="visibility:hidden"><?php echo htmlentities($this->block->code) ;?></textarea>
29
  <div id="editor-<?php echo $this->block->id ?>" class="code-editor">
30
  </div>
31
  </div>
25
  <div class="cjcontainer">
26
  <div class="cjcodeblock">
27
  <div class="datablock">
28
+ <textarea class="initCode" style="visibility:hidden"><?php echo htmlentities($this->block->code, null, 'UTF-8') ;?></textarea>
29
  <div id="editor-<?php echo $this->block->id ?>" class="code-editor">
30
  </div>
31
  </div>
views/blocks/manager/public/css/blocks.css CHANGED
@@ -1,9 +1,15 @@
1
  /** CSS &amp; Javascript Toolkit - blocks page CSS **/
2
  /* Wordpress Page */
3
  .wrap { position: relative; }
4
- #cjt-banner-bar {right: 0px;position: absolute;top: 2px;}
5
- #cjt-banner-bar .cjt-banner-link {float: right; margin-bottom: 6px;}
6
- #cjt-banner-bar .cjt-banner-link a, .cjt-banner-bar a:hover, .cjt-banner-bar a:visited{color: #A5581B;}
 
 
 
 
 
 
7
  .blocks-icon32 { background: transparent url('../images/CSS_JS_Toolbox_Icon.png') no-repeat; }
8
  #post-body{ display: none; min-width:700px; }
9
  /* Give extra space for the last Block Code-Auto-Completion dialog */
1
  /** CSS &amp; Javascript Toolkit - blocks page CSS **/
2
  /* Wordpress Page */
3
  .wrap { position: relative; }
4
+ .cjt-banner-bar .cjt-banner-link a, .cjt-banner-bar a:hover, .cjt-banner-bar a:visited{color: #A5581B;}
5
+ #cjt-banner-bar-right {right: 0px;position: absolute;top: 2px;}
6
+ #cjt-banner-bar-right .cjt-banner-link {float: right; margin-bottom: 6px;}
7
+
8
+ #get-packages {margin-left: 15px;}
9
+ #get-packages-icon {display: inline-block; width: 13px; height: 15px; background-image: url('../images/get-packages.png'); margin-left: 3px;margin-bottom: -4px; margin-right: 5px;}
10
+
11
+ #review-icon {display: inline-block; width: 75px; height: 14px; background-image: url('../images/review.png');margin-bottom: -2px; margin-left: 12px;}
12
+
13
  .blocks-icon32 { background: transparent url('../images/CSS_JS_Toolbox_Icon.png') no-repeat; }
14
  #post-body{ display: none; min-width:700px; }
15
  /* Give extra space for the last Block Code-Auto-Completion dialog */
views/blocks/manager/public/images/get-packages.png ADDED
Binary file
views/blocks/manager/public/images/review.png ADDED
Binary file
views/blocks/manager/tmpl/blocks.html.tmpl CHANGED
@@ -9,14 +9,26 @@ defined('ABSPATH') or die("Access denied");
9
  <div id="cjtoolbox-admin" class="wrap">
10
  <div id="custom-icon" class="icon32 blocks-icon32"></div>
11
  <h2><?php echo cssJSToolbox::getText('CSS & Javascript Toolbox V6 CE') ?></h2>
12
- <div id="cjt-banner-bar">
13
- <span class="cjt-banner-link"><?php echo cssJSToolbox::getText('Need Help?') ?>&nbsp;&nbsp;&nbsp;<a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/css-javascript-toolbox-free/"><?php echo cssJSToolbox::getText('CJT V6 CE User Manual') ?></a></span>
14
- <br>
 
 
 
 
 
 
 
 
15
  <span class="cjt-banner-link">
16
- <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/category/scripts/"><?php echo cssJSToolbox::getText('Script Examples') ?></a>
17
- &nbsp;&nbsp;|&nbsp;&nbsp;
18
- <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/submit-a-script/"><?php echo cssJSToolbox::getText('Submit a Script') ?></a>
 
 
19
  </span>
 
 
20
  </div>
21
  <form id="cjtoolbox-blocks-page-form" method="post">
22
  <?php wp_nonce_field('cjtoolbox'); ?>
9
  <div id="cjtoolbox-admin" class="wrap">
10
  <div id="custom-icon" class="icon32 blocks-icon32"></div>
11
  <h2><?php echo cssJSToolbox::getText('CSS & Javascript Toolbox V6 CE') ?></h2>
12
+ <div id="cjt-banner-bar-left" class="cjt-banner-bar ">
13
+ <span class="cjt-banner-link">
14
+ <?php echo cssJSToolbox::getText('Upgrade To') ?>:&nbsp;&nbsp;
15
+ <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/css-javascript-toolbox-v6/"><?php echo cssJSToolbox::getText('CJT V6 Premium') ?></a>
16
+ </span>
17
+ <span id="get-packages" class="cjt-banner-link">
18
+ <span id="get-packages-icon"></span>
19
+ <a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/category/scripts/"><?php echo cssJSToolbox::getText('Get Script Packages') ?></a>
20
+ </span>
21
+ </div>
22
+ <div id="cjt-banner-bar-right" class="cjt-banner-bar ">
23
  <span class="cjt-banner-link">
24
+ <?php echo cssJSToolbox::getText('Support Us?') ?>&nbsp;&nbsp;&nbsp;
25
+ <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/css-javascript-toolbox#postform">
26
+ <?php echo cssJSToolbox::getText('Rate & Review') ?>
27
+ <span id="review-icon"></span>
28
+ </a>
29
  </span>
30
+ <br>
31
+ <span class="cjt-banner-link"><?php echo cssJSToolbox::getText('Need Help?') ?>&nbsp;&nbsp;&nbsp;<a target="_blank" href="http://<?php echo cssJSToolbox::CJT_WEB_SITE_DOMAIN ?>/css-javascript-toolbox-free/"><?php echo cssJSToolbox::getText('CJT V6 CE User Manual') ?></a></span>
32
  </div>
33
  <form id="cjtoolbox-blocks-page-form" method="post">
34
  <?php wp_nonce_field('cjtoolbox'); ?>
views/installer/install/tmpl/upgrade.html.tmpl ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+ ?>
9
+ <div class="cjt-installer-view">
10
+ <?php if (!$this->error) : ?>
11
+ <form name="installation-form" action="">
12
+ <input type="hidden" id="cjt-securityToken" value="<?php echo $this->securityToken ?>" />
13
+ <h1><?php echo cssJSToolbox::getText('Upgrading CJT Plugin') ?></h1>
14
+ <p><?php echo cssJSToolbox::getText('Please wait while we upgrading CJT Plugin installation! This process would take only a few seconds!') ?></p>
15
+ <p style="font-weight: bold;"><?php echo cssJSToolbox::getText('Please backup you database before processing!') ?></p>
16
+ <?php echo $this->getTemplate('upgrade', array('noHeaderMessage' => true), 'tmpl/upgrades'); ?>
17
+ <input type="button" name="install" value="<?php echo cssJSToolbox::getText('Upgrade') ?>" />
18
+ <?php else : ?>
19
+ <div class="error"><p><?php echo $this->error->getMessage() ?></p></div>
20
+ <br>
21
+ <?php endif ?>
22
+ </form>
23
+ </div>
views/installer/install/tmpl/upgrades/10ce.operations ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ // Disallow direct access.
7
+ defined('ABSPATH') or die("Access denied");
8
+
9
+ // Return operatrions!
10
+ return array(
11
+ 'database' => array('text' => cssJSToolbox::getText('Upgrading database')),
12
+ );
views/installer/install/tmpl/upgrades/upgrade.html.tmpl CHANGED
@@ -6,17 +6,20 @@
6
  // Disallow direct access.
7
  defined('ABSPATH') or die("Access denied");
8
  ?>
 
9
  <h3><?php echo cssJSToolbox::getText('Upgrading Plugin') ?></h3>
10
  <p><?php echo cssJSToolbox::getText('The upgrade process time estimation cannot be preditected because its based on the amount of data (blocks + other data) you\'ve created.') ?></p>
11
  <p><?php echo cssJSToolbox::getText('Important Note: It is highly recommended to upgrade the plugin using the same administrator or user that was used to manage the code blocks. This allows the upgrade system to obtain the code blocks \'ORDER\' from the current logged in administrators or users\' meta data.') ?></p>
 
12
  <ul class="installation-list upgrade">
13
  <?php
14
- // Get version operations.
15
- $operations = @include ("{$this->installedDbVersionId}.operations");
16
- $operations = $operations ? $operations : array();
17
- // Add last operations.
18
- $operations['finalize'] = array('text' => cssJSToolbox::getText('Finalize Upgrade.'));
19
- // Print upgrade operations.
20
- echo $this->getTemplate('default_operations_list', array('type' => 'upgrade', 'operations' => $operations));
 
21
  ?>
22
  </ul>
6
  // Disallow direct access.
7
  defined('ABSPATH') or die("Access denied");
8
  ?>
9
+ <?php if (!isset($noHeaderMessage)) : ?>
10
  <h3><?php echo cssJSToolbox::getText('Upgrading Plugin') ?></h3>
11
  <p><?php echo cssJSToolbox::getText('The upgrade process time estimation cannot be preditected because its based on the amount of data (blocks + other data) you\'ve created.') ?></p>
12
  <p><?php echo cssJSToolbox::getText('Important Note: It is highly recommended to upgrade the plugin using the same administrator or user that was used to manage the code blocks. This allows the upgrade system to obtain the code blocks \'ORDER\' from the current logged in administrators or users\' meta data.') ?></p>
13
+ <?php endif; ?>
14
  <ul class="installation-list upgrade">
15
  <?php
16
+ // Get version operations if there is operation file for current upgrader.
17
+ $versionPart = strtolower($this->installedDbVersionId);
18
+ $operationsFile = cssJSToolbox::resolvePath("views:installer:install:tmpl:upgrades:{$versionPart}.operations");
19
+ $operations = file_exists($operationsFile) ? require $operationsFile : array();
20
+ // Add last operations.
21
+ $operations['finalize'] = array('text' => cssJSToolbox::getText('Finalize Upgrade.'));
22
+ // Print upgrade operations.
23
+ echo $this->getTemplate('default_operations_list', array('type' => 'upgrade', 'operations' => $operations));
24
  ?>
25
  </ul>
views/tinymce/shortcodes/public/plugins/shortcode/shortcode.js CHANGED
@@ -33,7 +33,7 @@
33
  // Read selected block!
34
  var block = this;
35
  // Build shortcode!
36
- var shortcode = '[cjtoolbox id="' + block.id + '"]';
37
  // Insert shortcode at current cursor position.
38
  editor.selection.setContent(shortcode);
39
  editor.focus();
@@ -77,6 +77,8 @@
77
  function(id, block) {
78
  // Bind to select event!
79
  block.onclick = this._onselectblock;
 
 
80
  // Prepend ID to block title!
81
  block.title = '#' + id + ': ' + block.title;
82
  // Add item!
33
  // Read selected block!
34
  var block = this;
35
  // Build shortcode!
36
+ var shortcode = '[cjtoolbox name="' + block.name + '"][/cjtoolbox]';
37
  // Insert shortcode at current cursor position.
38
  editor.selection.setContent(shortcode);
39
  editor.focus();
77
  function(id, block) {
78
  // Bind to select event!
79
  block.onclick = this._onselectblock;
80
+ // Get a copy of block original name.
81
+ block.name = block.title;
82
  // Prepend ID to block title!
83
  block.title = '#' + id + ': ' + block.title;
84
  // Add item!