Ticket #9036: media-links-upgrade.patch
| File media-links-upgrade.patch, 3.9 KB (added by , 17 years ago) |
|---|
-
wp-includes/post-template.php
908 908 * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function. 909 909 * 910 910 * @param int $id Optional. Post ID. 911 * @param string $size Optional . Image size.911 * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 912 912 * @param bool $permalink Optional, default is false. Whether to add permalink to image. 913 913 * @param bool $icon Optional, default is false. Whether to include icon. 914 * @param string $text Optional, default is false. If string, then will be link text. 914 915 * @return string HTML content. 915 916 */ 916 function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false ) {917 function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) { 917 918 $id = intval($id); 918 919 $_post = & get_post( $id ); 919 920 … … 924 925 $url = get_attachment_link($_post->ID); 925 926 926 927 $post_title = attribute_escape($_post->post_title); 928 929 if( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false) 930 $link_text = wp_get_attachment_image($id, $size, $icon); 927 931 928 $link_text = wp_get_attachment_image($id, $size, $icon); 932 if($text) 933 $link_text = attribute_escape($text); 934 929 935 if ( !$link_text ) 930 936 $link_text = $_post->post_title; 931 937 … … 1191 1197 $autosavef = __( '%s [Autosave]' ); 1192 1198 $currentf = __( '%s [Current Revision]' ); 1193 1199 1194 $date = date_i18n( $datef, strtotime( $revision->post_modified ) );1200 $date = date_i18n( $datef, strtotime( $revision->post_modified_gmt . ' +0000' ) ); 1195 1201 if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) 1196 1202 $date = "<a href='$link'>$date</a>"; 1197 1203 -
wp-includes/media.php
689 689 * Display previous image link that has the same post parent. 690 690 * 691 691 * @since 2.5.0 692 * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text; 693 * @param string $text Optional, default is false. If included, link will reflect $text variable. 694 * @return string HTML content. 692 695 */ 693 function previous_image_link( ) {694 adjacent_image_link(true );696 function previous_image_link($size = 'thumbnail', $text = false) { 697 adjacent_image_link(true, $size, $text); 695 698 } 696 699 697 700 /** 698 701 * Display next image link that has the same post parent. 699 702 * 700 703 * @since 2.5.0 704 * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string. 0 or 'none' will default to post_title or $text; 705 * @param string $text Optional, default is false. If included, link will reflect $text variable. 706 * @return string HTML content. 701 707 */ 702 function next_image_link( ) {703 adjacent_image_link(false );708 function next_image_link($size = 'thumbnail', $text = false) { 709 adjacent_image_link(false, $size, $text); 704 710 } 705 711 706 712 /** … … 712 718 * 713 719 * @param bool $prev Optional. Default is true to display previous link, true for next. 714 720 */ 715 function adjacent_image_link($prev = true ) {721 function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) { 716 722 global $post; 717 723 $post = get_post($post); 718 724 $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 730 $k = $prev ? $k - 1 : $k + 1; 725 731 726 732 if ( isset($attachments[$k]) ) 727 echo wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true);733 echo wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text); 728 734 } 729 735 730 736 /**