@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | if (!empty($cond)) { |
| 37 | 37 | $clause = !$useHaving ? 'WHERE' : 'HAVING'; |
| 38 | 38 | $clue = !strpos($query, $clause) ? $clause : 'AND'; |
| 39 | - $query .= (' '.$clue.' '.$cond); |
|
| 39 | + $query .= (' ' . $clue . ' ' . $cond); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | private static function queryOrder(&$query, $order) |
| 44 | 44 | { |
| 45 | 45 | if (!empty($order)) { |
| 46 | - $arr = array_map(function (&$value, $key) { |
|
| 47 | - return $key.' '.strtoupper($value); |
|
| 46 | + $arr = array_map(function(&$value, $key) { |
|
| 47 | + return $key . ' ' . strtoupper($value); |
|
| 48 | 48 | }, $order, array_keys($order)); |
| 49 | - $query .= (' ORDER BY '.implode(', ', $arr)); |
|
| 49 | + $query .= (' ORDER BY ' . implode(', ', $arr)); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | if (!empty($limit)) { |
| 56 | 56 | $value = (is_array($limit) ? implode(', ', $limit) : $limit); |
| 57 | - $query .= (' LIMIT '.$value); |
|
| 57 | + $query .= (' LIMIT ' . $value); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | public static function prepare($setOrCheck = false) |
| 38 | 38 | { |
| 39 | 39 | //@see http://php.net/manual/es/function.filter-input.php#77307 |
| 40 | - $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: |
|
| 41 | - filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); |
|
| 40 | + $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); |
|
| 42 | 41 | |
| 43 | 42 | $extension = pathinfo(strtok($uri, '?'), PATHINFO_EXTENSION); |
| 44 | 43 | |
@@ -70,9 +69,9 @@ discard block |
||
| 70 | 69 | self::$t['order']['col'] = $orderBy; |
| 71 | 70 | $dir = strtolower($orderDir); |
| 72 | 71 | self::$t['order']['dir'] = in_array($dir, ['asc', 'desc']) ? |
| 73 | - $dir : self::error('Invalid orderDir (Asc/Desc): '.$orderDir); |
|
| 72 | + $dir : self::error('Invalid orderDir (Asc/Desc): ' . $orderDir); |
|
| 74 | 73 | self::$t['paging'] = ($num = abs($paging)) >= 10 ? |
| 75 | - $num : self::error('Invalid paging (<10): '.$paging); |
|
| 74 | + $num : self::error('Invalid paging (<10): ' . $paging); |
|
| 76 | 75 | } |
| 77 | 76 | |
| 78 | 77 | /** |
@@ -89,7 +88,7 @@ discard block |
||
| 89 | 88 | self::$t = self::request(self::$export); |
| 90 | 89 | |
| 91 | 90 | $order = [self::$t['order']['col'] => self::$t['order']['dir']]; |
| 92 | - $offset = (self::$t['page'] - 1) * self::$t['paging']; |
|
| 91 | + $offset = (self::$t['page'] - 1)*self::$t['paging']; |
|
| 93 | 92 | $limit = [$offset, self::$t['paging']]; |
| 94 | 93 | self::$t['q'] = self::query($query, self::$t['filter'], $order, $limit, true); |
| 95 | 94 | |
@@ -102,7 +101,7 @@ discard block |
||
| 102 | 101 | try { |
| 103 | 102 | self::$data = self::select($q); |
| 104 | 103 | } catch (Exception $e) { |
| 105 | - self::error('ERROR: '.$q.'<br />'.$e->getMessage()); |
|
| 104 | + self::error('ERROR: ' . $q . '<br />' . $e->getMessage()); |
|
| 106 | 105 | } |
| 107 | 106 | } |
| 108 | 107 | |
@@ -114,7 +113,7 @@ discard block |
||
| 114 | 113 | echo parent::load(); |
| 115 | 114 | } else { |
| 116 | 115 | $tableId = filter_input(INPUT_GET, 'table-id') ?: null; |
| 117 | - if ($tableId === self::$t['items'].'-table') { |
|
| 116 | + if ($tableId === self::$t['items'] . '-table') { |
|
| 118 | 117 | ob_get_clean(); |
| 119 | 118 | ob_start('ob_gzhandler'); |
| 120 | 119 | if (!self::$export) { |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | $vars = []; |
| 18 | 18 | self::showingMessageVars($vars); |
| 19 | 19 | if (self::$exportActive === true) { |
| 20 | - $url = strtok(self::$t['slug'], '?&').'.json?table='. |
|
| 21 | - self::$t['items'].'&export='; |
|
| 20 | + $url = strtok(self::$t['slug'], '?&') . '.json?table=' . |
|
| 21 | + self::$t['items'] . '&export='; |
|
| 22 | 22 | $vars['export']['url'] = $url; |
| 23 | 23 | $vars['export']['types'] = self::config('SAVES'); |
| 24 | 24 | } |
@@ -38,15 +38,14 @@ discard block |
||
| 38 | 38 | //Skips total count query |
| 39 | 39 | self::$t['rows'] = count(self::$data); |
| 40 | 40 | } else { |
| 41 | - $query = 'SELECT COUNT(*) FROM ('.self::$t['qAll'].') AS dt'; |
|
| 41 | + $query = 'SELECT COUNT(*) FROM (' . self::$t['qAll'] . ') AS dt'; |
|
| 42 | 42 | self::$t['rows'] = self::select($query); |
| 43 | 43 | } |
| 44 | - self::$t['pages'] = ceil(self::$t['rows'] / self::$t['paging']); |
|
| 44 | + self::$t['pages'] = ceil(self::$t['rows']/self::$t['paging']); |
|
| 45 | 45 | |
| 46 | - $vars['from'] = ($pageNo - 1) * self::$t['paging'] + 1; |
|
| 47 | - $vars['upto'] = ($pageNo * self::$t['paging'] < self::$t['rows']) ? |
|
| 48 | - $pageNo * self::$t['paging'] : |
|
| 49 | - self::$t['rows']; |
|
| 46 | + $vars['from'] = ($pageNo - 1)*self::$t['paging'] + 1; |
|
| 47 | + $vars['upto'] = ($pageNo*self::$t['paging'] < self::$t['rows']) ? |
|
| 48 | + $pageNo*self::$t['paging'] : self::$t['rows']; |
|
| 50 | 49 | |
| 51 | 50 | $vars['total'] = self::$t['rows']; |
| 52 | 51 | $vars['items'] = self::$t['items']; |
@@ -57,11 +56,11 @@ discard block |
||
| 57 | 56 | $trs = ''; |
| 58 | 57 | if (self::$t['rows'] > 0) { |
| 59 | 58 | $ftr = self::jsonTfoot()[0][0]; |
| 60 | - $trs .= '<tr><td'.self::attributes($ftr[1]).'>' |
|
| 61 | - .$ftr[0].'</td></tr>'; |
|
| 59 | + $trs .= '<tr><td' . self::attributes($ftr[1]) . '>' |
|
| 60 | + .$ftr[0] . '</td></tr>'; |
|
| 62 | 61 | } elseif (count(self::$errors) > 0) { |
| 63 | - $trs .= '<tr><td colspan="'.count(self::$cols).'">'. |
|
| 64 | - self::error().'</td></tr>'; |
|
| 62 | + $trs .= '<tr><td colspan="' . count(self::$cols) . '">' . |
|
| 63 | + self::error() . '</td></tr>'; |
|
| 65 | 64 | } |
| 66 | 65 | |
| 67 | 66 | return $trs; |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | $res = $select($expression, $bindings); |
| 75 | 74 | //if result is single cell value ($res[0]->value), return the value |
| 76 | 75 | return (count($res) === 1 && count((array) $res[0]) === 1) ? |
| 77 | - reset($res[0]) : |
|
| 78 | - $res; |
|
| 76 | + reset($res[0]) : $res; |
|
| 79 | 77 | } else { |
| 80 | 78 | throw new Exception('ERROR: table::$select is not a closure. '); |
| 81 | 79 | } |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | if (isset($r[0][1], $r[0][1]['class']) && |
| 32 | 32 | $r[0][1]['class'] === 'no-results' |
| 33 | 33 | ) { |
| 34 | - $trs .= '<tr><td'.self::attributes($r[0][1]).'>' |
|
| 35 | - .$r[0][0].'</td></tr>'; |
|
| 34 | + $trs .= '<tr><td' . self::attributes($r[0][1]) . '>' |
|
| 35 | + .$r[0][0] . '</td></tr>'; |
|
| 36 | 36 | } else { |
| 37 | - $trs .= '<tr><td>'.implode('</td><td>', $r) |
|
| 37 | + $trs .= '<tr><td>' . implode('</td><td>', $r) |
|
| 38 | 38 | .'</td></tr>'; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -49,16 +49,14 @@ discard block |
||
| 49 | 49 | $rows = [$header]; |
| 50 | 50 | |
| 51 | 51 | $data = self::$exportDataAsDisplayed ? |
| 52 | - self::$data : |
|
| 53 | - self::select(self::$t['q']); |
|
| 52 | + self::$data : self::select(self::$t['q']); |
|
| 54 | 53 | |
| 55 | 54 | if (count($data) > 0) { |
| 56 | 55 | foreach ($data as $row) { |
| 57 | 56 | $cells = []; |
| 58 | 57 | foreach ($columns as $column) { |
| 59 | 58 | $cells[] = is_array($row[$column]) ? |
| 60 | - $row[$column][0] : |
|
| 61 | - $row[$column]; |
|
| 59 | + $row[$column][0] : $row[$column]; |
|
| 62 | 60 | } |
| 63 | 61 | $rows[] = $cells; |
| 64 | 62 | } |
@@ -87,19 +85,18 @@ discard block |
||
| 87 | 85 | switch (self::$export) { |
| 88 | 86 | case 'Excel': |
| 89 | 87 | case 'CSV': |
| 90 | - $escape = function ($value) { |
|
| 88 | + $escape = function($value) { |
|
| 91 | 89 | return str_replace("\t", '	', $value); |
| 92 | 90 | }; |
| 93 | 91 | header('Content-Type:application/csv'); |
| 94 | - header('Content-Disposition:attachment; filename='. |
|
| 95 | - $filename.'.csv'); |
|
| 92 | + header('Content-Disposition:attachment; filename=' . |
|
| 93 | + $filename . '.csv'); |
|
| 96 | 94 | |
| 97 | 95 | if (($output = fopen('php://output', 'w'))) { |
| 98 | 96 | foreach ($eData as $v) { |
| 99 | 97 | self::$export === 'CSV' ? |
| 100 | - fputcsv($output, $v) : |
|
| 101 | - fwrite($output, |
|
| 102 | - implode("\t", array_map($escape, $v))."\r\n"); |
|
| 98 | + fputcsv($output, $v) : fwrite($output, |
|
| 99 | + implode("\t", array_map($escape, $v)) . "\r\n"); |
|
| 103 | 100 | } |
| 104 | 101 | fclose($output); |
| 105 | 102 | } |
@@ -113,7 +110,7 @@ discard block |
||
| 113 | 110 | $fnReplace[':app'] = self::config('APP'); |
| 114 | 111 | $fnReplace[':items'] = self::$t['items']; |
| 115 | 112 | $format = str_replace(':', '.', '%d.%m.%Y %H:%i:%s'); |
| 116 | - $timeQuery = 'SELECT DATE_FORMAT(Now(), "'.$format.'") AS `now`;'; |
|
| 113 | + $timeQuery = 'SELECT DATE_FORMAT(Now(), "' . $format . '") AS `now`;'; |
|
| 117 | 114 | $fnReplace[':datetime'] = self::select($timeQuery); |
| 118 | 115 | |
| 119 | 116 | return strtr((string) self::config('EXPORT_FILE_NAME'), $fnReplace); |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | protected static function filterValues(&$filter, &$opts = []) |
| 33 | 33 | { |
| 34 | - $filter = filter_input(INPUT_GET, 'filter', FILTER_SANITIZE_STRING) ?: |
|
| 35 | - null; |
|
| 34 | + $filter = filter_input(INPUT_GET, 'filter', FILTER_SANITIZE_STRING) ?: null; |
|
| 36 | 35 | |
| 37 | 36 | $filterBy = filter_input(INPUT_GET, 'filter-by', FILTER_VALIDATE_INT); |
| 38 | 37 | foreach (self::$cols as $key => $value) { |
@@ -47,15 +46,14 @@ discard block |
||
| 47 | 46 | private static function tagAttributes($tag, $items) |
| 48 | 47 | { |
| 49 | 48 | $attr = $tag === 'div' ? |
| 50 | - ['id' => $items.'-list', 'class' => 'table'] : |
|
| 51 | - ['id' => $items.'-table', 'data-table' => 'js', |
|
| 49 | + ['id' => $items . '-list', 'class' => 'table'] : ['id' => $items . '-table', 'data-table' => 'js', |
|
| 52 | 50 | 'data-sort-a' => self::config('UTF8_ASC_SYMBOL'), |
| 53 | 51 | 'data-sort-d' => self::config('UTF8_DESC_SYMBOL'), ]; |
| 54 | 52 | if (array_key_exists($tag, self::$attributes)) { |
| 55 | 53 | $attr += self::$attributes[$tag]; |
| 56 | 54 | } |
| 57 | 55 | if (isset(self::$attributes[$tag]['class'])) { |
| 58 | - $attr['class'] .= ' '.self::$attributes[$tag]['class']; |
|
| 56 | + $attr['class'] .= ' ' . self::$attributes[$tag]['class']; |
|
| 59 | 57 | } |
| 60 | 58 | |
| 61 | 59 | return self::attributes($attr); |
@@ -85,10 +83,9 @@ discard block |
||
| 85 | 83 | private static function thAttributes($col, $arg, &$sort, &$del) |
| 86 | 84 | { |
| 87 | 85 | if (isset($arg['width'])) { // Width attribute -> style |
| 88 | - $width = 'width:'.$arg['width'].';'; |
|
| 86 | + $width = 'width:' . $arg['width'] . ';'; |
|
| 89 | 87 | $arg['style'] = isset($arg['style']) ? |
| 90 | - $width.$arg['style'] : |
|
| 91 | - $width; |
|
| 88 | + $width . $arg['style'] : $width; |
|
| 92 | 89 | } |
| 93 | 90 | |
| 94 | 91 | if (($del = isset($arg['type']) && $arg['type'] == 'delete')) { |
@@ -102,23 +99,22 @@ discard block |
||
| 102 | 99 | |
| 103 | 100 | private static function thTag($index, $attr, $sort, $del, $lbl) |
| 104 | 101 | { |
| 105 | - $tag = '<th'.self::attributes($attr).'>'; |
|
| 102 | + $tag = '<th' . self::attributes($attr) . '>'; |
|
| 106 | 103 | if ($sort) { |
| 107 | - $tag .= '<a onclick="table.Sort('.$index.',this);">'; |
|
| 104 | + $tag .= '<a onclick="table.Sort(' . $index . ',this);">'; |
|
| 108 | 105 | } |
| 109 | 106 | if (!$del) { |
| 110 | 107 | if ($sort == self::$t['order']['col']) { |
| 111 | 108 | $span = self::$t['order']['dir'] === 'desc' ? |
| 112 | - self::config('UTF8_DESC_SYMBOL') : |
|
| 113 | - self::config('UTF8_ASC_SYMBOL'); |
|
| 109 | + self::config('UTF8_DESC_SYMBOL') : self::config('UTF8_ASC_SYMBOL'); |
|
| 114 | 110 | } else { |
| 115 | 111 | $span = ''; |
| 116 | 112 | } |
| 117 | - $tag .= '<span>'.$span.'</span>'.$lbl; |
|
| 113 | + $tag .= '<span>' . $span . '</span>' . $lbl; |
|
| 118 | 114 | } else { |
| 119 | - $tag .= '<input id="'.self::$t['items'].'CheckDeleteAll"'. |
|
| 120 | - ' onclick=\"checkAllDeleteCheckboxes(this,'. |
|
| 121 | - ' \''.self::$t['items'].'\')" type="checkbox"/>'; |
|
| 115 | + $tag .= '<input id="' . self::$t['items'] . 'CheckDeleteAll"' . |
|
| 116 | + ' onclick=\"checkAllDeleteCheckboxes(this,' . |
|
| 117 | + ' \'' . self::$t['items'] . '\')" type="checkbox"/>'; |
|
| 122 | 118 | } |
| 123 | 119 | if ($sort) { |
| 124 | 120 | $tag .= '</a>'; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | throw new Exception('Invalid value type.'); |
| 39 | 39 | } |
| 40 | 40 | } catch (Exception $e) { |
| 41 | - self::error('ERROR: '.$e->getMessage()); |
|
| 41 | + self::error('ERROR: ' . $e->getMessage()); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | self::$errors[] = $message; |
| 49 | 49 | } else { |
| 50 | 50 | return empty(self::$errors) ? null : |
| 51 | - '<p class="tbl-err">'.implode('</br>', self::$errors).'</p>'; |
|
| 51 | + '<p class="tbl-err">' . implode('</br>', self::$errors) . '</p>'; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | private static function valid($key, $val = null) |
| 56 | 56 | { |
| 57 | 57 | if (!array_key_exists($key, self::$config)) { |
| 58 | - throw new Exception('Request to undefined value: '.$key); |
|
| 58 | + throw new Exception('Request to undefined value: ' . $key); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if ($val !== null) { |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public static function assets($path = '/public/table') |
| 19 | 19 | { |
| 20 | - return "<script src=\"{$path}/table_helper.js\" defer></script>\n\t". |
|
| 21 | - "<script src=\"{$path}/table.js\" defer></script>\n\t". |
|
| 20 | + return "<script src=\"{$path}/table_helper.js\" defer></script>\n\t" . |
|
| 21 | + "<script src=\"{$path}/table.js\" defer></script>\n\t" . |
|
| 22 | 22 | "<link href=\"{$path}/table.css\" rel=\"stylesheet\">\n"; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | if ($value === true || (empty($value) && $value != 0)) { |
| 34 | 34 | $list[] = $key; |
| 35 | 35 | } else { |
| 36 | - $list[] = $key.'="'.$value.'"'; |
|
| 36 | + $list[] = $key . '="' . $value . '"'; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | self::$cols = []; |
| 64 | 64 | self::$t['rows'] = null; |
| 65 | 65 | } else { |
| 66 | - echo 'Existing table-id used in table::create(): '.$items; |
|
| 66 | + echo 'Existing table-id used in table::create(): ' . $items; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -80,18 +80,17 @@ discard block |
||
| 80 | 80 | case 3: return static::$$name[$p[0]][$p[1]][$p[2]] === $value; |
| 81 | 81 | case 2: return static::$$name[$p[0]][$p[1]] === $value; |
| 82 | 82 | case 1: return $p[0] === '∞' ? //request is to the last one |
| 83 | - static::$$name[(count(static::$$name) - 1)] === $value : |
|
| 84 | - static::$$name[$p[0]] === $value; |
|
| 83 | + static::$$name[(count(static::$$name) - 1)] === $value : static::$$name[$p[0]] === $value; |
|
| 85 | 84 | case 0: return static::$$name === $value; |
| 86 | 85 | default: |
| 87 | 86 | $oops = implode($p); |
| 88 | - throw new Exception('Missing value ('.$oops.').'); |
|
| 87 | + throw new Exception('Missing value (' . $oops . ').'); |
|
| 89 | 88 | } |
| 90 | 89 | } else { |
| 91 | - throw new Exception('Undefined property ('.$name.').'); |
|
| 90 | + throw new Exception('Undefined property (' . $name . ').'); |
|
| 92 | 91 | } |
| 93 | 92 | } catch (Exception $e) { |
| 94 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 93 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 95 | 94 | } |
| 96 | 95 | |
| 97 | 96 | return false; |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | } else { |
| 29 | 29 | $filterBy = self::$cols[$filterBy][1]; |
| 30 | 30 | } |
| 31 | - $filterBy = 'CONCAT(" ",'.$filterBy.', " ")'; |
|
| 31 | + $filterBy = 'CONCAT(" ",' . $filterBy . ', " ")'; |
|
| 32 | 32 | if (self::config('FILTER_CASE_SENSITIVE') !== true) { |
| 33 | - $filterBy .= ' COLLATE '.self::config('DB_COLLATION_CI'); |
|
| 33 | + $filterBy .= ' COLLATE ' . self::config('DB_COLLATION_CI'); |
|
| 34 | 34 | } |
| 35 | - $filter = $filterBy.' LIKE '.'"%'.$filter.'%"'; |
|
| 35 | + $filter = $filterBy . ' LIKE ' . '"%' . $filter . '%"'; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | return $filter; |
@@ -45,18 +45,17 @@ discard block |
||
| 45 | 45 | if (isset($v[2]['sort']) && $v[2]['sort'] === false) { |
| 46 | 46 | continue; |
| 47 | 47 | } |
| 48 | - $all[] = 'IFNULL('.$v[1].', "")'; |
|
| 48 | + $all[] = 'IFNULL(' . $v[1] . ', "")'; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - return 'CONCAT('.implode(',', $all).')'; |
|
| 51 | + return 'CONCAT(' . implode(',', $all) . ')'; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | private static function orderCol() |
| 55 | 55 | { |
| 56 | 56 | if (($col = filter_input(INPUT_GET, 'col', FILTER_VALIDATE_INT))) { |
| 57 | 57 | return isset(self::$cols[$col][2]['sort']) ? |
| 58 | - self::$cols[$col][2]['sort'] : |
|
| 59 | - self::$cols[$col][1]; |
|
| 58 | + self::$cols[$col][2]['sort'] : self::$cols[$col][1]; |
|
| 60 | 59 | } |
| 61 | 60 | |
| 62 | 61 | return self::$t['order']['col']; |
@@ -67,8 +66,7 @@ discard block |
||
| 67 | 66 | $reset = filter_has_var(INPUT_GET, 'col') ? 'asc' : null; |
| 68 | 67 | |
| 69 | 68 | return in_array(filter_input(INPUT_GET, 'ord'), ['asc', 'desc']) ? |
| 70 | - filter_input(INPUT_GET, 'ord') : |
|
| 71 | - ($reset ?: self::$t['order']['dir']); |
|
| 69 | + filter_input(INPUT_GET, 'ord') : ($reset ?: self::$t['order']['dir']); |
|
| 72 | 70 | } |
| 73 | 71 | |
| 74 | 72 | private static function setExport() |
@@ -81,7 +79,6 @@ discard block |
||
| 81 | 79 | private static function page() |
| 82 | 80 | { |
| 83 | 81 | return filter_has_var(INPUT_GET, 'pg') && self::$export == false ? |
| 84 | - (int) filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) : |
|
| 85 | - self::$t['page']; |
|
| 82 | + (int) filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) : self::$t['page']; |
|
| 86 | 83 | } |
| 87 | 84 | } |
@@ -14,13 +14,12 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $limit = 10; |
| 16 | 16 | |
| 17 | - $vars['start'] = $vars['page'] > ($limit / 2) ? |
|
| 18 | - ($vars['page'] - $limit / 2) : |
|
| 19 | - 1; |
|
| 17 | + $vars['start'] = $vars['page'] > ($limit/2) ? |
|
| 18 | + ($vars['page'] - $limit/2) : 1; |
|
| 20 | 19 | |
| 21 | - if ($vars['page'] > ($vars['pages'] - ($limit / 2))) { |
|
| 20 | + if ($vars['page'] > ($vars['pages'] - ($limit/2))) { |
|
| 22 | 21 | $vars['final'] = $vars['pages']; |
| 23 | - } elseif ($vars['page'] > ($limit / 2)) { |
|
| 22 | + } elseif ($vars['page'] > ($limit/2)) { |
|
| 24 | 23 | $vars['final'] = $vars['start'] + $limit; |
| 25 | 24 | } else { |
| 26 | 25 | $vars['final'] = $limit; |
@@ -43,16 +42,15 @@ discard block |
||
| 43 | 42 | } |
| 44 | 43 | |
| 45 | 44 | $jump = self::jump($multiplier, $direction); |
| 46 | - $add = '<li class="jump"><a>'.$jump.'</a></li>'; |
|
| 45 | + $add = '<li class="jump"><a>' . $jump . '</a></li>'; |
|
| 47 | 46 | |
| 48 | 47 | $jumpExists = $direction === '-' ? |
| 49 | - (self::$t['page'] - $multiplier) > 0 : |
|
| 50 | - (self::$t['page'] + $multiplier) <= self::$t['pages']; |
|
| 48 | + (self::$t['page'] - $multiplier) > 0 : (self::$t['page'] + $multiplier) <= self::$t['pages']; |
|
| 51 | 49 | |
| 52 | 50 | if ($jumpExists) { |
| 53 | - $html = $direction === '-' ? $add.$html : $html.$add; |
|
| 51 | + $html = $direction === '-' ? $add . $html : $html . $add; |
|
| 54 | 52 | |
| 55 | - return self::jumps($html, ($multiplier * 10)); |
|
| 53 | + return self::jumps($html, ($multiplier*10)); |
|
| 56 | 54 | } |
| 57 | 55 | |
| 58 | 56 | return $html; |
@@ -61,11 +59,11 @@ discard block |
||
| 61 | 59 | private static function jump($multiplier, $direction) |
| 62 | 60 | { |
| 63 | 61 | if ($multiplier >= 1000000) { |
| 64 | - return $direction.($multiplier / 1000000).'M'; |
|
| 62 | + return $direction . ($multiplier/1000000) . 'M'; |
|
| 65 | 63 | } elseif ($multiplier >= 1000) { |
| 66 | - return $direction.($multiplier / 1000).'K'; |
|
| 64 | + return $direction . ($multiplier/1000) . 'K'; |
|
| 67 | 65 | } else { |
| 68 | - return $direction.$multiplier; |
|
| 66 | + return $direction . $multiplier; |
|
| 69 | 67 | } |
| 70 | 68 | } |
| 71 | 69 | } |