| @@ -1,5 +1,6 @@ | ||
| 1 | -<?php | |
| 1 | +<?php | |
| 2 | +namespace MaxButtons; | |
| 2 | 3 | defined('ABSPATH') or die('No direct access permitted'); |
| 3 | 4 | $blockClass["dimension"] = "dimensionBlock"; |
| 4 | 5 | $blockOrder[20][] = "dimension"; |
| 5 | 6 | |
| @@ -4,36 +5,36 @@ | ||
| 4 | 5 | $blockOrder[20][] = "dimension"; |
| 5 | 6 | |
| 6 | 7 | class dimensionBlock extends maxBlock |
| 7 | 8 | { |
| 8 | - protected $blockname = "dimension"; | |
| 9 | - protected $fields = array("button_width" => array("default" => '160px', | |
| 10 | - "css" => "width", | |
| 11 | - ), | |
| 12 | - "button_height" => array("default" => '50px', | |
| 9 | + protected $blockname = "dimension"; | |
| 10 | + protected $fields = array("button_width" => array("default" => '160px', | |
| 11 | + "css" => "width", | |
| 12 | + ), | |
| 13 | + "button_height" => array("default" => '50px', | |
| 13 | 14 | "css" => "height") |
| 14 | - ); | |
| 15 | - | |
| 16 | - public function parse_css($css, $mode = 'normal') | |
| 15 | + ); | |
| 16 | + | |
| 17 | + public function parse_css($css, $mode = 'normal') | |
| 17 | 18 | { |
| 18 | - $css = parent::parse_css($css, $mode); | |
| 19 | + $css = parent::parse_css($css, $mode); | |
| 19 | 20 | |
| 20 | - if (! isset($css["maxbutton"]["normal"]["width"])) return $css; | |
| 21 | - | |
| 22 | - // do not allow zero's. | |
| 21 | + if (! isset($css["maxbutton"]["normal"]["width"])) return $css; | |
| 22 | + | |
| 23 | + // do not allow zero's. | |
| 23 | 24 | if (isset($css["maxbutton"]["normal"]["width"]) && ($css["maxbutton"]["normal"]["width"] == 0 || $css["maxbutton"]["normal"]["width"] == '') ) |
| 24 | 25 | unset($css["maxbutton"]["normal"]["width"]); |
| 25 | 26 | |
| 26 | 27 | if (isset($css["maxbutton"]["normal"]["height"]) && ($css["maxbutton"]["normal"]["height"] == 0 || $css["maxbutton"]["normal"]["height"] == '') ) |
| 27 | 28 | unset($css["maxbutton"]["normal"]["height"]); |
| 28 | - | |
| 29 | - | |
| 30 | - /* if ($css["normal"]["width"] > maxbuttons_strip_px(0) || $css["normal"]["height"] > maxbuttons_strip_px(0)) | |
| 29 | + | |
| 30 | + | |
| 31 | + /* if ($css["normal"]["width"] > maxbuttons_strip_px(0) || $css["normal"]["height"] > maxbuttons_strip_px(0)) | |
| 31 | 32 | { |
| 32 | - $css["normal"]["display"] = "inline-block"; | |
| 33 | + $css["normal"]["display"] = "inline-block"; | |
| 33 | 34 | } |
| 34 | 35 | */ |
| 35 | - | |
| 36 | + | |
| 36 | 37 | return $css; |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | 40 | public function map_fields($map) |
| @@ -38,49 +39,24 @@ | ||
| 38 | 39 | |
| 39 | 40 | public function map_fields($map) |
| 40 | 41 | { |
| 41 | 42 | $map = parent::map_fields($map); |
| 42 | - | |
| 43 | - $map["button_width"]["func"] = "updateDimension"; | |
| 44 | - $map["button_height"]["func"] = "updateDimension"; | |
| 45 | 43 | |
| 46 | - return $map; | |
| 47 | - | |
| 44 | + $map["button_width"]["func"] = "updateDimension"; | |
| 45 | + $map["button_height"]["func"] = "updateDimension"; | |
| 46 | + | |
| 47 | + return $map; | |
| 48 | + | |
| 48 | 49 | } |
| 49 | - | |
| 50 | 50 | |
| 51 | + | |
| 51 | 52 | public function admin_fields() |
| 52 | 53 | { |
| 53 | 54 | return; |
| 54 | - | |
| 55 | - $data = $this->data[$this->blockname]; | |
| 56 | - | |
| 57 | - foreach($this->fields as $field => $options) | |
| 58 | - { | |
| 59 | - $default = (isset($options["default"])) ? $options["default"] : ''; | |
| 60 | - ${$field} = (isset($data[$field])) ? $data[$field] : $default; | |
| 61 | - ${$field . "_default"} = $default; | |
| 62 | - } | |
| 63 | - ?> | |
| 64 | - <div class="mb_tab option-container"> | |
| 65 | - <div class="title"><?php _e('Dimensions', 'maxbuttons') ?></div> | |
| 66 | - <div class="inside"> | |
| 67 | - <div class="option-design"> | |
| 68 | - <div class="label"><?php _e('Button Width', 'maxbuttons') ?></div> | |
| 69 | - <div class="input"><input class="tiny-nopad" type="text" id="button_width" name="button_width" value="<?php echo maxUtils::strip_px($button_width) ?>" />px</div> | |
| 70 | - <div class="clear"></div> | |
| 71 | - </div> | |
| 72 | - <div class="option-design"> | |
| 73 | - <div class="label"><?php _e('Button Height', 'maxbuttons') ?></div> | |
| 74 | - <div class="input"><input class="tiny-nopad" type="text" id="button_height" name="button_height" value="<?php echo maxUtils::strip_px($button_height) ?>" />px</div> | |
| 75 | - <div class="clear"></div> | |
| 76 | - </div> | |
| 77 | - </div> | |
| 78 | - </div> | |
| 79 | -<?php | |
| 55 | + | |
| 80 | 56 | } // admin_fields |
| 81 | - | |
| 82 | - | |
| 83 | 57 | |
| 84 | -} // class | |
| 58 | + | |
| 59 | + | |
| 60 | +} // class | |
| 85 | 61 | |
| 86 | 62 | ?> |