Completed
Push — master ( 2eca18...281374 )
by Jacob
36s
created
utility/Request.class.inc.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -3,78 +3,78 @@
 block discarded – undo
3 3
 class Request
4 4
 {
5 5
 
6
-	private static $server = array();
7
-	private static $get = array();
8
-	private static $post = array();
6
+    private static $server = array();
7
+    private static $get = array();
8
+    private static $post = array();
9 9
 
10
-	private static $AJAX_REQUEST = 'HTTP_X_REQUESTED_WITH';
10
+    private static $AJAX_REQUEST = 'HTTP_X_REQUESTED_WITH';
11 11
 
12
-	static function init()
13
-	{
14
-		self::make_server();
15
-		self::make_get();
16
-		self::make_post();
17
-	}
12
+    static function init()
13
+    {
14
+        self::make_server();
15
+        self::make_get();
16
+        self::make_post();
17
+    }
18 18
 
19
-	static function getServer($key = null)
20
-	{
21
-		if($key)
22
-		{
23
-			if(isset(self::$server[$key]))
24
-				return self::$server[$key];
25
-			return false;
26
-		}
27
-		return self::$server;
28
-	}
19
+    static function getServer($key = null)
20
+    {
21
+        if($key)
22
+        {
23
+            if(isset(self::$server[$key]))
24
+                return self::$server[$key];
25
+            return false;
26
+        }
27
+        return self::$server;
28
+    }
29 29
 
30
-	static function isAjax()
31
-	{
32
-		if(self::getServer(self::$AJAX_REQUEST))
33
-			return true;
34
-		return false;
35
-	}
30
+    static function isAjax()
31
+    {
32
+        if(self::getServer(self::$AJAX_REQUEST))
33
+            return true;
34
+        return false;
35
+    }
36 36
 
37
-	static function getGet($key = null)
38
-	{
39
-		if($key)
40
-		{
41
-			if(isset(self::$get[$key]))
42
-				return self::$get[$key];
43
-			return false;
44
-		}
45
-		return self::$get;
46
-	}
37
+    static function getGet($key = null)
38
+    {
39
+        if($key)
40
+        {
41
+            if(isset(self::$get[$key]))
42
+                return self::$get[$key];
43
+            return false;
44
+        }
45
+        return self::$get;
46
+    }
47 47
 
48
-	static function getPost($key = null)
49
-	{
50
-		if($key)
51
-		{
52
-			if(isset(self::$post[$key]))
53
-				return self::$post[$key];
54
-			return false;
55
-		}
56
-		return self::$post;
57
-	}
48
+    static function getPost($key = null)
49
+    {
50
+        if($key)
51
+        {
52
+            if(isset(self::$post[$key]))
53
+                return self::$post[$key];
54
+            return false;
55
+        }
56
+        return self::$post;
57
+    }
58 58
 
59
-	public static function hasPost()
60
-	{
61
-		return is_array(self::$post) && !empty(self::$post);
62
-	}
59
+    public static function hasPost()
60
+    {
61
+        return is_array(self::$post) && !empty(self::$post);
62
+    }
63 63
 
64
-	static function make_server()
65
-	{
66
-		self::$server = $_SERVER;
67
-	}
64
+    static function make_server()
65
+    {
66
+        self::$server = $_SERVER;
67
+    }
68 68
 
69
-	static function make_get()
70
-	{
71
-		self::$get = $_GET;
72
-	}
69
+    static function make_get()
70
+    {
71
+        self::$get = $_GET;
72
+    }
73 73
 
74
-	static function make_post()
75
-	{
76
-		self::$post = $_POST;
77
-	}
74
+    static function make_post()
75
+    {
76
+        self::$post = $_POST;
77
+    }
78 78
 
79 79
 }
80 80
 
Please login to merge, or discard this patch.
utility/Header.class.inc.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -3,86 +3,86 @@
 block discarded – undo
3 3
 final class Header
