WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/02/2010 05:19:55 PM (10 years ago)
Author:
scribu
Message:

Introduce wp_basename() and use it for media handling. See #11887

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r15990 r16154  
    138138    $width = $height = 0;
    139139    $is_intermediate = false;
     140    $img_url_basename = wp_basename($img_url);
    140141
    141142    // plugins can use this to provide resize services
     
    145146    // try for a new style intermediate size
    146147    if ( $intermediate = image_get_intermediate_size($id, $size) ) {
    147         $img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
     148        $img_url = str_replace($img_url_basename, $intermediate['file'], $img_url);
    148149        $width = $intermediate['width'];
    149150        $height = $intermediate['height'];
     
    153154        // fall back to the old thumbnail
    154155        if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
    155             $img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
     156            $img_url = str_replace($img_url_basename, wp_basename($thumb_file), $img_url);
    156157            $width = $info[0];
    157158            $height = $info[1];
     
    437438    $dir = $info['dirname'];
    438439    $ext = $info['extension'];
    439     $name = basename($file, ".{$ext}");
     440    $name = wp_basename($file, ".$ext");
     441
    440442    if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) )
    441443        $dir = $_dest_path;
     
    486488            $resized_file = apply_filters('image_make_intermediate_size', $resized_file);
    487489            return array(
    488                 'file' => basename( $resized_file ),
     490                'file' => wp_basename( $resized_file ),
    489491                'width' => $info[0],
    490492                'height' => $info[1],
     
    607609    if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
    608610        $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
    609         $src_file = $icon_dir . '/' . basename($src);
     611        $src_file = $icon_dir . '/' . wp_basename($src);
    610612        @list($width, $height) = getimagesize($src_file);
    611613    }
Note: See TracChangeset for help on using the changeset viewer.