| @@ -72,8 +72,15 @@ | ||
| 72 | 72 | |
| 73 | 73 | $anchor->rel .= $custom_rel; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + if (isset($data["extra_classes"]) && trim($data["extra_classes"]) != '') | |
| 77 | + { | |
| 78 | + $extra = trim($data["extra_classes"]); | |
| 79 | + $anchor->class .= ' ' . $extra; | |
| 80 | + | |
| 81 | + } | |
| 82 | + | |
| 76 | 83 | if (isset($data["external_css"]) && $data["external_css"] == 1) |
| 77 | 84 | { |
| 78 | 85 | $anchor->class .= ' external-css ' ; |
| 79 | 86 | } |
| @@ -81,34 +88,29 @@ | ||
| 81 | 88 | return $domObj; |
| 82 | 89 | |
| 83 | 90 | } |
| 84 | 91 | |
| 85 | - public function post_parse_button($domObj, $mode = 'normal') | |
| 92 | + public function admin_fields() | |
| 86 | 93 | { |
| 87 | 94 | $data = $this->data[$this->blockname]; |
| 88 | - $button_id = $this->data["id"]; | |
| 89 | - $anchor = $domObj->find("a",0); | |
| 95 | + $admin = MB()->getClass('admin'); | |
| 90 | 96 | |
| 91 | - if (isset($data["extra_classes"]) && trim($data["extra_classes"]) != '') | |
| 97 | + foreach($this->fields as $field => $options) | |
| 92 | 98 | { |
| 93 | - $extra = trim($data["extra_classes"]); | |
| 94 | - $anchor->class .= ' ' . $extra; | |
| 99 | + $default = (isset($options["default"])) ? $options["default"] : ''; | |
| 100 | + $$field = (isset($data[$field])) ? $data[$field] : $default; | |
| 101 | + ${$field . "_default"} = $default; | |
| 102 | + | |
| 103 | + global $maxbuttons_container_alignments; | |
| 95 | 104 | } |
| 105 | +?> | |
| 96 | 106 | |
| 97 | - return $domObj; | |
| 98 | - } | |
| 107 | + <div class="option-container mb_tab"> | |
| 108 | + <div class="title"><?php _e('Advanced', 'maxbuttons') ?></div> | |
| 109 | + <div class="inside advanced"> | |
| 99 | 110 | |
| 111 | + <?php | |
| 100 | 112 | |
| 101 | - public function admin_fields() | |
| 102 | - { | |
| 103 | - $data = $this->data[$this->blockname]; | |
| 104 | - $admin = MB()->getClass('admin'); | |
| 105 | - | |
| 106 | - $start_block = new maxField('block_start'); | |
| 107 | - $start_block->name = __('advanced', 'maxbuttons'); | |
| 108 | - $start_block->label = __('Advanced', 'maxbuttons'); | |
| 109 | - $admin->addField($start_block); | |
| 110 | - | |
| 111 | 113 | $imp = new maxField('switch'); |
| 112 | 114 | $imp->note = __('Adding !important to the button styles can help avoid potential conflicts with your theme styles.', 'maxbuttons') ; |
| 113 | 115 | $imp->id = 'important_css'; |
| 114 | 116 | $imp->name = $imp->id; |
| @@ -125,9 +127,8 @@ | ||
| 125 | 127 | $class->name = $class->id; |
| 126 | 128 | $class->label = __("Extra classes","maxbuttons"); |
| 127 | 129 | $class->value = maxBlocks::getValue($class->id); |
| 128 | 130 | $class->note = __("Useful for custom code or other plugins who target classes", "maxbuttons"); |
| 129 | - $class->help = "<p class='shortcode'>Shortcode attribute : extraclass </p> <p>Using attribute will add classes, not replace them </p> "; | |
| 130 | 131 | //$class->output('start','end'); |
| 131 | 132 | |
| 132 | 133 | $admin->addField($class, 'start', 'end'); |
| 133 | 134 | |
| @@ -142,43 +143,29 @@ | ||
| 142 | 143 | $admin->addField($rel, 'start', 'end'); |
| 143 | 144 | |
| 144 | 145 | // do_action('mb-after-advanced'); |
| 145 | 146 | |
| 147 | + $admin->display_fields(); | |
| 148 | + | |
| 146 | 149 | $nocss = new maxField('switch'); |
| 147 | - $nocss->note = __('Enabling the "Use External CSS" will stop loading any button styling. You will need to put the button style manually', 'maxbuttons'); | |
| 150 | + $nocss->note = __('By default, the CSS styles for the button are rendered within a <style> 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'); | |
| 148 | 151 | $nocss->label = __('Use External CSS', 'maxbuttons'); |
| 149 | 152 | $nocss->id = 'external_css'; |
| 150 | 153 | $nocss->value = 1; |
| 151 | 154 | $nocss->name = $nocss->id; |
| 152 | - $nocss->checked = checked(maxBlocks::getValue($nocss->id), 1, false); | |
| 153 | - //$nocss->output('start',''); | |
| 154 | - $admin->addField($nocss, 'start'); | |
| 155 | + $nocss->checked = checked($external_css, 1, false); | |
| 156 | + $nocss->output('start',''); | |
| 155 | 157 | |
| 156 | 158 | $nospace = new maxField('spacer'); |
| 157 | 159 | $nospace->content = __("Warning: This will remove all styling of the buttons!","maxbuttons"); |
| 158 | - // $nospace->output('','end'); | |
| 159 | - $admin->addField($nospace, '', 'end'); | |
| 160 | - | |
| 161 | - $viewcss = new maxField('button'); | |
| 162 | - $viewcss->id = 'view_css_modal'; | |
| 163 | - $viewcss->name = $viewcss->id; | |
| 164 | - $viewcss->label = ' '; | |
| 165 | - $viewcss->button_label = __('View CSS', 'maxbuttons'); | |
| 166 | - $viewcss->inputclass = 'maxmodal'; | |
| 167 | - $viewcss->modal = 'view-css'; | |
| 168 | - | |
| 169 | - $admin->addField($viewcss, 'start', 'end'); | |
| 160 | + $nospace->output('','end'); | |
| 170 | 161 | ?> |
| 171 | 162 | |
| 163 | + <div class="option-design"> | |
| 164 | + <div class="label"> </div> | |
| 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> | |
| 166 | + <div class="clear"></div> | |
| 172 | 167 | |
| 173 | -<?php | |
| 174 | - | |
| 175 | - $this->sidebar(); | |
| 176 | - $endblock = new maxField('block_end'); | |
| 177 | - $admin->addField($endblock); | |
| 178 | - | |
| 179 | - ?> | |
| 180 | - | |
| 181 | 168 | <div id="view-css" class="maxmodal-data" > |
| 182 | 169 | <h3 class="title"><?php _e("External CSS","maxbuttons"); ?></h3> |
| 183 | 170 | <div class="content"> |
| 184 | 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> |
| @@ -187,9 +174,9 @@ | ||
| 187 | 174 | <?php |
| 188 | 175 | if (isset($this->data["id"]) && $this->data['id'] > 0) |
| 189 | 176 | { |
| 190 | 177 | $id = $this->data["id"]; |
| 191 | - $b = MB()->getClass('button'); | |
| 178 | + $b = new maxButton(); | |
| 192 | 179 | |
| 193 | 180 | $b->set($id); |
| 194 | 181 | $b->parse_button(); |
| 195 | 182 | $b->parse_css("preview"); |
| @@ -207,9 +194,13 @@ | ||
| 207 | 194 | </p> |
| 208 | 195 | </div> |
| 209 | 196 | </div> |
| 210 | 197 | |
| 211 | - <?php | |
| 198 | + </div> | |
| 199 | + </div> | |
| 200 | + </div> | |
| 201 | + | |
| 202 | +<?php | |
| 212 | 203 | } // admin_fields |
| 213 | 204 | |
| 214 | 205 | } // class |
| 215 | 206 | |