Completed
Push — develop ( 0674b4...4b2fd1 )
by Serg
06:28
created
manager/media/browser/mcpuk/lang/ca.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** Catalan localization file for KCFinder
4
-  * author: Xevi Fuster
5
-  * country: Catalunya
6
-  */
4
+ * author: Xevi Fuster
5
+ * country: Catalunya
6
+ */
7 7
 
8 8
 $lang = array(
9 9
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
 
8 8
 $lang = array(
9 9
 
10
-    '_locale' => "ca_ES.UTF-8",  // UNIX localization code
11
-    '_charset' => "utf-8",       // Browser charset
10
+    '_locale' => "ca_ES.UTF-8", // UNIX localization code
11
+    '_charset' => "utf-8", // Browser charset
12 12
 
13 13
     // Date time formats. See http://www.php.net/manual/en/function.strftime.php
14 14
     '_dateTimeFull' => "%A, %e %B, %Y %H:%M",
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lang/id.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** {Indonesian} localization file for KCFinder
4
-  * -Razi Senseio (Author)
5
-  */
4
+ * -Razi Senseio (Author)
5
+ */
6 6
 
7 7
 $lang = array(
8 8
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 $lang = array(
8 8
 
9
-    '_locale' => "id_ID.UTF-8",  // UNIX localization code
10
-    '_charset' => "utf-8",       // Browser charset
9
+    '_locale' => "id_ID.UTF-8", // UNIX localization code
10
+    '_charset' => "utf-8", // Browser charset
11 11
 
12 12
     // Date time formats. See http://www.php.net/manual/en/function.strftime.php
13 13
     '_dateTimeFull' => "%A, %e %B, %Y %H:%M",
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lang/nl.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** Dutch localization file for KCFinder
4
-  * author: Lars Anderson <[email protected]>
5
-  */
4
+ * author: Lars Anderson <[email protected]>
5
+ */
6 6
 
7 7
 $lang = array(
8 8
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 $lang = array(
8 8
 
9
-    '_locale' => "nl_NL.UTF-8",  // UNIX localization code
10
-    '_charset' => "utf-8",       // Browser charset
9
+    '_locale' => "nl_NL.UTF-8", // UNIX localization code
10
+    '_charset' => "utf-8", // Browser charset
11 11
 
12 12
     // Date time formats. See http://www.php.net/manual/en/function.strftime.php
13 13
     '_dateTimeFull' => "%A, %e.%B.%Y %H:%M",
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lang/vi.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** vi localization file for KCFinder
4
-  * Tran Van Quyet - HQV ltd
5
-  */
4
+ * Tran Van Quyet - HQV ltd
5
+ */
6 6
 
7 7
 $lang = array(
8 8
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 $lang = array(
8 8
 
9
-    '_locale' => "vi_VN.UTF-8",  // UNIX localization code
10
-    '_charset' => "utf-8",       // Browser charset
9
+    '_locale' => "vi_VN.UTF-8", // UNIX localization code
10
+    '_charset' => "utf-8", // Browser charset
11 11
 
12 12
     // Date time formats. See http://www.php.net/manual/en/function.strftime.php
13 13
     '_dateTimeFull' => "%A, %e %B, %Y %H:%M",
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/css.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Base CSS definitions
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Base CSS definitions
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 require "core/autoload.php";
16 16
 $mtime = @filemtime(__FILE__);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@
 block discarded – undo
14 14
 
15 15
 require "core/autoload.php";
16 16
 $mtime = @filemtime(__FILE__);
17
-if ($mtime) httpCache::checkMTime($mtime);
17
+if ($mtime) {
18
+    httpCache::checkMTime($mtime);
19
+}
18 20
 $browser = new browser($modx);
19 21
 $config = $browser->config;
20 22
 ob_start();
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/js_localize.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Load language labels into JavaScript
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Load language labels into JavaScript
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 require "core/autoload.php";
16 16
 $input = new input();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     header("Content-Type: text/javascript");
19 19
     die;
20 20
 }
21
-$file = "lang/" . $input->get['lng'] . ".php";
21
+$file = "lang/".$input->get['lng'].".php";
22 22
 $files = dir::content("lang", array(
23 23
     'types' => "file",
24 24
     'pattern' => '/^.*\.php$/'
@@ -33,4 +33,4 @@  discard block
 block discarded – undo
33 33
 header("Content-Type: text/javascript; charset={$lang['_charset']}");
34 34
 foreach ($lang as $english => $native)
35 35
     if (substr($english, 0, 1) != "_")
36
-        echo "browser.labels['" . text::jsValue($english) . "']=\"" . text::jsValue($native) . "\";";
36
+        echo "browser.labels['".text::jsValue($english)."']=\"".text::jsValue($native)."\";";
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,9 +28,12 @@
 block discarded – undo
28 28
     die;
29 29
 }
30 30
 $mtime = @filemtime($file);
31
-if ($mtime) httpCache::checkMTime($mtime);
31
+if ($mtime) {
32
+    httpCache::checkMTime($mtime);
33
+}
32 34
 require $file;
33 35
 header("Content-Type: text/javascript; charset={$lang['_charset']}");
34
-foreach ($lang as $english => $native)
36
+foreach ($lang as $english => $native) {
35 37
     if (substr($english, 0, 1) != "_")
36 38
         echo "browser.labels['" . text::jsValue($english) . "']=\"" . text::jsValue($native) . "\";";
39
+}
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/js/browser/joiner.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Join all JavaScript files in current directory
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Join all JavaScript files in current directory
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 chdir(".."); // For compatibility
16 16
 chdir("..");
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,11 +23,13 @@
 block discarded – undo
23 23
 
24 24
 foreach ($files as $file) {
25 25
     $fmtime = filemtime($file);
26
-    if (!isset($mtime) || ($fmtime > $mtime))
27
-        $mtime = $fmtime;
28
-}
26
+    if (!isset($mtime) || ($fmtime > $mtime)) {
27
+            $mtime = $fmtime;
28
+    }
29
+    }
29 30
 
30 31
 httpCache::checkMTime($mtime);
31 32
 header("Content-Type: text/javascript");
32
-foreach ($files as $file)
33
+foreach ($files as $file) {
33 34
     require $file;
35
+}
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/browser.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@
 block discarded – undo
10 10
 			}
11 11
 		};
12 12
 <?php
13
-	if(isset($_GET['type']))     $type = htmlspecialchars(trim($_GET['type']), ENT_QUOTES);
14
-	elseif(isset($_GET['Type'])) $type = htmlspecialchars(trim($_GET['Type']), ENT_QUOTES);
13
+    if(isset($_GET['type']))     $type = htmlspecialchars(trim($_GET['type']), ENT_QUOTES);
14
+    elseif(isset($_GET['Type'])) $type = htmlspecialchars(trim($_GET['Type']), ENT_QUOTES);
15 15
     else                         $type = 'images';
16 16
     
17 17
     if($type==='image') $type = 'images';
18 18
     
19
-	$opener = (isset($_GET['editor'])) ? 'opener=' . htmlspecialchars(trim($_GET['editor']), ENT_QUOTES) : '';
20
-	$request_uri = "{$opener}&type={$type}";
19
+    $opener = (isset($_GET['editor'])) ? 'opener=' . htmlspecialchars(trim($_GET['editor']), ENT_QUOTES) : '';
20
+    $request_uri = "{$opener}&type={$type}";
21 21
 ?>
22 22
 		window.location.href = "browse.php?<?php echo $request_uri; ?>";
23 23
 	</script>
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
 			}
11 11
 		};
12 12
 <?php
13
-	if(isset($_GET['type']))     $type = htmlspecialchars(trim($_GET['type']), ENT_QUOTES);
14
-	elseif(isset($_GET['Type'])) $type = htmlspecialchars(trim($_GET['Type']), ENT_QUOTES);
13
+	if (isset($_GET['type']))     $type = htmlspecialchars(trim($_GET['type']), ENT_QUOTES);
14
+	elseif (isset($_GET['Type'])) $type = htmlspecialchars(trim($_GET['Type']), ENT_QUOTES);
15 15
     else                         $type = 'images';
16 16
     
17
-    if($type==='image') $type = 'images';
17
+    if ($type === 'image') $type = 'images';
18 18
     
19
-	$opener = (isset($_GET['editor'])) ? 'opener=' . htmlspecialchars(trim($_GET['editor']), ENT_QUOTES) : '';
19
+	$opener = (isset($_GET['editor'])) ? 'opener='.htmlspecialchars(trim($_GET['editor']), ENT_QUOTES) : '';
20 20
 	$request_uri = "{$opener}&type={$type}";
21 21
 ?>
22 22
 		window.location.href = "browse.php?<?php echo $request_uri; ?>";
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,11 +10,17 @@
 block discarded – undo
10 10
 			}
11 11
 		};
12 12
 <?php
13
-	if(isset($_GET['type']))     $type = htmlspecialchars(trim($_GET['type']), ENT_QUOTES);
14
-	elseif(isset($_GET['Type'])) $type = htmlspecialchars(trim($_GET['Type']), ENT_QUOTES);
15
-    else                         $type = 'images';
13
+	if(isset($_GET['type'])) {
14
+	    $type = htmlspecialchars(trim($_GET['type']), ENT_QUOTES);
15
+	} elseif(isset($_GET['Type'])) {
16
+	    $type = htmlspecialchars(trim($_GET['Type']), ENT_QUOTES);
17
+	} else {
18
+        $type = 'images';
19
+    }
16 20
     
17
-    if($type==='image') $type = 'images';
21
+    if($type==='image') {
22
+        $type = 'images';
23
+    }
18 24
     
19 25
 	$opener = (isset($_GET['editor'])) ? 'opener=' . htmlspecialchars(trim($_GET['editor']), ENT_QUOTES) : '';
20 26
 	$request_uri = "{$opener}&type={$type}";
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/helper_dir.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Directory helper class
6
-  *   @package KCFinder
7
-  *   @version 2.54
8
-  *    @author Pavel Tzonkov <[email protected]>
9
-  * @copyright 2010-2014 KCFinder Project
10
-  *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
-  *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
-  *      @link http://kcfinder.sunhater.com
13
-  */
4
+ *
5
+ *      @desc Directory helper class
6
+ *   @package KCFinder
7
+ *   @version 2.54
8
+ *    @author Pavel Tzonkov <[email protected]>
9
+ * @copyright 2010-2014 KCFinder Project
10
+ *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
11
+ *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
12
+ *      @link http://kcfinder.sunhater.com
13
+ */
14 14
 
15 15
 class dir {
16 16
 
17
-  /** Checks if the given directory is really writable. The standard PHP
18
-    * function is_writable() does not work properly on Windows servers
19
-    * @param string $dir
20
-    * @return bool */
17
+    /** Checks if the given directory is really writable. The standard PHP
18
+     * function is_writable() does not work properly on Windows servers
19
+     * @param string $dir
20
+     * @return bool */
21 21
 
22 22
     static function isWritable($dir) {
23 23
         $dir = path::normalize($dir);
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
         return true;
34 34
     }
35 35
 
36
-  /** Recursively delete the given directory. Returns TRUE on success.
37
-    * If $firstFailExit parameter is true (default), the method returns the
38
-    * path to the first failed file or directory which cannot be deleted.
39
-    * If $firstFailExit is false, the method returns an array with failed
40
-    * files and directories which cannot be deleted. The third parameter
41
-    * $failed is used for internal use only.
42
-    * @param string $dir
43
-    * @param bool $firstFailExit
44
-    * @param array $failed
45
-    * @return mixed */
36
+    /** Recursively delete the given directory. Returns TRUE on success.
37
+     * If $firstFailExit parameter is true (default), the method returns the
38
+     * path to the first failed file or directory which cannot be deleted.
39
+     * If $firstFailExit is false, the method returns an array with failed
40
+     * files and directories which cannot be deleted. The third parameter
41
+     * $failed is used for internal use only.
42
+     * @param string $dir
43
+     * @param bool $firstFailExit
44
+     * @param array $failed
45
+     * @return mixed */
46 46
 
47 47
     static function prune($dir, $firstFailExit=true, array $failed=null) {
48 48
         if ($failed === null) $failed = array();
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
         return count($failed) ? $failed : true;
82 82
     }
83 83
 
84
-  /** Get the content of the given directory. Returns an array with filenames
85
-    * or FALSE on failure
86
-    * @param string $dir
87
-    * @param array $options
88
-    * @return mixed */
84
+    /** Get the content of the given directory. Returns an array with filenames
85
+     * or FALSE on failure
86
+     * @param string $dir
87
+     * @param array $options
88
+     * @return mixed */
89 89
 
90 90
     static function content($dir, array $options=null) {
91 91
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,20 +12,20 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class dir {
15
+class dir{
16 16
 
17 17
   /** Checks if the given directory is really writable. The standard PHP
18 18
     * function is_writable() does not work properly on Windows servers
19 19
     * @param string $dir
20 20
     * @return bool */
21 21
 
22
-    static function isWritable($dir) {
22
+    static function isWritable($dir){
23 23
         $dir = path::normalize($dir);
24 24
         if (!is_dir($dir))
25 25
             return false;
26 26
         $i = 0;
27 27
         do {
28
-            $file = "$dir/is_writable_" . md5($i++);
28
+            $file = "$dir/is_writable_".md5($i++);
29 29
         } while (file_exists($file));
30 30
         if (!@touch($file))
31 31
             return false;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     * @param array $failed
45 45
     * @return mixed */
46 46
 
47
-    static function prune($dir, $firstFailExit=true, array $failed=null) {
47
+    static function prune($dir, $firstFailExit = true, array $failed = null){
48 48
         if ($failed === null) $failed = array();
49 49
         $files = self::content($dir);
50 50
         if ($files === false) {
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
     * @param array $options
88 88
     * @return mixed */
89 89
 
90
-    static function content($dir, array $options=null) {
90
+    static function content($dir, array $options = null){
91 91
 
92 92
         $defaultOptions = array(
93
-            'types' => "all",   // Allowed: "all" or possible return values
93
+            'types' => "all", // Allowed: "all" or possible return values
94 94
                                 // of filetype(), or an array with them
95
-            'addPath' => true,  // Whether to add directory path to filenames
95
+            'addPath' => true, // Whether to add directory path to filenames
96 96
             'pattern' => '/./', // Regular expression pattern for filename
97 97
             'followLinks' => true
98 98
         );
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         return $files;
146 146
     }
147 147
 
148
-    static function fileSort($a, $b) {
148
+    static function fileSort($a, $b){
149 149
         if (function_exists("mb_strtolower")) {
150 150
             $a = mb_strtolower($a);
151 151
             $b = mb_strtolower($b);
Please login to merge, or discard this patch.
Braces   +63 added lines, -39 removed lines patch added patch discarded remove patch
@@ -12,23 +12,27 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class dir {
15
+class dir
16
+{
16 17
 
17 18
   /** Checks if the given directory is really writable. The standard PHP
18 19
     * function is_writable() does not work properly on Windows servers
19 20
     * @param string $dir
20 21
     * @return bool */
21 22
 
22
-    static function isWritable($dir) {
23
+    static function isWritable($dir)
24
+    {
23 25
         $dir = path::normalize($dir);
24
-        if (!is_dir($dir))
25
-            return false;
26
+        if (!is_dir($dir)) {
27
+                    return false;
28
+        }
26 29
         $i = 0;
27 30
         do {
28 31
             $file = "$dir/is_writable_" . md5($i++);
29 32
         } while (file_exists($file));
30
-        if (!@touch($file))
31
-            return false;
33
+        if (!@touch($file)) {
34
+                    return false;
35
+        }
32 36
         unlink($file);
33 37
         return true;
34 38
     }
@@ -44,12 +48,16 @@  discard block
 block discarded – undo
44 48
     * @param array $failed
45 49
     * @return mixed */
46 50
 
47
-    static function prune($dir, $firstFailExit=true, array $failed=null) {
48
-        if ($failed === null) $failed = array();
51
+    static function prune($dir, $firstFailExit=true, array $failed=null)
52
+    {
53
+        if ($failed === null) {
54
+            $failed = array();
55
+        }
49 56
         $files = self::content($dir);
50 57
         if ($files === false) {
51
-            if ($firstFailExit)
52
-                return $dir;
58
+            if ($firstFailExit) {
59
+                            return $dir;
60
+            }
53 61
             $failed[] = $dir;
54 62
             return $failed;
55 63
         }
@@ -58,23 +66,27 @@  discard block
 block discarded – undo
58 66
             if (is_dir($file)) {
59 67
                 $failed_in = self::prune($file, $firstFailExit, $failed);
60 68
                 if ($failed_in !== true) {
61
-                    if ($firstFailExit)
62
-                        return $failed_in;
63
-                    if (is_array($failed_in))
64
-                        $failed = array_merge($failed, $failed_in);
65
-                    else
66
-                        $failed[] = $failed_in;
69
+                    if ($firstFailExit) {
70
+                                            return $failed_in;
71
+                    }
72
+                    if (is_array($failed_in)) {
73
+                                            $failed = array_merge($failed, $failed_in);
74
+                    } else {
75
+                                            $failed[] = $failed_in;
76
+                    }
67 77
                 }
68 78
             } elseif (!@unlink($file)) {
69
-                if ($firstFailExit)
70
-                    return $file;
79
+                if ($firstFailExit) {
80
+                                    return $file;
81
+                }
71 82
                 $failed[] = $file;
72 83
             }
73 84
         }
74 85
 
75 86
         if (!@rmdir($dir)) {
76
-            if ($firstFailExit)
77
-                return $dir;
87
+            if ($firstFailExit) {
88
+                            return $dir;
89
+            }
78 90
             $failed[] = $dir;
79 91
         }
80 92
 
@@ -87,7 +99,8 @@  discard block
 block discarded – undo
87 99
     * @param array $options
88 100
     * @return mixed */
89 101
 
90
-    static function content($dir, array $options=null) {
102
+    static function content($dir, array $options=null)
103
+    {
91 104
 
92 105
         $defaultOptions = array(
93 106
             'types' => "all",   // Allowed: "all" or possible return values
@@ -97,23 +110,28 @@  discard block
 block discarded – undo
97 110
             'followLinks' => true
98 111
         );
99 112
 
100
-        if (!is_dir($dir) || !is_readable($dir))
101
-            return false;
113
+        if (!is_dir($dir) || !is_readable($dir)) {
114
+                    return false;
115
+        }
102 116
 
103
-        if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN")
104
-            $dir = str_replace("\\", "/", $dir);
117
+        if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") {
118
+                    $dir = str_replace("\\", "/", $dir);
119
+        }
105 120
         $dir = rtrim($dir, "/");
106 121
 
107 122
         $dh = @opendir($dir);
108
-        if ($dh === false)
109
-            return false;
123
+        if ($dh === false) {
124
+                    return false;
125
+        }
110 126
 
111
-        if ($options === null)
112
-            $options = $defaultOptions;
127
+        if ($options === null) {
128
+                    $options = $defaultOptions;
129
+        }
113 130
 
114
-        foreach ($defaultOptions as $key => $val)
115
-            if (!isset($options[$key]))
131
+        foreach ($defaultOptions as $key => $val) {
132
+                    if (!isset($options[$key]))
116 133
                 $options[$key] = $val;
134
+        }
117 135
 
118 136
         $files = array();
119 137
         while (($file = @readdir($dh)) !== false) {
@@ -124,28 +142,32 @@  discard block
 block discarded – undo
124 142
                 do {
125 143
                     $ldir = dirname($lfile);
126 144
                     $lfile = @readlink($lfile);
127
-                    if (substr($lfile, 0, 1) != "/")
128
-                        $lfile = "$ldir/$lfile";
145
+                    if (substr($lfile, 0, 1) != "/") {
146
+                                            $lfile = "$ldir/$lfile";
147
+                    }
129 148
                     $type = filetype($lfile);
130 149
                 } while ($type == "link");
131 150
             }
132 151
 
133 152
             if ((($type === "dir") && (($file == ".") || ($file == ".."))) ||
134 153
                 !preg_match($options['pattern'], $file)
135
-            )
136
-                continue;
154
+            ) {
155
+                            continue;
156
+            }
137 157
 
138 158
             if (($options['types'] === "all") || ($type === $options['types']) ||
139 159
                 ((is_array($options['types'])) && in_array($type, $options['types']))
140
-            )
141
-                $files[] = $options['addPath'] ? "$dir/$file" : $file;
160
+            ) {
161
+                            $files[] = $options['addPath'] ? "$dir/$file" : $file;
162
+            }
142 163
         }
143 164
         closedir($dh);
144 165
         usort($files, array("dir", "fileSort"));
145 166
         return $files;
146 167
     }
147 168
 
148
-    static function fileSort($a, $b) {
169
+    static function fileSort($a, $b)
170
+    {
149 171
         if (function_exists("mb_strtolower")) {
150 172
             $a = mb_strtolower($a);
151 173
             $b = mb_strtolower($b);
@@ -153,7 +175,9 @@  discard block
 block discarded – undo
153 175
             $a = strtolower($a);
154 176
             $b = strtolower($b);
155 177
         }
156
-        if ($a == $b) return 0;
178
+        if ($a == $b) {
179
+            return 0;
180
+        }
157 181
         return ($a < $b) ? -1 : 1;
158 182
     }
159 183
 }
Please login to merge, or discard this patch.