Changeset 28553
- Timestamp:
- 05/22/2014 09:35:36 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-media-list-table.php
r28497 r28553 65 65 $class = ' class="current"'; 66 66 if ( !empty( $num_posts[$mime_type] ) ) 67 $type_links[$mime_type] = "<a href='upload.php?post_mime_type=$mime_type'$class>". sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';67 $type_links[$mime_type] = '<a href="upload.php?post_mime_type=' . urlencode( $mime_type ) . '"' . $class . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>'; 68 68 } 69 69 $type_links['detached'] = '<a href="upload.php?detached=1"' . ( $this->detached ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached <span class="count">(%s)</span>', 'Unattached <span class="count">(%s)</span>', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</a>'; -
trunk/src/wp-includes/post.php
r28471 r28553 2330 2330 * @return array array(wildcard=>array(real types)) 2331 2331 */ 2332 function wp_match_mime_types( $wildcard_mime_types, $real_mime_types) {2332 function wp_match_mime_types( $wildcard_mime_types, $real_mime_types ) { 2333 2333 $matches = array(); 2334 if ( is_string($wildcard_mime_types) ) 2335 $wildcard_mime_types = array_map('trim', explode(',', $wildcard_mime_types)); 2336 if ( is_string($real_mime_types) ) 2337 $real_mime_types = array_map('trim', explode(',', $real_mime_types)); 2334 if ( is_string( $wildcard_mime_types ) ) { 2335 $wildcard_mime_types = array_map( 'trim', explode( ',', $wildcard_mime_types ) ); 2336 } 2337 if ( is_string( $real_mime_types ) ) { 2338 $real_mime_types = array_map( 'trim', explode( ',', $real_mime_types ) ); 2339 } 2340 2341 $patternses = array(); 2338 2342 $wild = '[-._a-z0-9]*'; 2343 2339 2344 foreach ( (array) $wildcard_mime_types as $type ) { 2340 $ type = str_replace('*', $wild, $type);2341 $patternses[1][$type] = "^$ type$";2345 $regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $type ) ) ); 2346 $patternses[1][$type] = "^$regex$"; 2342 2347 if ( false === strpos($type, '/') ) { 2343 $patternses[2][$type] = "^$type/"; 2344 $patternses[3][$type] = $type; 2345 } 2346 } 2347 asort($patternses); 2348 foreach ( $patternses as $patterns ) 2349 foreach ( $patterns as $type => $pattern ) 2350 foreach ( (array) $real_mime_types as $real ) 2351 if ( preg_match("#$pattern#", $real) && ( empty($matches[$type]) || false === array_search($real, $matches[$type]) ) ) 2348 $patternses[2][$type] = "^$regex/"; 2349 $patternses[3][$type] = $regex; 2350 } 2351 } 2352 asort( $patternses ); 2353 2354 foreach ( $patternses as $patterns ) { 2355 foreach ( $patterns as $type => $pattern ) { 2356 foreach ( (array) $real_mime_types as $real ) { 2357 if ( preg_match( "#$pattern#", $real ) && ( empty( $matches[$type] ) || false === array_search( $real, $matches[$type] ) ) ) { 2352 2358 $matches[$type][] = $real; 2359 } 2360 } 2361 } 2362 } 2353 2363 return $matches; 2354 2364 }
Note: See TracChangeset
for help on using the changeset viewer.