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