Completed
Push — develop ( cb7ecf...5e631f )
by Dmytro
17s
created
manager/includes/extenders/modifiers/mdf_addbreak.inc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 $text = $modx->getModifiers()->parseDocumentSource($value);
3
-$text = str_replace(array("\r\n","\r"),"\n",$text);
3
+$text = str_replace(array("\r\n", "\r"), "\n", $text);
4 4
 
5 5
 $blockElms  = 'br,table,tbody,tr,td,th,thead,tfoot,caption,colgroup,div';
6 6
 $blockElms .= ',dl,dd,dt,ul,ol,li,pre,select,option,form,map,area,blockquote';
7 7
 $blockElms .= ',address,math,style,input,p,h1,h2,h3,h4,h5,h6,hr,object,param,embed';
8 8
 $blockElms .= ',noframes,noscript,section,article,aside,hgroup,footer,address,code';
9 9
 $blockElms = explode(',', $blockElms);
10
-$lines = explode("\n",$text);
10
+$lines = explode("\n", $text);
11 11
 $c = count($lines);
12
-foreach($lines as $i=>$line)
12
+foreach ($lines as $i=>$line)
13 13
 {
14 14
     $line = rtrim($line);
15
-    if($i===$c-1) break;
16
-    foreach($blockElms as $block)
15
+    if ($i === $c - 1) break;
16
+    foreach ($blockElms as $block)
17 17
     {
18
-        if(preg_match("@</?{$block}" . '[^>]*>$@',$line))
18
+        if (preg_match("@</?{$block}".'[^>]*>$@', $line))
19 19
             continue 2;
20 20
     }
21 21
     $lines[$i] = "{$line}<br />";
Please login to merge, or discard this patch.
manager/includes/functions/processors.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
 }
38 38
 
39
-if(!function_exists('duplicateDocument')) {
39
+if (!function_exists('duplicateDocument')) {
40 40
     /**
41 41
      * @param int $docid
42 42
      * @param null|int $parent
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
             $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'),
91 91
                 "pagetitle LIKE '{$pagetitle} Duplicate%'"));
92 92
             if ($count >= 1) {
93
-                $count = ' ' . ($count + 1);
93
+                $count = ' '.($count + 1);
94 94
             } else {
95 95
                 $count = '';
96 96
             }
97 97
 
98
-            $content['pagetitle'] = $_lang['duplicated_el_suffix'] . $count . ' ' . $content['pagetitle'];
98
+            $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
99 99
             $content['alias'] = null;
100 100
         } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
101 101
             $content['alias'] = null;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     }
154 154
 }
155 155
 
156
-if(!function_exists('duplicateTVs')) {
156
+if (!function_exists('duplicateTVs')) {
157 157
     /**
158 158
      * Duplicate Document TVs
159 159
      *
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
         $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
168 168
 
169
-        $newid = (int)$newid;
170
-        $oldid = (int)$oldid;
169
+        $newid = (int) $newid;
170
+        $oldid = (int) $oldid;
171 171
 
172 172
         $modx->getDatabase()->insert(
173 173
             array('contentid' => '', 'tmplvarid' => '', 'value' => ''), $tbltvc, // Insert into
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 }
178 178
 
179
-if(!function_exists('duplicateAccess')) {
179
+if (!function_exists('duplicateAccess')) {
180 180
     /**
181 181
      * Duplicate Document Access Permissions
182 182
      *
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
         $tbldg = $modx->getFullTableName('document_groups');
191 191
 
192
-        $newid = (int)$newid;
193
-        $oldid = (int)$oldid;
192
+        $newid = (int) $newid;
193
+        $oldid = (int) $oldid;
194 194
 
195 195
         $modx->getDatabase()->insert(
196 196
             array('document' => '', 'document_group' => ''), $tbldg, // Insert into
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     }
200 200
 }
201 201
 
202
-if(!function_exists('evalModule')) {
202
+if (!function_exists('evalModule')) {
203 203
     /**
204 204
      * evalModule
205 205
      *
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
             }
236 236
             if ($modx->config['error_reporting'] === '99' || 2 < $error_level) {
237 237
                 $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'],
238
-                    $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
238
+                    $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg);
239 239
                 $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
240 240
             }
241 241
         }
242 242
         unset($modx->event->params);
243 243
 
244
-        return $mod . $msg;
244
+        return $mod.$msg;
245 245
     }
246 246
 }
247 247
 
248
-if(!function_exists('allChildren')) {
248
+if (!function_exists('allChildren')) {
249 249
     /**
250 250
      * @param int $currDocID
251 251
      * @return array
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     }
266 266
 }
267 267
 
268
-if(!function_exists('jsAlert')) {
268
+if (!function_exists('jsAlert')) {
269 269
     /**
270 270
      * show javascript alert
271 271
      *
@@ -275,14 +275,14 @@  discard block
 block discarded – undo
275 275
     {
276 276
         $modx = evolutionCMS();
277 277
         if ($_POST['ajax'] != 1) {
278
-            echo "<script>window.setTimeout(\"alert('" . addslashes($modx->getDatabase()->escape($msg)) . "')\",10);history.go(-1)</script>";
278
+            echo "<script>window.setTimeout(\"alert('".addslashes($modx->getDatabase()->escape($msg))."')\",10);history.go(-1)</script>";
279 279
         } else {
280
-            echo $msg . "\n";
280
+            echo $msg."\n";
281 281
         }
282 282
     }
283 283
 }
284 284
 
285
-if(!function_exists('login')) {
285
+if (!function_exists('login')) {
286 286
     /**
287 287
      * @param string $username
288 288
      * @param string $givenPassword
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     }
298 298
 }
299 299
 
300
-if(!function_exists('loginV1')) {
300
+if (!function_exists('loginV1')) {
301 301
     /**
302 302
      * @param int $internalKey
303 303
      * @param string $givenPassword
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     }
331 331
 }
332 332
 
333
-if(!function_exists('loginMD5')) {
333
+if (!function_exists('loginMD5')) {
334 334
     /**
335 335
      * @param int $internalKey
336 336
      * @param string $givenPassword
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     }
352 352
 }
353 353
 
354
-if(!function_exists('updateNewHash')) {
354
+if (!function_exists('updateNewHash')) {
355 355
     /**
356 356
      * @param string $username
357 357
      * @param string $password
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     }
367 367
 }
368 368
 
369
-if(!function_exists('incrementFailedLoginCount')) {
369
+if (!function_exists('incrementFailedLoginCount')) {
370 370
     /**
371 371
      * @param int $internalKey
372 372
      * @param int $failedlogins
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
         if ($failedlogins < $failed_allowed) {
391 391
             //sleep to help prevent brute force attacks
392
-            $sleep = (int)$failedlogins / 2;
392
+            $sleep = (int) $failedlogins / 2;
393 393
             if ($sleep > 5) {
394 394
                 $sleep = 5;
395 395
             }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     }
403 403
 }
404 404
 
405
-if(!function_exists('saveUserGroupAccessPermissons')) {
405
+if (!function_exists('saveUserGroupAccessPermissons')) {
406 406
     /**
407 407
      * saves module user group access
408 408
      */
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
     }
434 434
 }
435 435
 
