@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | protected function set_response($message, $type = 'internal') |
30 | 30 | { |
31 | - switch($type) |
|
31 | + switch ($type) |
|
32 | 32 | { |
33 | 33 | case 'internal' : |
34 | 34 | $this->response['internal'] = $message; |
@@ -1,60 +1,60 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | Loader::load('utility', array( |
4 | - 'Header', |
|
5 | - 'Request')); |
|
4 | + 'Header', |
|
5 | + 'Request')); |
|
6 | 6 | |
7 | 7 | abstract class AJAXController |
8 | 8 | { |
9 | 9 | |
10 | - private static $RESPONSE_HEADER = 'sendJSON'; |
|
10 | + private static $RESPONSE_HEADER = 'sendJSON'; |
|
11 | 11 | |
12 | - private $response = array(); |
|
12 | + private $response = array(); |
|
13 | 13 | |
14 | - abstract protected function set_data(); |
|
14 | + abstract protected function set_data(); |
|
15 | 15 | |
16 | - function __construct() {} |
|
16 | + function __construct() {} |
|
17 | 17 | |
18 | - public function activate() |
|
19 | - { |
|
20 | - call_user_func(array('Header', self::$RESPONSE_HEADER)); |
|
18 | + public function activate() |
|
19 | + { |
|
20 | + call_user_func(array('Header', self::$RESPONSE_HEADER)); |
|
21 | 21 | |
22 | - $this->set_data(); |
|
23 | - echo $this->response_as_json(); |
|
24 | - } |
|
25 | - |
|
26 | - protected function set_response($message, $type = 'internal') |
|
27 | - { |
|
28 | - switch($type) |
|
29 | - { |
|
30 | - case 'internal' : |
|
31 | - $this->response['internal'] = $message; |
|
32 | - break; |
|
33 | - case 'error' : |
|
34 | - $this->response['error'] = $message; |
|
35 | - default : |
|
36 | - $this->response[$type] = $message; |
|
37 | - break; |
|
38 | - } |
|
39 | - } |
|
40 | - |
|
41 | - protected function fail_response($message) |
|
42 | - { |
|
43 | - $this->set_response($message, 'error'); |
|
44 | - return false; |
|
45 | - } |
|
46 | - |
|
47 | - protected function eject($message) |
|
48 | - { |
|
49 | - $this->fail_response($message); |
|
50 | - echo $this->response_as_json(); |
|
51 | - exit(); |
|
52 | - } |
|
53 | - |
|
54 | - private function response_as_json() |
|
55 | - { |
|
56 | - return json_encode($this->response); |
|
57 | - } |
|
22 | + $this->set_data(); |
|
23 | + echo $this->response_as_json(); |
|
24 | + } |
|
25 | + |
|
26 | + protected function set_response($message, $type = 'internal') |
|
27 | + { |
|
28 | + switch($type) |
|
29 | + { |
|
30 | + case 'internal' : |
|
31 | + $this->response['internal'] = $message; |
|
32 | + break; |
|
33 | + case 'error' : |
|
34 | + $this->response['error'] = $message; |
|
35 | + default : |
|
36 | + $this->response[$type] = $message; |
|
37 | + break; |
|
38 | + } |
|
39 | + } |
|
40 | + |
|
41 | + protected function fail_response($message) |
|
42 | + { |
|
43 | + $this->set_response($message, 'error'); |
|
44 | + return false; |
|
45 | + } |
|
46 | + |
|
47 | + protected function eject($message) |
|
48 | + { |
|
49 | + $this->fail_response($message); |
|
50 | + echo $this->response_as_json(); |
|
51 | + exit(); |
|
52 | + } |
|
53 | + |
|
54 | + private function response_as_json() |
|
55 | + { |
|
56 | + return json_encode($this->response); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | } |
60 | 60 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | 'Header', |
5 | 5 | 'Request')); |
6 | 6 | |
7 | -abstract class AJAXController |
|
8 | -{ |
|
7 | +abstract class AJAXController |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | private static $RESPONSE_HEADER = 'sendJSON'; |
11 | 11 | |
@@ -13,18 +13,20 @@ discard block |
||
13 | 13 | |
14 | 14 | abstract protected function set_data(); |
15 | 15 | |
16 | - function __construct() {} |
|
16 | + function __construct() |
|
17 | + { |
|
18 | +} |
|
17 | 19 | |
18 | - public function activate() |
|
19 | - { |
|
20 | + public function activate() |
|
21 | + { |
|
20 | 22 | call_user_func(array('Header', self::$RESPONSE_HEADER)); |
21 | 23 | |
22 | 24 | $this->set_data(); |
23 | 25 | echo $this->response_as_json(); |
24 | 26 | } |
25 | 27 | |
26 | - protected function set_response($message, $type = 'internal') |
|
27 | - { |
|
28 | + protected function set_response($message, $type = 'internal') |
|
29 | + { |
|
28 | 30 | switch($type) |
29 | 31 | { |
30 | 32 | case 'internal' : |
@@ -38,21 +40,21 @@ discard block |
||
38 | 40 | } |
39 | 41 | } |
40 | 42 | |
41 | - protected function fail_response($message) |
|
42 | - { |
|
43 | + protected function fail_response($message) |
|
44 | + { |
|
43 | 45 | $this->set_response($message, 'error'); |
44 | 46 | return false; |
45 | 47 | } |
46 | 48 | |
47 | - protected function eject($message) |
|
48 | - { |
|
49 | + protected function eject($message) |
|
50 | + { |
|
49 | 51 | $this->fail_response($message); |
50 | 52 | echo $this->response_as_json(); |
51 | 53 | exit(); |
52 | 54 | } |
53 | 55 | |
54 | - private function response_as_json() |
|
55 | - { |
|
56 | + private function response_as_json() |
|
57 | + { |
|
56 | 58 | return json_encode($this->response); |
57 | 59 | } |
58 | 60 |
@@ -11,39 +11,39 @@ discard block |
||
11 | 11 | |
12 | 12 | public static function isBoolean($value, $strict = false) |
13 | 13 | { |
14 | - if($strict && ($value === true || $value === false)) |
|
14 | + if ($strict && ($value === true || $value === false)) |
|
15 | 15 | return true; |
16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
16 | + if (!$strict && ((bool) $value === true || (bool) $value === false)) |
|
17 | 17 | return true; |
18 | 18 | return false; |
19 | 19 | } |
20 | 20 | |
21 | 21 | public static function isDate($value) |
22 | 22 | { |
23 | - if(strtotime($value) !== -1) |
|
23 | + if (strtotime($value) !== -1) |
|
24 | 24 | return true; |
25 | - if(date('y', $value) !== false) |
|
25 | + if (date('y', $value) !== false) |
|
26 | 26 | return true; |
27 | 27 | return false; |
28 | 28 | } |
29 | 29 | |
30 | 30 | public static function isInteger($value, $strict = false) |
31 | 31 | { |
32 | - if($strict) |
|
32 | + if ($strict) |
|
33 | 33 | return is_int($value); |
34 | 34 | return (int) $value == $value; |
35 | 35 | } |
36 | 36 | |
37 | 37 | public static function isIP($value) |
38 | 38 | { |
39 | - if(self::isInteger(ip2long($value))) |
|
39 | + if (self::isInteger(ip2long($value))) |
|
40 | 40 | return true; |
41 | 41 | return false; |
42 | 42 | } |
43 | 43 | |
44 | 44 | public static function isString($value, $strict = false) |
45 | 45 | { |
46 | - if($strict) |
|
46 | + if ($strict) |
|
47 | 47 | return is_string($value); |
48 | 48 | return (string) $value == $value; |
49 | 49 | } |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | private static function check_value($pattern, $string) |
68 | 68 | { |
69 | 69 | preg_match($pattern, $string, $matches); |
70 | - if(empty($matches)) |
|
70 | + if (empty($matches)) |
|
71 | 71 | return false; |
72 | 72 | return $matches[0] == $string; |
73 | 73 | } |
74 | 74 | |
75 | 75 | public static function checkRequest($type, $key, $validation, $strict = false) |
76 | 76 | { |
77 | - switch($type) |
|
77 | + switch ($type) |
|
78 | 78 | { |
79 | 79 | case 'server': |
80 | 80 | $value = Request::getServer($key); |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | break; |
85 | 85 | } |
86 | 86 | |
87 | - if($value == false) |
|
87 | + if ($value == false) |
|
88 | 88 | return false; |
89 | 89 | |
90 | - switch($validation) |
|
90 | + switch ($validation) |
|
91 | 91 | { |
92 | 92 | case 'boolean': |
93 | 93 | return self::isBoolean($value, $strict); |
@@ -5,110 +5,110 @@ |
||
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 |
@@ -2,78 +2,86 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Request'); |
4 | 4 | |
5 | -class Validate |
|
6 | -{ |
|
5 | +class Validate |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $NAME_REGEX = '@[a-z\s\'-]+@i'; |
9 | 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 | 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; |
|
12 | + public static function isBoolean($value, $strict = false) |
|
13 | + { |
|
14 | + if($strict && ($value === true || $value === false)) { |
|
15 | + return true; |
|
16 | + } |
|
17 | + if(!$strict && ((bool) $value === true || (bool) $value === false)) { |
|
18 | + return true; |
|
19 | + } |
|
18 | 20 | return false; |
19 | 21 | } |
20 | 22 | |
21 | - public static function isDate($value) |
|
22 | - { |
|
23 | - if(strtotime($value) !== -1) |
|
24 | - return true; |
|
25 | - if(date('y', $value) !== false) |
|
26 | - return true; |
|
23 | + public static function isDate($value) |
|
24 | + { |
|
25 | + if(strtotime($value) !== -1) { |
|
26 | + return true; |
|
27 | + } |
|
28 | + if(date('y', $value) !== false) { |
|
29 | + return true; |
|
30 | + } |
|
27 | 31 | return false; |
28 | 32 | } |
29 | 33 | |
30 | - public static function isInteger($value, $strict = false) |
|
31 | - { |
|
32 | - if($strict) |
|
33 | - return is_int($value); |
|
34 | + public static function isInteger($value, $strict = false) |
|
35 | + { |
|
36 | + if($strict) { |
|
37 | + return is_int($value); |
|
38 | + } |
|
34 | 39 | return (int) $value == $value; |
35 | 40 | } |
36 | 41 | |
37 | - public static function isIP($value) |
|
38 | - { |
|
39 | - if(self::isInteger(ip2long($value))) |
|
40 | - return true; |
|
42 | + public static function isIP($value) |
|
43 | + { |
|
44 | + if(self::isInteger(ip2long($value))) { |
|
45 | + return true; |
|
46 | + } |
|
41 | 47 | return false; |
42 | 48 | } |
43 | 49 | |
44 | - public static function isString($value, $strict = false) |
|
45 | - { |
|
46 | - if($strict) |
|
47 | - return is_string($value); |
|
50 | + public static function isString($value, $strict = false) |
|
51 | + { |
|
52 | + if($strict) { |
|
53 | + return is_string($value); |
|
54 | + } |
|
48 | 55 | return (string) $value == $value; |
49 | 56 | } |
50 | 57 | |
51 | - public static function isURL($value) |
|
52 | - { |
|
58 | + public static function isURL($value) |
|
59 | + { |
|
53 | 60 | return true; |
54 | 61 | return self::check_value(self::$URL_REGEX, $value); |
55 | 62 | } |
56 | 63 | |
57 | - public static function isName($value) |
|
58 | - { |
|
64 | + public static function isName($value) |
|
65 | + { |
|
59 | 66 | return self::check_value(self::$NAME_REGEX, $value); |
60 | 67 | } |
61 | 68 | |
62 | - public static function isEmail($value) |
|
63 | - { |
|
69 | + public static function isEmail($value) |
|
70 | + { |
|
64 | 71 | return self::check_value(self::$EMAIL_REGEX, $value); |
65 | 72 | } |
66 | 73 | |
67 | - private static function check_value($pattern, $string) |
|
68 | - { |
|
74 | + private static function check_value($pattern, $string) |
|
75 | + { |
|
69 | 76 | preg_match($pattern, $string, $matches); |
70 | - if(empty($matches)) |
|
71 | - return false; |
|
77 | + if(empty($matches)) { |
|
78 | + return false; |
|
79 | + } |
|
72 | 80 | return $matches[0] == $string; |
73 | 81 | } |
74 | 82 | |
75 | - public static function checkRequest($type, $key, $validation, $strict = false) |
|
76 | - { |
|
83 | + public static function checkRequest($type, $key, $validation, $strict = false) |
|
84 | + { |
|
77 | 85 | switch($type) |
78 | 86 | { |
79 | 87 | case 'server': |
@@ -84,8 +92,9 @@ discard block |
||
84 | 92 | break; |
85 | 93 | } |
86 | 94 | |
87 | - if($value == false) |
|
88 | - return false; |
|
95 | + if($value == false) { |
|
96 | + return false; |
|
97 | + } |
|
89 | 98 | |
90 | 99 | switch($validation) |
91 | 100 | { |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | |
19 | 19 | static function getServer($key = null) |
20 | 20 | { |
21 | - if($key) |
|
21 | + if ($key) |
|
22 | 22 | { |
23 | - if(isset(self::$server[$key])) |
|
23 | + if (isset(self::$server[$key])) |
|
24 | 24 | return self::$server[$key]; |
25 | 25 | return false; |
26 | 26 | } |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | |
30 | 30 | static function isAjax() |
31 | 31 | { |
32 | - if(self::getServer(self::$AJAX_REQUEST)) |
|
32 | + if (self::getServer(self::$AJAX_REQUEST)) |
|
33 | 33 | return true; |
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | |
37 | 37 | static function getGet($key = null) |
38 | 38 | { |
39 | - if($key) |
|
39 | + if ($key) |
|
40 | 40 | { |
41 | - if(isset(self::$get[$key])) |
|
41 | + if (isset(self::$get[$key])) |
|
42 | 42 | return self::$get[$key]; |
43 | 43 | return false; |
44 | 44 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | static function getPost($key = null) |
49 | 49 | { |
50 | - if($key) |
|
50 | + if ($key) |
|
51 | 51 | { |
52 | - if(isset(self::$post[$key])) |
|
52 | + if (isset(self::$post[$key])) |
|
53 | 53 | return self::$post[$key]; |
54 | 54 | return false; |
55 | 55 | } |
@@ -3,78 +3,78 @@ |
||
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 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class Request |
|
4 | -{ |
|
3 | +class Request |
|
4 | +{ |
|
5 | 5 | |
6 | 6 | private static $server = array(); |
7 | 7 | private static $get = array(); |
@@ -9,70 +9,74 @@ discard block |
||
9 | 9 | |
10 | 10 | private static $AJAX_REQUEST = 'HTTP_X_REQUESTED_WITH'; |
11 | 11 | |
12 | - static function init() |
|
13 | - { |
|
12 | + static function init() |
|
13 | + { |
|
14 | 14 | self::make_server(); |
15 | 15 | self::make_get(); |
16 | 16 | self::make_post(); |
17 | 17 | } |
18 | 18 | |
19 | - static function getServer($key = null) |
|
20 | - { |
|
19 | + static function getServer($key = null) |
|
20 | + { |
|
21 | 21 | if($key) |
22 | 22 | { |
23 | - if(isset(self::$server[$key])) |
|
24 | - return self::$server[$key]; |
|
23 | + if(isset(self::$server[$key])) { |
|
24 | + return self::$server[$key]; |
|
25 | + } |
|
25 | 26 | return false; |
26 | 27 | } |
27 | 28 | return self::$server; |
28 | 29 | } |
29 | 30 | |
30 | - static function isAjax() |
|
31 | - { |
|
32 | - if(self::getServer(self::$AJAX_REQUEST)) |
|
33 | - return true; |
|
31 | + static function isAjax() |
|
32 | + { |
|
33 | + if(self::getServer(self::$AJAX_REQUEST)) { |
|
34 | + return true; |
|
35 | + } |
|
34 | 36 | return false; |
35 | 37 | } |
36 | 38 | |
37 | - static function getGet($key = null) |
|
38 | - { |
|
39 | + static function getGet($key = null) |
|
40 | + { |
|
39 | 41 | if($key) |
40 | 42 | { |
41 | - if(isset(self::$get[$key])) |
|
42 | - return self::$get[$key]; |
|
43 | + if(isset(self::$get[$key])) { |
|
44 | + return self::$get[$key]; |
|
45 | + } |
|
43 | 46 | return false; |
44 | 47 | } |
45 | 48 | return self::$get; |
46 | 49 | } |
47 | 50 | |
48 | - static function getPost($key = null) |
|
49 | - { |
|
51 | + static function getPost($key = null) |
|
52 | + { |
|
50 | 53 | if($key) |
51 | 54 | { |
52 | - if(isset(self::$post[$key])) |
|
53 | - return self::$post[$key]; |
|
55 | + if(isset(self::$post[$key])) { |
|
56 | + return self::$post[$key]; |
|
57 | + } |
|
54 | 58 | return false; |
55 | 59 | } |
56 | 60 | return self::$post; |
57 | 61 | } |
58 | 62 | |
59 | - public static function hasPost() |
|
60 | - { |
|
63 | + public static function hasPost() |
|
64 | + { |
|
61 | 65 | return is_array(self::$post) && !empty(self::$post); |
62 | 66 | } |
63 | 67 | |
64 | - static function make_server() |
|
65 | - { |
|
68 | + static function make_server() |
|
69 | + { |
|
66 | 70 | self::$server = $_SERVER; |
67 | 71 | } |
68 | 72 | |
69 | - static function make_get() |
|
70 | - { |
|
73 | + static function make_get() |
|
74 | + { |
|
71 | 75 | self::$get = $_GET; |
72 | 76 | } |
73 | 77 | |
74 | - static function make_post() |
|
75 | - { |
|
78 | + static function make_post() |
|
79 | + { |
|
76 | 80 | self::$post = $_POST; |
77 | 81 | } |
78 | 82 |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface LogRepositoryInterface |
6 | 6 | { |
7 | - public function getActiveLogs($limit = null, $offset= 0); |
|
7 | + public function getActiveLogs($limit = null, $offset = 0); |
|
8 | 8 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Jacobemerick\Web\Domain\Waterfall\Log; |
4 | 4 | |
5 | -interface LogRepositoryInterface |
|
6 | -{ |
|
5 | +interface LogRepositoryInterface |
|
6 | +{ |
|
7 | 7 | public function getActiveLogs($limit = null, $offset= 0); |
8 | 8 | } |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface WaterfallRepositoryInterface |
6 | 6 | { |
7 | - public function getWaterfalls($limit = null, $offset= 0); |
|
7 | + public function getWaterfalls($limit = null, $offset = 0); |
|
8 | 8 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Jacobemerick\Web\Domain\Waterfall\Waterfall; |
4 | 4 | |
5 | -interface WaterfallRepositoryInterface |
|
6 | -{ |
|
5 | +interface WaterfallRepositoryInterface |
|
6 | +{ |
|
7 | 7 | public function getWaterfalls($limit = null, $offset= 0); |
8 | 8 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'lifestream'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'site'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'waterfalls'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $namespace = 'home'; |
4 | -require_once __DIR__ . '/../../bootstrap.php'; |
|
4 | +require_once __DIR__.'/../../bootstrap.php'; |
|
5 | 5 | |
6 | 6 | // route |
7 | 7 | Loader::loadInstance('router', 'Router'); |