-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.php
44 lines (43 loc) · 1.02 KB
/
app.php
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
<?php
class App extends Prefab
{
protected $f3;
public function __construct()
{
$this->f3 = Base::instance();
}
public function authenticated()
{
return $this->f3->get('SESSION.user');
}
public static function user($user = null)
{
if($user) {
$this->f3->set('SESSION.user', $user);
}
return $this->authenticated();
}
public function set($key, $value) {
return $this->f3->set($key, $value);
}
public function get($param = null) {
return null !== $param ? $this->f3->get($param) : $this->f3;
}
static public function __callStatic($method,$args) {
$f3=f3();
if (method_exists($f3,$method)) {
return $f3->$method($args[0],isset($args[1])?$args[1]:NULL);
}
}
public function __get($property) {
return NULL!==$this->get($property)?$this->get($property):FALSE;
}
public function __set($property,$value=TRUE) {
$this->set($property,$value);
}
public function __call($method,$args) {
if (method_exists($this->f3,$method)) {
return $this->$method($args[0],isset($args[1])?$args[1]:NULL);
}
}
}