@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | |
24 | 24 | public static function instance() |
25 | 25 | { |
26 | - if(!isset(self::$instance)) |
|
27 | - self::$instance = new Debugger(); |
|
26 | + if(!isset(self::$instance)) { |
|
27 | + self::$instance = new Debugger(); |
|
28 | + } |
|
28 | 29 | return self::$instance; |
29 | 30 | } |
30 | 31 | |
@@ -51,12 +52,15 @@ discard block |
||
51 | 52 | |
52 | 53 | public static function internal_error($code, $string, $file = null, $line = null, $context = null) |
53 | 54 | { |
54 | - if($file == null) |
|
55 | - $file = self::$UNKNOWN_ERROR_FILE; |
|
56 | - if($line == null) |
|
57 | - $line = self::$UNKNOWN_ERROR_LINE; |
|
58 | - if($context == null) |
|
59 | - $context = self::$UNKNOWN_ERROR_CONTEXT; |
|
55 | + if($file == null) { |
|
56 | + $file = self::$UNKNOWN_ERROR_FILE; |
|
57 | + } |
|
58 | + if($line == null) { |
|
59 | + $line = self::$UNKNOWN_ERROR_LINE; |
|
60 | + } |
|
61 | + if($context == null) { |
|
62 | + $context = self::$UNKNOWN_ERROR_CONTEXT; |
|
63 | + } |
|
60 | 64 | |
61 | 65 | self::instance()->console->logError("{$string}... TYPE: {$code}", $file, $line); |
62 | 66 | |
@@ -67,8 +71,9 @@ discard block |
||
67 | 71 | { |
68 | 72 | $error = error_get_last(); |
69 | 73 | |
70 | - if(isset($error)) |
|
71 | - self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
|
74 | + if(isset($error)) { |
|
75 | + self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
|
76 | + } |
|
72 | 77 | |
73 | 78 | self::display(); |
74 | 79 | return true; |
@@ -81,8 +86,9 @@ discard block |
||
81 | 86 | |
82 | 87 | public static function display() |
83 | 88 | { |
84 | - if(!Loader::isLive() && self::instance()->display) |
|
85 | - self::instance()->profiler->display(); |
|
89 | + if(!Loader::isLive() && self::instance()->display) { |
|
90 | + self::instance()->profiler->display(); |
|
91 | + } |
|
86 | 92 | } |
87 | 93 | |
88 | 94 | } |
@@ -9,8 +9,9 @@ |
||
9 | 9 | |
10 | 10 | public function __construct($user_agent = null) |
11 | 11 | { |
12 | - if(!isset($user_agent)) |
|
13 | - $user_agent = Request::getServer('HTTP_USER_AGENT'); |
|
12 | + if(!isset($user_agent)) { |
|
13 | + $user_agent = Request::getServer('HTTP_USER_AGENT'); |
|
14 | + } |
|
14 | 15 | $this->user_agent = $user_agent; |
15 | 16 | } |
16 | 17 |
@@ -186,8 +186,9 @@ discard block |
||
186 | 186 | |
187 | 187 | private static function send($array, $gzip = true) |
188 | 188 | { |
189 | - if($gzip) |
|
190 | - self::start_gzipping(); |
|
189 | + if($gzip) { |
|
190 | + self::start_gzipping(); |
|
191 | + } |
|
191 | 192 | |
192 | 193 | foreach($array as $row) |
193 | 194 | { |
@@ -197,15 +198,17 @@ discard block |
||
197 | 198 | |
198 | 199 | private static function get_date($timestamp = false) |
199 | 200 | { |
200 | - if($timestamp == 0) |
|
201 | - $timestamp = time(); |
|
201 | + if($timestamp == 0) { |
|
202 | + $timestamp = time(); |
|
203 | + } |
|
202 | 204 | return gmdate('D, d M Y H:i:s \G\M\T', $timestamp); |
203 | 205 | } |
204 | 206 | |
205 | 207 | private static function start_gzipping() |
206 | 208 | { |
207 | - if(!ob_start('ob_gzhandler')) |
|
208 | - ob_start(); |
|
209 | + if(!ob_start('ob_gzhandler')) { |
|
210 | + ob_start(); |
|
211 | + } |
|
209 | 212 | } |
210 | 213 | |
211 | 214 | } |
212 | 215 | \ No newline at end of file |
@@ -52,18 +52,20 @@ discard block |
||
52 | 52 | |
53 | 53 | public function setSize($size) |
54 | 54 | { |
55 | - if($this->get_version() > 1) |
|
56 | - $position = strrpos($this->file, '-v'); |
|
57 | - else |
|
58 | - $position = strrpos($this->file, '.'); |
|
55 | + if($this->get_version() > 1) { |
|
56 | + $position = strrpos($this->file, '-v'); |
|
57 | + } else { |
|
58 | + $position = strrpos($this->file, '.'); |
|
59 | + } |
|
59 | 60 | |
60 | 61 | $this->file = substr($this->file, 0, $position) . '-s' . $size . substr($this->file, $position); |
61 | 62 | } |
62 | 63 | |
63 | 64 | public function getDimensions() |
64 | 65 | { |
65 | - if(!$this->isValid()) |
|
66 | - return false; |
|
66 | + if(!$this->isValid()) { |
|
67 | + return false; |
|
68 | + } |
|
67 | 69 | $imageinfo = getimagesize($this->getInternalPath()); |
68 | 70 | return array($imageinfo[0], $imageinfo[1]); |
69 | 71 | } |
@@ -85,10 +87,11 @@ discard block |
||
85 | 87 | |
86 | 88 | private function get_image($image) |
87 | 89 | { |
88 | - if(preg_match(self::$VERSION_PREG_MATCH, $image)) |
|
89 | - return preg_replace(self::$VERSION_PREG_MATCH, '', $image); |
|
90 | - else |
|
91 | - return $image; |
|
90 | + if(preg_match(self::$VERSION_PREG_MATCH, $image)) { |
|
91 | + return preg_replace(self::$VERSION_PREG_MATCH, '', $image); |
|
92 | + } else { |
|
93 | + return $image; |
|
94 | + } |
|
92 | 95 | } |
93 | 96 | |
94 | 97 | private function get_image_meta($image) |
@@ -103,9 +106,9 @@ discard block |
||
103 | 106 | { |
104 | 107 | $position = strrpos($image, '.'); |
105 | 108 | return substr($image, 0, $position) . '-v' . $this->get_version() . substr($image, $position); |
109 | + } else { |
|
110 | + return $image; |
|
106 | 111 | } |
107 | - else |
|
108 | - return $image; |
|
109 | 112 | } |
110 | 113 | |
111 | 114 | private $version; |
@@ -118,10 +121,11 @@ discard block |
||
118 | 121 | if(count($files) > 0) |
119 | 122 | { |
120 | 123 | preg_match(self::$VERSION_PREG_MATCH, $files[0], $matches); |
121 | - if(count($matches)) |
|
122 | - $this->version = $matches[1]; |
|
123 | - else |
|
124 | - $this->version = 1; |
|
124 | + if(count($matches)) { |
|
125 | + $this->version = $matches[1]; |
|
126 | + } else { |
|
127 | + $this->version = 1; |
|
128 | + } |
|
125 | 129 | } |
126 | 130 | } |
127 | 131 | return $this->version; |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | public static function instance() |
19 | 19 | { |
20 | - if(!isset(self::$instance)) |
|
21 | - self::$instance = new Loader(); |
|
20 | + if(!isset(self::$instance)) { |
|
21 | + self::$instance = new Loader(); |
|
22 | + } |
|
22 | 23 | return self::$instance; |
23 | 24 | } |
24 | 25 | |
@@ -71,8 +72,9 @@ discard block |
||
71 | 72 | |
72 | 73 | public static function getImagePath($type, $file) |
73 | 74 | { |
74 | - if($type == 'photo') |
|
75 | - $type = 'photo/processed'; |
|
75 | + if($type == 'photo') { |
|
76 | + $type = 'photo/processed'; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | $path = self::instance()->get_root(); |
78 | 80 | $path .= 'images'; |
@@ -110,11 +112,13 @@ discard block |
||
110 | 112 | foreach((array) $files as $file) |
111 | 113 | { |
112 | 114 | $file_path = self::instance()->get_path($type, $file); |
113 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
114 | - continue; |
|
115 | + if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') { |
|
116 | + continue; |
|
117 | + } |
|
115 | 118 | |
116 | - if(!file_exists($file_path)) |
|
117 | - Debugger::logMessage("Requested file does not exist: {$type}, {$file}"); |
|
119 | + if(!file_exists($file_path)) { |
|
120 | + Debugger::logMessage("Requested file does not exist: {$type}, {$file}"); |
|
121 | + } |
|
118 | 122 | |
119 | 123 | self::instance()->add_included_file($file_path); |
120 | 124 | |
@@ -163,10 +167,11 @@ discard block |
||
163 | 167 | |
164 | 168 | $reflectionObject = self::create_reflection_class($file); |
165 | 169 | |
166 | - if($reflectionObject->hasMethod('__construct')) |
|
167 | - return $reflectionObject->newInstanceArgs($data); |
|
168 | - else |
|
169 | - return $reflectionObject->newInstance(); |
|
170 | + if($reflectionObject->hasMethod('__construct')) { |
|
171 | + return $reflectionObject->newInstanceArgs($data); |
|
172 | + } else { |
|
173 | + return $reflectionObject->newInstance(); |
|
174 | + } |
|
170 | 175 | } |
171 | 176 | |
172 | 177 | public static function getRoot() |
@@ -20,10 +20,11 @@ |
||
20 | 20 | |
21 | 21 | public function setToAddress($email, $person = null) |
22 | 22 | { |
23 | - if($person) |
|
24 | - $this->to[] = "{$person} <{$email}>"; |
|
25 | - else |
|
26 | - $this->to[] = "{$email}"; |
|
23 | + if($person) { |
|
24 | + $this->to[] = "{$person} <{$email}>"; |
|
25 | + } else { |
|
26 | + $this->to[] = "{$email}"; |
|
27 | + } |
|
27 | 28 | return $this; |
28 | 29 | } |
29 | 30 |
@@ -20,8 +20,9 @@ discard block |
||
20 | 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; |
@@ -29,8 +30,9 @@ discard block |
||
29 | 30 | |
30 | 31 | static function isAjax() |
31 | 32 | { |
32 | - if(self::getServer(self::$AJAX_REQUEST)) |
|
33 | - return true; |
|
33 | + if(self::getServer(self::$AJAX_REQUEST)) { |
|
34 | + return true; |
|
35 | + } |
|
34 | 36 | return false; |
35 | 37 | } |
36 | 38 | |
@@ -38,8 +40,9 @@ discard block |
||
38 | 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; |
@@ -49,8 +52,9 @@ discard block |
||
49 | 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; |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | foreach($this->result as $row) |
43 | 43 | { |
44 | 44 | $weight = $this->get_search_weight($row); |
45 | - if($weight > 0) |
|
46 | - $weighted_array[$row->id] = $weight; |
|
45 | + if($weight > 0) { |
|
46 | + $weighted_array[$row->id] = $weight; |
|
47 | + } |
|
47 | 48 | } |
48 | 49 | arsort($weighted_array); |
49 | 50 | |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | { |
53 | 54 | foreach($this->result as $row) |
54 | 55 | { |
55 | - if($row->id == $id) |
|
56 | - $final_array[] = $row; |
|
56 | + if($row->id == $id) { |
|
57 | + $final_array[] = $row; |
|
58 | + } |
|
57 | 59 | } |
58 | 60 | } |
59 | 61 | return $final_array; |
@@ -15,12 +15,14 @@ discard block |
||
15 | 15 | static private function form_url_array($host, $uri) |
16 | 16 | { |
17 | 17 | $uri = substr($uri, 1); |
18 | - if(strpos($uri, '?')) |
|
19 | - $uri = substr($uri, 0, strpos($uri, '?')); |
|
18 | + if(strpos($uri, '?')) { |
|
19 | + $uri = substr($uri, 0, strpos($uri, '?')); |
|
20 | + } |
|
20 | 21 | $uri_array = explode('/', $uri); |
21 | 22 | |
22 | - if(!Loader::isLive()) |
|
23 | - $host = substr($host, strpos($host, '.') + 1); |
|
23 | + if(!Loader::isLive()) { |
|
24 | + $host = substr($host, strpos($host, '.') + 1); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | self::$array['host'] = $host; |
26 | 28 | |
@@ -33,8 +35,9 @@ discard block |
||
33 | 35 | self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/'; |
34 | 36 | self::$array['uri'] = '/' . implode('/', $uri_array); |
35 | 37 | |
36 | - if(end($uri_array) == '') |
|
37 | - $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
|
38 | + if(end($uri_array) == '') { |
|
39 | + $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
|
40 | + } |
|
38 | 41 | self::$array['pieces'] = (array) $uri_array; |
39 | 42 | } |
40 | 43 | |
@@ -61,22 +64,26 @@ discard block |
||
61 | 64 | static function getExtension() |
62 | 65 | { |
63 | 66 | $file = self::getPiece(-1); |
64 | - if(substr($file, -1) == '/') |
|
65 | - return false; |
|
67 | + if(substr($file, -1) == '/') { |
|
68 | + return false; |
|
69 | + } |
|
66 | 70 | return substr($file, strrpos($file, '.') + 1);; |
67 | 71 | } |
68 | 72 | |
69 | 73 | static function getPiece($piece = null) |
70 | 74 | { |
71 | - if(!$piece) |
|
72 | - return self::$array['pieces']; |
|
75 | + if(!$piece) { |
|
76 | + return self::$array['pieces']; |
|
77 | + } |
|
73 | 78 | |
74 | - if($piece == -1) |
|
75 | - return end(self::$array['pieces']); |
|
79 | + if($piece == -1) { |
|
80 | + return end(self::$array['pieces']); |
|
81 | + } |
|
76 | 82 | |
77 | 83 | $piece = $piece - 1; |
78 | - if(array_key_exists($piece, self::$array['pieces'])) |
|
79 | - return self::$array['pieces'][$piece]; |
|
84 | + if(array_key_exists($piece, self::$array['pieces'])) { |
|
85 | + return self::$array['pieces'][$piece]; |
|
86 | + } |
|
80 | 87 | return; |
81 | 88 | } |
82 | 89 |