PluginProbe
MaxButtons – Create buttons / 6.23
MaxButtons – Create buttons v6.23
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.23, at blocks/border.php

285 lines 10.3 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 <div class="option-container mb_tab">
94 <div class="title"><?php _e('Border', 'maxbuttons') ?></div>
95 <div class="inside">
96
97
98 <?php
99 // Spacer
100 $fspacer = new maxField('spacer');
101 $fspacer->label = __('Radius','maxbuttons');
102 $fspacer->name = 'radius';
103 $fspacer->output('start');
104
105 // Radius left top
106 $radius_tleft = new maxField('number');
107 //$radius_tleft->label = __('Top Left', 'maxbuttons');
108 //$radius_tleft->label = '<span class="dashicons dashicons-arrow-left-alt2 rotate-right"></span>';
109 $radius_tleft->value = maxUtils::strip_px(maxBlocks::getValue('radius_top_left'));
110 $radius_tleft->id = 'radius_top_left';
111 $radius_tleft->name = $radius_tleft->id;
112 $radius_tleft->min = 0;
113 $radius_tleft->inputclass = 'tiny';
114 $radius_tleft->publish = false;
115 $rtl = $radius_tleft->output('');
116
117 // Radius right top
118 $radius_tright = new maxField('number');
119 //$radius_tright->label = __('Top Right', 'maxbuttons');
120 //$radius_tright->label = '<span class="dashicons dashicons-arrow-right-alt2 rotate-left"></span>';
121 $radius_tright->value = maxUtils::strip_px(maxBlocks::getValue('radius_top_right'));
122 $radius_tright->id = 'radius_top_right';
123 $radius_tright->name = $radius_tright->id;
124 $radius_tright->min = 0;
125 $radius_tright->inputclass = 'tiny';
126 $radius_tright->publish = false;
127 $rtr = $radius_tright->output('', '');
128
129
130 // Radius bottom left
131 $radius_bleft = new maxField('number');
132 //$radius_bleft->label = __('Bottom Left', 'maxbuttons');
133 //$radius_bleft->label = '<span class="dashicons dashicons-arrow-left-alt2 rotate-left"></span>';
134 $radius_bleft->value = maxUtils::strip_px(maxBlocks::getValue('radius_bottom_left'));
135 $radius_bleft->id = 'radius_bottom_left';
136 $radius_bleft->name = $radius_bleft->id;
137 $radius_bleft->min = 0;
138 $radius_bleft->inputclass = 'tiny';
139 $radius_bleft->publish = false;
140 $rbl = $radius_bleft->output('');
141
142 // Radius bottom right
143 $radius_bright = new maxField('number');
144 //$radius_bright->label = __('Bottom Right', 'maxbuttons');
145 //$radius_bright->label = '<span class="dashicons dashicons-arrow-right-alt2 rotate-right"></span>';
146 $radius_bright->value = maxUtils::strip_px(maxBlocks::getValue('radius_bottom_right'));
147 $radius_bright->id = 'radius_bottom_right';
148 $radius_bright->name = $radius_bright->id;
149 $radius_bright->min = 0;
150 $radius_bright->inputclass = 'tiny';
151 $radius_bright->publish = false;
152 $rbr = $radius_bright->output('', '');
153
154 // If all same, lock the corners for simultanious change.
155 if ($radius_tleft->value == $radius_tright->value &&
156 $radius_tright->value == $radius_bleft->value &&
157 $radius_bleft->value = $radius_bright->value)
158 {
159 $lock = 'lock';
160 }
161 else
162 $lock = 'unlock';
163
164 $radius = new maxField('radius');
165 $radius->radius_tl = $rtl;
166 $radius->label_tl = __('Top Left','maxbuttons');
167 $radius->radius_tr = $rtr;
168 $radius->label_tr = __('Top Right','maxbuttons');
169 $radius->radius_bl = $rbl;
170 $radius->label_bl = __('Bottom Left','maxbuttons');
171 $radius->radius_br = $rbr;
172 $radius->label_br = __('Bottom Right','maxbuttons');
173 $radius->lock = $lock;
174 $radius->output('','end');
175
176 // Border style
177 $bstyle = new maxField('generic');
178 $bstyle->label = __('Style','maxbuttons');
179 $bstyle->name = 'border_style';
180 $bstyle->id = $bstyle->name;
181 $bstyle->value= maxBlocks::getValue('border_style');
182 $bstyle->setDefault(maxBlocks::getDefault('border_style'));
183 $bstyle->content = maxUtils::selectify($bstyle->name, $maxbuttons_border_styles, $bstyle->value);
184 $bstyle->output('start', 'end');
185
186 // Border width
187 $bwidth = new maxField('number');
188 $bwidth->label = __('Width', 'maxbuttons');
189 $bwidth->name = 'border_width';
190 $bwidth->id = $bwidth->name;
191 $bwidth->value = maxUtils::strip_px( maxBlocks::getValue('border_width') );
192 $bwidth->min = 0;
193 $bwidth->inputclass = 'tiny';
194 $bwidth->output('start','end');
195
196 // Border Color
197 $bcolor = new maxField('color');
198 $bcolor->id = 'border_color';
199 $bcolor->name = $bcolor->id;
200 $bcolor->value = maxBlocks::getColorValue('border_color');
201 $bcolor->label = __('Border Color','maxbuttons');
202 $bcolor->copycolor = true;
203 $bcolor->bindto = 'border_color_hover';
204 $bcolor->copypos = 'right';
205 $bcolor->output('start');
206
207 // Border Color Hover
208 $bcolor_hover = new maxField('color');
209 $bcolor_hover->id = 'border_color_hover';
210 $bcolor_hover->name = $bcolor_hover->id;
211 $bcolor_hover->value = maxBlocks::getColorValue('border_color_hover');
212 $bcolor_hover->label = __('Hover','maxbuttons');
213 $bcolor_hover->copycolor = true;
214 $bcolor_hover->bindto = 'border_color';
215 $bcolor_hover->copypos = 'left';
216 $bcolor_hover->output('','end');
217
218 // Shadow offset left
219 $bshadow = new maxField('number');
220 $bshadow->label = __('Shadow Offset Left','maxbuttons');
221 $bshadow->name = 'box_shadow_offset_left';
222 $bshadow->id = $bshadow->name;
223 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_offset_left') );
224 $bshadow->inputclass = 'tiny';
225 $bshadow->output('start');
226
227 // Shadow offset top
228 $bshadow = new maxField('number');
229 $bshadow->label = __('Shadow Offset Top','maxbuttons');
230 $bshadow->name = 'box_shadow_offset_top';
231 $bshadow->id = $bshadow->name;
232 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_offset_top') );
233 $bshadow->inputclass = 'tiny';
234 $bshadow->output('','end');
235
236 // Shadow width
237 $bshadow = new maxField('number');
238 $bshadow->label = __('Shadow Blur','maxbuttons');
239 $bshadow->name = 'box_shadow_width';
240 $bshadow->id = $bshadow->name;
241 $bshadow->value = maxUtils::strip_px( maxBlocks::getValue('box_shadow_width') );
242 $bshadow->inputclass = 'tiny';
243 $bshadow->output('start','');
244
245 $bspread = new maxField('number');
246 $bspread->label = __('Shadow Spread', 'maxbuttons');
247 $bspread->value = maxUtils::strip_px(maxBlocks::getValue('box_shadow_spread'));
248 $bspread->id = 'box_shadow_spread';
249 $bspread->name = $bspread->id;
250 $bspread->inputclass = 'tiny';
251 $bspread->output('','end');
252
253 // Border Shadow Color
254 $scolor = new maxField('color');
255 $scolor->id = 'box_shadow_color';
256 $scolor->name = $scolor->id;
257 $scolor->value = maxBlocks::getColorValue('box_shadow_color');
258 $scolor->label = __('Border Shadow Color','maxbuttons');
259 $scolor->copycolor = true;
260 $scolor->bindto = 'box_shadow_color_hover';
261 $scolor->copypos = 'right';
262 $scolor->output('start');
263
264 // Border Shadow Color Hover
265 $scolor_hover = new maxField('color');
266 $scolor_hover->id = 'box_shadow_color_hover';
267 $scolor_hover->name = $scolor_hover->id;
268 $scolor_hover->value = maxBlocks::getColorValue('box_shadow_color_hover');
269 $scolor_hover->label = __('Hover','maxbuttons');
270 $scolor_hover->copycolor = true;
271 $scolor_hover->bindto = 'box_shadow_color';
272 $scolor_hover->copypos = 'left';
273 $scolor_hover->output('','end');
274
275 ?>
276
277 </div>
278 </div>
279 <?php
280 } // admin fields
281
282 } // class
283
284 ?>
285