4 4
 {
5 5
 
6
-	public static function sendJSON()
7
-	{
8
-		$array = array(
9
-			'HTTP/1.1 200 OK',
10
-			'Cache-Control: no-cache',
11
-			'Content-Language: en',
12
-			'Content-Type: application/json',
13
-			'Expires: ' . self::get_date(time() - 1),
14
-			'Last-Modified: ' . self::get_date(),
15
-			'X-Powered-By: jacobemerick.com');
16
-		self::send($array);
17
-	}
6
+    public static function sendJSON()
7
+    {
8
+        $array = array(
9
+            'HTTP/1.1 200 OK',
10
+            'Cache-Control: no-cache',
11
+            'Content-Language: en',
12
+            'Content-Type: application/json',
13
+            'Expires: ' . self::get_date(time() - 1),
14
+            'Last-Modified: ' . self::get_date(),
15
+            'X-Powered-By: jacobemerick.com');
16
+        self::send($array);
17
+    }
18 18
 
19
-	public static function sendHTML()
20
-	{
21
-		$array = array(
22
-			'HTTP/1.1 200 OK',
23
-			'Cache-Control: no-cache',
24
-			'Content-Language: en',
25
-			'Content-Type: text/html',
26
-			'Expires: ' . self::get_date(time() - 1),
27
-			'Last-Modified: ' . self::get_date(),
28
-			'X-Powered-By: jacobemerick.com');
29
-		self::send($array);
30
-	}
19
+    public static function sendHTML()
20
+    {
21
+        $array = array(
22
+            'HTTP/1.1 200 OK',
23
+            'Cache-Control: no-cache',
24
+            'Content-Language: en',
25
+            'Content-Type: text/html',
26
+            'Expires: ' . self::get_date(time() - 1),
27
+            'Last-Modified: ' . self::get_date(),
28
+            'X-Powered-By: jacobemerick.com');
29
+        self::send($array);
30
+    }
31 31
 
32
-	public static function redirect($location, $method = 301)
33
-	{
34
-		header("Location: {$location}", TRUE, $method);
35
-		exit();
36
-	}
32
+    public static function redirect($location, $method = 301)
33
+    {
34
+        header("Location: {$location}", TRUE, $method);
35
+        exit();
36
+    }
37 37
 
38
-	public static function send404()
39
-	{
40
-		$array = array(
41
-			'HTTP/1.1 404 Not Found',
42
-			'Cache-Control: no-cache',
43
-			'Content-Language: en',
44
-			'Content-Type: text/html',
45
-			'Expires: ' . self::get_date(time() - 1),
46
-			'Last-Modified: ' . self::get_date(),
47
-			'X-Powered-By: jacobemerick.com');
48
-		self::send($array);
49
-	}
38
+    public static function send404()
39
+    {
40
+        $array = array(
41
+            'HTTP/1.1 404 Not Found',
42
+            'Cache-Control: no-cache',
43
+            'Content-Language: en',
44
+            'Content-Type: text/html',
45
+            'Expires: ' . self::get_date(time() - 1),
46
+            'Last-Modified: ' . self::get_date(),
47
+            'X-Powered-By: jacobemerick.com');
48
+        self::send($array);
49
+    }
50 50
 
51
-	public static function send503()
52
-	{
53
-		$array = array(
54
-			'HTTP/1.1 503 Service Unavailable',
55
-			'Cache-Control: no-cache',
56
-			'Content-Language: en',
57
-			'Content-Type: text/html',
58
-			'Expires: ' . self::get_date(time() - 1),
59
-			'Last-Modified: ' . self::get_date(),
60
-			'X-Powered-By: jacobemerick.com');
61
-		self::send($array);
62
-	}
51
+    public static function send503()
52
+    {
53
+        $array = array(
54
+            'HTTP/1.1 503 Service Unavailable',
55
+            'Cache-Control: no-cache',
56
+            'Content-Language: en',
57
+            'Content-Type: text/html',
58
+            'Expires: ' . self::get_date(time() - 1),
59
+            'Last-Modified: ' . self::get_date(),
60
+            'X-Powered-By: jacobemerick.com');
61
+        self::send($array);
62
+    }
63 63
 
64
-	private static function send($array, $gzip = true)
65
-	{
66
-		if($gzip)
67
-			self::start_gzipping();
64
+    private static function send($array, $gzip = true)
65
+    {
66
+        if($gzip)
67
+            self::start_gzipping();
68 68
 		
69
-		foreach($array as $row)
70
-		{
71
-			header($row, TRUE);
72
-		}
73
-	}
69
+        foreach($array as $row)
70
+        {
71
+            header($row, TRUE);
72
+        }
73
+    }
74 74
 
75
-	private static function get_date($timestamp = false)
76
-	{
77
-		if($timestamp == 0)
78
-			$timestamp = time();
79
-		return gmdate('D, d M Y H:i:s \G\M\T', $timestamp);
80
-	}
75
+    private static function get_date($timestamp = false)
76
+    {
77
+        if($timestamp == 0)
78
+            $timestamp = time();
79
+        return gmdate('D, d M Y H:i:s \G\M\T', $timestamp);
80
+    }
81 81
 
82
-	private static function start_gzipping()
83
-	{
84
-		if(!ob_start('ob_gzhandler'))
82
+    private static function start_gzipping()
83
+    {
84
+        if(!ob_start('ob_gzhandler'))
85 85
             ob_start();
86
-	}
86
+    }
87 87
 
88 88
 }
Please login to merge, or discard this patch.
utility/Validate.class.inc.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -5,110 +5,110 @@
 block discarded – undo
5 5
 class Validate
