Exemplo n.º 1
0
 /**
  * Autodetect a file's MIME-type
  *
  * This function may be called staticly.
  *
  * @param string $file   Path to the file to get the type of
  * @param bool   $params Append MIME parameters if true
  *
  * @return string $file's MIME-type on success, PEAR_Error otherwise
  *
  * @since 1.0.0beta1
  * @static
  */
 function autoDetect($file, $params = false)
 {
     $isStatic = !(isset($this) && get_class($this) == __CLASS__);
     if ($isStatic) {
         $t = new MIME_Type();
         return $t->_autoDetect($file, $params);
     } else {
         $type = $this->_autoDetect($file, $params);
         if (!$type instanceof PEAR_Error) {
             $this->parse($type);
         }
         return $type;
     }
 }