Completed
Pull Request — develop (#689)
by Alexander
05:50
created
manager/includes/extenders/ex_modifiers.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
     return true;
10 10
 }
11 11
 
12
-include_once(MODX_MANAGER_PATH . 'includes/extenders/modifiers.class.inc.php');
12
+include_once(MODX_MANAGER_PATH.'includes/extenders/modifiers.class.inc.php');
13 13
 $this->filter = new MODIFIERS;
14 14
 return true;
Please login to merge, or discard this patch.
manager/includes/extenders/ex_managerapi.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * Time: 14:16
6 6
  */
7 7
 
8
-if (!include_once MODX_MANAGER_PATH . 'includes/extenders/manager.api.class.inc.php') {
8
+if (!include_once MODX_MANAGER_PATH.'includes/extenders/manager.api.class.inc.php') {
9 9
     return false;
10 10
 } else {
11 11
     $this->manager = new ManagerAPI;
Please login to merge, or discard this patch.
manager/includes/extenders/maketable.class.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function setTableWidth($value)
132 132
     {
133
-        $this->tableWidth = (int)$value;
133
+        $this->tableWidth = (int) $value;
134 134
     }
135 135
 
136 136
     /**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     {
318 318
         $currentWidth = '';
319 319
         if (is_array($this->columnWidths)) {
320
-            $currentWidth = $this->columnWidths[$columnPosition] ? ' width="' . $this->columnWidths[$columnPosition] . '" ' : '';
320
+            $currentWidth = $this->columnWidths[$columnPosition] ? ' width="'.$this->columnWidths[$columnPosition].'" ' : '';
321 321
         }
322 322
 
323 323
         return $currentWidth;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             $currentClass = $this->rowAlternateClass;
347 347
         }
348 348
 
349
-        return ' class="' . $currentClass . '"';
349
+        return ' class="'.$currentClass.'"';
350 350
     }
351 351
 
352 352
     /**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     {
361 361
         $cellAction = '';
362 362
         if ($this->cellAction) {
363
-            $cellAction = ' onClick="javascript:window.location=\'' . $this->cellAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '\'" ';
363
+            $cellAction = ' onClick="javascript:window.location=\''.$this->cellAction.$this->actionField.'='.urlencode($currentActionFieldValue).'\'" ';
364 364
         }
365 365
 
366 366
         return $cellAction;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     {
378 378
         $cell = $value;
379 379
         if ($this->linkAction) {
380
-            $cell = '<a href="' . $this->linkAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '">' . $cell . '</a>';
380
+            $cell = '<a href="'.$this->linkAction.$this->actionField.'='.urlencode($currentActionFieldValue).'">'.$cell.'</a>';
381 381
         }
382 382
 
383 383
         return $cell;
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $end = '?';
407 407
         }
408 408
 
409
-        return $link . $end;
409
+        return $link.$end;
410 410
     }
411 411
 
412 412
     /**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         if (is_array($fieldsArray)) {
427 427
             $i = 0;
428 428
             foreach ($fieldsArray as $fieldName => $fieldValue) {
429
-                $table .= "\t<tr" . $this->determineRowClass($i) . ">\n";
429
+                $table .= "\t<tr".$this->determineRowClass($i).">\n";
430 430
                 $currentActionFieldValue = $fieldValue[$this->actionField];
431 431
                 if (is_array($this->selectedValues)) {
432 432
                     $isChecked = array_search($currentActionFieldValue, $this->selectedValues) === false ? 0 : 1;
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
                 $colPosition = 0;
438 438
                 foreach ($fieldValue as $key => $value) {
439 439
                     if (!in_array($key, $this->excludeFields)) {
440
-                        $table .= "\t\t<td" . $this->getCellAction($currentActionFieldValue) . ">";
440
+                        $table .= "\t\t<td".$this->getCellAction($currentActionFieldValue).">";
441 441
                         $table .= $this->createCellText($currentActionFieldValue, $value);
442 442
                         $table .= "</td>\n";
443 443
                         if ($i == 0) {
444 444
                             if (empty ($header) && $this->formElementType) {
445
-                                $header .= "\t\t<th style=\"width:32px\" " . ($this->thClass ? 'class="' . $this->thClass . '"' : '') . ">" . ($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '') . "</th>\n";
445
+                                $header .= "\t\t<th style=\"width:32px\" ".($this->thClass ? 'class="'.$this->thClass.'"' : '').">".($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '')."</th>\n";
446 446
                             }
447 447
                             $headerText = array_key_exists($key, $fieldHeadersArray) ? $fieldHeadersArray[$key] : $key;
448
-                            $header .= "\t\t<th" . $this->getColumnWidth($colPosition) . ($this->thClass ? ' class="' . $this->thClass . '" ' : '') . ">" . $headerText . "</th>\n";
448
+                            $header .= "\t\t<th".$this->getColumnWidth($colPosition).($this->thClass ? ' class="'.$this->thClass.'" ' : '').">".$headerText."</th>\n";
449 449
                         }
450 450
                         $colPosition++;
451 451
                     }
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
                 $i++;
454 454
                 $table .= "\t</tr>\n";
455 455
             }
456
-            $table = "\n" . '<table' . ($this->tableWidth > 0 ? ' width="' . $this->tableWidth . '"' : '') . ($this->tableClass ? ' class="' . $this->tableClass . '"' : '') . ($this->tableID ? ' id="' . $this->tableID . '"' : '') . ">\n" . ($header ? "\t<thead>\n\t<tr class=\"" . $this->rowHeaderClass . "\">\n" . $header . "\t</tr>\n\t</thead>\n" : '') . $table . "</table>\n";
456
+            $table = "\n".'<table'.($this->tableWidth > 0 ? ' width="'.$this->tableWidth.'"' : '').($this->tableClass ? ' class="'.$this->tableClass.'"' : '').($this->tableID ? ' id="'.$this->tableID.'"' : '').">\n".($header ? "\t<thead>\n\t<tr class=\"".$this->rowHeaderClass."\">\n".$header."\t</tr>\n\t</thead>\n" : '').$table."</table>\n";
457 457
             if ($this->formElementType) {
458
-                $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table;
458
+                $table = "\n".'<form id="'.$this->formName.'" name="'.$this->formName.'" action="'.$this->formAction.'" method="POST">'.$table;
459 459
             }
460 460
             if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists.
461 461
                 /* commented this part because of cookie
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
                 $table .= '</select>'.$_lang["pagination_table_perpage"].'</div>';
471 471
                 */
472
-                $table .= '<div id="pagination" class="paginate">' . $_lang["pagination_table_gotopage"] . '<ul>' . $this->pageNav . '</ul></div>';
472
+                $table .= '<div id="pagination" class="paginate">'.$_lang["pagination_table_gotopage"].'<ul>'.$this->pageNav.'</ul></div>';
473 473
                 //$table .= '<script language="javascript">function updatePageSize(size){window.location = \''.$this->prepareLink($linkpage).'pageSize=\'+size;}</script>';
474 474
 
475 475
             }
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 <script language="javascript">
479 479
 	toggled = 0;
480 480
 	function clickAll() {
481
-		myform = document.getElementById("' . $this->formName . '");
481
+		myform = document.getElementById("' . $this->formName.'");
482 482
 		for(i=0;i<myform.length;i++) {
483 483
 			if(myform.elements[i].type==\'checkbox\') {
484 484
 				myform.elements[i].checked=(toggled?false:true);
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
             }
491 491
             if ($this->formElementType) {
492 492
                 if ($this->extra) {
493
-                    $table .= "\n" . $this->extra . "\n";
493
+                    $table .= "\n".$this->extra."\n";
494 494
                 }
495
-                $table .= "\n" . '</form>' . "\n";
495
+                $table .= "\n".'</form>'."\n";
496 496
             }
497 497
 
498 498
             return $table;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         $numPages = ceil($numRecords / MAX_DISPLAY_RECORDS_NUM);
516 516
         $nav = '';
517 517
         if ($numPages > 1) {
518
-            $currentURL = empty($qs) ? '' : '?' . $qs;
518
+            $currentURL = empty($qs) ? '' : '?'.$qs;
519 519
             if ($currentPage > 6) {
520 520
                 $nav .= $this->createPageLink($currentURL, 1, $_lang["pagination_table_first"]);
521 521
             }
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
                 $nav .= $this->createPageLink($currentURL, $numPages, $_lang["pagination_table_last"]);
541 541
             }
542 542
         }
543
-        $this->pageNav = ' ' . $nav;
543
+        $this->pageNav = ' '.$nav;
544 544
     }
545 545
 
546 546
     /**
@@ -556,14 +556,14 @@  discard block
 block discarded – undo
556 556
     public function createPageLink($link = '', $pageNum, $displayText, $currentPage = false, $qs = '')
557 557
     {
558 558
         global $modx;
559
-        $orderBy = !empty($_GET['orderby']) ? '&orderby=' . $_GET['orderby'] : '';
560
-        $orderDir = !empty($_GET['orderdir']) ? '&orderdir=' . $_GET['orderdir'] : '';
559
+        $orderBy = !empty($_GET['orderby']) ? '&orderby='.$_GET['orderby'] : '';
560
+        $orderDir = !empty($_GET['orderdir']) ? '&orderdir='.$_GET['orderdir'] : '';
561 561
         if (!empty($qs)) {
562 562
             $qs = "?$qs";
563 563
         }
564 564
         $link = empty($link) ? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'],
565
-            $qs . "page=$pageNum$orderBy$orderDir") : $this->prepareLink($link) . "page=$pageNum";
566
-        $nav = '<li' . ($currentPage ? ' class="currentPage"' : '') . '><a' . ($currentPage ? ' class="currentPage"' : '') . ' href="' . $link . '">' . $displayText . '</a></li>' . "\n";
565
+            $qs."page=$pageNum$orderBy$orderDir") : $this->prepareLink($link)."page=$pageNum";
566
+        $nav = '<li'.($currentPage ? ' class="currentPage"' : '').'><a'.($currentPage ? ' class="currentPage"' : '').' href="'.$link.'">'.$displayText.'</a></li>'."\n";
567 567
 
568 568
         return $nav;
569 569
     }
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
         $field = '';
582 582
         if ($this->formElementType) {
583 583
             $checked = $isChecked ? "checked " : "";
584
-            $field = "\t\t" . '<td><input type="' . $this->formElementType . '" name="' . ($this->formElementName ? $this->formElementName : $value) . '"  value="' . $value . '" ' . $checked . '/></td>' . "\n";
584
+            $field = "\t\t".'<td><input type="'.$this->formElementType.'" name="'.($this->formElementName ? $this->formElementName : $value).'"  value="'.$value.'" '.$checked.'/></td>'."\n";
585 585
         }
586 586
 
587 587
         return $field;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
     public function handlePaging()
596 596
     {
597 597
         $offset = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0;
598
-        $limitClause = ' LIMIT ' . ($offset * MAX_DISPLAY_RECORDS_NUM) . ', ' . MAX_DISPLAY_RECORDS_NUM;
598
+        $limitClause = ' LIMIT '.($offset * MAX_DISPLAY_RECORDS_NUM).', '.MAX_DISPLAY_RECORDS_NUM;
599 599
 
600 600
         return $limitClause;
601 601
     }
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
     public function handleSorting($natural_order = false)
611 611
     {
612 612
         $orderByClause = '';
613
-        if ((bool)$natural_order === false) {
613
+        if ((bool) $natural_order === false) {
614 614
             $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : "id";
615 615
             $orderdir = !empty($_GET['orderdir']) ? $_GET['orderdir'] : "DESC";
616
-            $orderByClause = !empty($orderby) ? ' ORDER BY ' . $orderby . ' ' . $orderdir . ' ' : "";
616
+            $orderByClause = !empty($orderby) ? ' ORDER BY '.$orderby.' '.$orderdir.' ' : "";
617 617
         }
618 618
 
619 619
         return $orderByClause;
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
             }
643 643
         }
644 644
 
645
-        return '<a href="[~' . $modx->documentIdentifier . '~]?' . $qs . 'orderby=' . $key . $orderDir . '">' . $text . '</a>';
645
+        return '<a href="[~'.$modx->documentIdentifier.'~]?'.$qs.'orderby='.$key.$orderDir.'">'.$text.'</a>';
646 646
     }
647 647
 
648 648
 }
Please login to merge, or discard this patch.
manager/includes/extenders/ex_modxmailer.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * Time: 14:17
7 7
  */
8 8
 
9
-if (!include_once(MODX_MANAGER_PATH . 'includes/extenders/modxmailer.class.inc.php')) {
9
+if (!include_once(MODX_MANAGER_PATH.'includes/extenders/modxmailer.class.inc.php')) {
10 10
     return false;
11 11
 } else {
12 12
     $this->mail = new MODxMailer;
Please login to merge, or discard this patch.
manager/includes/mutate_settings.ajax.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
7 7
 }
8 8
 
9
-require_once(dirname(__FILE__) . '/protect.inc.php');
9
+require_once(dirname(__FILE__).'/protect.inc.php');
10 10
 
11 11
 $action = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $_POST['action']);
12 12
 $lang = preg_replace('/[^A-Za-z0-9_\s\+\-\.\/]/', '', $_POST['lang']);
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 
24 24
 switch (true) {
25 25
     case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/',
26
-            $lang) && file_exists(dirname(__FILE__) . '/lang/' . $lang . '.inc.php')): {
27
-        include(dirname(__FILE__) . '/lang/' . $lang . '.inc.php');
26
+            $lang) && file_exists(dirname(__FILE__).'/lang/'.$lang.'.inc.php')): {
27
+        include(dirname(__FILE__).'/lang/'.$lang.'.inc.php');
28 28
         $str = isset($key, $_lang, $_lang[$key]) ? $_lang[$key] : "";
29 29
         break;
30 30
     }
31 31
     case ($action == 'setsetting' && !empty($key) && !empty($value)): {
32
-        $sql = "REPLACE INTO " . $modx->getFullTableName("system_settings") . " (setting_name, setting_value) VALUES('{$key}', '{$value}');";
32
+        $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) VALUES('{$key}', '{$value}');";
33 33
         $str = "true";
34 34
         $modx->db->query($sql);
35 35
         $emptyCache = true;
Please login to merge, or discard this patch.
manager/includes/rss.inc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 ---------------------------------------------- */
28 28
 
29 29
 // include MagPieRSS
30
-require_once(MODX_MANAGER_PATH . 'media/rss/rss_fetch.inc');
30
+require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc');
31 31
 /**
32 32
  * Convert relative path into absolute url
33 33
  *
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     $tmp = parse_url($base);
42 42
     extract($tmp);
43 43
     if (strpos($rel, "//") === 0) {
44
-        return $scheme . ':' . $rel;
44
+        return $scheme.':'.$rel;
45 45
     }
46 46
     // return if already absolute URL
47 47
     if (parse_url($rel, PHP_URL_SCHEME) != '') {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     }
50 50
     // queries and anchors
51 51
     if ($rel[0] == '#' || $rel[0] == '?') {
52
-        return $base . $rel;
52
+        return $base.$rel;
53 53
     }
54 54
     // remove non-directory element from path
55 55
     $path = preg_replace('#/[^/]*$#', '', $path);
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
         $path = '';
59 59
     }
60 60
     // dirty absolute URL
61
-    $abs = $host . $path . "/" . $rel;
61
+    $abs = $host.$path."/".$rel;
62 62
     // replace '//' or  '/./' or '/foo/../' with '/'
63 63
     $abs = preg_replace("/(\/\.?\/)/", "/", $abs);
64 64
     $abs = preg_replace("/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs);
65 65
 
66 66
     // absolute URL is ready!
67
-    return $scheme . '://' . $abs;
67
+    return $scheme.'://'.$abs;
68 68
 }
69 69
 
70 70
 $feedData = array();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     $output = '';
75 75
     $rss = @fetch_rss($url);
76 76
     if (!$rss) {
77
-        $feedData[$section] = 'Failed to retrieve ' . $url;
77
+        $feedData[$section] = 'Failed to retrieve '.$url;
78 78
         continue;
79 79
     }
80 80
     $output .= '<ul>';
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
         $description = strip_tags($item['description']);
89 89
         if (strlen($description) > 199) {
90 90
             $description = substr($description, 0, 200);
91
-            $description .= '...<br />Read <a href="' . $href . '" target="_blank">more</a>.';
91
+            $description .= '...<br />Read <a href="'.$href.'" target="_blank">more</a>.';
92 92
         }
93
-        $output .= '<li><a href="' . $href . '" target="_blank">' . $title . '</a> - <b>' . $pubdate . '</b><br />' . $description . '</li>';
93
+        $output .= '<li><a href="'.$href.'" target="_blank">'.$title.'</a> - <b>'.$pubdate.'</b><br />'.$description.'</li>';
94 94
     }
95 95
 
96 96
     $output .= '</ul>';
Please login to merge, or discard this patch.
manager/includes/config_check.inc.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 // PROCESSOR FIRST
7
-if($_SESSION['mgrRole'] == 1) {
8
-	if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
7
+if ($_SESSION['mgrRole'] == 1) {
8
+	if ($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) {
9 9
 		$current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']);
10
-		if(!empty($current)) {
10
+		if (!empty($current)) {
11 11
 			$modx->manager->setSystemChecksum($current);
12 12
 			$modx->clearCache('full');
13 13
 			$modx->config['sys_files_checksum'] = $current;
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 $warningspresent = 0;
20 20
 
21 21
 $sysfiles_check = $modx->manager->checkSystemChecksum();
22
-if ($sysfiles_check!=='0'){
22
+if ($sysfiles_check !== '0') {
23 23
       $warningspresent = 1;
24 24
       $warnings[] = array($_lang['configcheck_sysfiles_mod']);
25 25
 }
26 26
 
27
-if (is_writable("includes/config.inc.php")){
27
+if (is_writable("includes/config.inc.php")) {
28 28
     // Warn if world writable
29
-    if(@fileperms('includes/config.inc.php') & 0x0002) {
29
+    if (@fileperms('includes/config.inc.php') & 0x0002) {
30 30
       $warningspresent = 1;
31 31
       $warnings[] = array($_lang['configcheck_configinc']);
32 32
     }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $warnings[] = array($_lang['configcheck_php_gdzip']);
43 43
 }
44 44
 
45
-if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') {
46
-    if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') {
45
+if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') {
46
+    if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') {
47 47
         if ($modx->db->getValue($modx->db->select('COUNT(setting_value)', $modx->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) {
48 48
             $warningspresent = 1;
49 49
             $warnings[] = array($_lang['configcheck_validate_referer']);
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 }
53 53
 
54 54
 // check for Template Switcher plugin
55
-if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') {
56
-    if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') {
55
+if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') {
56
+    if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') {
57 57
         $rs = $modx->db->select('name, disabled', $modx->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'");
58 58
         $row = $modx->db->getRow($rs);
59
-        if($row && $row['disabled'] == 0) {
59
+        if ($row && $row['disabled'] == 0) {
60 60
             $warningspresent = 1;
61 61
             $warnings[] = array($_lang['configcheck_templateswitcher_present']);
62 62
             $tplName = $row['name'];
@@ -120,36 +120,36 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * @return bool
122 122
      */
