Completed
Push — develop ( ef95a6...f399f2 )
by Maxim
06:16
created
manager/includes/paginate.inc.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@
 block discarded – undo
149 149
     /**
150 150
      * This function returns the current page number.
151 151
      *
152
-     * @return int
152
+     * @return string
153 153
      */
154 154
     public function getCurrentPage()
155 155
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
         $array_paging['total'] = $this->int_nbr_row;
102 102
 
103 103
         if ($this->int_cur_position != 0) {
104
-            $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">";
105
-            $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">";
104
+            $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">";
105
+            $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">";
106 106
         }
107 107
 
108 108
         if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) {
109 109
             $int_new_position = $this->int_cur_position + $this->int_num_result;
110
-            $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">";
111
-            $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">";
110
+            $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">";
111
+            $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">";
112 112
         }
113 113
 
114 114
         return $array_paging;
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
         for ($i = 0; $i < $this->getNumberOfPage(); $i++) {
127 127
             // if current page, do not make a link
128 128
             if ($i == $this->getCurrentPage()) {
129
-                $array_all_page[$i] = "<b>" . ($i + 1) . "</b>&nbsp;";
129
+                $array_all_page[$i] = "<b>".($i + 1)."</b>&nbsp;";
130 130
             } else {
131 131
                 $int_new_position = ($i * $this->int_num_result);
132
-                $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a>&nbsp;";
132
+                $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a>&nbsp;";
133 133
             }
134 134
         }
135 135
 
