- Timestamp:
- 2012/01/17 16:21:07 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_11-dev/data/class/helper/SC_Helper_Mobile.php
r21402 r21405 34 34 */ 35 35 class SC_Helper_Mobile { 36 37 /** 基本MimeType */38 var $defaultMimeType = 'application/force-download';39 40 /** 拡張MimeType配列41 * Application/octet-streamで対応出来ないファイルタイプのみ拡張子をキーに記述する42 * 拡張子が本配列に存在しない場合は application/force-download を利用する */43 var $arrMimetypes = array(44 'html'=> 'text/html',45 'css' => 'text/css',46 'hdml'=> 'text/x-hdml',47 'mmf' => 'application/x-smaf',48 'jpeg'=> 'image/jpeg',49 'jpg' => 'image/jpeg',50 'gif' => 'image/gif',51 'png' => 'image/png',52 'bmp' => 'image/x-ms-bmp',53 'amc' => 'application/x-mpeg',54 '3g2' => 'video/3gpp2',55 '3gp' => 'video/3gpp',56 'jam' => 'application/x-jam',57 'kjx' => 'application/x-kjx',58 'jar' => 'application/java-archive',59 'jad' => 'text/vnd.sun.j2me.app-descriptor',60 'swf' => 'application/x-shockwave-flash',61 'dmt' => 'application/x-decomail-template',62 'khm' => 'application/x-kddi-htmlmail',63 'hmt' => 'application/x-htmlmail-template',64 'ucm' => 'application/x-ucf-package',65 'ucp' => 'application/x-ucf-package',66 'pdf' => 'application/pdf',67 'wma' => 'audio/x-ms-wma',68 'asf' => 'video/x-ms-asf',69 'wax' => 'audio/x-ms-wax',70 'wvx' => 'video/x-ms-wvx',71 'wmv' => 'video/x-ms-wmv',72 'asx' => 'video/asx',73 'txt' => 'text/plain',74 'exe' => 'application/octet-stream',75 'zip' => 'application/zip',76 'doc' => 'application/msword',77 'xls' => 'application/vnd.ms-excel',78 'ppt' => 'application/vnd.ms-powerpoint'79 );80 36 81 37 /** … … 282 238 ob_start(array('SC_MobileImage_Ex', 'handler')); 283 239 284 //download.phpに対してカタカナ変換をするとファイルが壊れてしまうため回避する 285 if ($_SERVER['SCRIPT_FILENAME'] != HTML_REALDIR . "mypage/download.php") { 286 // 全角カタカナを半角カタカナに変換する。 287 ob_start(create_function('$buffer', 'return mb_convert_kana($buffer, "k", "SJIS-win");')); 288 } 240 // 全角カタカナを半角カタカナに変換する。 241 ob_start(create_function('$buffer', 'return mb_convert_kana($buffer, "k", "SJIS-win");')); 289 242 290 243 // 内部エンコーディングから Shift JIS に変換する。 … … 507 460 return false; 508 461 } 509 510 /**511 * ファイルのMIMEタイプを判別する512 *513 * @param string $filename ファイル名514 * @return string MIMEタイプ515 */516 function getMimeType($filename) {517 //ファイルの拡張子からコンテンツタイプを決定する518 $file_extension = strtolower(substr(strrchr($filename,"."),1));519 $mime_type = $this->defaultMimeType;520 if(array_key_exists($file_extension, $this->arrMimetypes)){521 $mime_type = $this->arrMimetypes[$file_extension];522 }523 return $mime_type;524 }525 462 } 526 463 ?>
Note: See TracChangeset
for help on using the changeset viewer.