@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | $sortable = !isset($arg['sort']) || $arg['sort'] !== false; |
| 23 | 23 | |
| 24 | 24 | $sort = $sortable ? |
| 25 | - (isset($arg['sort']) ? $arg['sort'] : $col) : |
|
| 26 | - null; |
|
| 25 | + (isset($arg['sort']) ? $arg['sort'] : $col) : null; |
|
| 27 | 26 | |
| 28 | 27 | if (($del = isset($arg['type']) && $arg['type'] == 'delete')) { |
| 29 | 28 | $sortable = false; |
@@ -37,11 +36,10 @@ discard block |
||
| 37 | 36 | if (isset($arg['width'])) { // Width attribute -> style |
| 38 | 37 | $width = 'width:' . $arg['width'] . ';'; |
| 39 | 38 | $arg['style'] = isset($arg['style']) ? |
| 40 | - $width . $arg['style'] : |
|
| 41 | - $width; |
|
| 39 | + $width . $arg['style'] : $width; |
|
| 42 | 40 | } |
| 43 | 41 | |
| 44 | - $attr = array_diff_key((array) $arg, ['sort', 'type', 'width']); |
|
| 42 | + $attr = array_diff_key((array)$arg, ['sort', 'type', 'width']); |
|
| 45 | 43 | |
| 46 | 44 | $th = '<th' . self::attributes($attr) . '>'; |
| 47 | 45 | if ($sortable) { |
@@ -50,8 +48,7 @@ discard block |
||
| 50 | 48 | if (!$del) { |
| 51 | 49 | if ($sort == self::$t['order']['col']) { |
| 52 | 50 | $span = self::$t['order']['dir'] === 'desc' ? |
| 53 | - self::config('UTF8_DESC_SYMBOL') : |
|
| 54 | - self::config('UTF8_ASC_SYMBOL'); |
|
| 51 | + self::config('UTF8_DESC_SYMBOL') : self::config('UTF8_ASC_SYMBOL'); |
|
| 55 | 52 | } else { |
| 56 | 53 | $span = ""; |
| 57 | 54 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | public static function prepare($setOrCheck = false) |
| 26 | 26 | { |
| 27 | 27 | //@see http://php.net/manual/es/function.filter-input.php#77307 |
| 28 | - $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: |
|
| 29 | - filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); |
|
| 28 | + $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); |
|
| 30 | 29 | |
| 31 | 30 | $extension = pathinfo(strtok($uri, '?'), PATHINFO_EXTENSION); |
| 32 | 31 | |
@@ -79,7 +78,7 @@ discard block |
||
| 79 | 78 | |
| 80 | 79 | $filter = self::requestFilter(); |
| 81 | 80 | $order = [self::$t['order']['col'] => self::$t['order']['dir']]; |
| 82 | - $offset = (self::$t['page'] - 1) * self::$t['paging']; |
|
| 81 | + $offset = (self::$t['page'] - 1)*self::$t['paging']; |
|
| 83 | 82 | $limit = [$offset, self::$t['paging']]; |
| 84 | 83 | self::$t['q'] = self::q($q, $filter, $order, $limit, true); |
| 85 | 84 | |
@@ -44,8 +44,7 @@ discard block |
||
| 44 | 44 | protected static function export() |
| 45 | 45 | { |
| 46 | 46 | $data = self::$exportDataAsDisplayed ? |
| 47 | - self::$data : |
|
| 48 | - self::select(self::$t['q']); |
|
| 47 | + self::$data : self::select(self::$t['q']); |
|
| 49 | 48 | $fnReplace = []; |
| 50 | 49 | $fnReplace[':app'] = self::config('APP'); |
| 51 | 50 | $fnReplace[':items'] = self::$t['items']; |
@@ -91,8 +90,7 @@ discard block |
||
| 91 | 90 | if (($output = fopen('php://output', 'w'))) { |
| 92 | 91 | foreach ($eData as $v) { |
| 93 | 92 | self::$export === 'CSV' ? |
| 94 | - fputcsv($output, $v) : |
|
| 95 | - fputs($output, implode("\t", array_map($escape, $v)) . "\r\n"); |
|
| 93 | + fputcsv($output, $v) : fputs($output, implode("\t", array_map($escape, $v)) . "\r\n"); |
|
| 96 | 94 | } |
| 97 | 95 | fclose($output); |
| 98 | 96 | } |
@@ -21,14 +21,13 @@ discard block |
||
| 21 | 21 | $q = 'SELECT COUNT(*) FROM (' . self::$t['qAll'] . ') AS dt'; |
| 22 | 22 | self::$t['rows'] = self::select($q); |
| 23 | 23 | } |
| 24 | - self::$t['pages'] = ceil(self::$t['rows'] / self::$t['paging']); |
|
| 24 | + self::$t['pages'] = ceil(self::$t['rows']/self::$t['paging']); |
|
| 25 | 25 | |
| 26 | 26 | $v = []; |
| 27 | 27 | |
| 28 | - $v['from'] = ($pageNo - 1) * self::$t['paging'] + 1; |
|
| 29 | - $v['upto'] = ($pageNo * self::$t['paging'] < self::$t['rows']) ? |
|
| 30 | - $pageNo * self::$t['paging'] : |
|
| 31 | - self::$t['rows']; |
|
| 28 | + $v['from'] = ($pageNo - 1)*self::$t['paging'] + 1; |
|
| 29 | + $v['upto'] = ($pageNo*self::$t['paging'] < self::$t['rows']) ? |
|
| 30 | + $pageNo*self::$t['paging'] : self::$t['rows']; |
|
| 32 | 31 | |
| 33 | 32 | $v["total"] = self::$t['rows']; |
| 34 | 33 | $v["items"] = self::$t['items']; |
@@ -56,9 +55,8 @@ discard block |
||
| 56 | 55 | $select = static::$select; |
| 57 | 56 | $res = $select($expression, $bindings); |
| 58 | 57 | //if result is single cell value ($res[0]->value), return the value |
| 59 | - return (count($res) === 1 && count((array) $res[0]) === 1) ? |
|
| 60 | - reset($res[0]) : |
|
| 61 | - $res; |
|
| 58 | + return (count($res) === 1 && count((array)$res[0]) === 1) ? |
|
| 59 | + reset($res[0]) : $res; |
|
| 62 | 60 | } else { |
| 63 | 61 | throw new Exception('ERROR: table::$select is not a closure. '); |
| 64 | 62 | } |
@@ -71,8 +69,8 @@ discard block |
||
| 71 | 69 | $ftr = self::jsonGetFooterData()[0][0]; |
| 72 | 70 | $trs .= '<tr><td' . self::attributes($ftr[1]) . '>' |
| 73 | 71 | . $ftr[0] . '</td></tr>'; |
| 74 | - } else if(count(self::$errors)>0) { |
|
| 75 | - $trs .= '<tr><td colspan="'.count(self::$cols).'">' . |
|
| 72 | + } else if (count(self::$errors) > 0) { |
|
| 73 | + $trs .= '<tr><td colspan="' . count(self::$cols) . '">' . |
|
| 76 | 74 | self::err() . '</td></tr>'; |
| 77 | 75 | } |
| 78 | 76 | return $trs; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | switch (gettype($c)) { |
| 63 | 63 | case 'array'; |
| 64 | 64 | foreach ($c as $k => $v) { |
| 65 | - self::$config[$k] = $getValid((string) $k, $v); |
|
| 65 | + self::$config[$k] = $getValid((string)$k, $v); |
|
| 66 | 66 | } |
| 67 | 67 | break; |
| 68 | 68 | case 'string': |
@@ -86,8 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | //Condition: '' | '(HAVING|WHERE|AND) ' . $cond |
| 88 | 88 | $c = !empty($cond) && !strpos($q, ($cl = !$h ? 'WHERE' : 'HAVING')) ? |
| 89 | - (' ' . (!strpos($q, $cl) ? $cl : ' AND ') . ' ' . $cond ) : |
|
| 90 | - ''; |
|
| 89 | + (' ' . (!strpos($q, $cl) ? $cl : ' AND ') . ' ' . $cond) : ''; |
|
| 91 | 90 | //Order: '' | 'ORDER BY ' . array_keys($order)[0] . ' ' . $order[0] |
| 92 | 91 | $o = !empty($order) ? |
| 93 | 92 | ' ORDER BY ' . implode(', ', |
@@ -98,8 +97,7 @@ discard block |
||
| 98 | 97 | ''; |
| 99 | 98 | //Limit: '' | ' LIMIT ' . '(20, 40|20)' |
| 100 | 99 | $l = !empty($limit) ? |
| 101 | - (' LIMIT ' . (is_array($limit) ? implode(', ', $limit) : $limit)) : |
|
| 102 | - ''; |
|
| 100 | + (' LIMIT ' . (is_array($limit) ? implode(', ', $limit) : $limit)) : ''; |
|
| 103 | 101 | |
| 104 | 102 | return $q . $c . $o . $l; |
| 105 | 103 | } |
@@ -122,7 +120,7 @@ discard block |
||
| 122 | 120 | $list = []; |
| 123 | 121 | foreach ($attributes as $key => $value) { |
| 124 | 122 | if (is_bool($value)) { |
| 125 | - if ((bool) $value) { |
|
| 123 | + if ((bool)$value) { |
|
| 126 | 124 | $list[] = $key; |
| 127 | 125 | } |
| 128 | 126 | } else if (empty($value) && !is_int($value)) { |
@@ -143,6 +141,6 @@ discard block |
||
| 143 | 141 | extract($vars); |
| 144 | 142 | ob_start(); |
| 145 | 143 | require $template; |
| 146 | - return (string) ob_get_clean(); |
|
| 144 | + return (string)ob_get_clean(); |
|
| 147 | 145 | } |
| 148 | 146 | } |