436
-if(!function_exists('saveEventListeners')) {
436
+if (!function_exists('saveEventListeners')) {
437 437
 # Save Plugin Event Listeners
438 438
     function saveEventListeners($id, $sysevents, $mode)
439 439
     {
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
     }
487 487
 }
488 488
 
489
-if(!function_exists('getEventIdByName')) {
489
+if (!function_exists('getEventIdByName')) {
490 490
     /**
491 491
      * @param string $name
492 492
      * @return string|int
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     }
510 510
 }
511 511
 
512
-if(!function_exists('saveTemplateAccess')) {
512
+if (!function_exists('saveTemplateAccess')) {
513 513
     /**
514 514
      * @param int $id
515 515
      */
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     }
549 549
 }
550 550
 
551
-if(!function_exists('saveTemplateVarAccess')) {
551
+if (!function_exists('saveTemplateVarAccess')) {
552 552
     /**
553 553
      * @return void
554 554
      */
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
     }
588 588
 }
589 589
 
590
-if(!function_exists('saveDocumentAccessPermissons')) {
590
+if (!function_exists('saveDocumentAccessPermissons')) {
591 591
     function saveDocumentAccessPermissons()
592 592
     {
593 593
         global $id, $newid;
@@ -756,10 +756,10 @@  discard block
 block discarded – undo
756 756
         }
757 757
 
758 758
         foreach ($defaults as $k) {
759
-            if (isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') {
759
+            if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') {
760 760
                 unset($settings[$k]);
761 761
             }
762
-            unset($settings['default_' . $k]);
762
+            unset($settings['default_'.$k]);
763 763
         }
764 764
 
765 765
         $modx->getDatabase()->delete($tbl_user_settings, "user='{$id}'");
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         global $id, $modx;
792 792
         $mode = $_POST['mode'];
793 793
         $modx->getManagerApi()->saveFormValues($mode);
794
-        $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode === $action ? "&id={$id}" : ''));
794
+        $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode === $action ? "&id={$id}" : ''));
795 795
     }
796 796
 }
797 797
 
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
         global $deltime;
808 808
 
809 809
         $rs = $modx->getDatabase()->select('id', $modx->getFullTableName('site_content'),
810
-            "parent='" . (int)$parent . "' AND deleted=1 AND deletedon='" . (int)$deltime . "'");
810
+            "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'");
811 811
         // the document has children documents, we'll need to delete those too
