PluginProbe
CSS & JavaScript Toolbox / 6.0.6
CSS & JavaScript Toolbox v6.0.6
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 -108 116.0.6 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,122 +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 - return "<input name='cjtoolbox[{$this->block->id}][name]' type='text' class='block-name' value='{$this->block->name}' title='{$tip}' maxlength='50' />";
120 + return "<span class='block-name' title='{$tip}'>{$this->block->name}</span>";
181 121 }
182 -
122 +
183 123 /**
184 124 * put your comment there...
185 - *
125 + *
186 126 * @param mixed $id
187 127 */
188 128 public function getMetaboxId() {
189 129 return self::META_BOX_PREFIX ."-{$this->block->id}";
190 130 }
191 -
131 +
192 132 /**
193 133 * put your comment there...
194 - *
134 + *
195 135 * @param mixed $name
196 136 */
197 137 public function getOption($name) {
198 138 return $this->params->{$name};
199 139 }
200 -
140 +
201 141 /**
202 - *
203 - *
142 + *
143 + *
204 144 */
205 145 public function setBlock($block) {
206 - // Set block.
207 146 $this->block = $block;
208 - // Get block state (opened/closes)
209 - $closedBlockId = "cjtoolbox-{$this->block->id}";
210 - $closedMetaboxes = get_user_meta(get_current_user_id(), 'closedpostboxes_cjtoolbox', true);
211 - $this->isClosed = in_array($closedBlockId, ((array) $closedMetaboxes));
212 147 }
213 -
148 +
214 149 /**
215 150 * put your comment there...
216 - *
151 + *
217 152 * @param mixed $name
218 153 * @param mixed $value
219 154 */
220 155 public function setOption($name, $value) {
@@ -221,9 +156,9 @@
221 156 $this->params->{$name} = $value;
222 157 // Chains!
223 158 return $this;
224 159 }
225 -
160 +
226 161 } // End class.
227 162
228 163 // Hookable!
229 164 CJTBlocksBlockView::define('CJTBlocksBlockView');