summaryrefslogtreecommitdiffstats
path: root/wp-includes/media.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-24 11:45:39 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-24 11:45:39 +0000
commitcf9f85dc8121a359d550ffa3b735fb48859eee88 (patch)
tree9f90be15fc46163f5656f019f2a2866414b7c9f2 /wp-includes/media.php
parentf10f9f5b05e23ce4c07479b094bd3ff4bbfd86d0 (diff)
downloadwordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.gz
wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.xz
wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.zip
Merged with WP 2.5, revision 7806
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1260 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/media.php')
-rw-r--r--wp-includes/media.php32
1 files changed, 20 insertions, 12 deletions
diff --git a/wp-includes/media.php b/wp-includes/media.php
index b81fcfa..e62be36 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -98,7 +98,8 @@ function get_image_tag($id, $alt, $title, $align, $size='medium') {
$html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id.'" />';
- $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );
+ $url = '';
+ $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );
return $html;
}
@@ -243,6 +244,7 @@ function image_make_intermediate_size($file, $width, $height, $crop=false) {
if ( $width || $height ) {
$resized_file = image_resize($file, $width, $height, $crop);
if ( !is_wp_error($resized_file) && $resized_file && $info = getimagesize($resized_file) ) {
+ $resized_file = apply_filters('image_make_intermediate_size', $resized_file);
return array(
'file' => basename( $resized_file ),
'width' => $info[0],
@@ -285,7 +287,7 @@ function image_get_intermediate_size($post_id, $size='thumbnail') {
if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) )
return false;
-
+
$data = $imagedata['sizes'][$size];
// include the full filesystem path of the intermediate file
if ( empty($data['path']) && !empty($data['file']) ) {
@@ -299,7 +301,7 @@ function image_get_intermediate_size($post_id, $size='thumbnail') {
// get an image to represent an attachment - a mime icon for files, thumbnail or intermediate size for images
// returns an array (url, width, height), or false if no image is available
function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) {
-
+
// get a thumbnail or intermediate image if there is one
if ( $image = image_downsize($attachment_id, $size) )
return $image;
@@ -324,13 +326,13 @@ function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = fals
$hwstring = image_hwstring($width, $height);
if ( is_array($size) )
$size = join('x', $size);
- $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" />';
+ $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" alt="" />';
}
-
+
return $html;
}
-add_shortcode('gallery', 'gallery_shortcode');
+add_shortcode('gallery', 'gallery_shortcode', true);
function gallery_shortcode($attr) {
global $post;
@@ -339,7 +341,14 @@ function gallery_shortcode($attr) {
$output = apply_filters('post_gallery', '', $attr);
if ( $output != '' )
return $output;
-
+
+ // We're trusting author input, so let's at least make sure it looks like a valid orderby statement
+ if ( isset( $attr['orderby'] ) ) {
+ $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
+ if ( !$attr['orderby'] )
+ unset( $attr['orderby'] );
+ }
+
extract(shortcode_atts(array(
'orderby' => 'menu_order ASC, ID ASC',
'id' => $post->ID,
@@ -351,8 +360,7 @@ function gallery_shortcode($attr) {
), $attr));
$id = intval($id);
- $orderby = addslashes($orderby);
- $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby=\"{$orderby}\"");
+ $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}");
if ( empty($attachments) )
return '';
@@ -369,7 +377,7 @@ function gallery_shortcode($attr) {
$captiontag = tag_escape($captiontag);
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
-
+
$output = apply_filters('gallery_style', "
<style type='text/css'>
.gallery {
@@ -409,7 +417,7 @@ function gallery_shortcode($attr) {
}
$output .= "
- <br style='clear: both;' >
+ <br style='clear: both;' />
</div>\n";
return $output;
@@ -426,7 +434,7 @@ function next_image_link() {
function adjacent_image_link($prev = true) {
global $post;
$post = get_post($post);
- $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\""));
+ $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC"));
foreach ( $attachments as $k => $attachment )
if ( $attachment->ID == $post->ID )