Esempio n. 1
0
 function special_index_lookup($type = false)
 {
     $type = $type ? $type : $this->type();
     $lookup_array = array('blog', 'category', 'search', 'tag', 'author', 'archive', 'page', 'post', '404_page');
     $index = array_search($type, $lookup_array);
     if (!$index) {
         $index = pl_create_int_from_string($type);
     }
     return $index;
 }
Esempio n. 2
0
 function getopts()
 {
     $option = array();
     // do globals
     if (isset($this->data->export_global)) {
         $option['pl-settings'] = pl_get_global_settings();
     }
     // grab the map
     // $option['pl-template_map'] = get_option( 'pl-template-map', array() );
     // grab user templates
     if (isset($this->data->templates)) {
         $templates = get_option('pl-user-templates', array('draft' => array(), 'live' => array()));
         $draft = array();
         $live = array();
         foreach ($this->data->templates as $k => $data) {
             if (isset($templates['draft'][$k])) {
                 $draft[$k] = $templates['draft'][$k];
             }
             if (isset($templates['live'][$k])) {
                 $live[$k] = $templates['live'][$k];
             }
         }
         $option['pl-user-templates'] = stripslashes_deep(array('draft' => $draft, 'live' => $live));
     }
     if (isset($this->data->export_types)) {
         $lookup_array = array('blog', 'category', 'search', 'tag', 'author', 'archive', 'page', 'post', '404_page');
         $args = array('public' => true, '_builtin' => false);
         $output = 'names';
         // names or objects, note names is the default
         $operator = 'and';
         // 'and' or 'or'
         $post_types = get_post_types($args, $output, $operator);
         $meta = array();
         $master = array_unique(array_merge($post_types, $lookup_array));
         foreach ($master as $t => $type) {
             $key = array_search($type, $lookup_array);
             if (!$key) {
                 $key = pl_create_int_from_string($type) + 70000000;
             } else {
                 $key = $key + 70000000;
             }
             //	$option[$type] = $key;
             $meta[$key] = get_post_meta($key, 'pl-settings');
             if (empty($meta[$key])) {
                 unset($meta[$key]);
             }
         }
         $post_ids = get_posts(array('numberposts' => -1, 'fields' => 'ids', 'post_type' => 'any'));
         $option['post_ids'] = $post_ids;
         foreach ($post_ids as $k => $p) {
             $meta[$p] = get_post_meta($p, 'pl-settings');
             if (empty($meta[$p])) {
                 unset($meta[$p]);
             }
         }
         $option['post_meta'] = $meta;
     }
     $option['custom'] = get_option('pl-user-sections');
     // do section data
     global $sections_data_handler;
     $section_data = $sections_data_handler->dump_opts();
     foreach ($section_data as $k => $data) {
         $section_data[$k]->draft = $this->unserialize($data->draft);
         $section_data[$k]->live = $this->unserialize($data->live);
     }
     $option['section_data'] = $section_data;
     $contents = json_encode($option);
     $contents .= $this->get_file_headers();
     return $contents;
 }
 function getopts()
 {
     $option = array();
     // do globals
     if (isset($this->data->export_global)) {
         $option['pl-settings'] = pl_get_global_settings();
     }
     // grab the map
     // $option['pl-template_map'] = get_option( 'pl-template-map', array() );
     // grab user templates
     if (isset($this->data->templates)) {
         $templates = get_option('pl-user-templates', array());
         foreach ($this->data->templates as $t => $s) {
             if (isset($templates['live'][$t])) {
                 $option['pl-user-templates'][$t] = $templates['live'][$t];
             }
         }
     }
     if (isset($this->data->export_types)) {
         $lookup_array = array('blog', 'category', 'search', 'tag', 'author', 'archive', 'page', 'post', '404_page');
         $args = array('public' => true, '_builtin' => false);
         $output = 'names';
         // names or objects, note names is the default
         $operator = 'and';
         // 'and' or 'or'
         $post_types = get_post_types($args, $output, $operator);
         $meta = array();
         $master = array_unique(array_merge($post_types, $lookup_array));
         foreach ($master as $t => $type) {
             $key = pl_create_int_from_string($type) + 70000000;
             $meta[$key] = get_post_meta($key, 'pl-settings');
             if (empty($meta[$key])) {
                 unset($meta[$key]);
             }
         }
         $option['post_meta'] = $meta;
     }
     // do section data
     global $sections_data_handler;
     $option['section_data'] = $sections_data_handler->dump_opts();
     $contents = json_encode($option);
     $contents .= $this->get_file_headers();
     return $contents;
 }
Esempio n. 4
0
 function special_index_lookup($type = false)
 {
     $type = $type ? $type : $this->type();
     $index = array_search($type, $this->lookup_array());
     if (!$index) {
         $index = pl_create_int_from_string($type);
     }
     return $this->special_base + $index;
 }