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/text.php +102 -101 6.96.28 View file →
@@ -1,43 +1,38 @@
1 1 <?php
2 +namespace MaxButtons;
2 3 defined('ABSPATH') or die('No direct access permitted');
3 -$blockClass["text"] = "textBlock";
4 -$blockOrder[50][] = "text";
4 +$blockClass["text"] = "textBlock";
5 +$blockOrder[50][] = "text";
5 6
6 -use MaxButtons\maxBlocks as maxBlocks;
7 -use MaxButtons\maxField as maxField;
8 -
9 -class textBlock extends maxBlock
7 +class textBlock extends maxBlock
10 8 {
11 9
12 - protected $blockname = "text";
10 + protected $blockname = "text";
13 11 protected $fields = array(
14 -
15 - "text" => array("default" => '' ),
16 - "font" => array("default" => "Tahoma",
17 - "css" => "font-family",
12 +
13 + "text" => array("default" => '' ),
14 + "font" => array("default" => "Tahoma",
15 + "css" => "font-family",
18 16 "csspart" => 'mb-text'
19 17 ),
20 -
18 +
21 19 "font_size" => array("default" => "15px",
22 20 "css" => "font-size",
23 21 "csspart" => 'mb-text' ),
24 - /* "font_size_unit" => array("default" => "em",
25 - "css" => "font_size_unit",
26 - "csspart" => "mb-text",
27 - ), */
28 - "text_align" => array(
22 +
23 + "text_align" => array(
29 24 "default" => "center",
30 25 "css" => "text-align",
31 26 "csspart" => "mb-text",
32 -
27 +
33 28 ),
34 -
29 +
35 30 "font_style" => array("default" => "normal",
36 31 "css" => "font-style",
37 32 "csspart" => 'mb-text'),
38 -
39 - "font_weight" => array("default" => "normal",
33 +
34 + "font_weight" => array("default" => "normal",
40 35 "css" => "font-weight",
41 36 "csspart" => 'mb-text'),
42 37 "text_shadow_offset_left" => array("default" => "0px",
43 38 "css" => "text-shadow-left",
@@ -43,14 +38,14 @@
43 38 "css" => "text-shadow-left",
44 39 "csspart" => 'mb-text',
45 40 "csspseudo" => "normal,hover"
46 41 ),
47 -
42 +
48 43 "text_shadow_offset_top" => array("default" => "0px",
49 44 "css" => "text-shadow-top",
50 45 "csspart" => 'mb-text',
51 46 "csspseudo" => "normal,hover"),
52 - "text_shadow_width" => array("default" => "0px",
47 + "text_shadow_width" => array("default" => "0px",
53 48 "css" => "text-shadow-width",
54 49 "csspart" => 'mb-text',
55 50 "csspseudo" => "normal,hover"),
56 51
@@ -65,64 +60,66 @@
65 60 "csspart" => "mb-text"),
66 61 "padding_left" => array("default" => "0px",
67 62 "css" => "padding-left",
68 63 "csspart" => "mb-text")
69 - );
70 -
64 + );
71 65
66 +
72 67 function __construct()
73 68 {
74 69 parent::__construct();
75 - $this->fields["text"]["default"] = __("YOUR TEXT","maxbuttons");
76 -
70 + $this->fields["text"]["default"] = __("YOUR TEXT","maxbuttons");
71 +
77 72 }
78 73
79 74 public function map_fields($map)
80 75 {
81 76 $map = parent::map_fields($map);
82 - $map["text"]["func"] = "updateAnchorText";
83 - $map["text_shadow_offset_left"]["func"] = "updateTextShadow";
84 - $map["text_shadow_offset_top"]["func"] = "updateTextShadow";
85 - $map["text_shadow_width"]["func"] = "updateTextShadow";
86 -
87 - return $map;
77 + $map["text"]["func"] = "updateAnchorText";
78 + $map["text_shadow_offset_left"]["func"] = "updateTextShadow";
79 + $map["text_shadow_offset_top"]["func"] = "updateTextShadow";
80 + $map["text_shadow_width"]["func"] = "updateTextShadow";
81 +
82 + return $map;
88 83 }
89 84 public function parse_css($css, $mode = 'normal')
90 85 {
91 86 $css = parent::parse_css($css);
92 -
87 +
93 88 // allow for font not to be set, but default to theme
94 - $font_size = isset($css["mb-text"]["normal"]["font-size"]) ? $css["mb-text"]["normal"]["font-size"] : $this->fields['font_size']['default'];
89 + $font_size = isset($css["mb-text"]["normal"]["font-size"]) ? $css["mb-text"]["normal"]["font-size"] : $this->fields['font_size']['default'];
95 90 if ($font_size == 0 || $font_size == '0px')
96 - unset($css["mb-text"]["normal"]["font-size"]);
97 -
98 - $css["mb-text"]["normal"]["line-height"] = "1em";
99 - $css["mb-text"]["normal"]["box-sizing"] = "border-box"; // default.
100 - $css["mb-text"]["normal"]["display"] = "block";
91 + unset($css["mb-text"]["normal"]["font-size"]);
92 +
93 + $css["mb-text"]["normal"]["line-height"] = "1em";
94 + $css["mb-text"]["normal"]["box-sizing"] = "border-box"; // default.
95 + $css["mb-text"]["normal"]["display"] = "block";
101 96 $css['mb-text']['normal']['background-color'] = 'unset'; // prevent bg overwriting
102 - return $css;
103 - }
97 + return $css;
98 + }
104 99 public function parse_button($domObj, $mode = 'normal')
105 100 {
106 - $data = $this->data[$this->blockname];
107 - $anchor = $domObj->find("a",0);
108 -
109 - if (isset($data["text"]) && $data["text"] != '' || $mode == 'preview')
110 - $anchor->innertext = "<span class='mb-text'>" . do_shortcode($data["text"]) . "</span>";
111 - return $domObj;
112 -
101 + $data = $this->data[$this->blockname];
102 + $anchor = $domObj->find("a",0);
103 +
104 + if (isset($data["text"]) && $data["text"] != '' || $mode == 'preview')
105 + $anchor->innertext = "<span class='mb-text'>" . do_shortcode($data["text"]) . "</span>";
106 + return $domObj;
107 +
113 108 }
114 -
115 - public function admin_fields()
109 +
110 + public function admin_fields()
116 111 {
117 - $data = $this->data[$this->blockname];
112 + $data = $this->data[$this->blockname];
118 113 foreach($this->fields as $field => $options)
119 - {
120 - $default = (isset($options["default"])) ? $options["default"] : '';
114 + {
115 + $default = (isset($options["default"])) ? $options["default"] : '';
121 116 $$field = (isset($data[$field])) ? $data[$field] : $default;
122 - ${$field . "_default"} = $default;
117 + ${$field . "_default"} = $default;
123 118 }
124 -
119 +
120 + $color_copy_self = __("Replace color from other field", "maxbuttons");
121 + $color_copy_move = __("Copy Color to other field", "maxbuttons");
125 122 ?>
126 123 <div class="mb_tab option-container">
127 124 <div class="title"><?php _e('Text Shadow', 'maxbuttons') ?></div>
128 125 <div class="inside text">
@@ -127,60 +124,64 @@
127 124 <div class="title"><?php _e('Text Shadow', 'maxbuttons') ?></div>
128 125 <div class="inside text">
129 126 <?php
130 127 // Shadow offset left
131 - $field_shadow = new maxField('number') ;
132 - $field_shadow->label = __('Shadow Offset Left', 'maxbuttons');
133 - $field_shadow->value = maxUtils::strip_px(maxBlocks::getValue('text_shadow_offset_left'));
134 - $field_shadow->id = 'text_shadow_offset_left';
135 - $field_shadow->name = $field_shadow->id;
136 - $field_shadow->inputclass = 'tiny';
137 - $field_shadow->output('start');
138 -
128 + $field_shadow = new maxField('number') ;
129 + $field_shadow->label = __('Shadow Offset Left', 'maxbuttons');
130 + $field_shadow->value = maxUtils::strip_px(maxBlocks::getValue('text_shadow_offset_left'));
131 + $field_shadow->id = 'text_shadow_offset_left';
132 + $field_shadow->name = $field_shadow->id;
133 + $field_shadow->inputclass = 'tiny';
134 + $field_shadow->output('start');
135 +
139 136 // Shadow offset top
140 - $field_shadow = new maxField('number') ;
141 - $field_shadow->label = __('Shadow Offset Top', 'maxbuttons');
142 - $field_shadow->value = maxUtils::strip_px(maxBlocks::getValue('text_shadow_offset_top'));
143 - $field_shadow->id = 'text_shadow_offset_top';
144 - $field_shadow->name = $field_shadow->id;
145 - $field_shadow->inputclass = 'tiny';
137 + $field_shadow = new maxField('number') ;
138 + $field_shadow->label = __('Shadow Offset Top', 'maxbuttons');
139 + $field_shadow->value = maxUtils::strip_px(maxBlocks::getValue('text_shadow_offset_top'));
140 + $field_shadow->id = 'text_shadow_offset_top';
141 + $field_shadow->name = $field_shadow->id;
142 + $field_shadow->inputclass = 'tiny';
146 143 $field_shadow->output('','end');
147 144
148 145 // Shadow width
149 - $field_shadow = new maxField('number') ;
150 - $field_shadow->label = __('Shadow Blur', 'maxbuttons');
151 - $field_shadow->value = maxUtils::strip_px(maxBlocks::getValue('text_shadow_width'));
152 - $field_shadow->id = 'text_shadow_width';
146 + $field_shadow = new maxField('number') ;
147 + $field_shadow->label = __('Shadow Blur', 'maxbuttons');
148 + $field_shadow->value = maxUtils::strip_px(maxBlocks::getValue('text_shadow_width'));
149 + $field_shadow->id = 'text_shadow_width';
153 150 $field_shadow->min = 0;
154 - $field_shadow->name = $field_shadow->id;
155 - $field_shadow->inputclass = 'tiny';
151 + $field_shadow->name = $field_shadow->id;
152 + $field_shadow->inputclass = 'tiny';
156 153 $field_shadow->output('start','end');
157 -
154 +
158 155 // Text Color
159 - $fshadow = new maxField('color');
160 - $fshadow->id = 'text_shadow_color';
161 - $fshadow->name = $fshadow->id;
162 - $fshadow->value = maxBlocks::getColorValue('text_shadow_color');
163 - $fshadow->label = __('Shadow Color','maxbuttons');
164 - $fshadow->copycolor = true;
165 - $fshadow->bindto = 'text_shadow_color_hover';
166 - $fshadow->copypos = 'right';
167 - $fshadow->output('start');
168 -
169 - // Text Color Hover
170 - $fshadow_hover = new maxField('color');
171 - $fshadow_hover->id = 'text_shadow_color_hover';
172 - $fshadow_hover->name = $fshadow_hover->id;
173 - $fshadow_hover->value = maxBlocks::getColorValue('text_shadow_color_hover');
174 - $fshadow_hover->label = __('Hover','maxbuttons');
175 - $fshadow_hover->copycolor = true;
176 - $fshadow_hover->bindto = 'text_shadow_color';
177 - $fshadow_hover->copypos = 'left';
178 - $fshadow_hover->output('','end');
179 - ?>
156 + $fshadow = new maxField('color');
157 + $fshadow->id = 'text_shadow_color';
158 + $fshadow->name = $fshadow->id;
159 + $fshadow->value = maxBlocks::getColorValue('text_shadow_color');
160 + $fshadow->label = __('Shadow Color','maxbuttons');
161 + $fshadow->copycolor = true;
162 + $fshadow->bindto = 'text_shadow_color_hover';
163 + $fshadow->copypos = 'right';
164 + $fshadow->left_title = $color_copy_self;
165 + $fshadow->right_title = $color_copy_move;
166 + $fshadow->output('start');
180 167
168 + // Text Color Hover
169 + $fshadow_hover = new maxField('color');
170 + $fshadow_hover->id = 'text_shadow_color_hover';
171 + $fshadow_hover->name = $fshadow_hover->id;
172 + $fshadow_hover->value = maxBlocks::getColorValue('text_shadow_color_hover');
173 + $fshadow_hover->label = __('Hover','maxbuttons');
174 + $fshadow_hover->copycolor = true;
175 + $fshadow_hover->bindto = 'text_shadow_color';
176 + $fshadow_hover->copypos = 'left';
177 + $fshadow_hover->left_title = $color_copy_move;
178 + $fshadow_hover->right_title = $color_copy_self;
179 + $fshadow_hover->output('','end');
180 + ?>
181 +
181 182 </div>
182 183 </div>
183 -<?php } // admin fields
184 - } // class
185 -
184 +<?php } // admin fields
185 + } // class
186 +
186 187 ?>