@@ -12,20 +12,20 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class input { |
|
15 | +class input{ |
|
16 | 16 | |
17 | 17 | /** Filtered $_GET array |
18 | 18 | * @var array */ |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @var array */ |
27 | 27 | public $cookie; |
28 | 28 | |
29 | - public function __construct() { |
|
29 | + public function __construct(){ |
|
30 | 30 | $this->get = &$_GET; |
31 | 31 | $this->post = &$_POST; |
32 | 32 | $this->cookie = &$_COOKIE; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param string $property |
37 | 37 | * @return mixed */ |
38 | 38 | |
39 | - public function __get($property) { |
|
39 | + public function __get($property){ |
|
40 | 40 | return property_exists($this, $property) ? $this->$property : null; |
41 | 41 | } |
42 | 42 | } |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class path { |
|
15 | +class path{ |
|
16 | 16 | |
17 | 17 | /** Get the absolute URL path of the given one. Returns FALSE if the URL |
18 | 18 | * is not valid or the current directory cannot be resolved (getcwd()) |
19 | 19 | * @param string $path |
20 | 20 | * @return string */ |
21 | 21 | |
22 | - static function rel2abs_url($path) { |
|
22 | + static function rel2abs_url($path){ |
|
23 | 23 | if (substr($path, 0, 1) == "/") return $path; |
24 | 24 | $dir = @getcwd(); |
25 | 25 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if (substr($dir, 0, strlen($doc_root)) != $doc_root) |
33 | 33 | return false; |
34 | 34 | |
35 | - $return = self::normalize(substr($dir, strlen($doc_root)) . "/$path"); |
|
35 | + $return = self::normalize(substr($dir, strlen($doc_root))."/$path"); |
|
36 | 36 | if (substr($return, 0, 1) !== "/") |
37 | 37 | $return = "/$return"; |
38 | 38 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $url |
45 | 45 | * @return string */ |
46 | 46 | |
47 | - static function url2fullPath($url) { |
|
47 | + static function url2fullPath($url){ |
|
48 | 48 | $url = self::normalize($url); |
49 | 49 | |
50 | 50 | $uri = isset($_SERVER['SCRIPT_NAME']) |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | |
57 | 57 | if (substr($url, 0, 1) !== "/") { |
58 | 58 | if ($uri === false) return false; |
59 | - $url = dirname($uri) . "/$url"; |
|
59 | + $url = dirname($uri)."/$url"; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | if (isset($_SERVER['DOCUMENT_ROOT'])) { |
63 | - return self::normalize($_SERVER['DOCUMENT_ROOT'] . "/$url"); |
|
63 | + return self::normalize($_SERVER['DOCUMENT_ROOT']."/$url"); |
|
64 | 64 | |
65 | 65 | } else { |
66 | 66 | if ($uri === false) return false; |
67 | 67 | |
68 | 68 | if (isset($_SERVER['SCRIPT_FILENAME'])) { |
69 | 69 | $scr_filename = self::normalize($_SERVER['SCRIPT_FILENAME']); |
70 | - return self::normalize(substr($scr_filename, 0, -strlen($uri)) . "/$url"); |
|
70 | + return self::normalize(substr($scr_filename, 0, -strlen($uri))."/$url"); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $count = count(explode('/', $uri)) - 1; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return false; |
81 | 81 | $rdir = getcwd(); |
82 | 82 | chdir($dir); |
83 | - return ($rdir !== false) ? self::normalize($rdir . "/$url") : false; |
|
83 | + return ($rdir !== false) ? self::normalize($rdir."/$url") : false; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | * @param string $path |
93 | 93 | * @return string */ |
94 | 94 | |
95 | - static function normalize($path) { |
|
95 | + static function normalize($path){ |
|
96 | 96 | if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") { |
97 | 97 | $path = preg_replace('/([^\\\])\\\([^\\\])/', "$1/$2", $path); |
98 | 98 | if (substr($path, -1) == "\\") $path = substr($path, 0, -1); |
99 | - if (substr($path, 0, 1) == "\\") $path = "/" . substr($path, 1); |
|
99 | + if (substr($path, 0, 1) == "\\") $path = "/".substr($path, 1); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $path = preg_replace('/\/+/s', "/", $path); |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | * @param string $path |
119 | 119 | * @return string */ |
120 | 120 | |
121 | - static function urlPathEncode($path) { |
|
121 | + static function urlPathEncode($path){ |
|
122 | 122 | $path = self::normalize($path); |
123 | 123 | $encoded = ""; |
124 | 124 | foreach (explode("/", $path) as $dir) |
125 | - $encoded .= rawurlencode($dir) . "/"; |
|
125 | + $encoded .= rawurlencode($dir)."/"; |
|
126 | 126 | $encoded = substr($encoded, 0, -1); |
127 | 127 | return $encoded; |
128 | 128 | } |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | * @param string $path |
132 | 132 | * @return string */ |
133 | 133 | |
134 | - static function urlPathDecode($path) { |
|
134 | + static function urlPathDecode($path){ |
|
135 | 135 | $path = self::normalize($path); |
136 | 136 | $decoded = ""; |
137 | 137 | foreach (explode("/", $path) as $dir) |
138 | - $decoded .= rawurldecode($dir) . "/"; |
|
138 | + $decoded .= rawurldecode($dir)."/"; |
|
139 | 139 | $decoded = substr($decoded, 0, -1); |
140 | 140 | return $decoded; |
141 | 141 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class file { |
|
15 | +class file{ |
|
16 | 16 | |
17 | 17 | static $MIME = array( |
18 | 18 | 'ai' => 'application/postscript', |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param string $dir |
106 | 106 | * @return bool */ |
107 | 107 | |
108 | - static function isWritable($filename) { |
|
108 | + static function isWritable($filename){ |
|
109 | 109 | $filename = path::normalize($filename); |
110 | 110 | if (!is_file($filename) || (false === ($fp = @fopen($filename, 'a+')))) |
111 | 111 | return false; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param bool $toLower |
119 | 119 | * @return string */ |
120 | 120 | |
121 | - static function getExtension($filename, $toLower=true) { |
|
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 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param string $magic |
135 | 135 | * @return string */ |
136 | 136 | |
137 | - static function getMimeType($filename, $magic=null) { |
|
137 | + static function getMimeType($filename, $magic = null){ |
|
138 | 138 | if (class_exists("finfo")) { |
139 | 139 | $finfo = ($magic === null) |
140 | 140 | ? new finfo(FILEINFO_MIME) |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string $tpl |
171 | 171 | * @return string */ |
172 | 172 | |
173 | - static function getInexistantFilename($filename, $dir=null, $tpl=null) { |
|
173 | + static function getInexistantFilename($filename, $dir = null, $tpl = null){ |
|
174 | 174 | if ($tpl === null) $tpl = "{name}({sufix}){ext}"; |
175 | 175 | $fullPath = ($dir === null); |
176 | 176 | if ($fullPath) |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | $tpl = str_replace('{ext}', (strlen($ext) ? ".$ext" : ""), $tpl); |
189 | 189 | $i = 1; $file = "$dir/$filename"; |
190 | 190 | while (file_exists($file)) |
191 | - $file = "$dir/" . str_replace('{sufix}', $i++, $tpl); |
|
191 | + $file = "$dir/".str_replace('{sufix}', $i++, $tpl); |
|
192 | 192 | |
193 | 193 | return $fullPath |
194 | 194 | ? $file |
195 | 195 | : (strlen($fdir) |
196 | - ? "$fdir/" . basename($file) |
|
196 | + ? "$fdir/".basename($file) |
|
197 | 197 | : basename($file)); |
198 | 198 | } |
199 | 199 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -abstract class image { |
|
15 | +abstract class image{ |
|
16 | 16 | const DEFAULT_JPEG_QUALITY = 75; |
17 | 17 | |
18 | 18 | /** Image resource or object |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param string $property |
42 | 42 | * @return mixed */ |
43 | 43 | |
44 | - final public function __get($property) { |
|
44 | + final public function __get($property){ |
|
45 | 45 | return property_exists($this, $property) ? $this->$property : null; |
46 | 46 | } |
47 | 47 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param mixed $image |
58 | 58 | * @param array $options */ |
59 | 59 | |
60 | - public function __construct($image, array $options=array()) { |
|
60 | + public function __construct($image, array $options = array()){ |
|
61 | 61 | $this->image = $this->width = $this->height = null; |
62 | 62 | $imageDetails = $this->buildImage($image); |
63 | 63 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param mixed $image |
76 | 76 | * @return object */ |
77 | 77 | |
78 | - final static function factory($driver, $image, array $options=array()) { |
|
78 | + final static function factory($driver, $image, array $options = array()){ |
|
79 | 79 | $class = "image_$driver"; |
80 | 80 | return new $class($image, $options); |
81 | 81 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $drivers |
87 | 87 | * @return string */ |
88 | 88 | |
89 | - final static function getDriver(array $drivers=array('gd')) { |
|
89 | + final static function getDriver(array $drivers = array('gd')){ |
|
90 | 90 | foreach ($drivers as $driver) { |
91 | 91 | if (!preg_match('/^[a-z0-9\_]+$/i', $driver)) |
92 | 92 | continue; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param mixed $image |
106 | 106 | * @return array */ |
107 | 107 | |
108 | - final protected function buildImage($image) { |
|
108 | + final protected function buildImage($image){ |
|
109 | 109 | $class = get_class($this); |
110 | 110 | |
111 | 111 | if ($image instanceof $class) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param integer $resizedHeight |
132 | 132 | * @return integer */ |
133 | 133 | |
134 | - final public function getPropWidth($resizedHeight) { |
|
134 | + final public function getPropWidth($resizedHeight){ |
|
135 | 135 | $width = round(($this->width * $resizedHeight) / $this->height); |
136 | 136 | if (!$width) $width = 1; |
137 | 137 | return $width; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param integer $resizedWidth |
143 | 143 | * @return integer */ |
144 | 144 | |
145 | - final public function getPropHeight($resizedWidth) { |
|
145 | + final public function getPropHeight($resizedWidth){ |
|
146 | 146 | $height = round(($this->height * $resizedWidth) / $this->width); |
147 | 147 | if (!$height) $height = 1; |
148 | 148 | return $height; |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * static method should be implemented into driver classes like abstract |
154 | 154 | * methods |
155 | 155 | * @return bool */ |
156 | - static function available() { return false; } |
|
156 | + static function available(){ return false; } |
|
157 | 157 | |
158 | 158 | /** Checks if file is an image. This static method should be implemented into |
159 | 159 | * driver classes like abstract methods |
160 | 160 | * @param string $file |
161 | 161 | * @return bool */ |
162 | - static function checkImage($file) { return false; } |
|
162 | + static function checkImage($file){ return false; } |
|
163 | 163 | |
164 | 164 | /** Resize image. Should return TRUE on success or FALSE on failure |
165 | 165 | * @param integer $width |
@@ -175,21 +175,21 @@ discard block |
||
175 | 175 | * @param integer $height |
176 | 176 | * @param mixed $background |
177 | 177 | * @return bool */ |
178 | - abstract public function resizeFit($width, $height, $background=false); |
|
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 | 181 | * success or FALSE on failure |
182 | 182 | * @param mixed $src |
183 | 183 | * @param integer $offset |
184 | 184 | * @return bool */ |
185 | - abstract public function resizeCrop($width, $height, $offset=false); |
|
185 | + abstract public function resizeCrop($width, $height, $offset = false); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | /** Rotate image |
189 | 189 | * @param integer $angle |
190 | 190 | * @param string $background |
191 | 191 | * @return bool */ |
192 | - abstract public function rotate($angle, $background="#000000"); |
|
192 | + abstract public function rotate($angle, $background = "#000000"); |
|
193 | 193 | |
194 | 194 | abstract public function flipHorizontal(); |
195 | 195 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @param mixed $top |
206 | 206 | * @param mixed $left |
207 | 207 | * @return bool */ |
208 | - abstract public function watermark($file, $left=false, $top=false); |
|
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 | 211 | * 'file' - if is set, the output will be written to a file |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param string $type |
215 | 215 | * @param array $options |
216 | 216 | * @return bool */ |
217 | - abstract public function output($type='jpeg', array $options=array()); |
|
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 | 220 | * resource or object related to the created image, which will be passed to |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $state = 'skipframe'; |
152 | 152 | } |
153 | - elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) |
|
153 | + elseif (in_array($b, array_merge(range(0xC0, 0xC3), range(0xC5, 0xC7), range(0xC9, 0xCB), range(0xCD, 0xCF)))) |
|
154 | 154 | { |
155 | 155 | $state = 'readsize'; |
156 | 156 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $response = null; |
189 | 189 | |
190 | 190 | // do we need more data? |
191 | - if ($this->strpos + $n -1 >= strlen($this->str)) |
|
191 | + if ($this->strpos + $n - 1 >= strlen($this->str)) |
|
192 | 192 | { |
193 | 193 | $end = ($this->strpos + $n); |
194 | 194 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class httpCache { |
|
15 | +class httpCache{ |
|
16 | 16 | const DEFAULT_TYPE = "text/html"; |
17 | 17 | const DEFAULT_EXPIRE = 604800; // in seconds |
18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param integer $expire |
26 | 26 | * @param array $headers */ |
27 | 27 | |
28 | - static function file($file, $type=null, $expire=null, array $headers=null) { |
|
28 | + static function file($file, $type = null, $expire = null, array $headers = null){ |
|
29 | 29 | $mtime = @filemtime($file); |
30 | 30 | if ($mtime !== false) self::checkMTime($mtime); |
31 | 31 | |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | * @param array $headers |
48 | 48 | * @param bool $checkMTime */ |
49 | 49 | |
50 | - static function content($content, $mtime, $type=null, $expire=null, array $headers=null, $checkMTime=true) { |
|
50 | + static function content($content, $mtime, $type = null, $expire = null, array $headers = null, $checkMTime = true){ |
|
51 | 51 | if ($checkMTime) self::checkMTime($mtime); |
52 | 52 | if ($type === null) $type = self::DEFAULT_TYPE; |
53 | 53 | if ($expire === null) $expire = self::DEFAULT_EXPIRE; |
54 | 54 | $size = strlen($content); |
55 | - $expires = gmdate("D, d M Y H:i:s", time() + $expire) . " GMT"; |
|
55 | + $expires = gmdate("D, d M Y H:i:s", time() + $expire)." GMT"; |
|
56 | 56 | header("Content-Type: $type"); |
57 | 57 | header("Expires: $expires"); |
58 | 58 | header("Cache-Control: max-age=$expire"); |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * the PHP to be configured as Apache module. |
69 | 69 | * @param integer $mtime */ |
70 | 70 | |
71 | - static function checkMTime($mtime, $sendHeaders=null) { |
|
72 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s", $mtime) . " GMT"); |
|
71 | + static function checkMTime($mtime, $sendHeaders = null){ |
|
72 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mtime)." GMT"); |
|
73 | 73 | |
74 | 74 | $headers = function_exists("getallheaders") |
75 | 75 | ? getallheaders() |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class image_gd extends image { |
|
15 | +class image_gd extends image{ |
|
16 | 16 | |
17 | 17 | |
18 | 18 | // ABSTRACT PUBLIC METHODS |
19 | 19 | |
20 | - public function resize($width, $height) { |
|
20 | + public function resize($width, $height){ |
|
21 | 21 | if (!$width) $width = 1; |
22 | 22 | if (!$height) $height = 1; |
23 | 23 | return ( |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ); |
30 | 30 | } |
31 | 31 | |
32 | - public function resizeFit($width, $height, $background=false) { |
|
32 | + public function resizeFit($width, $height, $background = false){ |
|
33 | 33 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
34 | 34 | return true; |
35 | 35 | if (!$width || (($height / $width) < ($this->height / $this->width))) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - public function resizeCrop($width, $height, $offset=false) { |
|
70 | + public function resizeCrop($width, $height, $offset = false){ |
|
71 | 71 | |
72 | 72 | if (($this->width / $this->height) > ($width / $height)) { |
73 | 73 | $h = $height; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return $return; |
118 | 118 | } |
119 | 119 | |
120 | - public function rotate($angle, $background="#000000") { |
|
120 | + public function rotate($angle, $background = "#000000"){ |
|
121 | 121 | $angle = -$angle; |
122 | 122 | $img = @imagerotate($this->image, $angle, $this->gdColor($background)); |
123 | 123 | if ($img === false) |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | return true; |
129 | 129 | } |
130 | 130 | |
131 | - public function flipHorizontal() { |
|
131 | + public function flipHorizontal(){ |
|
132 | 132 | $img = imagecreatetruecolor($this->width, $this->height); |
133 | 133 | imagealphablending($img, false); |
134 | 134 | imagesavealpha($img, true); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return true; |
140 | 140 | } |
141 | 141 | |
142 | - public function flipVertical() { |
|
142 | + public function flipVertical(){ |
|
143 | 143 | $img = imagecreatetruecolor($this->width, $this->height); |
144 | 144 | imagealphablending($img, false); |
145 | 145 | imagesavealpha($img, true); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return true; |
151 | 151 | } |
152 | 152 | |
153 | - public function watermark($file, $left=false, $top=false) { |
|
153 | + public function watermark($file, $left = false, $top = false){ |
|
154 | 154 | $info = getimagesize($file); |
155 | 155 | list($w, $h, $t) = $info; |
156 | 156 | if (!in_array($t, array(IMAGETYPE_PNG, IMAGETYPE_GIF))) |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | return true; |
188 | 188 | } |
189 | 189 | |
190 | - public function output($type='jpeg', array $options=array()) { |
|
190 | + public function output($type = 'jpeg', array $options = array()){ |
|
191 | 191 | $method = "output_$type"; |
192 | 192 | if (!method_exists($this, $method)) |
193 | 193 | return false; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | // ABSTRACT PROTECTED METHODS |
199 | 199 | |
200 | - protected function getBlankImage($width, $height) { |
|
200 | + protected function getBlankImage($width, $height){ |
|
201 | 201 | $img = @imagecreatetruecolor($width, $height); |
202 | 202 | // imagealphablending($img, false); |
203 | 203 | // imagesavealpha($img, true); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | return $img; |
208 | 208 | } |
209 | 209 | |
210 | - protected function getImage($image, &$width, &$height) { |
|
210 | + protected function getImage($image, &$width, &$height){ |
|
211 | 211 | |
212 | 212 | if (is_resource($image) && (get_resource_type($image) == "gd")) { |
213 | 213 | $width = @imagesx($image); |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | (false !== (list($width, $height, $t) = @getimagesize($image))) |
219 | 219 | ) { |
220 | 220 | $image = |
221 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
221 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
222 | 222 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
223 | 223 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
224 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
225 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
224 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
225 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
226 | 226 | )))); |
227 | 227 | |
228 | 228 | return $image; |
@@ -234,22 +234,22 @@ discard block |
||
234 | 234 | |
235 | 235 | // PSEUDO-ABSTRACT STATIC METHODS |
236 | 236 | |
237 | - static function available() { |
|
237 | + static function available(){ |
|
238 | 238 | return function_exists("imagecreatefromjpeg"); |
239 | 239 | } |
240 | 240 | |
241 | - static function checkImage($file) { |
|
241 | + static function checkImage($file){ |
|
242 | 242 | if (!is_string($file) || |
243 | 243 | ((false === (list($width, $height, $t) = @getimagesize($file)))) |
244 | 244 | ) |
245 | 245 | return false; |
246 | 246 | |
247 | 247 | $img = |
248 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
248 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
249 | 249 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($file) : ( |
250 | 250 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($file) : ( |
251 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
252 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
251 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
252 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
253 | 253 | )))); |
254 | 254 | |
255 | 255 | return ($img !== false); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | // OWN METHODS |
260 | 260 | |
261 | - protected function output_png(array $options=array()) { |
|
261 | + protected function output_png(array $options = array()){ |
|
262 | 262 | $file = isset($options['file']) ? $options['file'] : null; |
263 | 263 | $quality = isset($options['quality']) ? $options['quality'] : null; |
264 | 264 | $filters = isset($options['filters']) ? $options['filters'] : null; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return imagepng($this->image, $file, $quality, $filters); |
269 | 269 | } |
270 | 270 | |
271 | - protected function output_jpeg(array $options=array()) { |
|
271 | + protected function output_jpeg(array $options = array()){ |
|
272 | 272 | $file = isset($options['file']) ? $options['file'] : null; |
273 | 273 | $quality = isset($options['quality']) |
274 | 274 | ? $options['quality'] |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | return imagejpeg($this->image, $file, $quality); |
279 | 279 | } |
280 | 280 | |
281 | - protected function output_gif(array $options=array()) { |
|
281 | + protected function output_gif(array $options = array()){ |
|
282 | 282 | $file = isset($options['file']) ? $options['file'] : null; |
283 | 283 | if (isset($options['file']) && !headers_sent()) |
284 | 284 | header("Content-Type: image/gif"); |
285 | 285 | return imagegif($this->image, $file); |
286 | 286 | } |
287 | 287 | |
288 | - protected function gdColor() { |
|
288 | + protected function gdColor(){ |
|
289 | 289 | $args = func_get_args(); |
290 | 290 | |
291 | 291 | $exprRGB = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i'; |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | return imagecolorallocate($this->image, $r, $g, $b); |
328 | 328 | } |
329 | 329 | |
330 | - protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) { |
|
330 | + protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color){ |
|
331 | 331 | $color = $this->gdColor($color); |
332 | 332 | if ($color === false) return false; |
333 | 333 | return imageFilledRectangle($this->image, $x1, $y1, $x2, $y2, $color); |
334 | 334 | } |
335 | 335 | |
336 | 336 | protected function imageCopyResampled( |
337 | - $src, $dstX=0, $dstY=0, $srcX=0, $srcY=0, $dstW=null, $dstH=null, $srcW=null, $srcH=null |
|
338 | - ) { |
|
337 | + $src, $dstX = 0, $dstY = 0, $srcX = 0, $srcY = 0, $dstW = null, $dstH = null, $srcW = null, $srcH = null |
|
338 | + ){ |
|
339 | 339 | $imageDetails = $this->buildImage($src); |
340 | 340 | |
341 | 341 | if ($imageDetails === false) |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class text { |
|
15 | +class text{ |
|
16 | 16 | |
17 | 17 | /** Replace repeated white spaces to single space |
18 | 18 | * @param string $string |
19 | 19 | * @return string */ |
20 | 20 | |
21 | - static function clearWhitespaces($string) { |
|
21 | + static function clearWhitespaces($string){ |
|
22 | 22 | return trim(preg_replace('/\s+/s', " ", $string)); |
23 | 23 | } |
24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string $string |
27 | 27 | * @return string */ |
28 | 28 | |
29 | - static function htmlValue($string) { |
|
29 | + static function htmlValue($string){ |
|
30 | 30 | return |
31 | 31 | str_replace('"', """, |
32 | 32 | str_replace("'", ''', |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param string $string |
40 | 40 | * @return string */ |
41 | 41 | |
42 | - static function jsValue($string) { |
|
42 | + static function jsValue($string){ |
|
43 | 43 | return |
44 | 44 | preg_replace('/\r?\n/', "\\n", |
45 | 45 | str_replace('"', "\\\"", |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $string |
53 | 53 | * @param bool $cdata */ |
54 | 54 | |
55 | - static function xmlData($string, $cdata=false) { |
|
55 | + static function xmlData($string, $cdata = false){ |
|
56 | 56 | $string = str_replace("]]>", "]]]]><![CDATA[>", $string); |
57 | 57 | if (!$cdata) |
58 | 58 | $string = "<![CDATA[$string]]>"; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param string $code |
64 | 64 | * @return string */ |
65 | 65 | |
66 | - static function compressCSS($code) { |
|
66 | + static function compressCSS($code){ |
|
67 | 67 | $code = self::clearWhitespaces($code); |
68 | 68 | $code = preg_replace('/ ?\{ ?/', "{", $code); |
69 | 69 | $code = preg_replace('/ ?\} ?/', "}", $code); |