Completed
Push — develop ( 663a1f...4a4b5c )
by Agel_Nash
15s
created
manager/includes/tmplvars.format.inc.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 // Added by Raymond 20-Jan-2005
8
-function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') {
8
+function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = ''){
9 9
 
10 10
 	global $modx;
11 11
 
@@ -14,29 +14,29 @@  discard block
 block discarded – undo
14 14
 	$value = ProcessTVCommand($value, $name, $docid);
15 15
 
16 16
 	$params = array();
17
-	if($paramstring) {
17
+	if ($paramstring) {
18 18
 		$cp = explode("&", $paramstring);
19
-		foreach($cp as $p => $v) {
19
+		foreach ($cp as $p => $v) {
20 20
 			$v = trim($v); // trim
21 21
 			$ar = explode("=", $v);
22
-			if(is_array($ar) && count($ar) == 2) {
22
+			if (is_array($ar) && count($ar) == 2) {
23 23
 				$params[$ar[0]] = decodeParamValue($ar[1]);
24 24
 			}
25 25
 		}
26 26
 	}
27 27
 
28 28
 	$id = "tv$name";
29
-	switch($format) {
29
+	switch ($format) {
30 30
 		case 'image':
31 31
 			$images = parseInput($value, '||', 'array');
32 32
 			$o = '';
33
-			foreach($images as $image) {
34
-				if(!is_array($image)) {
33
+			foreach ($images as $image) {
34
+				if (!is_array($image)) {
35 35
 					$image = explode('==', $image);
36 36
 				}
37 37
 				$src = $image[0];
38 38
 
39
-				if($src) {
39
+				if ($src) {
40 40
 					// We have a valid source
41 41
 					$attributes = '';
42 42
 					$attr = array(
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 						'alt' => $modx->htmlspecialchars($params['alttext']),
47 47
 						'style' => $params['style']
48 48
 					);
49
-					if(isset($params['align']) && $params['align'] != 'none') {
49
+					if (isset($params['align']) && $params['align'] != 'none') {
50 50
 						$attr['align'] = $params['align'];
51 51
 					}
52
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
53
-					$attributes .= ' ' . $params['attrib'];
52
+					foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
53
+					$attributes .= ' '.$params['attrib'];
54 54
 
55 55
 					// Output the image with attributes
56
-					$o .= '<img' . rtrim($attributes) . ' />';
56
+					$o .= '<img'.rtrim($attributes).' />';
57 57
 				}
58 58
 			}
59 59
 			break;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		case "delim":    // display as delimitted list
62 62
 			$value = parseInput($value, "||");
63 63
 			$p = $params['format'] ? $params['format'] : " ";
64
-			if($p == "\\n") {
64
+			if ($p == "\\n") {
65 65
 				$p = "\n";
66 66
 			}
67 67
 			$o = str_replace("||", $p, $value);
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 		case "string":
71 71
 			$value = parseInput($value);
72 72
 			$format = strtolower($params['format']);
73
-			if($format == 'upper case') {
73
+			if ($format == 'upper case') {
74 74
 				$o = strtoupper($value);
75
-			} else if($format == 'lower case') {
75
+			} else if ($format == 'lower case') {
76 76
 				$o = strtolower($value);
77
-			} else if($format == 'sentence case') {
77
+			} else if ($format == 'sentence case') {
78 78
 				$o = ucfirst($value);
79
-			} else if($format == 'capitalize') {
79
+			} else if ($format == 'capitalize') {
80 80
 				$o = ucwords($value);
81 81
 			} else {
82 82
 				$o = $value;
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 			break;
85 85
 
86 86
 		case "date":
87
-			if($value != '' || $params['default'] == 'Yes') {
88
-				if(empty($value)) {
87
+			if ($value != '' || $params['default'] == 'Yes') {
88
+				if (empty($value)) {
89 89
 					$value = 'now';
90 90
 				}
91 91
 				$timestamp = getUnixtimeFromDateString($value);
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 		case "hyperlink":
100 100
 			$value = parseInput($value, "||", "array");
101 101
 			$o = '';
102
-			for($i = 0; $i < count($value); $i++) {
102
+			for ($i = 0; $i < count($value); $i++) {
103 103
 				list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]);
104
-				if(!$url) {
104
+				if (!$url) {
105 105
 					$url = $name;
106 106
 				}
107
-				if($url) {
108
-					if($o) {
107
+				if ($url) {
108
+					if ($o) {
109 109
 						$o .= '<br />';
110 110
 					}
111 111
 					$attributes = '';
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 						'style' => $params['style'],
118 118
 						'target' => $params['target'],
119 119
 					);
120
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
121
-					$attributes .= ' ' . $params['attrib']; // add extra
120
+					foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
121
+					$attributes .= ' '.$params['attrib']; // add extra
122 122
 
123 123
 					// Output the link
124
-					$o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>';
124
+					$o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>';
125 125
 				}
126 126
 			}
127 127
 			break;
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 			$tagname = ($params['tagname']) ? $params['tagname'] : 'div';
133 133
 			$o = '';
134 134
 			// Loop through a list of tags
135
-			for($i = 0; $i < count($value); $i++) {
135
+			for ($i = 0; $i < count($value); $i++) {
136 136
 				$tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i];
137
-				if(!$tagvalue) {
137
+				if (!$tagvalue) {
138 138
 					continue;
139 139
 				}
140 140
 
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 					'class' => $params['class'],
146 146
 					'style' => $params['style'],
147 147
 				);
148
-				foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
149
-				$attributes .= ' ' . $params['attrib']; // add extra
148
+				foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
149
+				$attributes .= ' '.$params['attrib']; // add extra
150 150
 
151 151
 				// Output the HTML Tag
152
-				$o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
152
+				$o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>';
153 153
 			}
154 154
 			break;
155 155
 
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 			$w = $params['w'] ? $params['w'] : '100%';
159 159
 			$h = $params['h'] ? $params['h'] : '400px';
160 160
 			$richtexteditor = $params['edt'] ? $params['edt'] : "";
161
-			$o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
161
+			$o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
162 162
 			$o .= $modx->htmlspecialchars($value);
163 163
 			$o .= '</textarea></div>';
164 164
 			$replace_richtext = array($id);
165 165
 			// setup editors
166
-			if(!empty($replace_richtext) && !empty($richtexteditor)) {
166
+			if (!empty($replace_richtext) && !empty($richtexteditor)) {
167 167
 				// invoke OnRichTextEditorInit event
168 168
 				$evtOut = $modx->invokeEvent("OnRichTextEditorInit", array(
169 169
 					'editor' => $richtexteditor,
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 					'width' => $w,
173 173
 					'height' => $h
174 174
 				));
175
-				if(is_array($evtOut)) {
175
+				if (is_array($evtOut)) {
176 176
 					$o .= implode("", $evtOut);
177 177
 				}
178 178
 			}
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 
186 186
 		case "viewport":
187 187
 			$value = parseInput($value);
188
-			$id = '_' . time();
189
-			if(!$params['vpid']) {
188
+			$id = '_'.time();
189
+			if (!$params['vpid']) {
190 190
 				$params['vpid'] = $id;
191 191
 			}
192 192
 			$sTag = "<iframe";
@@ -194,42 +194,42 @@  discard block
 block discarded – undo
194 194
 			$autoMode = "0";
195 195
 			$w = $params['width'];
196 196
 			$h = $params['height'];
197
-			if($params['stretch'] == 'Yes') {
197
+			if ($params['stretch'] == 'Yes') {
198 198
 				$w = "100%";
199 199
 				$h = "100%";
200 200
 			}
201
-			if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
202
-				$autoMode = "3";  //both
203
-			} else if($params['awidth'] == 'Yes') {
201
+			if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
202
+				$autoMode = "3"; //both
203
+			} else if ($params['awidth'] == 'Yes') {
204 204
 				$autoMode = "1"; //width only
205
-			} else if($params['aheight'] == 'Yes') {
206
-				$autoMode = "2";    //height only
205
+			} else if ($params['aheight'] == 'Yes') {
206
+				$autoMode = "2"; //height only
207 207
 			}
208 208
 
209
-			$modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array(
209
+			$modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array(
210 210
 				'name' => 'viewport',
211 211
 				'version' => '0',
212 212
 				'plaintext' => false
213 213
 			));
214
-			$o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
215
-			if($params['class']) {
216
-				$o .= " class='" . $params['class'] . "' ";
214
+			$o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' ";
215
+			if ($params['class']) {
216
+				$o .= " class='".$params['class']."' ";
217 217
 			}
218
-			if($params['style']) {
219
-				$o .= " style='" . $params['style'] . "' ";
218
+			if ($params['style']) {
219
+				$o .= " style='".$params['style']."' ";
220 220
 			}
221
-			if($params['attrib']) {
222
-				$o .= $params['attrib'] . " ";
221
+			if ($params['attrib']) {
222
+				$o .= $params['attrib']." ";
223 223
 			}
224
-			$o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' ";
225
-			$o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' ";
226
-			$o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' ";
224
+			$o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' ";
225
+			$o .= "src='".$value."' frameborder='".$params['borsize']."' ";
226
+			$o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' ";
227 227
 			$o .= ">";
228 228
 			$o .= $eTag;
229 229
 			break;
230 230
 
231 231
 		case "datagrid":
232
-			include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
232
+			include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
233 233
 			$grd = new DataGrid('', $value);
234 234
 
235 235
 			$grd->noRecordMsg = $params['egmsg'];
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
 		case 'htmlentities':
266 266
 			$value = parseInput($value);
267
-			if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
267
+			if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
268 268
 				// remove delimiter from checkbox and listbox-multiple TVs
269 269
 				$value = str_replace('||', '', $value);
270 270
 			}
@@ -275,33 +275,33 @@  discard block
 block discarded – undo
275 275
 			$widget_output = '';
276 276
 			$o = '';
277 277
 			/* If we are loading a file */
278
-			if(substr($params['output'], 0, 5) == "@FILE") {
279
-				$file_name = MODX_BASE_PATH . trim(substr($params['output'], 6));
280
-				if(!file_exists($file_name)) {
281
-					$widget_output = $file_name . ' does not exist';
278
+			if (substr($params['output'], 0, 5) == "@FILE") {
279
+				$file_name = MODX_BASE_PATH.trim(substr($params['output'], 6));
280
+				if (!file_exists($file_name)) {
281
+					$widget_output = $file_name.' does not exist';
282 282
 				} else {
283 283
 					$widget_output = file_get_contents($file_name);
284 284
 				}
285
-			} elseif(substr($params['output'], 0, 8) == '@INCLUDE') {
286
-				$file_name = MODX_BASE_PATH . trim(substr($params['output'], 9));
287
-				if(!file_exists($file_name)) {
288
-					$widget_output = $file_name . ' does not exist';
285
+			} elseif (substr($params['output'], 0, 8) == '@INCLUDE') {
286
+				$file_name = MODX_BASE_PATH.trim(substr($params['output'], 9));
287
+				if (!file_exists($file_name)) {
288
+					$widget_output = $file_name.' does not exist';
289 289
 				} else {
290 290
 					/* The included file needs to set $widget_output. Can be string, array, object */
291 291
 					include $file_name;
292 292
 				}
293
-			} elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') {
293
+			} elseif (substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') {
294 294
 				$chunk_name = trim(substr($params['output'], 7));
295 295
 				$widget_output = $modx->getChunk($chunk_name);
296
-			} elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') {
296
+			} elseif (substr($params['output'], 0, 5) == '@EVAL' && $value !== '') {
297 297
 				$eval_str = trim(substr($params['output'], 6));
298 298
 				$widget_output = eval($eval_str);
299
-			} elseif($value !== '') {
299
+			} elseif ($value !== '') {
300 300
 				$widget_output = $params['output'];
301 301
 			} else {
302 302
 				$widget_output = '';
303 303
 			}
304
-			if(is_string($widget_output)) {
304
+			if (is_string($widget_output)) {
305 305
 				$_ = $modx->config['enable_filter'];
306 306
 				$modx->config['enable_filter'] = 1;
307 307
 				$widget_output = $modx->parseText($widget_output, array('value' => $value));
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
 		default:
316 316
 			$value = parseInput($value);
317
-			if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
317
+			if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
318 318
 				// add separator
319 319
 				$value = explode('||', $value);
320 320
 				$value = implode($sep, $value);
@@ -325,23 +325,23 @@  discard block
 block discarded – undo
325 325
 	return $o;
326 326
 }
327 327
 
328
-function decodeParamValue($s) {
328
+function decodeParamValue($s){
329 329
 	$s = str_replace("%3D", '=', $s); // =
330 330
 	$s = str_replace("%26", '&', $s); // &
331 331
 	return $s;
332 332
 }
333 333
 
334 334
 // returns an array if a delimiter is present. returns array is a recordset is present
335
-function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array
335
+function parseInput($src, $delim = "||", $type = "string", $columns = true){ // type can be: string, array
336 336
 	global $modx;
337
-	if($modx->db->isResult($src)) {
337
+	if ($modx->db->isResult($src)) {
338 338
 		// must be a recordset
339 339
 		$rows = array();
340
-		while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols);
340
+		while ($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols);
341 341
 		return ($type == "array") ? $rows : implode($delim, $rows);
342 342
 	} else {
343 343
 		// must be a text
344
-		if($type == "array") {
344
+		if ($type == "array") {
345 345
 			return explode($delim, $src);
346 346
 		} else {
347 347
 			return $src;
@@ -349,21 +349,21 @@  discard block
 block discarded – undo
349 349
 	}
350 350
 }
351 351
 
352
-function getUnixtimeFromDateString($value) {
352
+function getUnixtimeFromDateString($value){
353 353
 	$timestamp = false;
354 354
 	// Check for MySQL or legacy style date
355 355
 	$date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
356 356
 	$date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
357 357
 	$matches = array();
358
-	if(strpos($value, '-') !== false) {
359
-		if(preg_match($date_match_1, $value, $matches)) {
358
+	if (strpos($value, '-') !== false) {
359
+		if (preg_match($date_match_1, $value, $matches)) {
360 360
 			$timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
361
-		} elseif(preg_match($date_match_2, $value, $matches)) {
361
+		} elseif (preg_match($date_match_2, $value, $matches)) {
362 362
 			$timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
363 363
 		}
364 364
 	}
365 365
 	// If those didn't work, use strtotime to figure out the date
366
-	if($timestamp === false || $timestamp === -1) {
366
+	if ($timestamp === false || $timestamp === -1) {
367 367
 		$timestamp = strtotime($value);
368 368
 	}
369 369
 	return $timestamp;
Please login to merge, or discard this patch.
manager/includes/rss.inc.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,33 +29,33 @@  discard block
 block discarded – undo
29 29
 // include MagPieRSS
30 30
 require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc');
31 31
 // Convert relative path into absolute url
32
-function rel2abs( $rel, $base ) {
32
+function rel2abs($rel, $base){
33 33
 	// parse base URL  and convert to local variables: $scheme, $host,  $path
34
-	extract( parse_url( $base ) );
35
-	if ( strpos( $rel,"//" ) === 0 ) {
36
-		return $scheme . ':' . $rel;
34
+	extract(parse_url($base));
35
+	if (strpos($rel, "//") === 0) {
36
+		return $scheme.':'.$rel;
37 37
 	}
38 38
 	// return if already absolute URL
39
-	if ( parse_url( $rel, PHP_URL_SCHEME ) != '' ) {
39
+	if (parse_url($rel, PHP_URL_SCHEME) != '') {
40 40
 		return $rel;
41 41
 	}
42 42
 	// queries and anchors
43
-	if ( $rel[0] == '#' || $rel[0] == '?' ) {
44
-		return $base . $rel;
43
+	if ($rel[0] == '#' || $rel[0] == '?') {
44
+		return $base.$rel;
45 45
 	}
46 46
 	// remove non-directory element from path
47
-	$path = preg_replace( '#/[^/]*$#', '', $path );
47
+	$path = preg_replace('#/[^/]*$#', '', $path);
48 48
 	// destroy path if relative url points to root
49
-	if ( $rel[0] ==  '/' ) {
49
+	if ($rel[0] == '/') {
50 50
 		$path = '';
51 51
 	}
52 52
 	// dirty absolute URL
53
-	$abs = $host . $path . "/" . $rel;
53
+	$abs = $host.$path."/".$rel;
54 54
 	// replace '//' or  '/./' or '/foo/../' with '/'
55
-	$abs = preg_replace( "/(\/\.?\/)/", "/", $abs );
56
-	$abs = preg_replace( "/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs );
55
+	$abs = preg_replace("/(\/\.?\/)/", "/", $abs);
56
+	$abs = preg_replace("/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs);
57 57
 	// absolute URL is ready!
58
-	return $scheme . '://' . $abs;
58
+	return $scheme.'://'.$abs;
59 59
 }
60 60
 $feedData = array();
61 61
 
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 foreach ($urls as $section=>$url) {
64 64
 	$output = '';
65 65
     $rss = @fetch_rss($url);
66
-    if( !$rss ){
67
-    	$feedData[$section] = 'Failed to retrieve ' . $url;
66
+    if (!$rss) {
67
+    	$feedData[$section] = 'Failed to retrieve '.$url;
68 68
     	continue;
69 69
 	}
70 70
     $output .= '<ul>';
71 71
 
72 72
     $items = array_slice($rss->items, 0, $itemsNumber);
73 73
     foreach ($items as $item) {
74
-        $href = rel2abs($item['link'],'https://github.com');
74
+        $href = rel2abs($item['link'], 'https://github.com');
75 75
         $title = $item['title'];
76 76
         $pubdate = $item['pubdate'];
77 77
         $pubdate = $modx->toDateFormat(strtotime($pubdate));
Please login to merge, or discard this patch.
manager/includes/default_config.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$c  = &$settings;
3
+$c = &$settings;
4 4
 
5 5
 $c['site_name']                = 'My MODX Site';
6 6
 $c['site_start']               = 1;
Please login to merge, or discard this patch.
manager/includes/charsets.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -65,26 +65,26 @@
 block discarded – undo
65 65
 $_['macintosh']         = 'Western European (Mac) - macintosh';
66 66
 $_['Windows-1252']      = 'Western European (Windows) - Windows-1252';
67 67
 
68
-if($modx_charset     == 'euc-jp')      $_['euc-jp']      = 'Japanese (EUC) - euc-jp';
69
-elseif($modx_charset == 'shift_jis')   $_['shift_jis']   = 'Japanese (Shift-JIS) - shift_jis';
70
-elseif($modx_charset == 'iso-2022-jp') $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp';
71
-elseif($modx_charset == 'csISO2022JP') $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP';
72
-elseif($modx_charset == 'EUC-CN')            $_['EUC-CN']            = 'Chinese Simplified (EUC) - EUC-CN';
73
-elseif($modx_charset == 'hz-gb-2312')        $_['hz-gb-2312']        = 'Chinese Simplified (HZ) - hz-gb-2312';
74
-elseif($modx_charset == 'x-mac-chinesesimp') $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp';
75
-elseif($modx_charset == 'x-Chinese-CNS')     $_['x-Chinese-CNS']     = 'Chinese Traditional (CNS) - x-Chinese-CNS';
76
-elseif($modx_charset == 'x-Chinese-Eten')    $_['x-Chinese-Eten']    = 'Chinese Traditional (Eten) - x-Chinese-Eten';
77
-elseif($modx_charset == 'x-mac-chinesetrad') $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad';
78
-elseif($modx_charset == 'ks_c_5601-1987') $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987';
79
-elseif($modx_charset == 'euc-kr')         $_['euc-kr']         = 'Korean (EUC) - euc-kr';
80
-elseif($modx_charset == 'iso-2022-kr')    $_['iso-2022-kr']    = 'Korean (ISO) - iso-2022-kr';
81
-elseif($modx_charset == 'Johab')          $_['Johab']          = 'Korean (Johab) - Johab';
82
-elseif($modx_charset == 'x-mac-korean')   $_['x-mac-korean']   = 'Korean (Mac) - x-mac-korean';
68
+if ($modx_charset == 'euc-jp')      $_['euc-jp']      = 'Japanese (EUC) - euc-jp';
69
+elseif ($modx_charset == 'shift_jis')   $_['shift_jis']   = 'Japanese (Shift-JIS) - shift_jis';
70
+elseif ($modx_charset == 'iso-2022-jp') $_['iso-2022-jp'] = 'Japanese (JIS-Allow 1 byte Kana - SO/SI) - iso-2022-jp';
71
+elseif ($modx_charset == 'csISO2022JP') $_['csISO2022JP'] = 'Japanese (JIS-Allow 1 byte Kana) - csISO2022JP';
72
+elseif ($modx_charset == 'EUC-CN')            $_['EUC-CN']            = 'Chinese Simplified (EUC) - EUC-CN';
73
+elseif ($modx_charset == 'hz-gb-2312')        $_['hz-gb-2312']        = 'Chinese Simplified (HZ) - hz-gb-2312';
74
+elseif ($modx_charset == 'x-mac-chinesesimp') $_['x-mac-chinesesimp'] = 'Chinese Simplified (Mac) - x-mac-chinesesimp';
75
+elseif ($modx_charset == 'x-Chinese-CNS')     $_['x-Chinese-CNS']     = 'Chinese Traditional (CNS) - x-Chinese-CNS';
76
+elseif ($modx_charset == 'x-Chinese-Eten')    $_['x-Chinese-Eten']    = 'Chinese Traditional (Eten) - x-Chinese-Eten';
77
+elseif ($modx_charset == 'x-mac-chinesetrad') $_['x-mac-chinesetrad'] = 'Chinese Traditional (Mac) - x-mac-chinesetrad';
78
+elseif ($modx_charset == 'ks_c_5601-1987') $_['ks_c_5601-1987'] = 'Korean - ks_c_5601-1987';
79
+elseif ($modx_charset == 'euc-kr')         $_['euc-kr']         = 'Korean (EUC) - euc-kr';
80
+elseif ($modx_charset == 'iso-2022-kr')    $_['iso-2022-kr']    = 'Korean (ISO) - iso-2022-kr';
81
+elseif ($modx_charset == 'Johab')          $_['Johab']          = 'Korean (Johab) - Johab';
82
+elseif ($modx_charset == 'x-mac-korean')   $_['x-mac-korean']   = 'Korean (Mac) - x-mac-korean';
83 83
 
84 84
 $tpl = '<option value="%s" %s>%s</option>';
85 85
 $options = array();
86
-foreach($_ as $value=>$label) {
87
-    $selected = $value===$modx_charset ? 'selected' : '';
86
+foreach ($_ as $value=>$label) {
87
+    $selected = $value === $modx_charset ? 'selected' : '';
88 88
     $options[] = sprintf($tpl, $value, $selected, $label);
89 89
 }
90 90
 echo join("\n", $options);
Please login to merge, or discard this patch.
manager/includes/preload.functions.inc.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 global $site_sessionname;
4 4
 $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession
5 5
 
6
-function genEvoSessionName() {
6
+function genEvoSessionName(){
7 7
     $_ = crc32(__FILE__);
8 8
     $_ = sprintf('%u', $_);
9
-    return 'evo' . base_convert($_,10,36);
9
+    return 'evo'.base_convert($_, 10, 36);
10 10
 }
11 11
 
12 12
 function startCMSSession(){
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     
16 16
     session_name($site_sessionname);
17 17
     removeInvalidCmsSessionIds($site_sessionname);
18
-    $cookieExpiration= 0;
18
+    $cookieExpiration = 0;
19 19
     $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
20 20
     $cookiePath = !empty($session_cookie_path) ? $session_cookie_path : MODX_BASE_URL;
21 21
     $cookieDomain = !empty($session_cookie_domain) ? $session_cookie_domain : '';
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 
25 25
     $key = "modx.{$context}.session.cookie.lifetime";
26 26
     if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
27
-        $cookieLifetime= intval($_SESSION[$key]);
28
-        if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime;
27
+        $cookieLifetime = intval($_SESSION[$key]);
28
+        if ($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
29 29
         setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
30 30
     }
31 31
     if (!isset($_SESSION['modx.session.created.time'])) {
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
     }
34 34
 }
35 35
 
36
-function removeInvalidCmsSessionFromStorage(&$storage, $session_name) {
36
+function removeInvalidCmsSessionFromStorage(&$storage, $session_name){
37 37
     if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted'))
38 38
     {
39 39
     unset($storage[$session_name]);
40 40
     }
41 41
 }
42 42
 
43
-function removeInvalidCmsSessionIds($session_name) {
43
+function removeInvalidCmsSessionIds($session_name){
44 44
     // session ids is invalid iff it is empty string
45 45
     // storage priorioty can see in PHP source ext/session/session.c
46 46
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.
manager/includes/categories.inc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 //Kyle Jaebker - 08/07/06
4 4
 
5 5
 //Create a new category
6
-function newCategory($newCat) {
6
+function newCategory($newCat){
7 7
     global $modx;
8 8
     $useTable = $modx->getFullTableName('categories');
9 9
     $categoryId = $modx->db->insert(
@@ -14,36 +14,36 @@  discard block
 block discarded – undo
14 14
     return $categoryId;
15 15
 }
16 16
 //check if new category already exists
17
-function checkCategory($newCat = '') {
17
+function checkCategory($newCat = ''){
18 18
     global $modx;
19 19
     $useTable = $modx->getFullTableName('categories');
20 20
     $newCat = $modx->db->escape($newCat);
21 21
     $cats = $modx->db->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'");
22
-	if($cat = $modx->db->getValue($cats)) {
22
+	if ($cat = $modx->db->getValue($cats)) {
23 23
 		return $cat;
24 24
 	}
25 25
     return 0;
26 26
 }
27 27
 //Check for category, create new if not exists
28
-function getCategory($category='') {
28
+function getCategory($category = ''){
29 29
     $categoryId = checkCategory($category);
30
-    if(!$categoryId) $categoryId = newCategory($category);
30
+    if (!$categoryId) $categoryId = newCategory($category);
31 31
     return $categoryId;
32 32
 }
33 33
 //Get all categories
34
-function getCategories() {
34
+function getCategories(){
35 35
     global $modx;
36 36
     $useTable = $modx->getFullTableName('categories');
37 37
     $cats = $modx->db->select('id, category', $modx->getFullTableName('categories'), '', 'category');
38 38
 	$resourceArray = array();
39
-    while($row = $modx->db->getRow($cats)) {
39
+    while ($row = $modx->db->getRow($cats)) {
40 40
         $row['category'] = stripslashes($row['category']);
41 41
         $resourceArray[] = $row;
42 42
     }
43 43
     return $resourceArray;
44 44
 }
45 45
 //Delete category & associations
46
-function deleteCategory($catId=0) {
46
+function deleteCategory($catId = 0){
47 47
     global $modx;
48 48
     if ($catId) {
49 49
         $resetTables = array('site_plugins', 'site_snippets', 'site_htmlsnippets', 'site_templates', 'site_tmplvars', 'site_modules');
Please login to merge, or discard this patch.
manager/includes/error.class.inc.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 var $errorcode;
6 6
 var $errors = array();
7 7
 
8
-	function __construct() {
8
+	function __construct(){
9 9
 		
10 10
 		$_lang = $this->include_lang('errormsg');
11 11
 		
@@ -40,33 +40,33 @@  discard block
 block discarded – undo
40 40
 	);
41 41
 	}
42 42
 
43
-	function include_lang($context='common') {
43
+	function include_lang($context = 'common'){
44 44
 		global $modx;
45 45
 		$_lang = array();
46 46
 		
47
-		$context = trim($context,'/');
48
-		if(strpos($context,'..')!==false) return;
47
+		$context = trim($context, '/');
48
+		if (strpos($context, '..') !== false) return;
49 49
 		
50
-		if($context === 'common')
51
-			$lang_path = MODX_MANAGER_PATH . 'includes/lang/';
50
+		if ($context === 'common')
51
+			$lang_path = MODX_MANAGER_PATH.'includes/lang/';
52 52
 		else
53
-			$lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
54
-		include_once($lang_path . 'english.inc.php');
53
+			$lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/";
54
+		include_once($lang_path.'english.inc.php');
55 55
 		$manager_language = $modx->config['manager_language'];
56
-		if(is_file("{$lang_path}{$manager_language}.inc.php"))
56
+		if (is_file("{$lang_path}{$manager_language}.inc.php"))
57 57
 			include_once("{$lang_path}{$manager_language}.inc.php");
58 58
 		return $_lang;
59 59
 	}
60 60
 	
61
-	function setError($errorcode, $custommessage=""){
62
-		$this->errorcode=$errorcode;
63
-		$this->errormessage=$this->errors[$errorcode];
64
-		if($custommessage!="") {
65
-			$this->errormessage=$custommessage;
61
+	function setError($errorcode, $custommessage = ""){
62
+		$this->errorcode = $errorcode;
63
+		$this->errormessage = $this->errors[$errorcode];
64
+		if ($custommessage != "") {
65
+			$this->errormessage = $custommessage;
66 66
 		}
67 67
 	}	
68 68
 	
69
-	function getError() {
69
+	function getError(){
70 70
 		return $this->errorcode;
71 71
 	}
72 72
 	
Please login to merge, or discard this patch.
manager/includes/tmplvars.commands.inc.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Created by Raymond Irving Feb, 2005
5 5
  */
6 6
 global $BINDINGS; // Array of supported bindings. must be upper case
7
-$BINDINGS = array (
7
+$BINDINGS = array(
8 8
     'FILE',
9 9
     'CHUNK',
10 10
     'DOCUMENT',
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
     'DIRECTORY'
15 15
 );
16 16
 
17
-function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) {
17
+function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()){
18 18
     global $modx;
19 19
     $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier;
20 20
     $nvalue = trim($value);
21 21
     if (substr($nvalue, 0, 1) != '@')
22 22
         return $value;
23
-    elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') {
23
+    elseif (isset($modx->config['enable_bindings']) && $modx->config['enable_bindings'] != 1 && $src === 'docform') {
24 24
         return '@Bindings is disabled.';
25 25
     }
26 26
     else {
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
                 break;
47 47
 
48 48
             case "SELECT" : // selects a record from the cms database
49
-                $rt = array ();
50
-                $replacementVars = array (
49
+                $rt = array();
50
+                $replacementVars = array(
51 51
                     'DBASE' => $modx->db->config['dbase'],
52 52
                     'PREFIX' => $modx->db->config['table_prefix']
53 53
                 );
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
                 break;
89 89
 
90 90
             case 'DIRECTORY' :
91
-                $files = array ();
92
-                $path = $modx->config['base_path'] . $param;
91
+                $files = array();
92
+                $path = $modx->config['base_path'].$param;
93 93
                 if (substr($path, -1, 1) != '/') {
94 94
                     $path .= '/';
95 95
                 }
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
     }
118 118
 }
119 119
 
120
-function ProcessFile($file) {
120
+function ProcessFile($file){
121 121
     // get the file
122 122
 	$buffer = @file_get_contents($file);
123
-	if ($buffer===false) $buffer = " Could not retrieve document '$file'.";
123
+	if ($buffer === false) $buffer = " Could not retrieve document '$file'.";
124 124
     return $buffer;
125 125
 }
126 126
 
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 {
130 130
     global $BINDINGS;
131 131
     $binding_array = array();
132
-    foreach($BINDINGS as $cmd)
132
+    foreach ($BINDINGS as $cmd)
133 133
     {
134
-        if(strpos($binding_string,'@'.$cmd)===0)
134
+        if (strpos($binding_string, '@'.$cmd) === 0)
135 135
         {
136
-            $code = substr($binding_string,strlen($cmd)+1);
137
-            $binding_array = array($cmd,trim($code));
136
+            $code = substr($binding_string, strlen($cmd) + 1);
137
+            $binding_array = array($cmd, trim($code));
138 138
             break;
139 139
         }
140 140
     }
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 	if (strpos($param, '[*') !== false) {
150 150
 		$matches = $modx->getTagsFromContent($param, '[*', '*]');
151 151
 		foreach ($matches[0] as $i=>$match) {
152
-			if(isset($tvsArray[ $matches[1][$i] ])) {
153
-				if(is_array($tvsArray[ $matches[1][$i] ])) {
152
+			if (isset($tvsArray[$matches[1][$i]])) {
153
+				if (is_array($tvsArray[$matches[1][$i]])) {
154 154
 					$value = $tvsArray[$matches[1][$i]]['value'];
155 155
 					$value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value;
156 156
 				} else {
157
-					$value = $tvsArray[ $matches[1][$i] ];
157
+					$value = $tvsArray[$matches[1][$i]];
158 158
 				}
159 159
 				$param = str_replace($match, $value, $param);
160 160
 			}
Please login to merge, or discard this patch.
manager/includes/sysalert.display.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 	$sysMsgs = "";
14 14
 	$limit = count($SystemAlertMsgQueque);
15
-	for($i=0;$i<$limit;$i++) {
15
+	for ($i = 0; $i < $limit; $i++) {
16 16
 		$sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>";
17 17
 	}
18 18
 	// reset message queque
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	$_SESSION['SystemAlertMsgQueque'] = array();
21 21
 	$SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
22 22
 
23
-	if($sysMsgs!="") {
23
+	if ($sysMsgs != "") {
24 24
 ?>
25 25
 
26 26
 <?php // fetch the styles
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 			var sysAlert = new Element('div').setProperties({
33 33
 				'class': 'sysAlert'
34 34
 			});
35
-			sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs);?>';
35
+			sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs); ?>';
36 36
 			var boxHtml = new MooPrompt('<?php echo $_lang['sys_alert']; ?>', sysAlert, {
37 37
 				buttons: 1,
38 38
 				button1: 'Ok',
Please login to merge, or discard this patch.