| @@ -49,16 +49,16 @@ discard block | ||
| 49 | 49 | $list = []; | 
| 50 | 50 |          foreach ($attributes as $key => $value) { | 
| 51 | 51 |              if (is_bool($value)) { | 
| 52 | -                if ((bool) $value) { | |
| 52 | +                if ((bool)$value) { | |
| 53 | 53 | $list[] = $key; | 
| 54 | 54 | } | 
| 55 | -            } else if (empty($value)&&!is_int($value)) { | |
| 55 | +            } else if (empty($value) && !is_int($value)) { | |
| 56 | 56 | $list[] = $key; | 
| 57 | 57 |              } else { | 
| 58 | 58 | $list[] = $key . '="' . $value . '"'; | 
| 59 | 59 | } | 
| 60 | 60 | } | 
| 61 | -        return (count($list)>0 ? ' ' : '') . join(' ', $list); | |
| 61 | +        return (count($list) > 0 ? ' ' : '') . join(' ', $list); | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 | /** Parses view to string | 
| @@ -70,12 +70,12 @@ discard block | ||
| 70 | 70 | extract($vars); | 
| 71 | 71 | ob_start(); | 
| 72 | 72 | require $template; | 
| 73 | - return (string) ob_get_clean(); | |
| 73 | + return (string)ob_get_clean(); | |
| 74 | 74 | } | 
| 75 | 75 | |
| 76 | 76 | protected static function paging(&$v) | 
| 77 | 77 |      { | 
| 78 | -        if (self::$t['pages']>1) { | |
| 78 | +        if (self::$t['pages'] > 1) { | |
| 79 | 79 | $v['pages'] = self::$t['pages']; | 
| 80 | 80 | $v['page'] = self::$t['page']; | 
| 81 | 81 | $v['jumpL'] = self::pagingJumps(); | 
| @@ -85,12 +85,12 @@ discard block | ||
| 85 | 85 | |
| 86 | 86 | $limit = 10; | 
| 87 | 87 | |
| 88 | - $v['start'] = $v['page']>($limit/2) ? ($v['page']-$limit/2) : 1; | |
| 88 | + $v['start'] = $v['page'] > ($limit/2) ? ($v['page'] - $limit/2) : 1; | |
| 89 | 89 | |
| 90 | -            if ($v['page']>($v['pages']-($limit/2))) { | |
| 90 | +            if ($v['page'] > ($v['pages'] - ($limit/2))) { | |
| 91 | 91 | $v['final'] = $v['pages']; | 
| 92 | -            } else if ($v['page']>($limit/2)) { | |
| 93 | - $v['final'] = $v['start']+$limit; | |
| 92 | +            } else if ($v['page'] > ($limit/2)) { | |
| 93 | + $v['final'] = $v['start'] + $limit; | |
| 94 | 94 |              } else { | 
| 95 | 95 | $v['final'] = $limit; | 
| 96 | 96 | } | 
| @@ -110,9 +110,9 @@ discard block | ||
| 110 | 110 | $m = 100; | 
| 111 | 111 | } | 
| 112 | 112 |          $jump2show = function($m) use ($direction) { | 
| 113 | -            if ($m >=1000000) { | |
| 113 | +            if ($m >= 1000000) { | |
| 114 | 114 | return ($direction . ($m/1000000) . "M"); | 
| 115 | -            } else if ($m >=1000) { | |
| 115 | +            } else if ($m >= 1000) { | |
| 116 | 116 | return ($direction . ($m/1000) . "K"); | 
| 117 | 117 |              } else { | 
| 118 | 118 | return ($direction . $m); | 
| @@ -120,14 +120,14 @@ discard block | ||
| 120 | 120 | }; | 
| 121 | 121 | $add = '<li class="jump"><a>' . $jump2show($m) . '</a></li>'; | 
| 122 | 122 | |
| 123 | -        if ($direction ==='-') { | |
| 124 | - $jump_exists = (self::$t['page']-$m)>0; | |
| 123 | +        if ($direction === '-') { | |
| 124 | + $jump_exists = (self::$t['page'] - $m) > 0; | |
| 125 | 125 |          } else { | 
| 126 | - $jump_exists = (self::$t['page']+$m) <=self::$t['pages']; | |
| 126 | + $jump_exists = (self::$t['page'] + $m) <= self::$t['pages']; | |
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | 129 |          if ($jump_exists) { | 
| 130 | - $html = $direction ==='-' ? $add . $html : $html . $add; | |
| 130 | + $html = $direction === '-' ? $add . $html : $html . $add; | |
| 131 | 131 | } | 
| 132 | 132 | |
| 133 | 133 | return $jump_exists ? self::pagingJumps($html, ($m*10)) : $html; | 
| @@ -139,13 +139,13 @@ discard block | ||
| 139 | 139 | |
| 140 | 140 | $by = filter_input(INPUT_GET, 'filter-by', FILTER_VALIDATE_INT); | 
| 141 | 141 |          foreach (self::$cols as $k => $v) { | 
| 142 | -            if (isset($v[2]['sort'])&&$v[2]['sort'] ===false) { | |
| 142 | +            if (isset($v[2]['sort']) && $v[2]['sort'] === false) { | |
| 143 | 143 | continue; | 
| 144 | 144 | } | 
| 145 | 145 |              if (empty($v)) { | 
| 146 | 146 | $v = [null]; | 
| 147 | 147 | } // fix for column requested as [] | 
| 148 | - $selected = $by ===$k ? ' selected' : null; | |
| 148 | + $selected = $by === $k ? ' selected' : null; | |
| 149 | 149 |              $opts[] = "<option value=\"{$k}\"{$selected}>{$v[0]}</option>"; | 
| 150 | 150 | } | 
| 151 | 151 | } | 
| @@ -155,10 +155,10 @@ discard block | ||
| 155 | 155 | $filter = filter_input(INPUT_GET, 'filter') ?: false; | 
| 156 | 156 |          if ($filter) { | 
| 157 | 157 | $by = filter_input(INPUT_GET, 'filter-by', FILTER_VALIDATE_INT); | 
| 158 | -            if ($by ===false||is_null($by)) { | |
| 158 | +            if ($by === false || is_null($by)) { | |
| 159 | 159 | $by = []; | 
| 160 | 160 |                  foreach (self::$cols as $v) { | 
| 161 | -                    if (isset($v[2]['sort'])&&$v[2]['sort'] ===false) { | |
| 161 | +                    if (isset($v[2]['sort']) && $v[2]['sort'] === false) { | |
| 162 | 162 | continue; | 
| 163 | 163 | } | 
| 164 | 164 |                      $by[] = 'IFNULL(' . $v[1] . ', "")'; | 
| @@ -168,7 +168,7 @@ discard block | ||
| 168 | 168 | $by = self::$cols[$by][1]; | 
| 169 | 169 | } | 
| 170 | 170 |              $by = 'CONCAT(" ",' . $by . ', " ")'; | 
| 171 | -            if (self::config('FILTER_CASE_SENSITIVE') !==true) { | |
| 171 | +            if (self::config('FILTER_CASE_SENSITIVE') !== true) { | |
| 172 | 172 |                  $by .= ' COLLATE ' . self::config('DB_COLLATION_CI'); | 
| 173 | 173 | } | 
| 174 | 174 | $filter = $by . ' LIKE ' . '"%' . $filter . '%"'; | 
| @@ -180,8 +180,7 @@ discard block | ||
| 180 | 180 |      { | 
| 181 | 181 |          if (($col = filter_input(INPUT_GET, 'col', FILTER_VALIDATE_INT))) { | 
| 182 | 182 | return isset(self::$cols[$col][2]['sort']) ? | 
| 183 | - self::$cols[$col][2]['sort'] : | |
| 184 | - self::$cols[$col][1]; | |
| 183 | + self::$cols[$col][2]['sort'] : self::$cols[$col][1]; | |
| 185 | 184 | } | 
| 186 | 185 | return self::$t['order']['col']; | 
| 187 | 186 | } | 
| @@ -190,8 +189,7 @@ discard block | ||
| 190 | 189 |      { | 
| 191 | 190 | $reset = filter_has_var(INPUT_GET, 'col') ? 'asc' : null; | 
| 192 | 191 | return in_array(filter_input(INPUT_GET, 'ord'), ['asc', 'desc']) ? | 
| 193 | - filter_input(INPUT_GET, 'ord') : | |
| 194 | - ($reset ?: self::$t['order']['dir']); | |
| 192 | + filter_input(INPUT_GET, 'ord') : ($reset ?: self::$t['order']['dir']); | |
| 195 | 193 | } | 
| 196 | 194 | |
| 197 | 195 | protected static function requestExport() | 
| @@ -202,8 +200,7 @@ discard block | ||
| 202 | 200 | |
| 203 | 201 | protected static function requestPage() | 
| 204 | 202 |      { | 
| 205 | - return filter_has_var(INPUT_GET, 'pg')&&self::$export ==false ? | |
| 206 | - (int) filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) : | |
| 207 | - self::$t['page']; | |
| 203 | + return filter_has_var(INPUT_GET, 'pg') && self::$export == false ? | |
| 204 | + (int)filter_input(INPUT_GET, 'pg', FILTER_SANITIZE_NUMBER_INT) : self::$t['page']; | |
| 208 | 205 | } | 
| 209 | 206 | } | 
| @@ -33,10 +33,8 @@ discard block | ||
| 33 | 33 | self::prepare(true); | 
| 34 | 34 | self::$t['order']['col'] = $orderBy; | 
| 35 | 35 | $dir = strtolower($orderDir); | 
| 36 | - self::$t['order']['dir'] = in_array($dir, ['asc', 'desc']) ? $dir : | |
| 37 | -                die('Invalid orderDir(Asc/Desc): ' . $orderDir); | |
| 38 | - self::$t['paging'] = ($p = abs($paging))>10 ? $p : | |
| 39 | -                die('Invalid paging(>10): ' . $paging); | |
| 36 | +        self::$t['order']['dir'] = in_array($dir, ['asc', 'desc']) ? $dir : die('Invalid orderDir(Asc/Desc): ' . $orderDir); | |
| 37 | +        self::$t['paging'] = ($p = abs($paging)) > 10 ? $p : die('Invalid paging(>10): ' . $paging); | |
| 40 | 38 | } | 
| 41 | 39 | |
| 42 | 40 | /** #2. Execute (queries) | 
| @@ -55,11 +53,11 @@ discard block | ||
| 55 | 53 | |
| 56 | 54 | $filter = self::requestFilter(); | 
| 57 | 55 | $order = [self::$t['order']['col'] => self::$t['order']['dir']]; | 
| 58 | - $offset = (self::$t['page']-1)*self::$t['paging']; | |
| 56 | + $offset = (self::$t['page'] - 1)*self::$t['paging']; | |
| 59 | 57 | $limit = [$offset, self::$t['paging']]; | 
| 60 | 58 | self::$t['q'] = self::q($q, $filter, $order, $limit, true); | 
| 61 | 59 | |
| 62 | - $qAll = isset($qTotal)&&!$filter ? $qTotal : $q; | |
| 60 | + $qAll = isset($qTotal) && !$filter ? $qTotal : $q; | |
| 63 | 61 | $orderAll = !self::$export ? [] : $order; | 
| 64 | 62 | self::$t['qAll'] = self::q($qAll, $filter, $orderAll, 0, true); | 
| 65 | 63 | |
| @@ -75,12 +73,12 @@ discard block | ||
| 75 | 73 | /** #3. Loads output (html, json or csv file) */ | 
| 76 | 74 | public static function load() | 
| 77 | 75 |      { | 
| 78 | -        if (self::$pageExt !=='json') { | |
| 76 | +        if (self::$pageExt !== 'json') { | |
| 79 | 77 | echo parent::load(); | 
| 80 | 78 |          } else { | 
| 81 | 79 | ob_get_clean(); | 
| 82 | 80 | $tableId = filter_input(INPUT_GET, 'table-id') ?: null; | 
| 83 | -            if ($tableId ===self::$t['items'] . '-table') { | |
| 81 | +            if ($tableId === self::$t['items'] . '-table') { | |
| 84 | 82 |                  if (!self::$export) { | 
| 85 | 83 |                      header('Content-Type: application/json'); | 
| 86 | 84 | $jsonArr = ['body' => self::jsonGetBodyData(), | 
| @@ -99,16 +97,15 @@ discard block | ||
| 99 | 97 | public static function prepare($setOrCheck = false) | 
| 100 | 98 |      { | 
| 101 | 99 | //@see http://php.net/manual/es/function.filter-input.php#77307 | 
| 102 | - $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: | |
| 103 | - filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); | |
| 100 | + $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); | |
| 104 | 101 | |
| 105 | 102 | $extension = pathinfo(strtok($uri, '?'), PATHINFO_EXTENSION); | 
| 106 | 103 | |
| 107 | 104 | self::$t['slug'] = pathinfo($uri, PATHINFO_BASENAME); | 
| 108 | 105 | self::$pageExt = strtolower($extension); | 
| 109 | 106 | |
| 110 | -        if (self::$helper_class::prepare(__METHOD__, $setOrCheck) !==true) { | |
| 111 | -            if (self::$pageExt ==='json'&&!isset(self::$t['prepared'])) { | |
| 107 | +        if (self::$helper_class::prepare(__METHOD__, $setOrCheck) !== true) { | |
| 108 | +            if (self::$pageExt === 'json' && !isset(self::$t['prepared'])) { | |
| 112 | 109 | ob_start(); | 
| 113 | 110 | self::$t['prepared'] = true; | 
| 114 | 111 | } | 
| @@ -22,23 +22,22 @@ discard block | ||
| 22 | 22 |          if (self::$cols) { | 
| 23 | 23 | $ths = []; | 
| 24 | 24 | $length = sizeof(self::$cols); | 
| 25 | -            for ($i = 0; $i<$length; $i++) { | |
| 25 | +            for ($i = 0; $i < $length; $i++) { | |
| 26 | 26 | list($lbl, $col, $arg) = array_pad(self::$cols[$i], 3, null); | 
| 27 | 27 | |
| 28 | 28 |                  if (is_null($col)) { | 
| 29 | 29 | $arg['sort'] = false; | 
| 30 | 30 | } | 
| 31 | 31 | |
| 32 | - $sortable = !isset($arg['sort'])||$arg['sort'] !==false; | |
| 32 | + $sortable = !isset($arg['sort']) || $arg['sort'] !== false; | |
| 33 | 33 | |
| 34 | 34 | $sort = $sortable ? | 
| 35 | - (isset($arg['sort']) ? $arg['sort'] : $col) : | |
| 36 | - null; | |
| 35 | + (isset($arg['sort']) ? $arg['sort'] : $col) : null; | |
| 37 | 36 | |
| 38 | -                if (($del = isset($arg['type'])&&$arg['type'] =='delete')) { | |
| 37 | +                if (($del = isset($arg['type']) && $arg['type'] == 'delete')) { | |
| 39 | 38 | $sortable = false; | 
| 40 | - if (!isset($arg['width'])&& | |
| 41 | - false ===strpos($arg['width'], 'width:') | |
| 39 | + if (!isset($arg['width']) && | |
| 40 | + false === strpos($arg['width'], 'width:') | |
| 42 | 41 |                      ) { | 
| 43 | 42 | $arg['width'] = '1%'; | 
| 44 | 43 | } | 
| @@ -47,21 +46,19 @@ discard block | ||
| 47 | 46 |                  if (isset($arg['width'])) { // Width attribute -> style | 
| 48 | 47 | $width = 'width:' . $arg['width'] . ';'; | 
| 49 | 48 | $arg['style'] = isset($arg['style']) ? | 
| 50 | - $width . $arg['style'] : | |
| 51 | - $width; | |
| 49 | + $width . $arg['style'] : $width; | |
| 52 | 50 | } | 
| 53 | 51 | |
| 54 | - $attr = array_diff_key((array) $arg, ['sort', 'type', 'width']); | |
| 52 | + $attr = array_diff_key((array)$arg, ['sort', 'type', 'width']); | |
| 55 | 53 | |
| 56 | 54 | $th = '<th' . self::attributes($attr) . '>'; | 
| 57 | 55 |                  if ($sortable) { | 
| 58 | 56 |                      $th .= '<a onclick="table.Sort(' . $i . ',this);">'; | 
| 59 | 57 | } | 
| 60 | 58 |                  if (!$del) { | 
| 61 | -                    if ($sort ==self::$t['order']['col']) { | |
| 62 | - $span = self::$t['order']['dir'] ==='desc' ? | |
| 63 | -                                self::config('UTF8_DESC_SYMBOL') : | |
| 64 | -                                self::config('UTF8_ASC_SYMBOL'); | |
| 59 | +                    if ($sort == self::$t['order']['col']) { | |
| 60 | + $span = self::$t['order']['dir'] === 'desc' ? | |
| 61 | +                                self::config('UTF8_DESC_SYMBOL') : self::config('UTF8_ASC_SYMBOL'); | |
| 65 | 62 |                      } else { | 
| 66 | 63 | $span = ""; | 
| 67 | 64 | } | 
| @@ -91,9 +88,8 @@ discard block | ||
| 91 | 88 | protected static function q($q, $cond = null, array $order = [], $limit = 0, $h = false) | 
| 92 | 89 |      { | 
| 93 | 90 | //Condition: '' | '(HAVING|WHERE|AND) ' . $cond | 
| 94 | - $c = !empty($cond)&&!strpos($q, ($cl = !$h ? 'WHERE' : 'HAVING')) ? | |
| 95 | -                (' ' . (!strpos($q, $cl) ? $cl : ' AND ') . ' ' . $cond ) : | |
| 96 | - ''; | |
| 91 | + $c = !empty($cond) && !strpos($q, ($cl = !$h ? 'WHERE' : 'HAVING')) ? | |
| 92 | +                (' ' . (!strpos($q, $cl) ? $cl : ' AND ') . ' ' . $cond) : ''; | |
| 97 | 93 | //Order: '' | 'ORDER BY ' . array_keys($order)[0] . ' ' . $order[0] | 
| 98 | 94 | $o = !empty($order) ? | 
| 99 | 95 |                  ' ORDER BY ' . implode(', ', | 
| @@ -104,8 +100,7 @@ discard block | ||
| 104 | 100 | ''; | 
| 105 | 101 | //Limit: '' | ' LIMIT ' . '(20, 40|20)' | 
| 106 | 102 | $l = !empty($limit) ? | 
| 107 | -                (' LIMIT ' . (is_array($limit) ? implode(', ', $limit) : $limit)) : | |
| 108 | - ''; | |
| 103 | +                (' LIMIT ' . (is_array($limit) ? implode(', ', $limit) : $limit)) : ''; | |
| 109 | 104 | |
| 110 | 105 | return $q . $c . $o . $l; | 
| 111 | 106 | } | 
| @@ -113,8 +108,7 @@ discard block | ||
| 113 | 108 | protected static function exportData() | 
| 114 | 109 |      { | 
| 115 | 110 | $data = self::$exportDataAsDisplayed ? | 
| 116 | - self::$data : | |
| 117 | - self::select(self::$t['q']); | |
| 111 | + self::$data : self::select(self::$t['q']); | |
| 118 | 112 | $fnReplace = []; | 
| 119 | 113 | $fnReplace[':app'] = self::$app; | 
| 120 | 114 | $fnReplace[':items'] = self::$t['items']; | 
| @@ -124,14 +118,14 @@ discard block | ||
| 124 | 118 |          $outFilename = strtr(self::config('EXPORT_FILE_NAME'), $fnReplace); | 
| 125 | 119 | $outColumns = $outHeader = []; | 
| 126 | 120 |          foreach (self::$cols as $c) { | 
| 127 | -            if (isset($c[2]['sort'])&&$c[2]['sort'] ===false) { | |
| 121 | +            if (isset($c[2]['sort']) && $c[2]['sort'] === false) { | |
| 128 | 122 | continue; | 
| 129 | 123 | } | 
| 130 | 124 | $outColumns[] = $c[1]; | 
| 131 | 125 | $outHeader[] = $c[0]; | 
| 132 | 126 | } | 
| 133 | 127 | $eData = [$outHeader]; | 
| 134 | -        if (count($data)>0) { | |
| 128 | +        if (count($data) > 0) { | |
| 135 | 129 |              foreach ($data as $row) { | 
| 136 | 130 | $rowData = []; | 
| 137 | 131 |                  foreach ($row as $dbName => $value) { | 
| @@ -155,9 +149,8 @@ discard block | ||
| 155 | 149 | |
| 156 | 150 |                  $output = fopen('php://output', 'w'); | 
| 157 | 151 |                  foreach ($eData as $v) { | 
| 158 | - self::$export ==='CSV' ? | |
| 159 | - fputcsv($output, $v) : | |
| 160 | -                                    fputs($output, implode("\t", array_map($escape, $v)) . "\r\n"); | |
| 152 | + self::$export === 'CSV' ? | |
| 153 | +                                    fputcsv($output, $v) : fputs($output, implode("\t", array_map($escape, $v)) . "\r\n"); | |
| 161 | 154 | } | 
| 162 | 155 | fclose($output); | 
| 163 | 156 | break; | 
| @@ -170,7 +163,7 @@ discard block | ||
| 170 | 163 |          foreach (self::$cols as $c) { | 
| 171 | 164 | $outColumns[] = isset($c[1]) ? $c[1] : null; | 
| 172 | 165 | } | 
| 173 | -        if ((self::$t['rows'] = count(self::$data))>0) { | |
| 166 | +        if ((self::$t['rows'] = count(self::$data)) > 0) { | |
| 174 | 167 |              foreach (self::$data as $row) { | 
| 175 | 168 | $rowData = []; | 
| 176 | 169 |                  foreach ($outColumns as $dbName) { | 
| @@ -189,9 +182,9 @@ discard block | ||
| 189 | 182 | protected static function jsonGetFooterData() | 
| 190 | 183 |      { | 
| 191 | 184 | $jsonArrFooter = []; | 
| 192 | -        if (count(self::$data)>0) { | |
| 185 | +        if (count(self::$data) > 0) { | |
| 193 | 186 | $pageNo = self::$t['page']; | 
| 194 | -            if ($pageNo ===1&&count(self::$data)<self::$t['paging']) { | |
| 187 | +            if ($pageNo === 1 && count(self::$data) < self::$t['paging']) { | |
| 195 | 188 | //Skips total count query | 
| 196 | 189 | self::$t['rows'] = count(self::$data); | 
| 197 | 190 |              } else { | 
| @@ -202,15 +195,14 @@ discard block | ||
| 202 | 195 | |
| 203 | 196 | $v = []; | 
| 204 | 197 | |
| 205 | - $v['from'] = ($pageNo-1)*self::$t['paging']+1; | |
| 206 | - $v['upto'] = ($pageNo*self::$t['paging']<self::$t['rows']) ? | |
| 207 | - $pageNo*self::$t['paging'] : | |
| 208 | - self::$t['rows']; | |
| 198 | + $v['from'] = ($pageNo - 1)*self::$t['paging'] + 1; | |
| 199 | + $v['upto'] = ($pageNo*self::$t['paging'] < self::$t['rows']) ? | |
| 200 | + $pageNo*self::$t['paging'] : self::$t['rows']; | |
| 209 | 201 | |
| 210 | 202 | $v["total"] = self::$t['rows']; | 
| 211 | 203 | $v["items"] = self::$t['items']; | 
| 212 | 204 | |
| 213 | -            if (self::$exportActive ===true) { | |
| 205 | +            if (self::$exportActive === true) { | |
| 214 | 206 | $url = strtok(self::$t['slug'], "?&") . ".json?table=" . | 
| 215 | 207 | self::$t['items'] . "&export="; | 
| 216 | 208 |                  $v["export"] = ["url" => $url, "types" => self::config('SAVES')]; | 
| @@ -260,10 +252,10 @@ discard block | ||
| 260 | 252 | private static function rows($for) | 
| 261 | 253 |      { | 
| 262 | 254 | $trs = ''; | 
| 263 | -        if ($for ==='body') { | |
| 255 | +        if ($for === 'body') { | |
| 264 | 256 |              foreach (self::jsonGetBodyData() as $r) { | 
| 265 | - if (isset($r[0][1], $r[0][1]['class'])&& | |
| 266 | - $r[0][1]['class'] ==='no-results' | |
| 257 | + if (isset($r[0][1], $r[0][1]['class']) && | |
| 258 | + $r[0][1]['class'] === 'no-results' | |
| 267 | 259 |                  ) { | 
| 268 | 260 | $trs .= '<tr><td' . self::attributes($r[0][1]) . '>' | 
| 269 | 261 | . $r[0][0] . '</td></tr>'; | 
| @@ -272,8 +264,8 @@ discard block | ||
| 272 | 264 | . '</td></tr>'; | 
| 273 | 265 | } | 
| 274 | 266 | } | 
| 275 | -        } else if ($for ==='footer') { | |
| 276 | -            if (self::$t['rows']>0) { | |
| 267 | +        } else if ($for === 'footer') { | |
| 268 | +            if (self::$t['rows'] > 0) { | |
| 277 | 269 | $ftr = self::jsonGetFooterData()[0][0]; | 
| 278 | 270 | $trs .= '<tr><td' . self::attributes($ftr[1]) . '>' | 
| 279 | 271 | . $ftr[0] . '</td></tr>'; | 
| @@ -295,13 +287,12 @@ discard block | ||
| 295 | 287 | |
| 296 | 288 | static function select(string $expression, array $bindings = []) | 
| 297 | 289 |      { | 
| 298 | -        if (is_object(static::$select)&&(static::$select instanceof Closure)) { | |
| 290 | +        if (is_object(static::$select) && (static::$select instanceof Closure)) { | |
| 299 | 291 | $select = static::$select; | 
| 300 | 292 | $res = $select($expression, $bindings); | 
| 301 | 293 | //if result is single cell value ($res[0]->value), return the value | 
| 302 | - return (count($res) ===1&&count((array) $res[0]) ===1) ? | |
| 303 | - reset($res[0]) : | |
| 304 | - $res; | |
| 294 | + return (count($res) === 1 && count((array)$res[0]) === 1) ? | |
| 295 | + reset($res[0]) : $res; | |
| 305 | 296 |          } else { | 
| 306 | 297 |              die('ERROR: table::$select is not a valid closure. ' | 
| 307 | 298 | . __METHOD__ . '() #' . __LINE__); |