812 812
         while ($row = $modx->getDatabase()->getRow($rs)) {
813 813
             $children[] = $row['id'];
Please login to merge, or discard this patch.
manager/includes/functions/actions/import.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('run')) {
2
+if (!function_exists('run')) {
3 3
     /**
4 4
      * @return string
5 5
      */
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
             $modx->getDatabase()->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
29 29
         }
30 30
 
31
-        $parent = (int)$_POST['parent'];
31
+        $parent = (int) $_POST['parent'];
32 32
 
33
-        if (is_dir(MODX_BASE_PATH . 'temp/import')) {
34
-            $filedir = MODX_BASE_PATH . 'temp/import/';
35
-        } elseif (is_dir(MODX_BASE_PATH . 'assets/import')) {
36
-            $filedir = MODX_BASE_PATH . 'assets/import/';
33
+        if (is_dir(MODX_BASE_PATH.'temp/import')) {
34
+            $filedir = MODX_BASE_PATH.'temp/import/';
35
+        } elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
36
+            $filedir = MODX_BASE_PATH.'assets/import/';
37 37
         } else {
38 38
             $filedir = '';
39 39
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $files = pop_index($files);
45 45
 
46 46
         // no. of files to import
47
-        $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
47
+        $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
48 48
 
49 49
         // import files
50 50
         if (0 < count($files)) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $mtime = $mtime[1] + $mtime[0];
58 58
         $importend = $mtime;
59 59
         $totaltime = ($importend - $importstart);
60
-        $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
60
+        $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
61 61
 
62 62
         if ($_POST['convert_link'] == 'on') {
63 63
             convertLink();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 }
69 69
 
70
-if(!function_exists('importFiles')) {
70
+if (!function_exists('importFiles')) {
71 71
     /**
72 72
      * @param int $parent
73 73
      * @param string $filedir
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             if (is_array($value)) {
99 99
                 // create folder
100 100
                 $alias = $id;
101
-                printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
101
+                printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
102 102
                 $field = array();
103 103
                 $field['type'] = 'document';
104 104
                 $field['contentType'] = 'text/html';
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                              'index.html',
118 118
                              'index.htm'
119 119
                          ) as $filename) {
120
-                    $filepath = $filedir . $alias . '/' . $filename;
120
+                    $filepath = $filedir.$alias.'/'.$filename;
121 121
                     if ($find === false && file_exists($filepath)) {
122 122
                         $file = getFileContent($filepath);
123 123
                         list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
                         $newid = $modx->getDatabase()->insert($field, $tbl_site_content);
133 133
                         if ($newid) {
134 134
                             $find = true;
135
-                            echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
136
-                            importFiles($newid, $filedir . $alias . '/', $value, 'sub');
135
+                            echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
136
+                            importFiles($newid, $filedir.$alias.'/', $value, 'sub');
137 137
                         } else {
138
-                            echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->getDatabase()->getLastError();
138
+                            echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->getDatabase()->getLastError();
139 139
                             exit;
140 140
                         }
141 141
                     }
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
                     $newid = $modx->getDatabase()->insert($field, $tbl_site_content);
151 151
                     if ($newid) {
152 152
                         $find = true;
153
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
154
-                        importFiles($newid, $filedir . $alias . '/', $value, 'sub');
153
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
154
+                        importFiles($newid, $filedir.$alias.'/', $value, 'sub');
155 155
                     } else {
156
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->getDatabase()->getLastError();
156
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->getDatabase()->getLastError();
157 157
                         exit;
158 158
                     }
159 159
                 }
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
                 $fparts = explode('.', $value);
167 167
                 $alias = $fparts[0];
168 168
                 $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
169
-                printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
169
+                printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
170 170
 
171 171
                 if (!in_array($ext, $allowedfiles)) {
172
-                    echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
172
+                    echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
173 173
                 } else {
174
-                    $filepath = $filedir . $filename;
174
+                    $filepath = $filedir.$filename;
175 175
                     $file = getFileContent($filepath);
176 176
                     list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
177 177
 
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
                     $field['menuindex'] = ($alias == 'index') ? 0 : 2;
198 198
                     $newid = $modx->getDatabase()->insert($field, $tbl_site_content);
199 199
                     if ($newid) {
200
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
200
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
201 201
                     } else {
202
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->getDatabase()->getLastError();
202
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->getDatabase()->getLastError();
203 203
                         exit;
204 204
                     }
205 205
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     }
219 219
 }
220 220
 
221
-if(!function_exists('getFiles')) {
221
+if (!function_exists('getFiles')) {
222 222
     /**
223 223
      * @param string $directory
224 224
      * @param array $listing
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
             foreach ($files as $file) {
235 235
                 if ($file == '.' || $file == '..') {
236 236
                     continue;
237
-                } elseif ($h = @opendir($directory . $file . "/")) {
237
+                } elseif ($h = @opendir($directory.$file."/")) {
238 238
                     closedir($h);
239 239
                     $count = -1;
240
-                    $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
240
+                    $listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
241 241
                 } elseif (strpos($file, '.htm') !== false) {
242 242
                     $listing[$dummy] = $file;
243 243
                     $dummy = $dummy + 1;
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
                 }
246 246
             }
247 247
         } else {
248
-            echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
248
+            echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
249 249
         }
250 250
 
251 251
         return ($listing);
252 252
     }
253 253
 }
254 254
 
255
-if(!function_exists('getFileContent')) {
255
+if (!function_exists('getFileContent')) {
256 256
     /**
257 257
      * @param string $filepath
258 258
      * @return bool|string
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
         global $_lang;
263 263
         // get the file
264 264
         if (!$buffer = file_get_contents($filepath)) {
265
-            echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
265
+            echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
266 266
         } else {
267 267
             return $buffer;
268 268
         }
269 269
     }
270 270
 }
271 271
 
272
-if(!function_exists('pop_index')) {
272
+if (!function_exists('pop_index')) {
273 273
     /**
274 274
      * @param array $array
275 275
      * @return array
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     }
295 295
 }
296 296
 
297
-if(!function_exists('treatContent')) {
297
+if (!function_exists('treatContent')) {
298 298
     /**
299 299
      * @param string $src
300 300
      * @param string $filename
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         } else {
330 330
             $content = $src;
331 331
             $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
332
-            $r = '$1' . $modx->config['modx_charset'] . '$2';
332
+            $r = '$1'.$modx->config['modx_charset'].'$2';
333 333
             $content = preg_replace($s, $r, $content);
334 334
             $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
335 335
         }
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     }
346 346
 }
347 347
 
348
-if(!function_exists('convertLink')) {
348
+if (!function_exists('convertLink')) {
349 349
     /**
350 350
      * @return void
351 351
      */
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                     list($href, $v) = explode('"', $v, 2);
369 369
                     $_ = $href;
370 370
                     if (strpos($_, $modx->config['site_url']) !== false) {
371
-                        $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
371
+                        $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
372 372
                     }
373 373
                     if ($_[0] === '/') {
374 374
                         $_ = substr($_, 1);
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
                     if (strpos($_, '/') !== false) {
396 396
                         $_ = substr($_, strrpos($_, '/'));
397 397
                     }
398
-                    $_ = $dir . str_replace('.html', '', $_);
398
+                    $_ = $dir.str_replace('.html', '', $_);
399 399
                     if (!isset($target[$_])) {
400 400
                         $target[$_] = $modx->getIdFromAlias($_);
401 401
                     }
402 402
                     $target[$_] = trim($target[$_]);
403 403
                     if (!empty($target[$_])) {
404
-                        $href = '[~' . $target[$_] . '~]';
404
+                        $href = '[~'.$target[$_].'~]';
405 405
                     }
406
-                    $array[$c] = '<a href="' . $href . '"' . $v;
406
+                    $array[$c] = '<a href="'.$href.'"'.$v;
407 407
                 }
408 408
                 $c++;
409 409
             }
Please login to merge, or discard this patch.
manager/includes/functions/nodes.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('makeHTML')) {
3
+if (!function_exists('makeHTML')) {
4 4
     /**
5 5
      * @param int $indent
6 6
      * @param int $parent
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
             case 'publishedon':
38 38
             case 'pub_date':
39 39
             case 'unpub_date':
40
-                $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'],
41
-                    'sc.' . $_SESSION['tree_sortby']);
40
+                $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'],
41
+                    'sc.'.$_SESSION['tree_sortby']);
42 42
                 break;
43 43
             default:
44
-                $sortby = 'sc.' . $_SESSION['tree_sortby'];
44
+                $sortby = 'sc.'.$_SESSION['tree_sortby'];
45 45
         };
46 46
 
47
-        $orderby = $modx->getDatabase()->escape($sortby . ' ' . $_SESSION['tree_sortdir']);
47
+        $orderby = $modx->getDatabase()->escape($sortby.' '.$_SESSION['tree_sortdir']);
48 48
 
49 49
         // Folder sorting gets special setup ;) Add menuindex and pagetitle
50 50
         if ($_SESSION['tree_sortby'] == 'isfolder') {
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
             $_SESSION['mgrDocgroups']) : '';
60 60
         $showProtected = false;
61 61
         if (isset ($modx->config['tree_show_protected'])) {
62
-            $showProtected = (boolean)$modx->config['tree_show_protected'];
62
+            $showProtected = (boolean) $modx->config['tree_show_protected'];
63 63
         }
64
-        $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0';
64
+        $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
65 65
         if ($showProtected == false) {
66
-            $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
66
+            $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
67 67
         } else {
68 68
             $access = '';
69 69
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             }
101 101
 
102 102
             $weblinkDisplay = $row['type'] == 'reference' ? sprintf('&nbsp;%s', $_style['tree_linkgo']) : '';
103
-            $pageIdDisplay = '<small>(' . ($modx_textdir ? '&rlm;' : '') . $row['id'] . ')</small>';
103
+            $pageIdDisplay = '<small>('.($modx_textdir ? '&rlm;' : '').$row['id'].')</small>';
104 104
 
105 105
             // Prepare displaying user-locks
106 106
             $lockedByUser = '';
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                         'element_type' => $_lang["lock_element_type_7"],
112 112
                         'lasthit_df'   => $rowLock['lasthit_df']
113 113
                     ));
114
-                    $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>';
114
+                    $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>';
115 115
                 } else {
116 116
                     $title = $modx->parseText($_lang["lock_element_locked_by"], array(
117 117
                         'element_type' => $_lang["lock_element_type_7"],
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
                         'lasthit_df'   => $rowLock['lasthit_df']
120 120
                     ));
121 121
                     if ($modx->hasPermission('remove_locks')) {
122
-                        $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
122
+                        $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
123 123
                     } else {
124
-                        $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
124
+                        $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
125 125
                     }
126 126
                 }
127 127
             }
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
 
131 131
             $title = '';
132 132
             if (isDateNode($nodeNameSource)) {
133
-                $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]';
133
+                $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]';
134 134
             }
135
-            $title .= $_lang['id'] . ': ' . $row['id'];
136
-            $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle'];
137
-            $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex'];
138
-            $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-');
139
-            $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename'];
140
-            $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']);
141
-            $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']);
142
-            $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']);
143
-            $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
144
-            $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
145
-            $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
146
-            $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
135
+            $title .= $_lang['id'].': '.$row['id'];
136
+            $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle'];
137
+            $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex'];
138
+            $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-');
139
+            $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename'];
140
+            $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']);
141
+            $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']);
142
+            $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']);
143
+            $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
144
+            $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
145
+            $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
146
+            $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
147 147
             $title = $modx->getPhpCompat()->htmlspecialchars($title);
148
-            $title = str_replace('[+lf+]', ' &#13;', $title);   // replace line-breaks with empty space as fall-back
148
+            $title = str_replace('[+lf+]', ' &#13;', $title); // replace line-breaks with empty space as fall-back
149 149
 
150 150
             $data = array(
151 151
                 'id'               => $row['id'],
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 }
230 230
 
231 231
                 if ($ph['contextmenu']) {
232
-                    $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
232
+                    $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
233 233
                 }
234 234
 
235 235
                 if ($_SESSION['tree_show_only_folders']) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                         }
288 288
 
289 289
                         if ($ph['contextmenu']) {
290
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
290
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
291 291
                         }
292 292
 
293 293
                         $node .= $modx->parseText($tpl, $ph);
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                         }
326 326
 
327 327
                         if ($ph['contextmenu']) {
328
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
328
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
329 329
                         }
330 330
 
331 331
                         $node .= $modx->parseText($tpl, $ph);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                         }
377 377
 
378 378
                         if ($ph['contextmenu']) {
379
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
379
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
380 380
                         }
381 381
 
382 382
                         $node .= $modx->parseText($tpl, $ph);
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                         }
419 419
 
420 420
                         if ($ph['contextmenu']) {
421
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
421
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
422 422
                         }
423 423
 
424 424
                         $node .= $modx->parseText($tpl, $ph);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     }
445 445
 }
446 446
 
447
-if(!function_exists('getIconInfo')) {
447
+if (!function_exists('getIconInfo')) {
448 448
     /**
449 449
      * @param array $_style
450 450
      * @return array
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     }
479 479
 }
480 480
 
481
-if(!function_exists('getNodeTitle')) {
481
+if (!function_exists('getNodeTitle')) {
482 482
     /**
483 483
      * @param string $nodeNameSource
484 484
      * @param array $row
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
                         $nodetitle .= $modx->config['friendly_url_suffix'];
500 500
                     }
501 501
                 }
502
-                $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle;
502
+                $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle;
503 503
                 break;
504 504
             case 'pagetitle':
505 505
                 $nodetitle = $row['pagetitle'];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     }
534 534
 }
535 535
 
536
-if(!function_exists('isDateNode')) {
536
+if (!function_exists('isDateNode')) {
537 537
     /**
538 538
      * @param string $nodeNameSource
539 539
      * @return bool
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
     }
554 554
 }
555 555
 
556
-if(!function_exists('checkIsFolder')) {
556
+if (!function_exists('checkIsFolder')) {
557 557
     /**
558 558
      * @param int $parent
559 559
      * @param int $isfolder
@@ -563,11 +563,11 @@  discard block
 block discarded – undo
563 563
     {
564 564
         $modx = evolutionCMS();
565 565
 
566
-        return (int)$modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' '));
566
+        return (int) $modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' '));
567 567
     }
568 568
 }
569 569
 
570
-if(!function_exists('_htmlentities')) {
570
+if (!function_exists('_htmlentities')) {
571 571
     /**
572 572
      * @param mixed $array
573 573
      * @return string
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
     }
584 584
 }
585 585
 
586
-if(!function_exists('getTplSingleNode')) {
586
+if (!function_exists('getTplSingleNode')) {
587 587
     /**
588 588
      * @return string
589 589
      */
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
     }
614 614
 }
615 615
 
616
-if(!function_exists('getTplFolderNode')) {
616
+if (!function_exists('getTplFolderNode')) {
617 617
     /**
618 618
      * @return string
619 619
      */
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
         title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>';
655 655
     }
656 656
 }
657
-if(!function_exists('getTplFolderNodeNotChildren')) {
657
+if (!function_exists('getTplFolderNodeNotChildren')) {
658 658
     /**
659 659
      * @return string
660 660
      */
Please login to merge, or discard this patch.
manager/includes/functions/tv.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists('ProcessTVCommand')) {
3
+if (!function_exists('ProcessTVCommand')) {
4 4
     /**
5 5
      * @param string $value
6 6
      * @param string $name
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array())
13 13
     {
14 14
         $modx = evolutionCMS();
15
-        $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
15
+        $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
16 16
         $nvalue = trim($value);
17 17
         if (substr($nvalue, 0, 1) != '@') {
18 18
             return $value;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
                         // if an inherited value is found and if there is content following the @INHERIT binding
78 78
                         // remove @INHERIT and output that following content. This content could contain other
79 79
                         // @ bindings, that are processed in the next step
80
-                        if ((string)$tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) {
81
-                            $output = trim(str_replace('@INHERIT', '', (string)$tv['value']));
80
+                        if ((string) $tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) {
81
+                            $output = trim(str_replace('@INHERIT', '', (string) $tv['value']));
82 82
                             break 2;
83 83
                         }
84 84
                     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
                 case 'DIRECTORY' :
88 88
                     $files = array();
89
-                    $path = $modx->config['base_path'] . $param;
89
+                    $path = $modx->config['base_path'].$param;
90 90
                     if (substr($path, -1, 1) != '/') {
91 91
                         $path .= '/';
92 92
                     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     }
118 118
 }
119 119
 
120
-if (! function_exists('ProcessFile')) {
120
+if (!function_exists('ProcessFile')) {
121 121
     /**
122 122
      * @param $file
123 123
      * @return string
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-if (! function_exists('ParseCommand')) {
137
+if (!function_exists('ParseCommand')) {
138 138
     /**
139 139
      * ParseCommand - separate @ cmd from params
140 140
      *
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
         $binding_array = array();
157 157
         foreach ($BINDINGS as $cmd) {
158
-            if (strpos($binding_string, '@' . $cmd) === 0) {
158
+            if (strpos($binding_string, '@'.$cmd) === 0) {
159 159
                 $code = substr($binding_string, strlen($cmd) + 1);
160 160
                 $binding_array = array($cmd, trim($code));
161 161
                 break;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     }
167 167
 }
168 168
 
169
-if (! function_exists('parseTvValues')) {
169
+if (!function_exists('parseTvValues')) {
170 170
     /**
171 171
      * Parse MODX Template-Variables
172 172
      *
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
 }
199 199
 
200
-if (! function_exists('getTVDisplayFormat')) {
200
+if (!function_exists('getTVDisplayFormat')) {
201 201
     /**
202 202
      * @param string $name
203 203
      * @param string $value
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $o = '';
216 216
 
217 217
         // process any TV commands in value
218
-        $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
218
+        $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
219 219
         $value = ProcessTVCommand($value, $name, $docid);
220 220
 
221 221
         $params = array();
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
                             $attr['align'] = $params['align'];
255 255
                         }
256 256
                         foreach ($attr as $k => $v) {
257
-                            $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
257
+                            $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
258 258
                         }
259
-                        $attributes .= ' ' . $params['attrib'];
259
+                        $attributes .= ' '.$params['attrib'];
260 260
 
261 261
                         // Output the image with attributes
262
-                        $o .= '<img' . rtrim($attributes) . ' />';
262
+                        $o .= '<img'.rtrim($attributes).' />';
263 263
                     }
264 264
                 }
265 265
                 break;
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
                             'target' => $params['target'],
332 332
                         );
333 333
                         foreach ($attr as $k => $v) {
334
-                            $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
334
+                            $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
335 335
                         }
336
-                        $attributes .= ' ' . $params['attrib']; // add extra
336
+                        $attributes .= ' '.$params['attrib']; // add extra
337 337
 
338 338
                         // Output the link
339
-                        $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->getPhpCompat()->htmlspecialchars($params['text']) : $name) . '</a>';
339
+                        $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->getPhpCompat()->htmlspecialchars($params['text']) : $name).'</a>';
340 340
                     }
341 341
                 }
342 342
                 break;
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
                         'style' => $params['style'],
363 363
                     );
364 364
                     foreach ($attr as $k => $v) {
365
-                        $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
365
+                        $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
366 366
                     }
367
-                    $attributes .= ' ' . $params['attrib']; // add extra
367
+                    $attributes .= ' '.$params['attrib']; // add extra
368 368
 
369 369
                     // Output the HTML Tag
370
-                    $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
370
+                    $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>';
371 371
                 }
372 372
                 break;
373 373
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 $w = $params['w'] ? $params['w'] : '100%';
377 377
                 $h = $params['h'] ? $params['h'] : '400px';
378 378
                 $richtexteditor = $params['edt'] ? $params['edt'] : "";
379
-                $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
379
+                $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
380 380
                 $o .= $modx->getPhpCompat()->htmlspecialchars($value);
381 381
                 $o .= '</textarea></div>';
382 382
                 $replace_richtext = array($id);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
             case "viewport":
405 405
                 $value = parseInput($value);
406
-                $id = '_' . time();
406
+                $id = '_'.time();
407 407
                 if (!$params['vpid']) {
408 408
                     $params['vpid'] = $id;
409 409
                 }
@@ -417,41 +417,41 @@  discard block
 block discarded – undo
417 417
                     $h = "100%";
418 418
                 }
419 419
                 if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
420
-                    $autoMode = "3";  //both
420
+                    $autoMode = "3"; //both
421 421
                 } else {
422 422
                     if ($params['awidth'] == 'Yes') {
423 423
                         $autoMode = "1"; //width only
424 424
                     } else {
425 425
                         if ($params['aheight'] == 'Yes') {
426
-                            $autoMode = "2";    //height only
426
+                            $autoMode = "2"; //height only
427 427
                         }
428 428
                     }
429 429
                 }
430 430
 
431
-                $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array(
431
+                $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array(
432 432
                     'name'      => 'viewport',
433 433
                     'version'   => '0',
434 434
                     'plaintext' => false
435 435
                 ));
436
-                $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
436
+                $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' ";
437 437
                 if ($params['class']) {
438
-                    $o .= " class='" . $params['class'] . "' ";
438
+                    $o .= " class='".$params['class']."' ";
439 439
                 }
440 440
                 if ($params['style']) {
441
-                    $o .= " style='" . $params['style'] . "' ";
441
+                    $o .= " style='".$params['style']."' ";
442 442
                 }
443 443
                 if ($params['attrib']) {
444
-                    $o .= $params['attrib'] . " ";
444
+                    $o .= $params['attrib']." ";
445 445
                 }
446
-                $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' ";
447
-                $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' ";
448
-                $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' ";
446
+                $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' ";
447
+                $o .= "src='".$value."' frameborder='".$params['borsize']."' ";
448
+                $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' ";
449 449
                 $o .= ">";
450 450
                 $o .= $eTag;
451 451
                 break;
452 452
 
453 453
             case "datagrid":
454
-                include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
454
+                include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
455 455
                 $grd = new DataGrid('', $value);
456 456
 
457 457
                 $grd->noRecordMsg = $params['egmsg'];
@@ -498,16 +498,16 @@  discard block
 block discarded – undo
498 498
                 $o = '';
499 499
                 /* If we are loading a file */
500 500
                 if (substr($params['output'], 0, 5) == "@FILE") {
501
-                    $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6));
501
+                    $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6));
502 502
                     if (!file_exists($file_name)) {
503
-                        $widget_output = $file_name . ' does not exist';
503
+                        $widget_output = $file_name.' does not exist';
504 504
                     } else {
505 505
                         $widget_output = file_get_contents($file_name);
506 506
                     }
507 507
                 } elseif (substr($params['output'], 0, 8) == '@INCLUDE') {
508
-                    $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9));
508
+                    $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9));
509 509
                     if (!file_exists($file_name)) {
510
-                        $widget_output = $file_name . ' does not exist';
510
+                        $widget_output = $file_name.' does not exist';
511 511
                     } else {
512 512
                         /* The included file needs to set $widget_output. Can be string, array, object */
513 513
                         include $file_name;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     }