6 6
 {
7 7
 
8
-	private static $NAME_REGEX = '@[a-z\s\'-]+@i';
9
-	private static $EMAIL_REGEX = '@(?:[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")\@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])@i';
10
-	private static $URL_REGEX = '@((https?|ftp)\:\/\/)?([a-z0-9-.]*)\.([a-z]{2,3})(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;:\@&%=+\/\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?@i';
8
+    private static $NAME_REGEX = '@[a-z\s\'-]+@i';
9
+    private static $EMAIL_REGEX = '@(?:[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")\@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])@i';
10
+    private static $URL_REGEX = '@((https?|ftp)\:\/\/)?([a-z0-9-.]*)\.([a-z]{2,3})(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;:\@&%=+\/\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?@i';
11 11
 
12
-	public static function isBoolean($value, $strict = false)
13
-	{
14
-		if($strict && ($value === true || $value === false))
15
-			return true;
16
-		if(!$strict && ((bool) $value === true || (bool) $value === false))
17
-			return true;
18
-		return false;
19
-	}
12
+    public static function isBoolean($value, $strict = false)
13
+    {
14
+        if($strict && ($value === true || $value === false))
15
+            return true;
16
+        if(!$strict && ((bool) $value === true || (bool) $value === false))
17
+            return true;
18
+        return false;
19
+    }
20 20
 
21
-	public static function isDate($value)
22
-	{
23
-		if(strtotime($value) !== -1)
24
-			return true;
25
-		if(date('y', $value) !== false)
26
-			return true;
27
-		return false;
28
-	}
21
+    public static function isDate($value)
22
+    {
23
+        if(strtotime($value) !== -1)
24
+            return true;
25
+        if(date('y', $value) !== false)
26
+            return true;
27
+        return false;
28
+    }
29 29
 
30
-	public static function isInteger($value, $strict = false)
31
-	{
32
-		if($strict)
33
-			return is_int($value);
34
-		return (int) $value == $value;
35
-	}
30
+    public static function isInteger($value, $strict = false)
31
+    {
32
+        if($strict)
33
+            return is_int($value);
34
+        return (int) $value == $value;
35
+    }
36 36
 
37
-	public static function isIP($value)
38
-	{
39
-		if(self::isInteger(ip2long($value)))
40
-			return true;
41
-		return false;
42
-	}
37
+    public static function isIP($value)
38
+    {
39
+        if(self::isInteger(ip2long($value)))
40
+            return true;
41
+        return false;
42
+    }
43 43
 
44
-	public static function isString($value, $strict = false)
45
-	{
46
-		if($strict)
47
-			return is_string($value);
48
-		return (string) $value == $value;
49
-	}
44
+    public static function isString($value, $strict = false)
45
+    {
46
+        if($strict)
47
+            return is_string($value);
48
+        return (string) $value == $value;
49
+    }
50 50
 
51
-	public static function isURL($value)
52
-	{
53
-		return true;
54
-		return self::check_value(self::$URL_REGEX, $value);
55
-	}
51
+    public static function isURL($value)
52
+    {
53
+        return true;
54
+        return self::check_value(self::$URL_REGEX, $value);
55
+    }
56 56
 
57
-	public static function isName($value)
58
-	{
59
-		return self::check_value(self::$NAME_REGEX, $value);
60
-	}
57
+    public static function isName($value)
58
+    {
59
+        return self::check_value(self::$NAME_REGEX, $value);
60
+    }
61 61
 
62
-	public static function isEmail($value)
63
-	{
64
-		return self::check_value(self::$EMAIL_REGEX, $value);
65
-	}
62
+    public static function isEmail($value)
63
+    {
64
+        return self::check_value(self::$EMAIL_REGEX, $value);
65
+    }
66 66
 
67
-	private static function check_value($pattern, $string)
68
-	{
69
-		preg_match($pattern, $string, $matches);
70
-		if(empty($matches))
71
-			return false;
72
-		return $matches[0] == $string;
73
-	}
67
+    private static function check_value($pattern, $string)
68
+    {
69
+        preg_match($pattern, $string, $matches);
70
+        if(empty($matches))
71
+            return false;
72
+        return $matches[0] == $string;
73
+    }
74 74
 
75
-	public static function checkRequest($type, $key, $validation, $strict = false)
76
-	{
77
-		switch($type)
78
-		{
79
-			case 'server':
80
-				$value = Request::getServer($key);
81
-			break;
82
-			case 'post':
83
-				$value = Request::getPost($key);
84
-			break;
85
-		}
75
+    public static function checkRequest($type, $key, $validation, $strict = false)
76
+    {
77
+        switch($type)
78
+        {
79
+            case 'server':
80
+                $value = Request::getServer($key);
81
+            break;
82
+            case 'post':
83
+                $value = Request::getPost($key);
84
+            break;
85
+        }
86 86
 		
87
-		if($value == false)
88
-			return false;
87
+        if($value == false)
88
+            return false;
89 89
 		
90
-		switch($validation)
91
-		{
92
-			case 'boolean':
93
-				return self::isBoolean($value, $strict);
94
-			case 'date':
95
-				return self::isDate($value);
96
-			case 'integer':
97
-				return self::isInteger($value, $strict);
98
-			case 'ip':
99
-				return self::isIP($value);
100
-			case 'string':
101
-				return self::isString($value, $strict);
102
-			case 'url':
103
-				return self::isURL($value, $strict);
104
-			case 'name':
105
-				return self::isName($value, $strict);
106
-			case 'email':
107
-				return self::isEmail($value, $strict);
108
-		}
90
+        switch($validation)
91
+        {
92
+            case 'boolean':
93
+                return self::isBoolean($value, $strict);
94
+            case 'date':
95
+                return self::isDate($value);
96
+            case 'integer':
97
+                return self::isInteger($value, $strict);
98
+            case 'ip':
99
+                return self::isIP($value);
100
+            case 'string':
101
+                return self::isString($value, $strict);
102
+            case 'url':
103
+                return self::isURL($value, $strict);
104
+            case 'name':
105
+                return self::isName($value, $strict);
106
+            case 'email':
107
+                return self::isEmail($value, $strict);
108
+        }
109 109
 		
110
-		return false;
111
-	}
110
+        return false;
111
+    }
112 112
 
113 113
 }
114 114
 
