/** * themeple_metabox::themeple_metabox() * * @param mixed $controller * @return */ function themeple_metabox($controller) { if (basename($_SERVER['PHP_SELF']) == "post-new.php" || basename($_SERVER['PHP_SELF']) == "post.php") { $this->controller = $controller; $this->view = new themeple_viewgen($controller); $this->view->used_for = "metabox"; $this->meta_prefix = themeple_admin_safe_string($controller->base_data['prefix']); add_action('admin_menu', array(&$this, 'init_boxes')); add_action('save_post', array(&$this, 'save_post')); } }
/** * themeple_media::get_custom_post() * * @return */ public static function get_custom_post($post_title) { $save_title = themeple_admin_safe_string($post_title); $args = array('post_type' => 'themeple_fw_post', 'post_title' => 'themeple_' . $save_title, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed'); $post = themeple_media::get_post_by_title($args['post_title']); if (!isset($post['ID'])) { $post_id = wp_insert_post($args); } else { $post_id = $post['ID']; } return $post_id; }
/** * themeple_database_options_sets::add_option_page() * * @param mixed $data * @return */ function add_option_page($data) { $data['slug'] = themeple_admin_safe_string(trim($data['name'])); $data_to_check = array($data['parent'], $data['name'], $data['slug']); foreach ($this->controller->admin_pages as $existing_page) { if ($existing_page['title'] == trim($data['name']) || $existing_page['slug'] == $data['slug']) { return 'name_already_exists'; } } $page_key = $data['prefix'] . "_dynamic_pages"; $current_options = get_option($page_key); if ($current_options == "") { $current_options = array(); } $result = array('slug' => themeple_admin_safe_string($data['slug']), 'parent' => $data['parent'], 'icon' => $data['icon'], 'title' => trim($data['name']), 'removable' => 'Remove Options Page'); if (isset($data['sortable'])) { $result['sortable'] = $data['sortable']; } $current_options[] = $result; update_option($page_key, $current_options); return $result; }