550 550
 }
551 551
 
552
-if (! function_exists('decodeParamValue')) {
552
+if (!function_exists('decodeParamValue')) {
553 553
     /**
554 554
      * @param string $s
555 555
      * @return string
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     }
563 563
 }
564 564
 
565
-if (! function_exists('parseInput')) {
565
+if (!function_exists('parseInput')) {
566 566
     /**
567 567
      * returns an array if a delimiter is present. returns array is a recordset is present
568 568
      *
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     }
595 595
 }
596 596
 
597
-if (! function_exists('getUnixtimeFromDateString')) {
597
+if (!function_exists('getUnixtimeFromDateString')) {
598 598
     /**
599 599
      * @param string $value
600 600
      * @return bool|false|int
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
     }
623 623
 }
624 624
 
625
-if (! function_exists('renderFormElement')) {
625
+if (!function_exists('renderFormElement')) {
626 626
     /**
627 627
      * DISPLAY FORM ELEMENTS
628 628
      *
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
         $field_style = '',
646 646
         $row = array(),
647 647
         $tvsArray = array()
648
-    ) {
648
+    ){
649 649
         $modx = evolutionCMS();
650 650
         global $_style;
651 651
         global $_lang;
@@ -665,22 +665,22 @@  discard block
 block discarded – undo
665 665
 
666 666
                 case "text": // handler for regular text boxes
667 667
                 case "rawtext"; // non-htmlentity converted text boxes
668
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
668
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />';
669 669
                     break;
670 670
                 case "email": // handles email input fields
671
-                    $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
671
+                    $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>';
672 672
                     break;
673 673
                 case "number": // handles the input of numbers
674
-                    $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
674
+                    $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
675 675
                     break;
676 676
                 case "textareamini": // handler for textarea mini boxes
677
-                    $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '</textarea>';
677
+                    $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->getPhpCompat()->htmlspecialchars($field_value).'</textarea>';
678 678
                     break;
679 679
                 case "textarea": // handler for textarea boxes
680 680
                 case "rawtextarea": // non-htmlentity convertex textarea boxes
681 681
                 case "htmlarea": // handler for textarea boxes (deprecated)
682 682
                 case "richtext": // handler for textarea boxes
683
-                    $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '</textarea>';
683
+                    $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->getPhpCompat()->htmlspecialchars($field_value).'</textarea>';
684 684
                     break;
685 685
                 case "date":
686 686
                     $field_id = str_replace(array(
@@ -690,12 +690,12 @@  discard block
 block discarded – undo
690 690
                     if ($field_value == '') {
691 691
                         $field_value = 0;
692 692
                     }
693
-                    $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;" />';
694
-                    $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>';
693
+                    $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;" />';
694
+                    $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>';
695 695
 
696 696
                     break;
697 697
                 case "dropdown": // handler for select boxes
698
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
698
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">';
699 699
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
700 700
                         $tvsArray));
701 701
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -703,12 +703,12 @@  discard block
 block discarded – undo
703 703
                         if (strlen($itemvalue) == 0) {
704 704
                             $itemvalue = $item;
705 705
                         }
706
-                        $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>';
706
+                        $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>';
707 707
                     }
708 708
                     $field_html .= "</select>";
709 709
                     break;
710 710
                 case "listbox": // handler for select boxes
711
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
711
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">';
712 712
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
713 713
                         $tvsArray));
714 714
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -716,13 +716,13 @@  discard block
 block discarded – undo
716 716
                         if (strlen($itemvalue) == 0) {
717 717
                             $itemvalue = $item;
718 718
                         }
719
-                        $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>';
719
+                        $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>';
720 720
                     }
721 721
                     $field_html .= "</select>";
722 722
                     break;
723 723
                 case "listbox-multiple": // handler for select boxes where you can choose multiple items
724 724
                     $field_value = explode("||", $field_value);
725
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
725
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
726 726
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
727 727
                         $tvsArray));
728 728
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
                         if (strlen($itemvalue) == 0) {
731 731
                             $itemvalue = $item;
732 732
                         }
733
-                        $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue,
734
-                                $field_value) ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>';
733
+                        $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue,
734
+                                $field_value) ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>';
735 735
                     }
736 736
                     $field_html .= "</select>";
737 737
                     break;
@@ -743,17 +743,17 @@  discard block
 block discarded – undo
743 743
                         'ftp://'   => 'ftp://',
744 744
                         'mailto:'  => 'mailto:'
745 745
                     );
746
-                    $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;">';
746
+                    $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;">';
747 747
                     foreach ($urls as $k => $v) {
748 748
                         if (strpos($field_value, $v) === false) {
749
-                            $field_html .= '<option value="' . $v . '">' . $k . '</option>';
749
+                            $field_html .= '<option value="'.$v.'">'.$k.'</option>';
750 750
                         } else {
751 751
                             $field_value = str_replace($v, '', $field_value);
752
-                            $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
752
+                            $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>';
753 753
                         }
754 754
                     }
755 755
                     $field_html .= '</select></td><td>';
756
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
756
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>';
757 757
                     break;
758 758
                 case 'checkbox': // handles check boxes
759 759
                     $values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
                         if (strlen($itemvalue) == 0) {
796 796
                             $itemvalue = $item;
797 797
                         }
798
-                        $field_html .= '<input type="radio" value="' . $modx->getPhpCompat()->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 />';
798
+                        $field_html .= '<input type="radio" value="'.$modx->getPhpCompat()->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 />';
799 799
                         $i++;
800 800
                     }
801 801
                     break;
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
 									lastImageCtrl = ctrl;
826 826
 									var w = screen.width * 0.5;
827 827
 									var h = screen.height * 0.5;
828
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
828
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
829 829
 								}
830 830
 								function BrowseFileServer(ctrl) {
831 831
 									lastFileCtrl = ctrl;
832 832
 									var w = screen.width * 0.5;
833 833
 									var h = screen.height * 0.5;
834
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
834
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
835 835
 								}
836 836
 								function SetUrlChange(el) {
837 837
 									if ('createEvent' in document) {
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 						</script>";
866 866
                         $ResourceManagerLoaded = true;
867 867
                     }
868
-                    $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 . '\')" />';
868
+                    $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.'\')" />';
869 869
                     break;
870 870
                 case "file": // handles the input of file uploads
871 871
                     /* Modified by Timon for use with resource browser */
@@ -895,13 +895,13 @@  discard block
 block discarded – undo
895 895
 									lastImageCtrl = ctrl;
896 896
 									var w = screen.width * 0.5;
897 897
 									var h = screen.height * 0.5;
898
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
898
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
899 899
 								}
900 900
 								function BrowseFileServer(ctrl) {
901 901
 									lastFileCtrl = ctrl;
902 902
 									var w = screen.width * 0.5;
903 903
 									var h = screen.height * 0.5;
904
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
904
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
905 905
 								}
906 906
 								function SetUrlChange(el) {
907 907
 									if ('createEvent' in document) {
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 						</script>";
936 936
                         $ResourceManagerLoaded = true;
937 937
                     }
938
-                    $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 . '\')" />';
938
+                    $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.'\')" />';
939 939
 
940 940
                     break;
941 941
 
@@ -943,16 +943,16 @@  discard block
 block discarded – undo
943 943
                     $custom_output = '';
944 944
                     /* If we are loading a file */
945 945
                     if (substr($field_elements, 0, 5) == "@FILE") {
946
-                        $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
946
+                        $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6));
947 947
                         if (!file_exists($file_name)) {
948
-                            $custom_output = $file_name . ' does not exist';
948
+                            $custom_output = $file_name.' does not exist';
949 949
                         } else {
950 950
                             $custom_output = file_get_contents($file_name);
951 951
                         }
952 952
                     } elseif (substr($field_elements, 0, 8) == '@INCLUDE') {
953
-                        $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
953
+                        $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9));
954 954
                         if (!file_exists($file_name)) {
955
-                            $custom_output = $file_name . ' does not exist';
955
+                            $custom_output = $file_name.' does not exist';
956 956
                         } else {
957 957
                             ob_start();
958 958
                             include $file_name;
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
                         $chunk_name = trim(substr($field_elements, 7));
964 964
                         $chunk_body = $modx->getChunk($chunk_name);
965 965
                         if ($chunk_body == false) {
966
-                            $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
966
+                            $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')';
967 967
                         } else {
968 968
                             $custom_output = $chunk_body;
969 969
                         }
@@ -988,15 +988,15 @@  discard block
 block discarded – undo
988 988
                     break;
989 989
 
990 990
                 default: // the default handler -- for errors, mostly
991
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
991
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />';
992 992
 
993 993
             } // end switch statement
