Completed
Pull Request — develop (#518)
by Agel_Nash
05:20
created
manager/media/browser/mcpuk/lib/helper_dir.php 1 patch
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.
manager/media/browser/mcpuk/lib/class_image_imagick.php 1 patch
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 ImageMagick image driver 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 ImageMagick image driver 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 image_imagick extends image {
16 16
 
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_input.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Input class for GET, POST and COOKIE requests
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 Input class for GET, POST and COOKIE requests
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 input {
16 16
 
17
-  /** Filtered $_GET array
18
-    * @var array */
17
+    /** Filtered $_GET array
18
+     * @var array */
19 19
     public $get;
20 20
 
21
-  /** Filtered $_POST array
22
-    * @var array */
21
+    /** Filtered $_POST array
22
+     * @var array */
23 23
     public $post;
24 24
 
25
-  /** Filtered $_COOKIE array
26
-    * @var array */
25
+    /** Filtered $_COOKIE array
26
+     * @var array */
27 27
     public $cookie;
28 28
 
29 29
     public function __construct() {
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
         $this->cookie = &$_COOKIE;
33 33
     }
34 34
 
35
-  /** Magic method to get non-public properties like public.
36
-    * @param string $property
37
-    * @return mixed */
35
+    /** Magic method to get non-public properties like public.
36
+     * @param string $property
37
+     * @return mixed */
38 38
 
39 39
     public function __get($property) {
40 40
         return property_exists($this, $property) ? $this->$property : null;
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/helper_path.php 1 patch
Indentation   +31 added lines, -31 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 Path 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 Path 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 path {
16 16
 
17
-  /** Get the absolute URL path of the given one. Returns FALSE if the URL
18
-    * is not valid or the current directory cannot be resolved (getcwd())
19
-    * @param string $path
20
-    * @return string */
17
+    /** Get the absolute URL path of the given one. Returns FALSE if the URL
18
+     * is not valid or the current directory cannot be resolved (getcwd())
19
+     * @param string $path
20
+     * @return string */
21 21
 
22 22
     static function rel2abs_url($path) {
23 23
         if (substr($path, 0, 1) == "/") return $path;
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
         return $return;
40 40
     }
41 41
 
42
-  /** Resolve full filesystem path of given URL. Returns FALSE if the URL
43
-    * cannot be resolved
44
-    * @param string $url
45
-    * @return string */
42
+    /** Resolve full filesystem path of given URL. Returns FALSE if the URL
43
+     * cannot be resolved
44
+     * @param string $url
45
+     * @return string */
46 46
 
47 47
     static function url2fullPath($url) {
48 48
         $url = self::normalize($url);
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
         }
85 85
     }
86 86
 
87
-  /** Normalize the given path. On Windows servers backslash will be replaced
88
-    * with slash. Remobes unnecessary doble slashes and double dots. Removes
89
-    * last slash if it exists. Examples:
90
-    * path::normalize("C:\\any\\path\\") returns "C:/any/path"
91
-    * path::normalize("/your/path/..//home/") returns "/your/home"
92
-    * @param string $path
93
-    * @return string */
87
+    /** Normalize the given path. On Windows servers backslash will be replaced
88
+     * with slash. Remobes unnecessary doble slashes and double dots. Removes
89
+     * last slash if it exists. Examples:
90
+     * path::normalize("C:\\any\\path\\") returns "C:/any/path"
91
+     * path::normalize("/your/path/..//home/") returns "/your/home"
92
+     * @param string $path
93
+     * @return string */
94 94
 
95 95
     static function normalize($path) {
96 96
         if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") {
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
         return $path;
115 115
     }
116 116
 
117
-  /** Encode URL Path
118
-    * @param string $path
119
-    * @return string */
117
+    /** Encode URL Path
118
+     * @param string $path
119
+     * @return string */
120 120
 
121 121
     static function urlPathEncode($path) {
122 122
         $path = self::normalize($path);
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
         return $encoded;
128 128
     }
129 129
 
130
-  /** Decode URL Path
131
-    * @param string $path
132
-    * @return string */
130
+    /** Decode URL Path
131
+     * @param string $path
132
+     * @return string */
133 133
 
134 134
     static function urlPathDecode($path) {
135 135
         $path = self::normalize($path);
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/helper_file.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc File 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 File 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 file {
16 16
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
         'zip'   => 'application/x-zip'
101 101
     );
102 102
 
103
-  /** Checks if the given file is really writable. The standard PHP function
104
-    * is_writable() does not work properly on Windows servers.
105
-    * @param string $dir
106
-    * @return bool */
103
+    /** Checks if the given file is really writable. The standard PHP function
104
+     * is_writable() does not work properly on Windows servers.
105
+     * @param string $dir
106
+     * @return bool */
107 107
 
108 108
     static function isWritable($filename) {
109 109
         $filename = path::normalize($filename);
@@ -113,26 +113,26 @@  discard block
 block discarded – undo
113 113
         return true;
114 114
     }
115 115
 
116
-  /** Get the extension from filename
117
-    * @param string $file
118
-    * @param bool $toLower
119
-    * @return string */
116
+    /** Get the extension from filename
117
+     * @param string $file
118
+     * @param bool $toLower
119
+     * @return string */
120 120
 
121 121
     static function getExtension($filename, $toLower=true) {
122 122
         return preg_match('/^.*\.([^\.]*)$/s', $filename, $patt)
123 123
             ? ($toLower ? strtolower($patt[1]) : $patt[1]) : "";
124 124
     }
125 125
 
126
-  /** Get MIME type of the given filename. If Fileinfo PHP extension is
127
-    * available the MIME type will be fetched by the file's content. The
128
-    * second parameter is optional and defines the magic file path. If you
129
-    * skip it, the default one will be loaded.
130
-    * If Fileinfo PHP extension is not available the MIME type will be fetched
131
-    * by filename extension regarding $MIME property. If the file extension
132
-    * does not exist there, returned type will be application/octet-stream
133
-    * @param string $filename
134
-    * @param string $magic
135
-    * @return string */
126
+    /** Get MIME type of the given filename. If Fileinfo PHP extension is
127
+     * available the MIME type will be fetched by the file's content. The
128
+     * second parameter is optional and defines the magic file path. If you
129
+     * skip it, the default one will be loaded.
130
+     * If Fileinfo PHP extension is not available the MIME type will be fetched
131
+     * by filename extension regarding $MIME property. If the file extension
132
+     * does not exist there, returned type will be application/octet-stream
133
+     * @param string $filename
134
+     * @param string $magic
135
+     * @return string */
136 136
 
137 137
     static function getMimeType($filename, $magic=null) {
138 138
         if (class_exists("finfo")) {
@@ -149,26 +149,26 @@  discard block
 block discarded – undo
149 149
         return isset(self::$MIME[$ext]) ? self::$MIME[$ext] : "application/octet-stream";
150 150
     }
151 151
 
152
-  /** Get inexistant filename based on the given filename. If you skip $dir
153
-    * parameter the directory will be fetched from $filename and returned
154
-    * value will be full filename path. The third parameter is optional and
155
-    * defines the template, the filename will be renamed to. Default template
156
-    * is {name}({sufix}){ext}. Examples:
157
-    *
158
-    *   file::getInexistantFilename("/my/directory/myfile.txt");
159
-    *   If myfile.txt does not exist - returns the same path to the file
160
-    *   otherwise returns "/my/directory/myfile(1).txt"
161
-    *
162
-    *   file::getInexistantFilename("myfile.txt", "/my/directory");
163
-    *   returns "myfile.txt" or "myfile(1).txt" or "myfile(2).txt" etc...
164
-    *
165
-    *   file::getInexistantFilename("myfile.txt", "/dir", "{name}[{sufix}]{ext}");
166
-    *   returns "myfile.txt" or "myfile[1].txt" or "myfile[2].txt" etc...
167
-    *
168
-    * @param string $filename
169
-    * @param string $dir
170
-    * @param string $tpl
171
-    * @return string */
152
+    /** Get inexistant filename based on the given filename. If you skip $dir
153
+     * parameter the directory will be fetched from $filename and returned
154
+     * value will be full filename path. The third parameter is optional and
155
+     * defines the template, the filename will be renamed to. Default template
156
+     * is {name}({sufix}){ext}. Examples:
157
+     *
158
+     *   file::getInexistantFilename("/my/directory/myfile.txt");
159
+     *   If myfile.txt does not exist - returns the same path to the file
160
+     *   otherwise returns "/my/directory/myfile(1).txt"
161
+     *
162
+     *   file::getInexistantFilename("myfile.txt", "/my/directory");
163
+     *   returns "myfile.txt" or "myfile(1).txt" or "myfile(2).txt" etc...
164
+     *
165
+     *   file::getInexistantFilename("myfile.txt", "/dir", "{name}[{sufix}]{ext}");
166
+     *   returns "myfile.txt" or "myfile[1].txt" or "myfile[2].txt" etc...
167
+     *
168
+     * @param string $filename
169
+     * @param string $dir
170
+     * @param string $tpl
171
+     * @return string */
172 172
 
173 173
     static function getInexistantFilename($filename, $dir=null, $tpl=null) {
174 174
         if ($tpl === null)  $tpl = "{name}({sufix}){ext}";
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_image.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc Abstract image driver 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 Abstract image driver 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
 abstract class image {
16 16
     const DEFAULT_JPEG_QUALITY = 75;
17 17
 
18 18
 /** Image resource or object
19
-  * @var mixed */
19
+ * @var mixed */
20 20
     protected $image;
21 21
 
22 22
 /** Image width in pixels
23
-  * @var integer */
23
+ * @var integer */
24 24
     protected $width;
25 25
 
26 26
 /** Image height in pixels
27
-  * @var integer */
27
+ * @var integer */
28 28
     protected $height;
29 29
 
30 30
 /** Init error
31
-  * @var bool */
31
+ * @var bool */
32 32
     protected $initError = false;
33 33
 
34 34
 /** Driver specific options
35
-  * @var array */
35
+ * @var array */
36 36
     protected $options = array();
37 37
 
38 38
 
39 39
 /** Magic method which allows read-only access to all protected or private
40
-  * class properties
41
-  * @param string $property
42
-  * @return mixed */
40
+ * class properties
41
+ * @param string $property
42
+ * @return mixed */
43 43
 
44 44
     final public function __get($property) {
45 45
         return property_exists($this, $property) ? $this->$property : null;
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 
48 48
 
49 49
 /** Constructor. Parameter $image should be:
50
-  *   1. An instance of image driver class (copy instance).
51
-  *   2. An image represented by the type of the $image property
52
-  *      (resource or object).
53
-  *   3. An array with two elements. First - width, second - height.
54
-  *      Creates a blank image.
55
-  *   4. A filename string. Get image form file.
56
-  * Second paramaeter is used by pass some specific image driver options
57
-  * @param mixed $image
58
-  * @param array $options */
50
+ *   1. An instance of image driver class (copy instance).
51
+ *   2. An image represented by the type of the $image property
52
+ *      (resource or object).
53
+ *   3. An array with two elements. First - width, second - height.
54
+ *      Creates a blank image.
55
+ *   4. A filename string. Get image form file.
56
+ * Second paramaeter is used by pass some specific image driver options
57
+ * @param mixed $image
58
+ * @param array $options */
59 59
 
60 60
     public function __construct($image, array $options=array()) {
61 61
         $this->image = $this->width = $this->height = null;
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 
71 71
 
72 72
 /** Factory pattern to load selected driver. $image and $options are passed
73
-  * to the constructor of the image driver
74
-  * @param string $driver
75
-  * @param mixed $image
76
-  * @return object */
73
+ * to the constructor of the image driver
74
+ * @param string $driver
75
+ * @param mixed $image
76
+ * @return object */
77 77
 
78 78
     final static function factory($driver, $image, array $options=array()) {
79 79
         $class = "image_$driver";
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 
84 84
 /** Checks if the drivers in the array parameter could be used. Returns first
85
-  * found one
86
-  * @param array $drivers
87
-  * @return string */
85
+ * found one
86
+ * @param array $drivers
87
+ * @return string */
88 88
 
89 89
     final static function getDriver(array $drivers=array('gd')) {
90 90
         foreach ($drivers as $driver) {
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 
102 102
 
103 103
 /** Returns an array. Element 0 - image resource. Element 1 - width. Element 2 - height.
104
-  * Returns FALSE on failure.
105
-  * @param mixed $image
106
-  * @return array */
104
+ * Returns FALSE on failure.
105
+ * @param mixed $image
106
+ * @return array */
107 107
 
108 108
     final protected function buildImage($image) {
109 109
         $class = get_class($this);
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 
129 129
 
130 130
 /** Returns calculated proportional width from the given height
131
-  * @param integer $resizedHeight
132
-  * @return integer */
131
+ * @param integer $resizedHeight
132
+ * @return integer */
133 133
 
134 134
     final public function getPropWidth($resizedHeight) {
135 135
         $width = round(($this->width * $resizedHeight) / $this->height);
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 
140 140
 
141 141
 /** Returns calculated proportional height from the given width
142
-  * @param integer $resizedWidth
143
-  * @return integer */
142
+ * @param integer $resizedWidth
143
+ * @return integer */
144 144
 
145 145
     final public function getPropHeight($resizedWidth) {
146 146
         $height = round(($this->height * $resizedWidth) / $this->width);
@@ -150,45 +150,45 @@  discard block
 block discarded – undo
150 150
 
151 151
 
152 152
 /** Checks if PHP needs some extra extensions to use the image driver. This
153
-  * static method should be implemented into driver classes like abstract
154
-  * methods
155
-  * @return bool */
153
+ * static method should be implemented into driver classes like abstract
154
+ * methods
155
+ * @return bool */
156 156
     static function available() { return false; }
157 157
 
158 158
 /** Checks if file is an image. This static method should be implemented into
159
-  * driver classes like abstract methods
160
-  * @param string $file
161
-  * @return bool */
159
+ * driver classes like abstract methods
160
+ * @param string $file
161
+ * @return bool */
162 162
     static function checkImage($file) { return false; }
163 163
 
164 164
 /** Resize image. Should return TRUE on success or FALSE on failure
165
-  * @param integer $width
166
-  * @param integer $height
167
-  * @return bool */
165
+ * @param integer $width
166
+ * @param integer $height
167
+ * @return bool */
168 168
     abstract public function resize($width, $height);
169 169
 
170 170
 /** Resize image to fit in given resolution. Should returns TRUE on success
171
-  * or FALSE on failure. If $background is set, the image size will be
172
-  * $width x $height and the empty spaces (if any) will be filled with defined
173
-  * color. Background color examples: "#5f5", "#ff67ca", array(255, 255, 255)
174
-  * @param integer $width
175
-  * @param integer $height
176
-  * @param mixed $background
177
-  * @return bool */
171
+ * or FALSE on failure. If $background is set, the image size will be
172
+ * $width x $height and the empty spaces (if any) will be filled with defined
173
+ * color. Background color examples: "#5f5", "#ff67ca", array(255, 255, 255)
174
+ * @param integer $width
175
+ * @param integer $height
176
+ * @param mixed $background
177
+ * @return bool */
178 178
     abstract public function resizeFit($width, $height, $background=false);
179 179
 
180 180
 /** Resize and crop the image to fit in given resolution. Returns TRUE on
181
-  * success or FALSE on failure
182
-  * @param mixed $src
183
-  * @param integer $offset
184
-  * @return bool */
181
+ * success or FALSE on failure
182
+ * @param mixed $src
183
+ * @param integer $offset
184
+ * @return bool */
185 185
     abstract public function resizeCrop($width, $height, $offset=false);
186 186
 
187 187
 
188 188
 /** Rotate image
189
-  * @param integer $angle
190
-  * @param string $background
191
-  * @return bool */
189
+ * @param integer $angle
190
+ * @param string $background
191
+ * @return bool */
192 192
     abstract public function rotate($angle, $background="#000000");
193 193
 
194 194
     abstract public function flipHorizontal();
@@ -196,44 +196,44 @@  discard block
 block discarded – undo
196 196
     abstract public function flipVertical();
197 197
 
198 198
 /** Apply a PNG or GIF watermark to the image. $top and $left parameters sets
199
-  * the offset of the watermark in pixels. Boolean and NULL values are possible
200
-  * too. In default case (FALSE, FALSE) the watermark should be applyed to
201
-  * the bottom right corner. NULL values means center aligning. If the
202
-  * watermark is bigger than the image or it's partialy or fully outside the
203
-  * image, it shoudn't be applied
204
-  * @param string $file
205
-  * @param mixed $top
206
-  * @param mixed $left
207
-  * @return bool */
199
+ * the offset of the watermark in pixels. Boolean and NULL values are possible
200
+ * too. In default case (FALSE, FALSE) the watermark should be applyed to
201
+ * the bottom right corner. NULL values means center aligning. If the
202
+ * watermark is bigger than the image or it's partialy or fully outside the
203
+ * image, it shoudn't be applied
204
+ * @param string $file
205
+ * @param mixed $top
206
+ * @param mixed $left
207
+ * @return bool */
208 208
     abstract public function watermark($file, $left=false, $top=false);
209 209
 
210 210
 /** Should output the image. Second parameter is used to pass some options like
211
-  *   'file' - if is set, the output will be written to a file
212
-  *   'quality' - compression quality
213
-  * It's possible to use extra specific options required by image type ($type)
214
-  * @param string $type
215
-  * @param array $options
216
-  * @return bool */
211
+ *   'file' - if is set, the output will be written to a file
212
+ *   'quality' - compression quality
213
+ * It's possible to use extra specific options required by image type ($type)
214
+ * @param string $type
215
+ * @param array $options
216
+ * @return bool */
217 217
     abstract public function output($type='jpeg', array $options=array());
218 218
 
219 219
 /** This method should create a blank image with selected size. Should returns
220
-  * resource or object related to the created image, which will be passed to
221
-  * $image property
222
-  * @param integer $width
223
-  * @param integer $height
224
-  * @return mixed */
220
+ * resource or object related to the created image, which will be passed to
221
+ * $image property
222
+ * @param integer $width
223
+ * @param integer $height
224
+ * @return mixed */
225 225
     abstract protected function getBlankImage($width, $height);
226 226
 
227 227
 /** This method should create an image from source image. Only first parameter
228
-  * ($image) is input. Its type should be filename string or a type of the
229
-  * $image property. See the constructor reference for details. The
230
-  * parametters $width and $height are output only. Should returns resource or
231
-  * object related to the created image, which will be passed to $image
232
-  * property
233
-  * @param mixed $image
234
-  * @param integer $width
235
-  * @param integer $height
236
-  * @return mixed */
228
+ * ($image) is input. Its type should be filename string or a type of the
229
+ * $image property. See the constructor reference for details. The
230
+ * parametters $width and $height are output only. Should returns resource or
231
+ * object related to the created image, which will be passed to $image
232
+ * property
233
+ * @param mixed $image
234
+ * @param integer $width
235
+ * @param integer $height
236
+ * @return mixed */
237 237
     abstract protected function getImage($image, &$width, &$height);
238 238
 
239 239
 }
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_fastImage.php 1 patch
Indentation   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -13,228 +13,228 @@
 block discarded – undo
13 13
 
14 14
 class fastImage
15 15
 {
16
-	private $strpos = 0;
17
-	private $str;
18
-	private $uri;
19
-	private $type;
20
-	private $handle;
16
+    private $strpos = 0;
17
+    private $str;
18
+    private $uri;
19
+    private $type;
20
+    private $handle;
21 21
 
22
-	public function __construct($uri = null)
23
-	{
24
-		if ($uri) $this->load($uri);
25
-	}
22
+    public function __construct($uri = null)
23
+    {
24
+        if ($uri) $this->load($uri);
25
+    }
26 26
 
27 27
 
28
-	public function load($uri)
29
-	{
30
-		if ($this->handle) $this->close();
28
+    public function load($uri)
29
+    {
30
+        if ($this->handle) $this->close();
31 31
 
32
-		$this->uri = $uri;
33
-		$this->handle = fopen($uri, 'r');
34
-	}
35
-
36
-
37
-	public function close()
38
-	{
39
-		if (is_resource($this->handle)) fclose($this->handle);
40
-	}
41
-
42
-
43
-	public function getSize()
44
-	{
45
-		$this->strpos = 0;
46
-		if ($this->getType())
47
-		{
48
-			return array_values($this->parseSize());
49
-		}
50
-
51
-		return false;
52
-	}
53
-
54
-
55
-	public function getType()
56
-	{
57
-		$this->strpos = 0;
58
-
59
-		if (!$this->type)
60
-		{
61
-			switch ($this->getChars(2))
62
-			{
63
-				case "BM":
64
-					return $this->type = 'bmp';
65
-				case "GI":
66
-					return $this->type = 'gif';
67
-				case chr(0xFF).chr(0xd8):
68
-					return $this->type = 'jpeg';
69
-				case chr(0x89).'P':
70
-					return $this->type = 'png';
71
-				default:
72
-					return false;
73
-			}
74
-		}
75
-
76
-		return $this->type;
77
-	}
78
-
79
-
80
-	private function parseSize()
81
-	{
82
-		$this->strpos = 0;
83
-
84
-		switch ($this->type)
85
-		{
86
-			case 'png':
87
-				return $this->parseSizeForPNG();
88
-			case 'gif':
89
-				return $this->parseSizeForGIF();
90
-			case 'bmp':
91
-				return $this->parseSizeForBMP();
92
-			case 'jpeg':
93
-				return $this->parseSizeForJPEG();
94
-		}
95
-
96
-		return null;
97
-	}
98
-
99
-
100
-	private function parseSizeForPNG()
101
-	{
102
-		$chars = $this->getChars(25);
103
-
104
-		return unpack("N*", substr($chars, 16, 8));
105
-	}
106
-
107
-
108
-	private function parseSizeForGIF()
109
-	{
110
-		$chars = $this->getChars(11);
111
-
112
-		return unpack("S*", substr($chars, 6, 4));
113
-	}
114
-
115
-
116
-	private function parseSizeForBMP()
117
-	{
118
-		$chars = $this->getChars(29);
119
-	 	$chars = substr($chars, 14, 14);
120
-		$type = unpack('C', $chars);
121
-
122
-		return (reset($type) == 40) ? unpack('L*', substr($chars, 4)) : unpack('L*', substr($chars, 4, 8));
123
-	}
124
-
125
-
126
-	private function parseSizeForJPEG()
127
-	{
128
-		$state = null;
129
-		$i = 0;
130
-
131
-		while (true)
132
-		{
133
-			switch ($state)
134
-			{
135
-				default:
136
-					$this->getChars(2);
137
-					$state = 'started';
138
-					break;
139
-
140
-				case 'started':
141
-					$b = $this->getByte();
142
-					if ($b === false) return false;
143
-
144
-					$state = $b == 0xFF ? 'sof' : 'started';
145
-					break;
146
-
147
-				case 'sof':
148
-					$b = $this->getByte();
149
-					if (in_array($b, range(0xe0, 0xef)))
150
-					{
151
-						$state = 'skipframe';
152
-					}
153
-					elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF))))
154
-					{
155
-						$state = 'readsize';
156
-					}
157
-					elseif ($b == 0xFF)
158
-					{
159
-						$state = 'sof';
160
-					}
161
-					else
162
-					{
163
-						$state = 'skipframe';
164
-					}
165
-					break;
166
-
167
-				case 'skipframe':
168
-					$skip = $this->readInt($this->getChars(2)) - 2;
169
-					$state = 'doskip';
170
-					break;
171
-
172
-				case 'doskip':
173
-					$this->getChars($skip);
174
-					$state = 'started';
175
-					break;
176
-
177
-				case 'readsize':
178
-					$c = $this->getChars(7);
179
-
180
-					return array($this->readInt(substr($c, 5, 2)), $this->readInt(substr($c, 3, 2)));
181
-			}
182
-		}
183
-	}
184
-
185
-
186
-	private function getChars($n)
187
-	{
188
-		$response = null;
189
-
190
-		// do we need more data?
191
-		if ($this->strpos + $n -1 >= strlen($this->str))
192
-		{
193
-			$end = ($this->strpos + $n);
194
-
195
-			while (strlen($this->str) < $end && $response !== false)
196
-			{
197
-				// read more from the file handle
198
-				$need = $end - ftell($this->handle);
199
-
200
-				if ($response = fread($this->handle, $need))
201
-				{
202
-					$this->str .= $response;
203
-				}
204
-				else
205
-				{
206
-					return false;
207
-				}
208
-			}
209
-		}
210
-
211
-		$result = substr($this->str, $this->strpos, $n);
212
-		$this->strpos += $n;
213
-
214
-		// we are dealing with bytes here, so force the encoding
215
-		return mb_convert_encoding($result, "8BIT");
216
-	}
217
-
218
-
219
-	private function getByte()
220
-	{
221
-		$c = $this->getChars(1);
222
-		$b = unpack("C", $c);
223
-
224
-		return reset($b);
225
-	}
226
-
227
-
228
-	private function readInt($str)
229
-	{
230
-		$size = unpack("C*", $str);
231
-
232
-	    	return ($size[1] << 8) + $size[2];
233
-	}
234
-
235
-
236
-	public function __destruct()
237
-	{
238
-		$this->close();
239
-	}
32
+        $this->uri = $uri;
33
+        $this->handle = fopen($uri, 'r');
34
+    }
35
+
36
+
37
+    public function close()
38
+    {
39
+        if (is_resource($this->handle)) fclose($this->handle);
40
+    }
41
+
42
+
43
+    public function getSize()
44
+    {
45
+        $this->strpos = 0;
46
+        if ($this->getType())
47
+        {
48
+            return array_values($this->parseSize());
49
+        }
50
+
51
+        return false;
52
+    }
53
+
54
+
55
+    public function getType()
56
+    {
57
+        $this->strpos = 0;
58
+
59
+        if (!$this->type)
60
+        {
61
+            switch ($this->getChars(2))
62
+            {
63
+                case "BM":
64
+                    return $this->type = 'bmp';
65
+                case "GI":
66
+                    return $this->type = 'gif';
67
+                case chr(0xFF).chr(0xd8):
68
+                    return $this->type = 'jpeg';
69
+                case chr(0x89).'P':
70
+                    return $this->type = 'png';
71
+                default:
72
+                    return false;
73
+            }
74
+        }
75
+
76
+        return $this->type;
77
+    }
78
+
79
+
80
+    private function parseSize()
81
+    {
82
+        $this->strpos = 0;
83
+
84
+        switch ($this->type)
85
+        {
86
+            case 'png':
87
+                return $this->parseSizeForPNG();
88
+            case 'gif':
89
+                return $this->parseSizeForGIF();
90
+            case 'bmp':
91
+                return $this->parseSizeForBMP();
92
+            case 'jpeg':
93
+                return $this->parseSizeForJPEG();
94
+        }
95
+
96
+        return null;
97
+    }
98
+
99
+
100
+    private function parseSizeForPNG()
101
+    {
102
+        $chars = $this->getChars(25);
103
+
104
+        return unpack("N*", substr($chars, 16, 8));
105
+    }
106
+
107
+
108
+    private function parseSizeForGIF()
109
+    {
110
+        $chars = $this->getChars(11);
111
+
112
+        return unpack("S*", substr($chars, 6, 4));
113
+    }
114
+
115
+
116
+    private function parseSizeForBMP()
117
+    {
118
+        $chars = $this->getChars(29);
119
+            $chars = substr($chars, 14, 14);
120
+        $type = unpack('C', $chars);
121
+
122
+        return (reset($type) == 40) ? unpack('L*', substr($chars, 4)) : unpack('L*', substr($chars, 4, 8));
123
+    }
124
+
125
+
126
+    private function parseSizeForJPEG()
127
+    {
128
+        $state = null;
129
+        $i = 0;
130
+
131
+        while (true)
132
+        {
133
+            switch ($state)
134
+            {
135
+                default:
136
+                    $this->getChars(2);
137
+                    $state = 'started';
138
+                    break;
139
+
140
+                case 'started':
141
+                    $b = $this->getByte();
142
+                    if ($b === false) return false;
143
+
144
+                    $state = $b == 0xFF ? 'sof' : 'started';
145
+                    break;
146
+
147
+                case 'sof':
148
+                    $b = $this->getByte();
149
+                    if (in_array($b, range(0xe0, 0xef)))
150
+                    {
151
+                        $state = 'skipframe';
152
+                    }
153
+                    elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF))))
154
+                    {
155
+                        $state = 'readsize';
156
+                    }
157
+                    elseif ($b == 0xFF)
158
+                    {
159
+                        $state = 'sof';
160
+                    }
161
+                    else
162
+                    {
163
+                        $state = 'skipframe';
164
+                    }
165
+                    break;
166
+
167
+                case 'skipframe':
168
+                    $skip = $this->readInt($this->getChars(2)) - 2;
169
+                    $state = 'doskip';
170
+                    break;
171
+
172
+                case 'doskip':
173
+                    $this->getChars($skip);
174
+                    $state = 'started';
175
+                    break;
176
+
177
+                case 'readsize':
178
+                    $c = $this->getChars(7);
179
+
180
+                    return array($this->readInt(substr($c, 5, 2)), $this->readInt(substr($c, 3, 2)));
181
+            }
182
+        }
183
+    }
184
+
185
+
186
+    private function getChars($n)
187
+    {
188
+        $response = null;
189
+
190
+        // do we need more data?
191
+        if ($this->strpos + $n -1 >= strlen($this->str))
192
+        {
193
+            $end = ($this->strpos + $n);
194
+
195
+            while (strlen($this->str) < $end && $response !== false)
196
+            {
197
+                // read more from the file handle
198
+                $need = $end - ftell($this->handle);
199
+
200
+                if ($response = fread($this->handle, $need))
201
+                {
202
+                    $this->str .= $response;
203
+                }
204
+                else
205
+                {
206
+                    return false;
207
+                }
208
+            }
209
+        }
210
+
211
+        $result = substr($this->str, $this->strpos, $n);
212
+        $this->strpos += $n;
213
+
214
+        // we are dealing with bytes here, so force the encoding
215
+        return mb_convert_encoding($result, "8BIT");
216
+    }
217
+
218
+
219
+    private function getByte()
220
+    {
221
+        $c = $this->getChars(1);
222
+        $b = unpack("C", $c);
223
+
224
+        return reset($b);
225
+    }
226
+
227
+
228
+    private function readInt($str)
229
+    {
230
+        $size = unpack("C*", $str);
231
+
232
+            return ($size[1] << 8) + $size[2];
233
+    }
234
+
235
+
236
+    public function __destruct()
237
+    {
238
+        $this->close();
239
+    }
240 240
 }
241 241
\ No newline at end of file
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/helper_httpCache.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /** This file is part of KCFinder project
4
-  *
5
-  *      @desc HTTP cache 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 HTTP cache 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 httpCache {
16 16
     const DEFAULT_TYPE = "text/html";
17 17
     const DEFAULT_EXPIRE = 604800; // in seconds
18 18
 
19
-  /** Cache a file. The $type parameter might define the MIME type of the file
20
-    * or path to magic file to autodetect the MIME type. If you skip $type
21
-    * parameter the method will try with the default magic file. Autodetection
22
-    * of MIME type requires Fileinfo PHP extension used in file::getMimeType()
23
-    * @param string $file
24
-    * @param string $type
25
-    * @param integer $expire
26
-    * @param array $headers */
19
+    /** Cache a file. The $type parameter might define the MIME type of the file
20
+     * or path to magic file to autodetect the MIME type. If you skip $type
21
+     * parameter the method will try with the default magic file. Autodetection
22
+     * of MIME type requires Fileinfo PHP extension used in file::getMimeType()
23
+     * @param string $file
24
+     * @param string $type
25
+     * @param integer $expire
26
+     * @param array $headers */
27 27
 
28 28
     static function file($file, $type=null, $expire=null, array $headers=null) {
29 29
         $mtime = @filemtime($file);
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
         self::content(@file_get_contents($file), $mtime, $type, $expire, $headers, false);
40 40
     }
41 41
 
42
-  /** Cache the given $content with $mtime modification time.
43
-    * @param binary $content
44
-    * @param integer $mtime
45
-    * @param string $type
46
-    * @param integer $expire
47
-    * @param array $headers
48
-    * @param bool $checkMTime */
42
+    /** Cache the given $content with $mtime modification time.
43
+     * @param binary $content
44
+     * @param integer $mtime
45
+     * @param string $type
46
+     * @param integer $expire
47
+     * @param array $headers
48
+     * @param bool $checkMTime */
49 49
 
50 50
     static function content($content, $mtime, $type=null, $expire=null, array $headers=null, $checkMTime=true) {
51 51
         if ($checkMTime) self::checkMTime($mtime);
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
         echo $content;
63 63
     }
64 64
 
65
-  /** Check if given modification time is newer than client-side one. If not,
66
-    * the method will tell the client to get the content from its own cache.
67
-    * Afterwards the script process will be terminated. This feature requires
68
-    * the PHP to be configured as Apache module.
69
-    * @param integer $mtime */
65
+    /** Check if given modification time is newer than client-side one. If not,
66
+     * the method will tell the client to get the content from its own cache.
67
+     * Afterwards the script process will be terminated. This feature requires
68
+     * the PHP to be configured as Apache module.
69
+     * @param integer $mtime */
70 70
 
71 71
     static function checkMTime($mtime, $sendHeaders=null) {
72 72
         header("Last-Modified: " . gmdate("D, d M Y H:i:s", $mtime) . " GMT");
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_image_gd.php 1 patch
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 GD image driver 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 GD image driver 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 image_gd extends image {
16 16
 
Please login to merge, or discard this patch.