Completed
Pull Request — develop (#534)
by Agel_Nash
05:08
created
manager/includes/controls/contextmenu.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 global $ContextMenuCnt;
4 4
 $ContextMenuCnt = 0;
5 5
 
6
-class ContextMenu {
6
+class ContextMenu{
7 7
 	public $id;
8 8
     /**
9 9
      * @var string
@@ -18,56 +18,56 @@  discard block
 block discarded – undo
18 18
      */
19 19
 	public $width = 120;
20 20
 
21
-    public function __construct($id = '', $width = 120, $visible = false) {
21
+    public function __construct($id = '', $width = 120, $visible = false){
22 22
 		global $ContextMenuCnt;
23 23
 		$ContextMenuCnt++;
24 24
 		$this->html = "";
25 25
 		$this->visible = $visible ? $visible : false;
26
-		$this->width = is_numeric($width) ? (int)$width : 120;
27
-		$this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt;    // set id
26
+		$this->width = is_numeric($width) ? (int) $width : 120;
27
+		$this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id
28 28
 	}
29 29
 
30
-    public function addItem($text, $action = "", $img = "", $disabled = 0) {
30
+    public function addItem($text, $action = "", $img = "", $disabled = 0){
31 31
 		global $base_url, $_style;
32
-        if($disabled) {
32
+        if ($disabled) {
33 33
             return;
34 34
         }
35
-		if(!$img) {
36
-			$img = $base_url . $_style['tx'];
35
+		if (!$img) {
36
+			$img = $base_url.$_style['tx'];
37 37
 		}
38
-		if(substr($action, 0, 3) == "js:") {
38
+		if (substr($action, 0, 3) == "js:") {
39 39
 			$action = substr($action, 3);
40
-		} else if(substr($action, 0, 3) == "hl:") {
41
-			$action = "window.location.href='" . substr($action, 3) . "'";
40
+		} else if (substr($action, 0, 3) == "hl:") {
41
+			$action = "window.location.href='".substr($action, 3)."'";
42 42
 		} else {
43
-			$action = "window.location.href='" . $action . "'";
43
+			$action = "window.location.href='".$action."'";
44 44
 		}
45
-		$action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\"";
46
-		$this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>";
47
-        if(substr($img, 0, 5) == 'fa fa') {
48
-            $img = '<i class="' . $img . '"></i>';
49
-        } else if(substr($img, 0, 1) != '<') {
50
-            $img = '<img src="' . $img . '" />';
45
+		$action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\"";
46
+		$this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>";
47
+        if (substr($img, 0, 5) == 'fa fa') {
48
+            $img = '<i class="'.$img.'"></i>';
49
+        } else if (substr($img, 0, 1) != '<') {
50
+            $img = '<img src="'.$img.'" />';
51 51
         }
52
-		$this->html .= $img . '&nbsp;' . $text . '</div>';
52
+		$this->html .= $img.'&nbsp;'.$text.'</div>';
53 53
 	}
54 54
 
55
-    public function addSeparator() {
55
+    public function addSeparator(){
56 56
 		$this->html .= "
57 57
 			<div class='cntxMnuSeparator'></div>
58 58
 		";
59 59
 	}
60 60
 
61
-    public function render() {
61
+    public function render(){
62 62
 		global $ContextMenuScript;
63 63
 
64
-		$html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>";
64
+		$html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>";
65 65
 		$ContextMenuScript = ""; // reset css
66 66
 		return $html;
67 67
 	}
68 68
 
69
-    public function getClientScriptObject() {
70
-		return "getCntxMenu('" . $this->id . "')";
69
+    public function getClientScriptObject(){
70
+		return "getCntxMenu('".$this->id."')";
71 71
 	}
72 72
 }
73 73
 
Please login to merge, or discard this patch.
manager/includes/controls/datasetpager.class.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 $__DataSetPagerCnt = 0;
12 12
 
13
-class DataSetPager {
13
+class DataSetPager{
14 14
 
15 15
 	public $ds; // datasource
16 16
     public $pageSize;
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
     public $renderPagerFnc;
32 32
     public $renderPagerFncArgs;
33 33
 
34
-    public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) {
34
+    public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1){
35 35
 		global $_PAGE; // use view state object
36 36
 
37 37
 		global $__DataSetPagerCnt;
38 38
 
39 39
 		// set id
40 40
 		$__DataSetPagerCnt++;
41
-		$this->id = !empty($id) ? $id : "dsp" . $__DataSetPagerCnt;
41
+		$this->id = !empty($id) ? $id : "dsp".$__DataSetPagerCnt;
42 42
 
43 43
 		// get pagenumber
44 44
 		// by setting pager to -1 cause pager to load it's last page number
45
-		if($pageNumber == -1) {
45
+		if ($pageNumber == -1) {
46 46
 			$pageNumber = 1;
47
-			if(isset($_GET["dpgn" . $this->id])) {
48
-				$pageNumber = $_GET["dpgn" . $this->id];
49
-			} elseif(isset($_PAGE['vs'][$id . '_dpgn'])) {
50
-				$pageNumber = $_PAGE['vs'][$id . '_dpgn'];
47
+			if (isset($_GET["dpgn".$this->id])) {
48
+				$pageNumber = $_GET["dpgn".$this->id];
49
+			} elseif (isset($_PAGE['vs'][$id.'_dpgn'])) {
50
+				$pageNumber = $_PAGE['vs'][$id.'_dpgn'];
51 51
 			}
52 52
 		}
53
-		if(!is_numeric($pageNumber)) {
53
+		if (!is_numeric($pageNumber)) {
54 54
 			$pageNumber = 1;
55 55
 		}
56 56
 
@@ -61,40 +61,40 @@  discard block
 block discarded – undo
61 61
 		$this->pager = '';
62 62
 	}
63 63
 
64
-    public function getRenderedPager() {
64
+    public function getRenderedPager(){
65 65
 		return $this->pager;
66 66
 	}
67 67
 
68
-    public function getRenderedRows() {
68
+    public function getRenderedRows(){
69 69
 		return $this->rows;
70 70
 	}
71 71
 
72
-    public function setDataSource($ds) {
72
+    public function setDataSource($ds){
73 73
 		$this->ds = $ds;
74 74
 	}
75 75
 
76
-    public function setPageSize($ps) {
76
+    public function setPageSize($ps){
77 77
 		$this->pageSize = $ps;
78 78
 	}
79 79
 
80
-    public function setRenderRowFnc($fncName, $args = "") {
80
+    public function setRenderRowFnc($fncName, $args = ""){
81 81
 		$this->renderRowFnc = &$fncName;
82
-		$this->renderRowFncArgs = $args;    // extra agruments
82
+		$this->renderRowFncArgs = $args; // extra agruments
83 83
 
84 84
 
85 85
 	}
86 86
 
87
-    public function setRenderPagerFnc($fncName, $args = "") {
87
+    public function setRenderPagerFnc($fncName, $args = ""){
88 88
 		$this->renderPagerFnc = $fncName;
89
-		$this->renderPagerFncArgs = $args;    // extra agruments
89
+		$this->renderPagerFncArgs = $args; // extra agruments
90 90
 	}
91 91
 
92
-    public function render() {
92
+    public function render(){
93 93
 		global $modx, $_PAGE;
94 94
 
95 95
 		$isDataset = $modx->db->isResult($this->ds);
96 96
 
97
-		if(!$this->selPageStyle) {
97
+		if (!$this->selPageStyle) {
98 98
 			$this->selPageStyle = "font-weight:bold";
99 99
 		}
100 100
 
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 		$tnr = ($isDataset) ? $modx->db->getRecordCount($this->ds) : count($this->ds);
103 103
 
104 104
 		// render: no records found
105
-		if($tnr <= 0) {
105
+		if ($tnr <= 0) {
106 106
 			$fnc = $this->renderRowFnc;
107 107
 			$args = $this->renderRowFncArgs;
108
-			if(isset($fnc)) {
109
-				if($args != "") {
108
+			if (isset($fnc)) {
109
+				if ($args != "") {
110 110
 					$this->rows .= $fnc(0, null, $args);
111 111
 				} // if agrs was specified then we will pass three params
112 112
 				else {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 		// get total pages
120 120
 		$tp = ceil($tnr / $this->pageSize);
121
-		if($this->pageNumber > $tp) {
121
+		if ($this->pageNumber > $tp) {
122 122
 			$this->pageNumber = 1;
123 123
 		}
124 124
 
@@ -126,39 +126,39 @@  discard block
 block discarded – undo
126 126
 		$p = $this->pageNumber;
127 127
 
128 128
 		// save page number to view state if available
129
-		if(isset($_PAGE['vs'])) {
130
-			$_PAGE['vs'][$this->id . '_dpgn'] = $p;
129
+		if (isset($_PAGE['vs'])) {
130
+			$_PAGE['vs'][$this->id.'_dpgn'] = $p;
131 131
 		}
132 132
 
133 133
 		// render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments="");
134
-		if($tp > 1) {
134
+		if ($tp > 1) {
135 135
 		    $url = '';
136 136
 			$fnc = $this->renderPagerFnc;
137 137
 			$args = $this->renderPagerFncArgs;
138
-			if(!isset($fnc)) {
139
-				if($modx->isFrontend()) {
140
-					$url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?';
138
+			if (!isset($fnc)) {
139
+				if ($modx->isFrontend()) {
140
+					$url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full').'?';
141 141
 				} else {
142
-					$url = $_SERVER['PHP_SELF'] . '?';
142
+					$url = $_SERVER['PHP_SELF'].'?';
143 143
 				}
144 144
 				$i = 0;
145
-				foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) {
145
+				foreach ($_GET as $n => $v) if ($n != 'dpgn'.$this->id) {
146 146
 					$i++;
147
-					$url .= (($i > 1) ? "&" : "") . "$n=$v";
147
+					$url .= (($i > 1) ? "&" : "")."$n=$v";
148 148
 				}
149
-				if($i >= 1) {
149
+				if ($i >= 1) {
150 150
 					$url .= "&";
151 151
 				}
152 152
 			}
153
-			for($i = 1; $i <= $tp; $i++) {
154
-				if(isset($fnc)) {
155
-					if($args != "") {
153
+			for ($i = 1; $i <= $tp; $i++) {
154
+				if (isset($fnc)) {
155
+					if ($args != "") {
156 156
 						$this->pager .= $fnc($p, $i, $args);
157 157
 					} else {
158 158
 						$this->pager .= $fnc($p, $i);
159 159
 					}
160 160
 				} else {
161
-					$this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> ";
161
+					$this->pager .= ($p == $i) ? " <span class='".$this->selPageClass."' style='".$this->selPageStyle."'>$i</span> " : " <a href='".$url."dpgn".$this->id."=$i' class='".$this->pageClass."' style='".$this->pageStyle."'>$i</a> ";
162 162
 				}
163 163
 			}
164 164
 		}
@@ -167,21 +167,21 @@  discard block
 block discarded – undo
167 167
 		$fnc = $this->renderRowFnc;
168 168
 		$args = $this->renderRowFncArgs;
169 169
 
170
-		if(isset($fnc)) {
170
+		if (isset($fnc)) {
171 171
 			$i = 1;
172 172
 			$fncObject = is_object($fnc);
173 173
 			$minitems = (($p - 1) * $this->pageSize) + 1;
174 174
 			$maxitems = (($p - 1) * $this->pageSize) + $this->pageSize;
175
-			while($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) {
176
-				if($i >= $minitems && $i <= $maxitems) {
177
-					if($fncObject) {
178
-						if($args != "") {
175
+			while ($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) {
176
+				if ($i >= $minitems && $i <= $maxitems) {
177
+					if ($fncObject) {
178
+						if ($args != "") {
179 179
 							$this->rows .= $fnc->RenderRowFnc($i, $row, $args);
180 180
 						} else {
181 181
 							$this->rows .= $fnc->RenderRowFnc($i, $row);
182 182
 						}
183 183
 					} else {
184
-						if($args != "") {
184
+						if ($args != "") {
185 185
 							$this->rows .= $fnc($i, $row, $args);
186 186
 						} // if agrs was specified then we wil pass three params
187 187
 						else {
Please login to merge, or discard this patch.
manager/includes/active_user_locks.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  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
-$lockElementId = (int)$lockElementId;
6
+$lockElementId = (int) $lockElementId;
7 7
 
8 8
 if ($lockElementId > 0) {
9 9
     ?>
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         var stay = document.getElementById('stay');
19 19
         // Trigger unlock
20 20
         if ((stay && stay.value !== '2') || !form_save) {
21
-          var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType;?>&id=<?php echo $lockElementId;?>&o=' + Math.random();
21
+          var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType; ?>&id=<?php echo $lockElementId; ?>&o=' + Math.random();
22 22
           if (navigator.sendBeacon) {
23 23
             navigator.sendBeacon(url)
24 24
           } else {
Please login to merge, or discard this patch.
manager/includes/error.class.inc.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public $errormessage;
17 17
 
18
-    public function __construct() {
18
+    public function __construct(){
19 19
 
20 20
 		$_lang = $this->include_lang('errormsg');
21 21
 
@@ -50,33 +50,33 @@  discard block
 block discarded – undo
50 50
 	);
51 51
 	}
52 52
 
53
-	function include_lang($context='common') {
53
+	function include_lang($context = 'common'){
54 54
 		global $modx;
55 55
 		$_lang = array();
56 56
 
57
-		$context = trim($context,'/');
58
-		if(strpos($context,'..')!==false) return;
57
+		$context = trim($context, '/');
58
+		if (strpos($context, '..') !== false) return;
59 59
 
60
-		if($context === 'common')
61
-			$lang_path = MODX_MANAGER_PATH . 'includes/lang/';
60
+		if ($context === 'common')
61
+			$lang_path = MODX_MANAGER_PATH.'includes/lang/';
62 62
 		else
63
-			$lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
64
-		include_once($lang_path . 'english.inc.php');
63
+			$lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/";
64
+		include_once($lang_path.'english.inc.php');
65 65
 		$manager_language = $modx->config['manager_language'];
66
-		if(is_file("{$lang_path}{$manager_language}.inc.php"))
66
+		if (is_file("{$lang_path}{$manager_language}.inc.php"))
67 67
 			include_once("{$lang_path}{$manager_language}.inc.php");
68 68
 		return $_lang;
69 69
 	}
70 70
 
71
-	function setError($errorcode, $custommessage=""){
72
-		$this->errorcode=$errorcode;
73
-		$this->errormessage=$this->errors[$errorcode];
74
-		if($custommessage!="") {
75
-			$this->errormessage=$custommessage;
71
+	function setError($errorcode, $custommessage = ""){
72
+		$this->errorcode = $errorcode;
73
+		$this->errormessage = $this->errors[$errorcode];
74
+		if ($custommessage != "") {
75
+			$this->errormessage = $custommessage;
76 76
 		}
77 77
 	}
78 78
 
79
-	function getError() {
79
+	function getError(){
80 80
 		return $this->errorcode;
81 81
 	}
82 82
 
Please login to merge, or discard this patch.
manager/includes/preload.functions.inc.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 global $site_sessionname;
4 4
 $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession
5 5
 
6
-function genEvoSessionName() {
6
+function genEvoSessionName(){
7 7
     $_ = crc32(__FILE__);
8 8
     $_ = sprintf('%u', $_);
9
-    return 'evo' . base_convert($_,10,36);
9
+    return 'evo'.base_convert($_, 10, 36);
10 10
 }
11 11
 
12 12
 function startCMSSession(){
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     session_name($site_sessionname);
17 17
     removeInvalidCmsSessionIds($site_sessionname);
18
-    $cookieExpiration= 0;
18
+    $cookieExpiration = 0;
19 19
     $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
20 20
     $cookiePath = !empty($session_cookie_path) ? $session_cookie_path : MODX_BASE_URL;
21 21
     $cookieDomain = !empty($session_cookie_domain) ? $session_cookie_domain : '';
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 
25 25
     $key = "modx.{$context}.session.cookie.lifetime";
26 26
     if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
27
-        $cookieLifetime= (int)$_SESSION[$key];
28
-        if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime;
27
+        $cookieLifetime = (int) $_SESSION[$key];
28
+        if ($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
29 29
         setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
30 30
     }
31 31
     if (!isset($_SESSION['modx.session.created.time'])) {
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
     }
34 34
 }
35 35
 
36
-function removeInvalidCmsSessionFromStorage(&$storage, $session_name) {
36
+function removeInvalidCmsSessionFromStorage(&$storage, $session_name){
37 37
     if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted'))
38 38
     {
39 39
     unset($storage[$session_name]);
40 40
     }
41 41
 }
42 42
 
43
-function removeInvalidCmsSessionIds($session_name) {
43
+function removeInvalidCmsSessionIds($session_name){
44 44
     // session ids is invalid iff it is empty string
45 45
     // storage priorioty can see in PHP source ext/session/session.c
46 46
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.
manager/includes/log.class.inc.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 
13 13
 */
14 14
 
15
-class logHandler {
15
+class logHandler{
16 16
     // Single variable for a log entry
17 17
     var $entry = array();
18 18
 
19
-    function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") {
19
+    function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){
20 20
         global $modx;
21 21
         $this->entry['msg'] = $msg; // writes testmessage to the object
22
-        $this->entry['action'] = empty($action)? $modx->manager->action : $action;    // writes the action to the object
22
+        $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object
23 23
 
24 24
         // User Credentials
25 25
         $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey;
26 26
         $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username;
27 27
 
28
-        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid;  // writes the id to the object
29
-        if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0
28
+        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object
29
+        if ($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0
30 30
 
31
-        $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object
32
-        if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty
31
+        $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object
32
+        if ($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty
33 33
 
34 34
         $this->writeToLog();
35 35
         return;
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
     // function to write to the log
39 39
     // collects all required info, and
40 40
     // writes it to the logging table
41
-    function writeToLog() {
41
+    function writeToLog(){
42 42
         global $modx;
43 43
         $tbl_manager_log = $modx->getFullTableName('manager_log');
44 44
 
45
-        if($this->entry['internalKey'] == "") {
45
+        if ($this->entry['internalKey'] == "") {
46 46
             $modx->webAlertAndQuit("Logging error: internalKey not set.");
47 47
         }
48
-        if(empty($this->entry['action'])) {
48
+        if (empty($this->entry['action'])) {
49 49
             $modx->webAlertAndQuit("Logging error: action not set.");
50 50
         }
51
-        if($this->entry['msg'] == "") {
51
+        if ($this->entry['msg'] == "") {
52 52
             include_once "actionlist.inc.php";
53 53
             $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']);
54
-            if($this->entry['msg'] == "") {
54
+            if ($this->entry['msg'] == "") {
55 55
                 $modx->webAlertAndQuit("Logging error: couldn't find message to write to log.");
56 56
             }
57 57
         }
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
         $fields['itemid']      = $this->entry['itemId'];
64 64
         $fields['itemname']    = $modx->db->escape($this->entry['itemName']);
65 65
         $fields['message']     = $modx->db->escape($this->entry['msg']);
66
-        $insert_id = $modx->db->insert($fields,$tbl_manager_log);
67
-        if(!$insert_id) {
66
+        $insert_id = $modx->db->insert($fields, $tbl_manager_log);
67
+        if (!$insert_id) {
68 68
             $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError());
69 69
         } else {
70
-            $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000;
71
-            $trim  = (isset($modx->config['manager_log_trim']))  ? (int)$modx->config['manager_log_trim'] : 100;
72
-            if(($insert_id % $trim) === 0) {
73
-                $modx->rotate_log('manager_log',$limit,$trim);
70
+            $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000;
71
+            $trim  = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100;
72
+            if (($insert_id % $trim) === 0) {
73
+                $modx->rotate_log('manager_log', $limit, $trim);
74 74
             }
75 75
         }
76 76
     }
Please login to merge, or discard this patch.
manager/includes/menu.class.inc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
                 $countChild++;
68 68
                 $id = $value[0];
69 69
                 $ph['id'] = $id;
70
-                $ph['li_class'] = $this->get_li_class($id) . $value[10];
70
+                $ph['li_class'] = $this->get_li_class($id).$value[10];
71 71
                 $ph['href'] = $value[3];
72 72
                 $ph['alt'] = $value[4];
73 73
                 $ph['target'] = $value[7];
74 74
                 $ph['onclick'] = $value[5];
75 75
                 $ph['a_class'] = $this->get_a_class($id);
76 76
                 $ph['LinkAttr'] = $this->getLinkAttr($id);
77
-                $ph['itemName'] = $value[2] . $this->getItemName($id);
77
+                $ph['itemName'] = $value[2].$this->getItemName($id);
78 78
 
79 79
                 $ph['DrawSub'] = '';
80 80
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function get_li_class($id)
114 114
     {
115 115
         if (isset($this->menu[$id])) {
116
-            return $this->defaults['parentClass'] . ' ';
116
+            return $this->defaults['parentClass'].' ';
117 117
         } else {
118 118
             return '';
119 119
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     public function get_a_class($id)
123 123
     {
124 124
         if (isset($this->menu[$id])) {
125
-            return ' class="' . $this->defaults['parentLinkClass'] . '"';
125
+            return ' class="'.$this->defaults['parentLinkClass'].'"';
126 126
         } else {
127 127
             return '';
128 128
         }
Please login to merge, or discard this patch.
manager/includes/tmplvars.commands.inc.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Created by Raymond Irving Feb, 2005
5 5
  */
6 6
 global $BINDINGS; // Array of supported bindings. must be upper case
7
-$BINDINGS = array (
7
+$BINDINGS = array(
8 8
     'FILE',
9 9
     'CHUNK',
10 10
     'DOCUMENT',
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
     'DIRECTORY'
15 15
 );
16 16
 
17
-function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) {
17
+function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()){
18 18
     global $modx;
19
-    $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
19
+    $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
20 20
     $nvalue = trim($value);
21 21
     if (substr($nvalue, 0, 1) != '@')
22 22
         return $value;
23
-    elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') {
23
+    elseif (isset($modx->config['enable_bindings']) && $modx->config['enable_bindings'] != 1 && $src === 'docform') {
24 24
         return '@Bindings is disabled.';
25 25
     }
26 26
     else {
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
                 break;
47 47
 
48 48
             case "SELECT" : // selects a record from the cms database
49
-                $rt = array ();
50
-                $replacementVars = array (
49
+                $rt = array();
50
+                $replacementVars = array(
51 51
                     'DBASE' => $modx->db->config['dbase'],
52 52
                     'PREFIX' => $modx->db->config['table_prefix']
53 53
                 );
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
                 break;
89 89
 
90 90
             case 'DIRECTORY' :
91
-                $files = array ();
92
-                $path = $modx->config['base_path'] . $param;
91
+                $files = array();
92
+                $path = $modx->config['base_path'].$param;
93 93
                 if (substr($path, -1, 1) != '/') {
94 94
                     $path .= '/';
95 95
                 }
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
     }
118 118
 }
119 119
 
120
-function ProcessFile($file) {
120
+function ProcessFile($file){
121 121
     // get the file
122 122
 	$buffer = @file_get_contents($file);
123
-	if ($buffer===false) $buffer = " Could not retrieve document '$file'.";
123
+	if ($buffer === false) $buffer = " Could not retrieve document '$file'.";
124 124
     return $buffer;
125 125
 }
126 126
 
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 {
130 130
     global $BINDINGS;
131 131
     $binding_array = array();
132
-    foreach($BINDINGS as $cmd)
132
+    foreach ($BINDINGS as $cmd)
133 133
     {
134
-        if(strpos($binding_string,'@'.$cmd)===0)
134
+        if (strpos($binding_string, '@'.$cmd) === 0)
135 135
         {
136
-            $code = substr($binding_string,strlen($cmd)+1);
137
-            $binding_array = array($cmd,trim($code));
136
+            $code = substr($binding_string, strlen($cmd) + 1);
137
+            $binding_array = array($cmd, trim($code));
138 138
             break;
139 139
         }
140 140
     }
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 	if (strpos($param, '[*') !== false) {
150 150
 		$matches = $modx->getTagsFromContent($param, '[*', '*]');
151 151
 		foreach ($matches[0] as $i=>$match) {
152
-			if(isset($tvsArray[ $matches[1][$i] ])) {
153
-				if(is_array($tvsArray[ $matches[1][$i] ])) {
152
+			if (isset($tvsArray[$matches[1][$i]])) {
153
+				if (is_array($tvsArray[$matches[1][$i]])) {
154 154
 					$value = $tvsArray[$matches[1][$i]]['value'];
155 155
 					$value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value;
156 156
 				} else {
157
-					$value = $tvsArray[ $matches[1][$i] ];
157
+					$value = $tvsArray[$matches[1][$i]];
158 158
 				}
159 159
 				$param = str_replace($match, $value, $param);
160 160
 			}
Please login to merge, or discard this patch.
manager/includes/rss.inc.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,34 +29,34 @@  discard block
 block discarded – undo
29 29
 // include MagPieRSS
30 30
 require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc');
31 31
 // Convert relative path into absolute url
32
-function rel2abs( $rel, $base ) {
32
+function rel2abs($rel, $base){
33 33
 	// parse base URL  and convert to local variables: $scheme, $host,  $path
34
-    $tmp = parse_url( $base );
35
-    extract( $tmp );
36
-	if ( strpos( $rel,"//" ) === 0 ) {
37
-		return $scheme . ':' . $rel;
34
+    $tmp = parse_url($base);
35
+    extract($tmp);
36
+	if (strpos($rel, "//") === 0) {
37
+		return $scheme.':'.$rel;
38 38
 	}
39 39
 	// return if already absolute URL
40
-	if ( parse_url( $rel, PHP_URL_SCHEME ) != '' ) {
40
+	if (parse_url($rel, PHP_URL_SCHEME) != '') {
41 41
 		return $rel;
42 42
 	}
43 43
 	// queries and anchors
44
-	if ( $rel[0] == '#' || $rel[0] == '?' ) {
45
-		return $base . $rel;
44
+	if ($rel[0] == '#' || $rel[0] == '?') {
45
+		return $base.$rel;
46 46
 	}
47 47
 	// remove non-directory element from path
48
-	$path = preg_replace( '#/[^/]*$#', '', $path );
48
+	$path = preg_replace('#/[^/]*$#', '', $path);
49 49
 	// destroy path if relative url points to root
50
-	if ( $rel[0] ==  '/' ) {
50
+	if ($rel[0] == '/') {
51 51
 		$path = '';
52 52
 	}
53 53
 	// dirty absolute URL
54
-	$abs = $host . $path . "/" . $rel;
54
+	$abs = $host.$path."/".$rel;
55 55
 	// replace '//' or  '/./' or '/foo/../' with '/'
56
-	$abs = preg_replace( "/(\/\.?\/)/", "/", $abs );
57
-	$abs = preg_replace( "/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs );
56
+	$abs = preg_replace("/(\/\.?\/)/", "/", $abs);
57
+	$abs = preg_replace("/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs);
58 58
 	// absolute URL is ready!
59
-	return $scheme . '://' . $abs;
59
+	return $scheme.'://'.$abs;
60 60
 }
61 61
 $feedData = array();
62 62
 
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 foreach ($urls as $section=>$url) {
65 65
 	$output = '';
66 66
     $rss = @fetch_rss($url);
67
-    if( !$rss ){
68
-    	$feedData[$section] = 'Failed to retrieve ' . $url;
67
+    if (!$rss) {
68
+    	$feedData[$section] = 'Failed to retrieve '.$url;
69 69
     	continue;
70 70
 	}
71 71
     $output .= '<ul>';
72 72
 
73 73
     $items = array_slice($rss->items, 0, $itemsNumber);
74 74
     foreach ($items as $item) {
75
-        $href = rel2abs($item['link'],'https://github.com');
75
+        $href = rel2abs($item['link'], 'https://github.com');
76 76
         $title = $item['title'];
77 77
         $pubdate = $item['pubdate'];
78 78
         $pubdate = $modx->toDateFormat(strtotime($pubdate));
Please login to merge, or discard this patch.