994 994
         } else {
995 995
             $custom = explode(":", $field_type);
996 996
             $custom_output = '';
997
-            $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
997
+            $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php';
998 998
             if (!file_exists($file_name)) {
999
-                $custom_output = $file_name . ' does not exist';
999
+                $custom_output = $file_name.' does not exist';
1000 1000
             } else {
1001 1001
                 ob_start();
1002 1002
                 include $file_name;
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
     } // end renderFormElement function
1021 1021
 }
1022 1022
 
1023
-if (! function_exists('ParseIntputOptions')) {
1023
+if (!function_exists('ParseIntputOptions')) {
1024 1024
     /**
1025 1025
      * @param string|array|mysqli_result $v
1026 1026
      * @return array
Please login to merge, or discard this patch.
manager/includes/bootstrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * @see https://github.com/theseer/Autoload
4 4
  */
5 5
 spl_autoload_register(
6
-    function($class) {
6
+    function($class){
7 7
         static $classes = null;
8 8
         if ($classes === null) {
9 9
             $classes = array(
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         }
67 67
         $cn = strtolower($class);
68 68
         if (isset($classes[$cn])) {
69
-            require __DIR__ . $classes[$cn];
69
+            require __DIR__.$classes[$cn];
70 70
         }
71 71
     },
72 72
     true,
Please login to merge, or discard this patch.
manager/includes/messageCount.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'),
7
-    "recipient=" . $modx->getLoginUserID() . " AND messageread=0");
7
+    "recipient=".$modx->getLoginUserID()." AND messageread=0");
8 8
 $nrnewmessages = $modx->getDatabase()->getValue($rs);
9
-$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID());
9
+$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID());
10 10
 $nrtotalmessages = $modx->getDatabase()->getValue($rs);
11 11
 $messagesallowed = $modx->hasPermission('messages');
12 12
 
13 13
 // ajax response
14 14
 if (isset($_POST['updateMsgCount'])) {
15 15
     header("Content-Type: application/json; charset=utf-8");
16
-    print $nrnewmessages . ',' . $nrtotalmessages;
16
+    print $nrnewmessages.','.$nrtotalmessages;
17 17
     exit;
18 18
 }
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/core/autoload.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 $modx = evolutionCMS();
27 27
 $modx->getDatabase()->connect();
28 28
 startCMSSession();
29
-if(!isset($_SESSION['mgrValidated'])) {
29
+if (!isset($_SESSION['mgrValidated'])) {
30 30
         die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
31 31
 }
32 32
 define('IN_MANAGER_MODE', true);
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 $manager_language = $modx->config['manager_language'];
36 36
 // Pass language code from MODX to KCFinder
37
-if(!file_exists("../../../includes/lang/".$manager_language.".inc.php")) {
37
+if (!file_exists("../../../includes/lang/".$manager_language.".inc.php")) {
38 38
     $manager_language = "english"; // if not set, get the english language file.
39 39
 }
40 40
 include_once "../../../includes/lang/".$manager_language.".inc.php";
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 // PHP VERSION CHECK
44 44
 if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5)
45
-    die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution.");
45
+    die("You are using PHP ".PHP_VERSION." when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution.");
46 46
 
47 47
 
48 48
 // SAFE MODE CHECK
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 
53 53
 // MAGIC AUTOLOAD CLASSES FUNCTION
54
-function autoloadda9d06472ccb71b84928677ce2a6ca89($class) {
54
+function autoloadda9d06472ccb71b84928677ce2a6ca89($class){
55 55
     static $classes = null;
56 56
     if ($classes === null) {
57 57
         $classes = array(
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         );
76 76
     }
77 77
     if (isset($classes[$class])) {
78
-        require dirname(__FILE__) . $classes[$class];
78
+        require dirname(__FILE__).$classes[$class];
79 79
     }
80 80
 }
81 81
 spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true);
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 // json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING
85 85
 if (!function_exists("json_encode")) {
86 86
 
87
-    function kcfinder_json_string_encode($string) {
88
-        return '"' .
87
+    function kcfinder_json_string_encode($string){
88
+        return '"'.
89 89
             str_replace('/', "\\/",
90 90
             str_replace("\t", "\\t",
91 91
             str_replace("\r", "\\r",
92 92
             str_replace("\n", "\\n",
93 93
             str_replace('"', "\\\"",
94 94
             str_replace("\\", "\\\\",
95
-        $string)))))) . '"';
95
+        $string)))))).'"';
96 96
     }
