@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $comments = $extJotCount->countComments(array_keys($this->_docs)); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $this->skippedDocs = 0; |
|
| 139 | + $this->skippedDocs = 0; |
|
| 140 | 140 | foreach ($this->_docs as $item) {
|
| 141 | 141 | $this->renderTPL = $tpl; |
| 142 | 142 | if ($extUser) {
|
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $findTpl = $this->renderTPL; |
| 172 | 172 | $tmp = $this->uniformPrepare($item, $i); |
| 173 | - extract($tmp, EXTR_SKIP); |
|
| 173 | + extract($tmp, EXTR_SKIP); |
|
| 174 | 174 | if ($this->renderTPL == '') {
|
| 175 | 175 | $this->renderTPL = $findTpl; |
| 176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | 'nameParam' => 'prepare' |
| 182 | 182 | )); |
| 183 | 183 | if (is_bool($item) && $item === false) {
|
| 184 | - $this->skippedDocs++; |
|
| 184 | + $this->skippedDocs++; |
|
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | $extSummary = $this->getExtender('summary');
|
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | - * @var $extPrepare prepare_DL_Extender |
|
| 221 | - */ |
|
| 220 | + * @var $extPrepare prepare_DL_Extender |
|
| 221 | + */ |
|
| 222 | 222 | $extPrepare = $this->getExtender('prepare');
|
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | - * @var $extE e_DL_Extender |
|
| 226 | - */ |
|
| 225 | + * @var $extE e_DL_Extender |
|
| 226 | + */ |
|
| 227 | 227 | $extE = $this->getExtender('e', true, true);
|
| 228 | 228 | |
| 229 | 229 | foreach ($data as $num => $item) {
|
@@ -291,18 +291,18 @@ discard block |
||
| 291 | 291 | if ($sanitarInIDs != "''") {
|
| 292 | 292 | switch ($this->getCFGDef('idType', 'parents')) {
|
| 293 | 293 | case 'parents': |
| 294 | - switch($this->getCFGDef('showParent', '0')){
|
|
| 295 | - case '-1': |
|
| 296 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")";
|
|
| 297 | - break; |
|
| 298 | - case 0: |
|
| 299 | - $tmpWhere = "c.parent IN ({$sanitarInIDs}) AND c.id NOT IN({$sanitarInIDs})";
|
|
| 300 | - break; |
|
| 301 | - case 1: |
|
| 302 | - default: |
|
| 303 | - $tmpWhere = "(c.parent IN ({$sanitarInIDs}) OR c.id IN({$sanitarInIDs}))";
|
|
| 304 | - break; |
|
| 305 | - } |
|
| 294 | + switch($this->getCFGDef('showParent', '0')){
|
|
| 295 | + case '-1': |
|
| 296 | + $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")";
|
|
| 297 | + break; |
|
| 298 | + case 0: |
|
| 299 | + $tmpWhere = "c.parent IN ({$sanitarInIDs}) AND c.id NOT IN({$sanitarInIDs})";
|
|
| 300 | + break; |
|
| 301 | + case 1: |
|
| 302 | + default: |
|
| 303 | + $tmpWhere = "(c.parent IN ({$sanitarInIDs}) OR c.id IN({$sanitarInIDs}))";
|
|
| 304 | + break; |
|
| 305 | + } |
|
| 306 | 306 | if (($addDocs = $this->getCFGDef('documents', '')) != '') {
|
| 307 | 307 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
| 308 | 308 | $whereArr[] = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))";
|
@@ -458,17 +458,17 @@ discard block |
||
| 458 | 458 | $tmpWhere = null; |
| 459 | 459 | if ($sanitarInIDs != "''") {
|
| 460 | 460 | switch($this->getCFGDef('showParent', '0')){
|
| 461 | - case '-1': |
|
| 462 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")";
|
|
| 463 | - break; |
|
| 464 | - case 0: |
|
| 465 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ") AND c.id NOT IN(" . $sanitarInIDs . ")";
|
|
| 466 | - break; |
|
| 467 | - case 1: |
|
| 468 | - default: |
|
| 469 | - $tmpWhere = "(c.parent IN (" . $sanitarInIDs . ") OR c.id IN({$sanitarInIDs}))";
|
|
| 470 | - break; |
|
| 471 | - } |
|
| 461 | + case '-1': |
|
| 462 | + $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")";
|
|
| 463 | + break; |
|
| 464 | + case 0: |
|
| 465 | + $tmpWhere = "c.parent IN (" . $sanitarInIDs . ") AND c.id NOT IN(" . $sanitarInIDs . ")";
|
|
| 466 | + break; |
|
| 467 | + case 1: |
|
| 468 | + default: |
|
| 469 | + $tmpWhere = "(c.parent IN (" . $sanitarInIDs . ") OR c.id IN({$sanitarInIDs}))";
|
|
| 470 | + break; |
|
| 471 | + } |
|
| 472 | 472 | } |
| 473 | 473 | if (($addDocs = $this->getCFGDef('documents', '')) != '') {
|
| 474 | 474 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | $id = ((int)$id > 0) ? (int)$id : $this->getCurrentMODXPageID(); |
| 46 | 46 | |
| 47 | 47 | $link = $this->checkExtender('request') ? $this->extender['request']->getLink() : $this->getRequest();
|
| 48 | - if($id == $this->modx->config['site_start']){
|
|
| 48 | + if ($id == $this->modx->config['site_start']) {
|
|
| 49 | 49 | $url = $this->modx->config['site_url'].($link != '' ? "?{$link}" : "");
|
| 50 | - }else{
|
|
| 50 | + } else {
|
|
| 51 | 51 | $url = $this->modx->makeUrl($id, '', $link, $this->getCFGDef('urlScheme', ''));
|
| 52 | 52 | } |
| 53 | 53 | return $url; |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $item['title'] = ($item['menutitle'] == '' ? $item['pagetitle'] : $item['menutitle']); |
| 156 | 156 | |
| 157 | - if($this->getCFGDef('makeUrl', 1)){
|
|
| 158 | - if($item['type'] == 'reference'){
|
|
| 157 | + if ($this->getCFGDef('makeUrl', 1)) {
|
|
| 158 | + if ($item['type'] == 'reference') {
|
|
| 159 | 159 | $item['url'] = is_numeric($item['content']) ? $this->modx->makeUrl($item['content'], '', '', $this->getCFGDef('urlScheme', '')) : $item['content'];
|
| 160 | - }else{
|
|
| 160 | + } else {
|
|
| 161 | 161 | $item['url'] = $this->modx->makeUrl($item['id'], '', '', $this->getCFGDef('urlScheme', ''));
|
| 162 | 162 | } |
| 163 | 163 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $tmp = $this->parseChunk($this->renderTPL, $item); |
| 189 | 189 | |
| 190 | 190 | if ($this->getCFGDef('contentPlaceholder', 0) !== 0) {
|
| 191 | - $this->toPlaceholders($tmp, 1, "item[" . $i . "]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
| 191 | + $this->toPlaceholders($tmp, 1, "item[".$i."]"); // [+item[x]+] – individual placeholder for each iteration documents on this page |
|
| 192 | 192 | } |
| 193 | 193 | $out .= $tmp; |
| 194 | 194 | $i++; |
@@ -228,25 +228,25 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | foreach ($data as $num => $item) {
|
| 230 | 230 | $row = $item; |
| 231 | - if((array('1') == $fields || in_array('summary', $fields)) && $extSummary) {
|
|
| 231 | + if ((array('1') == $fields || in_array('summary', $fields)) && $extSummary) {
|
|
| 232 | 232 | $row['summary'] = $this->getSummary($this->_docs[$num], $extSummary, 'introtext', 'content'); |
| 233 | 233 | } |
| 234 | - if(array('1') == $fields || in_array('date', $fields)) {
|
|
| 234 | + if (array('1') == $fields || in_array('date', $fields)) {
|
|
| 235 | 235 | $tmp = (isset($this->_docs[$num][$date]) && $date != 'createdon' && $this->_docs[$num][$date] != 0 && $this->_docs[$num][$date] == (int)$this->_docs[$num][$date]) ? $this->_docs[$num][$date] : $this->_docs[$num]['createdon']; |
| 236 | 236 | $row['date'] = strftime($this->getCFGDef('dateFormat', '%d.%b.%y %H:%M'), $tmp + $this->modx->config['server_offset_time']);
|
| 237 | 237 | } |
| 238 | - if(array('1') == $fields || in_array(array('menutitle', 'pagetitle'), $fields)) {
|
|
| 238 | + if (array('1') == $fields || in_array(array('menutitle', 'pagetitle'), $fields)) {
|
|
| 239 | 239 | $row['title'] = ($row['menutitle'] == '' ? $row['pagetitle'] : $row['menutitle']); |
| 240 | 240 | } |
| 241 | - if((bool)$this->getCFGDef('makeUrl', 1) && (array('1') == $fields || in_array(array('content', 'type'), $fields))){
|
|
| 242 | - if($row['type'] == 'reference'){
|
|
| 241 | + if ((bool)$this->getCFGDef('makeUrl', 1) && (array('1') == $fields || in_array(array('content', 'type'), $fields))) {
|
|
| 242 | + if ($row['type'] == 'reference') {
|
|
| 243 | 243 | $row['url'] = is_numeric($row['content']) ? $this->modx->makeUrl($row['content'], '', '', $this->getCFGDef('urlScheme', '')) : $row['content'];
|
| 244 | - }else{
|
|
| 244 | + } else {
|
|
| 245 | 245 | $row['url'] = $this->modx->makeUrl($row['id'], '', '', $this->getCFGDef('urlScheme', ''));
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - if($extE && $tmp = $extE->init($this, array('data' => $row))){
|
|
| 249 | - if(is_array($tmp)){
|
|
| 248 | + if ($extE && $tmp = $extE->init($this, array('data' => $row))) {
|
|
| 249 | + if (is_array($tmp)) {
|
|
| 250 | 250 | $row = $tmp; |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) {
|
| 275 | 275 | $where = $this->getCFGDef('addWhereList', '');
|
| 276 | 276 | $where = sqlHelper::trimLogicalOp($where); |
| 277 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
| 277 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
| 278 | 278 | if ($where != '' && $this->_filters['where'] != '') {
|
| 279 | 279 | $where .= " AND "; |
| 280 | 280 | } |
@@ -291,9 +291,9 @@ discard block |
||
| 291 | 291 | if ($sanitarInIDs != "''") {
|
| 292 | 292 | switch ($this->getCFGDef('idType', 'parents')) {
|
| 293 | 293 | case 'parents': |
| 294 | - switch($this->getCFGDef('showParent', '0')){
|
|
| 294 | + switch ($this->getCFGDef('showParent', '0')) {
|
|
| 295 | 295 | case '-1': |
| 296 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")";
|
|
| 296 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.")";
|
|
| 297 | 297 | break; |
| 298 | 298 | case 0: |
| 299 | 299 | $tmpWhere = "c.parent IN ({$sanitarInIDs}) AND c.id NOT IN({$sanitarInIDs})";
|
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | if (($addDocs = $this->getCFGDef('documents', '')) != '') {
|
| 307 | 307 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
| 308 | - $whereArr[] = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))";
|
|
| 308 | + $whereArr[] = "((".$tmpWhere.") OR c.id IN({$addDocs}))";
|
|
| 309 | 309 | } else {
|
| 310 | 310 | $whereArr[] = $tmpWhere; |
| 311 | 311 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | break; |
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | - $from = $tbl_site_content . " " . $this->_filters['join']; |
|
| 319 | + $from = $tbl_site_content." ".$this->_filters['join']; |
|
| 320 | 320 | $where = sqlHelper::trimLogicalOp($where); |
| 321 | 321 | |
| 322 | 322 | if (trim($where) != 'WHERE') {
|
@@ -347,12 +347,12 @@ discard block |
||
| 347 | 347 | $where = $this->getCFGDef('addWhereList', '');
|
| 348 | 348 | $where = sqlHelper::trimLogicalOp($where); |
| 349 | 349 | |
| 350 | - $where = ($where ? $where . ' AND ' : '') . $this->_filters['where']; |
|
| 350 | + $where = ($where ? $where.' AND ' : '').$this->_filters['where']; |
|
| 351 | 351 | $where = sqlHelper::trimLogicalOp($where); |
| 352 | 352 | |
| 353 | 353 | $tbl_site_content = $this->getTable('site_content', 'c');
|
| 354 | 354 | if ($sanitarInIDs != "''") {
|
| 355 | - $where .= ($where ? " AND " : "") . "c.id IN ({$sanitarInIDs}) AND";
|
|
| 355 | + $where .= ($where ? " AND " : "")."c.id IN ({$sanitarInIDs}) AND";
|
|
| 356 | 356 | } |
| 357 | 357 | $where = sqlHelper::trimLogicalOp($where); |
| 358 | 358 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | $fields = $this->getCFGDef('selectFields', 'c.*');
|
| 376 | 376 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id'));
|
| 377 | 377 | $sort = $this->SortOrderSQL("if(c.pub_date=0,c.createdon,c.pub_date)");
|
| 378 | - list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], $sort); |
|
| 378 | + list($tbl_site_content, $sort) = $this->injectSortByTV($tbl_site_content.' '.$this->_filters['join'], $sort); |
|
| 379 | 379 | |
| 380 | 380 | $limit = $this->LimitSQL($this->getCFGDef('queryLimit', 0));
|
| 381 | 381 | |
@@ -452,30 +452,30 @@ discard block |
||
| 452 | 452 | $tbl_site_content = $this->getTable('site_content', 'c');
|
| 453 | 453 | |
| 454 | 454 | $sort = $this->SortOrderSQL("if(c.pub_date=0,c.createdon,c.pub_date)");
|
| 455 | - list($from, $sort) = $this->injectSortByTV($tbl_site_content . ' ' . $this->_filters['join'], $sort); |
|
| 455 | + list($from, $sort) = $this->injectSortByTV($tbl_site_content.' '.$this->_filters['join'], $sort); |
|
| 456 | 456 | $sanitarInIDs = $this->sanitarIn($this->IDs); |
| 457 | 457 | |
| 458 | 458 | $tmpWhere = null; |
| 459 | 459 | if ($sanitarInIDs != "''") {
|
| 460 | - switch($this->getCFGDef('showParent', '0')){
|
|
| 460 | + switch ($this->getCFGDef('showParent', '0')) {
|
|
| 461 | 461 | case '-1': |
| 462 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ")";
|
|
| 462 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.")";
|
|
| 463 | 463 | break; |
| 464 | 464 | case 0: |
| 465 | - $tmpWhere = "c.parent IN (" . $sanitarInIDs . ") AND c.id NOT IN(" . $sanitarInIDs . ")";
|
|
| 465 | + $tmpWhere = "c.parent IN (".$sanitarInIDs.") AND c.id NOT IN(".$sanitarInIDs.")";
|
|
| 466 | 466 | break; |
| 467 | 467 | case 1: |
| 468 | 468 | default: |
| 469 | - $tmpWhere = "(c.parent IN (" . $sanitarInIDs . ") OR c.id IN({$sanitarInIDs}))";
|
|
| 469 | + $tmpWhere = "(c.parent IN (".$sanitarInIDs.") OR c.id IN({$sanitarInIDs}))";
|
|
| 470 | 470 | break; |
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | if (($addDocs = $this->getCFGDef('documents', '')) != '') {
|
| 474 | 474 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
| 475 | - if(empty($tmpWhere)){
|
|
| 475 | + if (empty($tmpWhere)) {
|
|
| 476 | 476 | $tmpWhere = "c.id IN({$addDocs})";
|
| 477 | - }else{
|
|
| 478 | - $tmpWhere = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))";
|
|
| 477 | + } else {
|
|
| 478 | + $tmpWhere = "((".$tmpWhere.") OR c.id IN({$addDocs}))";
|
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | if (!empty($tmpWhere)) {
|
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | $where[] = "c.deleted=0 AND c.published=1"; |
| 486 | 486 | } |
| 487 | 487 | if (!empty($where)) {
|
| 488 | - $where = "WHERE " . implode(" AND ", $where);
|
|
| 488 | + $where = "WHERE ".implode(" AND ", $where);
|
|
| 489 | 489 | } else {
|
| 490 | 490 | $where = ''; |
| 491 | 491 | } |
@@ -493,9 +493,9 @@ discard block |
||
| 493 | 493 | $group = $this->getGroupSQL($this->getCFGDef('groupBy', 'c.id'));
|
| 494 | 494 | |
| 495 | 495 | if ($sanitarInIDs != "''" || $this->getCFGDef('ignoreEmpty', '0')) {
|
| 496 | - $sql = $this->dbQuery("SELECT {$fields} FROM " . $from . " " . $where . " " .
|
|
| 497 | - $group . " ". |
|
| 498 | - $sort . " " . |
|
| 496 | + $sql = $this->dbQuery("SELECT {$fields} FROM ".$from." ".$where." ".
|
|
| 497 | + $group." ". |
|
| 498 | + $sort." ". |
|
| 499 | 499 | $this->LimitSQL($this->getCFGDef('queryLimit', 0))
|
| 500 | 500 | ); |
| 501 | 501 | |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $type = trim($type); |
| 514 | 514 | switch (strtoupper($type)) {
|
| 515 | 515 | case 'TVDATETIME': |
| 516 | - $field = "STR_TO_DATE(" . $field . ",'%d-%m-%Y %H:%i:%s')";
|
|
| 516 | + $field = "STR_TO_DATE(".$field.",'%d-%m-%Y %H:%i:%s')";
|
|
| 517 | 517 | break; |
| 518 | 518 | default: |
| 519 | 519 | $field = parent::changeSortType($field, $type); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $link = $this->checkExtender('request') ? $this->extender['request']->getLink() : $this->getRequest();
|
| 48 | 48 | if($id == $this->modx->config['site_start']){
|
| 49 | 49 | $url = $this->modx->config['site_url'].($link != '' ? "?{$link}" : "");
|
| 50 | - }else{
|
|
| 50 | + } else{
|
|
| 51 | 51 | $url = $this->modx->makeUrl($id, '', $link, $this->getCFGDef('urlScheme', ''));
|
| 52 | 52 | } |
| 53 | 53 | return $url; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | if($this->getCFGDef('makeUrl', 1)){
|
| 158 | 158 | if($item['type'] == 'reference'){
|
| 159 | 159 | $item['url'] = is_numeric($item['content']) ? $this->modx->makeUrl($item['content'], '', '', $this->getCFGDef('urlScheme', '')) : $item['content'];
|
| 160 | - }else{
|
|
| 160 | + } else{
|
|
| 161 | 161 | $item['url'] = $this->modx->makeUrl($item['id'], '', '', $this->getCFGDef('urlScheme', ''));
|
| 162 | 162 | } |
| 163 | 163 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | if((bool)$this->getCFGDef('makeUrl', 1) && (array('1') == $fields || in_array(array('content', 'type'), $fields))){
|
| 242 | 242 | if($row['type'] == 'reference'){
|
| 243 | 243 | $row['url'] = is_numeric($row['content']) ? $this->modx->makeUrl($row['content'], '', '', $this->getCFGDef('urlScheme', '')) : $row['content'];
|
| 244 | - }else{
|
|
| 244 | + } else{
|
|
| 245 | 245 | $row['url'] = $this->modx->makeUrl($row['id'], '', '', $this->getCFGDef('urlScheme', ''));
|
| 246 | 246 | } |
| 247 | 247 | } |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | $addDocs = $this->sanitarIn($this->cleanIDs($addDocs)); |
| 475 | 475 | if(empty($tmpWhere)){
|
| 476 | 476 | $tmpWhere = "c.id IN({$addDocs})";
|
| 477 | - }else{
|
|
| 477 | + } else{
|
|
| 478 | 478 | $tmpWhere = "((" . $tmpWhere . ") OR c.id IN({$addDocs}))";
|
| 479 | 479 | } |
| 480 | 480 | } |