芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/shimoda/vendor/ralouphie/mimey/src/MimeMappingBuilder.php
mapping = $mapping; } /** * Add a conversion. * * @param string $mime The MIME type. * @param string $extension The extension. * @param bool $prepend_extension Whether this should be the preferred conversion for MIME type to extension. * @param bool $prepend_mime Whether this should be the preferred conversion for extension to MIME type. */ public function add($mime, $extension, $prepend_extension = true, $prepend_mime = true) { $existing_extensions = empty($this->mapping['extensions'][$mime]) ? array() : $this->mapping['extensions'][$mime]; $existing_mimes = empty($this->mapping['mimes'][$extension]) ? array() : $this->mapping['mimes'][$extension]; if ($prepend_extension) { array_unshift($existing_extensions, $extension); } else { $existing_extensions[] = $extension; } if ($prepend_mime) { array_unshift($existing_mimes, $mime); } else { $existing_mimes[] = $mime; } $this->mapping['extensions'][$mime] = array_unique($existing_extensions); $this->mapping['mimes'][$extension] = array_unique($existing_mimes); } /** * @return array The mapping. */ public function getMapping() { return $this->mapping; } /** * Compile the current mapping to PHP. * * @return string The compiled PHP code to save to a file. */ public function compile() { $mapping = $this->getMapping(); $mapping_export = var_export($mapping, true); return "compile(), $flags, $context); } /** * Create a new mapping builder based on the built-in types. * * @return MimeMappingBuilder A mapping builder with built-in types loaded. */ public static function create() { return self::load(dirname(__DIR__) . '/mime.types.php'); } /** * Create a new mapping builder based on types from a file. * * @param string $file The compiled PHP file to load. * * @return MimeMappingBuilder A mapping builder with types loaded from a file. */ public static function load($file) { return new self(require($file)); } /** * Create a new mapping builder that has no types defined. * * @return MimeMappingBuilder A mapping builder with no types defined. */ public static function blank() { return new self(array('mimes' => array(), 'extensions' => array())); } }