PluginProbe
CSS & JavaScript Toolbox / 6.1.3
CSS & JavaScript Toolbox v6.1.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
css-javascript-toolbox / views / blocks / block / view.php

view.php in CSS & JavaScript Toolbox 6.1.3, at views/blocks/block/view.php

170 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version view.php
4 */
5
6 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 /**
10 * Blocks view
11 */
12 class CJTBlocksBlockView extends CJTView {
13
14 /** */
15 const META_BOX_PREFIX = 'cjtoolbox';
16
17 /**
18 * put your comment there...
19 *
20 * @var mixed
21 */
22 public $block = null;
23
24 /**
25 * put your comment there...
26 *
27 * @var mixed
28 */
29 protected $localization;
30
31 /**
32 * put your comment there...
33 *
34 * @var mixed
35 */
36 protected $params = array();
37
38 /**
39 * put your comment there...
40 *
41 * @var mixed
42 */
43 public $templateName = 'edit';
44
45 /**
46 * put your comment there...
47 *
48 */
49 public function __construct($viewInfo) {
50 parent::__construct($viewInfo);
51 // Enqueue Styles & Scripts.
52 add_action('admin_print_styles', array(__CLASS__, 'enqueueStyles'));
53 add_action('admin_print_scripts', array(__CLASS__, 'enqueueScripts'));
54 // Cast params to object
55 $this->params = (object) $this->params;
56 // Load localization text.
57 $this->localization = require($this->getPath('public/js/jquery.block/jquery.block.localization.php'));
58 }
59
60 /**
61 * put your comment there...
62 *
63 */
64 public function display() {
65 // Import template.
66 echo $this->getTemplate($this->templateName);
67 }
68
69 /**
70 * put your comment there...
71 *
72 */
73 public static function enqueueScripts() {
74 // Use related scripts.
75 self::useScripts(__CLASS__,
76 'jquery',
77 'common',
78 'wp-lists',
79 'postbox',
80 'thickbox',
81 'framework:js:hash:{CJT-}md5',
82 'framework:js:cookies:{CJT-}jquery.cookies.2.2.0',
83 'framework:js:ajax:{CJT-}cjt-server',
84 'framework:js:ajax:{CJT-}cjt-server-queue',
85 'framework:js:ui:{CJT-}jquery.toolbox',
86 'framework:js:ace(loadMethod=Tag, lookFor=ace)',
87 'framework:js:ace:{CJT-}pluggable',
88 'views:blocks:block:public:js:{CJT-}ajax',
89 'views:blocks:block:public:js:{CJT-}blockproperty',
90 'views:blocks:block:public:js:optional:{CJT-}revision',
91 'views:blocks:block:public:js:{CJT-}block',
92 'views:blocks:block:public:js:{CJT-}jquery.block'
93 );
94 }
95
96 /**
97 * put your comment there...
98 *
99 */
100 public static function enqueueStyles() {
101 // Initialize style.
102 $styles = array('thickbox', 'views:blocks:block:public:css:{CJT-}block');
103 // IF WP < 3.8 add compatibility CSS file.
104 $wpVersion = new CJT_Framework_Wordpress_Currentversion();
105 if ($wpVersion->isLess('3.8')) {
106 $styles[] = 'views:blocks:block:public:css:{CJT-}block-wp-lt-3.8';
107 }
108 // Include styles.
109 self::useStyles(__CLASS__, $styles);
110 }
111
112 /**
113 * put your comment there...
114 *
115 */
116 public function getBlock() {
117 return $this->block;
118 }
119
120 /**
121 * put your comment there...
122 *
123 */
124 public function getMetaboxName() {
125 $tip = cssJSToolbox::getText('Click to update Block name');
126 return "<span class='block-name' title='{$tip}'>{$this->block->name}</span>";
127 }
128
129 /**
130 * put your comment there...
131 *
132 * @param mixed $id
133 */
134 public function getMetaboxId() {
135 return self::META_BOX_PREFIX ."-{$this->block->id}";
136 }
137
138 /**
139 * put your comment there...
140 *
141 * @param mixed $name
142 */
143 public function getOption($name) {
144 return $this->params->{$name};
145 }
146
147 /**
148 *
149 *
150 */
151 public function setBlock($block) {
152 $this->block = $block;
153 }
154
155 /**
156 * put your comment there...
157 *
158 * @param mixed $name
159 * @param mixed $value
160 */
161 public function setOption($name, $value) {
162 $this->params->{$name} = $value;
163 // Chains!
164 return $this;
165 }
166
167 } // End class.
168
169 // Hookable!
170 CJTBlocksBlockView::define('CJTBlocksBlockView');