@@ -1,16 +1,16 @@ |
||
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(); |
@@ -1,16 +1,16 @@ |
||
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(".."); |
@@ -10,14 +10,14 @@ |
||
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> |
@@ -1,23 +1,23 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -1,16 +1,16 @@ |
||
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 |
@@ -1,29 +1,29 @@ discard block |
||
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 |
||
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; |
@@ -1,23 +1,23 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -1,16 +1,16 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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}"; |
@@ -1,45 +1,45 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |