Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r16865 r15003  
    138138    $width = $height = 0;
    139139    $is_intermediate = false;
    140     $img_url_basename = wp_basename($img_url);
    141140
    142141    // plugins can use this to provide resize services
     
    146145    // try for a new style intermediate size
    147146    if ( $intermediate = image_get_intermediate_size($id, $size) ) {
    148         $img_url = str_replace($img_url_basename, $intermediate['file'], $img_url);
     147        $img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
    149148        $width = $intermediate['width'];
    150149        $height = $intermediate['height'];
     
    154153        // fall back to the old thumbnail
    155154        if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
    156             $img_url = str_replace($img_url_basename, wp_basename($thumb_file), $img_url);
     155            $img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
    157156            $width = $info[0];
    158157            $height = $info[1];
     
    179178 * Registers a new image size
    180179 */
    181 function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
     180function add_image_size( $name, $width = 0, $height = 0, $crop = FALSE ) {
    182181    global $_wp_additional_image_sizes;
    183     $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => (bool) $crop );
     182    $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => !!$crop );
    184183}
    185184
     
    187186 * Registers an image size for the post thumbnail
    188187 */
    189 function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
     188function set_post_thumbnail_size( $width = 0, $height = 0, $crop = FALSE ) {
    190189    add_image_size( 'post-thumbnail', $width, $height, $crop );
    191190}
     
    438437    $dir = $info['dirname'];
    439438    $ext = $info['extension'];
    440     $name = wp_basename($file, ".$ext");
    441 
     439    $name = basename($file, ".{$ext}");
    442440    if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) )
    443441        $dir = $_dest_path;
     
    488486            $resized_file = apply_filters('image_make_intermediate_size', $resized_file);
    489487            return array(
    490                 'file' => wp_basename( $resized_file ),
     488                'file' => basename( $resized_file ),
    491489                'width' => $info[0],
    492490                'height' => $info[1],
     
    609607    if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
    610608        $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
    611         $src_file = $icon_dir . '/' . wp_basename($src);
     609        $src_file = $icon_dir . '/' . basename($src);
    612610        @list($width, $height) = getimagesize($src_file);
    613611    }
     
    824822    $selector = "gallery-{$instance}";
    825823
    826     $gallery_style = $gallery_div = '';
    827     if ( apply_filters( 'use_default_gallery_style', true ) )
    828         $gallery_style = "
     824    $output = apply_filters('gallery_style', "
    829825        <style type='text/css'>
    830826            #{$selector} {
     
    835831                margin-top: 10px;
    836832                text-align: center;
    837                 width: {$itemwidth}%;
    838             }
     833                width: {$itemwidth}%;           }
    839834            #{$selector} img {
    840835                border: 2px solid #cfcfcf;
     
    844839            }
    845840        </style>
    846         <!-- see gallery_shortcode() in wp-includes/media.php -->";
    847     $size_class = sanitize_html_class( $size );
    848     $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
    849     $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
     841        <!-- see gallery_shortcode() in wp-includes/media.php -->
     842        <div id='$selector' class='gallery galleryid-{$id}'>");
    850843
    851844    $i = 0;
     
    860853        if ( $captiontag && trim($attachment->post_excerpt) ) {
    861854            $output .= "
    862                 <{$captiontag} class='wp-caption-text gallery-caption'>
     855                <{$captiontag} class='gallery-caption'>
    863856                " . wptexturize($attachment->post_excerpt) . "
    864857                </{$captiontag}>";
     
    968961 * @since 2.9.0
    969962 *
    970  * @param string $mime_type
     963 * @param $mime_type string
    971964 * @return bool
    972965 */
     
    999992 * @since 2.9.0
    1000993 *
    1001  * @param int $width Image width
    1002  * @param int $height Image height
     994 * @param $width
     995 * @param $height
    1003996 * @return image resource
    1004997 */
     
    10711064        global $shortcode_tags;
    10721065
    1073         // Back up current registered shortcodes and clear them all out
     1066        // Backup current registered shortcodes and clear them all out
    10741067        $orig_shortcode_tags = $shortcode_tags;
    10751068        remove_all_shortcodes();
     
    11641157        $attr = wp_parse_args( $attr, wp_embed_defaults() );
    11651158
    1166         // kses converts & into &amp; and we need to undo this
    1167         // See http://core.trac.wordpress.org/ticket/11311
    1168         $url = str_replace( '&amp;', '&', $url );
    1169 
    11701159        // Look for known internal handlers
    11711160        ksort( $this->handlers );
     
    11961185
    11971186                if ( !empty($cache) )
    1198                     return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID );
     1187                    return apply_filters( 'embed_oembed_html', $cache, $url, $attr );
    11991188            }
    12001189
     
    12091198            // If there was a result, return it
    12101199            if ( $html )
    1211                 return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
     1200                return apply_filters( 'embed_oembed_html', $html, $url, $attr );
    12121201        }
    12131202
Note: See TracChangeset for help on using the changeset viewer.