diff --git a/wp-includes/media.php b/wp-includes/media.php index 4c3896e0b2..356cedf744 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -689,18 +689,24 @@ function gallery_shortcode($attr) { * Display previous image link that has the same post parent. * * @since 2.5.0 + * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text; + * @param string $text Optional, default is false. If included, link will reflect $text variable. + * @return string HTML content. */ -function previous_image_link() { - adjacent_image_link(true); +function previous_image_link($size = 'thumbnail', $text = false) { + adjacent_image_link(true, $size, $text); } /** * Display next image link that has the same post parent. * * @since 2.5.0 + * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text; + * @param string $text Optional, default is false. If included, link will reflect $text variable. + * @return string HTML content. */ -function next_image_link() { - adjacent_image_link(false); +function next_image_link($size = 'thumbnail', $text = false) { + adjacent_image_link(false, $size, $text); } /** @@ -712,7 +718,7 @@ function next_image_link() { * * @param bool $prev Optional. Default is true to display previous link, true for next. */ -function adjacent_image_link($prev = true) { +function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) { global $post; $post = get_post($post); $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') )); @@ -724,7 +730,7 @@ function adjacent_image_link($prev = true) { $k = $prev ? $k - 1 : $k + 1; if ( isset($attachments[$k]) ) - echo wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true); + echo wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text); } /** diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 7e640f39d1..f46fcac5f6 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -908,12 +908,13 @@ function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $p * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function. * * @param int $id Optional. Post ID. - * @param string $size Optional. Image size. + * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. * @param bool $permalink Optional, default is false. Whether to add permalink to image. * @param bool $icon Optional, default is false. Whether to include icon. + * @param string $text Optional, default is false. If string, then will be link text. * @return string HTML content. */ -function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) { +function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) { $id = intval($id); $_post = & get_post( $id ); @@ -924,11 +925,15 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false $url = get_attachment_link($_post->ID); $post_title = attribute_escape($_post->post_title); - - $link_text = wp_get_attachment_image($id, $size, $icon); - if ( !$link_text ) + + if ( $text ) { + $link_text = attribute_escape($text); + } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) { + $link_text = wp_get_attachment_image($id, $size, $icon); + } else { $link_text = $_post->post_title; - + } + return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon ); } @@ -1191,7 +1196,7 @@ function wp_post_revision_title( $revision, $link = true ) { $autosavef = __( '%s [Autosave]' ); $currentf = __( '%s [Current Revision]' ); - $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); + $date = date_i18n( $datef, strtotime( $revision->post_modified_gmt . ' +0000' ) ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) $date = "$date";