PluginProbe
MaxButtons – Create buttons / 6.25
MaxButtons – Create buttons v6.25
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / blocks / border.php

border.php in MaxButtons – Create buttons 6.25, at blocks/border.php

327 lines 11.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace MaxButtons;
3 defined('ABSPATH') or die('No direct access permitted');
4 $blockClass["border"] = "borderBlock";
5 $blockOrder[30][] = "border";
6
7 class borderBlock extends maxBlock
8 {
9 protected $blockname = "border";
10 protected $fields = array("radius_top_left" =>
11 array("default" => "4px",
12 "css" => "border-top-left-radius"
13 ),
14 "radius_top_right" => array("default" => "4px",
15 "css" => "border-top-right-radius"
16 ),
17 "radius_bottom_left" => array("default" => "4px",
18 "css" => "border-bottom-left-radius"
19 ),
20 "radius_bottom_right" => array("default" => "4px",
21 "css" => "border-bottom-right-radius"
22 ),
23 "border_style" => array("default" => "solid",
24 "css" => "border-style"
25 ),
26 "border_width" => array("default" => "2px",
27 "css" => "border-width"
28 ),
29 "box_shadow_offset_left" => array("default" => "0px",
30 "css" => "box-shadow-offset-left",
31 "csspseudo" => "normal,hover"
32 ),
33 "box_shadow_offset_top" => array("default" => "0px",
34 "css" => "box-shadow-offset-top",
35 "csspseudo" => "normal,hover"),
36 "box_shadow_width" => array("default" => "2px",
37 "css" => "box-shadow-width",
38 "csspseudo" => "normal,hover"),
39 'box_shadow_spread' => array('default' => '0px',
40 'css' => 'box-shadow-spread',
41 'csspseudo' => 'normal,hover'),
42
43 );
44
45
46 function __construct()
47 {
48 parent::__construct();
49 $this->fields = apply_filters($this->blockname. "-block-fields",$this->fields);
50 $this->data[$this->blockname] = array(); //empty init
51 }
52
53 public function map_fields($map)
54 {
55 $map = parent::map_fields($map);
56 $map["box_shadow_offset_left"]["func"] = "updateBoxShadow";
57 $map["box_shadow_offset_top"]["func"] = "updateBoxShadow";
58 $map["box_shadow_width"]["func"] = "updateBoxShadow";
59 $map["box_shadow_spread"]["func"] = "updateBoxShadow";
60
61 $map["radius_top_left"]["func"] = "updateRadius";
62 $map["radius_top_right"]["func"] = "updateRadius";
63 $map["radius_bottom_left"]["func"] = "updateRadius";
64 $map["radius_bottom_right"]["func"] = "updateRadius";
65
66
67 return $map;
68 }
69
70 public function admin_fields()
71 {
72
73 $data = $this->data[$this->blockname];
74 foreach($this->fields as $field => $options)
75 {
76 $default = (isset($options["default"])) ? $options["default"] : '';
77 $$field = (isset($data[$field])) ? $data[$field] : $default;
78 ${$field . "_default"} = $default;
79 }
80
81 $maxbuttons_border_styles = array(
82 '' => '',
83 'dashed' => __('dashed','maxbuttons'),
84 'dotted' => __('dotted','maxbuttons'),
85 'double' => __('double','maxbuttons'),
86 'groove' => __('groove','maxbuttons'),
87 'inset' => __('inset','maxbuttons'),
88 'outset' => __('outset','maxbuttons'),
89 'ridge' => __('ridge','maxbuttons'),
90 'solid' => __('solid','maxbuttons')
91 );
92
93 $color_copy_self = __("Replace color from other field", "maxbuttons");
94 $color_copy_move = __("Copy Color to other field", "maxbuttons");
95
96 $admin = MB()->getClass('admin');
97
98 ?>
99 <div class="option-container mb_tab">
100 <div class="title"><?php _e('Border', 'maxbuttons') ?></div>
101 <div class="inside">
102
103
104 <?php
105 // Spacer
106 $fspacer = new maxField('spacer');
107 $fspacer->label = __('Radius','maxbuttons');
108 $fspacer->name = 'radius';
109 // $fspacer->output('start');
110
111 $admin->addField($fspacer, 'start');
112
113 // Radius left top
114 $radius_tleft = new maxField('number');
115 //$radius_tleft->label = __('Top Left', 'maxbuttons');
116 //$radius_tleft->label = '<span class="dashicons dashicons-arrow-left-alt2 rotate-right"></span>';
117 $radius_tleft->value = maxUtils::strip_px(maxBlocks::getValue('radius_top_left'));
118 $radius_tleft->id = 'radius_top_left';
119 $radius_tleft->name = $radius_tleft->id;
120 $radius_tleft->min = 0;
121 $radius_tleft->inputclass = 'tiny';
122 $radius_tleft->publish = false;
123 $rtl = $radius_tleft->output('');
124
125
126
127 // Radius right top
128 $radius_tright = new maxField('number');
129 //$radius_tright->label = __('Top Right', 'maxbuttons');
130 //$radius_tright->label = '<span class="dashicons dashicons-arrow-right-alt2 rotate-left"></span>';
131 $radius_tright->value = maxUtils::strip_px(maxBlocks::getValue('radius_top_right'));
132 $radius_tright->id = 'radius_top_right';
133 $radius_tright->name = $radius_tright->id;
134 $radius_tright->min = 0;
135 $radius_tright->inputclass = 'tiny';
136 $radius_tright->publish = false;
137 $rtr = $radius_tright->output('', '');
138
139
140 // Radius bottom left
141 $radius_bleft = new maxField('number');
142 //$radius_bleft->label = __('Bottom Left', 'maxbuttons');
143 //$radius_bleft->label = '<span class="dashicons dashicons-arrow-left-alt2 rotate-left"></span>';
144 $radius_bleft->value = maxUtils::strip_px(maxBlocks::getValue('radius_bottom_left'));
145 $radius_bleft->id = 'radius_bottom_left';
146 $radius_bleft->name = $radius_bleft->id;
147 $radius_bleft->min = 0;
148 $radius_bleft->inputclass = 'tiny';
149 $radius_bleft->publish = false;
150 $rbl = $radius_bleft->output('');
151
152 // Radius bottom right
153 $radius_bright = new maxField('number');
154 //$radius_bright->label = __('Bottom Right', 'maxbuttons');
155 //$radius_bright->label = '<span class="dashicons dashicons-arrow-right-alt2 rotate-right"></span>';
156 $radius_bright->value = maxUtils::strip_px(maxBlocks::getValue('radius_bottom_right'));
157 $radius_bright->id = 'radius_bottom_right';
158 $radius_bright->name = $radius_bright->id;
159 $radius_bright->min = 0;
160 $radius_bright->inputclass = 'tiny';
161 $radius_bright->publish = false;
162 $rbr = $radius_bright->output('', '');
163
164 // If all same, lock the corners for simultanious change.
165 if ($radius_tleft->value == $radius_tright->value &&
166 $radius_tright->value == $radius_bleft->value &&
167 $radius_bleft->value = $radius_bright->value)
168 {
169 $lock = 'lock';
170 }
171 else
172 $lock = 'unlock';
173
174 $radius = new maxField('radius');
175 $radius->radius_tl = $rtl;
176 $radius->label_tl = __('Top Left','maxbuttons');
177 $radius->radius_tr = $rtr;
178 $radius->label_tr = __('Top Right','maxbuttons');
179 $radius->radius_bl = $rbl;
180 $radius->label_bl = __('Bottom Left','maxbuttons');
181 $radius->radius_br = $rbr;
182 $radius->label_br = __('Bottom Right','maxbuttons');
183 $radius->lock = $lock;
184 //$radius->output('','end');
185
186 $admin->addField($radius, '', 'end');
187
188 // Border style
189 $bstyle = new maxField('generic');
190 $bstyle->label = __('Style','maxbuttons');
191 $bstyle->name = 'border_style';
192 $bstyle->id = $bstyle->name;
193 $bstyle->value= maxBlocks::getValue('border_style');
194 $bstyle->setDefault(maxBlocks::getDefault('border_style'));
195 $bstyle->content = maxUtils::selectify($bstyle->name, $maxbuttons_border_styles, $bstyle->value);
196 //$bstyle->output('start', 'end');
197
198 $admin->addField($bstyle, 'start', 'end');
199
200 // Border width
201 $bwidth = new maxField('number');
202 $bwidth->label = __('Width', 'maxbuttons');
203 $bwidth->name = 'border_width';
204 $bwidth->id = $bwidth->name;
205 $bwidth->value = maxUtils::strip_px( maxBlocks::getValue('border_width') );
206 $bwidth->min = 0;
207 $bwidth->inputclass = 'tiny';
208 //$bwidth->output('start','end');
209
210 $admin->addField($bwidth, 'start', 'end');
211
212 // Border Color
213 $bcolor = new maxField('color');
214 $bcolor->id = 'border_color';
215 $bcolor->name = $bcolor->id;
216 $bcolor->value = maxBlocks::getColorValue('border_color');
217 $bcolor->label = __('Border Color','maxbuttons');
218 $bcolor->copycolor = true;
219 $bcolor->bindto = 'border_color_hover';
220 $bcolor->copypos = 'right';
221 $bcolor->left_title = $color_copy_self;
222 $bcolor->right_title = $color_copy_move;
223 //$bcolor->output('start');
224
225 $admin->addField($bcolor ,'start');
226
227 // Border Color Hover
228 $bcolor_hover = new maxField('color');
229 $bcolor_hover->id = 'border_color_hover';
230 $bcolor_hover->name = $bcolor_hover->id;
231 $bcolor_hover->value = maxBlocks::getColorValue('border_color_hover');
232 $bcolor_hover->label = __('Hover','maxbuttons');
233 $bcolor_hover->copycolor = true;
234 $bcolor_hover->bindto = 'border_color';
235 $bcolor_hover->copypos = 'left';
236 $bcolor_hover->left_title = $color_copy_move;
237 $bcolor_hover->right_title = $color_copy_self;
238 // $bcolor_hover->output('','end');
239
240 $admin->addField($bcolor_hover, '', 'end');
241
242 // Shadow offset left
243 $bshadow = new maxField('number');
244 $bshadow->label = __('Shadow Offset Left','maxbuttons');
245 $bshadow->name = 'box_shadow_offset_left';
246 $bshadow->id = $bshadow->name;
247 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_offset_left') );
248 $bshadow->inputclass = 'tiny';
249 //$bshadow->output('start');
250
251 $admin->addField($bshadow, 'start');
252
253 // Shadow offset top
254 $bshadow = new maxField('number');
255 $bshadow->label = __('Shadow Offset Top','maxbuttons');
256 $bshadow->name = 'box_shadow_offset_top';
257 $bshadow->id = $bshadow->name;
258 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_offset_top') );
259 $bshadow->inputclass = 'tiny';
260 // $bshadow->output('','end');
261
262 $admin->addField($bshadow, '', 'end');
263
264 // Shadow width
265 $bshadow = new maxField('number');
266 $bshadow->label = __('Shadow Blur','maxbuttons');
267 $bshadow->name = 'box_shadow_width';
268 $bshadow->id = $bshadow->name;
269 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_width') );
270 $bshadow->inputclass = 'tiny';
271 //$bshadow->output('start','');
272
273 $admin->addField($bshadow, 'start', '');
274
275 $bspread = new maxField('number');
276 $bspread->label = __('Shadow Spread', 'maxbuttons');
277 $bspread->value = maxUtils::strip_px(maxBlocks::getValue('box_shadow_spread'));
278 $bspread->id = 'box_shadow_spread';
279 $bspread->name = $bspread->id;
280 $bspread->inputclass = 'tiny';
281 //$bspread->output('','end');
282
283 $admin->addField($bspread, '', 'end');
284
285 // Border Shadow Color
286 $scolor = new maxField('color');
287 $scolor->id = 'box_shadow_color';
288 $scolor->name = $scolor->id;
289 $scolor->value = maxBlocks::getColorValue('box_shadow_color');
290 $scolor->label = __('Border Shadow Color','maxbuttons');
291 $scolor->copycolor = true;
292 $scolor->bindto = 'box_shadow_color_hover';
293 $scolor->copypos = 'right';
294 $scolor->left_title = $color_copy_self;
295 $scolor->right_title = $color_copy_move;
296 //$scolor->output('start');
297
298 $admin->addField($scolor, 'start');
299
300 // Border Shadow Color Hover
301 $scolor_hover = new maxField('color');
302 $scolor_hover->id = 'box_shadow_color_hover';
303 $scolor_hover->name = $scolor_hover->id;
304 $scolor_hover->value = maxBlocks::getColorValue('box_shadow_color_hover');
305 $scolor_hover->label = __('Hover','maxbuttons');
306 $scolor_hover->copycolor = true;
307 $scolor_hover->bindto = 'box_shadow_color';
308 $scolor_hover->copypos = 'left';
309 $scolor_hover->left_title = $color_copy_self;
310 $scolor_hover->right_title = $color_copy_move;
311 //$scolor_hover->output('','end');
312
313 $admin->addField($scolor_hover, '','end');
314
315 $admin->display_fields();
316
317 ?>
318
319 </div>
320 </div>
321 <?php
322 } // admin fields
323
324 } // class
325
326 ?>
327