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

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