PluginProbe
MaxButtons – Create buttons / 6.28
MaxButtons – Create buttons v6.28
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
← All changes | blocks/border.php +226 -174 6.36.28 View file →
@@ -1,18 +1,16 @@
1 1 <?php
2 +namespace MaxButtons;
2 3 defined('ABSPATH') or die('No direct access permitted');
3 -$blockClass["border"] = "borderBlock";
4 -$blockOrder[30][] = "border";
4 +$blockClass["border"] = "borderBlock";
5 +$blockOrder[30][] = "border";
5 6
6 -use MaxButtons\maxBlocks as maxBlocks;
7 -use MaxButtons\maxField as maxField;
8 -
9 -class borderBlock extends maxBlock
7 +class borderBlock extends maxBlock
10 8 {
11 - protected $blockname = "border";
12 - protected $fields = array("radius_top_left" =>
9 + protected $blockname = "border";
10 + protected $fields = array("radius_top_left" =>
13 11 array("default" => "4px",
14 - "css" => "border-top-left-radius"
12 + "css" => "border-top-left-radius"
15 13 ),
16 14 "radius_top_right" => array("default" => "4px",
17 15 "css" => "border-top-right-radius"
18 16 ),
@@ -20,9 +18,9 @@
20 18 "css" => "border-bottom-left-radius"
21 19 ),
22 20 "radius_bottom_right" => array("default" => "4px",
23 21 "css" => "border-bottom-right-radius"
24 - ),
22 + ),
25 23 "border_style" => array("default" => "solid",
26 24 "css" => "border-style"
27 25 ),
28 26 "border_width" => array("default" => "2px",
@@ -37,49 +35,49 @@
37 35 "csspseudo" => "normal,hover"),
38 36 "box_shadow_width" => array("default" => "2px",
39 37 "css" => "box-shadow-width",
40 38 "csspseudo" => "normal,hover"),
41 - 'box_shadow_spread' => array('default' => '0px',
42 - 'css' => 'box-shadow-spread',
39 + 'box_shadow_spread' => array('default' => '0px',
40 + 'css' => 'box-shadow-spread',
43 41 'csspseudo' => 'normal,hover'),
44 -
45 - );
46 -
47 42
43 + );
44 +
45 +
48 46 function __construct()
49 47 {
50 48 parent::__construct();
51 - $this->fields = apply_filters($this->blockname. "-block-fields",$this->fields);
52 - $this->data[$this->blockname] = array(); //empty init
49 + $this->fields = apply_filters($this->blockname. "-block-fields",$this->fields);
50 + $this->data[$this->blockname] = array(); //empty init
53 51 }
54 -
52 +
55 53 public function map_fields($map)
56 54 {
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;
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;
70 67 }
71 68
72 - public function admin_fields()
69 + public function admin_fields()
73 70 {
74 - $data = $this->data[$this->blockname];
71 +
72 + $data = $this->data[$this->blockname];
75 73 foreach($this->fields as $field => $options)
76 - {
77 - $default = (isset($options["default"])) ? $options["default"] : '';
74 + {
75 + $default = (isset($options["default"])) ? $options["default"] : '';
78 76 $$field = (isset($data[$field])) ? $data[$field] : $default;
79 - ${$field . "_default"} = $default;
77 + ${$field . "_default"} = $default;
80 78 }
81 -
79 +
82 80 $maxbuttons_border_styles = array(
83 81 '' => '',
84 82 'dashed' => __('dashed','maxbuttons'),
85 83 'dotted' => __('dotted','maxbuttons'),
@@ -89,185 +87,239 @@
89 87 'outset' => __('outset','maxbuttons'),
90 88 'ridge' => __('ridge','maxbuttons'),
91 89 'solid' => __('solid','maxbuttons')
92 90 );
93 -?>
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 +?>
94 98 <div class="option-container mb_tab">
95 99 <div class="title"><?php _e('Border', 'maxbuttons') ?></div>
96 100 <div class="inside">
97 -
98 -
99 - <?php
101 +
102 +
103 + <?php
100 104 // Spacer
101 - $fspacer = new maxField('spacer');
105 + $fspacer = new maxField('spacer');
102 106 $fspacer->label = __('Radius','maxbuttons');
103 - $fspacer->name = 'radius';
104 - $fspacer->output('start');
105 -
107 + $fspacer->name = 'radius';
108 + // $fspacer->output('start');
109 +
110 + $admin->addField($fspacer, 'start');
111 +
106 112 // Radius left top
107 - $radius_tleft = new maxField('number');
113 + $radius_tleft = new maxField('number');
108 114 //$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;
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;
113 119 $radius_tleft->min = 0;
114 - $radius_tleft->inputclass = 'tiny';
115 - $radius_tleft->publish = false;
116 - $rtl = $radius_tleft->output('');
117 -
120 + $radius_tleft->inputclass = 'tiny';
121 + $radius_tleft->publish = false;
122 + $rtl = $radius_tleft->output('');
123 +
124 +
125 +
118 126 // 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;
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;
125 133 $radius_tright->min = 0;
126 - $radius_tright->inputclass = 'tiny';
127 - $radius_tright->publish = false;
128 - $rtr = $radius_tright->output('', '');
134 + $radius_tright->inputclass = 'tiny';
135 + $radius_tright->publish = false;
136 + $rtr = $radius_tright->output('', '');
129 137
130 -
138 +
131 139 // Radius bottom left
132 - $radius_bleft = new maxField('number');
140 + $radius_bleft = new maxField('number');
133 141 //$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;
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;
138 146 $radius_bleft->min = 0;
139 - $radius_bleft->inputclass = 'tiny';
140 - $radius_bleft->publish = false;
141 - $rbl = $radius_bleft->output('');
142 -
147 + $radius_bleft->inputclass = 'tiny';
148 + $radius_bleft->publish = false;
149 + $rbl = $radius_bleft->output('');
150 +
143 151 // 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';
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';
149 157 $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)
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)
159 167 {
160 - $lock = 'lock';
168 + $lock = 'lock';
161 169 }
162 170 else
163 171 $lock = 'unlock';
164 -
172 +
165 173 $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');
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');
172 180 $radius->radius_br = $rbr;
173 181 $radius->label_br = __('Bottom Right','maxbuttons');
174 182 $radius->lock = $lock;
175 - $radius->output('','end');
176 -
183 + //$radius->output('','end');
184 +
185 + $admin->addField($radius, '', 'end');
186 +
177 187 // 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');
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');
186 196
197 + $admin->addField($bstyle, 'start', 'end');
198 +
187 199 // 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') );
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') );
193 205 $bwidth->min = 0;
194 - $bwidth->inputclass = 'tiny';
195 - $bwidth->output('start','end');
206 + $bwidth->inputclass = 'tiny';
207 + //$bwidth->output('start','end');
196 208
209 + $admin->addField($bwidth, 'start', 'end');
210 +
197 211 // 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 + $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');
212 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 +
213 241 // 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');
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');
221 249
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');
250 + $admin->addField($bshadow, 'start');
230 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 +
231 263 // 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','');
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','');
239 271
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 -
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 +
248 284 // 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 -
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 +
264 316 ?>
265 317
266 318 </div>
267 319 </div>
268 -<?php
320 +<?php
269 321 } // admin fields
270 -
271 - } // class
322 +
323 + } // class
272 324
273 325 ?>