Please login to merge, or discard this patch.
router/HomeRouter.class.inc.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,26 +5,26 @@
 block discarded – undo
5 5
 final class HomeRouter extends Router
6 6
 {
7 7
 
8
-	protected function get_redirect_array()
9
-	{
10
-		return array(
11
-			(object) array(
12
-				'pattern' => '@/index.(html|htm|php)$@',
13
-				'replace' => ''));
14
-	}
8
+    protected function get_redirect_array()
9
+    {
10
+        return array(
11
+            (object) array(
12
+                'pattern' => '@/index.(html|htm|php)$@',
13
+                'replace' => ''));
14
+    }
15 15
 
16
-	protected function get_direct_array()
17
-	{
18
-		return array(
19
-			(object) array(
20
-				'match' => '/',
21
-				'controller' => 'HomeController'),
22
-			(object) array(
23
-				'match' => '/about/',
24
-				'controller' => 'AboutController'),
25
-			(object) array(
26
-				'match' => '/contact/',
27
-				'controller' => 'ContactController'));
28
-	}
16
+    protected function get_direct_array()
17
+    {
18
+        return array(
19
+            (object) array(
20
+                'match' => '/',
21
+                'controller' => 'HomeController'),
22
+            (object) array(
23
+                'match' => '/about/',
24
+                'controller' => 'AboutController'),
25
+            (object) array(
26
+                'match' => '/contact/',
27
+                'controller' => 'ContactController'));
28
+    }
29 29
 
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
router/SiteRouter.class.inc.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -5,29 +5,29 @@
 block discarded – undo
5 5
 class SiteRouter extends Router
6 6
 {
7 7
 
8
-	protected function get_redirect_array()
9
-	{
10
-		return array(
11
-			(object) array(
12
-				'pattern' => '@/index.(html|htm|php)$@',
13
-				'replace' => '/'));
14
-	}
8
+    protected function get_redirect_array()
9
+    {
10
+        return array(
11
+            (object) array(
12
+                'pattern' => '@/index.(html|htm|php)$@',
13
+                'replace' => '/'));
14
+    }
15 15
 
16
-	protected function get_direct_array()
17
-	{
18
-		return array(
19
-			(object) array(
20
-				'match' => '/',
21
-				'controller' => 'HomeController'),
22
-			(object) array(
23
-				'match' => '/terms/',
24
-				'controller' => 'TermsController'),
25
-			(object) array(
26
-				'match' => '/change-log/',
27
-				'controller' => 'ChangelogController'),
28
-			(object) array(
29
-				'match' => '/contact/',
30
-				'controller' => 'ContactController'));
31
-	}
16
+    protected function get_direct_array()
17
+    {
18
+        return array(
19
+            (object) array(
20
+                'match' => '/',
21
+                'controller' => 'HomeController'),
22
+            (object) array(
23
+                'match' => '/terms/',
24
+                'controller' => 'TermsController'),
25
+            (object) array(
26
+                'match' => '/change-log/',
27
+                'controller' => 'ChangelogController'),
28
+            (object) array(
29
+                'match' => '/contact/',
30
+                'controller' => 'ContactController'));
31
+    }
32 32
 
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
router/Router.class.inc.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,144 +1,144 @@
 block discarded – undo
1 1
 <?
2 2
 
3 3
 Loader::load('utility', array(
4
-	'Request',
5
-	'URLDecode'));
4
+    'Request',
5
+    'URLDecode'));
6 6
 
7 7
 abstract class Router
