- Timestamp:
- 2011/11/24 15:15:19 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_11-dev/data/class/helper/SC_Helper_Mobile.php
r21185 r21354 35 35 class SC_Helper_Mobile { 36 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 37 81 /** 38 82 * EC-CUBE がサポートする携帯端末かどうかをチェックする。 … … 238 282 ob_start(array('SC_MobileImage_Ex', 'handler')); 239 283 240 // 全角カタカナを半角カタカナに変換する。 241 ob_start(create_function('$buffer', 'return mb_convert_kana($buffer, "k", "SJIS-win");')); 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 } 242 289 243 290 // 内部エンコーディングから Shift JIS に変換する。 … … 460 507 return false; 461 508 } 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 } 462 525 } 463 526 ?>
Note: See TracChangeset
for help on using the changeset viewer.
