@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | throw new Exception('Request to undefined value: ' . $k); |
| 41 | 41 | } |
| 42 | 42 | if (isset($v)) { |
| 43 | - if(!empty($v) && gettype($v) === gettype(self::$config[$k])){ |
|
| 43 | + if (!empty($v) && gettype($v) === gettype(self::$config[$k])) { |
|
| 44 | 44 | return $v; |
| 45 | 45 | } else { |
| 46 | 46 | throw new Exception("Setting invalid value: $v (:$k)"); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $list = []; |
| 73 | 73 | foreach ($attributes as $key => $value) { |
| 74 | 74 | if (is_bool($value)) { |
| 75 | - if ((bool) $value) { |
|
| 75 | + if ((bool)$value) { |
|
| 76 | 76 | $list[] = $key; |
| 77 | 77 | } |
| 78 | 78 | } else if (empty($value) && !is_int($value)) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | extract($vars); |
| 94 | 94 | ob_start(); |
| 95 | 95 | require $template; |
| 96 | - return (string) ob_get_clean(); |
|
| 96 | + return (string)ob_get_clean(); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | protected static function paging(&$v) |
@@ -108,13 +108,12 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | $limit = 10; |
| 110 | 110 | |
| 111 | - $v['start'] = $v['page'] > ($limit / 2) ? |
|
| 112 | - ($v['page'] - $limit / 2) : |
|
| 113 | - 1; |
|
| 111 | + $v['start'] = $v['page'] > ($limit/2) ? |
|
| 112 | + ($v['page'] - $limit/2) : 1; |
|
| 114 | 113 | |
| 115 | - if ($v['page'] > ($v['pages'] - ($limit / 2))) { |
|
| 114 | + if ($v['page'] > ($v['pages'] - ($limit/2))) { |
|
| 116 | 115 | $v['final'] = $v['pages']; |
| 117 | - } else if ($v['page'] > ($limit / 2)) { |
|
| 116 | + } else if ($v['page'] > ($limit/2)) { |
|
| 118 | 117 | $v['final'] = $v['start'] + $limit; |
| 119 | 118 | } else { |
| 120 | 119 | $v['final'] = $limit; |
@@ -136,9 +135,9 @@ discard block |
||
| 136 | 135 | } |
| 137 | 136 | $jump2show = function($m) use ($direction) { |
| 138 | 137 | if ($m >= 1000000) { |
| 139 | - return ($direction . ($m / 1000000) . "M"); |
|
| 138 | + return ($direction . ($m/1000000) . "M"); |
|
| 140 | 139 | } else if ($m >= 1000) { |
| 141 | - return ($direction . ($m / 1000) . "K"); |
|
| 140 | + return ($direction . ($m/1000) . "K"); |
|
| 142 | 141 | } else { |
| 143 | 142 | return ($direction . $m); |
| 144 | 143 | } |
@@ -155,7 +154,7 @@ discard block |
||
| 155 | 154 | $html = $direction === '-' ? $add . $html : $html . $add; |
| 156 | 155 | } |
| 157 | 156 | |
| 158 | - return $jump_exists ? self::pagingJumps($html, ($m * 10)) : $html; |
|
| 157 | + return $jump_exists ? self::pagingJumps($html, ($m*10)) : $html; |
|
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | protected static function filterValues(&$f, &$opts = []) |
@@ -205,8 +204,7 @@ discard block |
||
| 205 | 204 | { |
| 206 | 205 | if (($col = filter_input(INPUT_GET, 'col', FILTER_VALIDATE_INT))) { |
| 207 | 206 | return isset(self::$cols[$col][2]['sort']) ? |
| 208 | - self::$cols[$col][2]['sort'] : |
|
| 209 | - self::$cols[$col][1]; |
|
| 207 | + self::$cols[$col][2]['sort'] : self::$cols[$col][1]; |
|
| 210 | 208 | } |
| 211 | 209 | return self::$t['order']['col']; |
| 212 | 210 | } |
@@ -215,8 +213,7 @@ discard block |
||
| 215 | 213 | { |
| 216 | 214 | $reset = filter_has_var(INPUT_GET, 'col') ? 'asc' : null; |
| 217 | 215 | return in_array(filter_input(INPUT_GET, 'ord'), ['asc', 'desc']) ? |
| 218 | - filter_input(INPUT_GET, 'ord') : |
|
| 219 | - ($reset ?: self::$t['order']['dir']); |
|
| 216 | + filter_input(INPUT_GET, 'ord') : ($reset ?: self::$t['order']['dir']); |
|
| 220 | 217 | } |
| 221 | 218 | |
| 222 | 219 | protected static function requestExport() |
@@ -228,7 +225,6 @@ discard block |
||
| 228 | 225 | protected static function requestPage() |
| 229 | 226 | { |
| 230 | 227 | return filter_has_var(INPUT_GET, 'pg') && self::$export == false ? |
| 231 | - (int) filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) : |
|
| 232 | - self::$t['page']; |
|
| 228 | + (int)filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) : self::$t['page']; |
|
| 233 | 229 | } |
| 234 | 230 | } |