本文整理汇总了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();
}
示例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;
}
}
示例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();
}