97 97
 
98
-    function json_encode($data) {
98
+    function json_encode($data){
99 99
 
100 100
         if (is_array($data)) {
101 101
             $ret = array();
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
             // OBJECT
104 104
             if (array_keys($data) !== range(0, count($data) - 1)) {
105 105
                 foreach ($data as $key => $val)
106
-                    $ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val);
107
-                return "{" . implode(",", $ret) . "}";
106
+                    $ret[] = kcfinder_json_string_encode($key).':'.json_encode($val);
107
+                return "{".implode(",", $ret)."}";
108 108
 
109 109
             // ARRAY
110 110
             } else {
111 111
                 foreach ($data as $val)
112 112
                     $ret[] = json_encode($val);
113
-                return "[" . implode(",", $ret) . "]";
113
+                return "[".implode(",", $ret)."]";
114 114
             }
115 115
 
116 116
         // BOOLEAN OR NULL
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/core/uploader.php 1 patch
Spacing   +46 added lines, -47 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class uploader {
15
+class uploader{
16 16
 
17 17
 /** Release version */
18 18
     const VERSION = "2.54";
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
 /** Next three properties are got from the current language file
74 74
   * @var string */
75
-    protected $dateTimeFull;   // Currently not used
76
-    protected $dateTimeMid;    // Currently not used
75
+    protected $dateTimeFull; // Currently not used
76
+    protected $dateTimeMid; // Currently not used
77 77
     protected $dateTimeSmall;
78 78
 
79 79
 /** Contain Specified language labels
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 /** Magic method which allows read-only access to protected or private class properties
105 105
   * @param string $property
106 106
   * @return mixed */
107
-    public function __get($property) {
107
+    public function __get($property){
108 108
         return property_exists($this, $property) ? $this->$property : null;
109 109
     }
110 110
 
111
-    public function __construct($modx) {
111
+    public function __construct($modx){
112 112
 
113 113
         //MODX
114 114
         try {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
         // COOKIES INIT
208 208
         $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
209
-        $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/';
209
+        $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/';
210 210
         if (preg_match($ip, $_SERVER['HTTP_HOST']) ||
211 211
             preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST'])
212 212
         )
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         ) {
225 225
             list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
226 226
             $path = path::normalize($path);
227
-            $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path";
227
+            $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path";
228 228
             $this->config['uploadDir'] = strlen($this->config['uploadDir'])
229 229
                 ? path::normalize($this->config['uploadDir'])
230 230
                 : path::url2fullPath("/$path");
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         foreach ($this->langInputNames as $key)
268 268
             if (isset($this->get[$key]) &&
269 269
                 preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) &&
270
-                file_exists("lang/" . strtolower($this->get[$key]) . ".php")
270
+                file_exists("lang/".strtolower($this->get[$key]).".php")
271 271
             ) {
272 272
                 $this->lang = $this->get[$key];
273 273
                 break;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             $this->backMsg("Cannot read upload folder.");
299 299
     }
300 300
 
301
-    public function upload() {
301
+    public function upload(){
302 302
         $config = &$this->config;
303 303
         $file = &$this->file;
304 304
         $url = $message = "";
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                     @mkdir(path::normalize($dir), $this->config['dirPerms'], true);
330 330
 
331 331
                 $filename = $this->normalizeFilename($file['name']);
332
-                $target = file::getInexistantFilename($dir . $filename);
332
+                $target = file::getInexistantFilename($dir.$filename);
333 333
 
334 334
                 if (!@move_uploaded_file($file['tmp_name'], $target) &&
335 335
                     !@rename($file['tmp_name'], $target) &&
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
                     $this->makeThumb($target);
343 343
                     $url = $this->typeURL;
344 344
                     if (isset($udir)) $url .= "/$udir";
345
-                    $url .= "/" . basename($target);
345
+                    $url .= "/".basename($target);
346 346
                     if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) {
347 347
                         list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
348
-                        $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/";
349
-                        $url = $base . path::urlPathEncode($path);
348
+                        $base = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/";
349
+                        $url = $base.path::urlPathEncode($path);
350 350
                     } else
351 351
                         $url = path::urlPathEncode($url);
352 352
                 }
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
     }
366 366
 
367 367
 
368
-	protected function getTransaliasSettings() {
368
+	protected function getTransaliasSettings(){
369 369
 		$modx = evolutionCMS();
370 370
 
371 371
 		// Cleaning uploaded filename?
372 372
 		$setting = $modx->getDatabase()->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1');
373
-		if ($modx->getDatabase()->getValue($setting)>0) {
373
+		if ($modx->getDatabase()->getValue($setting) > 0) {
374 374
 			// Transalias plugin active?
375 375
 			$res = $modx->getDatabase()->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0');
376 376
 			if ($properties = $modx->getDatabase()->getValue($res)) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	}
386 386
 
387 387
 
388
-	protected function normalizeFilename($filename) {
388
+	protected function normalizeFilename($filename){
389 389
 		if ($this->getTransaliasSettings()) {
390 390
         		$format = strrchr($filename, ".");
391 391
         		$filename = str_replace($format, "", $filename);
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
         	return $filename;
395 395
 	}
396 396
 
397
-	protected function normalizeDirname($dirname) {
397
+	protected function normalizeDirname($dirname){
398 398
         return $this->modx->stripAlias($dirname);
399 399
     }
400 400
 
401
-    protected function checkUploadedFile(array $aFile=null) {
401
+    protected function checkUploadedFile(array $aFile = null){
402 402
         $config = &$this->config;
403 403
         $file = ($aFile === null) ? $this->file : $aFile;
404 404
 
@@ -437,8 +437,7 @@  discard block
 block discarded – undo
437 437
                 ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ?
438 438
                     $this->label("Missing a temporary folder.") : (
439 439
                 ($file['error'] == UPLOAD_ERR_CANT_WRITE) ?
440
-                    $this->label("Failed to write file.") :
441
-                    $this->label("Unknown error.")
440
+                    $this->label("Failed to write file.") : $this->label("Unknown error.")
442 441
             )))));
443 442
 
444 443
         // HIDDEN FILENAMES CHECK
@@ -473,14 +472,14 @@  discard block
 block discarded – undo
473 472
 
474 473
 
475 474
 	// CHECK FOR MODX MAX FILE SIZE
476
-	$actualfilesize=filesize($file['tmp_name']);
475
+	$actualfilesize = filesize($file['tmp_name']);
477 476
 	if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize'])
478 477
 	    return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
479 478
 
480 479
         return true;
481 480
     }
482 481
 
483
-    protected function checkInputDir($dir, $inclType=true, $existing=true) {
482
+    protected function checkInputDir($dir, $inclType = true, $existing = true){
484 483
         $dir = path::normalize($dir);
485 484
         if (substr($dir, 0, 1) == "/")
486 485
             $dir = substr($dir, 1);
@@ -506,7 +505,7 @@  discard block
 block discarded – undo
506 505
         return (is_dir($path) && is_readable($path)) ? $return : false;
507 506
     }
508 507
 
509
-    protected function validateExtension($ext, $type) {
508
+    protected function validateExtension($ext, $type){
510 509
         $ext = trim(strtolower($ext));
511 510
         if (!isset($this->types[$type]))
512 511
             return false;
@@ -531,17 +530,17 @@  discard block
 block discarded – undo
531 530
         return in_array($ext, $exts);
532 531
     }
533 532
 
534
-    protected function getTypeFromPath($path) {
533
+    protected function getTypeFromPath($path){
535 534
         return preg_match('/^([^\/]*)\/.*$/', $path, $patt)
536 535
             ? $patt[1] : $path;
537 536
     }
538 537
 
539
-    protected function removeTypeFromPath($path) {
538
+    protected function removeTypeFromPath($path){
540 539
         return preg_match('/^[^\/]*\/(.*)$/', $path, $patt)
541 540
             ? $patt[1] : "";
542 541
     }
543 542
 
544
-    protected function imageResize($image, $file=null) {
543
+    protected function imageResize($image, $file = null){
545 544
 
546 545
         if (!($image instanceof image)) {
547 546
             $img = image::factory($this->imageDriver, $image);
@@ -629,24 +628,24 @@  discard block
 block discarded – undo
629 628
             $img->watermark($this->config['watermark']['file'], $left, $top);
630 629
 		}
631 630
 
632
-        $options = array( 'file' => $file );
631
+        $options = array('file' => $file);
633 632
 
634
-        $type = exif_imagetype( $file );
633
+        $type = exif_imagetype($file);
635 634
 
636
-        switch ( $type ) {
635
+        switch ($type) {
637 636
             case IMAGETYPE_GIF:
638
-                return $img->output( 'gif', $options );
637
+                return $img->output('gif', $options);
639 638
 
640 639
             case IMAGETYPE_PNG:
641
-                return $img->output( 'png', $options );
640
+                return $img->output('png', $options);
642 641
 
643 642
             default:
644
-                return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) );
643
+                return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality'])));
645 644
         }
646 645
 
647 646
     }
648 647
 
649
-    protected function makeThumb($file, $overwrite=true) {
648
+    protected function makeThumb($file, $overwrite = true){
650 649
         $img = image::factory($this->imageDriver, $file);
651 650
 
652 651
         // Drop files which are not images
@@ -654,7 +653,7 @@  discard block
 block discarded – undo
654 653
             return true;
655 654
 
656 655
         $thumb = substr($file, strlen($this->config['uploadDir']));
657
-        $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb;
656
+        $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb;
658 657
         $thumb = path::normalize($thumb);
659 658
         $thumbDir = dirname($thumb);
660 659
         if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true))
@@ -677,15 +676,15 @@  discard block
 block discarded – undo
677 676
         if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight']))
678 677
             return false;
679 678
 
680
-        if ( $this->imageDriver == 'gd' ) {
681
-            $width  = imagesx( $img->image );
682
-            $height = imagesy( $img->image );
683
-            $back   = image::factory( $this->imageDriver, array( $width, $height ) );
684
-            $tile   = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' );
679
+        if ($this->imageDriver == 'gd') {
680
+            $width  = imagesx($img->image);
681
+            $height = imagesy($img->image);
682
+            $back   = image::factory($this->imageDriver, array($width, $height));
683
+            $tile   = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png');
685 684
 
686
-            imagesettile( $back->image, $tile->image );
687
-            imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED );
688
-            imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height );
685
+            imagesettile($back->image, $tile->image);
686
+            imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED);
687
+            imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height);
689 688
 
690 689
             $img = $back;
691 690
         }
@@ -697,7 +696,7 @@  discard block
 block discarded – undo
697 696
         ));
698 697
     }
699 698
 
700
-    protected function localize($langCode) {
699
+    protected function localize($langCode){
701 700
         require "lang/{$langCode}.php";
702 701
         setlocale(LC_ALL, $lang['_locale']);
703 702
         $this->charset = $lang['_charset'];
@@ -712,7 +711,7 @@  discard block
 block discarded – undo
712 711
         $this->labels = $lang;
713 712
     }
714 713
 
715
-    protected function label($string, array $data=null) {
714
+    protected function label($string, array $data = null){
716 715
         $return = isset($this->labels[$string]) ? $this->labels[$string] : $string;
717 716
         if (is_array($data))
718 717
             foreach ($data as $key => $val)
@@ -720,7 +719,7 @@  discard block
 block discarded – undo
720 719
         return $return;
721 720
     }
722 721
 
723
-    protected function backMsg($message, array $data=null) {
722
+    protected function backMsg($message, array $data = null){
724 723
         $message = $this->label($message, $data);
725 724
         if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name']))
726 725
             @unlink($this->file['tmp_name']);
@@ -728,7 +727,7 @@  discard block
 block discarded – undo
728 727
         die;
729 728
     }
730 729
 
731
-    protected function callBack($url, $message="") {
730
+    protected function callBack($url, $message = ""){
732 731
         $message = text::jsValue($message);
733 732
         $CKfuncNum = isset($this->opener['CKEditor']['funcNum'])
734 733
             ? $this->opener['CKEditor']['funcNum'] : 0;
@@ -769,7 +768,7 @@  discard block
 block discarded – undo
769 768
 
770 769
     }
771 770
 
772
-    protected function get_htaccess() {
771
+    protected function get_htaccess(){
773 772
         return "<IfModule mod_php4.c>
774 773
   php_value engine off
775 774
 </IfModule>
Please login to merge, or discard this patch.