PluginProbe
CSS & JavaScript Toolbox / 6.0.15
CSS & JavaScript Toolbox v6.0.15
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 | controllers/coupling/shortcode/block/block.php +16 -53 126.0.15 View file →
@@ -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");
@@ -9,40 +9,40 @@
9 9 /**
10 10 * Handle block Shortcode.
11 11 */
12 12 class CJT_Controllers_Coupling_Shortcode_Block extends CJTHookableClass {
13 -
13 +
14 14 /**
15 15 * put your comment there...
16 - *
16 + *
17 17 * @var mixed
18 18 */
19 19 protected $attributes;
20 -
20 +
21 21 /**
22 22 * put your comment there...
23 - *
23 + *
24 24 * @var mixed
25 25 */
26 26 protected $content = null;
27 -
27 +
28 28 /**
29 29 * put your comment there...
30 - *
30 + *
31 31 * @var mixed
32 32 */
33 33 protected $options = array('force' => 'true', 'tag' => 'span');
34 -
34 +
35 35 /**
36 36 * put your comment there...
37 - *
37 + *
38 38 * @var mixed
39 39 */
40 40 protected $parameters = array();
41 -
41 +
42 42 /**
43 43 * put your comment there...
44 - *
44 + *
45 45 * @param mixed $attributes
46 46 * @param mixed $content
47 47 * @return CJT_Controllers_Coupling_Shortcode_Block
48 48 */
@@ -55,9 +55,9 @@
55 55 }
56 56
57 57 /**
58 58 * put your comment there...
59 - *
59 + *
60 60 */
61 61 public function __toString() {
62 62 // Initialize.
63 63 $replacement = '';
@@ -83,53 +83,16 @@
83 83 // Output block if 'force="true" or only if it wasn't already in the header/footer!
84 84 if (($this->options['force'] == 'true') || !in_array($block->id, $coupling->getOnActionIds())) {
85 85 // Id is being used!
86 86 $coupling->addOnActionIds((int) $block->id);
87 - // Retrieve block code-files.
88 - $block->code = $model->getBlockCode($block->id);
89 - // Import Executable (PHP and HTML) templates.
90 - $block->code = $block->code . $model->getExecTemplatesCode($block->id);
91 87 // CJT Block Standard Parameters object.
92 - $spi = new CJT_Framework_Developer_Interface_Block_Shortcode_Shortcode($block, $this->parameters, $this->content);
88 + cssJSToolbox::import('framework:developer:interface:block:shortcode:shortcode.php');
89 + $spi = new CJT_Framework_Developer_Interface_Block_Shortcode($block, $this->parameters, $this->content);
93 90 // Get block code, execute it as PHP!
94 91 $blockCode = CJTPHPCodeEvaluator::getInstance($block)->exec(array('cb' => $spi))->getOutput();
95 92 // CJT Shortcode markup interface (CSMI)!
96 93 // CSMI is HTML markup to identify the CJT block Shortcode replacement.
97 -
98 - $__tag = filter_var($this->options['tag'], FILTER_SANITIZE_EMAIL);
99 -
100 - // CODE UPDATED -- START
101 - $replacement = "\n\n<!-- CJT Shortcode Block ({$block->id}) - {$block->name} - START -->\n
102 - <{$__tag} id='{$spi->containerElementId()}' class='csmi csmi-bid-{$block->id} csmi-{$block->name}'>
103 - {$this->content}{$blockCode}
104 - </{$__tag}>\n
105 - <!-- CJT Shortcode Block ({$block->id}) - {$block->name} - END -->\n\n";
106 - // CODE UPDATED -- END
107 -
108 - // Get linked templates.
109 - $linkedStylesheets = '';
110 - $templates = $model->getLinkedTemplates($block->id);
111 - $reverseTypes = array_flip(CJTCouplingModel::$templateTypes);
112 - // Enqueue all scripts & Direct Output for all Style Sheets!
113 - foreach ($templates as $template) {
114 - // Get Template type name.
115 - $typeName = $reverseTypes[$template->type];
116 - /**
117 - * @var WP_Dependencies
118 - */
119 - $queue = $model->getQueueObject($typeName);
120 - if (!in_array($template->queueName, $queue->done)) {
121 - if (!isset($queue->registered[$template->queueName])) {
122 - $queue->add($template->queueName, "/{$template->file}", null, $template->version, 1);
123 - }
124 - // Enqueue template!
125 - $queue->enqueue($template->queueName);
126 - }
127 - }
128 - // Prepend linked Stylesheets to the replacement.
129 - if (isset($linkedStylesheets) && !empty($linkedStylesheets)) {
130 - $replacement = "<style type='text/css'>{$linkedStylesheets}</style>{$replacement}";
131 - }
94 + $replacement = "<{$this->options['tag']} id='{$spi->containerElementId()}' class='csmi csmi-bid-{$block->id} csmi-{$block->name}'>{$this->content}{$blockCode}</{$this->options['tag']}>";
132 95 }
133 96 }
134 97 }
135 98 else { // Invalid Shortcode block query!
@@ -141,5 +104,5 @@
141 104
142 105 } // End class.
143 106
144 107 // Hookable!
145 -CJT_Controllers_Coupling_Shortcode_Block::define('CJT_Controllers_Coupling_Shortcode_Block');
108 +CJT_Controllers_Coupling_Shortcode_Block::define('CJT_Controllers_Coupling_Shortcode_Block');