| 1 |
<?php |
| 2 |
defined('ABSPATH') or die('No direct access permitted'); |
| 3 |
$blockClass["responsive"] = "responsiveBlock"; |
| 4 |
$blockOrder[90][] = "responsive"; |
| 5 |
|
| 6 |
use MaxButtons\maxBlocks as maxBlocks; |
| 7 |
use MaxButtons\maxField as maxField; |
| 8 |
|
| 9 |
|
| 10 |
class responsiveBlock extends maxBlock |
| 11 |
{ |
| 12 |
protected $blockname = 'responsive'; |
| 13 |
protected $fields = array("options" => '', |
| 14 |
"auto_responsive" => array("default" => 0), |
| 15 |
"media_query" => array("default" => array() |
| 16 |
), |
| 17 |
|
| 18 |
); |
| 19 |
// multifields for manual conversion // define +/- the same as normal fields. |
| 20 |
// to find solution in parsing stuff back to button. |
| 21 |
protected $multi_fields = array("mq_button_width" => array("default" => '0', |
| 22 |
"css" => "width", |
| 23 |
"csspseudo" => "responsive", |
| 24 |
|
| 25 |
), |
| 26 |
"mq_button_width_unit" => array("default" => 'px', |
| 27 |
"css" => "width_unit", |
| 28 |
"csspseudo" => "responsive", |
| 29 |
), |
| 30 |
"mq_button_height" => array("default" => '0', |
| 31 |
"css" => "height", |
| 32 |
"csspseudo" => "responsive", |
| 33 |
|
| 34 |
), |
| 35 |
"mq_button_height_unit" => array("default" => 'px', |
| 36 |
"css" => "height_unit", |
| 37 |
"csspseudo" => "responsive", |
| 38 |
), |
| 39 |
"mq_container_width" => array("default" => 0, |
| 40 |
"css" => "width", |
| 41 |
"csspart" => "mb-container", |
| 42 |
"csspseudo" => "responsive", |
| 43 |
), |
| 44 |
"mq_container_float" => array("default" => "", |
| 45 |
"css" => "float", |
| 46 |
"csspart" => "mb-container", |
| 47 |
"csspseudo" => "responsive", |
| 48 |
), |
| 49 |
"mq_container_width_unit" => array("default" => "px", |
| 50 |
"css" => "width_unit", |
| 51 |
"csspart" => "mb-container", |
| 52 |
), |
| 53 |
"mq_font_size" => array("default" => 90, |
| 54 |
"css" => "font-size", |
| 55 |
"csspart" => "mb-text", |
| 56 |
), |
| 57 |
"mq_font_size_unit" => array("default" => "%", |
| 58 |
"css" => "font-size_unit", |
| 59 |
"csspart" => "mb-text"), |
| 60 |
|
| 61 |
"mq_custom_minwidth" => array("default" => "0", |
| 62 |
"css" => "custom_minwidth"), |
| 63 |
"mq_custom_maxwidth" => array("default" => "0", |
| 64 |
"css" => "custom_maxwidth"), |
| 65 |
"mq_hide" => array("default" => '', |
| 66 |
"css" => "display", |
| 67 |
"csspart" => "mb-container, maxbutton, mb-center", |
| 68 |
|
| 69 |
), |
| 70 |
); |
| 71 |
|
| 72 |
|
| 73 |
public function parse_css($css, $mode = 'normal') |
| 74 |
{ |
| 75 |
if ($mode != 'normal') |
| 76 |
return $css; |
| 77 |
|
| 78 |
if (! isset($this->data[$this->blockname])) |
| 79 |
return $css; |
| 80 |
|
| 81 |
$data = $this->data[$this->blockname]; |
| 82 |
|
| 83 |
if (isset($data["auto_responsive"]) && $data["auto_responsive"] == 1) |
| 84 |
{ // generate auto_rules for responsive. |
| 85 |
$css["maxbutton"]["responsive"]["phone"][0]["width"] = "90%"; |
| 86 |
$css["mb-container"]["responsive"]["phone"][0]["width"] = "90%"; |
| 87 |
$css["mb-container"]["responsive"]["phone"][0]["float"] = "none"; |
| 88 |
$css["mb-text"]["responsive"]["phone"][0]["font-size"] = "90%"; |
| 89 |
|
| 90 |
|
| 91 |
if ( isset($this->data["text"]["font_size"]) ) |
| 92 |
{ |
| 93 |
$css["mb-text"]["responsive"]["phone"][0]["font-size"] = floor(intval($this->data["text"]["font_size"]) * 0.8) . 'px'; |
| 94 |
} |
| 95 |
|
| 96 |
} |
| 97 |
|
| 98 |
if (! isset($data["media_query"])) |
| 99 |
return $css; |
| 100 |
|
| 101 |
foreach($data["media_query"] as $query => $data ): |
| 102 |
$i = 0; |
| 103 |
|
| 104 |
foreach($data as $index => $fields): |
| 105 |
|
| 106 |
|
| 107 |
foreach($fields as $field => $value) |
| 108 |
{ |
| 109 |
$csspart = (isset($this->multi_fields[$field]["csspart"])) ? explode(",",$this->multi_fields[$field]["csspart"]) : array('maxbutton') ; |
| 110 |
$css_stat = $this->multi_fields[$field]["css"]; |
| 111 |
|
| 112 |
|
| 113 |
if ($value == '' || $value == '0') |
| 114 |
{ } |
| 115 |
elseif ($query != 'custom' && ($field == 'mq_custom_maxwidth' || $field == "mq_custom_minwidth")) |
| 116 |
{ } // skip custom fields on noncustom query |
| 117 |
else |
| 118 |
{ |
| 119 |
foreach($csspart as $j => $part) |
| 120 |
{ |
| 121 |
$part = trim($part); // spaces in array |
| 122 |
$css[$part]["responsive"][$query][$i][$css_stat] = $value; |
| 123 |
} |
| 124 |
|
| 125 |
/* } |
| 126 |
else |
| 127 |
{ |
| 128 |
|
| 129 |
$css[$csspart]["responsive"][$query][$i][$css_stat] = $value; |
| 130 |
} */ |
| 131 |
} |
| 132 |
|
| 133 |
} |
| 134 |
$i++; |
| 135 |
endforeach; |
| 136 |
|
| 137 |
endforeach; |
| 138 |
return $css; |
| 139 |
} |
| 140 |
|
| 141 |
|
| 142 |
public function save_fields($data, $post) |
| 143 |
{ |
| 144 |
|
| 145 |
$queries = (isset($post["media_query"])) ? $post["media_query"] : null; |
| 146 |
$media_queries = array(); |
| 147 |
|
| 148 |
if (is_null($queries)) |
| 149 |
return $data; |
| 150 |
|
| 151 |
//echo "<PRE>"; print_R($queries); print_R($post); echo "</pRE>"; |
| 152 |
//exit(); |
| 153 |
|
| 154 |
foreach($queries as $i => $query) |
| 155 |
{ |
| 156 |
|
| 157 |
if ($query != '') |
| 158 |
{ |
| 159 |
//$media_queries[$query] = array(); |
| 160 |
|
| 161 |
// collect the other fields. |
| 162 |
$c = isset($media_queries[$query]) ? count($media_queries[$query]) : 0; |
| 163 |
|
| 164 |
foreach($this->multi_fields as $field => $values) |
| 165 |
{ |
| 166 |
$default = isset($values["default"]) ? $values["default"] : ''; |
| 167 |
|
| 168 |
if (isset($post[$field][$i])) |
| 169 |
{ |
| 170 |
$postval = $post[$field][$i]; |
| 171 |
if (is_numeric($default)) // sanitize. |
| 172 |
{ |
| 173 |
$postval = intval($postval); |
| 174 |
} |
| 175 |
else |
| 176 |
$value = sanitize_text_field($postval); |
| 177 |
|
| 178 |
$media_queries[$query][$c][$field] = $postval; |
| 179 |
} |
| 180 |
} |
| 181 |
|
| 182 |
} |
| 183 |
} |
| 184 |
|
| 185 |
$data[$this->blockname]["media_query"] = $media_queries; |
| 186 |
|
| 187 |
$data[$this->blockname]["auto_responsive"] = (isset($post["auto_responsive"])) ? $post["auto_responsive"] : 0; |
| 188 |
|
| 189 |
return $data; |
| 190 |
|
| 191 |
} |
| 192 |
|
| 193 |
|
| 194 |
public function admin_fields() |
| 195 |
{ |
| 196 |
$data = isset($this->data[$this->blockname]) ? $this->data[$this->blockname] : array(); |
| 197 |
|
| 198 |
$media_names = maxUtils::get_media_query(1); // nicenames |
| 199 |
$media_desc = maxUtils::get_media_query(3); |
| 200 |
$units = array("px" => __("px","maxbuttons"), |
| 201 |
"%" => __("%","maxbuttons") |
| 202 |
); |
| 203 |
$container_floats = array( |
| 204 |
"" => "", |
| 205 |
"none" => __("None","maxbuttons"), |
| 206 |
"left" => __("Left","maxbuttons"), |
| 207 |
"right" => __("Right","maxbuttons"), |
| 208 |
); |
| 209 |
|
| 210 |
foreach($this->fields as $field => $options) |
| 211 |
{ |
| 212 |
$default = (isset($options["default"])) ? $options["default"] : ''; |
| 213 |
$$field = (isset($data[$field])) ? $data[$field] : $default; |
| 214 |
${$field . "_default"} = $default; |
| 215 |
} |
| 216 |
|
| 217 |
// sorting routine via array merge. |
| 218 |
$fk = array_flip(array_keys($media_query)); |
| 219 |
$names_used = array_intersect_key($media_names,$fk); |
| 220 |
$media_query = array_merge($names_used,$media_query); |
| 221 |
|
| 222 |
?> |
| 223 |
<div class="mb_tab option-container"> |
| 224 |
<div class="title"><?php _e('Responsive Settings', 'maxbuttons') ?></div> |
| 225 |
<div class="inside responsive"> |
| 226 |
|
| 227 |
<div class="option-design"> |
| 228 |
<p class="note"><?php _e("Responsive settings let you decide the behavior of the button on different devices and screen sizes. For instance large buttons on small screens.","maxbuttons") ?></p> |
| 229 |
<?php |
| 230 |
$auto = new maxField('switch'); |
| 231 |
$auto->label = __('Auto Responsive (experimental)', 'maxinbound'); |
| 232 |
$auto->name = 'auto_responsive'; |
| 233 |
$auto->id = $auto->name; |
| 234 |
$auto->value = '1'; |
| 235 |
$auto->checked = checked($auto_responsive, 1, false); |
| 236 |
$auto->output ('start','end'); |
| 237 |
?> |
| 238 |
|
| 239 |
<div class="clear"></div> |
| 240 |
<p class="note"><strong><?php _e("Note:","maxbuttons"); ?> </strong><?php _e(" Auto responsive settings will take a guess only on small screens. To control your responsive settings uncheck this button. This will show more options.","maxbuttons"); ?></p> |
| 241 |
</div> |
| 242 |
|
| 243 |
|
| 244 |
<div class="option-design new-query"> |
| 245 |
<label for='new_query'><?php _e('New Query', 'maxbuttons') ?></label> |
| 246 |
|
| 247 |
<div class="input"> |
| 248 |
<select name="new_query" id="new_query"> |
| 249 |
<?php |
| 250 |
|
| 251 |
foreach ($media_names as $key => $val): |
| 252 |
$disabled = isset($media_query[$key]) && $key !== 'custom' ? ' DISABLED ' : ''; |
| 253 |
?> |
| 254 |
<option value="<?php echo $key ?>" <?php echo $disabled ?> ><?php echo $val ?></option> |
| 255 |
|
| 256 |
|
| 257 |
<?php endforeach; ?> |
| 258 |
</select> |
| 259 |
<?php //echo maxUtils::selectify("new_query",$media_names,'' ); ?> |
| 260 |
<a href='javascript:void(0)' class="button add_media_query"><?php _e("Add","maxbuttons") ?></a> |
| 261 |
</div> |
| 262 |
|
| 263 |
|
| 264 |
<div class="clear"></div> |
| 265 |
</div> <!-- option design --> |
| 266 |
|
| 267 |
<div class='option-design media_queries_options'> |
| 268 |
<?php |
| 269 |
$i = 0 ; |
| 270 |
foreach($media_query as $item => $data): |
| 271 |
foreach ($data as $index => $fields): |
| 272 |
|
| 273 |
if (! isset($fields['mq_hide'])) |
| 274 |
$fields['mq_hide'] = 0; |
| 275 |
|
| 276 |
$condition = array('target' => 'mq_hide[' . $i . ']', 'values' => 'unchecked'); |
| 277 |
$show_conditional = htmlentities(json_encode($condition)); |
| 278 |
|
| 279 |
?> |
| 280 |
<div class='media_query' data-query="<?php echo $item ?>"> |
| 281 |
<span class='removebutton dashicons dashicons-no'></span> |
| 282 |
|
| 283 |
<input type="hidden" name="media_query[<?php echo $i ?>]" value="<?php echo $item ?>"> |
| 284 |
<label class='title'><?php echo $media_names[$item] ?></label> |
| 285 |
<p class='description'><?php echo $media_desc[$item] ?></p> |
| 286 |
<?php |
| 287 |
if ($item == "custom") { $custom_class = 'option custom'; } else { $custom_class = 'option custom hidden '; } |
| 288 |
|
| 289 |
$min_width = new maxField('number'); |
| 290 |
$min_width->id = 'mq_custom_minwidth[' . $i . ']'; |
| 291 |
$min_width->name= $min_width->id; |
| 292 |
$min_width->label = __('Min Width', 'maxbuttons'); |
| 293 |
$min_width->value = $fields['mq_custom_minwidth']; |
| 294 |
$min_width->inputclass = 'small'; |
| 295 |
$min_width->main_class = $custom_class; // hide label |
| 296 |
$min_width->output('start', ''); |
| 297 |
|
| 298 |
|
| 299 |
$max_width = new maxField('number'); |
| 300 |
$max_width->id = 'mq_custom_maxwidth[' . $i . ']'; |
| 301 |
$max_width->name = $max_width->id; |
| 302 |
$max_width->label = __('Max Width','maxbuttons'); |
| 303 |
$max_width->value = $fields['mq_custom_maxwidth']; |
| 304 |
$max_width->inputclass = 'small'; |
| 305 |
$max_width->mainclass = $custom_class; |
| 306 |
$max_width->output('','end'); |
| 307 |
|
| 308 |
|
| 309 |
$font_size = new maxField('number'); |
| 310 |
$font_size->id = 'mq_font_size[' . $i . ']'; |
| 311 |
$font_size->name = $font_size->id; |
| 312 |
$font_size->value = $fields['mq_font_size']; |
| 313 |
$font_size->label = __('Font Size', 'maxbuttons'); |
| 314 |
$font_size->min = 0; |
| 315 |
$font_size->inputclass = 'tiny'; |
| 316 |
$font_size->start_conditional = $show_conditional; |
| 317 |
$font_size->output('start', ''); |
| 318 |
|
| 319 |
$fsize_unit = new maxField('generic'); |
| 320 |
$fsize_unit->id = 'mq_font_size_unit[' . $i . ']'; |
| 321 |
$fsize_unit->name = $fsize_unit->id; |
| 322 |
$fsize_unit->value = $fields['mq_font_size_unit']; |
| 323 |
$fsize_unit->content = maxUtils::selectify($fsize_unit->id, $units, $fsize_unit->value); |
| 324 |
// $fsize_unit->conditional = $show_conditional; |
| 325 |
$fsize_unit->output('','end'); |
| 326 |
|
| 327 |
// width |
| 328 |
$width = new maxField('number'); |
| 329 |
$width->id = 'mq_button_width[' . $i . ']'; |
| 330 |
$width->name = $width->id; |
| 331 |
$width->value = $fields['mq_button_width']; |
| 332 |
$width->label = __('Button Width', 'maxbuttons'); |
| 333 |
$width->min = 0; |
| 334 |
$width->inputclass = 'tiny'; |
| 335 |
$width->start_conditional = $show_conditional; |
| 336 |
$width->output('start',''); |
| 337 |
|
| 338 |
$width_unit = new maxField('generic'); |
| 339 |
$width_unit->id = 'mq_button_width_unit[' . $i . ']'; |
| 340 |
$width_unit->name = $width_unit->id; |
| 341 |
$width_unit->value = $fields['mq_button_width_unit']; |
| 342 |
$width_unit->content = maxUtils::selectify($width_unit->id, $units, $width_unit->value); |
| 343 |
// $width_unit->conditional = $show_conditional; |
| 344 |
$width_unit->output('',''); |
| 345 |
|
| 346 |
// height |
| 347 |
$height = new maxField('number'); |
| 348 |
$height->id = 'mq_button_height[' . $i . ']'; |
| 349 |
$height->name = $height->id; |
| 350 |
$height->value = $fields['mq_button_height']; |
| 351 |
$height->label = __("Button Height", "maxbuttons"); |
| 352 |
$height->min = 0; |
| 353 |
$height->inputclass = 'tiny'; |
| 354 |
// $height->conditional = $show_conditional; |
| 355 |
$height->output('',''); |
| 356 |
|
| 357 |
$height_unit = new maxField('generic'); |
| 358 |
$height_unit->id = 'mq_button_height_unit[' . $i . ']'; |
| 359 |
$height_unit->name = $height_unit->id; |
| 360 |
$height_unit->value = $fields['mq_button_height_unit']; |
| 361 |
$height_unit->content = maxUtils::selectify($height_unit->id, $units, $height_unit->value); |
| 362 |
// $height_unit->conditional = $show_conditional; |
| 363 |
$height_unit->output('','end'); |
| 364 |
|
| 365 |
$cwidth = new maxField('number'); |
| 366 |
$cwidth->id = 'mq_container_width[' . $i . ']'; |
| 367 |
$cwidth->name = $cwidth->id; |
| 368 |
$cwidth->label = __('Container Width', 'maxbuttons'); |
| 369 |
$cwidth->value = $fields['mq_container_width']; |
| 370 |
$cwidth->min = '0'; |
| 371 |
$cwidth->inputclass = 'tiny'; |
| 372 |
$cwidth->start_conditional = $show_conditional; |
| 373 |
$cwidth->output('start', ''); |
| 374 |
|
| 375 |
$cwidth_unit = new maxField('generic'); |
| 376 |
$cwidth_unit->id = 'mq_container_width_unit[' . $i . ']'; |
| 377 |
$cwidth_unit->name = $cwidth_unit->id; |
| 378 |
$cwidth_unit->value = $fields['mq_container_width_unit']; |
| 379 |
$cwidth_unit->content = maxUtils::selectify($cwidth_unit->id, $units, $cwidth_unit->value); |
| 380 |
// $cwidth_unit->conditional = $show_conditional; |
| 381 |
$cwidth_unit->output('','end'); |
| 382 |
|
| 383 |
$cfloat = new maxField('generic'); |
| 384 |
$cfloat->id = 'mq_container_float[' . $i . ']'; |
| 385 |
$cfloat->name = $cfloat->id; |
| 386 |
$cfloat->label = __('Container Float','maxbuttons'); |
| 387 |
$cfloat->value = $fields['mq_container_float']; |
| 388 |
$cfloat->content = maxUtils::selectify($cfloat->id, $container_floats, $cfloat->value); |
| 389 |
$cfloat->start_conditional = $show_conditional; |
| 390 |
$cfloat->output('start','end'); |
| 391 |
|
| 392 |
$hide = new maxField('switch'); |
| 393 |
$hide->id = 'mq_hide[' . $i . ']'; |
| 394 |
$hide->name = $hide->id; |
| 395 |
$hide->value = 'none'; |
| 396 |
$hide->checked = checked($fields['mq_hide'], $hide->value, false); |
| 397 |
$hide->label = __('Hide button in this view','maxbuttons'); |
| 398 |
$hide->output('start','end'); |
| 399 |
|
| 400 |
/* |
| 401 |
$preview = new maxField('button'); |
| 402 |
$preview->id = 'mq_preview[' . $i . ']'; |
| 403 |
$preview->button_label = __('Show in preview','maxbuttons'); |
| 404 |
$preview->output('', 'end'); |
| 405 |
*/ |
| 406 |
|
| 407 |
$i++; |
| 408 |
//if ($item != 'custom') |
| 409 |
// unset($media_names[$item]); // remove existing queries from new query selection |
| 410 |
?> |
| 411 |
</div> <!-- media query --> |
| 412 |
<?php |
| 413 |
endforeach; |
| 414 |
endforeach; |
| 415 |
|
| 416 |
|
| 417 |
?> |
| 418 |
</div> <!-- option -design --> |
| 419 |
<div class="new_query_space"></div> |
| 420 |
</div> <!-- inside --> |
| 421 |
|
| 422 |
<input type="hidden" name="next_media_index" value="<?php echo $i ?>" > |
| 423 |
<div class='media_option_prot'> |
| 424 |
|
| 425 |
<div class='media_query' data-query=''> |
| 426 |
<span class='removebutton dashicons dashicons-no'></span> |
| 427 |
|
| 428 |
<input type="hidden" name="media_query[]" value=""> |
| 429 |
<label class='title'></label> |
| 430 |
<p class='description'> </p> |
| 431 |
<?php |
| 432 |
$custom_class = 'option hidden custom'; |
| 433 |
$condition = array('target' => 'mq_hide[]', 'values' => 'unchecked'); |
| 434 |
$show_conditional = htmlentities(json_encode($condition)); |
| 435 |
|
| 436 |
$min_width = new maxField('number'); |
| 437 |
$min_width->id = 'mq_custom_minwidth[]'; |
| 438 |
$min_width->name= $min_width->id; |
| 439 |
$min_width->label = __('Min Width', 'maxbuttons'); |
| 440 |
// $min_width->value = $fields['mq_custom_minwidth']; |
| 441 |
$min_width->inputclass = 'small'; |
| 442 |
$min_width->main_class = $custom_class; // hide label |
| 443 |
$min_width->output('start', ''); |
| 444 |
|
| 445 |
$max_width = new maxField('number'); |
| 446 |
$max_width->id = 'mq_custom_maxwidth[]'; |
| 447 |
$max_width->name = $max_width->id; |
| 448 |
$max_width->label = __('Max Width','maxbuttons'); |
| 449 |
// $max_width->value = $fields['mq_custom_maxwidth']; |
| 450 |
$max_width->inputclass = 'small'; |
| 451 |
$max_width->mainclass = $custom_class; |
| 452 |
$max_width->output('','end'); |
| 453 |
|
| 454 |
|
| 455 |
$font_size = new maxField('number'); |
| 456 |
$font_size->id = 'mq_font_size[]'; |
| 457 |
$font_size->name = $font_size->id; |
| 458 |
//$font_size->value = $fields['mq_font_size']; |
| 459 |
$font_size->label = __('Font Size', 'maxbuttons'); |
| 460 |
$font_size->min = 0; |
| 461 |
$font_size->inputclass = 'tiny'; |
| 462 |
$font_size->start_conditional = $show_conditional; |
| 463 |
$font_size->output('start', ''); |
| 464 |
|
| 465 |
$fsize_unit = new maxField('generic'); |
| 466 |
$fsize_unit->id = 'mq_font_size_unit[]'; |
| 467 |
$fsize_unit->name = $fsize_unit->id; |
| 468 |
//$fsize_unit->value = $fields['mq_font_size_unit']; |
| 469 |
$fsize_unit->content = maxUtils::selectify($fsize_unit->id, $units, $fsize_unit->value) ; |
| 470 |
$fsize_unit->output('','end'); |
| 471 |
|
| 472 |
// width |
| 473 |
$width = new maxField('number'); |
| 474 |
$width->id = 'mq_button_width[]'; |
| 475 |
$width->name = $width->id; |
| 476 |
//$width->value = $fields['mq_button_width']; |
| 477 |
$width->label = __('Button Width', 'maxbuttons'); |
| 478 |
$width->min = 0; |
| 479 |
$width->inputclass = 'tiny'; |
| 480 |
$width->start_conditional = $show_conditional; |
| 481 |
$width->output('start',''); |
| 482 |
|
| 483 |
$width_unit = new maxField('generic'); |
| 484 |
$width_unit->id = 'mq_button_width_unit[]'; |
| 485 |
$width_unit->name = $width_unit->id; |
| 486 |
//$width_unit->value = $fields['mq_button_width_unit']; |
| 487 |
$width_unit->content = maxUtils::selectify($width_unit->id, $units, $width_unit->value); |
| 488 |
$width_unit->output('',''); |
| 489 |
|
| 490 |
// height |
| 491 |
$height = new maxField('number'); |
| 492 |
$height->id = 'mq_button_height[]'; |
| 493 |
$height->name = $height->id; |
| 494 |
//$height->value = $fields['mq_button_height']; |
| 495 |
$height->label = __("Button Height", "maxbuttons"); |
| 496 |
$height->min = 0; |
| 497 |
$height->inputclass = 'tiny'; |
| 498 |
$height->output('',''); |
| 499 |
|
| 500 |
$height_unit = new maxField('generic'); |
| 501 |
$height_unit->id = 'mq_button_height_unit[]'; |
| 502 |
$height_unit->name = $height_unit->id; |
| 503 |
// $height_unit->value = $fields['mq_button_height_unit']; |
| 504 |
$height_unit->content = maxUtils::selectify($height_unit->id, $units, $height_unit->value) ; |
| 505 |
$height_unit->output('','end'); |
| 506 |
|
| 507 |
$cwidth = new maxField('number'); |
| 508 |
$cwidth->id = 'mq_container_width[]'; |
| 509 |
$cwidth->name = $cwidth->id; |
| 510 |
$cwidth->label = __('Container Width', 'maxbuttons'); |
| 511 |
//$cwidth->value = $fields['mq_container_width']; |
| 512 |
$cwidth->min = '1'; |
| 513 |
$cwidth->inputclass = 'tiny'; |
| 514 |
$cwidth->start_conditional = $show_conditional; |
| 515 |
$cwidth->output('start', ''); |
| 516 |
|
| 517 |
$cwidth_unit = new maxField('generic'); |
| 518 |
$cwidth_unit->id = 'mq_container_width_unit[]'; |
| 519 |
$cwidth_unit->name = $cwidth_unit->id; |
| 520 |
//$cwidth_unit->value = $fields['mq_container_width_unit']; |
| 521 |
$cwidth_unit->content = maxUtils::selectify($cwidth_unit->id, $units, $cwidth_unit->value); |
| 522 |
$cwidth_unit->output('','end'); |
| 523 |
|
| 524 |
$cfloat = new maxField('generic'); |
| 525 |
$cfloat->id = 'mq_container_float[]'; |
| 526 |
$cfloat->name = $cfloat->id; |
| 527 |
$cfloat->label = __('Container Float','maxbuttons'); |
| 528 |
// $cfloat->value = $fields['mq_container_float']; |
| 529 |
$cfloat->content = maxUtils::selectify($cfloat->id, $container_floats, $cfloat->value); |
| 530 |
$cfloat->start_conditional = $show_conditional; |
| 531 |
$cfloat->output('start','end'); |
| 532 |
|
| 533 |
if (! isset($fields['mq_hide'])) |
| 534 |
$fields['mq_hide'] = 0; |
| 535 |
|
| 536 |
$hide = new maxField('switch'); |
| 537 |
$hide->id = 'mq_hide[]'; |
| 538 |
$hide->name = $hide->id; |
| 539 |
$hide->value = 'none'; |
| 540 |
//$hide->checked = checked($fields['mq_hide'], $hide->value, false); |
| 541 |
$hide->label = __('Hide button in this view','maxbuttons'); |
| 542 |
$hide->output('start','end'); |
| 543 |
|
| 544 |
/*$preview = new maxField('button'); |
| 545 |
$preview->id = 'mq_preview[]'; |
| 546 |
$preview->button_label = __('Show in preview','maxbuttons'); |
| 547 |
$preview->output('', 'end'); |
| 548 |
*/ |
| 549 |
?> |
| 550 |
</div> <!-- /media-query --> |
| 551 |
|
| 552 |
</div> <!-- /media-query-prot --> |
| 553 |
<div id="media_desc"> |
| 554 |
<?php foreach($media_desc as $key => $desc) |
| 555 |
{ |
| 556 |
echo "<span id='$key'>$desc</span>"; |
| 557 |
|
| 558 |
} |
| 559 |
?> |
| 560 |
</div> |
| 561 |
|
| 562 |
|
| 563 |
</div> <!-- container --> |
| 564 |
|
| 565 |
<?php |
| 566 |
} |
| 567 |
|
| 568 |
} // class |
| 569 |
|
| 570 |
?> |
| 571 |
|