@@ -1149,18 +1149,18 @@ discard block |
||
1149 | 1149 | } |
1150 | 1150 | |
1151 | 1151 | /** |
1152 | - * Get remote contents |
|
1153 | - * |
|
1154 | - * @param string $url target url |
|
1155 | - * @param int $timeout timeout (sec) |
|
1156 | - * @param int $redirect_max redirect max count |
|
1157 | - * @param string $ua |
|
1158 | - * @param resource $fp |
|
1159 | - * @return string or bool(false) |
|
1160 | - * @retval string contents |
|
1161 | - * @retval false error |
|
1162 | - * @author Naoki Sawada |
|
1163 | - **/ |
|
1152 | + * Get remote contents |
|
1153 | + * |
|
1154 | + * @param string $url target url |
|
1155 | + * @param int $timeout timeout (sec) |
|
1156 | + * @param int $redirect_max redirect max count |
|
1157 | + * @param string $ua |
|
1158 | + * @param resource $fp |
|
1159 | + * @return string or bool(false) |
|
1160 | + * @retval string contents |
|
1161 | + * @retval false error |
|
1162 | + * @author Naoki Sawada |
|
1163 | + **/ |
|
1164 | 1164 | protected function get_remote_contents( &$url, $timeout = 30, $redirect_max = 5, $ua = 'Mozilla/5.0', $fp = null ) { |
1165 | 1165 | $method = (function_exists('curl_exec') && !ini_get('safe_mode'))? 'curl_get_contents' : 'fsock_get_contents'; |
1166 | 1166 | return $this->$method( $url, $timeout, $redirect_max, $ua, $fp ); |
@@ -2090,12 +2090,12 @@ discard block |
||
2090 | 2090 | } |
2091 | 2091 | |
2092 | 2092 | /** |
2093 | - * Return content URL |
|
2094 | - * |
|
2095 | - * @param array $args command arguments |
|
2096 | - * @return array |
|
2097 | - * @author Naoki Sawada |
|
2098 | - **/ |
|
2093 | + * Return content URL |
|
2094 | + * |
|
2095 | + * @param array $args command arguments |
|
2096 | + * @return array |
|
2097 | + * @author Naoki Sawada |
|
2098 | + **/ |
|
2099 | 2099 | protected function url($args) { |
2100 | 2100 | $target = $args['target']; |
2101 | 2101 | $options = isset($args['options'])? $args['options'] : array(); |
@@ -1241,8 +1241,12 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | $query = $method.' '.$uri." HTTP/1.0\r\n"; |
1243 | 1243 | $query .= "Host: ".$arr['host']."\r\n"; |
1244 | - if (!empty($ua)) $query .= "User-Agent: ".$ua."\r\n"; |
|
1245 | - if (!is_null($getSize)) $query .= 'Range: bytes=0-' . ($getSize - 1) . "\r\n"; |
|
1244 | + if (!empty($ua)) { |
|
1245 | + $query .= "User-Agent: ".$ua."\r\n"; |
|
1246 | + } |
|
1247 | + if (!is_null($getSize)) { |
|
1248 | + $query .= 'Range: bytes=0-' . ($getSize - 1) . "\r\n"; |
|
1249 | + } |
|
1246 | 1250 | |
1247 | 1251 | $query .= $headers; |
1248 | 1252 | |
@@ -1257,7 +1261,9 @@ discard block |
||
1257 | 1261 | $arr['https'].$arr['host'], |
1258 | 1262 | $arr['port'], |
1259 | 1263 | $errno,$errstr,$connect_timeout); |
1260 | - if ($fp) break; |
|
1264 | + if ($fp) { |
|
1265 | + break; |
|
1266 | + } |
|
1261 | 1267 | $connect_try_count++; |
1262 | 1268 | if (connection_aborted()) { |
1263 | 1269 | exit(); |
@@ -1574,7 +1580,9 @@ discard block |
||
1574 | 1580 | $tempDir = ''; |
1575 | 1581 | $test = DIRECTORY_SEPARATOR . microtime(true); |
1576 | 1582 | foreach($testDirs as $testDir) { |
1577 | - if (!$testDir || !is_dir($testDir)) continue; |
|
1583 | + if (!$testDir || !is_dir($testDir)) { |
|
1584 | + continue; |
|
1585 | + } |
|
1578 | 1586 | $testFile = $testDir.$test; |
1579 | 1587 | if (touch($testFile)) { |
1580 | 1588 | unlink($testFile); |
@@ -1810,7 +1818,9 @@ discard block |
||
1810 | 1818 | $result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, self::ERROR_UPLOAD_TRANSFER); |
1811 | 1819 | $this->uploadDebug = 'Upload error: unable open tmp file'; |
1812 | 1820 | if (! is_uploaded_file($tmpname)) { |
1813 | - if (@ unlink($tmpname)) unset($GLOBALS['elFinderTempFiles'][$tmpfname]); |
|
1821 | + if (@ unlink($tmpname)) { |
|
1822 | + unset($GLOBALS['elFinderTempFiles'][$tmpfname]); |
|
1823 | + } |
|
1814 | 1824 | continue; |
1815 | 1825 | } |
1816 | 1826 | break; |
@@ -1824,7 +1834,10 @@ discard block |
||
1824 | 1834 | $result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, $volume->error()); |
1825 | 1835 | fclose($fp); |
1826 | 1836 | if (! is_uploaded_file($tmpname)) { |
1827 | - if (@ unlink($tmpname)) unset($GLOBALS['elFinderTempFiles'][$tmpname]);; |
|
1837 | + if (@ unlink($tmpname)) { |
|
1838 | + unset($GLOBALS['elFinderTempFiles'][$tmpname]); |
|
1839 | + } |
|
1840 | + ; |
|
1828 | 1841 | continue; |
1829 | 1842 | } |
1830 | 1843 | break; |
@@ -212,8 +212,9 @@ |
||
212 | 212 | protected function input_filter($args) { |
213 | 213 | static $magic_quotes_gpc = NULL; |
214 | 214 | |
215 | - if ($magic_quotes_gpc === NULL) |
|
216 | - $magic_quotes_gpc = (version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc()); |
|
215 | + if ($magic_quotes_gpc === NULL) { |
|
216 | + $magic_quotes_gpc = (version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc()); |
|
217 | + } |
|
217 | 218 | |
218 | 219 | if (is_array($args)) { |
219 | 220 | return array_map(array(& $this, 'input_filter'), $args); |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Base class for elFinder volume. |
|
4 | - * Provide 2 layers: |
|
5 | - * 1. Public API (commands) |
|
6 | - * 2. abstract fs API |
|
7 | - * |
|
8 | - * All abstract methods begin with "_" |
|
9 | - * |
|
10 | - * @author Dmitry (dio) Levashov |
|
11 | - * @author Troex Nevelin |
|
12 | - * @author Alexey Sukhotin |
|
13 | - **/ |
|
3 | + * Base class for elFinder volume. |
|
4 | + * Provide 2 layers: |
|
5 | + * 1. Public API (commands) |
|
6 | + * 2. abstract fs API |
|
7 | + * |
|
8 | + * All abstract methods begin with "_" |
|
9 | + * |
|
10 | + * @author Dmitry (dio) Levashov |
|
11 | + * @author Troex Nevelin |
|
12 | + * @author Alexey Sukhotin |
|
13 | + **/ |
|
14 | 14 | abstract class elFinderVolumeDriver { |
15 | 15 | |
16 | 16 | /** |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | 'mimefile' => '', |
193 | 193 | // mime type normalize map : Array '[ext]:[detected mime type]' => '[normalized mime]' |
194 | 194 | 'mimeMap' => array( |
195 | - 'md:application/x-genesis-rom' => 'text/x-markdown', |
|
196 | - 'md:text/plain' => 'text/x-markdown', |
|
197 | - 'markdown:text/plain' => 'text/x-markdown', |
|
198 | - 'css:text/x-asm' => 'text/css' |
|
199 | - ), |
|
195 | + 'md:application/x-genesis-rom' => 'text/x-markdown', |
|
196 | + 'md:text/plain' => 'text/x-markdown', |
|
197 | + 'markdown:text/plain' => 'text/x-markdown', |
|
198 | + 'css:text/x-asm' => 'text/css' |
|
199 | + ), |
|
200 | 200 | // directory for thumbnails |
201 | 201 | 'tmbPath' => '.tmb', |
202 | 202 | // mode to create thumbnails dir |
@@ -4043,14 +4043,14 @@ discard block |
||
4043 | 4043 | // } |
4044 | 4044 | |
4045 | 4045 | /** |
4046 | - * Find position of first occurrence of string in a string with multibyte support |
|
4047 | - * |
|
4048 | - * @param string $haystack The string being checked. |
|
4049 | - * @param string $needle The string to find in haystack. |
|
4050 | - * @param int $offset The search offset. If it is not specified, 0 is used. |
|
4051 | - * @return int|bool |
|
4052 | - * @author Alexey Sukhotin |
|
4053 | - **/ |
|
4046 | + * Find position of first occurrence of string in a string with multibyte support |
|
4047 | + * |
|
4048 | + * @param string $haystack The string being checked. |
|
4049 | + * @param string $needle The string to find in haystack. |
|
4050 | + * @param int $offset The search offset. If it is not specified, 0 is used. |
|
4051 | + * @return int|bool |
|
4052 | + * @author Alexey Sukhotin |
|
4053 | + **/ |
|
4054 | 4054 | protected function stripos($haystack , $needle , $offset = 0) { |
4055 | 4055 | if (function_exists('mb_stripos')) { |
4056 | 4056 | return mb_stripos($haystack , $needle , $offset); |
@@ -859,7 +859,9 @@ discard block |
||
859 | 859 | |
860 | 860 | // This get's triggered if $this->root == '/' and alias is empty. |
861 | 861 | // Maybe modify _basename instead? |
862 | - if ($this->rootName === '') $this->rootName = $this->separator; |
|
862 | + if ($this->rootName === '') { |
|
863 | + $this->rootName = $this->separator; |
|
864 | + } |
|
863 | 865 | |
864 | 866 | $root = $this->stat($this->root); |
865 | 867 | |
@@ -2938,7 +2940,9 @@ discard block |
||
2938 | 2940 | if ($this->mimeDetect == 'finfo') { |
2939 | 2941 | if ($type = @finfo_file($this->finfo, $path)) { |
2940 | 2942 | if ($ext && preg_match('~^application/(?:octet-stream|(?:x-)?zip)~', $type)) { |
2941 | - if (isset(elFinderVolumeDriver::$mimetypes[$ext])) $type = elFinderVolumeDriver::$mimetypes[$ext]; |
|
2943 | + if (isset(elFinderVolumeDriver::$mimetypes[$ext])) { |
|
2944 | + $type = elFinderVolumeDriver::$mimetypes[$ext]; |
|
2945 | + } |
|
2942 | 2946 | } else if ($ext === 'js' && preg_match('~^text/~', $type)) { |
2943 | 2947 | $type = 'text/javascript'; |
2944 | 2948 | } |
@@ -4013,7 +4017,7 @@ discard block |
||
4013 | 4017 | imagesavealpha($image,true); |
4014 | 4018 | $bgcolor1 = imagecolorallocatealpha($image, 255, 255, 255, 127); |
4015 | 4019 | |
4016 | - }else{ |
|
4020 | + } else{ |
|
4017 | 4021 | list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x"); |
4018 | 4022 | $bgcolor1 = imagecolorallocate($image, $r, $g, $b); |
4019 | 4023 | } |
@@ -4203,7 +4207,9 @@ discard block |
||
4203 | 4207 | } |
4204 | 4208 | |
4205 | 4209 | // 'Here' |
4206 | - if ($path === '' || $path === '.' . $separator) return $base; |
|
4210 | + if ($path === '' || $path === '.' . $separator) { |
|
4211 | + return $base; |
|
4212 | + } |
|
4207 | 4213 | |
4208 | 4214 | // Absolute path |
4209 | 4215 | if ($path[0] === $separator || strpos($path, $systemroot) === 0) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $options['url'] = $this->getConnectorUrl(); |
193 | 193 | } |
194 | 194 | $callback = $options['url'] |
195 | - . '?cmd=netmount&protocol=dropbox&host=dropbox.com&user=init&pass=return&node='.$options['id'].$cdata; |
|
195 | + . '?cmd=netmount&protocol=dropbox&host=dropbox.com&user=init&pass=return&node='.$options['id'].$cdata; |
|
196 | 196 | |
197 | 197 | try { |
198 | 198 | $tokens = $this->oauth->getRequestToken(); |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | */ |
266 | 266 | private function getConnectorUrl() { |
267 | 267 | $url = ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')? 'https://' : 'http://') |
268 | - . $_SERVER['SERVER_NAME'] // host |
|
269 | - . ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']) // port |
|
270 | - . $_SERVER['REQUEST_URI']; // path & query |
|
268 | + . $_SERVER['SERVER_NAME'] // host |
|
269 | + . ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']) // port |
|
270 | + . $_SERVER['REQUEST_URI']; // path & query |
|
271 | 271 | list($url) = explode('?', $url); |
272 | 272 | return $url; |
273 | 273 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | $stat['mime'] = $raw['is_dir']? 'directory' : $raw['mime_type']; |
606 | 606 | $stat['size'] = $stat['mime'] == 'directory' ? 0 : $raw['bytes']; |
607 | 607 | $stat['ts'] = isset($raw['client_mtime'])? strtotime($raw['client_mtime']) : |
608 | - (isset($raw['modified'])? strtotime($raw['modified']) : $_SERVER['REQUEST_TIME']); |
|
608 | + (isset($raw['modified'])? strtotime($raw['modified']) : $_SERVER['REQUEST_TIME']); |
|
609 | 609 | $stat['dirs'] = 0; |
610 | 610 | if ($raw['is_dir']) { |
611 | 611 | $stat['dirs'] = (int)(bool)$this->query('select path from '.$this->DB_TableName.' where isdir=1 and path='.$this->DB->quote(strtolower($raw['path']))); |
@@ -648,14 +648,14 @@ discard block |
||
648 | 648 | } |
649 | 649 | |
650 | 650 | /** |
651 | - * Recursive files search |
|
652 | - * |
|
653 | - * @param string $path dir path |
|
654 | - * @param string $q search string |
|
655 | - * @param array $mimes |
|
656 | - * @return array |
|
657 | - * @author Naoki Sawada |
|
658 | - **/ |
|
651 | + * Recursive files search |
|
652 | + * |
|
653 | + * @param string $path dir path |
|
654 | + * @param string $q search string |
|
655 | + * @param array $mimes |
|
656 | + * @return array |
|
657 | + * @author Naoki Sawada |
|
658 | + **/ |
|
659 | 659 | protected function doSearch($path, $q, $mimes) { |
660 | 660 | $result = array(); |
661 | 661 | $sth = $this->DB->prepare('select dat from '.$this->DB_TableName.' WHERE path LIKE ? AND fname LIKE ?'); |
@@ -679,16 +679,16 @@ discard block |
||
679 | 679 | } |
680 | 680 | |
681 | 681 | /** |
682 | - * Copy file/recursive copy dir only in current volume. |
|
683 | - * Return new file path or false. |
|
684 | - * |
|
685 | - * @param string $src source path |
|
686 | - * @param string $dst destination dir path |
|
687 | - * @param string $name new file name (optionaly) |
|
688 | - * @return string|false |
|
689 | - * @author Dmitry (dio) Levashov |
|
690 | - * @author Naoki Sawada |
|
691 | - **/ |
|
682 | + * Copy file/recursive copy dir only in current volume. |
|
683 | + * Return new file path or false. |
|
684 | + * |
|
685 | + * @param string $src source path |
|
686 | + * @param string $dst destination dir path |
|
687 | + * @param string $name new file name (optionaly) |
|
688 | + * @return string|false |
|
689 | + * @author Dmitry (dio) Levashov |
|
690 | + * @author Naoki Sawada |
|
691 | + **/ |
|
692 | 692 | protected function copy($src, $dst, $name) { |
693 | 693 | |
694 | 694 | $this->clearcache(); |
@@ -699,14 +699,14 @@ discard block |
||
699 | 699 | } |
700 | 700 | |
701 | 701 | /** |
702 | - * Remove file/ recursive remove dir |
|
703 | - * |
|
704 | - * @param string $path file path |
|
705 | - * @param bool $force try to remove even if file locked |
|
706 | - * @return bool |
|
707 | - * @author Dmitry (dio) Levashov |
|
708 | - * @author Naoki Sawada |
|
709 | - **/ |
|
702 | + * Remove file/ recursive remove dir |
|
703 | + * |
|
704 | + * @param string $path file path |
|
705 | + * @param bool $force try to remove even if file locked |
|
706 | + * @return bool |
|
707 | + * @author Dmitry (dio) Levashov |
|
708 | + * @author Naoki Sawada |
|
709 | + **/ |
|
710 | 710 | protected function remove($path, $force = false, $recursive = false) { |
711 | 711 | $stat = $this->stat($path); |
712 | 712 | $stat['realpath'] = $path; |
@@ -736,14 +736,14 @@ discard block |
||
736 | 736 | } |
737 | 737 | |
738 | 738 | /** |
739 | - * Create thumnbnail and return it's URL on success |
|
740 | - * |
|
741 | - * @param string $path file path |
|
742 | - * @param string $mime file mime type |
|
743 | - * @return string|false |
|
744 | - * @author Dmitry (dio) Levashov |
|
745 | - * @author Naoki Sawada |
|
746 | - **/ |
|
739 | + * Create thumnbnail and return it's URL on success |
|
740 | + * |
|
741 | + * @param string $path file path |
|
742 | + * @param string $mime file mime type |
|
743 | + * @return string|false |
|
744 | + * @author Dmitry (dio) Levashov |
|
745 | + * @author Naoki Sawada |
|
746 | + **/ |
|
747 | 747 | protected function createTmb($path, $stat) { |
748 | 748 | if (!$stat || !$this->canCreateTmb($path, $stat)) { |
749 | 749 | return false; |
@@ -828,13 +828,13 @@ discard block |
||
828 | 828 | } |
829 | 829 | |
830 | 830 | /** |
831 | - * Return content URL |
|
832 | - * |
|
833 | - * @param string $hash file hash |
|
834 | - * @param array $options options |
|
835 | - * @return array |
|
836 | - * @author Naoki Sawada |
|
837 | - **/ |
|
831 | + * Return content URL |
|
832 | + * |
|
833 | + * @param string $hash file hash |
|
834 | + * @param array $options options |
|
835 | + * @return array |
|
836 | + * @author Naoki Sawada |
|
837 | + **/ |
|
838 | 838 | public function getContentUrl($hash, $options = array()) { |
839 | 839 | if (($file = $this->file($hash)) == false || !$file['url'] || $file['url'] == 1) { |
840 | 840 | $path = $this->decode($hash); |
@@ -897,9 +897,9 @@ discard block |
||
897 | 897 | try { |
898 | 898 | $request2 = new HTTP_Request2(); |
899 | 899 | $request2->setConfig(array( |
900 | - 'ssl_verify_peer' => false, |
|
901 | - 'ssl_verify_host' => false |
|
902 | - )); |
|
900 | + 'ssl_verify_peer' => false, |
|
901 | + 'ssl_verify_host' => false |
|
902 | + )); |
|
903 | 903 | $request2->setUrl($url); |
904 | 904 | $request2->setMethod(HTTP_Request2::METHOD_HEAD); |
905 | 905 | $result = $request2->send(); |
@@ -132,8 +132,12 @@ discard block |
||
132 | 132 | * @author Naoki Sawada |
133 | 133 | **/ |
134 | 134 | public function netmountPrepare($options) { |
135 | - if (empty($options['consumerKey']) && defined('ELFINDER_DROPBOX_CONSUMERKEY')) $options['consumerKey'] = ELFINDER_DROPBOX_CONSUMERKEY; |
|
136 | - if (empty($options['consumerSecret']) && defined('ELFINDER_DROPBOX_CONSUMERSECRET')) $options['consumerSecret'] = ELFINDER_DROPBOX_CONSUMERSECRET; |
|
135 | + if (empty($options['consumerKey']) && defined('ELFINDER_DROPBOX_CONSUMERKEY')) { |
|
136 | + $options['consumerKey'] = ELFINDER_DROPBOX_CONSUMERKEY; |
|
137 | + } |
|
138 | + if (empty($options['consumerSecret']) && defined('ELFINDER_DROPBOX_CONSUMERSECRET')) { |
|
139 | + $options['consumerSecret'] = ELFINDER_DROPBOX_CONSUMERSECRET; |
|
140 | + } |
|
137 | 141 | |
138 | 142 | if ($options['user'] === 'init') { |
139 | 143 | |
@@ -616,8 +620,12 @@ discard block |
||
616 | 620 | } else { |
617 | 621 | $stat['url'] = '1'; |
618 | 622 | } |
619 | - if (isset($raw['width'])) $stat['width'] = $raw['width']; |
|
620 | - if (isset($raw['height'])) $stat['height'] = $raw['height']; |
|
623 | + if (isset($raw['width'])) { |
|
624 | + $stat['width'] = $raw['width']; |
|
625 | + } |
|
626 | + if (isset($raw['height'])) { |
|
627 | + $stat['height'] = $raw['height']; |
|
628 | + } |
|
621 | 629 | |
622 | 630 | return $stat; |
623 | 631 | } |
@@ -1061,7 +1069,9 @@ discard block |
||
1061 | 1069 | * @author Dmitry (dio) Levashov |
1062 | 1070 | **/ |
1063 | 1071 | protected function _dimensions($path, $mime) { |
1064 | - if (strpos($mime, 'image') !== 0) return ''; |
|
1072 | + if (strpos($mime, 'image') !== 0) { |
|
1073 | + return ''; |
|
1074 | + } |
|
1065 | 1075 | $cache = $this->getDBdat($path); |
1066 | 1076 | if (isset($cache['width']) && isset($cache['height'])) { |
1067 | 1077 | return $cache['width'].'x'.$cache['height']; |
@@ -1281,7 +1291,9 @@ discard block |
||
1281 | 1291 | * @author Dmitry (dio) Levashov |
1282 | 1292 | **/ |
1283 | 1293 | protected function _save($fp, $path, $name, $stat) { |
1284 | - if ($name) $path .= '/'.$name; |
|
1294 | + if ($name) { |
|
1295 | + $path .= '/'.$name; |
|
1296 | + } |
|
1285 | 1297 | $path = $this->_normpath($path); |
1286 | 1298 | try { |
1287 | 1299 | $this->dropbox->putFile($path, $fp); |
@@ -1291,8 +1303,12 @@ discard block |
||
1291 | 1303 | $this->deltaCheck(); |
1292 | 1304 | if (is_array($stat)) { |
1293 | 1305 | $raw = $this->getDBdat($path); |
1294 | - if (isset($stat['width'])) $raw['width'] = $stat['width']; |
|
1295 | - if (isset($stat['height'])) $raw['height'] = $stat['height']; |
|
1306 | + if (isset($stat['width'])) { |
|
1307 | + $raw['width'] = $stat['width']; |
|
1308 | + } |
|
1309 | + if (isset($stat['height'])) { |
|
1310 | + $raw['height'] = $stat['height']; |
|
1311 | + } |
|
1296 | 1312 | $this->updateDBdat($path, $raw); |
1297 | 1313 | } |
1298 | 1314 | return $path; |
@@ -386,7 +386,7 @@ |
||
386 | 386 | |
387 | 387 | try { |
388 | 388 | $obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $this->_normpath($path) , 'GetMetadata' => true, 'InlineData' => true, 'GetData' => true)); |
389 | - } catch (Exception $e) { |
|
389 | + } catch (Exception $e) { |
|
390 | 390 | |
391 | 391 | } |
392 | 392 |
@@ -104,20 +104,24 @@ |
||
104 | 104 | private function normalize($str, $opts) { |
105 | 105 | if ($opts['nfc'] || $opts['nfkc']) { |
106 | 106 | if (class_exists('Normalizer')) { |
107 | - if ($opts['nfc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_C)) |
|
108 | - $str = Normalizer::normalize($str, Normalizer::FORM_C); |
|
109 | - if ($opts['nfkc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_KC)) |
|
110 | - $str = Normalizer::normalize($str, Normalizer::FORM_KC); |
|
107 | + if ($opts['nfc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_C)) { |
|
108 | + $str = Normalizer::normalize($str, Normalizer::FORM_C); |
|
109 | + } |
|
110 | + if ($opts['nfkc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_KC)) { |
|
111 | + $str = Normalizer::normalize($str, Normalizer::FORM_KC); |
|
112 | + } |
|
111 | 113 | } else { |
112 | 114 | if (! class_exists('I18N_UnicodeNormalizer')) { |
113 | 115 | @ include_once 'I18N/UnicodeNormalizer.php'; |
114 | 116 | } |
115 | 117 | if (class_exists('I18N_UnicodeNormalizer')) { |
116 | 118 | $normalizer = new I18N_UnicodeNormalizer(); |
117 | - if ($opts['nfc']) |
|
118 | - $str = $normalizer->normalize($str, 'NFC'); |
|
119 | - if ($opts['nfkc']) |
|
120 | - $str = $normalizer->normalize($str, 'NFKC'); |
|
119 | + if ($opts['nfc']) { |
|
120 | + $str = $normalizer->normalize($str, 'NFC'); |
|
121 | + } |
|
122 | + if ($opts['nfkc']) { |
|
123 | + $str = $normalizer->normalize($str, 'NFKC'); |
|
124 | + } |
|
121 | 125 | } |
122 | 126 | } |
123 | 127 | } |
@@ -1,55 +1,55 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * elFinder Plugin Normalizer |
|
4 | - * |
|
5 | - * UTF-8 Normalizer of file-name and file-path etc. |
|
6 | - * nfc(NFC): Canonical Decomposition followed by Canonical Composition |
|
7 | - * nfkc(NFKC): Compatibility Decomposition followed by Canonical |
|
8 | - * |
|
9 | - * This plugin require Class "Normalizer" (PHP 5 >= 5.3.0, PECL intl >= 1.0.0) |
|
10 | - * or PEAR package "I18N_UnicodeNormalizer" |
|
11 | - * |
|
12 | - * ex. binding, configure on connector options |
|
13 | - * $opts = array( |
|
14 | - * 'bind' => array( |
|
15 | - * 'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre' => array( |
|
16 | - * 'Plugin.Normalizer.cmdPreprocess' |
|
17 | - * ), |
|
18 | - * 'upload.presave' => array( |
|
19 | - * 'Plugin.Normalizer.onUpLoadPreSave' |
|
20 | - * ) |
|
21 | - * ), |
|
22 | - * // global configure (optional) |
|
23 | - * 'plugin' => array( |
|
24 | - * 'Normalizer' => array( |
|
25 | - * 'enable' => true, |
|
26 | - * 'nfc' => true, |
|
27 | - * 'nfkc' => true, |
|
28 | - * 'lowercase' => false |
|
29 | - * ) |
|
30 | - * ), |
|
31 | - * // each volume configure (optional) |
|
32 | - * 'roots' => array( |
|
33 | - * array( |
|
34 | - * 'driver' => 'LocalFileSystem', |
|
35 | - * 'path' => '/path/to/files/', |
|
36 | - * 'URL' => 'http://localhost/to/files/' |
|
37 | - * 'plugin' => array( |
|
38 | - * 'Normalizer' => array( |
|
39 | - * 'enable' => true, |
|
40 | - * 'nfc' => true, |
|
41 | - * 'nfkc' => true, |
|
42 | - * 'lowercase' => false |
|
43 | - * ) |
|
44 | - * ) |
|
45 | - * ) |
|
46 | - * ) |
|
47 | - * ); |
|
48 | - * |
|
49 | - * @package elfinder |
|
50 | - * @author Naoki Sawada |
|
51 | - * @license New BSD |
|
52 | - */ |
|
3 | + * elFinder Plugin Normalizer |
|
4 | + * |
|
5 | + * UTF-8 Normalizer of file-name and file-path etc. |
|
6 | + * nfc(NFC): Canonical Decomposition followed by Canonical Composition |
|
7 | + * nfkc(NFKC): Compatibility Decomposition followed by Canonical |
|
8 | + * |
|
9 | + * This plugin require Class "Normalizer" (PHP 5 >= 5.3.0, PECL intl >= 1.0.0) |
|
10 | + * or PEAR package "I18N_UnicodeNormalizer" |
|
11 | + * |
|
12 | + * ex. binding, configure on connector options |
|
13 | + * $opts = array( |
|
14 | + * 'bind' => array( |
|
15 | + * 'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre' => array( |
|
16 | + * 'Plugin.Normalizer.cmdPreprocess' |
|
17 | + * ), |
|
18 | + * 'upload.presave' => array( |
|
19 | + * 'Plugin.Normalizer.onUpLoadPreSave' |
|
20 | + * ) |
|
21 | + * ), |
|
22 | + * // global configure (optional) |
|
23 | + * 'plugin' => array( |
|
24 | + * 'Normalizer' => array( |
|
25 | + * 'enable' => true, |
|
26 | + * 'nfc' => true, |
|
27 | + * 'nfkc' => true, |
|
28 | + * 'lowercase' => false |
|
29 | + * ) |
|
30 | + * ), |
|
31 | + * // each volume configure (optional) |
|
32 | + * 'roots' => array( |
|
33 | + * array( |
|
34 | + * 'driver' => 'LocalFileSystem', |
|
35 | + * 'path' => '/path/to/files/', |
|
36 | + * 'URL' => 'http://localhost/to/files/' |
|
37 | + * 'plugin' => array( |
|
38 | + * 'Normalizer' => array( |
|
39 | + * 'enable' => true, |
|
40 | + * 'nfc' => true, |
|
41 | + * 'nfkc' => true, |
|
42 | + * 'lowercase' => false |
|
43 | + * ) |
|
44 | + * ) |
|
45 | + * ) |
|
46 | + * ) |
|
47 | + * ); |
|
48 | + * |
|
49 | + * @package elfinder |
|
50 | + * @author Naoki Sawada |
|
51 | + * @license New BSD |
|
52 | + */ |
|
53 | 53 | class elFinderPluginNormalizer |
54 | 54 | { |
55 | 55 | private $opts = array(); |
@@ -1,49 +1,49 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * elFinder Plugin AutoResize |
|
4 | - * |
|
5 | - * Auto resize on file upload. |
|
6 | - * |
|
7 | - * ex. binding, configure on connector options |
|
8 | - * $opts = array( |
|
9 | - * 'bind' => array( |
|
10 | - * 'upload.presave' => array( |
|
11 | - * 'Plugin.AutoResize.onUpLoadPreSave' |
|
12 | - * ) |
|
13 | - * ), |
|
14 | - * // global configure (optional) |
|
15 | - * 'plugin' => array( |
|
16 | - * 'PluginAutoResize' => array( |
|
17 | - * 'enable' => true, // For control by volume driver |
|
18 | - * 'maxWidth' => 1024, // Path to Water mark image |
|
19 | - * 'maxHeight' => 1024, // Margin right pixel |
|
20 | - * 'quality' => 95, // JPEG image save quality |
|
21 | - * 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP // Target image formats ( bit-field ) |
|
22 | - * ) |
|
23 | - * ), |
|
24 | - * // each volume configure (optional) |
|
25 | - * 'roots' => array( |
|
26 | - * array( |
|
27 | - * 'driver' => 'LocalFileSystem', |
|
28 | - * 'path' => '/path/to/files/', |
|
29 | - * 'URL' => 'http://localhost/to/files/' |
|
30 | - * 'plugin' => array( |
|
31 | - * 'PluginAutoResize' => array( |
|
32 | - * 'enable' => true, // For control by volume driver |
|
33 | - * 'maxWidth' => 1024, // Path to Water mark image |
|
34 | - * 'maxHeight' => 1024, // Margin right pixel |
|
35 | - * 'quality' => 95, // JPEG image save quality |
|
36 | - * 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP // Target image formats ( bit-field ) |
|
37 | - * ) |
|
38 | - * ) |
|
39 | - * ) |
|
40 | - * ) |
|
41 | - * ); |
|
42 | - * |
|
43 | - * @package elfinder |
|
44 | - * @author Naoki Sawada |
|
45 | - * @license New BSD |
|
46 | - */ |
|
3 | + * elFinder Plugin AutoResize |
|
4 | + * |
|
5 | + * Auto resize on file upload. |
|
6 | + * |
|
7 | + * ex. binding, configure on connector options |
|
8 | + * $opts = array( |
|
9 | + * 'bind' => array( |
|
10 | + * 'upload.presave' => array( |
|
11 | + * 'Plugin.AutoResize.onUpLoadPreSave' |
|
12 | + * ) |
|
13 | + * ), |
|
14 | + * // global configure (optional) |
|
15 | + * 'plugin' => array( |
|
16 | + * 'PluginAutoResize' => array( |
|
17 | + * 'enable' => true, // For control by volume driver |
|
18 | + * 'maxWidth' => 1024, // Path to Water mark image |
|
19 | + * 'maxHeight' => 1024, // Margin right pixel |
|
20 | + * 'quality' => 95, // JPEG image save quality |
|
21 | + * 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP // Target image formats ( bit-field ) |
|
22 | + * ) |
|
23 | + * ), |
|
24 | + * // each volume configure (optional) |
|
25 | + * 'roots' => array( |
|
26 | + * array( |
|
27 | + * 'driver' => 'LocalFileSystem', |
|
28 | + * 'path' => '/path/to/files/', |
|
29 | + * 'URL' => 'http://localhost/to/files/' |
|
30 | + * 'plugin' => array( |
|
31 | + * 'PluginAutoResize' => array( |
|
32 | + * 'enable' => true, // For control by volume driver |
|
33 | + * 'maxWidth' => 1024, // Path to Water mark image |
|
34 | + * 'maxHeight' => 1024, // Margin right pixel |
|
35 | + * 'quality' => 95, // JPEG image save quality |
|
36 | + * 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP // Target image formats ( bit-field ) |
|
37 | + * ) |
|
38 | + * ) |
|
39 | + * ) |
|
40 | + * ) |
|
41 | + * ); |
|
42 | + * |
|
43 | + * @package elfinder |
|
44 | + * @author Naoki Sawada |
|
45 | + * @license New BSD |
|
46 | + */ |
|
47 | 47 | class elFinderPluginAutoResize { |
48 | 48 | |
49 | 49 | private $opts = array(); |
@@ -1,55 +1,55 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * elFinder Plugin Watermark |
|
4 | - * |
|
5 | - * Print watermark on file upload. |
|
6 | - * |
|
7 | - * ex. binding, configure on connector options |
|
8 | - * $opts = array( |
|
9 | - * 'bind' => array( |
|
10 | - * 'upload.presave' => array( |
|
11 | - * 'Plugin.Watermark.onUpLoadPreSave' |
|
12 | - * ) |
|
13 | - * ), |
|
14 | - * // global configure (optional) |
|
15 | - * 'plugin' => array( |
|
16 | - * 'Watermark' => array( |
|
17 | - * 'enable' => true, // For control by volume driver |
|
18 | - * 'source' => 'logo.png', // Path to Water mark image |
|
19 | - * 'marginRight' => 5, // Margin right pixel |
|
20 | - * 'marginBottom' => 5, // Margin bottom pixel |
|
21 | - * 'quality' => 95, // JPEG image save quality |
|
22 | - * 'transparency' => 70, // Water mark image transparency ( other than PNG ) |
|
23 | - * 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field ) |
|
24 | - * 'targetMinPixel' => 200 // Target image minimum pixel size |
|
25 | - * ) |
|
26 | - * ), |
|
27 | - * // each volume configure (optional) |
|
28 | - * 'roots' => array( |
|
29 | - * array( |
|
30 | - * 'driver' => 'LocalFileSystem', |
|
31 | - * 'path' => '/path/to/files/', |
|
32 | - * 'URL' => 'http://localhost/to/files/' |
|
33 | - * 'plugin' => array( |
|
34 | - * 'Watermark' => array( |
|
35 | - * 'enable' => true, // For control by volume driver |
|
36 | - * 'source' => 'logo.png', // Path to Water mark image |
|
37 | - * 'marginRight' => 5, // Margin right pixel |
|
38 | - * 'marginBottom' => 5, // Margin bottom pixel |
|
39 | - * 'quality' => 95, // JPEG image save quality |
|
40 | - * 'transparency' => 70, // Water mark image transparency ( other than PNG ) |
|
41 | - * 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field ) |
|
42 | - * 'targetMinPixel' => 200 // Target image minimum pixel size |
|
43 | - * ) |
|
44 | - * ) |
|
45 | - * ) |
|
46 | - * ) |
|
47 | - * ); |
|
48 | - * |
|
49 | - * @package elfinder |
|
50 | - * @author Naoki Sawada |
|
51 | - * @license New BSD |
|
52 | - */ |
|
3 | + * elFinder Plugin Watermark |
|
4 | + * |
|
5 | + * Print watermark on file upload. |
|
6 | + * |
|
7 | + * ex. binding, configure on connector options |
|
8 | + * $opts = array( |
|
9 | + * 'bind' => array( |
|
10 | + * 'upload.presave' => array( |
|
11 | + * 'Plugin.Watermark.onUpLoadPreSave' |
|
12 | + * ) |
|
13 | + * ), |
|
14 | + * // global configure (optional) |
|
15 | + * 'plugin' => array( |
|
16 | + * 'Watermark' => array( |
|
17 | + * 'enable' => true, // For control by volume driver |
|
18 | + * 'source' => 'logo.png', // Path to Water mark image |
|
19 | + * 'marginRight' => 5, // Margin right pixel |
|
20 | + * 'marginBottom' => 5, // Margin bottom pixel |
|
21 | + * 'quality' => 95, // JPEG image save quality |
|
22 | + * 'transparency' => 70, // Water mark image transparency ( other than PNG ) |
|
23 | + * 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field ) |
|
24 | + * 'targetMinPixel' => 200 // Target image minimum pixel size |
|
25 | + * ) |
|
26 | + * ), |
|
27 | + * // each volume configure (optional) |
|
28 | + * 'roots' => array( |
|
29 | + * array( |
|
30 | + * 'driver' => 'LocalFileSystem', |
|
31 | + * 'path' => '/path/to/files/', |
|
32 | + * 'URL' => 'http://localhost/to/files/' |
|
33 | + * 'plugin' => array( |
|
34 | + * 'Watermark' => array( |
|
35 | + * 'enable' => true, // For control by volume driver |
|
36 | + * 'source' => 'logo.png', // Path to Water mark image |
|
37 | + * 'marginRight' => 5, // Margin right pixel |
|
38 | + * 'marginBottom' => 5, // Margin bottom pixel |
|
39 | + * 'quality' => 95, // JPEG image save quality |
|
40 | + * 'transparency' => 70, // Water mark image transparency ( other than PNG ) |
|
41 | + * 'targetType' => IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field ) |
|
42 | + * 'targetMinPixel' => 200 // Target image minimum pixel size |
|
43 | + * ) |
|
44 | + * ) |
|
45 | + * ) |
|
46 | + * ) |
|
47 | + * ); |
|
48 | + * |
|
49 | + * @package elfinder |
|
50 | + * @author Naoki Sawada |
|
51 | + * @license New BSD |
|
52 | + */ |
|
53 | 53 | class elFinderPluginWatermark { |
54 | 54 | |
55 | 55 | private $opts = array(); |