/** * Unset section based on Section Control */ function unset_section($sid, $template_slug, $sc, $dsc) { global $post; $post_id = isset($post) ? $post->ID : null; $oset = array('post_id' => $post_id); // Global Section Control Array $general_hide = isset($dsc['hide']) ? true : false; // Meta Controls if (is_pagelines_special()) { $special_type = $this->template_type; $meta_reverse = isset($sc[$special_type]['show']) && $sc[$special_type]['show'] ? true : false; $meta_hide = isset($sc[$special_type]['hide']) && $sc[$special_type]['hide'] ? true : false; } else { $meta_reverse = plmeta(meta_option_name(array('show', $template_slug, $sid)), $oset) ? true : false; $meta_hide = plmeta(meta_option_name(array('hide', $template_slug, $sid)), $oset) ? true : false; } return $general_hide && !$meta_reverse || !$general_hide && $meta_hide ? true : false; }
/** * * @TODO document * */ function sc_inputs($template_slug, $sections, $o) { global $post; $is_special = isset($o['special']) ? true : false; // No sections in area if (empty($sections)) { echo sprintf('<div class="sc_inputs"><div class="emptyarea">%s</div></div>', __('Area is empty.', 'pagelines')); return; } echo '<div class="sc_inputs">'; foreach ($sections as $key => $sid) { $pieces = explode('ID', $sid); $section = (string) $pieces[0]; $clone_id = isset($pieces[1]) ? $pieces[1] : 1; // Get section information if (isset($this->factory[$section])) { $section_data = $this->factory[$section]; $hidden_by_default = isset($this->sc_global[$template_slug][$sid]['hide']) ? $this->sc_global[$template_slug][$sid]['hide'] : null; $check_type = $hidden_by_default ? 'show' : 'hide'; // Make the field 'key' $option_name = $is_special ? $this->sc_name($template_slug, $sid, $o['special'], $check_type) : meta_option_name(array($check_type, $template_slug, $sid)); $check_value = $is_special ? $this->sc_value($template_slug, $sid, $o['special'], $check_type) : get_pagelines_meta($option_name, $post->ID); // The name of the section $clone = $clone_id != 1 ? ' #' . $clone_id : ''; $check_label = ucfirst($check_type) . ' ' . $section_data->name . $clone; ?> <div class="sc_wrap <?php echo 'type_' . $check_type; ?> " > <label class="sc_button" for="<?php echo $option_name; ?> "> <span class="sc_button_pad fix" > <?php printf('<span class="sc_check_wrap"><input class="sc_check" type="checkbox" id="%1$s" name="%1$s" %2$s /></span>', $option_name, checked((bool) $check_value, true, false)); printf('<span class="sc_label"><span class="sc_label_pad" style="background: url(%s) no-repeat 8px 5px;">%s</span></span>', $section_data->icon, $check_label); ?> </span> </label> </div><?php } } echo '</div>'; }
/** * * @TODO document * */ function save_section_control($postID, $sid, $template_slug) { $check_name_hide = meta_option_name(array('hide', $template_slug, $sid)); $this->save_meta($postID, $check_name_hide); $check_name_show = meta_option_name(array('show', $template_slug, $sid)); $this->save_meta($postID, $check_name_show); }