8 8
 {
9 9
 
10
-	public function __construct() {}
10
+    public function __construct() {}
11 11
 
12
-	public static function instance()
13
-	{
14
-		$router_name = self::get_router_name();
15
-		$router = Loader::loadNew('router', $router_name);
16
-		$router->route();
17
-	}
12
+    public static function instance()
13
+    {
14
+        $router_name = self::get_router_name();
15
+        $router = Loader::loadNew('router', $router_name);
16
+        $router->route();
17
+    }
18 18
 
19
-	private static function get_router_name()
20
-	{
21
-		if(Request::isAJAX())
22
-			return 'AJAXRouter';
19
+    private static function get_router_name()
20
+    {
21
+        if(Request::isAJAX())
22
+            return 'AJAXRouter';
23 23
 		
24
-		switch(URLDecode::getSite())
25
-		{
26
-			case 'ajax' :
27
-				return 'AjaxRouter';
28
-			break;
29
-			case 'blog' :
30
-				return 'BlogRouter';
31
-			break;
32
-			case 'home' :
33
-				return 'HomeRouter';
34
-			break;
35
-			case 'lifestream' :
36
-				return 'LifestreamRouter';
37
-			break;
38
-			case 'portfolio' :
39
-				return 'PortfolioRouter';
40
-			break;
41
-			case 'site' :
42
-				return 'SiteRouter';
43
-			break;
44
-			case 'waterfalls' :
45
-				return 'WaterfallRouter';
46
-			break;
47
-		}
24
+        switch(URLDecode::getSite())
25
+        {
26
+            case 'ajax' :
27
+                return 'AjaxRouter';
28
+            break;
29
+            case 'blog' :
30
+                return 'BlogRouter';
31
+            break;
32
+            case 'home' :
33
+                return 'HomeRouter';
34
+            break;
35
+            case 'lifestream' :
36
+                return 'LifestreamRouter';
37
+            break;
38
+            case 'portfolio' :
39
+                return 'PortfolioRouter';
40
+            break;
41
+            case 'site' :
42
+                return 'SiteRouter';
43
+            break;
44
+            case 'waterfalls' :
45
+                return 'WaterfallRouter';
46
+            break;
47
+        }
48 48
 		
49
-		Loader::loadNew('controller', '/Error404Controller')->activate();
50
-	}
49
+        Loader::loadNew('controller', '/Error404Controller')->activate();
50
+    }
51 51
 
52
-	protected function route()
53
-	{
54
-		$uri = URLDecode::getURI();
52
+    protected function route()
53
+    {
54
+        $uri = URLDecode::getURI();
55 55
 		
56
-		$this->check_for_redirect($uri);
56
+        $this->check_for_redirect($uri);
57 57
 		
58
-		$controller = $this->get_controller($uri);
59
-		Loader::loadNew('controller', $controller)
60
-			->activate();
61
-	}
58
+        $controller = $this->get_controller($uri);
59
+        Loader::loadNew('controller', $controller)
60
+            ->activate();
61
+    }
62 62
 
63
-	abstract protected function get_redirect_array();
64
-	abstract protected function get_direct_array();
63
+    abstract protected function get_redirect_array();
64
+    abstract protected function get_direct_array();
65 65
 
66
-	final protected function check_for_redirect($redirect_uri)
67
-	{
68
-		foreach($this->get_redirect_array() as $check)
69
-		{
70
-			$redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri);
71
-		}
66
+    final protected function check_for_redirect($redirect_uri)
67
+    {
68
+        foreach($this->get_redirect_array() as $check)
69
+        {
70
+            $redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri);
71
+        }
72 72
 		
73
-		$redirect_uri = $this->check_for_special_redirect($redirect_uri);
73
+        $redirect_uri = $this->check_for_special_redirect($redirect_uri);
74 74
 		
75
-		if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
76
-			$redirect_uri .= '/';
75
+        if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
76
+            $redirect_uri .= '/';
77 77
 		
78 78
         if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') {
79 79
             $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
80 80
             $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri;
81 81
         }
82 82
         
83
-		if($redirect_uri == URLDecode::getURI())
84
-			return;
83
+        if($redirect_uri == URLDecode::getURI())
84
+            return;
85 85
 		
86
-		$controller_check = $redirect_uri;
87
-		if(substr($redirect_uri, 0, 4) == 'http') {
88
-      $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
89
-			$controller_check = preg_replace('@^' . $protocol . '://([a-z\.]+)@', '', $redirect_uri);
86
+        $controller_check = $redirect_uri;
87
+        if(substr($redirect_uri, 0, 4) == 'http') {
88
+        $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
89
+            $controller_check = preg_replace('@^' . $protocol . '://([a-z\.]+)@', '', $redirect_uri);
90 90
     }
91 91
 		
92
-		$controller = $this->get_controller($controller_check);
93
-		if($controller == '/Error404Controller')
94
-		{
95
-			Loader::loadNew('controller', '/Error404Controller')
96
-				->activate();
97
-			exit;
98
-		}
92
+        $controller = $this->get_controller($controller_check);
93
+        if($controller == '/Error404Controller')
94
+        {
95
+            Loader::loadNew('controller', '/Error404Controller')
96
+                ->activate();
97
+            exit;
98
+        }
99 99
 
100
-		if(substr($redirect_uri, 0, 4) != 'http')
101
-		{
102
-			$redirect_uri = substr($redirect_uri, 1);
103
-			$redirect_uri = URLDecode::getBase() . $redirect_uri;
104
-		}
100
+        if(substr($redirect_uri, 0, 4) != 'http')
101
+        {
102
+            $redirect_uri = substr($redirect_uri, 1);
103
+            $redirect_uri = URLDecode::getBase() . $redirect_uri;
104
+        }
105 105
 		
106
-		Loader::loadNew('controller', '/Error301Controller', (array) $redirect_uri)
107
-			->activate();
108
-	}
106
+        Loader::loadNew('controller', '/Error301Controller', (array) $redirect_uri)
107
+            ->activate();
108
+    }
109 109
 
110
-	protected function check_for_special_redirect($uri)
111
-	{
112
-		return $uri;
113
-	}
110
+    protected function check_for_special_redirect($uri)
111
+    {
112
+        return $uri;
113
+    }
114 114
 
115
-	final private function get_controller($uri)
116
-	{
117
-		foreach($this->get_direct_array() as $check)
118
-		{
119
-			if($uri == $check->match)
120
-				return "{$this->get_primary_folder()}/{$check->controller}";
115
+    final private function get_controller($uri)
116
+    {
117
+        foreach($this->get_direct_array() as $check)
118
+        {
119
+            if($uri == $check->match)
120
+                return "{$this->get_primary_folder()}/{$check->controller}";
121 121
 			
122
-			if(preg_match("@^{$check->match}$@", $uri))
123
-				return "{$this->get_primary_folder()}/{$check->controller}";
124
-		}
122
+            if(preg_match("@^{$check->match}$@", $uri))
123
+                return "{$this->get_primary_folder()}/{$check->controller}";
124
+        }
125 125
 		
126
-		return '/Error404Controller';
127
-	}
126
+        return '/Error404Controller';
127
+    }
128 128
 