Please login to merge, or discard this patch.
manager/includes/protect.inc.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 // sanitize array
17 17
 if (!function_exists('modx_sanitize_gpc')) {
18 18
     /**
19
-     * @param array|string $values
19
+     * @param string $values
20 20
      * @param int $depth
21 21
      * @return array|string
22 22
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 }
12 12
 
13 13
 global $sanitize_seed;
14
-$sanitize_seed = 'sanitize_seed_' . base_convert(md5(__FILE__), 16, 36);
14
+$sanitize_seed = 'sanitize_seed_'.base_convert(md5(__FILE__), 16, 36);
15 15
 
16 16
 // sanitize array
17 17
 if (!function_exists('modx_sanitize_gpc')) {
Please login to merge, or discard this patch.
manager/includes/tmplvars.format.inc.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -349,7 +349,7 @@
 block discarded – undo
349 349
 /**
350 350
  * returns an array if a delimiter is present. returns array is a recordset is present
351 351
  *
352
- * @param $src
352
+ * @param string $src
353 353
  * @param string $delim
354 354
  * @param string $type
355 355
  * @param bool $columns
Please login to merge, or discard this patch.
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -21,320 +21,320 @@  discard block
 block discarded – undo
21 21
     $o = '';
22 22
 
23 23
     // process any TV commands in value
24
-	$docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
25
-	$value = ProcessTVCommand($value, $name, $docid);
24
+    $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
25
+    $value = ProcessTVCommand($value, $name, $docid);
26 26
 
27
-	$params = array();
28
-	if($paramstring) {
29
-		$cp = explode("&", $paramstring);
30
-		foreach($cp as $p => $v) {
31
-			$v = trim($v); // trim
32
-			$ar = explode("=", $v);
33
-			if(is_array($ar) && count($ar) == 2) {
34
-				$params[$ar[0]] = decodeParamValue($ar[1]);
35
-			}
36
-		}
37
-	}
27
+    $params = array();
28
+    if($paramstring) {
29
+        $cp = explode("&", $paramstring);
30
+        foreach($cp as $p => $v) {
31
+            $v = trim($v); // trim
32
+            $ar = explode("=", $v);
33
+            if(is_array($ar) && count($ar) == 2) {
34
+                $params[$ar[0]] = decodeParamValue($ar[1]);
35
+            }
36
+        }
37
+    }
38 38
 
39
-	$id = "tv$name";
40
-	switch($format) {
41
-		case 'image':
42
-			$images = parseInput($value, '||', 'array');
43
-			foreach($images as $image) {
44
-				if(!is_array($image)) {
45
-					$image = explode('==', $image);
46
-				}
47
-				$src = $image[0];
39
+    $id = "tv$name";
40
+    switch($format) {
41
+        case 'image':
42
+            $images = parseInput($value, '||', 'array');
43
+            foreach($images as $image) {
44
+                if(!is_array($image)) {
45
+                    $image = explode('==', $image);
46
+                }
47
+                $src = $image[0];
48 48
 
49
-				if($src) {
50
-					// We have a valid source
51
-					$attributes = '';
52
-					$attr = array(
53
-						'class' => $params['class'],
54
-						'src' => $src,
55
-						'id' => ($params['id'] ? $params['id'] : ''),
56
-						'alt' => $modx->htmlspecialchars($params['alttext']),
57
-						'style' => $params['style']
58
-					);
59
-					if(isset($params['align']) && $params['align'] != 'none') {
60
-						$attr['align'] = $params['align'];
61
-					}
62
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
63
-					$attributes .= ' ' . $params['attrib'];
49
+                if($src) {
50
+                    // We have a valid source
51
+                    $attributes = '';
52
+                    $attr = array(
53
+                        'class' => $params['class'],
54
+                        'src' => $src,
55
+                        'id' => ($params['id'] ? $params['id'] : ''),
56
+                        'alt' => $modx->htmlspecialchars($params['alttext']),
57
+                        'style' => $params['style']
58
+                    );
59
+                    if(isset($params['align']) && $params['align'] != 'none') {
60
+                        $attr['align'] = $params['align'];
61
+                    }
62
+                    foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
63
+                    $attributes .= ' ' . $params['attrib'];
64 64
 
65
-					// Output the image with attributes
66
-					$o .= '<img' . rtrim($attributes) . ' />';
67
-				}
68
-			}
69
-			break;
65
+                    // Output the image with attributes
66
+                    $o .= '<img' . rtrim($attributes) . ' />';
67
+                }
68
+            }
69
+            break;
70 70
 
71
-		case "delim":    // display as delimitted list
72
-			$value = parseInput($value, "||");
73
-			$p = $params['format'] ? $params['format'] : " ";
74
-			if($p == "\\n") {
75
-				$p = "\n";
76
-			}
77
-			$o = str_replace("||", $p, $value);
78
-			break;
71
+        case "delim":    // display as delimitted list
72
+            $value = parseInput($value, "||");
73
+            $p = $params['format'] ? $params['format'] : " ";
74
+            if($p == "\\n") {
75
+                $p = "\n";
76
+            }
77
+            $o = str_replace("||", $p, $value);
78
+            break;
79 79
 
80
-		case "string":
81
-			$value = parseInput($value);
82
-			$format = strtolower($params['format']);
83
-			if($format == 'upper case') {
84
-				$o = strtoupper($value);
85
-			} else if($format == 'lower case') {
86
-				$o = strtolower($value);
87
-			} else if($format == 'sentence case') {
88
-				$o = ucfirst($value);
89
-			} else if($format == 'capitalize') {
90
-				$o = ucwords($value);
91
-			} else {
92
-				$o = $value;
93
-			}
94
-			break;
80
+        case "string":
81
+            $value = parseInput($value);
82
+            $format = strtolower($params['format']);
83
+            if($format == 'upper case') {
84
+                $o = strtoupper($value);
85
+            } else if($format == 'lower case') {
86
+                $o = strtolower($value);
87
+            } else if($format == 'sentence case') {
88
+                $o = ucfirst($value);
89
+            } else if($format == 'capitalize') {
90
+                $o = ucwords($value);
91
+            } else {
92
+                $o = $value;
93
+            }
94
+            break;
95 95
 
96
-		case "date":
97
-			if($value != '' || $params['default'] == 'Yes') {
98
-				if(empty($value)) {
99
-					$value = 'now';
100
-				}
101
-				$timestamp = getUnixtimeFromDateString($value);
102
-				$p = $params['format'] ? $params['format'] : "%A %d, %B %Y";
103
-				$o = strftime($p, $timestamp);
104
-			} else {
105
-				$value = '';
106
-			}
107
-			break;
96
+        case "date":
97
+            if($value != '' || $params['default'] == 'Yes') {
98
+                if(empty($value)) {
99
+                    $value = 'now';
100
+                }
101
+                $timestamp = getUnixtimeFromDateString($value);
102
+                $p = $params['format'] ? $params['format'] : "%A %d, %B %Y";
103
+                $o = strftime($p, $timestamp);
104
+            } else {
105
+                $value = '';
106
+            }
107
+            break;
108 108
 
109
-		case "hyperlink":
110
-			$value = parseInput($value, "||", "array");
111
-			$o = '';
112
-			$countValue = count($value);
113
-			for($i = 0; $i < $countValue; $i++) {
114
-				list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]);
115
-				if(!$url) {
116
-					$url = $name;
117
-				}
118
-				if($url) {
119
-					if($o) {
120
-						$o .= '<br />';
121
-					}
122
-					$attributes = '';
123
-					// setup the link attributes
124
-					$attr = array(
125
-						'href' => $url,
126
-						'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name,
127
-						'class' => $params['class'],
128
-						'style' => $params['style'],
129
-						'target' => $params['target'],
130
-					);
131
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
132
-					$attributes .= ' ' . $params['attrib']; // add extra
109
+        case "hyperlink":
110
+            $value = parseInput($value, "||", "array");
111
+            $o = '';
112
+            $countValue = count($value);
113
+            for($i = 0; $i < $countValue; $i++) {
114
+                list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]);
115
+                if(!$url) {
116
+                    $url = $name;
117
+                }
118
+                if($url) {
119
+                    if($o) {
120
+                        $o .= '<br />';
121
+                    }
122
+                    $attributes = '';
123
+                    // setup the link attributes
124
+                    $attr = array(
125
+                        'href' => $url,
126
+                        'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name,
127
+                        'class' => $params['class'],
128
+                        'style' => $params['style'],
129
+                        'target' => $params['target'],
130
+                    );
131
+                    foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
132
+                    $attributes .= ' ' . $params['attrib']; // add extra
133 133
 
134
-					// Output the link
135
-					$o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>';
136
-				}
137
-			}
138
-			break;
134
+                    // Output the link
135
+                    $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>';
136
+                }
137
+            }
138
+            break;
139 139
 
140
-		case "htmltag":
141
-			$value = parseInput($value, "||", "array");
142
-			$tagid = $params['tagid'];
143
-			$tagname = ($params['tagname']) ? $params['tagname'] : 'div';
144
-			$o = '';
145
-			// Loop through a list of tags
140
+        case "htmltag":
141
+            $value = parseInput($value, "||", "array");
142
+            $tagid = $params['tagid'];
143
+            $tagname = ($params['tagname']) ? $params['tagname'] : 'div';
144
+            $o = '';
145
+            // Loop through a list of tags
146 146
             $countValue = count($value);
147
-			for($i = 0; $i < $countValue; $i++) {
148
-				$tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i];
149
-				if(!$tagvalue) {
150
-					continue;
151
-				}
147
+            for($i = 0; $i < $countValue; $i++) {
148
+                $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i];
149
+                if(!$tagvalue) {
150
+                    continue;
151
+                }
152 152
 
153
-				$attributes = '';
154
-				$attr = array(
155
-					'id' => ($tagid ? $tagid : $id),
156
-					// 'tv' already added to id
157
-					'class' => $params['class'],
158
-					'style' => $params['style'],
159
-				);
160
-				foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
161
-				$attributes .= ' ' . $params['attrib']; // add extra
153
+                $attributes = '';
154
+                $attr = array(
155
+                    'id' => ($tagid ? $tagid : $id),
156
+                    // 'tv' already added to id
157
+                    'class' => $params['class'],
158
+                    'style' => $params['style'],
159
+                );
160
+                foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
161
+                $attributes .= ' ' . $params['attrib']; // add extra
162 162
 
163
-				// Output the HTML Tag
164
-				$o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
165
-			}
166
-			break;
163
+                // Output the HTML Tag
164
+                $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
165
+            }
166
+            break;
167 167
 
168
-		case "richtext":
169
-			$value = parseInput($value);
170
-			$w = $params['w'] ? $params['w'] : '100%';
171
-			$h = $params['h'] ? $params['h'] : '400px';
172
-			$richtexteditor = $params['edt'] ? $params['edt'] : "";
173
-			$o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
174
-			$o .= $modx->htmlspecialchars($value);
175
-			$o .= '</textarea></div>';
176
-			$replace_richtext = array($id);
177
-			// setup editors
178
-			if(!empty($replace_richtext) && !empty($richtexteditor)) {
179
-				// invoke OnRichTextEditorInit event
180
-				$evtOut = $modx->invokeEvent("OnRichTextEditorInit", array(
181
-					'editor' => $richtexteditor,
182
-					'elements' => $replace_richtext,
183
-					'forfrontend' => 1,
184
-					'width' => $w,
185
-					'height' => $h
186
-				));
187
-				if(is_array($evtOut)) {
188
-					$o .= implode("", $evtOut);
189
-				}
190
-			}
191
-			break;
168
+        case "richtext":
169
+            $value = parseInput($value);
170
+            $w = $params['w'] ? $params['w'] : '100%';
171
+            $h = $params['h'] ? $params['h'] : '400px';
172
+            $richtexteditor = $params['edt'] ? $params['edt'] : "";
173
+            $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
174
+            $o .= $modx->htmlspecialchars($value);
175
+            $o .= '</textarea></div>';
176
+            $replace_richtext = array($id);
177
+            // setup editors
178
+            if(!empty($replace_richtext) && !empty($richtexteditor)) {
179
+                // invoke OnRichTextEditorInit event
180
+                $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array(
181
+                    'editor' => $richtexteditor,
182
+                    'elements' => $replace_richtext,
183
+                    'forfrontend' => 1,
184
+                    'width' => $w,
185
+                    'height' => $h
186
+                ));
187
+                if(is_array($evtOut)) {
188
+                    $o .= implode("", $evtOut);
189
+                }
190
+            }
191
+            break;
192 192
 
193
-		case "unixtime":
194
-			$value = parseInput($value);
195
-			$o = getUnixtimeFromDateString($value);
196
-			break;
193
+        case "unixtime":
194
+            $value = parseInput($value);
195
+            $o = getUnixtimeFromDateString($value);
196
+            break;
197 197
 
198
-		case "viewport":
199
-			$value = parseInput($value);
200
-			$id = '_' . time();
201
-			if(!$params['vpid']) {
202
-				$params['vpid'] = $id;
203
-			}
204
-			$sTag = "<iframe";
205
-			$eTag = "</iframe>";
206
-			$autoMode = "0";
207
-			$w = $params['width'];
208
-			$h = $params['height'];
209
-			if($params['stretch'] == 'Yes') {
210
-				$w = "100%";
211
-				$h = "100%";
212
-			}
213
-			if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
214
-				$autoMode = "3";  //both
215
-			} else if($params['awidth'] == 'Yes') {
216
-				$autoMode = "1"; //width only
217
-			} else if($params['aheight'] == 'Yes') {
218
-				$autoMode = "2";    //height only
219
-			}
198
+        case "viewport":
199
+            $value = parseInput($value);
200
+            $id = '_' . time();
201
+            if(!$params['vpid']) {
202
+                $params['vpid'] = $id;
203
+            }
204
+            $sTag = "<iframe";
205
+            $eTag = "</iframe>";
206
+            $autoMode = "0";
207
+            $w = $params['width'];
208
+            $h = $params['height'];
209
+            if($params['stretch'] == 'Yes') {
210
+                $w = "100%";
211
+                $h = "100%";
212
+            }
213
+            if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
214
+                $autoMode = "3";  //both
215
+            } else if($params['awidth'] == 'Yes') {
216
+                $autoMode = "1"; //width only
217
+            } else if($params['aheight'] == 'Yes') {
218
+                $autoMode = "2";    //height only
219
+            }
220 220
 
221
-			$modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array(
222
-				'name' => 'viewport',
223
-				'version' => '0',
224
-				'plaintext' => false
225
-			));
226
-			$o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
227
-			if($params['class']) {
228
-				$o .= " class='" . $params['class'] . "' ";
229
-			}
230
-			if($params['style']) {
231
-				$o .= " style='" . $params['style'] . "' ";
232
-			}
233
-			if($params['attrib']) {
234
-				$o .= $params['attrib'] . " ";
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 . "' ";
239
-			$o .= ">";
240
-			$o .= $eTag;
241
-			break;
221
+            $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array(
222
+                'name' => 'viewport',
223
+                'version' => '0',
224
+                'plaintext' => false
225
+            ));
226
+            $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
227
+            if($params['class']) {
228
+                $o .= " class='" . $params['class'] . "' ";
229
+            }
230
+            if($params['style']) {
231
+                $o .= " style='" . $params['style'] . "' ";
232
+            }
233
+            if($params['attrib']) {
234
+                $o .= $params['attrib'] . " ";
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 . "' ";
239
+            $o .= ">";
240
+            $o .= $eTag;
241
+            break;
242 242
 
243
-		case "datagrid":
244
-			include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
245
-			$grd = new DataGrid('', $value);
243
+        case "datagrid":
244
+            include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
245
+            $grd = new DataGrid('', $value);
246 246
 
247
-			$grd->noRecordMsg = $params['egmsg'];
247
+            $grd->noRecordMsg = $params['egmsg'];
248 248
 
249
-			$grd->columnHeaderClass = $params['chdrc'];
250
-			$grd->cssClass = $params['tblc'];
251
-			$grd->itemClass = $params['itmc'];
252
-			$grd->altItemClass = $params['aitmc'];
249
+            $grd->columnHeaderClass = $params['chdrc'];
250
+            $grd->cssClass = $params['tblc'];
251
+            $grd->itemClass = $params['itmc'];
252
+            $grd->altItemClass = $params['aitmc'];
253 253
 
254
-			$grd->columnHeaderStyle = $params['chdrs'];
255
-			$grd->cssStyle = $params['tbls'];
256
-			$grd->itemStyle = $params['itms'];
257
-			$grd->altItemStyle = $params['aitms'];
254
+            $grd->columnHeaderStyle = $params['chdrs'];
255
+            $grd->cssStyle = $params['tbls'];
256
+            $grd->itemStyle = $params['itms'];
257
+            $grd->altItemStyle = $params['aitms'];
258 258
 
259
-			$grd->columns = $params['cols'];
260
-			$grd->fields = $params['flds'];
261
-			$grd->colWidths = $params['cwidth'];
262
-			$grd->colAligns = $params['calign'];
263
-			$grd->colColors = $params['ccolor'];
264
-			$grd->colTypes = $params['ctype'];
259
+            $grd->columns = $params['cols'];
260
+            $grd->fields = $params['flds'];
261
+            $grd->colWidths = $params['cwidth'];
262
+            $grd->colAligns = $params['calign'];
263
+            $grd->colColors = $params['ccolor'];
264
+            $grd->colTypes = $params['ctype'];
265 265
 
266
-			$grd->cellPadding = $params['cpad'];
267
-			$grd->cellSpacing = $params['cspace'];
268
-			$grd->header = $params['head'];
269
-			$grd->footer = $params['foot'];
270
-			$grd->pageSize = $params['psize'];
271
-			$grd->pagerLocation = $params['ploc'];
272
-			$grd->pagerClass = $params['pclass'];
273
-			$grd->pagerStyle = $params['pstyle'];
274
-			$o = $grd->render();
275
-			break;
266
+            $grd->cellPadding = $params['cpad'];
267
+            $grd->cellSpacing = $params['cspace'];
268
+            $grd->header = $params['head'];
269
+            $grd->footer = $params['foot'];
270
+            $grd->pageSize = $params['psize'];
271
+            $grd->pagerLocation = $params['ploc'];
272
+            $grd->pagerClass = $params['pclass'];
273
+            $grd->pagerStyle = $params['pstyle'];
274
+            $o = $grd->render();
275
+            break;
276 276
 
277
-		case 'htmlentities':
278
-			$value = parseInput($value);
279
-			if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
280
-				// remove delimiter from checkbox and listbox-multiple TVs
281
-				$value = str_replace('||', '', $value);
282
-			}
283
-			$o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']);
284
-			break;
277
+        case 'htmlentities':
278
+            $value = parseInput($value);
279
+            if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
280
+                // remove delimiter from checkbox and listbox-multiple TVs
281
+                $value = str_replace('||', '', $value);
282
+            }
283
+            $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']);
284
+            break;
285 285
 
286
-		case 'custom_widget':
287
-			$widget_output = '';
288
-			$o = '';
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';
294
-				} else {
295
-					$widget_output = file_get_contents($file_name);
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';
301
-				} else {
302
-					/* The included file needs to set $widget_output. Can be string, array, object */
303
-					include $file_name;
304
-				}
305
-			} elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') {
306
-				$chunk_name = trim(substr($params['output'], 7));
307
-				$widget_output = $modx->getChunk($chunk_name);
308
-			} elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') {
309
-				$eval_str = trim(substr($params['output'], 6));
310
-				$widget_output = eval($eval_str);
311
-			} elseif($value !== '') {
312
-				$widget_output = $params['output'];
313
-			} else {
314
-				$widget_output = '';
315
-			}
316
-			if(is_string($widget_output)) {
317
-				$_ = $modx->config['enable_filter'];
318
-				$modx->config['enable_filter'] = 1;
319
-				$widget_output = $modx->parseText($widget_output, array('value' => $value));
320
-				$modx->config['enable_filter'] = $_;
321
-				$o = $modx->parseDocumentSource($widget_output);
322
-			} else {
323
-				$o = $widget_output;
324
-			}
325
-			break;
286
+        case 'custom_widget':
287
+            $widget_output = '';
288
+            $o = '';
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';
294
+                } else {
295
+                    $widget_output = file_get_contents($file_name);
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';
301
+                } else {
302
+                    /* The included file needs to set $widget_output. Can be string, array, object */
303
+                    include $file_name;
304
+                }
305
+            } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') {
306
+                $chunk_name = trim(substr($params['output'], 7));
307
+                $widget_output = $modx->getChunk($chunk_name);
308
+            } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') {
309
+                $eval_str = trim(substr($params['output'], 6));
310
+                $widget_output = eval($eval_str);
311
+            } elseif($value !== '') {
312
+                $widget_output = $params['output'];
313
+            } else {
314
+                $widget_output = '';
315
+            }
316
+            if(is_string($widget_output)) {
317
+                $_ = $modx->config['enable_filter'];
318
+                $modx->config['enable_filter'] = 1;
319
+                $widget_output = $modx->parseText($widget_output, array('value' => $value));
320
+                $modx->config['enable_filter'] = $_;
321
+                $o = $modx->parseDocumentSource($widget_output);
322
+            } else {
323
+                $o = $widget_output;
324
+            }
325
+            break;
326 326
 
