PluginProbe
CSS & JavaScript Toolbox / 8.0.3
CSS & JavaScript Toolbox v8.0.3
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 +39 -81 trunk8.0.3 View file →
@@ -9,57 +9,50 @@
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 29 public $isClosed;
30 -
30 +
31 31 /**
32 32 * put your comment there...
33 - *
33 + *
34 34 * @var mixed
35 35 */
36 36 protected $localization;
37 -
38 - /**
39 - * put your comment there...
40 - *
41 - * @var mixed
42 - */
43 - protected $ontoolbox = array('parameters' => array('block'));
44 -
37 +
45 38 /**
46 39 * put your comment there...
47 - *
40 + *
48 41 * @var mixed
49 42 */
50 43 protected $params = array();
51 -
44 +
52 45 /**
53 46 * put your comment there...
54 - *
47 + *
55 48 * @var mixed
56 49 */
57 50 public $templateName = 'edit';
58 -
51 +
59 52 /**
60 53 * put your comment there...
61 - *
54 + *
62 55 */
63 56 public function __construct($viewInfo) {
64 57 parent::__construct($viewInfo);
65 58 // Enqueue Styles & Scripts.
@@ -69,29 +62,29 @@
69 62 $this->params = (object) $this->params;
70 63 // Load localization text.
71 64 $this->localization = require($this->getPath('public/js/jquery.block/jquery.block.localization.php'));
72 65 }
73 -
66 +
74 67 /**
75 68 * put your comment there...
76 - *
69 + *
77 70 */
78 71 public function display($template = null) {
79 72 // Import template.
80 73 echo $this->getTemplate($template ? $template : $this->templateName);
81 74 }
82 -
75 +
83 76 /**
84 77 * put your comment there...
85 - *
78 + *
86 79 */
87 80 public static function enqueueScripts() {
88 81 // Use related scripts.
89 82 self::useScripts(__CLASS__,
90 83 'jquery',
91 - 'common',
92 - 'wp-lists',
93 - 'postbox',
84 + 'common',
85 + 'wp-lists',
86 + 'postbox',
94 87 'thickbox',
95 88 'framework:js:hash:{CJT-}md5',
96 89 'framework:js:cookies:{CJT-}jquery.cookies.2.2.0',
97 90 'framework:js:ajax:{CJT-}cjt-server',
@@ -105,15 +98,15 @@
105 98 'views:blocks:block:public:js:{CJT-}codefile-manager',
106 99 'views:blocks:block:public:js:{CJT-}codefile',
107 100 'views:blocks:block:public:js:{CJT-}block',
108 101 'views:blocks:block:public:js:plugins:{CJT-}_dockmodule',
109 - 'views:blocks:block:public:js:{CJT-}jquery.block'
102 + 'views:blocks:block:public:js:{CJT-}jquery.block'
110 103 );
111 104 }
112 -
105 +
113 106 /**
114 107 * put your comment there...
115 - *
108 + *
116 109 */
117 110 public static function enqueueStyles() {
118 111 // Initialize style.
119 112 $styles = array(
@@ -128,82 +121,47 @@
128 121 }
129 122 // Include styles.
130 123 self::useStyles(__CLASS__, $styles);
131 124 }
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 -
125 +
143 126 /**
144 127 * put your comment there...
145 - *
128 + *
146 129 */
147 130 public function getBlock() {
148 - return $this->block;
131 + return $this->block;
149 132 }
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 -
133 +
174 134 /**
175 135 * put your comment there...
176 - *
136 + *
177 137 */
178 138 public function getMetaboxName() {
179 139 $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' />";
140 + return "<span class='block-name' title='{$tip}'>{$this->block->name}</span>";
183 141 }
184 -
142 +
185 143 /**
186 144 * put your comment there...
187 - *
145 + *
188 146 * @param mixed $id
189 147 */
190 148 public function getMetaboxId() {
191 149 return self::META_BOX_PREFIX ."-{$this->block->id}";
192 150 }
193 -
151 +
194 152 /**
195 153 * put your comment there...
196 - *
154 + *
197 155 * @param mixed $name
198 156 */
199 157 public function getOption($name) {
200 158 return $this->params->{$name};
201 159 }
202 -
160 +
203 161 /**
204 - *
205 - *
162 + *
163 + *
206 164 */
207 165 public function setBlock($block) {
208 166 // Set block.
209 167 $this->block = $block;
@@ -211,12 +169,12 @@
211 169 $closedBlockId = "cjtoolbox-{$this->block->id}";
212 170 $closedMetaboxes = get_user_meta(get_current_user_id(), 'closedpostboxes_cjtoolbox', true);
213 171 $this->isClosed = in_array($closedBlockId, ((array) $closedMetaboxes));
214 172 }
215 -
173 +
216 174 /**
217 175 * put your comment there...
218 - *
176 + *
219 177 * @param mixed $name
220 178 * @param mixed $value
221 179 */
222 180 public function setOption($name, $value) {
@@ -223,9 +181,9 @@
223 181 $this->params->{$name} = $value;
224 182 // Chains!
225 183 return $this;
226 184 }
227 -
185 +
228 186 } // End class.
229 187
230 188 // Hookable!
231 189 CJTBlocksBlockView::define('CJTBlocksBlockView');