PluginProbe
MaxButtons – Create buttons / 6.25
MaxButtons – Create buttons v6.25
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
maxbuttons / blocks / dimension.php

dimension.php in MaxButtons – Create buttons 6.25, at blocks/dimension.php

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