Exemple #1
0
 /**
  * @param string $sFontName
  * @return string
  */
 public function GetFont($sFontName)
 {
     $sFontFileName = $this->oPluginManager->GetFont($this->sName, $sFontName);
     if ($sFontFileName) {
         $sContentType = \MailSo\Base\Utils::MimeContentType($sFontFileName);
         $sType = \MailSo\Base\Utils::ContentTypeType($sContentType, $sFontFileName);
         if ('font' === $sType) {
             @header('Content-Type: ' . $sContentType);
             //				@header('Content-Disposition: attachment; filename="' . $sFontName . '"');
             $sFilePath = $sFontFileName;
             if (file_exists($sFilePath)) {
                 return file_get_contents($sFilePath);
             } else {
                 if (function_exists('http_response_code')) {
                     \http_response_code(404);
                 } else {
                     \header("HTTP/1.1 404 Not Found", true, 404);
                 }
             }
         }
     }
 }
 /**
  * @return bool
  */
 public function IsDoc()
 {
     return 'doc' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->FileName());
 }
Exemple #3
0
 /**
  * @param string $sFileName
  * @return string
  */
 public function GetImage($sFileName)
 {
     $sContentType = \MailSo\Base\Utils::MimeContentType($sFileName);
     if ('image' === \MailSo\Base\Utils::ContentTypeType($sContentType, $sFileName)) {
         @header('Content-Type: ' . $sContentType);
         $sFilePath = $this->GetPath() . '/images/' . $sFileName;
         if (file_exists($sFilePath)) {
             return file_get_contents($sFilePath);
         } else {
             if (function_exists('http_response_code')) {
                 \http_response_code(404);
             } else {
                 \header("HTTP/1.1 404 Not Found", true, 404);
             }
         }
     }
 }