wp_match_mime_types [ WordPress Function ]
wp_match_mime_types ( $wildcard_mime_types, $real_mime_types )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: wp_mime_type_icon, wp_post_mime_type_where, sanitize_mime_type, get_post_mime_types, wp_cache_reset
Check a MIME-Type against a list.
If the wildcard_mime_types parameter is a string, it must be comma separated list. If the real_mime_types is a string, it is also comma separated to create the list.
Source
<?php
function wp_match_mime_types($wildcard_mime_types, $real_mime_types) {
$matches = array();
if ( is_string($wildcard_mime_types) )
$wildcard_mime_types = array_map('trim', explode(',', $wildcard_mime_types));
if ( is_string($real_mime_types) )
$real_mime_types = array_map('trim', explode(',', $real_mime_types));
$wild = '[-._a-z0-9]*';
foreach ( (array) $wildcard_mime_types as $type ) {
$type = str_replace('*', $wild, $type);
$patternses[1][$type] = "^$type$";
if ( false === strpos($type, '/') ) {
$patternses[2][$type] = "^$type/";
$patternses[3][$type] = $type;
}
}
asort($patternses);
foreach ( $patternses as $patterns )
foreach ( $patterns as $type => $pattern )
foreach ( (array) $real_mime_types as $real )
if ( preg_match("#$pattern#", $real) && ( empty($matches[$type]) || false === array_search($real, $matches[$type]) ) )
$matches[$type][] = $real;
return $matches;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- wp_match_mime_types (WordPress Function) - WPSeek.com
WordPress lookup for wp_match_mime_types, a WordPress Function. wpseek. com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - wp_match_mime_types
Function and Method Cross Reference. wp_match_mime_types(). Defined at: /wp -includes/post.php -> line 1919. Referenced 8 times: /wp-includes/post.php ...
phpxref.ftwr.co.uk - #16635 (Handle grouped MIME-Types) – WordPress Trac
$type = 'application/zip|application/x-tar';. This works ok in wp_match_mime_types but fails in wp_post_mime_type_where. I've found two possible solutions: ...
core.trac.wordpress.org - post.php
Jul 16, 2009 ... wp_is_post_revision(), Determines if the specified post is a revision. wp_match_mime_types(), Check a MIME-Type against a list.
www.tig12.net