327
-		default:
328
-			$value = parseInput($value);
329
-			if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
330
-				// add separator
331
-				$value = explode('||', $value);
332
-				$value = implode($sep, $value);
333
-			}
334
-			$o = $value;
335
-			break;
336
-	}
337
-	return $o;
327
+        default:
328
+            $value = parseInput($value);
329
+            if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
330
+                // add separator
331
+                $value = explode('||', $value);
332
+                $value = implode($sep, $value);
333
+            }
334
+            $o = $value;
335
+            break;
336
+    }
337
+    return $o;
338 338
 }
339 339
 
340 340
 /**
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
  * @return string
343 343
  */
344 344
 function decodeParamValue($s) {
345
-	$s = str_replace("%3D", '=', $s); // =
346
-	return str_replace("%26", '&', $s); // &
345
+    $s = str_replace("%3D", '=', $s); // =
346
+    return str_replace("%26", '&', $s); // &
347 347
 }
348 348
 
349 349
 /**
@@ -357,19 +357,19 @@  discard block
 block discarded – undo
357 357
  */
358 358
 function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array
359 359
     $modx = evolutionCMS();
360
-	if($modx->db->isResult($src)) {
361
-		// must be a recordset
362
-		$rows = array();
363
-		while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols);
364
-		return ($type == "array") ? $rows : implode($delim, $rows);
365
-	} else {
366
-		// must be a text
367
-		if($type == "array") {
368
-			return explode($delim, $src);
369
-		} else {
370
-			return $src;
371
-		}
372
-	}
360
+    if($modx->db->isResult($src)) {
361
+        // must be a recordset
362
+        $rows = array();
363
+        while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols);
364
+        return ($type == "array") ? $rows : implode($delim, $rows);
365
+    } else {
366
+        // must be a text
367
+        if($type == "array") {
368
+            return explode($delim, $src);
369
+        } else {
370
+            return $src;
371
+        }
372
+    }
373 373
 }
374 374
 
375 375
 /**
@@ -377,21 +377,21 @@  discard block
 block discarded – undo
377 377
  * @return bool|false|int
378 378
  */
379 379
 function getUnixtimeFromDateString($value) {
380
-	$timestamp = false;
381
-	// Check for MySQL or legacy style date
382
-	$date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
383
-	$date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
384
-	$matches = array();
385
-	if(strpos($value, '-') !== false) {
386
-		if(preg_match($date_match_1, $value, $matches)) {
387
-			$timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
388
-		} elseif(preg_match($date_match_2, $value, $matches)) {
389
-			$timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
390
-		}
391
-	}
392
-	// If those didn't work, use strtotime to figure out the date
393
-	if($timestamp === false || $timestamp === -1) {
394
-		$timestamp = strtotime($value);
395
-	}
396
-	return $timestamp;
380
+    $timestamp = false;
381
+    // Check for MySQL or legacy style date
382
+    $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
383
+    $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
384
+    $matches = array();
385
+    if(strpos($value, '-') !== false) {
386
+        if(preg_match($date_match_1, $value, $matches)) {
387
+            $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
388
+        } elseif(preg_match($date_match_2, $value, $matches)) {
389
+            $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
390
+        }
391
+    }
392
+    // If those didn't work, use strtotime to figure out the date
393
+    if($timestamp === false || $timestamp === -1) {
394
+        $timestamp = strtotime($value);
395
+    }
396
+    return $timestamp;
397 397
 }
Please login to merge, or discard this 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
     $modx = evolutionCMS();
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
     $modx = evolutionCMS();
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.
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@  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 21
     $modx = evolutionCMS();
21 22
     $o = '';
@@ -59,7 +60,9 @@  discard block
 block discarded – undo
59 60
 					if(isset($params['align']) && $params['align'] != 'none') {
60 61
 						$attr['align'] = $params['align'];
61 62
 					}
62
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
63
+					foreach($attr as $k => $v) {
64
+					    $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
65
+					}
63 66
 					$attributes .= ' ' . $params['attrib'];
64 67
 
65 68
 					// Output the image with attributes
@@ -128,7 +131,9 @@  discard block
 block discarded – undo
128 131
 						'style' => $params['style'],
129 132
 						'target' => $params['target'],
130 133
 					);
131
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
134
+					foreach($attr as $k => $v) {
135
+					    $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
136
+					}
132 137
 					$attributes .= ' ' . $params['attrib']; // add extra
133 138
 
134 139
 					// Output the link
@@ -157,7 +162,9 @@  discard block
 block discarded – undo
157 162
 					'class' => $params['class'],
158 163
 					'style' => $params['style'],
159 164
 				);
160
-				foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
165
+				foreach($attr as $k => $v) {
166
+				    $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
167
+				}
161 168
 				$attributes .= ' ' . $params['attrib']; // add extra
162 169
 
163 170
 				// Output the HTML Tag
@@ -341,7 +348,8 @@  discard block
 block discarded – undo
341 348
  * @param string $s
342 349
  * @return string
343 350
  */