129
-	final private function get_primary_folder()
130
-	{
131
-		if(Request::isAjax())
132
-			return 'ajax';
129
+    final private function get_primary_folder()
130
+    {
131
+        if(Request::isAjax())
132
+            return 'ajax';
133 133
 		
134
-		return URLDecode::getSite();
135
-	}
134
+        return URLDecode::getSite();
135
+    }
136 136
 
137
-	private function requires_trailing_slash()
138
-	{
139
-		return (
140
-			URLDecode::getExtension() != 'json' &&
137
+    private function requires_trailing_slash()
138
+    {
139
+        return (
140
+            URLDecode::getExtension() != 'json' &&
141 141
             strstr(URLDecode::getURI(), '#') === false);
142
-	}
142
+    }
143 143
 
144 144
 }
Please login to merge, or discard this patch.
router/LifestreamRouter.class.inc.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -5,54 +5,54 @@
 block discarded – undo
5 5
 class LifestreamRouter extends Router
6 6
 {
7 7
 
8
-	protected function get_redirect_array()
9
-	{
10
-		return array(
11
-			(object) array(
12
-				'pattern' => '@/index.(html|htm|php)$@',
13
-				'replace' => '/'),
14
-			(object) array(
15
-				'pattern' => '@^/1/$@',
16
-				'replace' => '/'),
17
-			(object) array(
18
-				'pattern' => '@/page_([0-9]+)(/?)$@',
19
-				'replace' => '/page/$1/'),
20
-			(object) array(
21
-				'pattern' => '@/tag/([a-z]+)/$@',
22
-				'replace' => '/$1/'),
23
-			(object) array(
24
-				'pattern' => '@/tag/([a-z]+)/page/([0-9]+)/$@',
25
-				'replace' => '/$1/page/$2/'),
26
-			(object) array(
27
-				'pattern' => '@/tag/([a-z-]+)/$@',
28
-				'replace' => '/'),
29
-			(object) array(
30
-				'pattern' => '@/tag/([a-z-]+)/page/([0-9]+)/$@',
31
-				'replace' => '/'));
32
-	}
8
+    protected function get_redirect_array()
9
+    {
10
+        return array(
11
+            (object) array(
12
+                'pattern' => '@/index.(html|htm|php)$@',
13
+                'replace' => '/'),
14
+            (object) array(
15
+                'pattern' => '@^/1/$@',
16
+                'replace' => '/'),
17
+            (object) array(
18
+                'pattern' => '@/page_([0-9]+)(/?)$@',
19
+                'replace' => '/page/$1/'),
20
+            (object) array(
21
+                'pattern' => '@/tag/([a-z]+)/$@',
22
+                'replace' => '/$1/'),
23
+            (object) array(
24
+                'pattern' => '@/tag/([a-z]+)/page/([0-9]+)/$@',
25
+                'replace' => '/$1/page/$2/'),
26
+            (object) array(
27
+                'pattern' => '@/tag/([a-z-]+)/$@',
28
+                'replace' => '/'),
29
+            (object) array(
30
+                'pattern' => '@/tag/([a-z-]+)/page/([0-9]+)/$@',
31
+                'replace' => '/'));
32
+    }
33 33
 
34
-	protected function get_direct_array()
35
-	{
36
-		return array(
37
-			(object) array(
38
-				'match' => '/',
39
-				'controller' => 'HomeController'),
40
-			(object) array(
41
-				'match' => '/about/',
42
-				'controller' => 'AboutController'),
43
-			(object) array(
44
-				'match' => '/page/([0-9]+)/',
45
-				'controller' => 'HomeController'),
46
-			(object) array(
47
-				'match' => '/([a-z]+)/',
48
-				'controller' => 'TagController'),
49
-			(object) array(
50
-				'match' => '/([a-z]+)/page/([0-9]+)/',
51
-				'controller' => 'TagController'),
52
-			(object) array(
53
-				'match' => '/([a-z]+)/([0-9]+)/',
54
-				'controller' => 'PostController'));
55
-	}
34
+    protected function get_direct_array()
35
+    {
36
+        return array(
37
+            (object) array(
38
+                'match' => '/',
39
+                'controller' => 'HomeController'),
40
+            (object) array(
41
+                'match' => '/about/',
42
+                'controller' => 'AboutController'),
43
+            (object) array(
44
+                'match' => '/page/([0-9]+)/',
45
+                'controller' => 'HomeController'),
46
+            (object) array(
47
+                'match' => '/([a-z]+)/',
48
+                'controller' => 'TagController'),
49
+            (object) array(
50
+                'match' => '/([a-z]+)/page/([0-9]+)/',
51
+                'controller' => 'TagController'),
52
+            (object) array(
53
+                'match' => '/([a-z]+)/([0-9]+)/',
54
+                'controller' => 'PostController'));
55
+    }
56 56
 
57 57
 }
58 58
 
Please login to merge, or discard this patch.
router/AJAXRouter.class.inc.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,22 +5,22 @@
 block discarded – undo
5 5
 class AJAXRouter extends Router
