PluginProbe
CSS & JavaScript Toolbox / 6.0.9
CSS & JavaScript Toolbox v6.0.9
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 | views/blocks/block/view.php +43 -110 trunk6.0.9 View file →
@@ -9,57 +9,43 @@
9 9 /**
10 10 * Blocks view
11 11 */
12 12 class CJTBlocksBlockView extends CJTView {
13 -
13 +
14 14 /** */
15 15 const META_BOX_PREFIX = 'cjtoolbox';
16 -
16 +
17 17 /**
18 18 * put your comment there...
19 - *
19 + *
20 20 * @var mixed
21 21 */
22 22 public $block = null;
23 -
23 +
24 24 /**
25 25 * put your comment there...
26 - *
26 + *
27 27 * @var mixed
28 28 */
29 - public $isClosed;
30 -
31 - /**
32 - * put your comment there...
33 - *
34 - * @var mixed
35 - */
36 29 protected $localization;
37 -
38 - /**
39 - * put your comment there...
40 - *
41 - * @var mixed
42 - */
43 - protected $ontoolbox = array('parameters' => array('block'));
44 -
30 +
45 31 /**
46 32 * put your comment there...
47 - *
33 + *
48 34 * @var mixed
49 35 */
50 36 protected $params = array();
51 -
37 +
52 38 /**
53 39 * put your comment there...
54 - *
40 + *
55 41 * @var mixed
56 42 */
57 43 public $templateName = 'edit';
58 -
44 +
59 45 /**
60 46 * put your comment there...
61 - *
47 + *
62 48 */
63 49 public function __construct($viewInfo) {
64 50 parent::__construct($viewInfo);
65 51 // Enqueue Styles & Scripts.
@@ -69,29 +55,29 @@
69 55 $this->params = (object) $this->params;
70 56 // Load localization text.
71 57 $this->localization = require($this->getPath('public/js/jquery.block/jquery.block.localization.php'));
72 58 }
73 -
59 +
74 60 /**
75 61 * put your comment there...
76 - *
62 + *
77 63 */
78 - public function display($template = null) {
64 + public function display() {
79 65 // Import template.
80 - echo $this->getTemplate($template ? $template : $this->templateName);
66 + echo $this->getTemplate($this->templateName);
81 67 }
82 -
68 +
83 69 /**
84 70 * put your comment there...
85 - *
71 + *
86 72 */
87 73 public static function enqueueScripts() {
88 74 // Use related scripts.
89 75 self::useScripts(__CLASS__,
90 - 'jquery',
91 - 'common',
92 - 'wp-lists',
93 - 'postbox',
76 + 'jquery',
77 + 'common',
78 + 'wp-lists',
79 + 'postbox',
94 80 'thickbox',
95 81 'framework:js:hash:{CJT-}md5',
96 82 'framework:js:cookies:{CJT-}jquery.cookies.2.2.0',
97 83 'framework:js:ajax:{CJT-}cjt-server',
@@ -99,124 +85,71 @@
99 85 'framework:js:ui:{CJT-}jquery.toolbox',
100 86 'framework:js:ace(loadMethod=Tag, lookFor=ace)',
101 87 'framework:js:ace:{CJT-}pluggable',
102 88 'views:blocks:block:public:js:{CJT-}ajax',
103 - 'views:blocks:block:public:js:{CJT-}blockproperty',
104 - 'views:blocks:block:public:js:optional:{CJT-}revision',
105 - 'views:blocks:block:public:js:{CJT-}codefile-manager',
106 - 'views:blocks:block:public:js:{CJT-}codefile',
107 89 'views:blocks:block:public:js:{CJT-}block',
108 - 'views:blocks:block:public:js:plugins:{CJT-}_dockmodule',
109 - 'views:blocks:block:public:js:{CJT-}jquery.block'
90 + 'views:blocks:block:public:js:{CJT-}jquery.block'
110 91 );
111 92 }
112 -
93 +
113 94 /**
114 95 * put your comment there...
115 - *
96 + *
116 97 */
117 98 public static function enqueueStyles() {
118 - // Initialize style.
119 - $styles = array(
99 + // Use related styles.
100 + self::useStyles(__CLASS__,
120 101 'thickbox',
121 - 'views:blocks:block:public:css:{CJT-}block',
122 - 'views:blocks:block:public:css:{CJT-}codefile'
102 + 'views:blocks:block:public:css:{CJT-}block'
123 103 );
124 - // IF WP < 3.8 add compatibility CSS file.
125 - $wpVersion = new CJT_Framework_Wordpress_Currentversion();
126 - if ($wpVersion->isLess('3.8')) {
127 - $styles[] = 'views:blocks:block:public:css:{CJT-}block-wp-lt-3.8';
128 - }
129 - // Include styles.
130 - self::useStyles(__CLASS__, $styles);
131 104 }
132 -
133 - /**
134 - * put your comment there...
135 - *
136 - * @param mixed $block
137 - */
138 - public function getAllAssignments() {
139 -
140 - return CJTBlocksModel::getAllAssignments($this->block);
141 - }
142 -
105 +
143 106 /**
144 107 * put your comment there...
145 - *
108 + *
146 109 */
147 110 public function getBlock() {
148 - return $this->block;
111 + return $this->block;
149 112 }
150 -
151 - /**
152 - * put your comment there...
153 - *
154 - */
155 - public function getHookStatus() {
156 -
157 - $hooksAttacher =& CJTBlocksCouplingController::theInstance()->getHooksAttacher();
158 -
159 - $locationText = $hooksAttacher->getHookText($this->block->location);
160 - $locationTitle = $hooksAttacher->getHookText($this->block->location, 'title');
161 - $badLocationClass = '';
162 -
163 - if(!$locationText) {
164 -
165 - $badLocationClass = 'bad-location-specified';
166 - $locationText = cssJSToolbox::getText('Hook is not supported, it might be assigned by some kind of CJT hooks extensions. You either need to re-enable/re-install that extension or change the hook value to one of the supported hooks');
167 - }
168 -
169 - $text = compact('badLocationClass', 'locationText', 'locationTitle');
170 -
171 - return $text;
172 - }
173 -
113 +
174 114 /**
175 115 * put your comment there...
176 - *
116 + *
177 117 */
178 118 public function getMetaboxName() {
179 119 $tip = cssJSToolbox::getText('Click to update Block name');
180 - // Escape the stored block name for the HTML attribute context to prevent stored XSS (CVE-2025-13533).
181 - $escapedName = esc_attr($this->block->name);
182 - return "<input name='cjtoolbox[{$this->block->id}][name]' type='text' class='block-name' value='{$escapedName}' title='{$tip}' maxlength='50' />";
120 + return "<span class='block-name' title='{$tip}'>{$this->block->name}</span>";
183 121 }
184 -
122 +
185 123 /**
186 124 * put your comment there...
187 - *
125 + *
188 126 * @param mixed $id
189 127 */
190 128 public function getMetaboxId() {
191 129 return self::META_BOX_PREFIX ."-{$this->block->id}";
192 130 }
193 -
131 +
194 132 /**
195 133 * put your comment there...
196 - *
134 + *
197 135 * @param mixed $name
198 136 */
199 137 public function getOption($name) {
200 138 return $this->params->{$name};
201 139 }
202 -
140 +
203 141 /**
204 - *
205 - *
142 + *
143 + *
206 144 */
207 145 public function setBlock($block) {
208 - // Set block.
209 146 $this->block = $block;
210 - // Get block state (opened/closes)
211 - $closedBlockId = "cjtoolbox-{$this->block->id}";
212 - $closedMetaboxes = get_user_meta(get_current_user_id(), 'closedpostboxes_cjtoolbox', true);
213 - $this->isClosed = in_array($closedBlockId, ((array) $closedMetaboxes));
214 147 }
215 -
148 +
216 149 /**
217 150 * put your comment there...
218 - *
151 + *
219 152 * @param mixed $name
220 153 * @param mixed $value
221 154 */
222 155 public function setOption($name, $value) {
@@ -223,9 +156,9 @@
223 156 $this->params->{$name} = $value;
224 157 // Chains!
225 158 return $this;
226 159 }
227 -
160 +
228 161 } // End class.
229 162
230 163 // Hookable!
231 164 CJTBlocksBlockView::define('CJTBlocksBlockView');