-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontroller.php
More file actions
44 lines (39 loc) · 984 Bytes
/
Copy pathcontroller.php
File metadata and controls
44 lines (39 loc) · 984 Bytes
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
/**
* A base controller class for shortcut application controllers
* @author Ron Masas <ronmasas@gmail.com>
*/
class Controller
{
protected $db;
protected $get;
protected $post;
protected $server;
protected $shortcut;
/**
* @param Shortcut $shortcut
* @return void
*/
public function __construct($shortcut) {
global $wpdb;
// Database connection
$this->db = $wpdb;
// Requests get params
$this->get = $_GET;
// Requests post params
$this->post = $_POST;
// Global server array
$this->server = $_SERVER;
// Shortcut instace
$this->shortcut = $shortcut;
}
/**
* Wrap the shortcut instace view function for quick aceess
* @param string $template
* @param array $vars
* @return string
*/
protected function view($template, $vars = array()) {
return $this->shortcut->view($template, $vars);
}
}