/**
  * Save Meta Options
  *
  * Use tabs array to save options...
  * Need to identify if the option is being set to empty or has never been set
  * *Section Control* gets its own saving schema
  */
 function save_meta_options($postID)
 {
     // Make sure we are saving on the correct post type...
     // Current post type is passed in $_POST
     $current_post_type = isset($_POST['post_type']) ? $_POST['post_type'] : false;
     $post_type_save = in_array($current_post_type, $this->settings['posttype']) ? true : false;
     if ((isset($_POST['update']) || isset($_POST['save']) || isset($_POST['publish'])) && $post_type_save) {
         $page_template = isset($_POST['page_template']) ? $_POST['page_template'] : null;
         $save_template = $this->get_save_template_type($_POST['post_type'], $page_template);
         $template_type = new PageLinesTemplate($save_template);
         $template_type->load_section_optionator();
         // Loop through tabs
         foreach ($this->tabs as $tab => $t) {
             // Loop through tab options
             foreach ($t->options as $oid => $o) {
                 if ($oid == 'section_control') {
                     $this->save_sc($postID);
                 } elseif ($oid == 'page_background_image') {
                     $this->save_bg($oid, $postID);
                 } elseif ($o['type'] == 'text_content' || $o['type'] == 'text_content_reverse') {
                     $option_value = isset($_POST[$oid]) ? $_POST[$oid] : null;
                     plupop($oid, $option_value);
                     plupop($oid, $option_value, array('setting' => PAGELINES_SPECIAL));
                 } elseif ($o['type'] == 'check' && (bool) pldefault($oid)) {
                     $reverse = $oid . "_reverse";
                     $option_value = isset($_POST[$reverse]) ? $_POST[$reverse] : null;
                     if (!empty($option_value) || get_post_meta($postID, $reverse)) {
                         update_post_meta($postID, $reverse, $option_value);
                     }
                 } else {
                     // Note: If the value is null, then test to see if the option is already set to something
                     // create and overwrite the option to null in that case (i.e. it is being set to empty)
                     if (isset($o['selectvalues']) && pagelines_is_multi_option($oid, $o)) {
                         foreach ($o['selectvalues'] as $sid => $s) {
                             $option_value = isset($_POST[$sid]) ? $_POST[$sid] : null;
                             if (!empty($option_value) || get_post_meta($postID, $sid)) {
                                 update_post_meta($postID, $sid, $option_value);
                             }
                         }
                     } else {
                         $option_value = isset($_POST[$oid]) ? $_POST[$oid] : null;
                         if (!empty($option_value) || get_post_meta($postID, $oid)) {
                             update_post_meta($postID, $oid, $option_value);
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
function reset_templates_to_default()
{
    PageLinesTemplate::reset_templates_to_default();
}
/**
*
* @TODO do
*
*/
function plspecial($key, $args)
{
    global $pagelines_special_meta;
    // Type of page is needed for special handling
    // Use the argument 'type' if available because of settings panels, etc.
    if (isset($args['type']) && $args['type'] != '') {
        $type = $args['type'];
    } else {
        $type = PageLinesTemplate::page_type_breaker();
    }
    if (isset($args['clone_id']) && $args['clone_id'] != 1) {
        $id_key = $key . '_' . $args['clone_id'];
    } else {
        $id_key = $key;
    }
    if (isset($pagelines_special_meta[$type]) && is_array($pagelines_special_meta[$type]) && isset($pagelines_special_meta[$type][$id_key])) {
        return $pagelines_special_meta[$type][$id_key];
    } else {
        return false;
    }
}