@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php namespace Helpers; |
2 | 2 | |
3 | -include_once(MODX_BASE_PATH . 'assets/snippets/phpthumb/phpthumb.class.php'); |
|
4 | -require_once(MODX_BASE_PATH . 'assets/lib/Helpers/FS.php'); |
|
3 | +include_once(MODX_BASE_PATH.'assets/snippets/phpthumb/phpthumb.class.php'); |
|
4 | +require_once(MODX_BASE_PATH.'assets/lib/Helpers/FS.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Class PHPThumb |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->thumb->sourceFilename = $inputFile; |
45 | 45 | $ext = explode('.', $inputFile); |
46 | 46 | $ext = str_replace('jpeg', 'jpg', strtolower(array_pop($ext))); |
47 | - $options = 'f=' . $ext . '&' . $options; |
|
47 | + $options = 'f='.$ext.'&'.$options; |
|
48 | 48 | $this->setOptions($options); |
49 | 49 | if ($this->thumb->GenerateThumbnail() && $this->thumb->RenderToFile($outputFile)) { |
50 | 50 | return true; |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | case 'jpg': |
65 | 65 | $ext = $this->fs->takeFileExt($file); |
66 | 66 | if ($ext == 'jpeg' || $ext == 'jpg') { |
67 | - $cmd = '/usr/bin/jpegtran -optimize -progressive -copy none -outfile ' . escapeshellarg($file . '_') . ' ' . escapeshellarg($file); |
|
67 | + $cmd = '/usr/bin/jpegtran -optimize -progressive -copy none -outfile '.escapeshellarg($file.'_').' '.escapeshellarg($file); |
|
68 | 68 | exec($cmd, $result, $return_var); |
69 | - if ($this->fs->fileSize($file) > $this->fs->fileSize($file . '_')) { |
|
70 | - $this->fs->moveFile($file . '_', $file); |
|
69 | + if ($this->fs->fileSize($file) > $this->fs->fileSize($file.'_')) { |
|
70 | + $this->fs->moveFile($file.'_', $file); |
|
71 | 71 | } else { |
72 | - $this->fs->unlink($file . '_'); |
|
72 | + $this->fs->unlink($file.'_'); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | break; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $index = $this->modx->db->getValue($rows); |
62 | 62 | $index = $index - 1; |
63 | 63 | $this->query("SET @index := " . $index); |
64 | - $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->indexName}`>{$index} AND `{$this->rfName}`={$rid} AND `{$this->pkName}` NOT IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
64 | + $this->query("update {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->indexName}`>{$index} AND `{$this->rfName}`={$rid} AND `{$this->pkName}` NOT IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
65 | 65 | $out = $this->modx->db->getAffectedRows(); |
66 | 66 | |
67 | 67 | return $out; |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | $ids = implode(',', $ids); |
97 | 97 | if ($dir == 'top') { |
98 | 98 | $this->query("SET @index := " . ($index - $cnt - 1)); |
99 | - $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
99 | + $this->query("update {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
100 | 100 | $this->query("SET @index := -1"); |
101 | 101 | } else { |
102 | 102 | $this->query("SET @index := -1"); |
103 | - $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
103 | + $this->query("update {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
|
104 | 104 | $this->query("SET @index := " . ($cnt - 1)); |
105 | 105 | } |
106 | - $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` NOT IN ({$ids})) AND `{$this->rfName}` = {$rid} ORDER BY `{$this->indexName}` ASC"); |
|
106 | + $this->query("update {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` NOT IN ({$ids})) AND `{$this->rfName}` = {$rid} ORDER BY `{$this->indexName}` ASC"); |
|
107 | 107 | $out = $this->modx->db->getAffectedRows(); |
108 | 108 | |
109 | 109 | return $out; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php namespace SimpleTab; |
2 | 2 | |
3 | -require_once(MODX_BASE_PATH . 'assets/lib/MODxAPI/autoTable.abstract.php'); |
|
4 | -require_once(MODX_BASE_PATH . 'assets/lib/Helpers/FS.php'); |
|
5 | -require_once(MODX_BASE_PATH . 'assets/lib/Helpers/PHPThumb.php'); |
|
3 | +require_once(MODX_BASE_PATH.'assets/lib/MODxAPI/autoTable.abstract.php'); |
|
4 | +require_once(MODX_BASE_PATH.'assets/lib/Helpers/FS.php'); |
|
5 | +require_once(MODX_BASE_PATH.'assets/lib/Helpers/PHPThumb.php'); |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Class dataTable |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $rows = $this->query("SELECT MIN(`{$this->indexName}`) FROM {$table} WHERE `{$this->pkName}` IN ({$ids})"); |
60 | 60 | $index = $this->modx->db->getValue($rows); |
61 | 61 | $index = $index - 1; |
62 | - $this->query("SET @index := " . $index); |
|
62 | + $this->query("SET @index := ".$index); |
|
63 | 63 | $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->indexName}`>{$index} AND `{$this->rfName}`={$rid} AND `{$this->pkName}` NOT IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
64 | 64 | $out = $this->modx->db->getAffectedRows(); |
65 | 65 | |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | $cnt = count($ids); |
95 | 95 | $ids = implode(',', $ids); |
96 | 96 | if ($dir == 'top') { |
97 | - $this->query("SET @index := " . ($index - $cnt - 1)); |
|
97 | + $this->query("SET @index := ".($index - $cnt - 1)); |
|
98 | 98 | $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
99 | 99 | $this->query("SET @index := -1"); |
100 | 100 | } else { |
101 | 101 | $this->query("SET @index := -1"); |
102 | 102 | $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` IN ({$ids})) ORDER BY `{$this->indexName}` ASC"); |
103 | - $this->query("SET @index := " . ($cnt - 1)); |
|
103 | + $this->query("SET @index := ".($cnt - 1)); |
|
104 | 104 | } |
105 | 105 | $this->query("UPDATE {$table} SET `{$this->indexName}` = (@index := @index + 1) WHERE (`{$this->pkName}` NOT IN ({$ids})) AND `{$this->rfName}` = {$rid} ORDER BY `{$this->indexName}` ASC"); |
106 | 106 | $out = $this->modx->db->getAffectedRows(); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return; |
120 | 120 | } |
121 | 121 | if ($this->fs->checkFile($url)) { |
122 | - unlink(MODX_BASE_PATH . $url); |
|
122 | + unlink(MODX_BASE_PATH.$url); |
|
123 | 123 | } |
124 | 124 | $dir = $this->fs->takeFileDir($url); |
125 | 125 | $iterator = new \FilesystemIterator($dir); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return; |
131 | 131 | } |
132 | 132 | $thumbsCache = \APIhelpers::getkey($this->params, 'thumbsCache', $this->thumbsCache); |
133 | - $thumb = $thumbsCache . $url; |
|
133 | + $thumb = $thumbsCache.$url; |
|
134 | 134 | if ($this->fs->checkFile($thumb)) { |
135 | 135 | $this->deleteThumb($thumb, true); |
136 | 136 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $filename = $this->fs->takeFileName($name); |
184 | 184 | $ext = $this->fs->takeFileExt($name); |
185 | 185 | |
186 | - return $this->modx->stripAlias($filename) . '.' . $ext; |
|
186 | + return $this->modx->stripAlias($filename).'.'.$ext; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -196,12 +196,12 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function reorder($source, $target, $point, $rid, $orderDir) |
198 | 198 | { |
199 | - $rid = (int)$rid; |
|
199 | + $rid = (int) $rid; |
|
200 | 200 | $point = strtolower($point); |
201 | 201 | $orderDir = strtolower($orderDir); |
202 | - $sourceIndex = (int)$source[$this->indexName]; |
|
203 | - $targetIndex = (int)$target[$this->indexName]; |
|
204 | - $sourceId = (int)$source[$this->pkName]; |
|
202 | + $sourceIndex = (int) $source[$this->indexName]; |
|
203 | + $targetIndex = (int) $target[$this->indexName]; |
|
204 | + $sourceId = (int) $source[$this->pkName]; |
|
205 | 205 | $table = $this->makeTable($this->table); |
206 | 206 | $rows = 0; |
207 | 207 | /* more refactoring needed */ |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | return false; |
271 | 271 | } |
272 | 272 | $thumb = new \Helpers\PHPThumb(); |
273 | - $inputFile = MODX_BASE_PATH . $this->fs->relativePath($url); |
|
274 | - $outputFile = MODX_BASE_PATH . $this->fs->relativePath($folder) . '/' . $this->fs->relativePath($url); |
|
273 | + $inputFile = MODX_BASE_PATH.$this->fs->relativePath($url); |
|
274 | + $outputFile = MODX_BASE_PATH.$this->fs->relativePath($folder).'/'.$this->fs->relativePath($url); |
|
275 | 275 | $dir = $this->fs->takeFileDir($outputFile); |
276 | 276 | $this->fs->makeDir($dir, $this->modx->config['new_folder_permissions']); |
277 | 277 | if ($thumb->create($inputFile, $outputFile, $options)) { |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | self::$reserved = array_keys($reservedMap); |
758 | 758 | |
759 | 759 | // Set up regular expressions |
760 | - self::$regex_boundaries = '(' . implode('|', |
|
761 | - array_map(array(__CLASS__, 'quote_regex'), self::$boundaries)) . ')'; |
|
762 | - self::$regex_reserved = '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved)) . ')'; |
|
760 | + self::$regex_boundaries = '('.implode('|', |
|
761 | + array_map(array(__CLASS__, 'quote_regex'), self::$boundaries)).')'; |
|
762 | + self::$regex_reserved = '('.implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved)).')'; |
|
763 | 763 | self::$regex_reserved_toplevel = str_replace(' ', '\\s+', |
764 | - '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved_toplevel)) . ')'); |
|
764 | + '('.implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved_toplevel)).')'); |
|
765 | 765 | self::$regex_reserved_newline = str_replace(' ', '\\s+', |
766 | - '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved_newline)) . ')'); |
|
766 | + '('.implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$reserved_newline)).')'); |
|
767 | 767 | |
768 | - self::$regex_function = '(' . implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$functions)) . ')'; |
|
768 | + self::$regex_function = '('.implode('|', array_map(array(__CLASS__, 'quote_regex'), self::$functions)).')'; |
|
769 | 769 | |
770 | 770 | self::$init = true; |
771 | 771 | } |
@@ -829,10 +829,10 @@ discard block |
||
829 | 829 | |
830 | 830 | // If the variable name is quoted |
831 | 831 | if ($string[1] === '"' || $string[1] === '\'' || $string[1] === '`') { |
832 | - $ret[self::TOKEN_VALUE] = $string[0] . self::getQuotedString(substr($string, 1)); |
|
832 | + $ret[self::TOKEN_VALUE] = $string[0].self::getQuotedString(substr($string, 1)); |
|
833 | 833 | } // Non-quoted variable name |
834 | 834 | else { |
835 | - preg_match('/^(' . $string[0] . '[a-zA-Z0-9\._\$]+)/', $string, $matches); |
|
835 | + preg_match('/^('.$string[0].'[a-zA-Z0-9\._\$]+)/', $string, $matches); |
|
836 | 836 | if (!empty($matches)) { |
837 | 837 | $ret[self::TOKEN_VALUE] = $matches[1]; |
838 | 838 | } |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | } |
845 | 845 | |
846 | 846 | // Number (decimal, binary, or hex) |
847 | - if (preg_match('/^([0-9]+(\.[0-9]+)?|0x[0-9a-fA-F]+|0b[01]+)($|\s|"\'`|' . self::$regex_boundaries . ')/', |
|
847 | + if (preg_match('/^([0-9]+(\.[0-9]+)?|0x[0-9a-fA-F]+|0b[01]+)($|\s|"\'`|'.self::$regex_boundaries.')/', |
|
848 | 848 | $string, $matches)) { |
849 | 849 | return array( |
850 | 850 | self::TOKEN_VALUE => $matches[1], |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | } |
854 | 854 | |
855 | 855 | // Boundary Character (punctuation and symbols) |
856 | - if (preg_match('/^(' . self::$regex_boundaries . ')/', $string, $matches)) { |
|
856 | + if (preg_match('/^('.self::$regex_boundaries.')/', $string, $matches)) { |
|
857 | 857 | return array( |
858 | 858 | self::TOKEN_VALUE => $matches[1], |
859 | 859 | self::TOKEN_TYPE => self::TOKEN_TYPE_BOUNDARY |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | if (!$previous || !isset($previous[self::TOKEN_VALUE]) || $previous[self::TOKEN_VALUE] !== '.') { |
866 | 866 | $upper = strtoupper($string); |
867 | 867 | // Top Level Reserved Word |
868 | - if (preg_match('/^(' . self::$regex_reserved_toplevel . ')($|\s|' . self::$regex_boundaries . ')/', $upper, |
|
868 | + if (preg_match('/^('.self::$regex_reserved_toplevel.')($|\s|'.self::$regex_boundaries.')/', $upper, |
|
869 | 869 | $matches)) { |
870 | 870 | return array( |
871 | 871 | self::TOKEN_TYPE => self::TOKEN_TYPE_RESERVED_TOPLEVEL, |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | ); |
874 | 874 | } |
875 | 875 | // Newline Reserved Word |
876 | - if (preg_match('/^(' . self::$regex_reserved_newline . ')($|\s|' . self::$regex_boundaries . ')/', $upper, |
|
876 | + if (preg_match('/^('.self::$regex_reserved_newline.')($|\s|'.self::$regex_boundaries.')/', $upper, |
|
877 | 877 | $matches)) { |
878 | 878 | return array( |
879 | 879 | self::TOKEN_TYPE => self::TOKEN_TYPE_RESERVED_NEWLINE, |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | ); |
882 | 882 | } |
883 | 883 | // Other Reserved Word |
884 | - if (preg_match('/^(' . self::$regex_reserved . ')($|\s|' . self::$regex_boundaries . ')/', $upper, |
|
884 | + if (preg_match('/^('.self::$regex_reserved.')($|\s|'.self::$regex_boundaries.')/', $upper, |
|
885 | 885 | $matches)) { |
886 | 886 | return array( |
887 | 887 | self::TOKEN_TYPE => self::TOKEN_TYPE_RESERVED, |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | // this makes it so "count(" is considered a function, but "count" alone is not |
895 | 895 | $upper = strtoupper($string); |
896 | 896 | // function |
897 | - if (preg_match('/^(' . self::$regex_function . '[(]|\s|[)])/', $upper, $matches)) { |
|
897 | + if (preg_match('/^('.self::$regex_function.'[(]|\s|[)])/', $upper, $matches)) { |
|
898 | 898 | return array( |
899 | 899 | self::TOKEN_TYPE => self::TOKEN_TYPE_RESERVED, |
900 | 900 | self::TOKEN_VALUE => substr($string, 0, strlen($matches[1]) - 1) |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | } |
903 | 903 | |
904 | 904 | // Non reserved word |
905 | - preg_match('/^(.*?)($|\s|["\'`]|' . self::$regex_boundaries . ')/', $string, $matches); |
|
905 | + preg_match('/^(.*?)($|\s|["\'`]|'.self::$regex_boundaries.')/', $string, $matches); |
|
906 | 906 | |
907 | 907 | return array( |
908 | 908 | self::TOKEN_VALUE => $matches[1], |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | |
1064 | 1064 | // If we need a new line before the token |
1065 | 1065 | if ($newline) { |
1066 | - $return .= "\n" . str_repeat($tab, $indent_level); |
|
1066 | + $return .= "\n".str_repeat($tab, $indent_level); |
|
1067 | 1067 | $newline = false; |
1068 | 1068 | $added_newline = true; |
1069 | 1069 | } else { |
@@ -1074,8 +1074,8 @@ discard block |
||
1074 | 1074 | if ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_COMMENT || $token[self::TOKEN_TYPE] === self::TOKEN_TYPE_BLOCK_COMMENT) { |
1075 | 1075 | if ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_BLOCK_COMMENT) { |
1076 | 1076 | $indent = str_repeat($tab, $indent_level); |
1077 | - $return .= "\n" . $indent; |
|
1078 | - $highlighted = str_replace("\n", "\n" . $indent, $highlighted); |
|
1077 | + $return .= "\n".$indent; |
|
1078 | + $highlighted = str_replace("\n", "\n".$indent, $highlighted); |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | $return .= $highlighted; |
@@ -1091,12 +1091,12 @@ discard block |
||
1091 | 1091 | if ($inline_indented) { |
1092 | 1092 | array_shift($indent_types); |
1093 | 1093 | $indent_level--; |
1094 | - $return .= "\n" . str_repeat($tab, $indent_level); |
|
1094 | + $return .= "\n".str_repeat($tab, $indent_level); |
|
1095 | 1095 | } |
1096 | 1096 | |
1097 | 1097 | $inline_parentheses = false; |
1098 | 1098 | |
1099 | - $return .= $highlighted . ' '; |
|
1099 | + $return .= $highlighted.' '; |
|
1100 | 1100 | continue; |
1101 | 1101 | } |
1102 | 1102 | |
@@ -1183,14 +1183,14 @@ discard block |
||
1183 | 1183 | $indent_level = 0; |
1184 | 1184 | |
1185 | 1185 | if ($highlight) { |
1186 | - $return .= "\n" . self::highlightError($token[self::TOKEN_VALUE]); |
|
1186 | + $return .= "\n".self::highlightError($token[self::TOKEN_VALUE]); |
|
1187 | 1187 | continue; |
1188 | 1188 | } |
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | // Add a newline before the closing parentheses (if not already added) |
1192 | 1192 | if (!$added_newline) { |
1193 | - $return .= "\n" . str_repeat($tab, $indent_level); |
|
1193 | + $return .= "\n".str_repeat($tab, $indent_level); |
|
1194 | 1194 | } |
1195 | 1195 | } // Top level reserved words start a new line and increase the special indent level |
1196 | 1196 | elseif ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_RESERVED_TOPLEVEL) { |
@@ -1207,10 +1207,10 @@ discard block |
||
1207 | 1207 | $newline = true; |
1208 | 1208 | // Add a newline before the top level reserved word (if not already added) |
1209 | 1209 | if (!$added_newline) { |
1210 | - $return .= "\n" . str_repeat($tab, $indent_level); |
|
1210 | + $return .= "\n".str_repeat($tab, $indent_level); |
|
1211 | 1211 | } // If we already added a newline, redo the indentation since it may be different now |
1212 | 1212 | else { |
1213 | - $return = rtrim($return, $tab) . str_repeat($tab, $indent_level); |
|
1213 | + $return = rtrim($return, $tab).str_repeat($tab, $indent_level); |
|
1214 | 1214 | } |
1215 | 1215 | |
1216 | 1216 | // If the token may have extra whitespace |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | elseif ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_RESERVED_NEWLINE) { |
1241 | 1241 | // Add a newline before the reserved word (if not already added) |
1242 | 1242 | if (!$added_newline) { |
1243 | - $return .= "\n" . str_repeat($tab, $indent_level); |
|
1243 | + $return .= "\n".str_repeat($tab, $indent_level); |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | // If the token may have extra whitespace |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | $return = rtrim($return, ' '); |
1264 | 1264 | } |
1265 | 1265 | |
1266 | - $return .= $highlighted . ' '; |
|
1266 | + $return .= $highlighted.' '; |
|
1267 | 1267 | |
1268 | 1268 | // If the token shouldn't have a space after it |
1269 | 1269 | if ($token[self::TOKEN_VALUE] === '(' || $token[self::TOKEN_VALUE] === '.') { |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | |
1282 | 1282 | // If there are unmatched parentheses |
1283 | 1283 | if ($highlight && array_search('block', $indent_types) !== false) { |
1284 | - $return .= "\n" . self::highlightError("WARNING: unclosed parentheses or section"); |
|
1284 | + $return .= "\n".self::highlightError("WARNING: unclosed parentheses or section"); |
|
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | // Replace tab characters with the configuration tab character |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | // If this is a query separator |
1335 | 1335 | if ($token[self::TOKEN_VALUE] === ';') { |
1336 | 1336 | if (!$empty) { |
1337 | - $queries[] = $current_query . ';'; |
|
1337 | + $queries[] = $current_query.';'; |
|
1338 | 1338 | } |
1339 | 1339 | $current_query = ''; |
1340 | 1340 | $empty = true; |
@@ -1480,9 +1480,9 @@ discard block |
||
1480 | 1480 | protected static function highlightQuote($value) |
1481 | 1481 | { |
1482 | 1482 | if (self::is_cli()) { |
1483 | - return self::$cli_quote . $value . "\x1b[0m"; |
|
1483 | + return self::$cli_quote.$value."\x1b[0m"; |
|
1484 | 1484 | } else { |
1485 | - return '<span ' . self::$quote_attributes . '>' . $value . '</span>'; |
|
1485 | + return '<span '.self::$quote_attributes.'>'.$value.'</span>'; |
|
1486 | 1486 | } |
1487 | 1487 | } |
1488 | 1488 | |
@@ -1496,9 +1496,9 @@ discard block |
||
1496 | 1496 | protected static function highlightBacktickQuote($value) |
1497 | 1497 | { |
1498 | 1498 | if (self::is_cli()) { |
1499 | - return self::$cli_backtick_quote . $value . "\x1b[0m"; |
|
1499 | + return self::$cli_backtick_quote.$value."\x1b[0m"; |
|
1500 | 1500 | } else { |
1501 | - return '<span ' . self::$backtick_quote_attributes . '>' . $value . '</span>'; |
|
1501 | + return '<span '.self::$backtick_quote_attributes.'>'.$value.'</span>'; |
|
1502 | 1502 | } |
1503 | 1503 | } |
1504 | 1504 | |
@@ -1512,9 +1512,9 @@ discard block |
||
1512 | 1512 | protected static function highlightReservedWord($value) |
1513 | 1513 | { |
1514 | 1514 | if (self::is_cli()) { |
1515 | - return self::$cli_reserved . $value . "\x1b[0m"; |
|
1515 | + return self::$cli_reserved.$value."\x1b[0m"; |
|
1516 | 1516 | } else { |
1517 | - return '<span ' . self::$reserved_attributes . '>' . $value . '</span>'; |
|
1517 | + return '<span '.self::$reserved_attributes.'>'.$value.'</span>'; |
|
1518 | 1518 | } |
1519 | 1519 | } |
1520 | 1520 | |
@@ -1532,9 +1532,9 @@ discard block |
||
1532 | 1532 | } |
1533 | 1533 | |
1534 | 1534 | if (self::is_cli()) { |
1535 | - return self::$cli_boundary . $value . "\x1b[0m"; |
|
1535 | + return self::$cli_boundary.$value."\x1b[0m"; |
|
1536 | 1536 | } else { |
1537 | - return '<span ' . self::$boundary_attributes . '>' . $value . '</span>'; |
|
1537 | + return '<span '.self::$boundary_attributes.'>'.$value.'</span>'; |
|
1538 | 1538 | } |
1539 | 1539 | } |
1540 | 1540 | |
@@ -1548,9 +1548,9 @@ discard block |
||
1548 | 1548 | protected static function highlightNumber($value) |
1549 | 1549 | { |
1550 | 1550 | if (self::is_cli()) { |
1551 | - return self::$cli_number . $value . "\x1b[0m"; |
|
1551 | + return self::$cli_number.$value."\x1b[0m"; |
|
1552 | 1552 | } else { |
1553 | - return '<span ' . self::$number_attributes . '>' . $value . '</span>'; |
|
1553 | + return '<span '.self::$number_attributes.'>'.$value.'</span>'; |
|
1554 | 1554 | } |
1555 | 1555 | } |
1556 | 1556 | |
@@ -1564,9 +1564,9 @@ discard block |
||
1564 | 1564 | protected static function highlightError($value) |
1565 | 1565 | { |
1566 | 1566 | if (self::is_cli()) { |
1567 | - return self::$cli_error . $value . "\x1b[0m"; |
|
1567 | + return self::$cli_error.$value."\x1b[0m"; |
|
1568 | 1568 | } else { |
1569 | - return '<span ' . self::$error_attributes . '>' . $value . '</span>'; |
|
1569 | + return '<span '.self::$error_attributes.'>'.$value.'</span>'; |
|
1570 | 1570 | } |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1580,9 +1580,9 @@ discard block |
||
1580 | 1580 | protected static function highlightComment($value) |
1581 | 1581 | { |
1582 | 1582 | if (self::is_cli()) { |
1583 | - return self::$cli_comment . $value . "\x1b[0m"; |
|
1583 | + return self::$cli_comment.$value."\x1b[0m"; |
|
1584 | 1584 | } else { |
1585 | - return '<span ' . self::$comment_attributes . '>' . $value . '</span>'; |
|
1585 | + return '<span '.self::$comment_attributes.'>'.$value.'</span>'; |
|
1586 | 1586 | } |
1587 | 1587 | } |
1588 | 1588 | |
@@ -1596,9 +1596,9 @@ discard block |
||
1596 | 1596 | protected static function highlightWord($value) |
1597 | 1597 | { |
1598 | 1598 | if (self::is_cli()) { |
1599 | - return self::$cli_word . $value . "\x1b[0m"; |
|
1599 | + return self::$cli_word.$value."\x1b[0m"; |
|
1600 | 1600 | } else { |
1601 | - return '<span ' . self::$word_attributes . '>' . $value . '</span>'; |
|
1601 | + return '<span '.self::$word_attributes.'>'.$value.'</span>'; |
|
1602 | 1602 | } |
1603 | 1603 | } |
1604 | 1604 | |
@@ -1612,9 +1612,9 @@ discard block |
||
1612 | 1612 | protected static function highlightVariable($value) |
1613 | 1613 | { |
1614 | 1614 | if (self::is_cli()) { |
1615 | - return self::$cli_variable . $value . "\x1b[0m"; |
|
1615 | + return self::$cli_variable.$value."\x1b[0m"; |
|
1616 | 1616 | } else { |
1617 | - return '<span ' . self::$variable_attributes . '>' . $value . '</span>'; |
|
1617 | + return '<span '.self::$variable_attributes.'>'.$value.'</span>'; |
|
1618 | 1618 | } |
1619 | 1619 | } |
1620 | 1620 | |
@@ -1640,14 +1640,14 @@ discard block |
||
1640 | 1640 | private static function output($string) |
1641 | 1641 | { |
1642 | 1642 | if (self::is_cli()) { |
1643 | - return $string . "\n"; |
|
1643 | + return $string."\n"; |
|
1644 | 1644 | } else { |
1645 | 1645 | $string = trim($string); |
1646 | 1646 | if (!self::$use_pre) { |
1647 | 1647 | return $string; |
1648 | 1648 | } |
1649 | 1649 | |
1650 | - return '<pre ' . self::$pre_attributes . '>' . $string . '</pre>'; |
|
1650 | + return '<pre '.self::$pre_attributes.'>'.$string.'</pre>'; |
|
1651 | 1651 | } |
1652 | 1652 | } |
1653 | 1653 |
@@ -9,44 +9,44 @@ |
||
9 | 9 | * @date 31.07.2013 |
10 | 10 | * @version 1.0.2 |
11 | 11 | */ |
12 | -if (! defined('MODX_BASE_PATH')) { |
|
12 | +if (!defined('MODX_BASE_PATH')) { |
|
13 | 13 | die('HACK?'); |
14 | 14 | } |
15 | 15 | |
16 | -$summary = MODX_BASE_PATH . "assets/lib/class.summary.php"; |
|
16 | +$summary = MODX_BASE_PATH."assets/lib/class.summary.php"; |
|
17 | 17 | |
18 | -if (file_exists($summary) && ! class_exists('SummaryText', false)) { |
|
18 | +if (file_exists($summary) && !class_exists('SummaryText', false)) { |
|
19 | 19 | include_once($summary); |
20 | 20 | } |
21 | 21 | |
22 | 22 | if (class_exists('SummaryText', false)) { |
23 | - $action = ( ! empty($action) && is_scalar($action)) ? $action : array(); |
|
23 | + $action = (!empty($action) && is_scalar($action)) ? $action : array(); |
|
24 | 24 | if (is_array($action)) { |
25 | 25 | if (empty($tags)) { |
26 | 26 | $action[] = 'notags'; |
27 | 27 | } |
28 | 28 | |
29 | - if (! empty($noparser)) { |
|
29 | + if (!empty($noparser)) { |
|
30 | 30 | $action[] = 'noparser'; |
31 | 31 | } |
32 | 32 | |
33 | - if (! empty($len)) { |
|
34 | - $action[] = 'len' . ((int)$len > 0 ? ':' . (int)$len : ''); |
|
33 | + if (!empty($len)) { |
|
34 | + $action[] = 'len'.((int) $len > 0 ? ':'.(int) $len : ''); |
|
35 | 35 | } |
36 | - if (! empty($chars)) { |
|
37 | - $action[] = 'chars' . ((int)$chars > 0 ? ':' . (int)$chars : ''); |
|
36 | + if (!empty($chars)) { |
|
37 | + $action[] = 'chars'.((int) $chars > 0 ? ':'.(int) $chars : ''); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $action = implode(",", $action); |
41 | 41 | } |
42 | 42 | |
43 | - if (! isset($dot)) { |
|
43 | + if (!isset($dot)) { |
|
44 | 44 | $dot = 0; |
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | $summary = new SummaryText($text, $action); |
49 | - if (! empty($cut)) { |
|
49 | + if (!empty($cut)) { |
|
50 | 50 | $summary->setCut($cut); |
51 | 51 | } |
52 | 52 | $out = $summary->run($dot); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -include_once(MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php'); |
|
2 | +include_once(MODX_BASE_PATH.'assets/lib/APIHelpers.class.php'); |
|
3 | 3 | if (!function_exists('validateMonth')) { |
4 | 4 | |
5 | 5 | /** |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | if (is_string($val)) { |
13 | 13 | $val = explode("-", $val, 3); |
14 | 14 | $flag = (count($val) == 3 && is_array($val) && strlen($val[2]) == 2 && strlen($val[1]) == 2 && strlen($val[0]) == 4); //Валидация содержимого массива |
15 | - $flag = ($flag && (int)$val[2] > 0 && (int)$val[2] <= 31); //Валидация дня |
|
16 | - $flag = ($flag && (int)$val[1] > 0 && (int)$val[1] <= 12); //Валидация месяца |
|
17 | - $flag = ($flag && (int)$val[0] > 1900 && (int)$val[0] <= 2100); //Валидация года |
|
15 | + $flag = ($flag && (int) $val[2] > 0 && (int) $val[2] <= 31); //Валидация дня |
|
16 | + $flag = ($flag && (int) $val[1] > 0 && (int) $val[1] <= 12); //Валидация месяца |
|
17 | + $flag = ($flag && (int) $val[0] > 1900 && (int) $val[0] <= 2100); //Валидация года |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | return $flag; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $url = explode("?", $url, 2); |
44 | 44 | $url = $url[0]; |
45 | 45 | if (!empty($q)) { |
46 | - $url .= "?" . $q; |
|
46 | + $url .= "?".$q; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $out = $beforePage = $afterPage = ''; |
58 | 58 | |
59 | -$display = (int)APIHelpers::getkey($params, 'display', '10'); |
|
59 | +$display = (int) APIHelpers::getkey($params, 'display', '10'); |
|
60 | 60 | |
61 | 61 | $dateSource = APIHelpers::getkey($params, 'dateSource', 'content'); |
62 | 62 | $dateField = APIHelpers::getkey($params, 'dateField', 'if(pub_date=0,createdon,pub_date)'); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $currentDay = $tmp; |
68 | 68 | } |
69 | 69 | |
70 | -$start = (int)APIHelpers::getkey($_GET, 'start', '0'); |
|
70 | +$start = (int) APIHelpers::getkey($_GET, 'start', '0'); |
|
71 | 71 | $elements = array( |
72 | 72 | 'offset' => $start |
73 | 73 | ); |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | if ($dateSource == 'tv') { |
82 | 82 | $params['tvSortType'] = 'TVDATETIME'; |
83 | 83 | $query = array( |
84 | - 'after' => "STR_TO_DATE(`dltv_" . $dateField . "_1`.`value`,'%d-%m-%Y %H:%i:%s') >= '" . $d . "'", |
|
85 | - 'before' => "STR_TO_DATE(`dltv_" . $dateField . "_1`.`value`,'%d-%m-%Y %H:%i:%s') < '" . $d . "'" |
|
84 | + 'after' => "STR_TO_DATE(`dltv_".$dateField."_1`.`value`,'%d-%m-%Y %H:%i:%s') >= '".$d."'", |
|
85 | + 'before' => "STR_TO_DATE(`dltv_".$dateField."_1`.`value`,'%d-%m-%Y %H:%i:%s') < '".$d."'" |
|
86 | 86 | ); |
87 | 87 | } else { |
88 | 88 | $query = array( |
89 | - 'after' => "FROM_UNIXTIME(" . $dateField . ") >= '" . $d . "'", |
|
90 | - 'before' => "FROM_UNIXTIME(" . $dateField . ") < '" . $d . "'" |
|
89 | + 'after' => "FROM_UNIXTIME(".$dateField.") >= '".$d."'", |
|
90 | + 'before' => "FROM_UNIXTIME(".$dateField.") < '".$d."'" |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | $sort = array( |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $debug = $DLObj->getCFGDef('debug', 0); |
201 | 201 | if ($debug) { |
202 | 202 | if ($debug > 0) { |
203 | - $out = $DLObj->debug->showLog() . $out; |
|
203 | + $out = $DLObj->debug->showLog().$out; |
|
204 | 204 | } else { |
205 | 205 | $out .= $DLObj->debug->showLog(); |
206 | 206 | } |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | * &limitAfter=`3` |
11 | 11 | * ]] |
12 | 12 | */ |
13 | -include_once(MODX_BASE_PATH . 'assets/snippets/DocLister/lib/DLCollection.class.php'); |
|
14 | -include_once(MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php'); |
|
15 | -include_once(MODX_BASE_PATH . 'assets/snippets/DocLister/lib/DLReflect.class.php'); |
|
13 | +include_once(MODX_BASE_PATH.'assets/snippets/DocLister/lib/DLCollection.class.php'); |
|
14 | +include_once(MODX_BASE_PATH.'assets/lib/APIHelpers.class.php'); |
|
15 | +include_once(MODX_BASE_PATH.'assets/snippets/DocLister/lib/DLReflect.class.php'); |
|
16 | 16 | |
17 | 17 | $params = is_array($modx->event->params) ? $modx->event->params : array(); |
18 | 18 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | */ |
54 | 54 | $activeReflectTPL = APIHelpers::getkey($params, 'activeReflectTPL', '@CODE: <li><span>[+title+]</span></li>'); |
55 | 55 | |
56 | -list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function () { |
|
56 | +list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function(){ |
|
57 | 57 | return array('m-Y', '%m-%Y', array('DLReflect', 'validateMonth')); |
58 | -}, function () { |
|
58 | +}, function(){ |
|
59 | 59 | return array('Y', '%Y', array('DLReflect', 'validateYear')); |
60 | 60 | }); |
61 | 61 | $tmp = $originalDate = date($dateFormat); |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | * Возможные значения: Любое число. 0 расценивается как все доступные месяцы |
146 | 146 | * Значение по умолчанию: 0 |
147 | 147 | */ |
148 | -$limitBefore = (int)APIHelpers::getkey($params, 'limitBefore', 0); |
|
148 | +$limitBefore = (int) APIHelpers::getkey($params, 'limitBefore', 0); |
|
149 | 149 | /** |
150 | 150 | * limitAfter |
151 | 151 | * Число элементов после месяца указанного в activeMonth параметре |
152 | 152 | * Возможные значения: Любое число. 0 расценивается как все доступные месяцы |
153 | 153 | * Значение по умолчанию: 0 |
154 | 154 | */ |
155 | -$limitAfter = (int)APIHelpers::getkey($params, 'limitAfter', 0); |
|
155 | +$limitAfter = (int) APIHelpers::getkey($params, 'limitAfter', 0); |
|
156 | 156 | $display = $limitBefore + 1 + $limitAfter; |
157 | 157 | |
158 | 158 | $out = ''; |
@@ -164,12 +164,12 @@ discard block |
||
164 | 164 | $DLParams['saveDLObject'] = 'DLAPI'; |
165 | 165 | if ($reflectSource === 'tv') { |
166 | 166 | $DLParams['tvSortType'] = 'TVDATETIME'; |
167 | - $query = 'STR_TO_DATE(`dltv_' . $reflectField . "_1`.`value`,'%d-%m-%Y %H:%i:%s')"; |
|
167 | + $query = 'STR_TO_DATE(`dltv_'.$reflectField."_1`.`value`,'%d-%m-%Y %H:%i:%s')"; |
|
168 | 168 | } else { |
169 | 169 | $DLParams['orderBy'] = $reflectField; |
170 | - $query = 'FROM_UNIXTIME(' . $reflectField . ')'; |
|
170 | + $query = 'FROM_UNIXTIME('.$reflectField.')'; |
|
171 | 171 | } |
172 | -$DLParams['selectFields'] = 'DATE_FORMAT(' . $query . ", '" . $sqlDateFormat . "') as `id`"; |
|
172 | +$DLParams['selectFields'] = 'DATE_FORMAT('.$query.", '".$sqlDateFormat."') as `id`"; |
|
173 | 173 | $totalReflects = $modx->runSnippet('DocLister', $DLParams); |
174 | 174 | /** Получаем объект DocLister'a */ |
175 | 175 | $DLAPI = $modx->getPlaceholder('DLAPI'); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $totalReflects = array(); |
186 | 186 | } |
187 | 187 | $totalReflects = new DLCollection($modx, $totalReflects); |
188 | -$totalReflects = $totalReflects->filter(function ($el) { |
|
188 | +$totalReflects = $totalReflects->filter(function($el){ |
|
189 | 189 | return !empty($el['id']); |
190 | 190 | }); |
191 | 191 | /** Добавляем активную дату в коллекцию */ |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $totalReflects->add(array('id' => $originalCurrentReflect), $originalCurrentReflect); |
200 | 200 | } |
201 | 201 | /** Сортируем даты по возрастанию */ |
202 | -$totalReflects->sort(function ($a, $b) use ($dateFormat) { |
|
202 | +$totalReflects->sort(function($a, $b) use ($dateFormat) { |
|
203 | 203 | $aDate = DateTime::createFromFormat($dateFormat, $a['id']); |
204 | 204 | $bDate = DateTime::createFromFormat($dateFormat, $b['id']); |
205 | 205 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | })->reindex(); |
208 | 208 | |
209 | 209 | /** Разделяем коллекцию дат на 2 части (до текущей даты и после) */ |
210 | -list($lReflect, $rReflect) = $totalReflects->partition(function ( |
|
210 | +list($lReflect, $rReflect) = $totalReflects->partition(function( |
|
211 | 211 | $key, |
212 | 212 | $val |
213 | 213 | ) use ( |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | $sortDir = APIHelpers::getkey($params, 'sortDir', 'ASC'); |
276 | 276 | /** Сортируем результатирующий список */ |
277 | -$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat) { |
|
277 | +$outReflects = $outReflects->sort(function($a, $b) use ($sortDir, $dateFormat) { |
|
278 | 278 | $aDate = DateTime::createFromFormat($dateFormat, $a); |
279 | 279 | $bDate = DateTime::createFromFormat($dateFormat, $b); |
280 | 280 | $out = false; |
@@ -294,15 +294,15 @@ discard block |
||
294 | 294 | foreach ($outReflects as $reflectItem) { |
295 | 295 | $tpl = (!is_null($activeReflect) && $activeReflect == $reflectItem) ? $activeReflectTPL : $reflectTPL; |
296 | 296 | |
297 | - $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI) { |
|
297 | + $data = DLReflect::switchReflect($reflectType, function() use ($reflectItem, $DLAPI) { |
|
298 | 298 | list($vMonth, $vYear) = explode('-', $reflectItem, 2); |
299 | 299 | |
300 | 300 | return array( |
301 | 301 | 'monthNum' => $vMonth, |
302 | - 'monthName' => $DLAPI->getMsg('months.' . (int)$vMonth), |
|
302 | + 'monthName' => $DLAPI->getMsg('months.'.(int) $vMonth), |
|
303 | 303 | 'year' => $vYear, |
304 | 304 | ); |
305 | - }, function () use ($reflectItem) { |
|
305 | + }, function() use ($reflectItem) { |
|
306 | 306 | return array( |
307 | 307 | 'year' => $reflectItem |
308 | 308 | ); |
@@ -334,4 +334,4 @@ discard block |
||
334 | 334 | $debug = ''; |
335 | 335 | } |
336 | 336 | |
337 | -return $debug . $out; |
|
337 | +return $debug.$out; |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | */ |
54 | 54 | $activeReflectTPL = APIHelpers::getkey($params, 'activeReflectTPL', '@CODE: <li><span>[+title+]</span></li>'); |
55 | 55 | |
56 | -list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function () { |
|
56 | +list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function (){ |
|
57 | 57 | return array('m-Y', '%m-%Y', array('DLReflect', 'validateMonth')); |
58 | -}, function () { |
|
58 | +}, function (){ |
|
59 | 59 | return array('Y', '%Y', array('DLReflect', 'validateYear')); |
60 | 60 | }); |
61 | 61 | $tmp = $originalDate = date($dateFormat); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $totalReflects = array(); |
186 | 186 | } |
187 | 187 | $totalReflects = new DLCollection($modx, $totalReflects); |
188 | -$totalReflects = $totalReflects->filter(function ($el) { |
|
188 | +$totalReflects = $totalReflects->filter(function ($el){ |
|
189 | 189 | return !empty($el['id']); |
190 | 190 | }); |
191 | 191 | /** Добавляем активную дату в коллекцию */ |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $totalReflects->add(array('id' => $originalCurrentReflect), $originalCurrentReflect); |
200 | 200 | } |
201 | 201 | /** Сортируем даты по возрастанию */ |
202 | -$totalReflects->sort(function ($a, $b) use ($dateFormat) { |
|
202 | +$totalReflects->sort(function ($a, $b) use ($dateFormat){ |
|
203 | 203 | $aDate = DateTime::createFromFormat($dateFormat, $a['id']); |
204 | 204 | $bDate = DateTime::createFromFormat($dateFormat, $b['id']); |
205 | 205 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $activeReflect, |
215 | 215 | $originalDate, |
216 | 216 | $dateFormat |
217 | -) { |
|
217 | +){ |
|
218 | 218 | $aDate = DateTime::createFromFormat($dateFormat, $val['id']); |
219 | 219 | if ($activeReflect === null) { |
220 | 220 | $activeReflect = $originalDate; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | $sortDir = APIHelpers::getkey($params, 'sortDir', 'ASC'); |
276 | 276 | /** Сортируем результатирующий список */ |
277 | -$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat) { |
|
277 | +$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat){ |
|
278 | 278 | $aDate = DateTime::createFromFormat($dateFormat, $a); |
279 | 279 | $bDate = DateTime::createFromFormat($dateFormat, $b); |
280 | 280 | $out = false; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | foreach ($outReflects as $reflectItem) { |
295 | 295 | $tpl = (!is_null($activeReflect) && $activeReflect == $reflectItem) ? $activeReflectTPL : $reflectTPL; |
296 | 296 | |
297 | - $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI) { |
|
297 | + $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI){ |
|
298 | 298 | list($vMonth, $vYear) = explode('-', $reflectItem, 2); |
299 | 299 | |
300 | 300 | return array( |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | 'monthName' => $DLAPI->getMsg('months.' . (int)$vMonth), |
303 | 303 | 'year' => $vYear, |
304 | 304 | ); |
305 | - }, function () use ($reflectItem) { |
|
305 | + }, function () use ($reflectItem){ |
|
306 | 306 | return array( |
307 | 307 | 'year' => $reflectItem |
308 | 308 | ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! defined('MODX_BASE_PATH')) { |
|
2 | +if (!defined('MODX_BASE_PATH')) { |
|
3 | 3 | die('HACK???'); |
4 | 4 | } |
5 | 5 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $children = is_array($children) ? $children : array(); |
16 | 16 | $self = $prev = $next = null; |
17 | 17 | foreach ($children as $key => $data) { |
18 | - if (! empty($self)) { |
|
18 | + if (!empty($self)) { |
|
19 | 19 | $next = $key; |
20 | 20 | break; |
21 | 21 | } |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | } |
11 | 11 | $_time = microtime(true); |
12 | 12 | $out = null; |
13 | -$DLDir = MODX_BASE_PATH . 'assets/snippets/DocLister/'; |
|
13 | +$DLDir = MODX_BASE_PATH.'assets/snippets/DocLister/'; |
|
14 | 14 | |
15 | -require_once($DLDir . "core/DocLister.abstract.php"); |
|
16 | -require_once($DLDir . "core/extDocLister.abstract.php"); |
|
17 | -require_once($DLDir . "core/filterDocLister.abstract.php"); |
|
15 | +require_once($DLDir."core/DocLister.abstract.php"); |
|
16 | +require_once($DLDir."core/extDocLister.abstract.php"); |
|
17 | +require_once($DLDir."core/filterDocLister.abstract.php"); |
|
18 | 18 | |
19 | 19 | if (isset($controller)) { |
20 | 20 | preg_match('/^(\w+)$/iu', $controller, $controller); |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | } else { |
23 | 23 | $controller = "site_content"; |
24 | 24 | } |
25 | -$class = $controller . "DocLister"; |
|
25 | +$class = $controller."DocLister"; |
|
26 | 26 | |
27 | -$dir = isset($dir) ? MODX_BASE_PATH . $dir : $DLDir . "core/controller/"; |
|
28 | -$path = $dir . $controller . '.php'; |
|
27 | +$dir = isset($dir) ? MODX_BASE_PATH . $dir : $DLDir."core/controller/"; |
|
28 | +$path = $dir.$controller.'.php'; |
|
29 | 29 | if ($class !== 'DocLister' && file_exists($path) && !class_exists($class, false)) { |
30 | 30 | require_once($path); |
31 | 31 | } |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | if ($DocLister->getCFGDef('debug', 0)) { |
47 | 47 | if ($DocLister->getCFGDef("api", 0)) { |
48 | - $modx->setPlaceholder($DocLister->getCFGDef("sysKey", "dl") . ".debug", $debug); |
|
48 | + $modx->setPlaceholder($DocLister->getCFGDef("sysKey", "dl").".debug", $debug); |
|
49 | 49 | } else { |
50 | - $out = ($DocLister->getCFGDef('debug') > 0) ? $debug . $out : $out . $debug; |
|
50 | + $out = ($DocLister->getCFGDef('debug') > 0) ? $debug.$out : $out.$debug; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $_out = ''; |
12 | 12 | |
13 | 13 | if (isset($modx->event->params['config'])) { |
14 | - require_once MODX_BASE_PATH . 'assets/lib/Helpers/Config.php'; |
|
14 | + require_once MODX_BASE_PATH.'assets/lib/Helpers/Config.php'; |
|
15 | 15 | |
16 | 16 | $helper = new \Helpers\Config($modx->event->params); |
17 | 17 | $helper->setPath('/assets/snippets/DocLister/'); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | $_parents = array(); |
25 | -$hideMain = (!isset($hideMain) || (int)$hideMain == 0); |
|
25 | +$hideMain = (!isset($hideMain) || (int) $hideMain == 0); |
|
26 | 26 | if ($hideMain) { |
27 | 27 | $_parents[] = $modx->config['site_start']; |
28 | 28 | } |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | -if (isset($showCurrent) && (int)$showCurrent > 0) { |
|
38 | +if (isset($showCurrent) && (int) $showCurrent > 0) { |
|
39 | 39 | $_parents[] = $id; |
40 | 40 | } |
41 | -if (!empty($_parents) && count($_parents) >= (empty($minDocs) ? 0 : (int)$minDocs)) { |
|
41 | +if (!empty($_parents) && count($_parents) >= (empty($minDocs) ? 0 : (int) $minDocs)) { |
|
42 | 42 | $_options = array_merge( |
43 | 43 | array( |
44 | 44 | 'config' => 'crumbs:core' |