@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | public static function prepare($setOrCheck = false) |
| 39 | 39 | { |
| 40 | 40 | //@see http://php.net/manual/es/function.filter-input.php#77307 |
| 41 | - $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: |
|
| 42 | - filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); |
|
| 41 | + $uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL) ?: filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); |
|
| 43 | 42 | |
| 44 | 43 | $extension = pathinfo(strtok($uri, '?'), PATHINFO_EXTENSION); |
| 45 | 44 | |
@@ -73,9 +72,9 @@ discard block |
||
| 73 | 72 | self::$t['order']['col'] = $orderBy; |
| 74 | 73 | $dir = strtolower($orderDir); |
| 75 | 74 | self::$t['order']['dir'] = in_array($dir, ['asc', 'desc']) ? |
| 76 | - $dir : self::error('Invalid orderDir (Asc/Desc): '.$orderDir); |
|
| 75 | + $dir : self::error('Invalid orderDir (Asc/Desc): ' . $orderDir); |
|
| 77 | 76 | self::$t['paging'] = ($num = abs($paging)) >= 10 ? |
| 78 | - $num : self::error('Invalid paging (<10): '.$paging); |
|
| 77 | + $num : self::error('Invalid paging (<10): ' . $paging); |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | /** |
@@ -94,7 +93,7 @@ discard block |
||
| 94 | 93 | self::$t = self::request(self::$export); |
| 95 | 94 | |
| 96 | 95 | $order = [self::$t['order']['col'] => self::$t['order']['dir']]; |
| 97 | - $offset = (self::$t['page'] - 1) * self::$t['paging']; |
|
| 96 | + $offset = (self::$t['page'] - 1)*self::$t['paging']; |
|
| 98 | 97 | $limit = [$offset, self::$t['paging']]; |
| 99 | 98 | self::$t['q'] = self::query($query, self::$t['filter'], $order, $limit, true); |
| 100 | 99 | |
@@ -107,7 +106,7 @@ discard block |
||
| 107 | 106 | try { |
| 108 | 107 | self::$data = self::select($q); |
| 109 | 108 | } catch (Exception $e) { |
| 110 | - self::error('ERROR: '.$q.'<br />'.$e->getMessage()); |
|
| 109 | + self::error('ERROR: ' . $q . '<br />' . $e->getMessage()); |
|
| 111 | 110 | } |
| 112 | 111 | } |
| 113 | 112 | |
@@ -120,7 +119,7 @@ discard block |
||
| 120 | 119 | echo parent::load(); |
| 121 | 120 | } else { |
| 122 | 121 | $tableId = self::filterInput(INPUT_GET, 'table-id'); |
| 123 | - if ($tableId === self::$t['items'].'-table') { |
|
| 122 | + if ($tableId === self::$t['items'] . '-table') { |
|
| 124 | 123 | ob_get_clean(); |
| 125 | 124 | ob_start('ob_gzhandler'); |
| 126 | 125 | if (!self::$export) { |
@@ -83,14 +83,14 @@ |
||
| 83 | 83 | if (property_exists(__CLASS__, $name)) { |
| 84 | 84 | $val = function(&$val) use ($nodes) { |
| 85 | 85 | $temp = &$val; |
| 86 | - foreach($nodes as $key) { |
|
| 86 | + foreach($nodes as $key) { |
|
| 87 | 87 | if ($key === 'last') { |
| 88 | 88 | return array_pop($temp); |
| 89 | 89 | } |
| 90 | - $temp = &$temp[$key]; |
|
| 91 | - } |
|
| 90 | + $temp = &$temp[$key]; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - return $temp; |
|
| 93 | + return $temp; |
|
| 94 | 94 | }; |
| 95 | 95 | |
| 96 | 96 | if (($v = $val(static::$$name)) !== 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 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | if ($value === true || (empty($value) && $value != 0)) { |
| 35 | 35 | $list[] = $key; |
| 36 | 36 | } else { |
| 37 | - $list[] = $key.'="'.$value.'"'; |
|
| 37 | + $list[] = $key . '="' . $value . '"'; |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | self::$cols = []; |
| 69 | 69 | self::$t['rows'] = null; |
| 70 | 70 | } else { |
| 71 | - echo 'Existing table-id used in table::create(): '.$items; |
|
| 71 | + echo 'Existing table-id used in table::create(): ' . $items; |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | if (property_exists(__CLASS__, $name)) { |
| 84 | 84 | $val = function(&$val) use ($nodes) { |
| 85 | 85 | $temp = &$val; |
| 86 | - foreach($nodes as $key) { |
|
| 86 | + foreach ($nodes as $key) { |
|
| 87 | 87 | if ($key === 'last') { |
| 88 | 88 | return array_pop($temp); |
| 89 | 89 | } |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | return $v === $value; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - throw new Exception('Missing value ('.implode($nodes).').'); |
|
| 100 | + throw new Exception('Missing value (' . implode($nodes) . ').'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - throw new Exception('Undefined property ('.$name.').'); |
|
| 103 | + throw new Exception('Undefined property (' . $name . ').'); |
|
| 104 | 104 | } catch (Exception $e) { |
| 105 | - echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 105 | + echo 'Caught exception: ', $e->getMessage(), "\n"; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return false; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param string $variable_name |
| 116 | 116 | * @return mixed |
| 117 | 117 | */ |
| 118 | - protected static function filterInput(int $type, string $variable_name){ |
|
| 118 | + protected static function filterInput(int $type, string $variable_name) { |
|
| 119 | 119 | return filter_input($type, $variable_name); |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -115,7 +115,8 @@ |
||
| 115 | 115 | * @param string $variable_name |
| 116 | 116 | * @return mixed |
| 117 | 117 | */ |
| 118 | - protected static function filterInput(int $type, string $variable_name){ |
|
| 118 | + protected static function filterInput(int $type, string $variable_name) |
|
| 119 | + { |
|
| 119 | 120 | return filter_input($type, $variable_name); |
| 120 | 121 | } |
| 121 | 122 | } |