PluginProbe
MaxButtons – Create buttons / 7.1
MaxButtons – Create buttons v7.1
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 7.1, at blocks/border.php

326 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 return $map;
67 }
68
69 public function admin_fields()
70 {
71
72 $data = $this->data[$this->blockname];
73 foreach($this->fields as $field => $options)
74 {
75 $default = (isset($options["default"])) ? $options["default"] : '';
76 $$field = (isset($data[$field])) ? $data[$field] : $default;
77 ${$field . "_default"} = $default;
78 }
79
80 $maxbuttons_border_styles = array(
81 '' => '',
82 'dashed' => __('dashed','maxbuttons'),
83 'dotted' => __('dotted','maxbuttons'),
84 'double' => __('double','maxbuttons'),
85 'groove' => __('groove','maxbuttons'),
86 'inset' => __('inset','maxbuttons'),
87 'outset' => __('outset','maxbuttons'),
88 'ridge' => __('ridge','maxbuttons'),
89 'solid' => __('solid','maxbuttons')
90 );
91
92 $color_copy_self = __("Replace color from other field", "maxbuttons");
93 $color_copy_move = __("Copy Color to other field", "maxbuttons");
94
95 $admin = MB()->getClass('admin');
96
97 ?>
98 <div class="option-container mb_tab">
99 <div class="title"><?php _e('Border', 'maxbuttons') ?></div>
100 <div class="inside">
101
102
103 <?php
104 // Spacer
105 $fspacer = new maxField('spacer');
106 $fspacer->label = __('Radius','maxbuttons');
107 $fspacer->name = 'radius';
108 // $fspacer->output('start');
109
110 $admin->addField($fspacer, 'start');
111
112 // Radius left top
113 $radius_tleft = new maxField('number');
114 //$radius_tleft->label = __('Top Left', 'maxbuttons');
115 //$radius_tleft->label = '<span class="dashicons dashicons-arrow-left-alt2 rotate-right"></span>';
116 $radius_tleft->value = maxUtils::strip_px(maxBlocks::getValue('radius_top_left'));
117 $radius_tleft->id = 'radius_top_left';
118 $radius_tleft->name = $radius_tleft->id;
119 $radius_tleft->min = 0;
120 $radius_tleft->inputclass = 'tiny';
121 $radius_tleft->publish = false;
122 $rtl = $radius_tleft->output('');
123
124
125
126 // Radius right top
127 $radius_tright = new maxField('number');
128 //$radius_tright->label = __('Top Right', 'maxbuttons');
129 //$radius_tright->label = '<span class="dashicons dashicons-arrow-right-alt2 rotate-left"></span>';
130 $radius_tright->value = maxUtils::strip_px(maxBlocks::getValue('radius_top_right'));
131 $radius_tright->id = 'radius_top_right';
132 $radius_tright->name = $radius_tright->id;
133 $radius_tright->min = 0;
134 $radius_tright->inputclass = 'tiny';
135 $radius_tright->publish = false;
136 $rtr = $radius_tright->output('', '');
137
138
139 // Radius bottom left
140 $radius_bleft = new maxField('number');
141 //$radius_bleft->label = __('Bottom Left', 'maxbuttons');
142 //$radius_bleft->label = '<span class="dashicons dashicons-arrow-left-alt2 rotate-left"></span>';
143 $radius_bleft->value = maxUtils::strip_px(maxBlocks::getValue('radius_bottom_left'));
144 $radius_bleft->id = 'radius_bottom_left';
145 $radius_bleft->name = $radius_bleft->id;
146 $radius_bleft->min = 0;
147 $radius_bleft->inputclass = 'tiny';
148 $radius_bleft->publish = false;
149 $rbl = $radius_bleft->output('');
150
151 // Radius bottom right
152 $radius_bright = new maxField('number');
153 //$radius_bright->label = __('Bottom Right', 'maxbuttons');
154 //$radius_bright->label = '<span class="dashicons dashicons-arrow-right-alt2 rotate-right"></span>';
155 $radius_bright->value = maxUtils::strip_px(maxBlocks::getValue('radius_bottom_right'));
156 $radius_bright->id = 'radius_bottom_right';
157 $radius_bright->name = $radius_bright->id;
158 $radius_bright->min = 0;
159 $radius_bright->inputclass = 'tiny';
160 $radius_bright->publish = false;
161 $rbr = $radius_bright->output('', '');
162
163 // If all same, lock the corners for simultanious change.
164 if ($radius_tleft->value == $radius_tright->value &&
165 $radius_tright->value == $radius_bleft->value &&
166 $radius_bleft->value = $radius_bright->value)
167 {
168 $lock = 'lock';
169 }
170 else
171 $lock = 'unlock';
172
173 $radius = new maxField('radius');
174 $radius->radius_tl = $rtl;
175 $radius->label_tl = __('Top Left','maxbuttons');
176 $radius->radius_tr = $rtr;
177 $radius->label_tr = __('Top Right','maxbuttons');
178 $radius->radius_bl = $rbl;
179 $radius->label_bl = __('Bottom Left','maxbuttons');
180 $radius->radius_br = $rbr;
181 $radius->label_br = __('Bottom Right','maxbuttons');
182 $radius->lock = $lock;
183 //$radius->output('','end');
184
185 $admin->addField($radius, '', 'end');
186
187 // Border style
188 $bstyle = new maxField('generic');
189 $bstyle->label = __('Style','maxbuttons');
190 $bstyle->name = 'border_style';
191 $bstyle->id = $bstyle->name;
192 $bstyle->value= maxBlocks::getValue('border_style');
193 $bstyle->setDefault(maxBlocks::getDefault('border_style'));
194 $bstyle->content = maxUtils::selectify($bstyle->name, $maxbuttons_border_styles, $bstyle->value);
195 //$bstyle->output('start', 'end');
196
197 $admin->addField($bstyle, 'start', 'end');
198
199 // Border width
200 $bwidth = new maxField('number');
201 $bwidth->label = __('Width', 'maxbuttons');
202 $bwidth->name = 'border_width';
203 $bwidth->id = $bwidth->name;
204 $bwidth->value = maxUtils::strip_px( maxBlocks::getValue('border_width') );
205 $bwidth->min = 0;
206 $bwidth->inputclass = 'tiny';
207 //$bwidth->output('start','end');
208
209 $admin->addField($bwidth, 'start', 'end');
210
211 // Border Color
212 $bcolor = new maxField('color');
213 $bcolor->id = 'border_color';
214 $bcolor->name = $bcolor->id;
215 $bcolor->value = maxBlocks::getColorValue('border_color');
216 $bcolor->label = __('Border Color','maxbuttons');
217 $bcolor->copycolor = true;
218 $bcolor->bindto = 'border_color_hover';
219 $bcolor->copypos = 'right';
220 $bcolor->left_title = $color_copy_self;
221 $bcolor->right_title = $color_copy_move;
222 //$bcolor->output('start');
223
224 $admin->addField($bcolor ,'start');
225
226 // Border Color Hover
227 $bcolor_hover = new maxField('color');
228 $bcolor_hover->id = 'border_color_hover';
229 $bcolor_hover->name = $bcolor_hover->id;
230 $bcolor_hover->value = maxBlocks::getColorValue('border_color_hover');
231 $bcolor_hover->label = __('Hover','maxbuttons');
232 $bcolor_hover->copycolor = true;
233 $bcolor_hover->bindto = 'border_color';
234 $bcolor_hover->copypos = 'left';
235 $bcolor_hover->left_title = $color_copy_move;
236 $bcolor_hover->right_title = $color_copy_self;
237 // $bcolor_hover->output('','end');
238
239 $admin->addField($bcolor_hover, '', 'end');
240
241 // Shadow offset left
242 $bshadow = new maxField('number');
243 $bshadow->label = __('Shadow Offset Left','maxbuttons');
244 $bshadow->name = 'box_shadow_offset_left';
245 $bshadow->id = $bshadow->name;
246 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_offset_left') );
247 $bshadow->inputclass = 'tiny';
248 //$bshadow->output('start');
249
250 $admin->addField($bshadow, 'start');
251
252 // Shadow offset top
253 $bshadow = new maxField('number');
254 $bshadow->label = __('Shadow Offset Top','maxbuttons');
255 $bshadow->name = 'box_shadow_offset_top';
256 $bshadow->id = $bshadow->name;
257 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_offset_top') );
258 $bshadow->inputclass = 'tiny';
259 // $bshadow->output('','end');
260
261 $admin->addField($bshadow, '', 'end');
262
263 // Shadow width
264 $bshadow = new maxField('number');
265 $bshadow->label = __('Shadow Blur','maxbuttons');
266 $bshadow->name = 'box_shadow_width';
267 $bshadow->id = $bshadow->name;
268 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_width') );
269 $bshadow->inputclass = 'tiny';
270 //$bshadow->output('start','');
271
272 $admin->addField($bshadow, 'start', '');
273
274 $bspread = new maxField('number');
275 $bspread->label = __('Shadow Spread', 'maxbuttons');
276 $bspread->value = maxUtils::strip_px(maxBlocks::getValue('box_shadow_spread'));
277 $bspread->id = 'box_shadow_spread';
278 $bspread->name = $bspread->id;
279 $bspread->inputclass = 'tiny';
280 //$bspread->output('','end');
281
282 $admin->addField($bspread, '', 'end');
283
284 // Border Shadow Color
285 $scolor = new maxField('color');
286 $scolor->id = 'box_shadow_color';
287 $scolor->name = $scolor->id;
288 $scolor->value = maxBlocks::getColorValue('box_shadow_color');
289 $scolor->label = __('Border Shadow Color','maxbuttons');
290 $scolor->copycolor = true;
291 $scolor->bindto = 'box_shadow_color_hover';
292 $scolor->copypos = 'right';
293 $scolor->left_title = $color_copy_self;
294 $scolor->right_title = $color_copy_move;
295 //$scolor->output('start');
296
297 $admin->addField($scolor, 'start');
298
299 // Border Shadow Color Hover
300 $scolor_hover = new maxField('color');
301 $scolor_hover->id = 'box_shadow_color_hover';
302 $scolor_hover->name = $scolor_hover->id;
303 $scolor_hover->value = maxBlocks::getColorValue('box_shadow_color_hover');
304 $scolor_hover->label = __('Hover','maxbuttons');
305 $scolor_hover->copycolor = true;
306 $scolor_hover->bindto = 'box_shadow_color';
307 $scolor_hover->copypos = 'left';
308 $scolor_hover->left_title = $color_copy_self;
309 $scolor_hover->right_title = $color_copy_move;
310 //$scolor_hover->output('','end');
311
312 $admin->addField($scolor_hover, '','end');
313
314 $admin->display_fields();
315
316 ?>
317
318 </div>
319 </div>
320 <?php
321 } // admin fields
322
323 } // class
324
325 ?>
326