Completed
Pull Request — develop (#725)
by Agel_Nash
08:07
created
manager/includes/src/Support/DataGrid.php 1 patch
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
 # -----------------------------------------
12 12
 #
13 13
 
14
-class DataGrid implements DataGridInterface{
14
+class DataGrid implements DataGridInterface
15
+{
15 16
 
16 17
 	public $ds; // datasource
17 18
     public $id;
@@ -75,7 +76,8 @@  discard block
 block discarded – undo
75 76
 
76 77
     public static $dataGridCnt;
77 78
 
78
-    public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) {
79
+    public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1)
80
+    {
79 81
 		// set id
80 82
 		self::$dataGridCnt++;
81 83
 		$this->id = $this->id ? empty($id) : "dg" . self::$dataGridCnt;
@@ -89,11 +91,13 @@  discard block
 block discarded – undo
89 91
 		$this->pagerLocation = 'top-right';
90 92
 	}
91 93
 
92
-    public function setDataSource($ds) {
94
+    public function setDataSource($ds)
95
+    {
93 96
 		$this->ds = $ds;
94 97
 	}
95 98
 
96
-    public function render() {
99
+    public function render()
100
+    {
97 101
         $modx = evolutionCMS();
98 102
 		$columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : '';
99 103
 		$columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : "";
@@ -128,7 +132,9 @@  discard block
 block discarded – undo
128 132
 
129 133
 		if($this->_isDataset && !$this->columns) {
130 134
 			$cols = $modx->getDatabase()->numFields($this->ds);
131
-			for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->getDatabase()->fieldName($this->ds, $i);
135
+			for($i = 0; $i < $cols; $i++) {
136
+			    $this->columns .= ($i ? "," : "") . $modx->getDatabase()->fieldName($this->ds, $i);
137
+			}
132 138
 		}
133 139
 
134 140
 		// start grid
@@ -207,7 +213,8 @@  discard block
 block discarded – undo
207 213
 
208 214
 	// format column values
209 215
 
210
-    public function RenderRowFnc($n, $row) {
216
+    public function RenderRowFnc($n, $row)
217
+    {
211 218
 		if($this->_alt == 0) {
212 219
 			$Style = $this->_itemStyle;
213 220
 			$Class = $this->_itemClass;
@@ -237,7 +244,8 @@  discard block
 block discarded – undo
237 244
 		return $o;
238 245
 	}
239 246
 
240
-    public function formatColumnValue($row, $value, $type, &$align) {
247
+    public function formatColumnValue($row, $value, $type, &$align)
248
+    {
241 249
 		if(strpos($type, ":") !== false) {
242 250
 			list($type, $type_format) = explode(":", $type, 2);
243 251
 		}
Please login to merge, or discard this patch.
manager/includes/src/Support/ContextMenu.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 use EvolutionCMS\Interfaces\ContextMenuInterface;
4 4
 
5
-class ContextMenu implements ContextMenuInterface{
5
+class ContextMenu implements ContextMenuInterface
6
+{
6 7
     public $id;
7 8
     /**
8 9
      * @var string
@@ -19,7 +20,8 @@  discard block
 block discarded – undo
19 20
 
20 21
     public static $cnt;
21 22
 
22
-    public function __construct($id = '', $width = 120, $visible = false) {
23
+    public function __construct($id = '', $width = 120, $visible = false)
24
+    {
23 25
         self::$cnt++;
24 26
         $this->html = "";
25 27
         $this->visible = $visible ? $visible : false;
@@ -27,7 +29,8 @@  discard block
 block discarded – undo
27 29
         $this->id = $id ? $id : "cntxMnu" . self::$cnt;    // set id
28 30
     }
29 31
 
30
-    public function addItem($text, $action = "", $img = "", $disabled = 0) {
32
+    public function addItem($text, $action = "", $img = "", $disabled = 0)
33
+    {
31 34
         global $base_url, $_style;
32 35
         if($disabled) {
33 36
             return;
@@ -52,13 +55,15 @@  discard block
 block discarded – undo
52 55
         $this->html .= $img . '&nbsp;' . $text . '</div>';
53 56
     }
54 57
 
55
-    public function addSeparator() {
58
+    public function addSeparator()
59
+    {
56 60
         $this->html .= "
57 61
 			<div class='cntxMnuSeparator'></div>
58 62
 		";
59 63
     }
60 64
 
61
-    public function render() {
65
+    public function render()
66
+    {
62 67
         $ContextMenuScript = <<<BLOCK
63 68
 <script>
64 69
 	function getCntxMenu(id) {
@@ -76,7 +81,8 @@  discard block
 block discarded – undo
76 81
         return $html;
77 82
     }
78 83
 
79
-    public function getClientScriptObject() {
84
+    public function getClientScriptObject()
85
+    {
80 86
         return "getCntxMenu('" . $this->id . "')";
81 87
     }
82 88
 }
Please login to merge, or discard this patch.
manager/includes/src/Support/DataSetPager.php 1 patch
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,7 +11,8 @@  discard block
 block discarded – undo
11 11
 # -----------------------------------------
12 12
 #
13 13
 
14
-class DataSetPager implements DataSetPagerInterface{
14
+class DataSetPager implements DataSetPagerInterface
15
+{
15 16
 
16 17
 	public $ds; // datasource
17 18
     public $pageSize;
@@ -33,7 +34,8 @@  discard block
 block discarded – undo
33 34
     public $renderPagerFncArgs;
34 35
     public static $dataSetPagerCnt;
35 36
 
36
-    public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) {
37
+    public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1)
38
+    {
37 39
 		global $_PAGE; // use view state object
38 40
 
39 41
 		// set id
@@ -61,35 +63,42 @@  discard block
 block discarded – undo
61 63
 		$this->pager = '';
62 64
 	}
63 65
 
64
-    public function getRenderedPager() {
66
+    public function getRenderedPager()
67
+    {
65 68
 		return $this->pager;
66 69
 	}
67 70
 
68
-    public function getRenderedRows() {
71
+    public function getRenderedRows()
72
+    {
69 73
 		return $this->rows;
70 74
 	}
71 75
 
72
-    public function setDataSource($ds) {
76
+    public function setDataSource($ds)
77
+    {
73 78
 		$this->ds = $ds;
74 79
 	}
75 80
 
76
-    public function setPageSize($ps) {
81
+    public function setPageSize($ps)
82
+    {
77 83
 		$this->pageSize = $ps;
78 84
 	}
79 85
 
80
-    public function setRenderRowFnc($fncName, $args = "") {
86
+    public function setRenderRowFnc($fncName, $args = "")
87
+    {
81 88
 		$this->renderRowFnc = &$fncName;
82 89
 		$this->renderRowFncArgs = $args;    // extra agruments
83 90
 
84 91
 
85 92
 	}
86 93
 
87
-    public function setRenderPagerFnc($fncName, $args = "") {
94
+    public function setRenderPagerFnc($fncName, $args = "")
95
+    {
88 96
 		$this->renderPagerFnc = $fncName;
89 97
 		$this->renderPagerFncArgs = $args;    // extra agruments
90 98
 	}
91 99
 
92
-    public function render() {
100
+    public function render()
101
+    {
93 102
 		$modx = evolutionCMS(); global $_PAGE;
94 103
 
95 104
 		$isDataset = $modx->getDatabase()->isResult($this->ds);
@@ -142,8 +151,10 @@  discard block
 block discarded – undo
142 151
 					$url = $_SERVER['PHP_SELF'] . '?';
143 152
 				}
144 153
 				$i = 0;
145
-				foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) {
154
+				foreach($_GET as $n => $v) {
155
+				    if($n != 'dpgn' . $this->id) {
146 156
 					$i++;
157
+				}
147 158
 					$url .= (($i > 1) ? "&" : "") . "$n=$v";
148 159
 				}
149 160
 				if($i >= 1) {
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_moduser.inc.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 $userid = (int)$value;
3 3
 if (!isset($modx->getModifiers()->cache['ui'][$userid])) {
4
-    if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid));
5
-    else             $user = $modx->getUserInfo($userid);
4
+    if ($userid < 0) {
5
+        $user = $modx->getWebUserInfo(abs($userid));
6
+    } else {
7
+        $user = $modx->getUserInfo($userid);
8
+    }
6 9
     $modx->getModifiers()->cache['ui'][$userid] = $user;
7 10
 } else {
8 11
     $user = $modx->getModifiers()->cache['ui'][$userid];
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_summary.inc.php 1 patch
Braces   +28 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,9 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt);
3
-elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';}
4
-else {$limit=124;$delim='';}
2
+if(strpos($opt,',')) {
3
+    list($limit,$delim) = explode(',', $opt);
4
+} elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} else {$limit=124;$delim='';}
5 5
 
6
-if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
6
+if($delim==='') {
7
+    $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
8
+}
7 9
 $limit = (int)$limit;
8 10
 
9 11
 $content = $modx->getModifiers()->parseDocumentSource($value);
@@ -11,8 +13,9 @@  discard block
 block discarded – undo
11 13
 $content = strip_tags($content);
12 14
 
13 15
 $content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'),' ',$content);
14
-if(preg_match('/\s+/',$content))
16
+if(preg_match('/\s+/',$content)) {
15 17
     $content = preg_replace('/\s+/',' ',$content);
18
+}
16 19
 $content = trim($content);
17 20
 
18 21
 $pos = $modx->getModifiers()->strpos($content, $delim);
@@ -21,23 +24,35 @@  discard block
 block discarded – undo
21 24
     $_ = explode($delim, $content);
22 25
     $text = '';
23 26
     foreach($_ as $v) {
24
-        if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break;
27
+        if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) {
28
+            break;
29
+        }
25 30
         $text .= $v.$delim;
26 31
     }
27
-    if($text) $content = $text;
28
-}
32
+    if($text) {
33
+        $content = $text;
34
+    }
35
+    }
29 36
 
30 37
 if($limit<$modx->getModifiers()->strlen($content) && strpos($content,' ')!==false) {
31 38
     $_ = explode(' ', $content);
32 39
     $text = '';
33 40
     foreach($_ as $v) {
34
-        if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break;
41
+        if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) {
42
+            break;
43
+        }
35 44
         $text .= $v . ' ';
36 45
     }
37
-    if($text!=='') $content = $text;
38
-}
46
+    if($text!=='') {
47
+        $content = $text;
48
+    }
49
+    }
39 50
 
40
-if($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit);
41
-if($modx->getModifiers()->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim;
51
+if($limit < $modx->getModifiers()->strlen($content)) {
52
+    $content = $modx->getModifiers()->substr($content, 0, $limit);
53
+}
54
+if($modx->getModifiers()->substr($content,-1)==$delim) {
55
+    $content = rtrim($content,$delim) . $delim;
56
+}
42 57
 
43 58
 return $content;
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_memberof.inc.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,11 +5,14 @@  discard block
 block discarded – undo
5 5
 $groupNames = ($this->strlen($opt) > 0 ) ? explode(',',$opt) : array();
6 6
 
7 7
 // if $groupNames is not an array return false
8
-if(!is_array($groupNames)) return 0;
8
+if(!is_array($groupNames)) {
9
+    return 0;
10
+}
9 11
 
10 12
 // Creates an array with all webgroups the user id is in
11
-if (isset($modx->getModifiers()->cache['mo'][$userID])) $grpNames = $modx->getModifiers()->cache['mo'][$userID];
12
-else {
13
+if (isset($modx->getModifiers()->cache['mo'][$userID])) {
14
+    $grpNames = $modx->getModifiers()->cache['mo'][$userID];
15
+} else {
13 16
     $from = sprintf("[+prefix+]webgroup_names wgn INNER JOIN [+prefix+]web_groups wg ON wg.webgroup=wgn.id AND wg.webuser='%s'",$userID);
14 17
     $rs = $modx->getDatabase()->select('wgn.name',$from);
15 18
     $modx->getModifiers()->cache['mo'][$userID] = $grpNames = $modx->getDatabase()->getColumn('name',$rs);
@@ -17,8 +20,10 @@  discard block
 block discarded – undo
17 20
 
18 21
 // Check if a supplied group matches a webgroup from the array we just created
19 22
 foreach($groupNames as $k=>$v) {
20
-    if(in_array(trim($v),$grpNames)) return 1;
21
-}
23
+    if(in_array(trim($v),$grpNames)) {
24
+        return 1;
25
+    }
26
+    }
22 27
 
23 28
 // If we get here the above logic did not find a match, so return false
24 29
 return 0;
Please login to merge, or discard this patch.
manager/includes/functions/processors.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -380,10 +380,12 @@
 block discarded – undo
380 380
         $failedlogins += 1;
381 381
 
382 382
         $fields = array('failedlogincount' => $failedlogins);
383
-        if ($failedlogins >= $failed_allowed) //block user for too many fail attempts
383
+        if ($failedlogins >= $failed_allowed) {
384
+            //block user for too many fail attempts
384 385
         {
385 386
             $fields['blockeduntil'] = time() + ($blocked_minutes * 60);
386 387
         }
388
+        }
387 389
 
388 390
         $modx->getDatabase()->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
389 391
 
Please login to merge, or discard this patch.
manager/includes/functions/tv.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -573,7 +573,8 @@
 block discarded – undo
573 573
      * @return array|string
574 574
      */
575 575
     function parseInput($src, $delim = "||", $type = "string", $columns = true)
576
-    { // type can be: string, array
576
+    {
577
+// type can be: string, array
577 578
         $modx = evolutionCMS();
578 579
         if ($modx->getDatabase()->isResult($src)) {
579 580
             // must be a recordset
Please login to merge, or discard this patch.
manager/includes/bootstrap.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
  * @see https://github.com/theseer/Autoload
4 4
  */
5 5
 spl_autoload_register(
6
-    function($class) {
6
+    function($class){
7 7
         static $classes = null;
8 8
         if ($classes === null) {
9 9
             $classes = array(
Please login to merge, or discard this patch.