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