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/advanced.php +101 -102 6.236.28 View file →
@@ -1,194 +1,193 @@
1 1 <?php
2 2 namespace MaxButtons;
3 3 defined('ABSPATH') or die('No direct access permitted');
4 -$blockClass["advanced"] = "advancedBlock";
5 -$blockOrder[80][] = "advanced";
4 +$blockClass["advanced"] = "advancedBlock";
5 +$blockOrder[80][] = "advanced";
6 6
7 7
8 -class advancedBlock extends maxBlock
8 +class advancedBlock extends maxBlock
9 9 {
10 - protected $blockname = "advanced";
10 + protected $blockname = "advanced";
11 11 protected $fields = array("important_css" => array("default" => "0"),
12 - "custom_rel" => array('default' => ''),
13 - "extra_classes" => array('default' => ''),
12 + "custom_rel" => array('default' => ''),
13 + "extra_classes" => array('default' => ''),
14 14 "external_css" => array("default" => "0"),
15 -
16 15
17 -
18 - );
19 -
16 +
17 +
18 + );
19 +
20 20 public function __construct()
21 21 {
22 - parent::__construct();
22 + parent::__construct();
23 23 add_filter('mb/button/rawcss', array($this, 'parse_css_advanced'), 1001, 2); // run once
24 24 //add_filter('mb-css-blocks', array($this, 'preview_external_css'), 100 )
25 25 }
26 -
26 +
27 27 public function parse_css($css, $mode = 'normal')
28 28 {
29 29 $css = parent::parse_css($css);
30 - $data = $this->data[$this->blockname];
30 + $data = $this->data[$this->blockname];
31 31
32 32 if (isset($data["important_css"]) && $data["important_css"] == 1)
33 33 {
34 - $css["settings"]["important"] = 1;
35 - }
34 + $css["settings"]["important"] = 1;
35 + }
36 36
37 - return $css;
37 + return $css;
38 38 }
39 -
39 +
40 40 public function parse_css_advanced($css, $mode)
41 41 {
42 - $data = $this->data[$this->blockname];
42 + $data = $this->data[$this->blockname];
43 43
44 - if (isset($data["external_css"]) && $data["external_css"] == 1 && $mode == 'normal')
44 + if (isset($data["external_css"]) && $data["external_css"] == 1 && $mode == 'normal')
45 45 {
46 -
46 +
47 47 return array(
48 - "normal" => array(),
48 + "normal" => array(),
49 49 "hover" => array());
50 50 }
51 51
52 52 return $css;
53 53 }
54 -
54 +
55 55 public function parse_button($domObj, $mode = 'normal')
56 56 {
57 -
58 - $data = $this->data[$this->blockname];
59 -
60 - $button_id = $this->data["id"];
61 -
62 - $anchor = $domObj->find("a",0);
63 -
57 +
58 + $data = $this->data[$this->blockname];
59 +
60 + $button_id = $this->data["id"];
61 +
62 + $anchor = $domObj->find("a",0);
63 +
64 64 if (isset($data["custom_rel"]) && trim($data["custom_rel"]) != '')
65 65 {
66 - $rel = '';
66 + $rel = '';
67 67 $custom_rel = trim($data["custom_rel"]);
68 - if (isset($anchor->rel) && $anchor->rel != '')
68 + if (isset($anchor->rel) && $anchor->rel != '')
69 69 {
70 70 $anchor->rel .= ' ';
71 71 }
72 -
72 +
73 73 $anchor->rel .= $custom_rel;
74 74 }
75 -
76 - if (isset($data["extra_classes"]) && trim($data["extra_classes"]) != '')
75 +
76 + if (isset($data["extra_classes"]) && trim($data["extra_classes"]) != '')
77 77 {
78 - $extra = trim($data["extra_classes"]);
79 - $anchor->class .= ' ' . $extra;
80 -
78 + $extra = trim($data["extra_classes"]);
79 + $anchor->class .= ' ' . $extra;
80 +
81 81 }
82 -
83 - if (isset($data["external_css"]) && $data["external_css"] == 1)
82 +
83 + if (isset($data["external_css"]) && $data["external_css"] == 1)
84 84 {
85 - $anchor->class .= ' external-css ' ;
85 + $anchor->class .= ' external-css ' ;
86 86 }
87 -
88 - return $domObj;
89 -
87 +
88 + return $domObj;
89 +
90 90 }
91 -
92 - public function admin_fields()
91 +
92 + public function admin_fields()
93 93 {
94 - $data = $this->data[$this->blockname];
94 + $data = $this->data[$this->blockname];
95 + $admin = MB()->getClass('admin');
95 96
96 97 foreach($this->fields as $field => $options)
97 - {
98 - $default = (isset($options["default"])) ? $options["default"] : '';
98 + {
99 + $default = (isset($options["default"])) ? $options["default"] : '';
99 100 $$field = (isset($data[$field])) ? $data[$field] : $default;
100 - ${$field . "_default"} = $default;
101 -
102 - global $maxbuttons_container_alignments;
101 + ${$field . "_default"} = $default;
102 +
103 + global $maxbuttons_container_alignments;
103 104 }
104 -
105 -
106 -?>
107 -
105 +?>
106 +
108 107 <div class="option-container mb_tab">
109 108 <div class="title"><?php _e('Advanced', 'maxbuttons') ?></div>
110 109 <div class="inside advanced">
111 -
112 - <?php
113 -
114 - /* $fspacer = new maxField('spacer');
115 - $fspacer->label = __('Use !Important', 'maxbuttons');
116 - $fspacer->name = '';
117 - $fspacer->note = __('Adding !important to the button styles can help avoid potential conflicts with your theme styles.', 'maxbuttons') ;
118 - $fspacer->output('start');
119 - */
120 -
121 - $imp = new maxField('switch');
110 +
111 + <?php
112 +
113 + $imp = new maxField('switch');
122 114 $imp->note = __('Adding !important to the button styles can help avoid potential conflicts with your theme styles.', 'maxbuttons') ;
123 - $imp->id = 'important_css';
115 + $imp->id = 'important_css';
124 116 $imp->name = $imp->id;
125 - $imp->value = 1;
117 + $imp->value = 1;
126 118 $imp->label = __('Use !Important', 'maxbuttons');
127 119 $imp->checked = checked(maxBlocks::getValue('important_css'), 1, false);
128 120 //$imp->value = maxBlocks::getValue('important_css');
129 - $imp->output('start','end');
130 -
131 - $class = new maxField();
132 - $class->id = 'extra_classes';
133 - $class->name = $class->id;
121 + //$imp->output('start','end');
122 +
123 + $admin->addField($imp, 'start', 'end');
124 +
125 + $class = new maxField();
126 + $class->id = 'extra_classes';
127 + $class->name = $class->id;
134 128 $class->label = __("Extra classes","maxbuttons");
135 - $class->value = maxBlocks::getValue($class->id);
129 + $class->value = maxBlocks::getValue($class->id);
136 130 $class->note = __("Useful for custom code or other plugins who target classes", "maxbuttons");
137 - $class->output('start','end');
138 -
139 - $rel = new maxField();
131 + //$class->output('start','end');
132 +
133 + $admin->addField($class, 'start', 'end');
134 +
135 + $rel = new maxField();
140 136 $rel->id = 'custom_rel';
141 - $rel->name = $rel->id;
137 + $rel->name = $rel->id;
142 138 $rel->label = __("Custom Rel Tag","maxbuttons");
143 - $rel->value = maxBlocks::getValue($rel->id);
139 + $rel->value = maxBlocks::getValue($rel->id);
144 140 $rel->note = __("Useful when button is targeting lightbox and/or popup plugins that use this method", "maxbuttons");
145 - $rel->output('start','end');
146 -
147 - do_action('mb-after-advanced');
148 -
149 -
141 + //$rel->output('start','end');
142 +
143 + $admin->addField($rel, 'start', 'end');
144 +
145 + // do_action('mb-after-advanced');
146 +
147 + $admin->display_fields();
148 +
150 149 $nocss = new maxField('switch');
151 - $nocss->note = __('By default, the CSS styles for the button are rendered within a &lt;style&gt; block in the HTML body. Enabling the "Use External CSS" option allows you to put the CSS code for the button into your theme stylesheet instead.', 'maxbuttons');
150 + $nocss->note = __('By default, the CSS styles for the button are rendered within a &lt;style&gt; block in the HTML body. Enabling the "Use External CSS" option allows you to put the CSS code for the button into your theme stylesheet instead.', 'maxbuttons');
152 151 $nocss->label = __('Use External CSS', 'maxbuttons');
153 - $nocss->id = 'external_css';
152 + $nocss->id = 'external_css';
154 153 $nocss->value = 1;
155 - $nocss->name = $nocss->id;
154 + $nocss->name = $nocss->id;
156 155 $nocss->checked = checked($external_css, 1, false);
157 156 $nocss->output('start','');
158 -
159 - $nospace = new maxField('spacer');
160 - $nospace->content = __("Warning: This will remove all styling of the buttons!","maxbuttons");
161 - $nospace->output('','end');
162 - ?>
163 -
157 +
158 + $nospace = new maxField('spacer');
159 + $nospace->content = __("Warning: This will remove all styling of the buttons!","maxbuttons");
160 + $nospace->output('','end');
161 + ?>
162 +
164 163 <div class="option-design">
165 164 <div class="label">&nbsp;</div>
166 165 <div class="input"><a id="view_css_modal" name="view_css" href="javascript:void(0)" class="button maxmodal" data-modal="view-css"><?php _e('View CSS', 'maxbuttons') ?></a></div>
167 166 <div class="clear"></div>
168 -
169 - <div id="view-css" class="maxmodal-data" >
167 +
168 + <div id="view-css" class="maxmodal-data" >
170 169 <h3 class="title"><?php _e("External CSS","maxbuttons"); ?></h3>
171 170 <div class="content">
172 171 <p><?php _e('If the "Use External CSS" option is enabled for this button, copy and paste the CSS code below into your theme stylesheet.', 'maxbuttons') ?></p>
173 -
172 +
174 173 <textarea id="maxbutton-css" readonly="readonly">
175 - <?php
174 + <?php
176 175 if (isset($this->data["id"]) && $this->data['id'] > 0)
177 176 {
178 177 $id = $this->data["id"];
179 - $b = new maxButton();
178 + $b = new maxButton();
180 179
181 180 $b->set($id);
182 181 $b->parse_button();
183 - $b->parse_css("preview");
182 + $b->parse_css("preview");
184 183
185 184 echo $b->getparsedCSS();
186 -
185 +
187 186 }
188 187 else
189 188 { _e("Please save the button first","maxbuttons"); }
190 -
189 +
191 190 ?></textarea>
192 191 </div>
193 192 <div class='controls'>
194 193 <p><a class='button-primary modal_close' href='javascript:void(0);'><?php _e("Close","maxbuttons"); ?></a>
@@ -199,9 +198,9 @@
199 198 </div>
200 199 </div>
201 200 </div>
202 201
203 -<?php
202 +<?php
204 203 } // admin_fields
205 204
206 205 } // class
207 206