@@ -49,9 +49,13 @@ |
||
| 49 | 49 | |
| 50 | 50 | public static function url(string $value) { |
| 51 | 51 | |
| 52 | - if (false === ($value = parent::url($value))) return false; |
|
| 52 | + if (false === ($value = parent::url($value))) { |
|
| 53 | + return false; |
|
| 54 | + } |
|
| 53 | 55 | |
| 54 | - if (!preg_match('/^https?:\/\//', $value)) return false; |
|
| 56 | + if (!preg_match('/^https?:\/\//', $value)) { |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 55 | 59 | |
| 56 | 60 | # ------------------------ |
| 57 | 61 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | $number = number_format(($number / pow(1024, $exponent)), (($exponent < 2) ? $exponent : 2)); |
| 48 | 48 | |
| 49 | - return (floatval($number) . ' ' . $text); |
|
| 49 | + return (floatval($number).' '.$text); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | # ------------------------ |
@@ -17,11 +17,17 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public static function forceInt($number, int $min = 0, int $max = 0) : int { |
| 19 | 19 | |
| 20 | - if (!is_numeric($number) || (($number = intval($number)) < 0)) $number = 0; |
|
| 20 | + if (!is_numeric($number) || (($number = intval($number)) < 0)) { |
|
| 21 | + $number = 0; |
|
| 22 | + } |
|
| 21 | 23 | |
| 22 | - if (($min > 0) && ($number < $min)) return $min; |
|
| 24 | + if (($min > 0) && ($number < $min)) { |
|
| 25 | + return $min; |
|
| 26 | + } |
|
| 23 | 27 | |
| 24 | - if (($max > 0) && ($number > $max)) return $max; |
|
| 28 | + if (($max > 0) && ($number > $max)) { |
|
| 29 | + return $max; |
|
| 30 | + } |
|
| 25 | 31 | |
| 26 | 32 | # ------------------------ |
| 27 | 33 | |
@@ -34,11 +40,17 @@ discard block |
||
| 34 | 40 | |
| 35 | 41 | public static function forceFloat($number, float $min = 0, float $max = 0, int $decimals = 0) : float { |
| 36 | 42 | |
| 37 | - if (!is_numeric($number) || (($number = floatval($number)) < 0)) $number = 0; |
|
| 43 | + if (!is_numeric($number) || (($number = floatval($number)) < 0)) { |
|
| 44 | + $number = 0; |
|
| 45 | + } |
|
| 38 | 46 | |
| 39 | - if (($min > 0) && ($number < $min)) $number = $min; |
|
| 47 | + if (($min > 0) && ($number < $min)) { |
|
| 48 | + $number = $min; |
|
| 49 | + } |
|
| 40 | 50 | |
| 41 | - if (($max > 0) && ($number > $max)) $number = $max; |
|
| 51 | + if (($max > 0) && ($number > $max)) { |
|
| 52 | + $number = $max; |
|
| 53 | + } |
|
| 42 | 54 | |
| 43 | 55 | $number = floatval(number_format($number, $decimals, '.', '')); |
| 44 | 56 | |
@@ -55,9 +67,11 @@ discard block |
||
| 55 | 67 | |
| 56 | 68 | $number = (($number >= 0) ? $number : 0); $exponents = [0 => 'Bytes', 'KB', 'MB', 'GB', 'TB']; |
| 57 | 69 | |
| 58 | - foreach ($exponents as $exponent => $text) if ($number < pow(1024, ($exponent + 1))) { |
|
| 70 | + foreach ($exponents as $exponent => $text) { |
|
| 71 | + if ($number < pow(1024, ($exponent + 1))) { |
|
| 59 | 72 | |
| 60 | 73 | $number = number_format(($number / pow(1024, $exponent)), (($exponent < 2) ? $exponent : 2)); |
| 74 | + } |
|
| 61 | 75 | |
| 62 | 76 | return (floatval($number) . ' ' . $text); |
| 63 | 77 | } |
@@ -79,13 +93,21 @@ discard block |
||
| 79 | 93 | |
| 80 | 94 | $last_1 = substr($number, ($length - 1), 1); $last_2 = substr($number, ($length - 2), 2); |
| 81 | 95 | |
| 82 | - if (($last_2 >= 11) && ($last_2 <= 20)) return $form_5; |
|
| 96 | + if (($last_2 >= 11) && ($last_2 <= 20)) { |
|
| 97 | + return $form_5; |
|
| 98 | + } |
|
| 83 | 99 | |
| 84 | - if ($last_1 == 1) return $form_1; |
|
| 100 | + if ($last_1 == 1) { |
|
| 101 | + return $form_1; |
|
| 102 | + } |
|
| 85 | 103 | |
| 86 | - if (($last_1 >= 2) && ($last_1 <= 4)) return $form_3; |
|
| 104 | + if (($last_1 >= 2) && ($last_1 <= 4)) { |
|
| 105 | + return $form_3; |
|
| 106 | + } |
|
| 87 | 107 | |
| 88 | - if (($last_1 >= 5) || ($last_1 == 0)) return $form_5; |
|
| 108 | + if (($last_1 >= 5) || ($last_1 == 0)) { |
|
| 109 | + return $form_5; |
|
| 110 | + } |
|
| 89 | 111 | } |
| 90 | 112 | } |
| 91 | 113 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public static function __autoload() { |
| 14 | 14 | |
| 15 | - self::init(DIR_DATA . 'Geo/Countries.php'); |
|
| 15 | + self::init(DIR_DATA.'Geo/Countries.php'); |
|
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public static function __autoload() { |
| 14 | 14 | |
| 15 | - self::init(DIR_DATA . 'Geo/Timezones.php'); |
|
| 15 | + self::init(DIR_DATA.'Geo/Timezones.php'); |
|
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | |
| 46 | 46 | public static function redirect(string $url) { |
| 47 | 47 | |
| 48 | - header("Location: " . $url); exit(); |
|
| 48 | + header("Location: ".$url); exit(); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | |
| 13 | 13 | # Set headers |
| 14 | 14 | |
| 15 | - $headers = ('MIME-Version: 1.0' . "\r\n"); |
|
| 15 | + $headers = ('MIME-Version: 1.0'."\r\n"); |
|
| 16 | 16 | |
| 17 | - $headers .= ('Content-Type: ' . ($is_html ? 'text/html' : 'text/plain') . '; charset=UTF-8' . "\r\n"); |
|
| 17 | + $headers .= ('Content-Type: '.($is_html ? 'text/html' : 'text/plain').'; charset=UTF-8'."\r\n"); |
|
| 18 | 18 | |
| 19 | - $headers .= ('From: ' . $sender . ' <' . $from . '>' . "\r\n" . 'Reply-To: ' . $reply_to . "\r\n"); |
|
| 19 | + $headers .= ('From: '.$sender.' <'.$from.'>'."\r\n".'Reply-To: '.$reply_to."\r\n"); |
|
| 20 | 20 | |
| 21 | - $headers .= ('X-Mailer: PHP/' . phpversion() . "\r\n"); |
|
| 21 | + $headers .= ('X-Mailer: PHP/'.phpversion()."\r\n"); |
|
| 22 | 22 | |
| 23 | 23 | # Send message |
| 24 | 24 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | # Build query |
| 20 | 20 | |
| 21 | - $this->query = ('DELETE FROM ' . $table . ($condition ? (' WHERE (' . $condition . ')') : '')); |
|
| 21 | + $this->query = ('DELETE FROM '.$table.($condition ? (' WHERE ('.$condition.')') : '')); |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -22,9 +22,9 @@ |
||
| 22 | 22 | |
| 23 | 23 | # Build query |
| 24 | 24 | |
| 25 | - $this->query = ('SELECT ' . $selection . ' FROM ' . $table . ($condition ? (' WHERE (' . $condition . ')') : '') . |
|
| 25 | + $this->query = ('SELECT '.$selection.' FROM '.$table.($condition ? (' WHERE ('.$condition.')') : ''). |
|
| 26 | 26 | |
| 27 | - ($order ? (' ORDER BY ' . $order) : '') . ($limit ? (' LIMIT ' . $limit) : '')); |
|
| 27 | + ($order ? (' ORDER BY '.$order) : '').($limit ? (' LIMIT '.$limit) : '')); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | |
| 46 | 46 | if ($this->form_personal->handle($controller_personal) || $this->form_password->handle($controller_password)) { |
| 47 | 47 | |
| 48 | - Request::redirect(INSTALL_PATH . '/profile/edit?submitted'); |
|
| 48 | + Request::redirect(INSTALL_PATH.'/profile/edit?submitted'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | # Display success message |
@@ -50,7 +50,9 @@ |
||
| 50 | 50 | |
| 51 | 51 | # Display success message |
| 52 | 52 | |
| 53 | - if (false !== Request::get('submitted')) Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
| 53 | + if (false !== Request::get('submitted')) { |
|
| 54 | + Messages::set('success', Language::get('USER_SUCCESS_EDIT')); |
|
| 55 | + } |
|
| 54 | 56 | |
| 55 | 57 | # ------------------------ |
| 56 | 58 | |