Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15003 r16865  
    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];
     
    178179 * Registers a new image size
    179180 */
    180 function add_image_size( $name, $width = 0, $height = 0, $crop = FALSE ) {
     181function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
    181182    global $_wp_additional_image_sizes;
    182     $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => !!$crop );
     183    $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => (bool) $crop );
    183184}
    184185
     
    186187 * Registers an image size for the post thumbnail
    187188 */
    188 function set_post_thumbnail_size( $width = 0, $height = 0, $crop = FALSE ) {
     189function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
    189190    add_image_size( 'post-thumbnail', $width, $height, $crop );
    190191}
     
    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    }
     
    822824    $selector = "gallery-{$instance}";
    823825
    824     $output = apply_filters('gallery_style', "
     826    $gallery_style = $gallery_div = '';
     827    if ( apply_filters( 'use_default_gallery_style', true ) )
     828        $gallery_style = "
    825829        <style type='text/css'>
    826830            #{$selector} {
     
    831835                margin-top: 10px;
    832836                text-align: center;
    833                 width: {$itemwidth}%;           }
     837                width: {$itemwidth}%;
     838            }
    834839            #{$selector} img {
    835840                border: 2px solid #cfcfcf;
     
    839844            }
    840845        </style>
    841         <!-- see gallery_shortcode() in wp-includes/media.php -->
    842         <div id='$selector' class='gallery galleryid-{$id}'>");
     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 );
    843850
    844851    $i = 0;
     
    853860        if ( $captiontag && trim($attachment->post_excerpt) ) {
    854861            $output .= "
    855                 <{$captiontag} class='gallery-caption'>
     862                <{$captiontag} class='wp-caption-text gallery-caption'>
    856863                " . wptexturize($attachment->post_excerpt) . "
    857864                </{$captiontag}>";
     
    961968 * @since 2.9.0
    962969 *
    963  * @param $mime_type string
     970 * @param string $mime_type
    964971 * @return bool
    965972 */
     
    992999 * @since 2.9.0
    9931000 *
    994  * @param $width
    995  * @param $height
     1001 * @param int $width Image width
     1002 * @param int $height Image height
    9961003 * @return image resource
    9971004 */
     
    10641071        global $shortcode_tags;
    10651072
    1066         // Backup current registered shortcodes and clear them all out
     1073        // Back up current registered shortcodes and clear them all out
    10671074        $orig_shortcode_tags = $shortcode_tags;
    10681075        remove_all_shortcodes();
     
    11571164        $attr = wp_parse_args( $attr, wp_embed_defaults() );
    11581165
     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
    11591170        // Look for known internal handlers
    11601171        ksort( $this->handlers );
     
    11851196
    11861197                if ( !empty($cache) )
    1187                     return apply_filters( 'embed_oembed_html', $cache, $url, $attr );
     1198                    return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID );
    11881199            }
    11891200
     
    11981209            // If there was a result, return it
    11991210            if ( $html )
    1200                 return apply_filters( 'embed_oembed_html', $html, $url, $attr );
     1211                return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
    12011212        }
    12021213
Note: See TracChangeset for help on using the changeset viewer.