344
-function decodeParamValue($s) {
351
+function decodeParamValue($s)
352
+{
345 353
 	$s = str_replace("%3D", '=', $s); // =
346 354
 	return str_replace("%26", '&', $s); // &
347 355
 }
@@ -355,12 +363,16 @@  discard block
 block discarded – undo
355 363
  * @param bool $columns
356 364
  * @return array|string
357 365
  */
358
-function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array
366
+function parseInput($src, $delim = "||", $type = "string", $columns = true)
367
+{
368
+// type can be: string, array
359 369
     $modx = evolutionCMS();
360 370
 	if($modx->db->isResult($src)) {
361 371
 		// must be a recordset
362 372
 		$rows = array();
363
-		while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols);
373
+		while($cols = $modx->db->getRow($src, 'num')) {
374
+		    $rows[] = ($columns) ? $cols : implode(" ", $cols);
375
+		}
364 376
 		return ($type == "array") ? $rows : implode($delim, $rows);
365 377
 	} else {
366 378
 		// must be a text
@@ -376,7 +388,8 @@  discard block
 block discarded – undo
376 388
  * @param string $value
377 389
  * @return bool|false|int
378 390
  */
379
-function getUnixtimeFromDateString($value) {
391
+function getUnixtimeFromDateString($value)
392
+{
380 393
 	$timestamp = false;
381 394
 	// Check for MySQL or legacy style date
382 395
 	$date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
Please login to merge, or discard this patch.
manager/includes/tmplvars.inc.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -381,7 +381,7 @@
 block discarded – undo
381 381
 } // end renderFormElement function
382 382
 
383 383
 /**
384
- * @param string|array|mysqli_result $v
384
+ * @param string $v
385 385
  * @return array
386 386
  */
387 387
 function ParseIntputOptions($v) {
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
  * @param array $tvsArray
13 13
  * @return string
14 14
  */
15
-function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) {
15
+function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()){
16 16
     $modx = evolutionCMS();
17 17
 	global $_style;
18 18
 	global $_lang;
19 19
 	global $content;
20 20
 	global $which_browser;
21 21
 
22
-	if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) {
22
+	if (substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) {
23 23
 		$eval_str = trim(substr($default_text, 7));
24 24
 		$default_text = eval($eval_str);
25 25
 		$field_value = $default_text;
@@ -27,74 +27,74 @@  discard block
 block discarded – undo
27 27
 
28 28
 	$field_html = '';
29 29
 	$cimode = strpos($field_type, ':');
30
-	if($cimode === false) {
31
-		switch($field_type) {
30
+	if ($cimode === false) {
31
+		switch ($field_type) {
32 32
 
33 33
 			case "text": // handler for regular text boxes
34 34
 			case "rawtext"; // non-htmlentity converted text boxes
35
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
35
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />';
36 36
 				break;
37 37
 			case "email": // handles email input fields
38
-				$field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
38
+				$field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>';
39 39
 				break;
40 40
 			case "number": // handles the input of numbers
41
-				$field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
41
+				$field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
42 42
 				break;
43 43
 			case "textareamini": // handler for textarea mini boxes
44
-				$field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
44
+				$field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>';
45 45
 				break;
46 46
 			case "textarea": // handler for textarea boxes
47 47
 			case "rawtextarea": // non-htmlentity convertex textarea boxes
48 48
 			case "htmlarea": // handler for textarea boxes (deprecated)
49 49
 			case "richtext": // handler for textarea boxes
50
-				$field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
50
+				$field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>';
51 51
 				break;
52 52
 			case "date":
53 53
 				$field_id = str_replace(array(
54 54
 					'-',
55 55
 					'.'
56 56
 				), '_', urldecode($field_id));
57
-				if($field_value == '') {
57
+				if ($field_value == '') {
58 58
 					$field_value = 0;
59 59
 				}
60
-				$field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
61
-				$field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
60
+				$field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />';
61
+				$field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>';
62 62
 
63 63
 				break;
64 64
 			case "dropdown": // handler for select boxes
65
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
65
+				$field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">';
66 66
 				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
67
-				while(list($item, $itemvalue) = each($index_list)) {
67
+				while (list($item, $itemvalue) = each($index_list)) {
68 68
 					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
69
-					if(strlen($itemvalue) == 0) {
69
+					if (strlen($itemvalue) == 0) {
70 70
 						$itemvalue = $item;
71 71
 					}
72
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
72
+					$field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
73 73
 				}
74 74
 				$field_html .= "</select>";
75 75
 				break;
76 76
 			case "listbox": // handler for select boxes
77
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
77
+				$field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">';
78 78
 				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
79
-				while(list($item, $itemvalue) = each($index_list)) {
79
+				while (list($item, $itemvalue) = each($index_list)) {
80 80
 					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
81
-					if(strlen($itemvalue) == 0) {
81
+					if (strlen($itemvalue) == 0) {
82 82
 						$itemvalue = $item;
83 83
 					}
84
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
84
+					$field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
85 85
 				}
86 86
 				$field_html .= "</select>";
87 87
 				break;
88 88
 			case "listbox-multiple": // handler for select boxes where you can choose multiple items
89 89
 				$field_value = explode("||", $field_value);
90
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
90
+				$field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
91 91
 				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
92
-				while(list($item, $itemvalue) = each($index_list)) {
92
+				while (list($item, $itemvalue) = each($index_list)) {
93 93
 					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
94
-					if(strlen($itemvalue) == 0) {
94
+					if (strlen($itemvalue) == 0) {
95 95
 						$itemvalue = $item;
96 96
 					}
97
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
97
+					$field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
98 98
 				}
99 99
 				$field_html .= "</select>";
100 100
 				break;
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 					'ftp://' => 'ftp://',
107 107
 					'mailto:' => 'mailto:'
108 108
 				);
109
-				$field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
110
-				foreach($urls as $k => $v) {
111
-					if(strpos($field_value, $v) === false) {
112
-						$field_html .= '<option value="' . $v . '">' . $k . '</option>';
109
+				$field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">';
110
+				foreach ($urls as $k => $v) {
111
+					if (strpos($field_value, $v) === false) {
112
+						$field_html .= '<option value="'.$v.'">'.$k.'</option>';
113 113
 					} else {
114 114
 						$field_value = str_replace($v, '', $field_value);
115
-						$field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
115
+						$field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>';
116 116
 					}
117 117
 				}
118 118
 				$field_html .= '</select></td><td>';
119
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
119
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>';
120 120
 				break;
121 121
 			case 'checkbox': // handles check boxes
122 122
 				$values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 				$tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />';
125 125
 				static $i = 0;
126 126
 				$_ = array();
127
-				foreach($index_list as $c => $item) {
128
-					if(is_array($item)) {
127
+				foreach ($index_list as $c => $item) {
128
+					if (is_array($item)) {
129 129
 						$name = trim($item[0]);
130 130
 						$value = isset($item[1]) ? $item[1] : $name;
131 131
 					} else {
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 			case "option": // handles radio buttons
152 152
 				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
153 153
 				static $i = 0;
154
-				while(list($item, $itemvalue) = each($index_list)) {
154
+				while (list($item, $itemvalue) = each($index_list)) {
155 155
 					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
156
-					if(strlen($itemvalue) == 0) {
156
+					if (strlen($itemvalue) == 0) {
157 157
 						$itemvalue = $item;
158 158
 					}
159
-					$field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
159
+					$field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />';
160 160
 					$i++;
161 161
 				}
162 162
 				break;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				global $_lang;
165 165
 				global $ResourceManagerLoaded;
166 166
 				global $content, $use_editor, $which_editor;
167
-				if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
167
+				if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
168 168
 					$field_html .= "
169 169
 						<script type=\"text/javascript\">
170 170
 							/* <![CDATA[ */
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
 									lastImageCtrl = ctrl;
187 187
 									var w = screen.width * 0.5;
188 188
 									var h = screen.height * 0.5;
189
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
189
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
190 190
 								}
191 191
 								function BrowseFileServer(ctrl) {
192 192
 									lastFileCtrl = ctrl;
193 193
 									var w = screen.width * 0.5;
194 194
 									var h = screen.height * 0.5;
195
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
195
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
196 196
 								}
197 197
 								function SetUrlChange(el) {
198 198
 									if ('createEvent' in document) {
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
 						</script>";
227 227
 					$ResourceManagerLoaded = true;
228 228
 				}
229
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
229
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />';
230 230
 				break;
231 231
 			case "file": // handles the input of file uploads
232 232
 				/* Modified by Timon for use with resource browser */
233 233
 				global $_lang;
234 234
 				global $ResourceManagerLoaded;
235 235
 				global $content, $use_editor, $which_editor;
236
-				if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
236
+				if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
237 237
 					/* I didn't understand the meaning of the condition above, so I left it untouched ;-) */
238 238
 					$field_html .= "
239 239
 						<script type=\"text/javascript\">
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 									lastImageCtrl = ctrl;
257 257
 									var w = screen.width * 0.5;
258 258
 									var h = screen.height * 0.5;
259
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
259
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
260 260
 								}
261 261
 								function BrowseFileServer(ctrl) {
262 262
 									lastFileCtrl = ctrl;
263 263
 									var w = screen.width * 0.5;
264 264
 									var h = screen.height * 0.5;
265
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
265
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
266 266
 								}
267 267
 								function SetUrlChange(el) {
268 268
 									if ('createEvent' in document) {
@@ -296,39 +296,39 @@  discard block
 block discarded – undo
296 296
 						</script>";
297 297
 					$ResourceManagerLoaded = true;
298 298
 				}
299
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
299
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />';
300 300
 
301 301
 				break;
302 302
 
303 303
 			case 'custom_tv':
304 304
 				$custom_output = '';
305 305
 				/* If we are loading a file */
306
-				if(substr($field_elements, 0, 5) == "@FILE") {
307
-					$file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
308
-					if(!file_exists($file_name)) {
309
-						$custom_output = $file_name . ' does not exist';
306
+				if (substr($field_elements, 0, 5) == "@FILE") {
307
+					$file_name = MODX_BASE_PATH.trim(substr($field_elements, 6));
308
+					if (!file_exists($file_name)) {
309
+						$custom_output = $file_name.' does not exist';
310 310
 					} else {
311 311
 						$custom_output = file_get_contents($file_name);
312 312
 					}
313
-				} elseif(substr($field_elements, 0, 8) == '@INCLUDE') {
314
-					$file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
315
-					if(!file_exists($file_name)) {
316
-						$custom_output = $file_name . ' does not exist';
313
+				} elseif (substr($field_elements, 0, 8) == '@INCLUDE') {
314
+					$file_name = MODX_BASE_PATH.trim(substr($field_elements, 9));
315
+					if (!file_exists($file_name)) {
316
+						$custom_output = $file_name.' does not exist';
317 317
 					} else {
318 318
 						ob_start();
319 319
 						include $file_name;
320 320
 						$custom_output = ob_get_contents();
321 321
 						ob_end_clean();
322 322
 					}
323
-				} elseif(substr($field_elements, 0, 6) == "@CHUNK") {
323
+				} elseif (substr($field_elements, 0, 6) == "@CHUNK") {
324 324
 					$chunk_name = trim(substr($field_elements, 7));
325 325
 					$chunk_body = $modx->getChunk($chunk_name);
326
-					if($chunk_body == false) {
327
-						$custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
326
+					if ($chunk_body == false) {
327
+						$custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')';
328 328
 					} else {
329 329
 						$custom_output = $chunk_body;
330 330
 					}
331
-				} elseif(substr($field_elements, 0, 5) == "@EVAL") {
331
+				} elseif (substr($field_elements, 0, 5) == "@EVAL") {
332 332
 					$eval_str = trim(substr($field_elements, 6));
333 333
 					$custom_output = eval($eval_str);
334 334
 				} else {
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
 				break;
350 350
 
351 351
 			default: // the default handler -- for errors, mostly
352
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
352
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />';
353 353
 
354 354
 		} // end switch statement
355 355
 	} else {
356 356
 		$custom = explode(":", $field_type);
357 357
 		$custom_output = '';
358
-		$file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
359
-		if(!file_exists($file_name)) {
360
-			$custom_output = $file_name . ' does not exist';
358
+		$file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php';
359
+		if (!file_exists($file_name)) {
360
+			$custom_output = $file_name.' does not exist';
361 361
 		} else {
362 362
 			ob_start();
363 363
 			include $file_name;
@@ -384,13 +384,13 @@  discard block
 block discarded – undo
384 384
  * @param string|array|mysqli_result $v
385 385
  * @return array
386 386
  */
387
-function ParseIntputOptions($v) {
387
+function ParseIntputOptions($v){
388 388
     $modx = evolutionCMS();
389 389
 	$a = array();
390
-	if(is_array($v)) {
390
+	if (is_array($v)) {
391 391
 		return $v;
392
-	} else if($modx->db->isResult($v)) {
393
-		while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
392
+	} else if ($modx->db->isResult($v)) {
393
+		while ($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
394 394
 	} else {
395 395
 		$a = explode("||", $v);
396 396
 	}
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
  * @param array $tvsArray
13 13
  * @return string
14 14
  */
15
-function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) {
15
+function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array())
16
+{
16 17
     $modx = evolutionCMS();
17 18
 	global $_style;
18 19
 	global $_lang;
@@ -384,13 +385,16 @@  discard block
 block discarded – undo
384 385
  * @param string|array|mysqli_result $v
385 386
  * @return array
386 387
  */
387
-function ParseIntputOptions($v) {
388
+function ParseIntputOptions($v)
389
+{
388 390
     $modx = evolutionCMS();
389 391
 	$a = array();
390 392
 	if(is_array($v)) {
391 393
 		return $v;
392 394
 	} else if($modx->db->isResult($v)) {
393
-		while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
395
+		while($cols = $modx->db->getRow($v, 'num')) {
396
+		    $a[] = $cols;
397
+		}
394 398
 	} else {
395 399
 		$a = explode("||", $v);
396 400
 	}
Please login to merge, or discard this patch.
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -14,158 +14,158 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) {
16 16
     $modx = evolutionCMS();
17
-	global $_style;
18
-	global $_lang;
19
-	global $content;
20
-	global $which_browser;
17
+    global $_style;
18
+    global $_lang;
19
+    global $content;
20
+    global $which_browser;
21 21
 
22
-	if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) {
23
-		$eval_str = trim(substr($default_text, 7));
24
-		$default_text = eval($eval_str);
25
-		$field_value = $default_text;
26
-	}
22
+    if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) {
23
+        $eval_str = trim(substr($default_text, 7));
24
+        $default_text = eval($eval_str);
25
+        $field_value = $default_text;
26
+    }
27 27
 
28
-	$field_html = '';
29
-	$cimode = strpos($field_type, ':');
30
-	if($cimode === false) {
31
-		switch($field_type) {
28
+    $field_html = '';
29
+    $cimode = strpos($field_type, ':');
30
+    if($cimode === false) {
31
+        switch($field_type) {
32 32
 
33
-			case "text": // handler for regular text boxes
34
-			case "rawtext"; // non-htmlentity converted text boxes
35
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
36
-				break;
37
-			case "email": // handles email input fields
38
-				$field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
39
-				break;
40
-			case "number": // handles the input of numbers
41
-				$field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
42
-				break;
43
-			case "textareamini": // handler for textarea mini boxes
44
-				$field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
45
-				break;
46
-			case "textarea": // handler for textarea boxes
47
-			case "rawtextarea": // non-htmlentity convertex textarea boxes
48
-			case "htmlarea": // handler for textarea boxes (deprecated)
49
-			case "richtext": // handler for textarea boxes
50
-				$field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
51
-				break;
52
-			case "date":
53
-				$field_id = str_replace(array(
54
-					'-',
55
-					'.'
56
-				), '_', urldecode($field_id));
57
-				if($field_value == '') {
58
-					$field_value = 0;
59
-				}
60
-				$field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
61
-				$field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
33
+            case "text": // handler for regular text boxes
34
+            case "rawtext"; // non-htmlentity converted text boxes
35
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
36
+                break;
37
+            case "email": // handles email input fields
38
+                $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
39
+                break;
40
+            case "number": // handles the input of numbers
41
+                $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
42
+                break;
43
+            case "textareamini": // handler for textarea mini boxes
44
+                $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
45
+                break;
46
+            case "textarea": // handler for textarea boxes
47
+            case "rawtextarea": // non-htmlentity convertex textarea boxes
48
+            case "htmlarea": // handler for textarea boxes (deprecated)
49
+            case "richtext": // handler for textarea boxes
50
+                $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
51
+                break;
52
+            case "date":
53
+                $field_id = str_replace(array(
54
+                    '-',
55
+                    '.'
56
+                ), '_', urldecode($field_id));
57
+                if($field_value == '') {
58
+                    $field_value = 0;
59
+                }
60
+                $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
61
+                $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
62 62
 
63
-				break;
64
-			case "dropdown": // handler for select boxes
65
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
66
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
67
-				while(list($item, $itemvalue) = each($index_list)) {
68
-					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
69
-					if(strlen($itemvalue) == 0) {
70
-						$itemvalue = $item;
71
-					}
72
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
73
-				}
74
-				$field_html .= "</select>";
75
-				break;
76
-			case "listbox": // handler for select boxes
77
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
78
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
79
-				while(list($item, $itemvalue) = each($index_list)) {
80
-					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
81
-					if(strlen($itemvalue) == 0) {
82
-						$itemvalue = $item;
83
-					}
84
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
85
-				}
86
-				$field_html .= "</select>";
87
-				break;
88
-			case "listbox-multiple": // handler for select boxes where you can choose multiple items
89
-				$field_value = explode("||", $field_value);
90
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
91
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
92
-				while(list($item, $itemvalue) = each($index_list)) {
93
-					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
94
-					if(strlen($itemvalue) == 0) {
95
-						$itemvalue = $item;
96
-					}
97
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
98
-				}
99
-				$field_html .= "</select>";
100
-				break;
101
-			case "url": // handles url input fields
102
-				$urls = array(
103
-					'' => '--',
104
-					'http://' => 'http://',
105
-					'https://' => 'https://',
106
-					'ftp://' => 'ftp://',
107
-					'mailto:' => 'mailto:'
108
-				);
109
-				$field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
110
-				foreach($urls as $k => $v) {
111
-					if(strpos($field_value, $v) === false) {
112
-						$field_html .= '<option value="' . $v . '">' . $k . '</option>';
113
-					} else {
114
-						$field_value = str_replace($v, '', $field_value);
115
-						$field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
116
-					}
117
-				}
118
-				$field_html .= '</select></td><td>';
119
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
120
-				break;
121
-			case 'checkbox': // handles check boxes
122
-				$values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
123
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
124
-				$tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />';
125
-				static $i = 0;
126
-				$_ = array();
127
-				foreach($index_list as $c => $item) {
128
-					if(is_array($item)) {
129
-						$name = trim($item[0]);
130
-						$value = isset($item[1]) ? $item[1] : $name;
131
-					} else {
132
-						$item = trim($item);
133
-						list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array(
134
-							$item,
135
-							$item
136
-						);
137
-					}
138
-					$checked = in_array($value, $values) ? ' checked="checked"' : '';
139
-					$param = array(
140
-						$modx->htmlspecialchars($value),
141
-						$i,
142
-						$field_id,
143
-						$checked,
144
-						$name
145
-					);
146
-					$_[] = vsprintf($tpl, $param);
147
-					$i++;
148
-				}
149
-				$field_html = implode("\n", $_);
150
-				break;
151
-			case "option": // handles radio buttons
152
-				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
153
-				static $i = 0;
154
-				while(list($item, $itemvalue) = each($index_list)) {
155
-					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
156
-					if(strlen($itemvalue) == 0) {
157
-						$itemvalue = $item;
158
-					}
159
-					$field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
160
-					$i++;
161
-				}
162
-				break;
163
-			case "image": // handles image fields using htmlarea image manager
164
-				global $_lang;
165
-				global $ResourceManagerLoaded;
166
-				global $content, $use_editor, $which_editor;
167
-				if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
168
-					$field_html .= "
63
+                break;
64
+            case "dropdown": // handler for select boxes
65
+                $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
66
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
67
+                while(list($item, $itemvalue) = each($index_list)) {
68
+                    list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
69
+                    if(strlen($itemvalue) == 0) {
70
+                        $itemvalue = $item;
71
+                    }
72
+                    $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
73
+                }
74
+                $field_html .= "</select>";
75
+                break;
76
+            case "listbox": // handler for select boxes
77
+                $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
78
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
79
+                while(list($item, $itemvalue) = each($index_list)) {
80
+                    list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
81
+                    if(strlen($itemvalue) == 0) {
82
+                        $itemvalue = $item;
83
+                    }
84
+                    $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
85
+                }
86
+                $field_html .= "</select>";
87
+                break;
88
+            case "listbox-multiple": // handler for select boxes where you can choose multiple items
89
+                $field_value = explode("||", $field_value);
90
+                $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
91
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
92
+                while(list($item, $itemvalue) = each($index_list)) {
93
+                    list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
94
+                    if(strlen($itemvalue) == 0) {
95
+                        $itemvalue = $item;
96
+                    }
97
+                    $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
98
+                }
99
+                $field_html .= "</select>";
100
+                break;
101
+            case "url": // handles url input fields
102
+                $urls = array(
103
+                    '' => '--',
104
+                    'http://' => 'http://',
105
+                    'https://' => 'https://',
106
+                    'ftp://' => 'ftp://',
107
+                    'mailto:' => 'mailto:'
108
+                );
109
+                $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
110
+                foreach($urls as $k => $v) {
111
+                    if(strpos($field_value, $v) === false) {
112
+                        $field_html .= '<option value="' . $v . '">' . $k . '</option>';
113
+                    } else {
114
+                        $field_value = str_replace($v, '', $field_value);
115
+                        $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
116
+                    }
117
+                }
118
+                $field_html .= '</select></td><td>';
119
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
120
+                break;
121
+            case 'checkbox': // handles check boxes
122
+                $values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
123
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
124
+                $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />';
125
+                static $i = 0;
126
+                $_ = array();
127
+                foreach($index_list as $c => $item) {
128
+                    if(is_array($item)) {
129
+                        $name = trim($item[0]);
130
+                        $value = isset($item[1]) ? $item[1] : $name;
131
+                    } else {
132
+                        $item = trim($item);
133
+                        list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array(
134
+                            $item,
135
+                            $item
136
+                        );
137
+                    }
138
+                    $checked = in_array($value, $values) ? ' checked="checked"' : '';
139
+                    $param = array(
140
+                        $modx->htmlspecialchars($value),
141
+                        $i,
142
+                        $field_id,
143
+                        $checked,
144
+                        $name
145
+                    );
146
+                    $_[] = vsprintf($tpl, $param);
147
+                    $i++;
148
+                }
149
+                $field_html = implode("\n", $_);
150
+                break;
151
+            case "option": // handles radio buttons
152
+                $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
153
+                static $i = 0;
154
+                while(list($item, $itemvalue) = each($index_list)) {
155
+                    list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
156
+                    if(strlen($itemvalue) == 0) {
157
+                        $itemvalue = $item;
158
+                    }
159
+                    $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
160
+                    $i++;
161
+                }
162
+                break;
163
+            case "image": // handles image fields using htmlarea image manager
164
+                global $_lang;
165
+                global $ResourceManagerLoaded;
166
+                global $content, $use_editor, $which_editor;
167
+                if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
168
+                    $field_html .= "
169 169
 						<script type=\"text/javascript\">
170 170
 							/* <![CDATA[ */
171 171
 								var lastImageCtrl;
@@ -224,18 +224,18 @@  discard block
 block discarded – undo
224 224
 								}
225 225
 							/* ]]> */
226 226
 						</script>";
227
-					$ResourceManagerLoaded = true;
228
-				}
229
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
230
-				break;
231
-			case "file": // handles the input of file uploads
232
-				/* Modified by Timon for use with resource browser */
233
-				global $_lang;
234
-				global $ResourceManagerLoaded;
235
-				global $content, $use_editor, $which_editor;
236
-				if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
237
-					/* I didn't understand the meaning of the condition above, so I left it untouched ;-) */
238
-					$field_html .= "
227
+                    $ResourceManagerLoaded = true;
228
+                }
229
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
230
+                break;
231
+            case "file": // handles the input of file uploads
232
+                /* Modified by Timon for use with resource browser */
233
+                global $_lang;
234
+                global $ResourceManagerLoaded;
235
+                global $content, $use_editor, $which_editor;
236
+                if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
237
+                    /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */
238
+                    $field_html .= "
239 239
 						<script type=\"text/javascript\">
240 240
 							/* <![CDATA[ */
241 241
 								var lastImageCtrl;
@@ -294,90 +294,90 @@  discard block
 block discarded – undo
294 294
 								}
295 295
 							/* ]]> */
296 296
 						</script>";
297
-					$ResourceManagerLoaded = true;
298
-				}
299
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
297
+                    $ResourceManagerLoaded = true;
298
+                }
299
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
300 300
 
301
-				break;
301
+                break;
302 302
 
303
-			case 'custom_tv':
304
-				$custom_output = '';
305
-				/* If we are loading a file */
306
-				if(substr($field_elements, 0, 5) == "@FILE") {
307
-					$file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
308
-					if(!file_exists($file_name)) {
309
-						$custom_output = $file_name . ' does not exist';
310
-					} else {
311
-						$custom_output = file_get_contents($file_name);
312
-					}
313
-				} elseif(substr($field_elements, 0, 8) == '@INCLUDE') {
314
-					$file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
315
-					if(!file_exists($file_name)) {
316
-						$custom_output = $file_name . ' does not exist';
317
-					} else {
318
-						ob_start();
319
-						include $file_name;
320
-						$custom_output = ob_get_contents();
321
-						ob_end_clean();
322
-					}
323
-				} elseif(substr($field_elements, 0, 6) == "@CHUNK") {
324
-					$chunk_name = trim(substr($field_elements, 7));
325
-					$chunk_body = $modx->getChunk($chunk_name);
326
-					if($chunk_body == false) {
327
-						$custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
328
-					} else {
329
-						$custom_output = $chunk_body;
330
-					}
331
-				} elseif(substr($field_elements, 0, 5) == "@EVAL") {
332
-					$eval_str = trim(substr($field_elements, 6));
333
-					$custom_output = eval($eval_str);
334
-				} else {
335
-					$custom_output = $field_elements;
336
-				}
337
-				$replacements = array(
338
-					'[+field_type+]' => $field_type,
339
-					'[+field_id+]' => $field_id,
340
-					'[+default_text+]' => $default_text,
341
-					'[+field_value+]' => $modx->htmlspecialchars($field_value),
342
-					'[+field_style+]' => $field_style,
343
-				);
344
-				$custom_output = str_replace(array_keys($replacements), $replacements, $custom_output);
345
-				$modx->documentObject = $content;
346
-				$modx->documentIdentifier = $content['id'];
347
-				$custom_output = $modx->parseDocumentSource($custom_output);
348
-				$field_html .= $custom_output;
349
-				break;
303
+            case 'custom_tv':
304
+                $custom_output = '';
305
+                /* If we are loading a file */
306
+                if(substr($field_elements, 0, 5) == "@FILE") {
307
+                    $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
308
+                    if(!file_exists($file_name)) {
309
+                        $custom_output = $file_name . ' does not exist';
310
+                    } else {
311
+                        $custom_output = file_get_contents($file_name);
312
+                    }
313
+                } elseif(substr($field_elements, 0, 8) == '@INCLUDE') {
314
+                    $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
315
+                    if(!file_exists($file_name)) {
316
+                        $custom_output = $file_name . ' does not exist';
317
+                    } else {
318
+                        ob_start();
319
+                        include $file_name;
320
+                        $custom_output = ob_get_contents();
321
+                        ob_end_clean();
322
+                    }
323
+                } elseif(substr($field_elements, 0, 6) == "@CHUNK") {
324
+                    $chunk_name = trim(substr($field_elements, 7));
325
+                    $chunk_body = $modx->getChunk($chunk_name);
326
+                    if($chunk_body == false) {
327
+                        $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
328
+                    } else {
329
+                        $custom_output = $chunk_body;
330
+                    }
331
+                } elseif(substr($field_elements, 0, 5) == "@EVAL") {
332
+                    $eval_str = trim(substr($field_elements, 6));
333
+                    $custom_output = eval($eval_str);
334
+                } else {
335
+                    $custom_output = $field_elements;
336
+                }
337
+                $replacements = array(
338
+                    '[+field_type+]' => $field_type,
339
+                    '[+field_id+]' => $field_id,
340
+                    '[+default_text+]' => $default_text,
341
+                    '[+field_value+]' => $modx->htmlspecialchars($field_value),
342
+                    '[+field_style+]' => $field_style,
343
+                );
344
+                $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output);
345
+                $modx->documentObject = $content;
346
+                $modx->documentIdentifier = $content['id'];
347
+                $custom_output = $modx->parseDocumentSource($custom_output);
348
+                $field_html .= $custom_output;
349
+                break;
350 350
 
351
-			default: // the default handler -- for errors, mostly
352
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
351
+            default: // the default handler -- for errors, mostly
352
+                $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
353 353
 
354
-		} // end switch statement
355
-	} else {
356
-		$custom = explode(":", $field_type);
357
-		$custom_output = '';
358
-		$file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
359
-		if(!file_exists($file_name)) {
360
-			$custom_output = $file_name . ' does not exist';
361
-		} else {
362
-			ob_start();
363
-			include $file_name;
364
-			$custom_output = ob_get_contents();
365
-			ob_end_clean();
366
-		}
367
-		$replacements = array(
368
-			'[+field_type+]' => $field_type,
369
-			'[+field_id+]' => $field_id,
370
-			'[+default_text+]' => $default_text,
371
-			'[+field_value+]' => $modx->htmlspecialchars($field_value),
372
-			'[+field_style+]' => $field_style,
373
-		);
374
-		$custom_output = str_replace(array_keys($replacements), $replacements, $custom_output);
375
-		$modx->documentObject = $content;
376
-		$custom_output = $modx->parseDocumentSource($custom_output);
377
-		$field_html .= $custom_output;
378
-	}
354
+        } // end switch statement
355
+    } else {
356
+        $custom = explode(":", $field_type);
357
+        $custom_output = '';
358
+        $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
359
+        if(!file_exists($file_name)) {
360
+            $custom_output = $file_name . ' does not exist';
361
+        } else {
362
+            ob_start();
363
+            include $file_name;
364
+            $custom_output = ob_get_contents();
365
+            ob_end_clean();
366
+        }
367
+        $replacements = array(
368
+            '[+field_type+]' => $field_type,
369
+            '[+field_id+]' => $field_id,
370
+            '[+default_text+]' => $default_text,
371
+            '[+field_value+]' => $modx->htmlspecialchars($field_value),
372
+            '[+field_style+]' => $field_style,
373
+        );
374
+        $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output);
375
+        $modx->documentObject = $content;
376
+        $custom_output = $modx->parseDocumentSource($custom_output);
377
+        $field_html .= $custom_output;
378
+    }
379 379
 
380
-	return $field_html;
380
+    return $field_html;
381 381
 } // end renderFormElement function
382 382
 
383 383
 /**
@@ -386,13 +386,13 @@  discard block
 block discarded – undo
386 386
  */
387 387
 function ParseIntputOptions($v) {
388 388
     $modx = evolutionCMS();
389
-	$a = array();
390
-	if(is_array($v)) {
391
-		return $v;
392
-	} else if($modx->db->isResult($v)) {
393
-		while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
394
-	} else {
395
-		$a = explode("||", $v);
396
-	}
397
-	return $a;
389
+    $a = array();
390
+    if(is_array($v)) {
391
+        return $v;
392
+    } else if($modx->db->isResult($v)) {
393
+        while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
394
+    } else {
395
+        $a = explode("||", $v);
396
+    }
397
+    return $a;
398 398
 }
Please login to merge, or discard this patch.
manager/processors/cache_sync.class.processor.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@
 block discarded – undo
237 237
     /**
238 238
      * build siteCache file
239 239
      * @param DocumentParser $modx
240
-     * @return boolean success
240
+     * @return null|boolean success
241 241
      */
242 242
     public function buildCache($modx)
243 243
     {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         if (isset($this->aliases[$id])) {
95 95
             if ($this->aliasVisible[$id] == 1) {
96 96
                 if ($path != '') {
97
-                    $path = $this->aliases[$id] . '/' . $path;
97
+                    $path = $this->aliases[$id].'/'.$path;
98 98
                 } else {
99 99
                     $path = $this->aliases[$id];
100 100
                 }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             $modx->messageQuit("Cache path not set.");
119 119
         }
120 120
 
121
-        $files = glob(realpath($this->cachePath) . '/*.pageCache.php');
121
+        $files = glob(realpath($this->cachePath).'/*.pageCache.php');
122 122
         $filesincache = count($files);
123 123
         $deletedfiles = array();
124 124
         while ($file = array_shift($files)) {
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
                 if (isset($opcache)) {
152 152
                     echo '<p>Opcache empty.</p>';
153 153
                 }
154
-                echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>';
154
+                echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>';
155 155
                 foreach ($deletedfiles as $deletedfile) {
156
-                    echo '<li>' . $deletedfile . '</li>';
156
+                    echo '<li>'.$deletedfile.'</li>';
157 157
                 }
158 158
                 echo '</ul>';
159 159
             }
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 
173 173
 
174 174
         // write the file
175
-        $content = '<?php' . "\n";
176
-        $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n";
177
-        $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n";
175
+        $content = '<?php'."\n";
176
+        $content .= '$recent_update=\''.$this->request_time.'\';'."\n";
177
+        $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n";
178 178
 
179
-        $filename = $this->cachePath . '/sitePublishing.idx.php';
179
+        $filename = $this->cachePath.'/sitePublishing.idx.php';
180 180
         if (!$handle = fopen($filename, 'w')) {
181 181
             exit("Cannot open file ({$filename}");
182 182
         }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $timesArr = array();
201 201
 
202 202
         $result = $modx->db->select('MIN(pub_date) AS minpub', '[+prefix+]site_content',
203
-            'pub_date>' . $this->request_time);
203
+            'pub_date>'.$this->request_time);
204 204
         if (!$result) {
205 205
             echo "Couldn't determine next publish event!";
206 206
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         }
212 212
 
213 213
         $result = $modx->db->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content',
214
-            'unpub_date>' . $this->request_time);
214
+            'unpub_date>'.$this->request_time);
215 215
         if (!$result) {
216 216
             echo "Couldn't determine next unpublish event!";
217 217
         }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         $config = array();
251 251
         $content .= '$c=&$this->config;';
252 252
         while (list($key, $value) = $modx->db->getRow($rs, 'num')) {
253
-            $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";';
253
+            $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";';
254 254
             $config[$key] = $value;
255 255
         }
256 256
 
@@ -288,23 +288,23 @@  discard block
 block discarded – undo
288 288
             $docid = $doc['id'];
289 289
             if ($use_alias_path) {
290 290
                 $tmpPath = $this->getParents($doc['parent']);
291
-                $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias'];
291
+                $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias'];
292 292
                 $key = $alias;
293 293
             } else {
294 294
                 $key = $doc['alias'];
295 295
             }
296 296
 
297 297
             $doc['path'] = $tmpPath;
298
-            $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');';
299
-            $content .= '$d[\'' . $key . '\']=' . $docid . ';';
300
-            $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');';
298
+            $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');';
299
+            $content .= '$d[\''.$key.'\']='.$docid.';';
300
+            $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');';
301 301
         }
302 302
 
303 303
         // get content types
304 304
         $rs = $modx->db->select('id, contentType', '[+prefix+]site_content', "contentType!='text/html'");
305 305
         $content .= '$c=&$this->contentTypes;';
306 306
         while ($doc = $modx->db->getRow($rs)) {
307
-            $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';';
307
+            $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';';
308 308
         }
309 309
 
310 310
         // WRITE Chunks to cache file
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             if ($modx->config['minifyphp_incache']) {
315 315
                 $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']);
316 316
             }
317
-            $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';';
317
+            $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';';
318 318
         }
319 319
 
320 320
         // WRITE snippets to cache file
@@ -325,18 +325,18 @@  discard block
 block discarded – undo
325 325
         while ($row = $modx->db->getRow($rs)) {
326 326
             $key = $row['name'];
327 327
             if ($row['disabled']) {
328
-                $content .= '$s[\'' . $key . '\']=\'return false;\';';
328
+                $content .= '$s[\''.$key.'\']=\'return false;\';';
329 329
             } else {
330 330
                 $value = trim($row['snippet']);
331 331
                 if ($modx->config['minifyphp_incache']) {
332 332
                     $value = $this->php_strip_whitespace($value);
333 333
                 }
334
-                $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';';
334
+                $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';';
335 335
                 $properties = $modx->parseProperties($row['properties']);
336 336
                 $sharedproperties = $modx->parseProperties($row['sharedproperties']);
337 337
                 $properties = array_merge($sharedproperties, $properties);
338 338
                 if (0 < count($properties)) {
339
-                    $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';';
339
+                    $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';';
340 340
                 }
341 341
             }
342 342
         }
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
             if ($modx->config['minifyphp_incache']) {
355 355
                 $value = $this->php_strip_whitespace($value);
356 356
             }
357
-            $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';';
357
+            $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';';
358 358
             if ($row['properties'] != '' || $row['sharedproperties'] != '') {
359 359
                 $properties = $modx->parseProperties($row['properties']);
360 360
                 $sharedproperties = $modx->parseProperties($row['sharedproperties']);
361 361
                 $properties = array_merge($sharedproperties, $properties);
362 362
                 if (0 < count($properties)) {
363
-                    $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';';
363
+                    $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';';
364 364
                 }
365 365
             }
366 366
         }
@@ -383,14 +383,14 @@  discard block
 block discarded – undo
383 383
         }
384 384
         foreach ($events as $evtname => $pluginnames) {
385 385
             $events[$evtname] = $pluginnames;
386
-            $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'',
387
-                    $this->escapeSingleQuotes($pluginnames)) . '\');';
386
+            $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'',
387
+                    $this->escapeSingleQuotes($pluginnames)).'\');';
388 388
         }
389 389
 
390 390
         $content .= "\n";
391 391
 
392 392
         // close and write the file
393
-        $filename = $this->cachePath . 'siteCache.idx.php';
393
+        $filename = $this->cachePath.'siteCache.idx.php';
394 394
 
395 395
         // invoke OnBeforeCacheUpdate event
396 396
         if ($modx) {
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
             exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!");
402 402
         }
403 403
 
404
-        if (!is_file($this->cachePath . '/.htaccess')) {
405
-            file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n");
404
+        if (!is_file($this->cachePath.'/.htaccess')) {
405
+            file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n");
406 406
         }
407 407
 
408 408
         // invoke OnCacheUpdate event
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
         $source = trim($source);
426 426
         if (substr($source, 0, 5) !== '<?php') {
427
-            $source = '<?php ' . $source;
427
+            $source = '<?php '.$source;
428 428
         }
429 429
 
430 430
         $tokens = token_get_all($source);
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
             }
483 483
         }
484 484
         $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'),
485
-            array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_);
485
+            array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_);
486 486
         $source = trim($source);
487 487
 
488 488
         return $source;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,8 @@  discard block
 block discarded – undo
79 79
      * @return string
80 80
      */
81 81
     public function getParents($id, $path = '')
82
-    { // modx:returns child's parent
82
+    {
83
+// modx:returns child's parent
83 84
         $modx = evolutionCMS();
84 85
         if (empty($this->aliases)) {
85 86
             $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible";
@@ -456,7 +457,8 @@  discard block
 block discarded – undo
456 457
                         $_ = trim($_);
457 458
                     }
458 459
                     $lastChar = substr($_, -1);
459
-                    if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289
460
+                    if (!in_array($lastChar, $chars)) {
461
+// ,320,327,288,284,289
460 462
                         if (!in_array($prev_token,
461 463
                             array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) {
462 464
                             $_ .= ' ';
Please login to merge, or discard this patch.
install/functions.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! function_exists('install_sessionCheck')) {
2
+if (!function_exists('install_sessionCheck')) {
3 3
     function install_sessionCheck()
4 4
     {
5 5
         global $_lang;
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 </head>
22 22
 <body>
23 23
 	<div class="install">
24
-		<p>' . $_lang["session_problem"] . '</p>
25
-		<p><a href="./">' . $_lang["session_problem_try_again"] . '</a></p>
24
+		<p>' . $_lang["session_problem"].'</p>
25
+		<p><a href="./">' . $_lang["session_problem_try_again"].'</a></p>
26 26
 	</div>
27 27
 </body>
28 28
 </html>';
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     }
33 33
 }
34 34
 
35
-if( ! function_exists('parse')) {
35
+if (!function_exists('parse')) {
36 36
     /**
37 37
      * @param string $src
38 38
      * @param array $ph
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     function parse($src, $ph, $left = '[+', $right = '+]')
44 44
     {
45 45
         foreach ($ph as $k => $v) {
46
-            $k = $left . $k . $right;
46
+            $k = $left.$k.$right;
47 47
             $src = str_replace($k, $v, $src);
48 48
         }
49 49
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     }
52 52
 }
53 53
 
54
-if( ! function_exists('ph')) {
54
+if (!function_exists('ph')) {
55 55
     /**
56 56
      * @return array
57 57
      */
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $ph['textdir'] = $modx_textdir ? ' id="rtl"' : '';
71 71
         $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd'];
72 72
         $ph['version'] = $moduleVersion;
73
-        $ph['release_date'] = ($modx_textdir ? '&rlm;' : '') . $modx_release_date;
73
+        $ph['release_date'] = ($modx_textdir ? '&rlm;' : '').$modx_release_date;
74 74
         $ph['footer1'] = $_lang['modx_footer1'];
75 75
         $ph['footer2'] = $_lang['modx_footer2'];
76 76
         $ph['current_year'] = date('Y');
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     }
80 80
 }
81 81
 
82
-if( ! function_exists('get_installmode')) {
82
+if (!function_exists('get_installmode')) {
83 83
     /**
84 84
      * @return int
85 85
      */
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     }
142 142
 }
143 143
 
144
-if( ! function_exists('getLangs')) {
144
+if (!function_exists('getLangs')) {
145 145
     /**
146 146
      * @param string $install_language
147 147
      * @return string
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         }
156 156
 
157 157
         $langs = array();
158
-        if ($handle = opendir("../" . MGR_DIR . "/includes/lang")) {
158
+        if ($handle = opendir("../".MGR_DIR."/includes/lang")) {
159 159
             while (false !== ($file = readdir($handle))) {
160 160
                 if (strpos($file, '.inc.') !== false) {
161 161
                     $langs[] = $file;
Please login to merge, or discard this patch.
manager/actions/mutate_settings/functions.inc.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 function get_lang_keys($filename)
9 9
 {
10
-    $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename;
10
+    $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename;
11 11
     if (is_file($file) && is_readable($file)) {
12 12
         include($file);
13 13
         $out = isset($_lang) ? array_keys($_lang) : array();
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
     if (!empty($key)) {
54 54
         $languages = get_langs_by_key($key);
55 55
         sort($languages);
56
-        $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>';
56
+        $lang_options .= '<option value="">'.$_lang['language_title'].'</option>';
57 57
 
58 58
         foreach ($languages as $language_name) {
59 59
             $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
60
-            $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>';
60
+            $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>';
61 61
         }
62 62
 
63 63
         return $lang_options;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         foreach ($languages as $language_name) {
68 68
             $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
69 69
             $sel = $language_name === $selected_lang ? ' selected="selected"' : '';
70
-            $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>';
70
+            $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>';
71 71
         }
72 72
 
73 73
         return $lang_options;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $disabled = '';
93 93
     }
94 94
     if ($add) {
95
-        $add = ' ' . $add;
95
+        $add = ' '.$add;
96 96
     }
97 97
 
98 98
     return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value,
Please login to merge, or discard this patch.
Braces   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
  * @param string $filename
6 6
  * @return array of keys from a language file
7 7
  */
8
-function get_lang_keys($filename)
9
-{
8
+function get_lang_keys($filename)
9
+{
10 10
     $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename;
11
-    if (is_file($file) && is_readable($file)) {
11
+    if (is_file($file) && is_readable($file)) {
12 12
         include($file);
13 13
         $out = isset($_lang) ? array_keys($_lang) : array();
14
-    } else {
14
+    } else {
15 15
         $out = array();
16 16
     }
17 17
 
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
  * @param string $key
25 25
  * @return array of languages that define the key in their file
26 26
  */
27
-function get_langs_by_key($key)
28
-{
27
+function get_langs_by_key($key)
28
+{
29 29
     global $lang_keys;
30 30
     $lang_return = array();
31
-    foreach ($lang_keys as $lang => $keys) {
32
-        if (in_array($key, $keys)) {
31
+    foreach ($lang_keys as $lang => $keys) {
32
+        if (in_array($key, $keys)) {
33 33
             $lang_return[] = $lang;
34 34
         }
35 35
     }
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
  * @param string $selected_lang specify language to select in option list, default none
47 47
  * @return string html option list
48 48
  */
49
-function get_lang_options($key = '', $selected_lang = '')
50
-{
49
+function get_lang_options($key = '', $selected_lang = '')
50
+{
51 51
     global $lang_keys, $_lang;
52 52
     $lang_options = '';
53
-    if (!empty($key)) {
53
+    if (!empty($key)) {
54 54
         $languages = get_langs_by_key($key);
55 55
         sort($languages);
56 56
         $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>';
57 57
 
58
-        foreach ($languages as $language_name) {
58
+        foreach ($languages as $language_name) {
59 59
             $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
60 60
             $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>';
61 61
         }
62 62
 
63 63
         return $lang_options;
64
-    } else {
64
+    } else {
65 65
         $languages = array_keys($lang_keys);
66 66
         sort($languages);
67
-        foreach ($languages as $language_name) {
67
+        foreach ($languages as $language_name) {
68 68
             $uclanguage_name = ucwords(str_replace("_", " ", $language_name));
69 69
             $sel = $language_name === $selected_lang ? ' selected="selected"' : '';
70 70
             $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>';
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
  * @param bool $disabled
82 82
  * @return string
83 83
  */
84
-function form_radio($name, $value, $add = '', $disabled = false)
85
-{
84
+function form_radio($name, $value, $add = '', $disabled = false)
85
+{
86 86
     global ${$name};
87 87
     $var = ${$name};
88 88
     $checked = ($var == $value) ? ' checked="checked"' : '';
89
-    if ($disabled) {
89
+    if ($disabled) {
90 90
         $disabled = ' disabled';
91
-    } else {
91
+    } else {
92 92
         $disabled = '';
93 93
     }
94
-    if ($add) {
94
+    if ($add) {
95 95
         $add = ' ' . $add;
96 96
     }
97 97
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
  * @param string $object
105 105
  * @return string
106 106
  */
107
-function wrap_label($str = '', $object)
108
-{
107
+function wrap_label($str = '', $object)
108
+{
109 109
     return "<label>{$object}\n{$str}</label>";
110 110
 }
111 111
 
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
  * @param array $ph
115 115
  * @return string
116 116
  */
117
-function parseText($tpl = '', $ph = array())
118
-{
119
-    if (empty($ph) || empty($tpl)) {
117
+function parseText($tpl = '', $ph = array())
118
+{
119
+    if (empty($ph) || empty($tpl)) {
120 120
         return $tpl;
121 121
     }
122 122
 
123
-    foreach ($ph as $k => $v) {
123
+    foreach ($ph as $k => $v) {
124 124
         $k = "[+{$k}+]";
125 125
         $tpl = str_replace($k, $v, $tpl);
126 126
     }
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
  * @param bool $cond
133 133
  * @return string
134 134
  */
135
-function showHide($cond = true)
136
-{
135
+function showHide($cond = true)
136
+{
137 137
     global $displayStyle;
138 138
     $showHide = $cond ? $displayStyle : 'none';
139 139
 
Please login to merge, or discard this patch.
manager/actions/help/01About_EVO.php 3 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@  discard block
 block discarded – undo
4 4
 }
5 5
 $logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">';
6 6
 $downloadLinks = array(
7
-	0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'),
8
-	1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
-	2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
-	3=>array('title'=>$_lang["extras"],'link'=>array(
11
-		'http://extras.evolution-cms.com/',
12
-		'https://github.com/extras-evolution'
13
-	)),
7
+    0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'),
8
+    1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
+    2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
+    3=>array('title'=>$_lang["extras"],'link'=>array(
11
+        'http://extras.evolution-cms.com/',
12
+        'https://github.com/extras-evolution'
13
+    )),
14 14
 );
15 15
 
16 16
 $translationLinks = array(
17
-	0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
-	1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'),
17
+    0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
+    1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'),
19 19
 );
20 20
 
21 21
 /**
@@ -24,23 +24,23 @@  discard block
 block discarded – undo
24 24
  * @return string
25 25
  */
26 26
 function createList($sectionHeader, $linkArr) {
27
-	$output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28
-	$output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29
-	$links = '';
30
-	foreach($linkArr as $row) {
31
-		if (!is_array($row['link'])) $row['link'] = array($row['link']);
32
-		foreach ($row['link'] as $link) {
33
-			$links .= $links != '' ? '<br/>' : '';
34
-			$links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
35
-		}
36
-		$output .= '
27
+    $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28
+    $output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29
+    $links = '';
30
+    foreach($linkArr as $row) {
31
+        if (!is_array($row['link'])) $row['link'] = array($row['link']);
32
+        foreach ($row['link'] as $link) {
33
+            $links .= $links != '' ? '<br/>' : '';
34
+            $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
35
+        }
36
+        $output .= '
37 37
 		<tr>
38 38
 			<td align="left"><strong>' . $row["title"] . '</strong></td>
39 39
 			<td align="left">' . $links . '</td>
40 40
 		</tr>';
41
-		$links = '';
42
-	}
43
-	$output .= '</table></div>'."\n";
41
+        $links = '';
42
+    }
43
+    $output .= '</table></div>'."\n";
44 44
     return $output;
45 45
 }
46 46
 echo $logo;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  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
-$logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">';
5
+$logo = '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">';
6 6
 $downloadLinks = array(
7
-	0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'),
8
-	1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
-	2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
-	3=>array('title'=>$_lang["extras"],'link'=>array(
7
+	0=>array('title'=>$_lang["information"], 'link'=>'https://evo.im/'),
8
+	1=>array('title'=>$_lang["download"], 'link'=>'https://github.com/evolution-cms/evolution/releases'),
9
+	2=>array('title'=>$_lang["previous_releases"], 'link'=>'https://modx.com/download/evolution/previous-releases.html'),
10
+	3=>array('title'=>$_lang["extras"], 'link'=>array(
11 11
 		'http://extras.evolution-cms.com/',
12 12
 		'https://github.com/extras-evolution'
13 13
 	)),
14 14
 );
15 15
 
16 16
 $translationLinks = array(
17
-	0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
-	1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'),
17
+	0=>array('title'=>'Evolution CMS', 'link'=>'https://www.transifex.com/evolutioncms/evolution/'),
18
+	1=>array('title'=>$_lang["extras"], 'link'=>'https://www.transifex.com/evolutioncms/extras/'),
19 19
 );
20 20
 
21 21
 /**
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
  * @param array $linkArr
24 24
  * @return string
25 25
  */
26
-function createList($sectionHeader, $linkArr) {
26
+function createList($sectionHeader, $linkArr){
27 27
 	$output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28 28
 	$output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29 29
 	$links = '';
30
-	foreach($linkArr as $row) {
30
+	foreach ($linkArr as $row) {
31 31
 		if (!is_array($row['link'])) $row['link'] = array($row['link']);
32 32
 		foreach ($row['link'] as $link) {
33 33
 			$links .= $links != '' ? '<br/>' : '';
34
-			$links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
34
+			$links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>';
35 35
 		}
36 36
 		$output .= '
37 37
 		<tr>
38
-			<td align="left"><strong>' . $row["title"] . '</strong></td>
39
-			<td align="left">' . $links . '</td>
38
+			<td align="left"><strong>' . $row["title"].'</strong></td>
39
+			<td align="left">' . $links.'</td>
40 40
 		</tr>';
41 41
 		$links = '';
42 42
 	}
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,12 +23,15 @@
 block discarded – undo
23 23
  * @param array $linkArr
24 24
  * @return string
25 25
  */
26
-function createList($sectionHeader, $linkArr) {
26
+function createList($sectionHeader, $linkArr)
27
+{
27 28
 	$output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n";
28 29
 	$output .= '<table width="500"  border="0" cellspacing="0" cellpadding="0">'."\n";
29 30
 	$links = '';
30 31
 	foreach($linkArr as $row) {
31
-		if (!is_array($row['link'])) $row['link'] = array($row['link']);
32
+		if (!is_array($row['link'])) {
33
+		    $row['link'] = array($row['link']);
34
+		}
32 35
 		foreach ($row['link'] as $link) {
33 36
 			$links .= $links != '' ? '<br/>' : '';
34 37
 			$links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>';
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/Module_Categories_Manager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     die('Please use the MODx Backend.');
8 8
 }
9 9
 
10
-require_once realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Categories.php';
10
+require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php';
11 11
 
12 12
 class Module_Categories_Manager extends Categories
13 13
 {
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
     {
95 95
         global $_lang, $_style;
96 96
 
97
-        $filename = trim($view_name) . '.tpl.phtml';
98
-        $file = self::get('views_dir') . $filename;
97
+        $filename = trim($view_name).'.tpl.phtml';
98
+        $file = self::get('views_dir').$filename;
99 99
         $view = &$this;
100 100
 
101 101
         if (is_file($file)
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
     {
121 121
 
122 122
         $_update = array(
123
-            'id'       => (int)$element_id,
124
-            'category' => (int)$category_id
123
+            'id'       => (int) $element_id,
124
+            'category' => (int) $category_id
125 125
         );
126 126
 
127 127
         $this->db->update(
128 128
             $_update,
129 129
             $this->db_tbl[$element],
130
-            "`id` = '" . (int)$element_id . "'"
130
+            "`id` = '".(int) $element_id."'"
131 131
         );
132 132
 
133 133
         return $this->db->getAffectedRows() === 1;
Please login to merge, or discard this patch.