WordPress.org

Make WordPress Core

Ticket #20672: 20672.2.diff

File 20672.2.diff, 2.0 KB (added by duck_, 2 years ago)
  • wp-admin/includes/class-wp-media-list-table.php

     
    6464                        if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) 
    6565                                $class = ' class="current"'; 
    6666                        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>'; 
    6868                } 
    6969                $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>'; 
    7070 
  • wp-includes/post.php

     
    19381938                $real_mime_types = array_map('trim', explode(',', $real_mime_types)); 
    19391939        $wild = '[-._a-z0-9]*'; 
    19401940        foreach ( (array) $wildcard_mime_types as $type ) { 
    1941                 $type = str_replace('*', $wild, $type); 
    1942                 $patternses[1][$type] = "^$type$"; 
     1941                $regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $type ) ) ); 
     1942                $patternses[1][$type] = "^$regex$"; 
    19431943                if ( false === strpos($type, '/') ) { 
    1944                         $patternses[2][$type] = "^$type/"; 
    1945                         $patternses[3][$type] = $type; 
     1944                        $patternses[2][$type] = "^$regex/"; 
     1945                        $patternses[3][$type] = $regex; 
    19461946                } 
    19471947        } 
    19481948        asort($patternses);