PluginProbe
MaxButtons – Create buttons / 7.1
MaxButtons – Create buttons v7.1
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 / gradient.php

gradient.php in MaxButtons – Create buttons 7.1, at blocks/gradient.php

247 lines 8.0 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["gradient"] = "gradientBlock";
5 $blockOrder[40][] = "gradient";
6
7 class gradientBlock extends maxBlock
8 {
9 protected $blockname = "gradient";
10 protected $fields = array("gradient_stop" => array("default" => "45",
11 "css" => "gradient-stop",
12 "csspseudo" => "normal,hover",
13 ),
14
15 "gradient_start_opacity" => array("default" => "100",
16 "css" => "gradient-start-opacity"),
17 "gradient_end_opacity" => array("default" => "100",
18 "css" => "gradient-end-opacity"),
19 "gradient_start_opacity_hover" => array("default" => "100",
20 "css" => "gradient-start-opacity",
21 "csspseudo" => "hover"),
22 "gradient_end_opacity_hover" => array("default" => "100",
23 "css" => "gradient-end-opacity",
24 "csspseudo" => "hover"),
25 'use_gradient' => array('default' => '0',
26 'css' => 'gradient-use-gradient',
27 'csspseudo' => 'normal,hover',
28 ),
29
30 );
31
32
33 public function map_fields($map)
34 {
35
36 $map["gradient_stop"]["func"] = "updateGradientOpacity";
37 $map["gradient_start_opacity"]["func"] = "updateGradientOpacity";
38 $map["gradient_end_opacity"]["func"] = "updateGradientOpacity";
39 $map["gradient_start_opacity_hover"]["func"] = "updateGradientOpacity";
40 $map["gradient_end_opacity_hover"]["func"] = "updateGradientOpacity";
41
42 return $map;
43 }
44
45
46 public function admin_fields()
47 {
48 $data = $this->data[$this->blockname];
49
50 ?>
51 <div class="mb_tab option-container gradient-options">
52 <div class="title"><?php _e('Background', 'maxbuttons') ?></div>
53 <div class="inside">
54 <?php
55
56 $g_start = maxBlocks::getColorValue('gradient_start_color');
57 $g_end = maxBlocks::getColorValue('gradient_end_color');
58 $gh_start = maxBlocks::getColorValue('gradient_start_color_hover');
59 $gh_end = maxBlocks::getColorValue('gradient_end_color_hover');
60
61 $use_gradient = maxBlocks::getValue('use_gradient');
62
63 if (! isset($data['use_gradient'] ))
64 {
65 if ($g_start != $g_end || $gh_start != $gh_end)
66 $use_gradient = true;
67 else
68 $use_gradient = false;
69
70 }
71
72 $condition = array('target' => 'use_gradient', 'values' => 'checked');
73 $gradient_conditional = htmlentities(json_encode($condition));
74
75 $color_copy_self = __("Replace color from other field", "maxbuttons");
76 $color_copy_move = __("Copy Color to other field", "maxbuttons");
77 // $fspacer->output('start');
78
79 $useg = new maxField('switch');
80 $useg->label = __('Use Gradients', 'maxbuttons');
81 $useg->name = 'use_gradient';
82 $useg->id = $useg->name;
83 $useg->value = '1';
84 $useg->checked = checked($use_gradient, 1, false);
85 $useg->output ('start','end');
86
87 // Spacer
88 $fspacer = new maxField('spacer');
89 $fspacer->label = '&nbsp;';
90 $fspacer->name = 'gradient_head';
91 $fspacer->output('start');
92
93 // Spacer
94 //$fspacer = new maxField('spacer');
95 $fspacer->label = __('Start','maxbuttons');
96 $fspacer->name = 'gradient_start';
97 $fspacer->output('');
98
99 // Spacer
100 //$fspacer = new maxField('spacer');
101 $fspacer->label = __('End','maxbuttons');
102 $fspacer->name = 'gradient_end';
103 $fspacer->conditional = $gradient_conditional;
104 $fspacer->output('', 'end');
105
106 // Background Color
107 $color = new maxField('color');
108 $color->id = 'gradient_start_color';
109 $color->name = $color->id;
110 $color->value = $g_start;
111 $color->label = __('Background color','maxbuttons');
112 $color->inputclass = 'square';
113 $color->copycolor = true;
114 $color->bindto = 'gradient_end_color';
115 $color->left_title = $color_copy_self;
116 $color->right_title = $color_copy_move;
117 $color->copypos = 'right';
118
119 $color->output('start');
120
121 // Background Color (End Gradient)
122 $ecolor = new maxField('color');
123 $ecolor->id = 'gradient_end_color';
124 $ecolor->name = $ecolor->id;
125 $ecolor->value = $g_end;
126 $ecolor->inputclass = 'square';
127 $ecolor->copycolor = true;
128 $ecolor->bindto = $color->id;
129 $ecolor->copypos = 'left';
130 $ecolor->left_title = $color_copy_move;
131 $ecolor->right_title = $color_copy_self;
132 $ecolor->conditional = $gradient_conditional;
133 $ecolor->output('', 'end');
134
135
136 // Background Color Hover
137 $color_hover = new maxField('color');
138 $color_hover->id = 'gradient_start_color_hover';
139 $color_hover->name = $color_hover->id;
140 $color_hover->value = $gh_start;
141 $color_hover->label = __('Background hover','maxbuttons');
142 $color_hover->inputclass = 'square';
143 $color_hover->copycolor = true;
144 $color_hover->bindto = 'gradient_end_color_hover';
145 $color_hover->left_title = $color_copy_self;
146 $color_hover->right_title = $color_copy_move;
147 $color_hover->copypos = 'right';
148
149 $color_hover->output('start','');
150
151 // Background Color Hover
152 $ecolor_hover = new maxField('color');
153 $ecolor_hover->id = 'gradient_end_color_hover';
154 $ecolor_hover->name = $ecolor_hover->id;
155 $ecolor_hover->value = $gh_end;
156 $ecolor_hover->inputclass = 'square';
157 // $ecolor_hover->label = __('Color Hover End','maxbuttons');
158 $ecolor_hover->copycolor = true;
159 $ecolor_hover->bindto = $color_hover->id;
160 $ecolor_hover->copypos = 'left';
161 $ecolor_hover->left_title = $color_copy_move;
162 $ecolor_hover->right_title = $color_copy_self;
163 $ecolor_hover->conditional = $gradient_conditional;
164 $ecolor_hover->output('','end');
165
166 ?>
167
168 <!--
169 <p><a href='#'>See more options</a></p>
170 -->
171 <div id='gradient_fold' class="fold">
172
173 <?php
174 $startop = new maxField('number');
175 $startop->label = __('Normal Opacity','maxbuttons');
176 $startop->name = 'gradient_start_opacity';
177 $startop->id = $startop->name;
178 $startop->value = maxUtils::strip_px( maxBlocks::getValue('gradient_start_opacity') );
179 //$startop->setDefault(maxBlocks::getDefault('gradient_start_opacity'));
180 $startop->min = 1;
181 $startop->max = 100;
182 $startop->inputclass = 'small';
183 $startop->output('start','');
184
185 $endop = new maxField('number');
186 // $endop->label = __('Normal Opacity','maxbuttons');
187 $endop->name = 'gradient_end_opacity';
188 $endop->id = $endop->name;
189 $endop->value = maxUtils::strip_px( maxBlocks::getValue('gradient_end_opacity') );
190 $endop->setDefault(maxBlocks::getDefault('gradient_end_opacity'));
191 $endop->min = 1;
192 $endop->max = 100;
193 $endop->inputclass = 'small';
194 $endop->conditional = $gradient_conditional;
195 $endop->output('','end');
196
197 $startop = new maxField('number');
198 $startop->label = __('Hover opacity','maxbuttons');
199 $startop->name = 'gradient_start_opacity_hover';
200 $startop->id = $startop->name;
201 $startop->value = maxUtils::strip_px( maxBlocks::getValue('gradient_start_opacity_hover') );
202 //$startop->setDefault(maxBlocks::getDefault('gradient_start_opacity_hover'));
203 $startop->min = 1;
204 $startop->max = 100;
205 $startop->inputclass = 'small';
206
207 $startop->output('start','');
208
209 $endop = new maxField('number');
210 // $endop->label = __('Hover Opacity','maxbuttons');
211 $endop->name = 'gradient_end_opacity_hover';
212 $endop->id = $endop->name;
213 $endop->value = maxUtils::strip_px( maxBlocks::getValue('gradient_end_opacity_hover') );
214 $endop->setDefault(maxBlocks::getDefault('gradient_end_opacity_hover'));
215 $endop->min = 1;
216 $endop->max = 100;
217 $endop->inputclass = 'small';
218 $endop->conditional = $gradient_conditional;
219
220 $endop->output('','end');
221
222
223 $stop = new maxField('number');
224 $stop->label = __('Gradient stop','maxbuttons');
225 $stop->name = 'gradient_stop';
226 $stop->id = $stop->name;
227 $stop->value = maxUtils::strip_px( maxBlocks::getValue('gradient_stop') );
228 $stop->setDefault(maxBlocks::getDefault('gradient_stop'));
229 $stop->min = 1;
230 $stop->max = 99;
231 $stop->inputclass = 'small';
232 $stop->output('start','end');
233 ?>
234
235
236 </div><!-- // fold -->
237
238 </div>
239 </div>
240 <?php
241 } // admin_fields
242
243 } // class
244
245
246 ?>
247