本文整理汇总了PHP中elFinderVolumeDriver::mimetypesLoaded方法的典型用法代码示例。如果您正苦于以下问题:PHP elFinderVolumeDriver::mimetypesLoaded方法的具体用法?PHP elFinderVolumeDriver::mimetypesLoaded怎么用?PHP elFinderVolumeDriver::mimetypesLoaded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elFinderVolumeDriver
的用法示例。
在下文中一共展示了elFinderVolumeDriver::mimetypesLoaded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mount
public function mount(array $veb4112b6a6b76c8a84808a40baa94769)
{
if (empty($veb4112b6a6b76c8a84808a40baa94769['path'])) {
return false;
}
$this->options = array_merge($this->options, $veb4112b6a6b76c8a84808a40baa94769);
$this->id = $this->driverId . (!empty($this->options['id']) ? $this->options['id'] : elFinder::$volumesCnt++) . '_';
$this->root = $this->_normpath($this->options['path']);
$this->separator = isset($this->options['separator']) ? $this->options['separator'] : DIRECTORY_SEPARATOR;
$this->defaults = array('read' => isset($this->options['defaults']['read']) ? !!$this->options['defaults']['read'] : true, 'write' => isset($this->options['defaults']['write']) ? !!$this->options['defaults']['write'] : true, 'locked' => false, 'hidden' => false);
$this->attributes[] = array('pattern' => '~^' . preg_quote(DIRECTORY_SEPARATOR) . '$~', 'locked' => true, 'hidden' => false);
if (!empty($this->options['attributes']) && is_array($this->options['attributes'])) {
foreach ($this->options['attributes'] as $v0cc175b9c0f1b6a831c399e269772661) {
if (!empty($v0cc175b9c0f1b6a831c399e269772661['pattern']) || count($v0cc175b9c0f1b6a831c399e269772661) > 1) {
$this->attributes[] = $v0cc175b9c0f1b6a831c399e269772661;
}
}
}
if (!empty($this->options['accessControl'])) {
if (is_string($this->options['accessControl']) && function_exists($this->options['accessControl'])) {
$this->access = $this->options['accessControl'];
} elseif (is_array($this->options['accessControl']) && count($this->options['accessControl']) > 1 && is_object($this->options['accessControl'][0]) && method_exists($this->options['accessControl'][0], $this->options['accessControl'][1])) {
$this->access = array($this->options['accessControl'][0], $this->options['accessControl'][1]);
}
}
if (!$this->init()) {
return false;
}
$this->today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$this->yesterday = $this->today - 86400;
$this->uploadAllow = isset($this->options['uploadAllow']) && is_array($this->options['uploadAllow']) ? $this->options['uploadAllow'] : array();
$this->uploadDeny = isset($this->options['uploadDeny']) && is_array($this->options['uploadDeny']) ? $this->options['uploadDeny'] : array();
$v78f0805fa8ffadabda721fdaf85b3ca9 = explode(',', isset($this->options['uploadOrder']) ? $this->options['uploadOrder'] : 'deny,allow');
$this->uploadOrder = array(trim($v78f0805fa8ffadabda721fdaf85b3ca9[0]), trim($v78f0805fa8ffadabda721fdaf85b3ca9[1]));
if (!empty($this->options['uploadMaxSize'])) {
$vf7bd60b75b29d79b660a2859395c1a24 = '' . $this->options['uploadMaxSize'];
$v3e34bdebd9bd5edda27e8728904a2552 = strtolower(substr($vf7bd60b75b29d79b660a2859395c1a24, strlen($vf7bd60b75b29d79b660a2859395c1a24) - 1));
$v7b8b965ad4bca0e41ab51de7b31363a1 = 1;
switch ($v3e34bdebd9bd5edda27e8728904a2552) {
case 'k':
$v7b8b965ad4bca0e41ab51de7b31363a1 = 1024;
break;
case 'm':
$v7b8b965ad4bca0e41ab51de7b31363a1 = 1048576;
break;
case 'g':
$v7b8b965ad4bca0e41ab51de7b31363a1 = 1073741824;
}
$this->uploadMaxSize = intval($vf7bd60b75b29d79b660a2859395c1a24) * $v7b8b965ad4bca0e41ab51de7b31363a1;
}
$this->disabled = isset($this->options['disabled']) && is_array($this->options['disabled']) ? $this->options['disabled'] : array();
$this->cryptLib = $this->options['cryptLib'];
$this->mimeDetect = $this->options['mimeDetect'];
$v599dcce2998a6b40b1e38e8c6006cb0a = strtolower($this->options['mimeDetect']);
$v599dcce2998a6b40b1e38e8c6006cb0a = preg_match('/^(finfo|mime_content_type|internal|auto)$/i', $v599dcce2998a6b40b1e38e8c6006cb0a) ? $v599dcce2998a6b40b1e38e8c6006cb0a : 'auto';
$v2f0056df010e0231e4cca0e382df44fc = '/text\\/x\\-(php|c\\+\\+)/';
if (($v599dcce2998a6b40b1e38e8c6006cb0a == 'finfo' || $v599dcce2998a6b40b1e38e8c6006cb0a == 'auto') && class_exists('finfo') && preg_match($v2f0056df010e0231e4cca0e382df44fc, array_shift(explode(';', @finfo_file(finfo_open(FILEINFO_MIME), __FILE__))))) {
$v599dcce2998a6b40b1e38e8c6006cb0a = 'finfo';
} elseif (($v599dcce2998a6b40b1e38e8c6006cb0a == 'mime_content_type' || $v599dcce2998a6b40b1e38e8c6006cb0a == 'auto') && function_exists('mime_content_type') && preg_match($v2f0056df010e0231e4cca0e382df44fc, array_shift(explode(';', mime_content_type(__FILE__))))) {
$v599dcce2998a6b40b1e38e8c6006cb0a = 'mime_content_type';
} else {
$v599dcce2998a6b40b1e38e8c6006cb0a = 'internal';
}
$this->mimeDetect = $v599dcce2998a6b40b1e38e8c6006cb0a;
if ($this->mimeDetect == 'internal' && !self::$mimetypesLoaded) {
self::$mimetypesLoaded = true;
$this->mimeDetect = 'internal';
$v8c7dd922ad47494fc02c388e12c00eac = false;
if (!empty($this->options['mimefile']) && file_exists($this->options['mimefile'])) {
$v8c7dd922ad47494fc02c388e12c00eac = $this->options['mimefile'];
} elseif (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types')) {
$v8c7dd922ad47494fc02c388e12c00eac = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types';
} elseif (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mime.types')) {
$v8c7dd922ad47494fc02c388e12c00eac = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mime.types';
}
if ($v8c7dd922ad47494fc02c388e12c00eac && file_exists($v8c7dd922ad47494fc02c388e12c00eac)) {
$v9e7553e4134fc3598a792415f7cd7b6b = file($v8c7dd922ad47494fc02c388e12c00eac);
foreach ($v9e7553e4134fc3598a792415f7cd7b6b as $v2aa6fb0f7ebb71c0ba782d04b2a8f167 => $v6438c669e0d0de98e6929c2cc0fac474) {
if (!preg_match('/^\\s*#/', $v6438c669e0d0de98e6929c2cc0fac474)) {
$vd02a169f33469c888396a24dd9d9f1c6 = preg_split('/\\s+/', $v6438c669e0d0de98e6929c2cc0fac474, -1, PREG_SPLIT_NO_EMPTY);
for ($v865c0c0b4ab0e063e5caa3387c1a8741 = 1, $vf7bd60b75b29d79b660a2859395c1a24 = count($vd02a169f33469c888396a24dd9d9f1c6); $v865c0c0b4ab0e063e5caa3387c1a8741 < $vf7bd60b75b29d79b660a2859395c1a24; $v865c0c0b4ab0e063e5caa3387c1a8741++) {
if (!isset(self::$mimetypes[$vd02a169f33469c888396a24dd9d9f1c6[$v865c0c0b4ab0e063e5caa3387c1a8741]])) {
self::$mimetypes[$vd02a169f33469c888396a24dd9d9f1c6[$v865c0c0b4ab0e063e5caa3387c1a8741]] = $vd02a169f33469c888396a24dd9d9f1c6[0];
} else {
}
}
}
}
}
}
if (!$this->_isDir($this->root)) {
return false;
}
$vecae13117d6f0584c25a9da6c8f8415e = $this->attr($this->root, 'read');
if (!$vecae13117d6f0584c25a9da6c8f8415e && !$this->attr($this->root, 'write')) {
return false;
}
if ($vecae13117d6f0584c25a9da6c8f8415e) {
if ($this->options['startPath']) {
$vd6fe1d0be6347b8ef2427fa629c04485 = $this->_normpath($this->options['startPath']);
//.........这里部分代码省略.........
示例2: mount
/**
* "Mount" volume.
* Return true if volume available for read or write,
* false - otherwise
*
* @return bool
* @author Dmitry (dio) Levashov
* @author Alexey Sukhotin
**/
public function mount(array $opts)
{
if (!isset($opts['path']) || $opts['path'] === '') {
return false;
}
$this->options = array_merge($this->options, $opts);
$this->id = $this->driverId . (!empty($this->options['id']) ? $this->options['id'] : elFinder::$volumesCnt++) . '_';
$this->root = $this->_normpath($this->options['path']);
$this->separator = isset($this->options['separator']) ? $this->options['separator'] : DIRECTORY_SEPARATOR;
// default file attribute
$this->defaults = array('read' => isset($this->options['defaults']['read']) ? !!$this->options['defaults']['read'] : true, 'write' => isset($this->options['defaults']['write']) ? !!$this->options['defaults']['write'] : true, 'locked' => false, 'hidden' => false);
// root attributes
$this->attributes[] = array('pattern' => '~^' . preg_quote(DIRECTORY_SEPARATOR) . '$~', 'locked' => true, 'hidden' => false);
// set files attributes
if (!empty($this->options['attributes']) && is_array($this->options['attributes'])) {
foreach ($this->options['attributes'] as $a) {
// attributes must contain pattern and at least one rule
if (!empty($a['pattern']) || count($a) > 1) {
$this->attributes[] = $a;
}
}
}
if (!empty($this->options['accessControl'])) {
if (is_string($this->options['accessControl']) && function_exists($this->options['accessControl'])) {
$this->access = $this->options['accessControl'];
} elseif (is_array($this->options['accessControl']) && count($this->options['accessControl']) > 1 && is_object($this->options['accessControl'][0]) && method_exists($this->options['accessControl'][0], $this->options['accessControl'][1])) {
$this->access = array($this->options['accessControl'][0], $this->options['accessControl'][1]);
}
}
$this->today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$this->yesterday = $this->today - 86400;
// debug($this->attributes);
if (!$this->init()) {
return false;
}
// check some options is arrays
$this->uploadAllow = isset($this->options['uploadAllow']) && is_array($this->options['uploadAllow']) ? $this->options['uploadAllow'] : array();
$this->uploadDeny = isset($this->options['uploadDeny']) && is_array($this->options['uploadDeny']) ? $this->options['uploadDeny'] : array();
if (is_string($this->options['uploadOrder'])) {
// telephat_mode on, compatibility with 1.x
$parts = explode(',', isset($this->options['uploadOrder']) ? $this->options['uploadOrder'] : 'deny,allow');
$this->uploadOrder = array(trim($parts[0]), trim($parts[1]));
} else {
// telephat_mode off
$this->uploadOrder = $this->options['uploadOrder'];
}
if (!empty($this->options['uploadMaxSize'])) {
$size = '' . $this->options['uploadMaxSize'];
$unit = strtolower(substr($size, strlen($size) - 1));
$n = 1;
switch ($unit) {
case 'k':
$n = 1024;
break;
case 'm':
$n = 1048576;
break;
case 'g':
$n = 1073741824;
}
$this->uploadMaxSize = intval($size) * $n;
}
$this->disabled = isset($this->options['disabled']) && is_array($this->options['disabled']) ? $this->options['disabled'] : array();
$this->cryptLib = $this->options['cryptLib'];
$this->mimeDetect = $this->options['mimeDetect'];
// find available mimetype detect method
$type = strtolower($this->options['mimeDetect']);
$type = preg_match('/^(finfo|mime_content_type|internal|auto)$/i', $type) ? $type : 'auto';
$regexp = '/text\\/x\\-(php|c\\+\\+)/';
if (($type == 'finfo' || $type == 'auto') && class_exists('finfo') && preg_match($regexp, array_shift(explode(';', @finfo_file(finfo_open(FILEINFO_MIME), __FILE__))))) {
$type = 'finfo';
$this->finfo = finfo_open(FILEINFO_MIME);
} elseif (($type == 'mime_content_type' || $type == 'auto') && function_exists('mime_content_type') && preg_match($regexp, array_shift(explode(';', mime_content_type(__FILE__))))) {
$type = 'mime_content_type';
} else {
$type = 'internal';
}
$this->mimeDetect = $type;
// load mimes from external file for mimeDetect == 'internal'
// based on Alexey Sukhotin idea and patch: http://elrte.org/redmine/issues/163
// file must be in file directory or in parent one
if ($this->mimeDetect == 'internal' && !self::$mimetypesLoaded) {
self::$mimetypesLoaded = true;
$this->mimeDetect = 'internal';
$file = false;
if (!empty($this->options['mimefile']) && file_exists($this->options['mimefile'])) {
$file = $this->options['mimefile'];
} elseif (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types')) {
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types';
} elseif (file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mime.types')) {
$file = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'mime.types';
//.........这里部分代码省略.........
示例3: mimetypeInternalDetect
/**
* Detect file mimetype using "internal" method or Loading mime.types with $path = ''
*
* @param string $path file path
* @return string
* @author Dmitry (dio) Levashov
**/
protected static function mimetypeInternalDetect($path = '')
{
// load default MIME table file "mime.types"
if (!elFinderVolumeDriver::$mimetypesLoaded) {
elFinderVolumeDriver::$mimetypesLoaded = true;
$file = elFinder::$defaultMimefile;
if ($file === '' || !is_readable($file)) {
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mime.types';
}
if (is_readable($file)) {
$mimecf = file($file);
foreach ($mimecf as $line_num => $line) {
if (!preg_match('/^\\s*#/', $line)) {
$mime = preg_split('/\\s+/', $line, -1, PREG_SPLIT_NO_EMPTY);
for ($i = 1, $size = count($mime); $i < $size; $i++) {
if (!isset(elFinderVolumeDriver::$mimetypes[$mime[$i]])) {
elFinderVolumeDriver::$mimetypes[$mime[$i]] = $mime[0];
}
}
}
}
}
}
$ext = '';
if ($path) {
$pinfo = pathinfo($path);
$ext = isset($pinfo['extension']) ? strtolower($pinfo['extension']) : '';
}
return $ext && isset(elFinderVolumeDriver::$mimetypes[$ext]) ? elFinderVolumeDriver::$mimetypes[$ext] : 'unknown';
}