<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[21527] trunk/wp-includes/functions.php: Fix MS Office mime types.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/21527">21527</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2012-08-15 16:48:36 +0000 (Wed, 15 Aug 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix MS Office mime types. Group the mime list in get_allowed_mime_types() by type. Props hebbet, markel, SergeyBiryukov. fixes <a href="http://core.trac.wordpress.org/ticket/17117">#17117</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (21526 => 21527)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2012-08-15 16:06:05 UTC (rev 21526)
+++ trunk/wp-includes/functions.php        2012-08-15 16:48:36 UTC (rev 21527)
</span><span class="lines">@@ -1642,13 +1642,13 @@
</span><span class="cx"> */
</span><span class="cx"> function wp_ext2type( $ext ) {
</span><span class="cx">         $ext2type = apply_filters( 'ext2type', array(
</span><del>-                'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
-                'video' => array( 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),
-                'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'rtf', 'wp', 'wpd' ),
-                'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsb', 'xlsm' ),
-                'interactive' => array( 'key', 'ppt', 'pptx', 'pptm', 'odp', 'swf' ),
</del><ins>+                'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
+                'video' => array( 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),
+                'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'rtf', 'wp', 'wpd' ),
+                'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ),
+                'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
</ins><span class="cx">                 'text' => array( 'asc', 'csv', 'tsv', 'txt' ),
</span><del>-                'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ),
</del><ins>+                'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ),
</ins><span class="cx">                 'code' => array( 'css', 'htm', 'html', 'php', 'js' ),
</span><span class="cx">         ));
</span><span class="cx">         foreach ( $ext2type as $type => $exts )
</span><span class="lines">@@ -1767,18 +1767,24 @@
</span><span class="cx">         if ( !$mimes ) {
</span><span class="cx">                 // Accepted MIME types are set here as PCRE unless provided.
</span><span class="cx">                 $mimes = apply_filters( 'upload_mimes', array(
</span><ins>+                // Image formats
</ins><span class="cx">                 'jpg|jpeg|jpe' => 'image/jpeg',
</span><span class="cx">                 'gif' => 'image/gif',
</span><span class="cx">                 'png' => 'image/png',
</span><span class="cx">                 'bmp' => 'image/bmp',
</span><span class="cx">                 'tif|tiff' => 'image/tiff',
</span><span class="cx">                 'ico' => 'image/x-icon',
</span><ins>+                // Video formats
</ins><span class="cx">                 'asf|asx|wax|wmv|wmx' => 'video/asf',
</span><span class="cx">                 'avi' => 'video/avi',
</span><span class="cx">                 'divx' => 'video/divx',
</span><span class="cx">                 'flv' => 'video/x-flv',
</span><span class="cx">                 'mov|qt' => 'video/quicktime',
</span><span class="cx">                 'mpeg|mpg|mpe' => 'video/mpeg',
</span><ins>+                'mp4|m4v' => 'video/mp4',
+                'ogv' => 'video/ogg',
+                'mkv' => 'video/x-matroska',
+                // Text formats
</ins><span class="cx">                 'txt|asc|c|cc|h' => 'text/plain',
</span><span class="cx">                 'csv' => 'text/csv',
</span><span class="cx">                 'tsv' => 'text/tab-separated-values',
</span><span class="lines">@@ -1786,30 +1792,18 @@
</span><span class="cx">                 'rtx' => 'text/richtext',
</span><span class="cx">                 'css' => 'text/css',
</span><span class="cx">                 'htm|html' => 'text/html',
</span><ins>+                // Audio formats
</ins><span class="cx">                 'mp3|m4a|m4b' => 'audio/mpeg',
</span><del>-                'mp4|m4v' => 'video/mp4',
</del><span class="cx">                 'ra|ram' => 'audio/x-realaudio',
</span><span class="cx">                 'wav' => 'audio/wav',
</span><span class="cx">                 'ogg|oga' => 'audio/ogg',
</span><del>-                'ogv' => 'video/ogg',
</del><span class="cx">                 'mid|midi' => 'audio/midi',
</span><span class="cx">                 'wma' => 'audio/wma',
</span><span class="cx">                 'mka' => 'audio/x-matroska',
</span><del>-                'mkv' => 'video/x-matroska',
</del><ins>+                // Misc application formats
</ins><span class="cx">                 'rtf' => 'application/rtf',
</span><span class="cx">                 'js' => 'application/javascript',
</span><span class="cx">                 'pdf' => 'application/pdf',
</span><del>-                'doc|docx' => 'application/msword',
-                'pot|pps|ppt|pptx|ppam|pptm|sldm|ppsm|potm' => 'application/vnd.ms-powerpoint',
-                'wri' => 'application/vnd.ms-write',
-                'xla|xls|xlsx|xlt|xlw|xlam|xlsb|xlsm|xltm' => 'application/vnd.ms-excel',
-                'mdb' => 'application/vnd.ms-access',
-                'mpp' => 'application/vnd.ms-project',
-                'docm|dotm' => 'application/vnd.ms-word',
-                'pptx|sldx|ppsx|potx' => 'application/vnd.openxmlformats-officedocument.presentationml',
-                'xlsx|xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml',
-                'docx|dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml',
-                'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
</del><span class="cx">                 'swf' => 'application/x-shockwave-flash',
</span><span class="cx">                 'class' => 'application/java',
</span><span class="cx">                 'tar' => 'application/x-tar',
</span><span class="lines">@@ -1818,7 +1812,34 @@
</span><span class="cx">                 'rar' => 'application/rar',
</span><span class="cx">                 '7z' => 'application/x-7z-compressed',
</span><span class="cx">                 'exe' => 'application/x-msdownload',
</span><del>-                // openoffice formats
</del><ins>+                // MS Office formats
+                'doc' => 'application/msword',
+                'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
+                'wri' => 'application/vnd.ms-write',
+                'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
+                'mdb' => 'application/vnd.ms-access',
+                'mpp' => 'application/vnd.ms-project',
+                'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+                'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
+                'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
+                'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
+                'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+                'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
+                'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
+                'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
+                'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12',
+                'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
+                'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
+                'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
+                'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
+                'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
+                'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
+                'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
+                'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
+                'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
+                'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12',
+                'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
+                // OpenOffice formats
</ins><span class="cx">                 'odt' => 'application/vnd.oasis.opendocument.text',
</span><span class="cx">                 'odp' => 'application/vnd.oasis.opendocument.presentation',
</span><span class="cx">                 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
</span><span class="lines">@@ -1826,7 +1847,7 @@
</span><span class="cx">                 'odc' => 'application/vnd.oasis.opendocument.chart',
</span><span class="cx">                 'odb' => 'application/vnd.oasis.opendocument.database',
</span><span class="cx">                 'odf' => 'application/vnd.oasis.opendocument.formula',
</span><del>-                // wordperfect formats
</del><ins>+                // WordPerfect formats
</ins><span class="cx">                 'wp|wpd' => 'application/wordperfect',
</span><span class="cx">                 ) );
</span><span class="cx">         }
</span></span></pre>
</div>
</div>
</body>
</html>