6 6
 {
7 7
 
8
-	protected function get_redirect_array()
9
-	{
10
-		return array(
11
-			(object) array(
12
-				'pattern' => '@^/$@',
13
-				'replace' => 'https://home.jacobemerick.com/'));
14
-	}
8
+    protected function get_redirect_array()
9
+    {
10
+        return array(
11
+            (object) array(
12
+                'pattern' => '@^/$@',
13
+                'replace' => 'https://home.jacobemerick.com/'));
14
+    }
15 15
 
16
-	protected function get_direct_array()
17
-	{
18
-		return array(
19
-			(object) array(
20
-				'match' => '/get/portfolioImage.json',
21
-				'controller' => 'GetPortfolioImageController'),
16
+    protected function get_direct_array()
17
+    {
18
+        return array(
19
+            (object) array(
20
+                'match' => '/get/portfolioImage.json',
21
+                'controller' => 'GetPortfolioImageController'),
22 22
     );
23
-	}
23
+    }
24 24
 
25 25
 }
26 26
 
Please login to merge, or discard this patch.
router/BlogRouter.class.inc.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -5,121 +5,121 @@
 block discarded – undo
5 5
 class BlogRouter extends Router
6 6
 {
7 7
 
8
-	protected function get_redirect_array()
9
-	{
10
-		return array(
11
-			(object) array(
12
-				'pattern' => '@^/page_([0-9]+)/$@',
13
-				'replace' => '/$1/'),
14
-			(object) array(
15
-				'pattern' => '@/index.(html|htm|php)$@',
16
-				'replace' => '/'),
17
-			(object) array(
18
-				'pattern' => '@^/([0-9]{4})-([a-z]+)/$@',
19
-				'replace' => '/'),
20
-			(object) array(
21
-				'pattern' => '@^/([0-9]{4})-([a-z]+)/([0-9]+)/$@',
22
-				'replace' => '/'),
23
-			(object) array(
24
-				'pattern' => '@^/month_([a-z]{3,})_([0-9]{4})(/?)$@',
25
-				'replace' => '/'),
26
-			(object) array(
27
-				'pattern' => '@^/month_([a-z]{3,})_([0-9]{4})/page_([0-9]+)(/?)$@',
28
-				'replace' => '/'),
29
-			(object) array(
30
-				'pattern' => '@^/category_([a-z-]+)(/?)$@',
31
-				'replace' => '/$1/'),
32
-			(object) array(
33
-				'pattern' => '@^/category_([a-z-]+)/page_([0-9]+)(/?)$@',
34
-				'replace' => '/$1/$2/'),
35
-			(object) array(
36
-				'pattern' => '@^/tag_([a-z-]+)(/?)$@',
37
-				'replace' => '/tag/$1/'),
38
-			(object) array(
39
-				'pattern' => '@^/tag_([a-z-]+)/page_([0-9]+)(/?)$@',
40
-				'replace' => '/tag/$1/$2/'),
41
-			(object) array(
42
-				'pattern' => '@^/blog/(.*)$@',
43
-				'replace' => '/$1'));
44
-	}
8
+    protected function get_redirect_array()
9
+    {
10
+        return array(
11
+            (object) array(
12
+                'pattern' => '@^/page_([0-9]+)/$@',
13
+                'replace' => '/$1/'),
14
+            (object) array(
15
+                'pattern' => '@/index.(html|htm|php)$@',
16
+                'replace' => '/'),
17
+            (object) array(
18
+                'pattern' => '@^/([0-9]{4})-([a-z]+)/$@',
19
+                'replace' => '/'),
20
+            (object) array(
21
+                'pattern' => '@^/([0-9]{4})-([a-z]+)/([0-9]+)/$@',
22
+                'replace' => '/'),
23
+            (object) array(
24
+                'pattern' => '@^/month_([a-z]{3,})_([0-9]{4})(/?)$@',
25
+                'replace' => '/'),
26
+            (object) array(
27
+                'pattern' => '@^/month_([a-z]{3,})_([0-9]{4})/page_([0-9]+)(/?)$@',
28
+                'replace' => '/'),
29
+            (object) array(
30
+                'pattern' => '@^/category_([a-z-]+)(/?)$@',
31
+                'replace' => '/$1/'),
32
+            (object) array(
33
+                'pattern' => '@^/category_([a-z-]+)/page_([0-9]+)(/?)$@',
34
+                'replace' => '/$1/$2/'),
35
+            (object) array(
36
+                'pattern' => '@^/tag_([a-z-]+)(/?)$@',
37
+                'replace' => '/tag/$1/'),
38
+            (object) array(
39
+                'pattern' => '@^/tag_([a-z-]+)/page_([0-9]+)(/?)$@',
40
+                'replace' => '/tag/$1/$2/'),
41
+            (object) array(
42
+                'pattern' => '@^/blog/(.*)$@',
43
+                'replace' => '/$1'));
44
+    }
45 45
 
46
-	protected function check_for_special_redirect($uri)
47
-	{
48
-		if(preg_match('@^/post_([0-9]{4}-[0-9]{2}-[0-9]{2})_([a-z0-9-]+)(/?)$@', $uri, $matches))
49
-		{
46
+    protected function check_for_special_redirect($uri)
47
+    {
48
+        if(preg_match('@^/post_([0-9]{4}-[0-9]{2}-[0-9]{2})_([a-z0-9-]+)(/?)$@', $uri, $matches))
49
+        {
50 50
         global $container;
51 51
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
52 52
         $post = $repository->findPostByPath($matches[2]);
53 53
 
54
-			if(!$post)
55
-			{
56
-				Loader::loadNew('controller', '/Error404Controller')
57
-					->activate();
58
-			}
54
+            if(!$post)
55
+            {
56
+                Loader::loadNew('controller', '/Error404Controller')
57
+                    ->activate();
58
+            }
59 59
 			
60
-			Loader::load('utility', 'Content');
61
-			$uri = Content::instance('URLSafe', "/{$post['category']}/{$post['path']}/")->activate();
62
-		}
63
-		else
64
-		{
65
-			$post_uri = URLDecode::getPiece(1);
66
-			if($post_uri !== null)
67
-			{
60
+            Loader::load('utility', 'Content');
61
+            $uri = Content::instance('URLSafe', "/{$post['category']}/{$post['path']}/")->activate();
62
+        }
63
+        else
64
+        {
65
+            $post_uri = URLDecode::getPiece(1);
66
+            if($post_uri !== null)
67
+            {
68 68
         global $container;
69 69
         $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
70 70
         $post = $repository->findPostByPath($post_uri);
71 71
 
72
-				if($post != false)
73
-				{
74
-					Loader::load('utility', 'Content');
75
-					$uri = Content::instance('URLSafe', "/{$post['category']}/{$post['path']}/")->activate();
76
-				}
77
-			}
78
-		}
79
-		if($uri == '/search/')
80
-		{
81
-			if(Request::getGet('submit') == 'Submit Search' && Request::getGet('search'))
82
-			{
83
-				$uri .= Request::getGet('search');
84
-				$uri .= '/';
85
-			}
86
-		}
87
-		return $uri;
88
-	}
72
+                if($post != false)
73
+                {
74
+                    Loader::load('utility', 'Content');
75
+                    $uri = Content::instance('URLSafe', "/{$post['category']}/{$post['path']}/")->activate();
76
+                }
77
+            }
78
+        }
79
+        if($uri == '/search/')
80
+        {
81
+            if(Request::getGet('submit') == 'Submit Search' && Request::getGet('search'))
82
+            {
83
+                $uri .= Request::getGet('search');
84
+                $uri .= '/';
85
+            }
86
+        }
87
+        return $uri;
88
+    }
89 89
 
90
-	protected function get_direct_array()
91
-	{
92
-		return array(
93
-			(object) array(
94
-				'match' => '/',
95
-				'controller' => 'HomeController'),
96
-			(object) array(
97
-				'match' => '/([0-9]+)/',
98
-				'controller' => 'HomeController'),
99
-			(object) array(
100
-				'match' => '/about/',
101
-				'controller' => 'AboutController'),
102
-			(object) array(
103
-				'match' => '/(hiking|personal|web-development)/',
104
-				'controller' => 'CategoryController'),
105
-			(object) array(
106
-				'match' => '/(hiking|personal|web-development)/([0-9]+)/',
107
-				'controller' => 'CategoryController'),
108
-			(object) array(
109
-				'match' => '/tag/([a-z0-9-]+)/',
110
-				'controller' => 'TagController'),
111
-			(object) array(
112
-				'match' => '/tag/([a-z-]+)/([0-9]+)/',
113
-				'controller' => 'TagController'),
114
-			(object) array(
115
-				'match' => '/search/([a-z0-9-]+)/',
116
-				'controller' => 'SearchController'),
117
-			(object) array(
118
-				'match' => '/search/([a-z0-9-]+)/([0-9]+)/',
119
-				'controller' => 'SearchController'),
120
-			(object) array(
121
-				'match' => '/([a-z-]+)/([a-z0-9-]+)/',
122
-				'controller' => 'PostController'));
123
-	}
90
+    protected function get_direct_array()
91
+    {
92
+        return array(
93
+            (object) array(
94
+                'match' => '/',
95
+                'controller' => 'HomeController'),
96
+            (object) array(
97
+                'match' => '/([0-9]+)/',
98
+                'controller' => 'HomeController'),
99
+            (object) array(
100
+                'match' => '/about/',
101
+                'controller' => 'AboutController'),
102
+            (object) array(
103
+                'match' => '/(hiking|personal|web-development)/',
104
+                'controller' => 'CategoryController'),
105
+            (object) array(
106
+                'match' => '/(hiking|personal|web-development)/([0-9]+)/',
107
+                'controller' => 'CategoryController'),
108
+            (object) array(
109
+                'match' => '/tag/([a-z0-9-]+)/',
110
+                'controller' => 'TagController'),
111
+            (object) array(
112
+                'match' => '/tag/([a-z-]+)/([0-9]+)/',
113
+                'controller' => 'TagController'),
114
+            (object) array(
115
+                'match' => '/search/([a-z0-9-]+)/',
116
+                'controller' => 'SearchController'),
117
+            (object) array(
118
+                'match' => '/search/([a-z0-9-]+)/([0-9]+)/',
119
+                'controller' => 'SearchController'),
120
+            (object) array(
121
+                'match' => '/([a-z-]+)/([a-z0-9-]+)/',
122
+                'controller' => 'PostController'));
123
+    }
124 124
 
125 125
 }
Please login to merge, or discard this patch.