123
-    function checkSiteCache() {
123
+    function checkSiteCache(){
124 124
         global $modx;
125
-        $checked= true;
126
-        if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) {
127
-            $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php');
125
+        $checked = true;
126
+        if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) {
127
+            $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php');
128 128
         }
129 129
         return $checked;
130 130
     }
131 131
 }
132 132
 
133
-if (!is_writable(MODX_BASE_PATH . "assets/cache/")) {
133
+if (!is_writable(MODX_BASE_PATH."assets/cache/")) {
134 134
     $warningspresent = 1;
135 135
     $warnings[] = array($_lang['configcheck_cache']);
136 136
 }
137 137
 
138 138
 if (!checkSiteCache()) {
139 139
     $warningspresent = 1;
140
-    $warnings[]= array($lang['configcheck_sitecache_integrity']);
140
+    $warnings[] = array($lang['configcheck_sitecache_integrity']);
141 141
 }
142 142
 
143
-if (!is_writable(MODX_BASE_PATH . "assets/images/")) {
143
+if (!is_writable(MODX_BASE_PATH."assets/images/")) {
144 144
     $warningspresent = 1;
145 145
     $warnings[] = array($_lang['configcheck_images']);
146 146
 }
147 147
 
148
-if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) {
148
+if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) {
149 149
     $warningspresent = 1;
150 150
     $warnings[] = array($_lang['configcheck_rb_base_dir']);
151 151
 }
152
-if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) {
152
+if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) {
153 153
     $warningspresent = 1;
154 154
     $warnings[] = array($_lang['configcheck_filemanager_path']);
155 155
 }
