Changes in trunk/wp-includes/media.php [15003:16865]
- File:
-
- 1 edited
-
trunk/wp-includes/media.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r15003 r16865 138 138 $width = $height = 0; 139 139 $is_intermediate = false; 140 $img_url_basename = wp_basename($img_url); 140 141 141 142 // plugins can use this to provide resize services … … 145 146 // try for a new style intermediate size 146 147 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); 148 149 $width = $intermediate['width']; 149 150 $height = $intermediate['height']; … … 153 154 // fall back to the old thumbnail 154 155 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); 156 157 $width = $info[0]; 157 158 $height = $info[1]; … … 178 179 * Registers a new image size 179 180 */ 180 function add_image_size( $name, $width = 0, $height = 0, $crop = FALSE) {181 function add_image_size( $name, $width = 0, $height = 0, $crop = false ) { 181 182 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 ); 183 184 } 184 185 … … 186 187 * Registers an image size for the post thumbnail 187 188 */ 188 function set_post_thumbnail_size( $width = 0, $height = 0, $crop = FALSE) {189 function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) { 189 190 add_image_size( 'post-thumbnail', $width, $height, $crop ); 190 191 } … … 437 438 $dir = $info['dirname']; 438 439 $ext = $info['extension']; 439 $name = basename($file, ".{$ext}"); 440 $name = wp_basename($file, ".$ext"); 441 440 442 if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) ) 441 443 $dir = $_dest_path; … … 486 488 $resized_file = apply_filters('image_make_intermediate_size', $resized_file); 487 489 return array( 488 'file' => basename( $resized_file ),490 'file' => wp_basename( $resized_file ), 489 491 'width' => $info[0], 490 492 'height' => $info[1], … … 607 609 if ( $icon && $src = wp_mime_type_icon($attachment_id) ) { 608 610 $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); 610 612 @list($width, $height) = getimagesize($src_file); 611 613 } … … 822 824 $selector = "gallery-{$instance}"; 823 825 824 $output = apply_filters('gallery_style', " 826 $gallery_style = $gallery_div = ''; 827 if ( apply_filters( 'use_default_gallery_style', true ) ) 828 $gallery_style = " 825 829 <style type='text/css'> 826 830 #{$selector} { … … 831 835 margin-top: 10px; 832 836 text-align: center; 833 width: {$itemwidth}%; } 837 width: {$itemwidth}%; 838 } 834 839 #{$selector} img { 835 840 border: 2px solid #cfcfcf; … … 839 844 } 840 845 </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 ); 843 850 844 851 $i = 0; … … 853 860 if ( $captiontag && trim($attachment->post_excerpt) ) { 854 861 $output .= " 855 <{$captiontag} class=' gallery-caption'>862 <{$captiontag} class='wp-caption-text gallery-caption'> 856 863 " . wptexturize($attachment->post_excerpt) . " 857 864 </{$captiontag}>"; … … 961 968 * @since 2.9.0 962 969 * 963 * @param $mime_type string970 * @param string $mime_type 964 971 * @return bool 965 972 */ … … 992 999 * @since 2.9.0 993 1000 * 994 * @param $width995 * @param $height1001 * @param int $width Image width 1002 * @param int $height Image height 996 1003 * @return image resource 997 1004 */ … … 1064 1071 global $shortcode_tags; 1065 1072 1066 // Back up current registered shortcodes and clear them all out1073 // Back up current registered shortcodes and clear them all out 1067 1074 $orig_shortcode_tags = $shortcode_tags; 1068 1075 remove_all_shortcodes(); … … 1157 1164 $attr = wp_parse_args( $attr, wp_embed_defaults() ); 1158 1165 1166 // kses converts & into & and we need to undo this 1167 // See http://core.trac.wordpress.org/ticket/11311 1168 $url = str_replace( '&', '&', $url ); 1169 1159 1170 // Look for known internal handlers 1160 1171 ksort( $this->handlers ); … … 1185 1196 1186 1197 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 ); 1188 1199 } 1189 1200 … … 1198 1209 // If there was a result, return it 1199 1210 if ( $html ) 1200 return apply_filters( 'embed_oembed_html', $html, $url, $attr );1211 return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID ); 1201 1212 } 1202 1213
Note: See TracChangeset
for help on using the changeset viewer.