@@ -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 | |
@@ -11,40 +11,47 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | public static function isBoolean($value, $strict = false) |
| 13 | 13 | {
|
| 14 | - if($strict && ($value === true || $value === false)) |
|
| 15 | - return true; |
|
| 16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
| 17 | - return true; |
|
| 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 | 23 | public static function isDate($value) |
| 22 | 24 | {
|
| 23 | - if(strtotime($value) !== -1) |
|
| 24 | - return true; |
|
| 25 | - if(date('y', $value) !== false)
|
|
| 26 | - return true; |
|
| 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 | 34 | public static function isInteger($value, $strict = false) |
| 31 | 35 | {
|
| 32 | - if($strict) |
|
| 33 | - return is_int($value); |
|
| 36 | + if($strict) {
|
|
| 37 | + return is_int($value); |
|
| 38 | + } |
|
| 34 | 39 | return (int) $value == $value; |
| 35 | 40 | } |
| 36 | 41 | |
| 37 | 42 | public static function isIP($value) |
| 38 | 43 | {
|
| 39 | - if(self::isInteger(ip2long($value))) |
|
| 40 | - return true; |
|
| 44 | + if(self::isInteger(ip2long($value))) {
|
|
| 45 | + return true; |
|
| 46 | + } |
|
| 41 | 47 | return false; |
| 42 | 48 | } |
| 43 | 49 | |
| 44 | 50 | public static function isString($value, $strict = false) |
| 45 | 51 | {
|
| 46 | - if($strict) |
|
| 47 | - return is_string($value); |
|
| 52 | + if($strict) {
|
|
| 53 | + return is_string($value); |
|
| 54 | + } |
|
| 48 | 55 | return (string) $value == $value; |
| 49 | 56 | } |
| 50 | 57 | |
@@ -67,8 +74,9 @@ discard block |
||
| 67 | 74 | private static function check_value($pattern, $string) |
| 68 | 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 | |
@@ -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 | {
|