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

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