@@ -157,36 +157,36 @@  discard block
 block discarded – undo
157 157
 // clear file info cache
158 158
 clearstatcache();
159 159
 
160
-if ($warningspresent==1) {
160
+if ($warningspresent == 1) {
161 161
 
162
-if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3';
162
+if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3';
163 163
 $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>";
164 164
 
165
-for ($i=0;$i<count($warnings);$i++) {
165
+for ($i = 0; $i < count($warnings); $i++) {
166 166
     switch ($warnings[$i][0]) {
167 167
         case $_lang['configcheck_configinc'];
168 168
             $warnings[$i][1] = $_lang['configcheck_configinc_msg'];
169
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']);
169
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']);
170 170
             break;
171 171
         case $_lang['configcheck_installer'] :
172 172
             $warnings[$i][1] = $_lang['configcheck_installer_msg'];
173
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']);
173
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']);
174 174
             break;
175 175
         case $_lang['configcheck_cache'] :
176 176
             $warnings[$i][1] = $_lang['configcheck_cache_msg'];
177
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']);
177
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']);
178 178
             break;
179 179
         case $_lang['configcheck_images'] :
180 180
             $warnings[$i][1] = $_lang['configcheck_images_msg'];
181
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']);
181
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']);
182 182
             break;
183 183
         case $_lang['configcheck_sysfiles_mod']:
184 184
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
185
-			$warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>';
186
-			if($modx->hasPermission('settings')) {
187
-				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>';
185
+			$warnings[$i][2] = '<ul><li>'.implode('</li><li>', $sysfiles_check).'</li></ul>';
186
+			if ($modx->hasPermission('settings')) {
187
+				$warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\''.$_lang["reset_sysfiles_checksum_alert"].'\')">'.$_lang["reset_sysfiles_checksum_button"].'</a></li></ul>';
188 188
 			}
189
-            if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']);
189
+            if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1]." ".implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']);
190 190
             break;
191 191
         case $_lang['configcheck_lang_difference'] :
192 192
             $warnings[$i][1] = $_lang['configcheck_lang_difference_msg'];
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
             break;
209 209
         case $_lang['configcheck_validate_referer'] :
210 210
             $msg = $_lang['configcheck_validate_referer_msg'];
211
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
211
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
212 212
             $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n";
213 213
             break;
214 214
         case $_lang['configcheck_templateswitcher_present'] :
215 215
             $msg = $_lang["configcheck_templateswitcher_present_msg"];
216
-            if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
217
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"];
216
+            if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
217
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"];
218 218
             }
219
-            if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
220
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"];
219
+            if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
220
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"];
221 221
             }
222
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
222
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
223 223
             $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n";
224 224
             break;
225 225
         case $_lang['configcheck_rb_base_dir'] :
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $warnings[$i][1] = $_lang['configcheck_default_msg'];
233 233
     }
234 234
 
235
-    $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ;
235
+    $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : "";
236 236
     $config_check_results .= "
237 237
             <fieldset>
238 238
             <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p>
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
             ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')."
242 242
             </fieldset>
243 243
 ";
244
-        if ($i!=count($warnings)-1) {
244
+        if ($i != count($warnings) - 1) {
245 245
             $config_check_results .= "<br />";
246 246
         }
247 247
     }
248
-    $_SESSION["mgrConfigCheck"]=true;
248
+    $_SESSION["mgrConfigCheck"] = true;
249 249
 } else {
250 250
     $config_check_results = $_lang['configcheck_ok'];
251 251
 }
Please login to merge, or discard this patch.
manager/includes/tmplvars.format.inc.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -15,38 +15,38 @@  discard block
 block discarded – undo
15 15
  * @param string $sep
16 16
  * @return mixed|string
17 17
  */
18
-function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') {
18
+function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = ''){
19 19
 
20 20
 	global $modx;
21 21
     $o = '';
22 22
 
23 23
     // process any TV commands in value
24
-	$docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
24
+	$docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
25 25
 	$value = ProcessTVCommand($value, $name, $docid);
26 26
 
27 27
 	$params = array();
28
-	if($paramstring) {
28
+	if ($paramstring) {
29 29
 		$cp = explode("&", $paramstring);
30
-		foreach($cp as $p => $v) {
30
+		foreach ($cp as $p => $v) {
31 31
 			$v = trim($v); // trim
32 32
 			$ar = explode("=", $v);
33
-			if(is_array($ar) && count($ar) == 2) {
33
+			if (is_array($ar) && count($ar) == 2) {
34 34
 				$params[$ar[0]] = decodeParamValue($ar[1]);
35 35
 			}
36 36
 		}
37 37
 	}
38 38
 
39 39
 	$id = "tv$name";
40
-	switch($format) {
40
+	switch ($format) {
41 41
 		case 'image':
42 42
 			$images = parseInput($value, '||', 'array');
43
-			foreach($images as $image) {
44
-				if(!is_array($image)) {
43
+			foreach ($images as $image) {
44
+				if (!is_array($image)) {
45 45
 					$image = explode('==', $image);
46 46
 				}
47 47
 				$src = $image[0];
48 48
 
49
-				if($src) {
49
+				if ($src) {
50 50
 					// We have a valid source
51 51
 					$attributes = '';
52 52
 					$attr = array(
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 						'alt' => $modx->htmlspecialchars($params['alttext']),
57 57
 						'style' => $params['style']
58 58
 					);
59
-					if(isset($params['align']) && $params['align'] != 'none') {
59
+					if (isset($params['align']) && $params['align'] != 'none') {
60 60
 						$attr['align'] = $params['align'];
61 61
 					}
62
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
63
-					$attributes .= ' ' . $params['attrib'];
62
+					foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
63
+					$attributes .= ' '.$params['attrib'];
64 64
 
65 65
 					// Output the image with attributes
66
-					$o .= '<img' . rtrim($attributes) . ' />';
66
+					$o .= '<img'.rtrim($attributes).' />';
67 67
 				}
68 68
 			}
69 69
 			break;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		case "delim":    // display as delimitted list
72 72
 			$value = parseInput($value, "||");
73 73
 			$p = $params['format'] ? $params['format'] : " ";
74
-			if($p == "\\n") {
74
+			if ($p == "\\n") {
75 75
 				$p = "\n";
76 76
 			}
77 77
 			$o = str_replace("||", $p, $value);
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 		case "string":
81 81
 			$value = parseInput($value);
82 82
 			$format = strtolower($params['format']);
83
-			if($format == 'upper case') {
83
+			if ($format == 'upper case') {
84 84
 				$o = strtoupper($value);
85
-			} else if($format == 'lower case') {
85
+			} else if ($format == 'lower case') {
86 86
 				$o = strtolower($value);
87
-			} else if($format == 'sentence case') {
87
+			} else if ($format == 'sentence case') {
88 88
 				$o = ucfirst($value);
89
-			} else if($format == 'capitalize') {
89
+			} else if ($format == 'capitalize') {
90 90
 				$o = ucwords($value);
91 91
 			} else {
92 92
 				$o = $value;
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 			break;
95 95
 
96 96
 		case "date":
97
-			if($value != '' || $params['default'] == 'Yes') {
98
-				if(empty($value)) {
97
+			if ($value != '' || $params['default'] == 'Yes') {
98
+				if (empty($value)) {
99 99
 					$value = 'now';
100 100
 				}
101 101
 				$timestamp = getUnixtimeFromDateString($value);
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 			$value = parseInput($value, "||", "array");
111 111
 			$o = '';
112 112
 			$countValue = count($value);
113
-			for($i = 0; $i < $countValue; $i++) {
113
+			for ($i = 0; $i < $countValue; $i++) {
114 114
 				list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]);
115
-				if(!$url) {
115
+				if (!$url) {
116 116
 					$url = $name;
117 117
 				}
118
-				if($url) {
119
-					if($o) {
118
+				if ($url) {
119
+					if ($o) {
120 120
 						$o .= '<br />';
121 121
 					}
122 122
 					$attributes = '';
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 						'style' => $params['style'],
129 129
 						'target' => $params['target'],
130 130
 					);
131
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
132
-					$attributes .= ' ' . $params['attrib']; // add extra
131
+					foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
132
+					$attributes .= ' '.$params['attrib']; // add extra
133 133
 
134 134
 					// Output the link
135
-					$o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>';
135
+					$o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>';
136 136
 				}
137 137
 			}
138 138
 			break;
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 			$o = '';
145 145
 			// Loop through a list of tags
146 146
             $countValue = count($value);
147
-			for($i = 0; $i < $countValue; $i++) {
147
+			for ($i = 0; $i < $countValue; $i++) {
148 148
 				$tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i];
149
-				if(!$tagvalue) {
149
+				if (!$tagvalue) {
150 150
 					continue;
151 151
 				}
152 152
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 					'class' => $params['class'],
158 158
 					'style' => $params['style'],
159 159
 				);
160
-				foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
161
-				$attributes .= ' ' . $params['attrib']; // add extra
160
+				foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
161
+				$attributes .= ' '.$params['attrib']; // add extra
162 162
 
163 163
 				// Output the HTML Tag
164
-				$o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
164
+				$o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>';
165 165
 			}
166 166
 			break;
167 167
 
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 			$w = $params['w'] ? $params['w'] : '100%';
171 171
 			$h = $params['h'] ? $params['h'] : '400px';
172 172
 			$richtexteditor = $params['edt'] ? $params['edt'] : "";
173
-			$o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
173
+			$o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
174 174
 			$o .= $modx->htmlspecialchars($value);
175 175
 			$o .= '</textarea></div>';
176 176
 			$replace_richtext = array($id);
177 177
 			// setup editors
178
-			if(!empty($replace_richtext) && !empty($richtexteditor)) {
178
+			if (!empty($replace_richtext) && !empty($richtexteditor)) {
179 179
 				// invoke OnRichTextEditorInit event
180 180
 				$evtOut = $modx->invokeEvent("OnRichTextEditorInit", array(
181 181
 					'editor' => $richtexteditor,
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 					'width' => $w,
185 185
 					'height' => $h
186 186
 				));
187
-				if(is_array($evtOut)) {
187
+				if (is_array($evtOut)) {
188 188
 					$o .= implode("", $evtOut);
189 189
 				}
190 190
 			}
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 
198 198
 		case "viewport":
199 199
 			$value = parseInput($value);
200
-			$id = '_' . time();
201
-			if(!$params['vpid']) {
200
+			$id = '_'.time();
201
+			if (!$params['vpid']) {
202 202
 				$params['vpid'] = $id;
203 203
 			}
204 204
 			$sTag = "<iframe";
@@ -206,42 +206,42 @@  discard block
 block discarded – undo
206 206
 			$autoMode = "0";
207 207
 			$w = $params['width'];
208 208
 			$h = $params['height'];
209
-			if($params['stretch'] == 'Yes') {
209
+			if ($params['stretch'] == 'Yes') {
210 210
 				$w = "100%";
211 211
 				$h = "100%";
212 212
 			}
213
-			if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
214
-				$autoMode = "3";  //both
215
-			} else if($params['awidth'] == 'Yes') {
213
+			if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
214
+				$autoMode = "3"; //both
215
+			} else if ($params['awidth'] == 'Yes') {
216 216
 				$autoMode = "1"; //width only
217
-			} else if($params['aheight'] == 'Yes') {
218
-				$autoMode = "2";    //height only
217
+			} else if ($params['aheight'] == 'Yes') {
218
+				$autoMode = "2"; //height only
219 219
 			}
220 220
 
221
-			$modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array(
221
+			$modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array(
222 222
 				'name' => 'viewport',
223 223
 				'version' => '0',
224 224
 				'plaintext' => false
225 225
 			));
226
-			$o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
227
-			if($params['class']) {
228
-				$o .= " class='" . $params['class'] . "' ";
226
+			$o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' ";
227
+			if ($params['class']) {
228
+				$o .= " class='".$params['class']."' ";
229 229
 			}
230
-			if($params['style']) {
231
-				$o .= " style='" . $params['style'] . "' ";
230
+			if ($params['style']) {
231
+				$o .= " style='".$params['style']."' ";
232 232
 			}
233
-			if($params['attrib']) {
234
-				$o .= $params['attrib'] . " ";
233
+			if ($params['attrib']) {
234
+				$o .= $params['attrib']." ";
235 235
 			}
236
-			$o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' ";
237
-			$o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' ";
238
-			$o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' ";
236
+			$o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' ";
237
+			$o .= "src='".$value."' frameborder='".$params['borsize']."' ";
238
+			$o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' ";
239 239
 			$o .= ">";
240 240
 			$o .= $eTag;
241 241
 			break;
242 242
 
243 243
 		case "datagrid":
244
-			include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
244
+			include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
245 245
 			$grd = new DataGrid('', $value);
246 246
 
247 247
 			$grd->noRecordMsg = $params['egmsg'];
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 		case 'htmlentities':
278 278
 			$value = parseInput($value);
279
-			if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
279
+			if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
280 280
 				// remove delimiter from checkbox and listbox-multiple TVs
281 281
 				$value = str_replace('||', '', $value);
282 282
 			}
@@ -287,33 +287,33 @@  discard block
 block discarded – undo
287 287
 			$widget_output = '';
288 288
 			$o = '';
289 289
 			/* If we are loading a file */
290
-			if(substr($params['output'], 0, 5) == "@FILE") {
291
-				$file_name = MODX_BASE_PATH . trim(substr($params['output'], 6));
292
-				if(!file_exists($file_name)) {
293
-					$widget_output = $file_name . ' does not exist';
290
+			if (substr($params['output'], 0, 5) == "@FILE") {
291
+				$file_name = MODX_BASE_PATH.trim(substr($params['output'], 6));
292
+				if (!file_exists($file_name)) {
293
+					$widget_output = $file_name.' does not exist';
294 294
 				} else {
295 295
 					$widget_output = file_get_contents($file_name);
296 296
 				}
297
-			} elseif(substr($params['output'], 0, 8) == '@INCLUDE') {
298
-				$file_name = MODX_BASE_PATH . trim(substr($params['output'], 9));
299
-				if(!file_exists($file_name)) {
300
-					$widget_output = $file_name . ' does not exist';
297
+			} elseif (substr($params['output'], 0, 8) == '@INCLUDE') {
298
+				$file_name = MODX_BASE_PATH.trim(substr($params['output'], 9));
299
+				if (!file_exists($file_name)) {
300
+					$widget_output = $file_name.' does not exist';
301 301
 				} else {
302 302
 					/* The included file needs to set $widget_output. Can be string, array, object */
303 303
 					include $file_name;
304 304
 				}
305
-			} elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') {
305
+			} elseif (substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') {
306 306
 				$chunk_name = trim(substr($params['output'], 7));
307 307
 				$widget_output = $modx->getChunk($chunk_name);
308
-			} elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') {
308
+			} elseif (substr($params['output'], 0, 5) == '@EVAL' && $value !== '') {
309 309
 				$eval_str = trim(substr($params['output'], 6));
310 310
 				$widget_output = eval($eval_str);
311
-			} elseif($value !== '') {
311
+			} elseif ($value !== '') {
312 312
 				$widget_output = $params['output'];
313 313
 			} else {
314 314
 				$widget_output = '';
315 315
 			}
316
-			if(is_string($widget_output)) {
316
+			if (is_string($widget_output)) {
317 317
 				$_ = $modx->config['enable_filter'];
318 318
 				$modx->config['enable_filter'] = 1;
319 319
 				$widget_output = $modx->parseText($widget_output, array('value' => $value));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
 		default:
328 328
 			$value = parseInput($value);
329
-			if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
329
+			if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
330 330
 				// add separator
331 331
 				$value = explode('||', $value);
332 332
 				$value = implode($sep, $value);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
  * @param string $s
342 342
  * @return string
343 343
  */
344
-function decodeParamValue($s) {
344
+function decodeParamValue($s){
345 345
 	$s = str_replace("%3D", '=', $s); // =
346 346
 	return str_replace("%26", '&', $s); // &
347 347
 }
@@ -355,16 +355,16 @@  discard block
 block discarded – undo
355 355
  * @param bool $columns
356 356
  * @return array|string
357 357
  */
358
-function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array
358
+function parseInput($src, $delim = "||", $type = "string", $columns = true){ // type can be: string, array
359 359
 	global $modx;
360
-	if($modx->db->isResult($src)) {
360
+	if ($modx->db->isResult($src)) {
361 361
 		// must be a recordset
362 362
 		$rows = array();
363
-		while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols);
363
+		while ($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols);
364 364
 		return ($type == "array") ? $rows : implode($delim, $rows);
365 365
 	} else {
366 366
 		// must be a text
367
-		if($type == "array") {
367
+		if ($type == "array") {
368 368
 			return explode($delim, $src);
369 369
 		} else {
370 370
 			return $src;
@@ -376,21 +376,21 @@  discard block
 block discarded – undo
376 376
  * @param string $value
377 377
  * @return bool|false|int
378 378
  */
379
-function getUnixtimeFromDateString($value) {
379
+function getUnixtimeFromDateString($value){
380 380
 	$timestamp = false;
381 381
 	// Check for MySQL or legacy style date
382 382
 	$date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
383 383
 	$date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
384 384
 	$matches = array();
385
-	if(strpos($value, '-') !== false) {
386
-		if(preg_match($date_match_1, $value, $matches)) {
385
+	if (strpos($value, '-') !== false) {
386
+		if (preg_match($date_match_1, $value, $matches)) {
387 387
 			$timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
388
-		} elseif(preg_match($date_match_2, $value, $matches)) {
388
+		} elseif (preg_match($date_match_2, $value, $matches)) {
389 389
 			$timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
390 390
 		}
391 391
 	}
392 392
 	// If those didn't work, use strtotime to figure out the date
393
-	if($timestamp === false || $timestamp === -1) {
393
+	if ($timestamp === false || $timestamp === -1) {
394 394
 		$timestamp = strtotime($value);
395 395
 	}
396 396
 	return $timestamp;
Please login to merge, or discard this patch.
manager/includes/categories.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     $newCat = $modx->db->escape($newCat);
35 35
     $cats = $modx->db->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'");
36 36
     if ($cat = $modx->db->getValue($cats)) {
37
-        return (int)$cat;
37
+        return (int) $cat;
38 38
     }
39 39
 
40 40
     return 0;
Please login to merge, or discard this patch.