public function view() { $uri = $this->uri->uri_to_assoc(); $tpl = $uri['view']; switch ($tpl) { case 'write': $data['class_list'] = $this->blog_model->get_class_list(); $tpl = 'write'; break; case 'read': $data['blog_list'] = $this->blog_model->get_blog_list(); $tpl = 'read'; break; case 'class': $data['class_list'] = $this->blog_model->get_class_list(); break; case 'add_class': $tpl = 'add_class'; break; case 'edit': $id = !empty($uri['id']) ? intval($uri['id']) : msg('未找到博文'); $data['blog_info'] = $this->blog_model->get_blog_info($id); $tpl = 'write'; break; case 'edit_class': $cid = !empty($uri['cid']) ? intval($uri['cid']) : msg('未找到分类'); $data['class_info'] = $this->blog_model->get_class_info($cid); $tpl = 'add_class'; break; default: msg('操作失败', site_url('admin/blog/view/read'), 'error'); } !isset($data) && ($data = ''); admin_template('blog/' . $tpl, $data); }
function admin_template() { if (!empty($_POST['admin_template'])) { return $_POST['admin_template']; } else { return 'default'; } } if (!empty($_POST)) { if ($_POST['core_status'] === 'true') { $status = true; } else { $status = false; } $array = array('core' => array('status' => $status, 'question' => $_POST['core_question'], 'firstname' => $_POST['core_firstname'], 'twitter' => array('owner' => $_POST['core_twitter_owner'], 'nick' => $_POST['core_twitter_nick']), 'true' => array('text' => $_POST['core_true_text'], 'long' => $_POST['core_true_long']), 'tweetid' => $_POST['core_tweetid'] == "" ? false : $_POST['core_tweetid'], 'false' => array('text' => $_POST['core_false_text'], 'long' => $_POST['core_false_long']), 'url' => $_POST['core_url']), 'admin' => array('title' => '*****@*****.**', 'tweet_theme' => $_POST['admin_tweet_theme'], 'template' => admin_template(), 'lang' => $_POST['admin_language'])); $json = json_encode($array); $save = file_put_contents('../lib/data/content.json', $json); if ($save === false) { session_start(); $error = error_get_last(); $_SESSION['error'] = true; $_SESSION['error_msg'] = "Code <b>" . $error['type'] . "</b>: Error in line <b>" . $error['line'] . "</b>!<br>Message: " . $error['message']; header('Location: ./'); exit(1); } else { session_start(); $_SESSION['success'] = true; header('Location: ./'); exit; }
/** * Meta box display callback. * * @param WP_Post $post Current post object. */ public function render_admin_mbox($post) { $this->retrive_meta_props($post->ID); require_once plugin_dir_path(__FILE__) . 'views/admin.php'; admin_template($this->meta_props, $this->is_default); }
public function cmm_upload() { $tpl = 'cmm_upload'; $data = ''; admin_template('file/' . $tpl, $data); }