当前位置: 首页>>代码示例>>PHP>>正文


PHP adminPage::render方法代码示例

本文整理汇总了PHP中adminPage::render方法的典型用法代码示例。如果您正苦于以下问题:PHP adminPage::render方法的具体用法?PHP adminPage::render怎么用?PHP adminPage::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在adminPage的用法示例。


在下文中一共展示了adminPage::render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listContents

 private function listContents($sub_path = '')
 {
     $lib = new eatStaticMediaLibrary(DATA_ROOT . '/images/', $sub_path . '/');
     $page = new adminPage('images.php');
     // handle image upload
     if (eatStatic::getValue('postback', 'post') == "1") {
         $image = $lib->upload('images', $sub_path, 'file', 'image');
         if ($image != '') {
             $page->context['message'] = $image . ' uploaded';
         } else {
             $page->context['message'] = 'file not uploaded';
         }
     }
     // create new folder
     if (eatStatic::getValue('postback', 'post') == "2") {
         if (eatStatic::getValue('folder', 'post')) {
             $folder = $lib->createSubFolder(eatStatic::getValue('folder', 'post'));
         }
     }
     $page->context['contents'] = $lib->getContents();
     $page->context['title'] = "Images";
     $page->context['sub_path'] = $sub_path;
     $page->render();
 }
开发者ID:rickhurst,项目名称:eatStaticLib,代码行数:24,代码来源:eatStaticAdminImagesController.class.php

示例2: eatStaticCSRF

 function __construct($path)
 {
     require_once EATSTATIC_ROOT . '/eatStaticCSRF.class.php';
     $csrf = new eatStaticCSRF();
     switch ($path[2]) {
         case "":
             $page = new adminPage('login_form.php');
             if (eatStatic::getValue('postback', 'post') == '1') {
                 $csrf->verifyRequest();
                 $email = eatStatic::getValue('email', 'post');
                 $password = eatStatic::getValue('password', 'post');
                 if ($this->validUser($email, $password)) {
                     $_SESSION['admin'] = 1;
                     $_SESSION['admin_user'] = $email;
                     eatStaticAdminController::redirect("");
                 } else {
                     $page->context['error_message'] = 'Invalid username or password';
                 }
             }
             $page->context['title'] = "Log in";
             $page->context['show_navbar'] = false;
             $page->context['body_class'] = 'login-page';
             $page->context['csrf'] = $csrf;
             $page->render();
             break;
     }
 }
开发者ID:rickhurst,项目名称:eatStaticLib,代码行数:27,代码来源:eatStaticAdminController.class.php

示例3: editRawPost

 private function editRawPost($slug, $draft = false)
 {
     $post_folder = DATA_ROOT . '/posts/';
     if ($draft) {
         $post_folder = $post_folder . 'draft/';
     }
     //die($post_folder);
     $page = new adminPage('post_raw_edit.php');
     $post = new eatStaticBlogPost();
     if (file_exists($post_folder . $slug . '.txt')) {
         $post->data_file_path = $post_folder . $slug . '.txt';
     }
     if (file_exists($post_folder . $slug . '.md')) {
         $post->data_file_path = $post_folder . $slug . '.md';
     }
     if (file_exists($post->data_file_path)) {
         $page->context['title'] = "Edit Post";
         $post->hydrate();
     } else {
         $page->context['title'] = "New Post";
     }
     if (eatStatic::getValue('postback') == '1') {
         //die($slug);
         $post->raw_data = trim(eatStatic::getValue('raw_data', 'post'));
         $post->file_name = trim(eatStatic::getValue('file_name', 'post'));
         $post->original_file_name = trim(eatStatic::getValue('original_file_name', 'post'));
         //die($slug);
         // copy current file data to backups
         if ($slug != 'new') {
             copy($post->data_file_path, DATA_ROOT . '/posts/backup/' . $post->file_name . '.' . eatStatic::timestamp() . '.bak');
             if ($post->original_file_name != $post->file_name) {
                 //die($post->data_file_path);
                 // remove original
                 unlink($post->data_file_path);
                 $new_data_file_path = $post_folder . $post->file_name;
                 eatStatic::write_file($post->raw_data, $new_data_file_path);
             } else {
                 eatStatic::write_file($post->raw_data, $post->data_file_path);
             }
         } else {
             $post->data_file_path = $post_folder . $post->file_name;
             eatStatic::write_file($post->raw_data, $post->data_file_path);
             header('location:' . ADMIN_ROOT . 'posts/drafts/');
             die;
         }
     }
     $page->context['post'] = $post;
     //print_r($page);
     //die();
     $page->render();
 }
开发者ID:rickhurst,项目名称:eatStaticLib,代码行数:51,代码来源:eatStaticAdminPostsController.class.php


注:本文中的adminPage::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。