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
maxbuttons / collections / basic-block.php

basic-block.php in MaxButtons – Create buttons 6.28, at collections/basic-block.php

193 lines 6.3 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 $collectionBlock["basic"] = "basicCollectionBlock";
5
6 class basicCollectionBlock extends collectionBlock
7 {
8 protected $blockname = "basic";
9 protected $fields = array("name" => array("default" => ""),
10 "show_homepage" => array("default" => 0),
11 "show_page" => array("default" => 0),
12 "show_post" => array("default" => 0),
13 "show_archive" => array("default" => 0),
14 "placement" => array("default" => "after"),
15
16 );
17
18 function __construct()
19 {
20 $this->fields["name"]["default"] = __("New Collection","maxbuttons");
21
22 }
23
24 function parseCSS($css, $args)
25 {
26 $css["maxcollection"]["normal"]["display"] = "inline-block";
27 $css["maxcollection"]["normal"]["z-index"] = "9999";
28
29 switch($this->data["placement"])
30 {
31 case "static-left":
32 $css["maxcollection"]["normal"]["position"] = "fixed";
33 $css["maxcollection"]["normal"]["left"] = "0"; // these as string otherwise css compiler doens't like it
34 $css["maxcollection"]["normal"]["top"] = "0";
35 break;
36 case "static-right":
37 $css["maxcollection"]["normal"]["position"] = "fixed";
38 $css["maxcollection"]["normal"]["right"] = "0";
39 $css["maxcollection"]["normal"]["top"] = "0";
40 break;
41 case "static-top":
42 $css["maxcollection"]["normal"]["position"] = "fixed";
43 $css["maxcollection"]["normal"]["left"] = "0";
44 $css["maxcollection"]["normal"]["top"] = "0";
45 break;
46 case "static-bottom":
47 $css["maxcollection"]["normal"]["position"] = "fixed";
48 $css["maxcollection"]["normal"]["left"] = "0";
49 $css["maxcollection"]["normal"]["bottom"] = "0";
50 break;
51 }
52
53 if ($args["preview"] == true)
54 {
55 if (isset($css["maxcollection"]["normal"]["position"]) && $css["maxcollection"]["normal"]["position"] == "fixed")
56 {
57 $css["maxcollection"]["normal"]["position"]= "absolute";
58 }
59
60
61 }
62
63 //$css["maxcollection"]["normal"]["background-color"] = "#fff";
64 return $css;
65
66 }
67
68 public function map_fields($map)
69 {
70 $map = parent::map_fields($map);
71 $map["collection_name"]["func"] = "updateCollectionName";
72 $map["placement"]["func"] = "updatePlacement";
73
74
75 return $map;
76 }
77
78 function save_fields($data, $post)
79 {
80 $data = parent::save_fields($data, $post);
81 $data["collection_name"] = $data[$this->blockname]["name"]; // save as a global meta for searching
82 $data["collection_type"] = $this->collection->getType();
83 if ($data[$this->blockname]["show_homepage"] == 1)
84 {
85 $data["show_homepage"] = $data[$this->blockname]["placement"];
86 }
87 if ($data[$this->blockname]["show_page"] == 1)
88 {
89 $data["show_page"] = $data[$this->blockname]["placement"];
90 }
91
92 if ($data[$this->blockname]["show_post"] == 1)
93 {
94 $data["show_post"] = $data[$this->blockname]["placement"];
95 }
96 if ($data[$this->blockname]["show_archive"] == 1)
97 {
98 $data["show_archive"] = $data[$this->blockname]["placement"];
99 }
100
101 return $data;
102
103 }
104
105 function admin_fields()
106 {
107
108 extract($this->data); // admin data
109
110 $placement_options = array(
111 "after" => __("After","maxbuttons"),
112 "before" => __("Before","maxbuttons"),
113 "after-before" => __("Before + After (both)", "maxbuttons"),
114 "static-left" => __("Static left","maxbuttons"),
115 "static-right" => __("Static right","maxbuttons"),
116 "static-top" => __("Static top","maxbuttons"),
117 "static-bottom" => __("Static bottom","maxbuttons"),
118 );
119 ?><div class="mb_tab option-container" data-options="settings">
120 <div class="title">
121 <span class="dashicons dashicons-admin-settings"></span>
122 <span class="title"><?php _e("Settings","maxbuttons"); ?></span>
123 <span class='manual-box'><a href='javascript:void(0)' class='manual-toggle' data-target="settings"> <?php _e("Getting Started","maxbuttons-pro"); ?> </a></span>
124 <span class='right'><button name="save" type="submit" data-form='collection_edit' class="button button-primary"><?php _e("Save All","maxbuttons"); ?></button>
125 </span>
126 </div>
127
128 <div class="inside">
129
130 <div class="option">
131 <label for="collection_name"><?php _e("Name"); ?></label>
132 <input type="text" id='collection_name' name="name" value="<?php echo esc_attr($name) ?>" />
133 <div class="help fa fa-question-circle">
134 <span><?php _e("The name of your collection. It will not be displayed on the site.", "maxbuttons"); ?>
135 </span>
136 </div>
137
138 </div>
139
140 <div class="option">
141 <label for="collection_show"><?php _e("Automatically show on","maxbuttons"); ?></label>
142
143 <div class='option-list'>
144 <div class="help fa fa-question-circle">
145 <span><?php _e("Auto-display your buttons on the site. Checking the options will display the buttons on the corresponding part.", "maxbuttons"); ?>
146 </span>
147 </div>
148 <input type="checkbox" name="show_homepage" value="1" <?php checked(1, $show_homepage) ?> >
149 <?php _e("Homepage","maxbuttons"); ?><br />
150
151 <input type="checkbox" name="show_page" value="1" <?php checked(1, $show_page) ?> > <?php _e("Pages","maxbuttons"); ?><br>
152 <input type="checkbox" name="show_post" value="1" <?php checked(1, $show_post) ?> > <?php _e("Posts","maxbuttons"); ?><br>
153 <input type="checkbox" name="show_archive" value="1" <?php checked(1,$show_archive) ?> >
154 <?php _e("Category / Archives","maxbuttons"); ?> <br>
155
156
157 </div>
158 </div>
159
160 <div class="option">
161 <label for="collection_placement"><?php _e("Placement"); ?></label>
162 <?php echo maxUtils::selectify("placement", $placement_options, $placement); ?>
163 <div class="help fa fa-question-circle">
164 <span><?php _e("Choose where the buttons will show up.", "maxbuttons"); ?>
165 </span>
166 </div>
167 </div>
168
169
170
171 </div>
172 </div> <!-- option container -->
173
174 <div class="manual-entry" data-manual="settings">
175 <h3><?php _e("General settings", "maxbuttons"); ?>
176 <span class="dashicons dashicons-no window close manual-toggle" data-target="settings"></span>
177 </h3>
178
179 <p><?php _e("Give a name to your collection of buttons and select which portions and locations on your site you want the collection to appear. Anytime you want to see how your collection is going to look click the Preview tab to open up the Preview tab. We suggest you do this first. ","maxbuttons"); ?></p>
180
181
182 </div>
183
184
185 <?php
186
187
188 }
189
190 }
191
192 ?>
193