@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -include_once(MODX_BASE_PATH . "assets/lib/Helpers/Collection.php"); |
|
2 | +include_once(MODX_BASE_PATH."assets/lib/Helpers/Collection.php"); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class DLCollection |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function build_sql_where($table_alias, $field, $operator, $value) |
129 | 129 | { |
130 | - $this->DocLister->debug->debug('Build SQL query for filters: ' . $this->DocLister->debug->dumpData(func_get_args()), |
|
130 | + $this->DocLister->debug->debug('Build SQL query for filters: '.$this->DocLister->debug->dumpData(func_get_args()), |
|
131 | 131 | 'buildQuery', 2); |
132 | 132 | $output = sqlHelper::tildeField($field, $table_alias); |
133 | 133 | |
@@ -135,28 +135,28 @@ discard block |
||
135 | 135 | case '=': |
136 | 136 | case 'eq': |
137 | 137 | case 'is': |
138 | - $output .= " = '" . $this->modx->db->escape($value) . "'"; |
|
138 | + $output .= " = '".$this->modx->db->escape($value)."'"; |
|
139 | 139 | break; |
140 | 140 | case '!=': |
141 | 141 | case 'no': |
142 | 142 | case 'isnot': |
143 | - $output .= " != '" . $this->modx->db->escape($value) . "'"; |
|
143 | + $output .= " != '".$this->modx->db->escape($value)."'"; |
|
144 | 144 | break; |
145 | 145 | case '>': |
146 | 146 | case 'gt': |
147 | - $output .= ' > ' . str_replace(',', '.', floatval($value)); |
|
147 | + $output .= ' > '.str_replace(',', '.', floatval($value)); |
|
148 | 148 | break; |
149 | 149 | case '<': |
150 | 150 | case 'lt': |
151 | - $output .= ' < ' . str_replace(',', '.', floatval($value)); |
|
151 | + $output .= ' < '.str_replace(',', '.', floatval($value)); |
|
152 | 152 | break; |
153 | 153 | case '<=': |
154 | 154 | case 'elt': |
155 | - $output .= ' <= ' . str_replace(',', '.', floatval($value)); |
|
155 | + $output .= ' <= '.str_replace(',', '.', floatval($value)); |
|
156 | 156 | break; |
157 | 157 | case '>=': |
158 | 158 | case 'egt': |
159 | - $output .= ' >= ' . str_replace(',', '.', floatval($value)); |
|
159 | + $output .= ' >= '.str_replace(',', '.', floatval($value)); |
|
160 | 160 | break; |
161 | 161 | case '%': |
162 | 162 | case 'like': |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $output = $this->DocLister->LikeEscape($output, $value, '=', '%[+value+]'); |
170 | 170 | break; |
171 | 171 | case 'regexp': |
172 | - $output .= " REGEXP '" . $this->modx->db->escape($value) . "'"; |
|
172 | + $output .= " REGEXP '".$this->modx->db->escape($value)."'"; |
|
173 | 173 | break; |
174 | 174 | case 'against': |
175 | 175 | /** content:pagetitle,description,content,introtext:against:искомая строка */ |
@@ -192,16 +192,16 @@ discard block |
||
192 | 192 | $word_arr[] = $this->DocLister->LikeEscape($output, $word); |
193 | 193 | } |
194 | 194 | if (!empty($word_arr)) { |
195 | - $output = '(' . implode(' OR ', $word_arr) . ')'; |
|
195 | + $output = '('.implode(' OR ', $word_arr).')'; |
|
196 | 196 | } else { |
197 | 197 | $output = ''; |
198 | 198 | } |
199 | 199 | break; |
200 | 200 | case 'in': |
201 | - $output .= ' IN(' . $this->DocLister->sanitarIn($value, ',', true) . ')'; |
|
201 | + $output .= ' IN('.$this->DocLister->sanitarIn($value, ',', true).')'; |
|
202 | 202 | break; |
203 | 203 | case 'notin': |
204 | - $output .= ' NOT IN(' . $this->DocLister->sanitarIn($value, ',', true) . ')'; |
|
204 | + $output .= ' NOT IN('.$this->DocLister->sanitarIn($value, ',', true).')'; |
|
205 | 205 | break; |
206 | 206 | default: |
207 | 207 | $output = ''; |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | $this->tv_id = $tmp[0]; |
50 | 50 | } |
51 | 51 | if (!$this->tv_id) { |
52 | - $tvid = $this->modx->db->query("SELECT id FROM " . $this->DocLister->getTable('site_tmplvars') . " WHERE `name` = '" . $this->modx->db->escape($this->field) . "'"); |
|
52 | + $tvid = $this->modx->db->query("SELECT id FROM ".$this->DocLister->getTable('site_tmplvars')." WHERE `name` = '".$this->modx->db->escape($this->field)."'"); |
|
53 | 53 | $this->tv_id = intval($this->modx->db->getValue($tvid)); |
54 | 54 | } |
55 | 55 | |
56 | 56 | if (!$this->tv_id) { |
57 | - $this->DocLister->debug->warning('DocLister filtering by template variable "' . $this->DocLister->debug->dumpData($this->field) . '" failed. TV not found!'); |
|
57 | + $this->DocLister->debug->warning('DocLister filtering by template variable "'.$this->DocLister->debug->dumpData($this->field).'" failed. TV not found!'); |
|
58 | 58 | } else { |
59 | 59 | // create the alias for the join |
60 | - $alias = 'dltv_' . $this->field; |
|
60 | + $alias = 'dltv_'.$this->field; |
|
61 | 61 | if ($this->totalFilters > 0) { |
62 | - $alias .= '_' . $this->totalFilters; |
|
62 | + $alias .= '_'.$this->totalFilters; |
|
63 | 63 | } |
64 | 64 | $this->setTableAlias($alias); |
65 | 65 | $this->tvName = $this->field; |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | $join = ''; |
80 | 80 | $exists = $this->DocLister->checkTableAlias($this->tvName, $this->extTV->tvValuesTable()); |
81 | 81 | $alias = $this->DocLister->TableAlias($this->tvName, $this->extTV->tvValuesTable(), $this->getTableAlias()); |
82 | - $this->field = $alias . ".value"; |
|
82 | + $this->field = $alias.".value"; |
|
83 | 83 | if (!$exists) { |
84 | - $join = 'LEFT JOIN ' . $this->DocLister->getTable($this->extTV->tvValuesTable(), |
|
85 | - $alias) . ' ON `' . $alias . '`.`contentid`=`' . content_DL_filter::TableAlias . '`.`id` AND `' . $alias . '`.`tmplvarid`=' . $this->tv_id; |
|
84 | + $join = 'LEFT JOIN '.$this->DocLister->getTable($this->extTV->tvValuesTable(), |
|
85 | + $alias).' ON `'.$alias.'`.`contentid`=`'.content_DL_filter::TableAlias.'`.`id` AND `'.$alias.'`.`tmplvarid`='.$this->tv_id; |
|
86 | 86 | } else { |
87 | 87 | $this->setTableAlias($alias); |
88 | 88 | } |
@@ -44,10 +44,10 @@ |
||
44 | 44 | $reflectTPL = APIHelpers::getkey($params, 'reflectTPL', |
45 | 45 | '@CODE: <li><a href="[+url+]" title="[+title+]">[+title+]</a></li>'); |
46 | 46 | /** |
47 | - * activeReflectTPL |
|
48 | - * Шаблон активной даты. |
|
49 | - * Поддерживается такие же плейсхолдеры, как и в шаблоне reflectTPL |
|
50 | - */ |
|
47 | + * activeReflectTPL |
|
48 | + * Шаблон активной даты. |
|
49 | + * Поддерживается такие же плейсхолдеры, как и в шаблоне reflectTPL |
|
50 | + */ |
|
51 | 51 | $activeReflectTPL = APIHelpers::getkey($params, 'activeReflectTPL', '@CODE: <li><span>[+title+]</span></li>'); |
52 | 52 | |
53 | 53 | list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function () { |
@@ -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 | |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | $activeReflectTPL = APIHelpers::getkey($params, 'activeReflectTPL', '@CODE: <li><span>[+title+]</span></li>'); |
52 | 52 | |
53 | -list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function () { |
|
53 | +list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function(){ |
|
54 | 54 | return array('m-Y', '%m-%Y', array('DLReflect', 'validateMonth')); |
55 | -}, function () { |
|
55 | +}, function(){ |
|
56 | 56 | return array('Y', '%Y', array('DLReflect', 'validateYear')); |
57 | 57 | }); |
58 | 58 | $tmp = $originalDate = date($dateFormat); |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | * Возможные значения: Любое число. 0 расценивается как все доступные месяцы |
143 | 143 | * Значение по умолчанию: 0 |
144 | 144 | */ |
145 | -$limitBefore = (int)APIHelpers::getkey($params, 'limitBefore', 0); |
|
145 | +$limitBefore = (int) APIHelpers::getkey($params, 'limitBefore', 0); |
|
146 | 146 | /** |
147 | 147 | * limitAfter |
148 | 148 | * Число элементов после месяца указанного в activeMonth параметре |
149 | 149 | * Возможные значения: Любое число. 0 расценивается как все доступные месяцы |
150 | 150 | * Значение по умолчанию: 0 |
151 | 151 | */ |
152 | -$limitAfter = (int)APIHelpers::getkey($params, 'limitAfter', 0); |
|
152 | +$limitAfter = (int) APIHelpers::getkey($params, 'limitAfter', 0); |
|
153 | 153 | $display = $limitBefore + 1 + $limitAfter; |
154 | 154 | |
155 | 155 | $out = ''; |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | $DLParams['saveDLObject'] = 'DLAPI'; |
162 | 162 | if ($reflectSource == 'tv') { |
163 | 163 | $DLParams['tvSortType'] = 'TVDATETIME'; |
164 | - $DLParams['selectFields'] = "DATE_FORMAT(STR_TO_DATE(`dltv_" . $reflectField . "_1`.`value`,'%d-%m-%Y %H:%i:%s'), '" . $sqlDateFormat . "') as `id`"; |
|
164 | + $DLParams['selectFields'] = "DATE_FORMAT(STR_TO_DATE(`dltv_".$reflectField."_1`.`value`,'%d-%m-%Y %H:%i:%s'), '".$sqlDateFormat."') as `id`"; |
|
165 | 165 | } else { |
166 | 166 | $DLParams['orderBy'] = $reflectField; |
167 | - $DLParams['selectFields'] = "DATE_FORMAT(FROM_UNIXTIME(" . $reflectField . "), '" . $sqlDateFormat . "') as `id`"; |
|
167 | + $DLParams['selectFields'] = "DATE_FORMAT(FROM_UNIXTIME(".$reflectField."), '".$sqlDateFormat."') as `id`"; |
|
168 | 168 | } |
169 | 169 | $totalReflects = $modx->runSnippet('DocLister', $DLParams); |
170 | 170 | /** Получаем объект DocLister'a */ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $totalReflects = array(); |
182 | 182 | } |
183 | 183 | $totalReflects = new DLCollection($modx, $totalReflects); |
184 | -$totalReflects = $totalReflects->filter(function ($el) { |
|
184 | +$totalReflects = $totalReflects->filter(function($el){ |
|
185 | 185 | return !empty($el['id']); |
186 | 186 | }); |
187 | 187 | /** Добавляем активную дату в коллекцию */ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $totalReflects->add(array('id' => $originalCurrentReflect), $originalCurrentReflect); |
196 | 196 | } |
197 | 197 | /** Сортируем даты по возрастанию */ |
198 | -$totalReflects->sort(function ($a, $b) use ($dateFormat) { |
|
198 | +$totalReflects->sort(function($a, $b) use ($dateFormat) { |
|
199 | 199 | $aDate = DateTime::createFromFormat($dateFormat, $a['id']); |
200 | 200 | $bDate = DateTime::createFromFormat($dateFormat, $b['id']); |
201 | 201 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | })->reindex(); |
204 | 204 | |
205 | 205 | /** Разделяем коллекцию дат на 2 части (до текущей даты и после) */ |
206 | -list($lReflect, $rReflect) = $totalReflects->partition(function ($key, $val) use ( |
|
206 | +list($lReflect, $rReflect) = $totalReflects->partition(function($key, $val) use ( |
|
207 | 207 | $activeReflect, |
208 | 208 | $originalDate, |
209 | 209 | $dateFormat |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | $sortDir = APIHelpers::getkey($params, 'sortDir', 'ASC'); |
269 | 269 | /** Сортируем результатирующий список */ |
270 | -$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat) { |
|
270 | +$outReflects = $outReflects->sort(function($a, $b) use ($sortDir, $dateFormat) { |
|
271 | 271 | $aDate = DateTime::createFromFormat($dateFormat, $a); |
272 | 272 | $bDate = DateTime::createFromFormat($dateFormat, $b); |
273 | 273 | $out = false; |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | foreach ($outReflects as $reflectItem) { |
288 | 288 | $tpl = (!is_null($activeReflect) && $activeReflect == $reflectItem) ? $activeReflectTPL : $reflectTPL; |
289 | 289 | |
290 | - $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI) { |
|
290 | + $data = DLReflect::switchReflect($reflectType, function() use ($reflectItem, $DLAPI) { |
|
291 | 291 | list($vMonth, $vYear) = explode('-', $reflectItem, 2); |
292 | 292 | |
293 | 293 | return array( |
294 | 294 | 'monthNum' => $vMonth, |
295 | - 'monthName' => $DLAPI->getMsg('months.' . (int)$vMonth), |
|
295 | + 'monthName' => $DLAPI->getMsg('months.'.(int) $vMonth), |
|
296 | 296 | 'year' => $vYear, |
297 | 297 | ); |
298 | - }, function () use ($reflectItem) { |
|
298 | + }, function() use ($reflectItem) { |
|
299 | 299 | return array( |
300 | 300 | 'year' => $reflectItem |
301 | 301 | ); |
@@ -327,4 +327,4 @@ discard block |
||
327 | 327 | $debug = ''; |
328 | 328 | } |
329 | 329 | |
330 | -return $debug . $out; |
|
330 | +return $debug.$out; |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | $activeReflectTPL = APIHelpers::getkey($params, 'activeReflectTPL', '@CODE: <li><span>[+title+]</span></li>'); |
52 | 52 | |
53 | -list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function () { |
|
53 | +list($dateFormat, $sqlDateFormat, $reflectValidator) = DLReflect::switchReflect($reflectType, function (){ |
|
54 | 54 | return array('m-Y', '%m-%Y', array('DLReflect', 'validateMonth')); |
55 | -}, function () { |
|
55 | +}, function (){ |
|
56 | 56 | return array('Y', '%Y', array('DLReflect', 'validateYear')); |
57 | 57 | }); |
58 | 58 | $tmp = $originalDate = date($dateFormat); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $totalReflects = array(); |
182 | 182 | } |
183 | 183 | $totalReflects = new DLCollection($modx, $totalReflects); |
184 | -$totalReflects = $totalReflects->filter(function ($el) { |
|
184 | +$totalReflects = $totalReflects->filter(function ($el){ |
|
185 | 185 | return !empty($el['id']); |
186 | 186 | }); |
187 | 187 | /** Добавляем активную дату в коллекцию */ |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $totalReflects->add(array('id' => $originalCurrentReflect), $originalCurrentReflect); |
196 | 196 | } |
197 | 197 | /** Сортируем даты по возрастанию */ |
198 | -$totalReflects->sort(function ($a, $b) use ($dateFormat) { |
|
198 | +$totalReflects->sort(function ($a, $b) use ($dateFormat){ |
|
199 | 199 | $aDate = DateTime::createFromFormat($dateFormat, $a['id']); |
200 | 200 | $bDate = DateTime::createFromFormat($dateFormat, $b['id']); |
201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $activeReflect, |
208 | 208 | $originalDate, |
209 | 209 | $dateFormat |
210 | -) { |
|
210 | +){ |
|
211 | 211 | $aDate = DateTime::createFromFormat($dateFormat, $val['id']); |
212 | 212 | if (is_null($activeReflect)) { |
213 | 213 | $activeReflect = $originalDate; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | $sortDir = APIHelpers::getkey($params, 'sortDir', 'ASC'); |
269 | 269 | /** Сортируем результатирующий список */ |
270 | -$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat) { |
|
270 | +$outReflects = $outReflects->sort(function ($a, $b) use ($sortDir, $dateFormat){ |
|
271 | 271 | $aDate = DateTime::createFromFormat($dateFormat, $a); |
272 | 272 | $bDate = DateTime::createFromFormat($dateFormat, $b); |
273 | 273 | $out = false; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | foreach ($outReflects as $reflectItem) { |
288 | 288 | $tpl = (!is_null($activeReflect) && $activeReflect == $reflectItem) ? $activeReflectTPL : $reflectTPL; |
289 | 289 | |
290 | - $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI) { |
|
290 | + $data = DLReflect::switchReflect($reflectType, function () use ($reflectItem, $DLAPI){ |
|
291 | 291 | list($vMonth, $vYear) = explode('-', $reflectItem, 2); |
292 | 292 | |
293 | 293 | return array( |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | 'monthName' => $DLAPI->getMsg('months.' . (int)$vMonth), |
296 | 296 | 'year' => $vYear, |
297 | 297 | ); |
298 | - }, function () use ($reflectItem) { |
|
298 | + }, function () use ($reflectItem){ |
|
299 | 299 | return array( |
300 | 300 | 'year' => $reflectItem |
301 | 301 | ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $docgrp = implode(",", $docgrp); |
39 | 39 | } |
40 | 40 | $alias = parent::TableAlias; |
41 | - $where = ($this->modx->isFrontend() ? "`{$alias}`.`privateweb`=0" : "1='{$_SESSION['mgrRole']}' OR {$alias}.`privatemgr`=0") . (!$docgrp ? "" : " OR `{$this->tableAlias}`.`document_group` IN ({$docgrp})"); |
|
41 | + $where = ($this->modx->isFrontend() ? "`{$alias}`.`privateweb`=0" : "1='{$_SESSION['mgrRole']}' OR {$alias}.`privatemgr`=0").(!$docgrp ? "" : " OR `{$this->tableAlias}`.`document_group` IN ({$docgrp})"); |
|
42 | 42 | |
43 | 43 | return "($where)"; |
44 | 44 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function get_join() |
50 | 50 | { |
51 | - $join = 'LEFT JOIN ' . $this->DocLister->getTable('document_groups', |
|
52 | - $this->tableAlias) . ' ON `' . $this->tableAlias . '`.`document`=`' . parent::TableAlias . '`.`id`'; |
|
51 | + $join = 'LEFT JOIN '.$this->DocLister->getTable('document_groups', |
|
52 | + $this->tableAlias).' ON `'.$this->tableAlias.'`.`document`=`'.parent::TableAlias.'`.`id`'; |
|
53 | 53 | |
54 | 54 | return $join; |
55 | 55 | } |
@@ -89,10 +89,10 @@ |
||
89 | 89 | } |
90 | 90 | if (!empty($this->set)) { |
91 | 91 | if ($this->newDoc) { |
92 | - $SQL = "INSERT {$this->ignoreError} INTO {$this->makeTable($this->table)} SET " . implode(', ', |
|
92 | + $SQL = "insert {$this->ignoreError} INTO {$this->makeTable($this->table)} SET " . implode(', ', |
|
93 | 93 | $this->set); |
94 | 94 | } else { |
95 | - $SQL = ($this->getID() === null) ? null : "UPDATE {$this->ignoreError} {$this->makeTable($this->table)} SET " . implode(', ', |
|
95 | + $SQL = ($this->getID() === null) ? null : "update {$this->ignoreError} {$this->makeTable($this->table)} SET " . implode(', ', |
|
96 | 96 | $this->set) . " WHERE `" . $this->pkName . "` = " . $this->getID(); |
97 | 97 | } |
98 | 98 | $this->query($SQL); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->close(); |
57 | 57 | $this->markAllEncode(); |
58 | 58 | $this->newDoc = false; |
59 | - $result = $this->query("SELECT * from {$this->makeTable($this->table)} where `" . $this->pkName . "`='" . $this->escape($id) . "'"); |
|
59 | + $result = $this->query("SELECT * from {$this->makeTable($this->table)} where `".$this->pkName."`='".$this->escape($id)."'"); |
|
60 | 60 | $this->fromArray($this->modx->db->getRow($result)); |
61 | 61 | $this->store($this->toArray()); |
62 | 62 | $this->id = $this->eraseField($this->pkName); |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | } |
98 | 98 | if (!empty($this->set)) { |
99 | 99 | if ($this->newDoc) { |
100 | - $SQL = "INSERT {$this->ignoreError} INTO {$this->makeTable($this->table)} SET " . implode(', ', |
|
100 | + $SQL = "INSERT {$this->ignoreError} INTO {$this->makeTable($this->table)} SET ".implode(', ', |
|
101 | 101 | $this->set); |
102 | 102 | } else { |
103 | - $SQL = ($this->getID() === null) ? null : "UPDATE {$this->ignoreError} {$this->makeTable($this->table)} SET " . implode(', ', |
|
104 | - $this->set) . " WHERE `" . $this->pkName . "` = " . $this->getID(); |
|
103 | + $SQL = ($this->getID() === null) ? null : "UPDATE {$this->ignoreError} {$this->makeTable($this->table)} SET ".implode(', ', |
|
104 | + $this->set)." WHERE `".$this->pkName."` = ".$this->getID(); |
|
105 | 105 | } |
106 | 106 | $this->query($SQL); |
107 | 107 | if ($this->newDoc) { |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | if (is_array($_ids) && $_ids != array()) { |
129 | 129 | $id = $this->sanitarIn($_ids); |
130 | 130 | if (!empty($id)) { |
131 | - $this->query("DELETE from {$this->makeTable($this->table)} where `" . $this->pkName . "` IN ({$id})"); |
|
131 | + $this->query("DELETE from {$this->makeTable($this->table)} where `".$this->pkName."` IN ({$id})"); |
|
132 | 132 | } |
133 | 133 | $this->clearCache($fire_events); |
134 | 134 | } else { |
135 | - throw new Exception('Invalid IDs list for delete: <pre>' . print_r($ids, 1) . '</pre>'); |
|
135 | + throw new Exception('Invalid IDs list for delete: <pre>'.print_r($ids, 1).'</pre>'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return $this; |
@@ -80,8 +80,7 @@ |
||
80 | 80 | foreach ($this->jsonFields as $field) { |
81 | 81 | if ($this->get($field) === null |
82 | 82 | && isset($this->default_field[$field]) |
83 | - && is_array($this->default_field[$field])) |
|
84 | - { |
|
83 | + && is_array($this->default_field[$field])) { |
|
85 | 84 | $this->set($field, $this->default_field[$field]); |
86 | 85 | } |
87 | 86 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | $where = sqlHelper::trimLogicalOp($where); |
157 | 157 | |
158 | - $where = "WHERE {$where}"; |
|
158 | + $where = "where {$where}"; |
|
159 | 159 | $whereArr = array(); |
160 | 160 | if (!$this->getCFGDef('showNoPublish', 0)) { |
161 | 161 | $whereArr[] = "c.published=1"; |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | |
237 | 237 | if ($this->getCFGDef('showNoPublish', 0)) { |
238 | 238 | if ($where != '') { |
239 | - $where = "WHERE {$where}"; |
|
239 | + $where = "where {$where}"; |
|
240 | 240 | } else { |
241 | 241 | $where = ''; |
242 | 242 | } |
243 | 243 | } else { |
244 | 244 | if ($where != '') { |
245 | - $where = "WHERE {$where} AND "; |
|
245 | + $where = "where {$where} AND "; |
|
246 | 246 | } else { |
247 | - $where = "WHERE {$where} "; |
|
247 | + $where = "where {$where} "; |
|
248 | 248 | } |
249 | 249 | $where .= "c.published=1"; |
250 | 250 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0)); |
260 | 260 | |
261 | - $rs = $this->dbQuery("SELECT {$fields} FROM {$tbl_site_content} {$where} {$group} {$sort} {$limit}"); |
|
261 | + $rs = $this->dbQuery("select {$fields} FROM {$tbl_site_content} {$where} {$group} {$sort} {$limit}"); |
|
262 | 262 | |
263 | 263 | while ($item = $this->modx->db->getRow($rs)) { |
264 | 264 | $out[$item['id']] = $item; |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | $tbl_site_content = $this->getTable('site_content', 'c'); |
285 | 285 | $sanitarInIDs = $this->sanitarIn($id); |
286 | 286 | if ($this->getCFGDef('showNoPublish', 0)) { |
287 | - $where = "WHERE {$where} c.parent IN ({$sanitarInIDs}"; |
|
287 | + $where = "where {$where} c.parent IN ({$sanitarInIDs}"; |
|
288 | 288 | } else { |
289 | - $where = "WHERE {$where} c.parent IN ({$sanitarInIDs}) AND c.deleted=0 AND c.published=1"; |
|
289 | + $where = "where {$where} c.parent IN ({$sanitarInIDs}) AND c.deleted=0 AND c.published=1"; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | $rs = $this->dbQuery("SELECT id FROM {$tbl_site_content} {$where} AND c.id IN(SELECT DISTINCT s.parent FROM " . $this->getTable('catalog', |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $fields = $this->getCFGDef('selectFields', 'c.*'); |
363 | 363 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
364 | 364 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
365 | - $rs = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " . |
|
365 | + $rs = $this->dbQuery("select {$fields} FROM " . $from . " " . $where . " " . |
|
366 | 366 | $group . " " . |
367 | 367 | $sort . " " . |
368 | 368 | $this->LimitSQL($this->getCFGDef('queryLimit', 0)) |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html |
8 | 8 | * @author Agel_Nash <[email protected]>, kabachello <[email protected]> |
9 | 9 | */ |
10 | -include_once(dirname(__FILE__) . "/site_content.php"); |
|
10 | +include_once(dirname(__FILE__)."/site_content.php"); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Class shopkeeperDocLister |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | if ($this->getCFGDef('contentPlaceholder', 0) !== 0) { |
119 | 119 | $this->toPlaceholders($tmp, 1, |
120 | - "item[" . $i . "]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
120 | + "item[".$i."]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
121 | 121 | } |
122 | 122 | $out .= $tmp; |
123 | 123 | if (next($this->_docs) !== false) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
146 | 146 | $where = $this->getCFGDef('addWhereList', ''); |
147 | 147 | $where = sqlHelper::trimLogicalOp($where); |
148 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
148 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
149 | 149 | if ($where != '' && $this->_filters['where'] != '') { |
150 | 150 | $where .= " AND "; |
151 | 151 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | case 'parents': |
165 | 165 | switch ($this->getCFGDef('showParent', '0')) { |
166 | 166 | case '-1': |
167 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")"; |
|
167 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.")"; |
|
168 | 168 | break; |
169 | 169 | case 0: |
170 | 170 | $tmpWhere = "c.parent IN ({$sanitarInIDs}) AND c.id NOT IN({$sanitarInIDs})"; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | if (($addDocs = $this->getCFGDef('documents', '')) != '') { |
178 | 178 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
179 | - $whereArr[] = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))"; |
|
179 | + $whereArr[] = "((".$tmpWhere.") OR c.id IN({$addDocs}))"; |
|
180 | 180 | } else { |
181 | 181 | $whereArr[] = $tmpWhere; |
182 | 182 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | break; |
187 | 187 | } |
188 | 188 | } |
189 | - $from = $tbl_site_content . " " . $this->_filters['join']; |
|
189 | + $from = $tbl_site_content." ".$this->_filters['join']; |
|
190 | 190 | $where = sqlHelper::trimLogicalOp($where); |
191 | 191 | |
192 | 192 | if (trim($where) != 'WHERE') { |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | $where = $this->getCFGDef('addWhereList', ''); |
222 | 222 | $where = sqlHelper::trimLogicalOp($where); |
223 | 223 | |
224 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
224 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
225 | 225 | $where = sqlHelper::trimLogicalOp($where); |
226 | 226 | |
227 | 227 | $tbl_site_content = $this->getTable('catalog', 'c'); |
228 | 228 | if ($sanitarInIDs != "''") { |
229 | - $where .= ($where ? " AND " : "") . "c.id IN ({$sanitarInIDs}) AND"; |
|
229 | + $where .= ($where ? " AND " : "")."c.id IN ({$sanitarInIDs}) AND"; |
|
230 | 230 | } |
231 | 231 | $where = sqlHelper::trimLogicalOp($where); |
232 | 232 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $fields = $this->getCFGDef('selectFields', 'c.*'); |
250 | 250 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
251 | 251 | $sort = $this->SortOrderSQL("c.createdon"); |
252 | - list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], |
|
252 | + list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content.' '.$this->_filters['join'], |
|
253 | 253 | $sort); |
254 | 254 | |
255 | 255 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0)); |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | $where = "WHERE {$where} c.parent IN ({$sanitarInIDs}) AND c.deleted=0 AND c.published=1"; |
286 | 286 | } |
287 | 287 | |
288 | - $rs = $this->dbQuery("SELECT id FROM {$tbl_site_content} {$where} AND c.id IN(SELECT DISTINCT s.parent FROM " . $this->getTable('catalog', |
|
289 | - 's') . ")"); |
|
288 | + $rs = $this->dbQuery("SELECT id FROM {$tbl_site_content} {$where} AND c.id IN(SELECT DISTINCT s.parent FROM ".$this->getTable('catalog', |
|
289 | + 's').")"); |
|
290 | 290 | |
291 | 291 | while ($item = $this->modx->db->getRow($rs)) { |
292 | 292 | $out[] = $item['id']; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $tbl_site_content = $this->getTable('catalog', 'c'); |
318 | 318 | |
319 | 319 | $sort = $this->SortOrderSQL("c.createdon"); |
320 | - list($from, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], $sort); |
|
320 | + list($from, $sort) = $this->injectSortByTV($tbl_site_content.' '.$this->_filters['join'], $sort); |
|
321 | 321 | $sanitarInIDs = $this->sanitarIn($this->IDs); |
322 | 322 | |
323 | 323 | $tmpWhere = null; |
@@ -325,14 +325,14 @@ discard block |
||
325 | 325 | if ($sanitarInIDs != "''") { |
326 | 326 | switch ($this->getCFGDef('showParent', '0')) { |
327 | 327 | case '-1': |
328 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")"; |
|
328 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.")"; |
|
329 | 329 | break; |
330 | 330 | case 0: |
331 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ") AND c.id NOT IN(" . $sanitarInIDs . ")"; |
|
331 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.") AND c.id NOT IN(".$sanitarInIDs.")"; |
|
332 | 332 | break; |
333 | 333 | case 1: |
334 | 334 | default: |
335 | - $tmpWhere = "(c.parent IN (" . $sanitarInIDs . ") OR c.id IN({$sanitarInIDs}))"; |
|
335 | + $tmpWhere = "(c.parent IN (".$sanitarInIDs.") OR c.id IN({$sanitarInIDs}))"; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | if (empty($tmpWhere)) { |
342 | 342 | $tmpWhere = "c.id IN({$addDocs})"; |
343 | 343 | } else { |
344 | - $tmpWhere = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))"; |
|
344 | + $tmpWhere = "((".$tmpWhere.") OR c.id IN({$addDocs}))"; |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | if (!empty($tmpWhere)) { |
@@ -351,16 +351,16 @@ discard block |
||
351 | 351 | $where[] = "c.published=1"; |
352 | 352 | } |
353 | 353 | if (!empty($where)) { |
354 | - $where = "WHERE " . implode(" AND ", $where); |
|
354 | + $where = "WHERE ".implode(" AND ", $where); |
|
355 | 355 | } else { |
356 | 356 | $where = ''; |
357 | 357 | } |
358 | 358 | $fields = $this->getCFGDef('selectFields', 'c.*'); |
359 | 359 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
360 | 360 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
361 | - $rs = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " . |
|
362 | - $group . " " . |
|
363 | - $sort . " " . |
|
361 | + $rs = $this->dbQuery("SELECT {$fields} FROM ".$from." ".$where." ". |
|
362 | + $group." ". |
|
363 | + $sort." ". |
|
364 | 364 | $this->LimitSQL($this->getCFGDef('queryLimit', 0)) |
365 | 365 | ); |
366 | 366 |
@@ -1700,8 +1700,8 @@ |
||
1700 | 1700 | $fltr_params = explode(':', $filter, 2); |
1701 | 1701 | $fltr = APIHelpers::getkey($fltr_params, 0, null); |
1702 | 1702 | /** |
1703 | - * @var tv_DL_filter|content_DL_filter $fltr_class |
|
1704 | - */ |
|
1703 | + * @var tv_DL_filter|content_DL_filter $fltr_class |
|
1704 | + */ |
|
1705 | 1705 | $fltr_class = $fltr . '_DL_filter'; |
1706 | 1706 | // check if the filter is implemented |
1707 | 1707 | if (!is_null($fltr)) { |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | * @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html |
6 | 6 | * @author Agel_Nash <[email protected]> |
7 | 7 | */ |
8 | -include_once(MODX_BASE_PATH . 'assets/lib/APIHelpers.class.php'); |
|
9 | -include_once(MODX_BASE_PATH . 'assets/lib/Helpers/FS.php'); |
|
10 | -include_once(MODX_BASE_PATH . 'assets/lib/Helpers/Config.php'); |
|
11 | -require_once(dirname(dirname(__FILE__)) . "/lib/jsonHelper.class.php"); |
|
12 | -require_once(dirname(dirname(__FILE__)) . "/lib/sqlHelper.class.php"); |
|
13 | -require_once(dirname(dirname(__FILE__)) . "/lib/DLTemplate.class.php"); |
|
14 | -require_once(dirname(dirname(__FILE__)) . "/lib/DLCollection.class.php"); |
|
15 | -require_once(dirname(dirname(__FILE__)) . "/lib/xnop.class.php"); |
|
8 | +include_once(MODX_BASE_PATH.'assets/lib/APIHelpers.class.php'); |
|
9 | +include_once(MODX_BASE_PATH.'assets/lib/Helpers/FS.php'); |
|
10 | +include_once(MODX_BASE_PATH.'assets/lib/Helpers/Config.php'); |
|
11 | +require_once(dirname(dirname(__FILE__))."/lib/jsonHelper.class.php"); |
|
12 | +require_once(dirname(dirname(__FILE__))."/lib/sqlHelper.class.php"); |
|
13 | +require_once(dirname(dirname(__FILE__))."/lib/DLTemplate.class.php"); |
|
14 | +require_once(dirname(dirname(__FILE__))."/lib/DLCollection.class.php"); |
|
15 | +require_once(dirname(dirname(__FILE__))."/lib/xnop.class.php"); |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Class DocLister |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | case ')': |
299 | 299 | $open--; |
300 | 300 | if ($open == 0) { |
301 | - $res[] = $cur . ')'; |
|
301 | + $res[] = $cur.')'; |
|
302 | 302 | $cur = ''; |
303 | 303 | } else { |
304 | 304 | $cur .= $e; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function setDebug($flag = 0) |
364 | 364 | { |
365 | - $flag = abs((int)$flag); |
|
365 | + $flag = abs((int) $flag); |
|
366 | 366 | if ($this->_debugMode != $flag) { |
367 | 367 | $this->_debugMode = $flag; |
368 | 368 | $this->debug = null; |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | ini_set('display_errors', 1); |
373 | 373 | } |
374 | 374 | $dir = dirname(dirname(__FILE__)); |
375 | - if (file_exists($dir . "/lib/DLdebug.class.php")) { |
|
376 | - include_once($dir . "/lib/DLdebug.class.php"); |
|
375 | + if (file_exists($dir."/lib/DLdebug.class.php")) { |
|
376 | + include_once($dir."/lib/DLdebug.class.php"); |
|
377 | 377 | if (class_exists("DLdebug", false)) { |
378 | 378 | $this->debug = new DLdebug($this); |
379 | 379 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | } |
412 | 412 | $table = $this->_table[$name]; |
413 | 413 | if (!empty($alias) && is_scalar($alias)) { |
414 | - $table .= " as `" . $alias . "`"; |
|
414 | + $table .= " as `".$alias."`"; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | return $table; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function jsonDecode($json, $config = array(), $nop = false) |
454 | 454 | { |
455 | - $this->debug->debug('Decode JSON: ' . $this->debug->dumpData($json) . "\r\nwith config: " . $this->debug->dumpData($config), |
|
455 | + $this->debug->debug('Decode JSON: '.$this->debug->dumpData($json)."\r\nwith config: ".$this->debug->dumpData($config), |
|
456 | 456 | 'jsonDecode', 2); |
457 | 457 | $config = jsonHelper::jsonDecode($json, $config, $nop); |
458 | 458 | $this->isErrorJSON($json); |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | { |
472 | 472 | $error = jsonHelper::json_last_error_msg(); |
473 | 473 | if (!in_array($error, array('error_none', 'other'))) { |
474 | - $this->debug->error($this->getMsg('json.' . $error) . ": " . $this->debug->dumpData($json, 'code'), 'JSON'); |
|
474 | + $this->debug->error($this->getMsg('json.'.$error).": ".$this->debug->dumpData($json, 'code'), 'JSON'); |
|
475 | 475 | $error = true; |
476 | 476 | } |
477 | 477 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | } |
502 | 502 | |
503 | 503 | if ( |
504 | - (int)$this->getCFGDef('display', 0) > 0 && ( //OR paginate in extender's parameter |
|
504 | + (int) $this->getCFGDef('display', 0) > 0 && ( //OR paginate in extender's parameter |
|
505 | 505 | in_array('paginate', $extenders) || $this->getCFGDef('paginate', '') != '' || |
506 | 506 | $this->getCFGDef('TplPrevP', '') != '' || $this->getCFGDef('TplPage', '') != '' || |
507 | 507 | $this->getCFGDef('TplCurrentPage', '') != '' || $this->getCFGDef('TplWrapPaginate', '') != '' || |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | ) { |
512 | 512 | throw new Exception('Error load paginate extender'); |
513 | 513 | } else { |
514 | - if ((int)$this->getCFGDef('display', 0) == 0) { |
|
514 | + if ((int) $this->getCFGDef('display', 0) == 0) { |
|
515 | 515 | $extenders = $this->unsetArrayVal($extenders, 'paginate'); |
516 | 516 | } |
517 | 517 | } |
@@ -557,11 +557,11 @@ discard block |
||
557 | 557 | */ |
558 | 558 | public function getUrl($id = 0) |
559 | 559 | { |
560 | - $id = ((int)$id > 0) ? (int)$id : $this->getCurrentMODXPageID(); |
|
560 | + $id = ((int) $id > 0) ? (int) $id : $this->getCurrentMODXPageID(); |
|
561 | 561 | |
562 | 562 | $link = $this->checkExtender('request') ? $this->extender['request']->getLink() : $this->getRequest(); |
563 | 563 | if ($id == $this->modx->config['site_start']) { |
564 | - $url = $this->modx->config['site_url'] . ($link != '' ? "?{$link}" : ""); |
|
564 | + $url = $this->modx->config['site_url'].($link != '' ? "?{$link}" : ""); |
|
565 | 565 | } else { |
566 | 566 | $url = $this->modx->makeUrl($id, '', $link, $this->getCFGDef('urlScheme', '')); |
567 | 567 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | */ |
623 | 623 | public function getCurrentMODXPageID() |
624 | 624 | { |
625 | - $id = isset($this->modx->documentIdentifier) ? (int)$this->modx->documentIdentifier : 0; |
|
625 | + $id = isset($this->modx->documentIdentifier) ? (int) $this->modx->documentIdentifier : 0; |
|
626 | 626 | $docData = isset($this->modx->documentObject) ? $this->modx->documentObject : array(); |
627 | 627 | |
628 | 628 | return empty($id) ? \APIHelpers::getkey($docData, 'id', 0) : $id; |
@@ -640,13 +640,13 @@ discard block |
||
640 | 640 | public function ErrorLogger($message, $code, $file, $line, $trace) |
641 | 641 | { |
642 | 642 | if (abs($this->getCFGDef('debug', '0')) == '1') { |
643 | - $out = "CODE #" . $code . "<br />"; |
|
644 | - $out .= "on file: " . $file . ":" . $line . "<br />"; |
|
643 | + $out = "CODE #".$code."<br />"; |
|
644 | + $out .= "on file: ".$file.":".$line."<br />"; |
|
645 | 645 | $out .= "<pre>"; |
646 | 646 | $out .= print_r($trace, 1); |
647 | 647 | $out .= "</pre>"; |
648 | 648 | |
649 | - $message = $out . $message; |
|
649 | + $message = $out.$message; |
|
650 | 650 | } |
651 | 651 | die($message); |
652 | 652 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | $ext = explode(",", $ext); |
676 | 676 | foreach ($ext as $item) { |
677 | 677 | if ($item != '' && !$this->_loadExtender($item)) { |
678 | - throw new Exception('Error load ' . APIHelpers::e($item) . ' extender'); |
|
678 | + throw new Exception('Error load '.APIHelpers::e($item).' extender'); |
|
679 | 679 | } |
680 | 680 | } |
681 | 681 | } |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | $out = DLTemplate::getInstance($this->getMODX())->toPlaceholders($data, $set, $key, $id); |
718 | 718 | |
719 | 719 | $this->debug->debugEnd( |
720 | - "toPlaceholders", array($key . " placeholder" => $data), array('html') |
|
720 | + "toPlaceholders", array($key." placeholder" => $data), array('html') |
|
721 | 721 | ); |
722 | 722 | |
723 | 723 | return $out; |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | */ |
736 | 736 | public function sanitarIn($data, $sep = ',', $quote = true) |
737 | 737 | { |
738 | - if(is_scalar($data)) $data = explode($sep, $data); |
|
739 | - if(!is_array($data)) $data = array(); //@TODO: throw |
|
738 | + if (is_scalar($data)) $data = explode($sep, $data); |
|
739 | + if (!is_array($data)) $data = array(); //@TODO: throw |
|
740 | 740 | |
741 | 741 | $out = array(); |
742 | 742 | foreach ($data as $item) { |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | } |
746 | 746 | } |
747 | 747 | $q = $quote ? "'" : ""; |
748 | - $out = $q . implode($q . "," . $q, $out) . $q; |
|
748 | + $out = $q.implode($q.",".$q, $out).$q; |
|
749 | 749 | |
750 | 750 | return $out; |
751 | 751 | } |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | if (empty($lang)) { |
767 | 767 | $lang = $this->getCFGDef('lang', $this->modx->config['manager_language']); |
768 | 768 | } |
769 | - if (file_exists(dirname(dirname(__FILE__)) . "/lang/" . $lang . ".php")) { |
|
770 | - $tmp = include(dirname(__FILE__) . "/lang/" . $lang . ".php"); |
|
769 | + if (file_exists(dirname(dirname(__FILE__))."/lang/".$lang.".php")) { |
|
770 | + $tmp = include(dirname(__FILE__)."/lang/".$lang.".php"); |
|
771 | 771 | $this->_customLang = is_array($tmp) ? $tmp : array(); |
772 | 772 | } |
773 | 773 | |
@@ -788,14 +788,14 @@ discard block |
||
788 | 788 | $lang = $this->getCFGDef('lang', $this->modx->config['manager_language']); |
789 | 789 | } |
790 | 790 | |
791 | - $this->debug->debug('Load language ' . $this->debug->dumpData($name) . "." . $this->debug->dumpData($lang), |
|
791 | + $this->debug->debug('Load language '.$this->debug->dumpData($name).".".$this->debug->dumpData($lang), |
|
792 | 792 | 'loadlang', 2); |
793 | 793 | if (is_scalar($name)) { |
794 | 794 | $name = array($name); |
795 | 795 | } |
796 | 796 | foreach ($name as $n) { |
797 | - if (file_exists(dirname(__FILE__) . "/lang/" . $lang . "/" . $n . ".inc.php")) { |
|
798 | - $tmp = include(dirname(__FILE__) . "/lang/" . $lang . "/" . $n . ".inc.php"); |
|
797 | + if (file_exists(dirname(__FILE__)."/lang/".$lang."/".$n.".inc.php")) { |
|
798 | + $tmp = include(dirname(__FILE__)."/lang/".$lang."/".$n.".inc.php"); |
|
799 | 799 | if (is_array($tmp)) { |
800 | 800 | /** |
801 | 801 | * Переименовыываем элементы массива из array('test'=>'data') в array('name.test'=>'data') |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
881 | - $data[$this->getCFGDef("sysKey", "dl") . ".wrap"] = $this->renderWrap($out); |
|
881 | + $data[$this->getCFGDef("sysKey", "dl").".wrap"] = $this->renderWrap($out); |
|
882 | 882 | $out = $this->parseChunk($this->getCFGDef('tpl', ''), $data); |
883 | 883 | |
884 | 884 | return $out; |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | $out = $this->DLTemplate->parseChunk($name, $data, $parseDocumentSource); |
947 | 947 | $out = $this->parseLang($out); |
948 | 948 | if (empty($out)) { |
949 | - $this->debug->debug("Empty chunk: " . $this->debug->dumpData($name), '', 2); |
|
949 | + $this->debug->debug("Empty chunk: ".$this->debug->dumpData($name), '', 2); |
|
950 | 950 | } |
951 | 951 | $this->debug->debugEnd("parseChunk"); |
952 | 952 | |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | if ((($this->getCFGDef("noneWrapOuter", "1") && $docs == 0) || $docs > 0) && !empty($this->ownerTPL)) { |
983 | 983 | $this->debug->debug("", "renderWrapTPL", 2); |
984 | 984 | $parse = true; |
985 | - $plh = array($this->getCFGDef("sysKey", "dl") . ".wrap" => $data); |
|
985 | + $plh = array($this->getCFGDef("sysKey", "dl").".wrap" => $data); |
|
986 | 986 | /** |
987 | 987 | * @var $extPrepare prepare_DL_Extender |
988 | 988 | */ |
@@ -1032,10 +1032,10 @@ discard block |
||
1032 | 1032 | |
1033 | 1033 | $iterationName = ($i % 2 == 1) ? 'Odd' : 'Even'; |
1034 | 1034 | $tmp = strtolower($iterationName); |
1035 | - $class[] = $this->getCFGDef($tmp . 'Class', $tmp); |
|
1035 | + $class[] = $this->getCFGDef($tmp.'Class', $tmp); |
|
1036 | 1036 | |
1037 | - $this->renderTPL = $this->getCFGDef('tplId' . $i, $this->renderTPL); |
|
1038 | - $this->renderTPL = $this->getCFGDef('tpl' . $iterationName, $this->renderTPL); |
|
1037 | + $this->renderTPL = $this->getCFGDef('tplId'.$i, $this->renderTPL); |
|
1038 | + $this->renderTPL = $this->getCFGDef('tpl'.$iterationName, $this->renderTPL); |
|
1039 | 1039 | $iteration = $i; |
1040 | 1040 | |
1041 | 1041 | if ($this->extPaginate) { |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | } |
1053 | 1053 | |
1054 | 1054 | $data[$this->getCFGDef("sysKey", |
1055 | - "dl") . '.full_iteration'] = $iteration; |
|
1055 | + "dl").'.full_iteration'] = $iteration; |
|
1056 | 1056 | |
1057 | 1057 | if ($i == 1) { |
1058 | 1058 | $this->renderTPL = $this->getCFGDef('tplFirst', $this->renderTPL); |
@@ -1065,14 +1065,14 @@ discard block |
||
1065 | 1065 | if ($this->modx->documentIdentifier == $data['id']) { |
1066 | 1066 | $this->renderTPL = $this->getCFGDef('tplCurrent', $this->renderTPL); |
1067 | 1067 | $data[$this->getCFGDef("sysKey", |
1068 | - "dl") . '.active'] = 1; //[+active+] - 1 if $modx->documentIdentifer equal ID this element |
|
1068 | + "dl").'.active'] = 1; //[+active+] - 1 if $modx->documentIdentifer equal ID this element |
|
1069 | 1069 | $class[] = $this->getCFGDef('currentClass', 'current'); |
1070 | 1070 | } else { |
1071 | - $data[$this->getCFGDef("sysKey", "dl") . '.active'] = 0; |
|
1071 | + $data[$this->getCFGDef("sysKey", "dl").'.active'] = 0; |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | $class = implode(" ", $class); |
1075 | - $data[$this->getCFGDef("sysKey", "dl") . '.class'] = $class; |
|
1075 | + $data[$this->getCFGDef("sysKey", "dl").'.class'] = $class; |
|
1076 | 1076 | |
1077 | 1077 | /** |
1078 | 1078 | * @var $extE e_DL_Extender |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | */ |
1183 | 1183 | public function checkExtender($name) |
1184 | 1184 | { |
1185 | - return (isset($this->extender[$name]) && $this->extender[$name] instanceof $name . "_DL_Extender"); |
|
1185 | + return (isset($this->extender[$name]) && $this->extender[$name] instanceof $name."_DL_Extender"); |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | /** |
@@ -1223,17 +1223,17 @@ discard block |
||
1223 | 1223 | */ |
1224 | 1224 | protected function _loadExtender($name) |
1225 | 1225 | { |
1226 | - $this->debug->debug('Load Extender ' . $this->debug->dumpData($name), 'LoadExtender', 2); |
|
1226 | + $this->debug->debug('Load Extender '.$this->debug->dumpData($name), 'LoadExtender', 2); |
|
1227 | 1227 | $flag = false; |
1228 | 1228 | |
1229 | - $classname = ($name != '') ? $name . "_DL_Extender" : ""; |
|
1229 | + $classname = ($name != '') ? $name."_DL_Extender" : ""; |
|
1230 | 1230 | if ($classname != '' && isset($this->extender[$name]) && $this->extender[$name] instanceof $classname) { |
1231 | 1231 | $flag = true; |
1232 | 1232 | |
1233 | 1233 | } else { |
1234 | 1234 | if (!class_exists($classname, false) && $classname != '') { |
1235 | - if (file_exists(dirname(__FILE__) . "/extender/" . $name . ".extender.inc")) { |
|
1236 | - include_once(dirname(__FILE__) . "/extender/" . $name . ".extender.inc"); |
|
1235 | + if (file_exists(dirname(__FILE__)."/extender/".$name.".extender.inc")) { |
|
1236 | + include_once(dirname(__FILE__)."/extender/".$name.".extender.inc"); |
|
1237 | 1237 | } |
1238 | 1238 | } |
1239 | 1239 | if (class_exists($classname, false) && $classname != '') { |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | } |
1243 | 1243 | } |
1244 | 1244 | if (!$flag) { |
1245 | - $this->debug->debug("Error load Extender " . $this->debug->dumpData($name)); |
|
1245 | + $this->debug->debug("Error load Extender ".$this->debug->dumpData($name)); |
|
1246 | 1246 | } |
1247 | 1247 | $this->debug->debugEnd('LoadExtender'); |
1248 | 1248 | |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | */ |
1262 | 1262 | public function setIDs($IDs) |
1263 | 1263 | { |
1264 | - $this->debug->debug('set ID list ' . $this->debug->dumpData($IDs), 'setIDs', 2); |
|
1264 | + $this->debug->debug('set ID list '.$this->debug->dumpData($IDs), 'setIDs', 2); |
|
1265 | 1265 | $IDs = $this->cleanIDs($IDs); |
1266 | 1266 | $type = $this->getCFGDef('idType', 'parents'); |
1267 | 1267 | $depth = $this->getCFGDef('depth', ''); |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | public function cleanIDs($IDs, $sep = ',') |
1298 | 1298 | { |
1299 | - $this->debug->debug('clean IDs ' . $this->debug->dumpData($IDs) . ' with separator ' . $this->debug->dumpData($sep), |
|
1299 | + $this->debug->debug('clean IDs '.$this->debug->dumpData($IDs).' with separator '.$this->debug->dumpData($sep), |
|
1300 | 1300 | 'cleanIDs', 2); |
1301 | 1301 | $out = array(); |
1302 | 1302 | if (!is_array($IDs)) { |
@@ -1304,8 +1304,8 @@ discard block |
||
1304 | 1304 | } |
1305 | 1305 | foreach ($IDs as $item) { |
1306 | 1306 | $item = trim($item); |
1307 | - if (is_numeric($item) && (int)$item >= 0) { //Fix 0xfffffffff |
|
1308 | - $out[] = (int)$item; |
|
1307 | + if (is_numeric($item) && (int) $item >= 0) { //Fix 0xfffffffff |
|
1308 | + $out[] = (int) $item; |
|
1309 | 1309 | } |
1310 | 1310 | } |
1311 | 1311 | $out = array_unique($out); |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | { |
1380 | 1380 | $out = ''; |
1381 | 1381 | if ($group != '') { |
1382 | - $out = 'GROUP BY ' . $group; |
|
1382 | + $out = 'GROUP BY '.$group; |
|
1383 | 1383 | } |
1384 | 1384 | |
1385 | 1385 | return $out; |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | $idList = $this->sanitarIn($this->IDs, ',', false); |
1410 | 1410 | $out = array('orderBy' => "FIND_IN_SET({$this->getCFGDef('sortBy', $this->getPK())}, '{$idList}')"); |
1411 | 1411 | $this->config->setConfig($out); //reload config; |
1412 | - $sort = "ORDER BY " . $out['orderBy']; |
|
1412 | + $sort = "ORDER BY ".$out['orderBy']; |
|
1413 | 1413 | break; |
1414 | 1414 | default: |
1415 | 1415 | $out = array('orderBy' => '', 'order' => '', 'sortBy' => ''); |
@@ -1429,13 +1429,13 @@ discard block |
||
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | $out['sortBy'] = (($tmp = $this->getCFGDef('sortBy', '')) != '') ? $tmp : $sortName; |
1432 | - $out['orderBy'] = $out['sortBy'] . " " . $out['order']; |
|
1432 | + $out['orderBy'] = $out['sortBy']." ".$out['order']; |
|
1433 | 1433 | } |
1434 | 1434 | $this->config->setConfig($out); //reload config; |
1435 | - $sort = "ORDER BY " . $out['orderBy']; |
|
1435 | + $sort = "ORDER BY ".$out['orderBy']; |
|
1436 | 1436 | break; |
1437 | 1437 | } |
1438 | - $this->debug->debugEnd("sortORDER", 'Get sort order for SQL: ' . $this->debug->dumpData($sort)); |
|
1438 | + $this->debug->debugEnd("sortORDER", 'Get sort order for SQL: '.$this->debug->dumpData($sort)); |
|
1439 | 1439 | |
1440 | 1440 | return $sort; |
1441 | 1441 | } |
@@ -1466,17 +1466,17 @@ discard block |
||
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | if ($limit != 0) { |
1469 | - $ret = "LIMIT " . (int)$offset . "," . (int)$limit; |
|
1469 | + $ret = "LIMIT ".(int) $offset.",".(int) $limit; |
|
1470 | 1470 | } else { |
1471 | 1471 | if ($offset != 0) { |
1472 | 1472 | /** |
1473 | 1473 | * To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter |
1474 | 1474 | * @see http://dev.mysql.com/doc/refman/5.0/en/select.html |
1475 | 1475 | */ |
1476 | - $ret = "LIMIT " . (int)$offset . ",18446744073709551615"; |
|
1476 | + $ret = "LIMIT ".(int) $offset.",18446744073709551615"; |
|
1477 | 1477 | } |
1478 | 1478 | } |
1479 | - $this->debug->debugEnd("limitSQL", "Get limit for SQL: " . $this->debug->dumpData($ret)); |
|
1479 | + $this->debug->debugEnd("limitSQL", "Get limit for SQL: ".$this->debug->dumpData($ret)); |
|
1480 | 1480 | |
1481 | 1481 | return $ret; |
1482 | 1482 | } |
@@ -1519,20 +1519,20 @@ discard block |
||
1519 | 1519 | $children = array(); // children of each ID |
1520 | 1520 | $ids = array(); |
1521 | 1521 | foreach ($data as $i => $r) { |
1522 | - $row =& $data[$i]; |
|
1522 | + $row = & $data[$i]; |
|
1523 | 1523 | $id = $row[$idName]; |
1524 | 1524 | $pid = $row[$pidName]; |
1525 | - $children[$pid][$id] =& $row; |
|
1525 | + $children[$pid][$id] = & $row; |
|
1526 | 1526 | if (!isset($children[$id])) { |
1527 | 1527 | $children[$id] = array(); |
1528 | 1528 | } |
1529 | - $row['#childNodes'] =& $children[$id]; |
|
1529 | + $row['#childNodes'] = & $children[$id]; |
|
1530 | 1530 | $ids[$row[$idName]] = true; |
1531 | 1531 | } |
1532 | 1532 | // Root elements are elements with non-found PIDs. |
1533 | 1533 | $this->_tree = array(); |
1534 | 1534 | foreach ($data as $i => $r) { |
1535 | - $row =& $data[$i]; |
|
1535 | + $row = & $data[$i]; |
|
1536 | 1536 | if (!isset($ids[$row[$pidName]])) { |
1537 | 1537 | $this->_tree[$row[$idName]] = $row; |
1538 | 1538 | } |
@@ -1549,11 +1549,11 @@ discard block |
||
1549 | 1549 | */ |
1550 | 1550 | public function getPK($full = true) |
1551 | 1551 | { |
1552 | - $idField = isset($this->idField) ? $this->idField: 'id'; |
|
1552 | + $idField = isset($this->idField) ? $this->idField : 'id'; |
|
1553 | 1553 | if ($full) { |
1554 | - $idField = '`' . $idField . '`'; |
|
1554 | + $idField = '`'.$idField.'`'; |
|
1555 | 1555 | if (!empty($this->alias)) { |
1556 | - $idField = '`' . $this->alias . '`.' . $idField; |
|
1556 | + $idField = '`'.$this->alias.'`.'.$idField; |
|
1557 | 1557 | } |
1558 | 1558 | } |
1559 | 1559 | |
@@ -1570,9 +1570,9 @@ discard block |
||
1570 | 1570 | { |
1571 | 1571 | $parentField = isset($this->parentField) ? $this->parentField : ''; |
1572 | 1572 | if ($full && !empty($parentField)) { |
1573 | - $parentField = '`' . $parentField . '`'; |
|
1573 | + $parentField = '`'.$parentField.'`'; |
|
1574 | 1574 | if (!empty($this->alias)) { |
1575 | - $parentField = '`' . $this->alias . '`.' . $parentField; |
|
1575 | + $parentField = '`'.$this->alias.'`.'.$parentField; |
|
1576 | 1576 | } |
1577 | 1577 | } |
1578 | 1578 | |
@@ -1588,7 +1588,7 @@ discard block |
||
1588 | 1588 | */ |
1589 | 1589 | protected function getFilters($filter_string) |
1590 | 1590 | { |
1591 | - $this->debug->debug("getFilters: " . $this->debug->dumpData($filter_string), 'getFilter', 1); |
|
1591 | + $this->debug->debug("getFilters: ".$this->debug->dumpData($filter_string), 'getFilter', 1); |
|
1592 | 1592 | // the filter parameter tells us, which filters can be used in this query |
1593 | 1593 | $filter_string = trim($filter_string, ' ;'); |
1594 | 1594 | if (!$filter_string) { |
@@ -1615,14 +1615,14 @@ discard block |
||
1615 | 1615 | } |
1616 | 1616 | } |
1617 | 1617 | $output['join'] = !empty($joins) ? implode(' ', $joins) : ''; |
1618 | - $output['where'] = !empty($wheres) ? '(' . implode($sql, $wheres) . ')' : ''; |
|
1618 | + $output['where'] = !empty($wheres) ? '('.implode($sql, $wheres).')' : ''; |
|
1619 | 1619 | } |
1620 | 1620 | } |
1621 | 1621 | |
1622 | 1622 | if (!$logic_op_found) { |
1623 | 1623 | $filter = $this->loadFilter($filter_string); |
1624 | 1624 | if (!$filter) { |
1625 | - $this->debug->warning('Error while loading DocLister filter "' . $this->debug->dumpData($filter_string) . '": check syntax!'); |
|
1625 | + $this->debug->warning('Error while loading DocLister filter "'.$this->debug->dumpData($filter_string).'": check syntax!'); |
|
1626 | 1626 | $output = false; |
1627 | 1627 | } else { |
1628 | 1628 | $output['join'] = $filter->get_join(); |
@@ -1654,10 +1654,10 @@ discard block |
||
1654 | 1654 | * @param string $join |
1655 | 1655 | * @return $this |
1656 | 1656 | */ |
1657 | - public function setFiltersJoin($join = '') { |
|
1657 | + public function setFiltersJoin($join = ''){ |
|
1658 | 1658 | if (!empty($join)) { |
1659 | 1659 | if (!empty($this->_filters['join'])) { |
1660 | - $this->_filters['join'] .= ' ' . $join; |
|
1660 | + $this->_filters['join'] .= ' '.$join; |
|
1661 | 1661 | } else { |
1662 | 1662 | $this->_filters['join'] = $join; |
1663 | 1663 | } |
@@ -1678,19 +1678,19 @@ discard block |
||
1678 | 1678 | $type = trim($type); |
1679 | 1679 | switch (strtoupper($type)) { |
1680 | 1680 | case 'DECIMAL': |
1681 | - $field = 'CAST(' . $field . ' as DECIMAL(10,2))'; |
|
1681 | + $field = 'CAST('.$field.' as DECIMAL(10,2))'; |
|
1682 | 1682 | break; |
1683 | 1683 | case 'UNSIGNED': |
1684 | - $field = 'CAST(' . $field . ' as UNSIGNED)'; |
|
1684 | + $field = 'CAST('.$field.' as UNSIGNED)'; |
|
1685 | 1685 | break; |
1686 | 1686 | case 'BINARY': |
1687 | - $field = 'CAST(' . $field . ' as BINARY)'; |
|
1687 | + $field = 'CAST('.$field.' as BINARY)'; |
|
1688 | 1688 | break; |
1689 | 1689 | case 'DATETIME': |
1690 | - $field = 'CAST(' . $field . ' as DATETIME)'; |
|
1690 | + $field = 'CAST('.$field.' as DATETIME)'; |
|
1691 | 1691 | break; |
1692 | 1692 | case 'SIGNED': |
1693 | - $field = 'CAST(' . $field . ' as SIGNED)'; |
|
1693 | + $field = 'CAST('.$field.' as SIGNED)'; |
|
1694 | 1694 | break; |
1695 | 1695 | } |
1696 | 1696 | |
@@ -1704,18 +1704,18 @@ discard block |
||
1704 | 1704 | */ |
1705 | 1705 | protected function loadFilter($filter) |
1706 | 1706 | { |
1707 | - $this->debug->debug('Load filter ' . $this->debug->dumpData($filter), 'loadFilter', 2); |
|
1707 | + $this->debug->debug('Load filter '.$this->debug->dumpData($filter), 'loadFilter', 2); |
|
1708 | 1708 | $out = false; |
1709 | 1709 | $fltr_params = explode(':', $filter, 2); |
1710 | 1710 | $fltr = APIHelpers::getkey($fltr_params, 0, null); |
1711 | 1711 | /** |
1712 | 1712 | * @var tv_DL_filter|content_DL_filter $fltr_class |
1713 | 1713 | */ |
1714 | - $fltr_class = $fltr . '_DL_filter'; |
|
1714 | + $fltr_class = $fltr.'_DL_filter'; |
|
1715 | 1715 | // check if the filter is implemented |
1716 | 1716 | if (!is_null($fltr)) { |
1717 | - if (!class_exists($fltr_class) && file_exists(__DIR__ . '/filter/' . $fltr . '.filter.php')) { |
|
1718 | - require_once dirname(__FILE__) . '/filter/' . $fltr . '.filter.php'; |
|
1717 | + if (!class_exists($fltr_class) && file_exists(__DIR__.'/filter/'.$fltr.'.filter.php')) { |
|
1718 | + require_once dirname(__FILE__).'/filter/'.$fltr.'.filter.php'; |
|
1719 | 1719 | } |
1720 | 1720 | if (class_exists($fltr_class)) { |
1721 | 1721 | $this->totalFilters++; |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | */ |
1743 | 1743 | public function getCountFilters() |
1744 | 1744 | { |
1745 | - return (int)$this->totalFilters; |
|
1745 | + return (int) $this->totalFilters; |
|
1746 | 1746 | } |
1747 | 1747 | |
1748 | 1748 | /** |
@@ -1780,7 +1780,7 @@ discard block |
||
1780 | 1780 | public function getRequest() |
1781 | 1781 | { |
1782 | 1782 | $URL = null; |
1783 | - parse_str(parse_url(MODX_SITE_URL . $_SERVER['REQUEST_URI'], PHP_URL_QUERY), $URL); |
|
1783 | + parse_str(parse_url(MODX_SITE_URL.$_SERVER['REQUEST_URI'], PHP_URL_QUERY), $URL); |
|
1784 | 1784 | |
1785 | 1785 | return http_build_query(array_merge($URL, array(DocLister::AliasRequest => null))); |
1786 | 1786 | } |
@@ -735,8 +735,13 @@ discard block |
||
735 | 735 | */ |
736 | 736 | public function sanitarIn($data, $sep = ',', $quote = true) |
737 | 737 | { |
738 | - if(is_scalar($data)) $data = explode($sep, $data); |
|
739 | - if(!is_array($data)) $data = array(); //@TODO: throw |
|
738 | + if(is_scalar($data)) { |
|
739 | + $data = explode($sep, $data); |
|
740 | + } |
|
741 | + if(!is_array($data)) { |
|
742 | + $data = array(); |
|
743 | + } |
|
744 | + //@TODO: throw |
|
740 | 745 | |
741 | 746 | $out = array(); |
742 | 747 | foreach ($data as $item) { |
@@ -1101,7 +1106,8 @@ discard block |
||
1101 | 1106 | $fields = is_array($fields) ? $fields : explode(",", $fields); |
1102 | 1107 | if (is_array($array) && count($array) > 0) { |
1103 | 1108 | $tmp = array(); |
1104 | - foreach ($data as $i => $v) { //array_merge not valid work with integer index key |
|
1109 | + foreach ($data as $i => $v) { |
|
1110 | +//array_merge not valid work with integer index key |
|
1105 | 1111 | $tmp[$i] = (isset($array[$i]) ? array_merge($v, $array[$i]) : $v); |
1106 | 1112 | } |
1107 | 1113 | $data = $tmp; |
@@ -1304,7 +1310,8 @@ discard block |
||
1304 | 1310 | } |
1305 | 1311 | foreach ($IDs as $item) { |
1306 | 1312 | $item = trim($item); |
1307 | - if (is_numeric($item) && (int)$item >= 0) { //Fix 0xfffffffff |
|
1313 | + if (is_numeric($item) && (int)$item >= 0) { |
|
1314 | +//Fix 0xfffffffff |
|
1308 | 1315 | $out[] = (int)$item; |
1309 | 1316 | } |
1310 | 1317 | } |
@@ -1654,7 +1661,8 @@ discard block |
||
1654 | 1661 | * @param string $join |
1655 | 1662 | * @return $this |
1656 | 1663 | */ |
1657 | - public function setFiltersJoin($join = '') { |
|
1664 | + public function setFiltersJoin($join = '') |
|
1665 | + { |
|
1658 | 1666 | if (!empty($join)) { |
1659 | 1667 | if (!empty($this->_filters['join'])) { |
1660 | 1668 | $this->_filters['join'] .= ' ' . $join; |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | $from = $this->table . " " . $this->_filters['join']; |
216 | 216 | $where = $this->getCFGDef('addWhereList', ''); |
217 | 217 | |
218 | - //====== block added by Dreamer to enable filters ====== |
|
218 | + //====== block added by Dreamer to enable filters ====== |
|
219 | 219 | $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
220 | 220 | $where = sqlHelper::trimLogicalOp($where); |
221 | - //------- end of block ------- |
|
221 | + //------- end of block ------- |
|
222 | 222 | |
223 | 223 | |
224 | 224 | if ($where != '') { |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | $tmpWhere = $this->getCFGDef('addWhereList', ''); |
258 | 258 | $tmpWhere = sqlHelper::trimLogicalOp($tmpWhere); |
259 | 259 | |
260 | - //====== block added by Dreamer to enable filters ====== |
|
260 | + //====== block added by Dreamer to enable filters ====== |
|
261 | 261 | $tmpWhere = ($tmpWhere ? $tmpWhere . ' AND ' : '') . $this->_filters['where']; |
262 | 262 | $tmpWhere = sqlHelper::trimLogicalOp($tmpWhere); |
263 | - //------- end of block ------- |
|
263 | + //------- end of block ------- |
|
264 | 264 | |
265 | 265 | |
266 | 266 | if (!empty($tmpWhere)) { |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | $from = $this->table . " " . $this->_filters['join']; |
330 | 330 | $where = $this->getCFGDef('addWhereList', ''); |
331 | 331 | |
332 | - //====== block added by Dreamer ====== |
|
332 | + //====== block added by Dreamer ====== |
|
333 | 333 | $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
334 | 334 | $where = sqlHelper::trimLogicalOp($where); |
335 | - //------- end of block ------- |
|
335 | + //------- end of block ------- |
|
336 | 336 | |
337 | 337 | if ($where != '') { |
338 | 338 | $where = array($where); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $fields = $this->getCFGDef('selectFields', '*'); |
236 | 236 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', '')); |
237 | 237 | $sort = $this->SortOrderSQL($this->getPK()); |
238 | - $rs = $this->dbQuery("SELECT {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}"); |
|
238 | + $rs = $this->dbQuery("select {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}"); |
|
239 | 239 | |
240 | 240 | $pk = $this->getPK(false); |
241 | 241 | while ($item = $this->modx->db->getRow($rs)) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $sort = $this->SortOrderSQL($this->getPK()); |
306 | 306 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0)); |
307 | 307 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
308 | - $rs = $this->dbQuery("SELECT {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}"); |
|
308 | + $rs = $this->dbQuery("select {$fields} FROM {$from} {$where} {$group} {$sort} {$limit}"); |
|
309 | 309 | |
310 | 310 | $pk = $this->getPK(false); |
311 | 311 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $where .= " AND " . $tmp; |
400 | 400 | } |
401 | 401 | |
402 | - $rs = $this->dbQuery("SELECT {$this->getPK()} FROM {$this->table} WHERE {$where}"); |
|
402 | + $rs = $this->dbQuery("select {$this->getPK()} FROM {$this->table} WHERE {$where}"); |
|
403 | 403 | $pk = $this->getPK(false); |
404 | 404 | while ($item = $this->modx->db->getRow($rs)) { |
405 | 405 | $out[] = $item[$pk]; |
@@ -83,17 +83,17 @@ discard block |
||
83 | 83 | $item = $extUser->setUserData($item); //[+user.id.createdby+], [+user.fullname.publishedby+], [+dl.user.publishedby+].... |
84 | 84 | } |
85 | 85 | |
86 | - $item[$this->getCFGDef("sysKey", "dl") . '.summary'] = $extSummary ? $this->getSummary($item, |
|
86 | + $item[$this->getCFGDef("sysKey", "dl").'.summary'] = $extSummary ? $this->getSummary($item, |
|
87 | 87 | $extSummary) : ''; |
88 | 88 | |
89 | 89 | $item = array_merge($item, |
90 | 90 | $sysPlh); //inside the chunks available all placeholders set via $modx->toPlaceholders with prefix id, and with prefix sysKey |
91 | 91 | $item[$this->getCFGDef("sysKey", |
92 | - "dl") . '.iteration'] = $i; //[+iteration+] - Number element. Starting from zero |
|
92 | + "dl").'.iteration'] = $i; //[+iteration+] - Number element. Starting from zero |
|
93 | 93 | |
94 | 94 | $date = $this->getCFGDef('dateSource', 'pub_date'); |
95 | 95 | if (isset($item[$date])) { |
96 | - $_date = is_numeric($item[$date]) && $item[$date] == (int)$item[$date] ? $item[$date] : strtotime($item[$date]); |
|
96 | + $_date = is_numeric($item[$date]) && $item[$date] == (int) $item[$date] ? $item[$date] : strtotime($item[$date]); |
|
97 | 97 | if ($_date !== false) { |
98 | 98 | $_date = $_date + $this->modx->config['server_offset_time']; |
99 | 99 | $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $tmp = $this->parseChunk($this->renderTPL, $item); |
124 | 124 | if ($this->getCFGDef('contentPlaceholder', 0) !== 0) { |
125 | 125 | $this->toPlaceholders($tmp, 1, |
126 | - "item[" . $i . "]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
126 | + "item[".$i."]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
127 | 127 | } |
128 | 128 | $out .= $tmp; |
129 | 129 | if (next($this->_docs) !== false) { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | //without break |
173 | 173 | case ((array('1') == $fields || in_array('date', $fields)) && $date != 'date'): |
174 | 174 | if (isset($row[$date])) { |
175 | - $_date = is_numeric($row[$date]) && $row[$date] == (int)$row[$date] ? $row[$date] : strtotime($row[$date]); |
|
175 | + $_date = is_numeric($row[$date]) && $row[$date] == (int) $row[$date] ? $row[$date] : strtotime($row[$date]); |
|
176 | 176 | if ($_date !== false) { |
177 | 177 | $_date = $_date + $this->modx->config['server_offset_time']; |
178 | 178 | $dateFormat = $this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'); |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | $out = array(); |
211 | 211 | $sanitarInIDs = $this->sanitarIn($this->IDs); |
212 | 212 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
213 | - $from = $this->table . " " . $this->_filters['join']; |
|
213 | + $from = $this->table." ".$this->_filters['join']; |
|
214 | 214 | $where = $this->getCFGDef('addWhereList', ''); |
215 | 215 | |
216 | 216 | //====== block added by Dreamer to enable filters ====== |
217 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
217 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
218 | 218 | $where = sqlHelper::trimLogicalOp($where); |
219 | 219 | //------- end of block ------- |
220 | 220 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | if (!empty($where)) { |
232 | - $where = "WHERE " . implode(" AND ", $where); |
|
232 | + $where = "WHERE ".implode(" AND ", $where); |
|
233 | 233 | } else { |
234 | 234 | $where = ''; |
235 | 235 | } |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | { |
257 | 257 | $where = array(); |
258 | 258 | $out = array(); |
259 | - $from = $this->table . " " . $this->_filters['join']; |
|
259 | + $from = $this->table." ".$this->_filters['join']; |
|
260 | 260 | $tmpWhere = $this->getCFGDef('addWhereList', ''); |
261 | 261 | $tmpWhere = sqlHelper::trimLogicalOp($tmpWhere); |
262 | 262 | |
263 | 263 | //====== block added by Dreamer to enable filters ====== |
264 | - $tmpWhere = ($tmpWhere ? $tmpWhere . ' AND ' : '') . $this->_filters['where']; |
|
264 | + $tmpWhere = ($tmpWhere ? $tmpWhere.' AND ' : '').$this->_filters['where']; |
|
265 | 265 | $tmpWhere = sqlHelper::trimLogicalOp($tmpWhere); |
266 | 266 | //------- end of block ------- |
267 | 267 | |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | |
274 | 274 | $tmpWhere = null; |
275 | 275 | if ($sanitarInIDs != "''") { |
276 | - $tmpWhere = "({$this->getParentField()} IN (" . $sanitarInIDs . ")"; |
|
276 | + $tmpWhere = "({$this->getParentField()} IN (".$sanitarInIDs.")"; |
|
277 | 277 | switch ($this->getCFGDef('showParent', '0')) { |
278 | 278 | case -1: |
279 | 279 | $tmpWhere .= ")"; |
280 | 280 | break; |
281 | 281 | case 0: |
282 | - $tmpWhere .= " AND {$this->getPK()} NOT IN(" . $sanitarInIDs . "))"; |
|
282 | + $tmpWhere .= " AND {$this->getPK()} NOT IN(".$sanitarInIDs."))"; |
|
283 | 283 | break; |
284 | 284 | case 1: |
285 | 285 | default: |
@@ -290,16 +290,16 @@ discard block |
||
290 | 290 | if (($addDocs = $this->getCFGDef('documents', '')) != '') { |
291 | 291 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
292 | 292 | if (empty($tmpWhere)) { |
293 | - $tmpWhere = $this->getPK() . " IN({$addDocs})"; |
|
293 | + $tmpWhere = $this->getPK()." IN({$addDocs})"; |
|
294 | 294 | } else { |
295 | - $tmpWhere = "((" . $tmpWhere . ") OR {$this->getPK()} IN({$addDocs}))"; |
|
295 | + $tmpWhere = "((".$tmpWhere.") OR {$this->getPK()} IN({$addDocs}))"; |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | if (!empty($tmpWhere)) { |
299 | 299 | $where[] = $tmpWhere; |
300 | 300 | } |
301 | 301 | if (!empty($where)) { |
302 | - $where = "WHERE " . implode(" AND ", $where); |
|
302 | + $where = "WHERE ".implode(" AND ", $where); |
|
303 | 303 | } else { |
304 | 304 | $where = ''; |
305 | 305 | } |
@@ -329,11 +329,11 @@ discard block |
||
329 | 329 | $out = 0; |
330 | 330 | $sanitarInIDs = $this->sanitarIn($this->IDs); |
331 | 331 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) { |
332 | - $from = $this->table . " " . $this->_filters['join']; |
|
332 | + $from = $this->table." ".$this->_filters['join']; |
|
333 | 333 | $where = $this->getCFGDef('addWhereList', ''); |
334 | 334 | |
335 | 335 | //====== block added by Dreamer ====== |
336 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
336 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
337 | 337 | $where = sqlHelper::trimLogicalOp($where); |
338 | 338 | //------- end of block ------- |
339 | 339 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | } |
361 | 361 | if (($addDocs = $this->getCFGDef('documents', '')) != '') { |
362 | 362 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
363 | - $where[] = "((" . $tmpWhere . ") OR {$this->getPK()} IN({$addDocs}))"; |
|
363 | + $where[] = "((".$tmpWhere.") OR {$this->getPK()} IN({$addDocs}))"; |
|
364 | 364 | } else { |
365 | 365 | $where[] = $tmpWhere; |
366 | 366 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | } |
374 | 374 | if (!empty($where)) { |
375 | - $where = "WHERE " . implode(" AND ", $where); |
|
375 | + $where = "WHERE ".implode(" AND ", $where); |
|
376 | 376 | } else { |
377 | 377 | $where = ''; |
378 | 378 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $tmp = $this->getCFGDef('addWhereFolder', ''); |
400 | 400 | $where = "{$this->getParentField()} IN ({$sanitarInIDs})"; |
401 | 401 | if (!empty($tmp)) { |
402 | - $where .= " AND " . $tmp; |
|
402 | + $where .= " AND ".$tmp; |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | $rs = $this->dbQuery("SELECT {$this->getPK()} FROM {$this->table} WHERE {$where}"); |