-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathgust-views.php
More file actions
65 lines (65 loc) · 1.74 KB
/
gust-views.php
File metadata and controls
65 lines (65 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
class Gust_views {
static function root(){
if (Gust::auth()) {
D::redirect(GUST_ROOT.'/post');
} else if (Gust::auth('read')) {
D::redirect(GUST_ROOT.'/login?message=subscriber');
} else {
D::redirect(GUST_ROOT.'/login');
}
}
static function login(){
if (Gust::auth()) {
D::redirect(GUST_ROOT);
} else {
D::render('login',array('body_class'=>'ghost-login'));
}
}
static function post_type($type){
if (Gust::auth()) {
D::render('list',array('body_class'=>'manage','type'=>$type),false);
} else {
D::redirect(GUST_ROOT.'/login');
}
}
static function signout(){
wp_logout();
D::redirect(GUST_ROOT);
}
static function forgotten(){
if (Gust::auth()) {
D::redirect(GUST_ROOT);
} else {
D::render('forgotten',array('body_class'=>'ghost-forgotten'),false);
}
}
static function coffee_confirm(){
if (Gust::auth()) {
D::redirect(GUST_ROOT.'/post?coffee=confirm');
} else {
D::redirect(GUST_ROOT.'/login?coffee=confirm');
}
}
static function editor_default(){
D::redirect(GUST_ROOT.'/editor/post');
}
static function editor_new($type){
if (Gust::auth()) {
$id = Gust::new_post($type);
D::redirect(GUST_ROOT.'/editor/'.$id);
} else {
D::render('login',array('body_class'=>'ghost-login'));
}
}
static function editor($id){
if (Gust::auth()) {
D::render('editor',array('body_class'=>'ghost-login'));
} else {
D::render('login',array('body_class'=>'ghost-login'));
}
}
static function ghost($q) {
D::redirect(GUST_ROOT.'/'.$q);
}
}