Ticket #50561: 50561.1.diff
File 50561.1.diff, 3.1 KB (added by , 4 years ago) |
---|
-
src/wp-includes/bookmark-template.php
50 50 */ 51 51 function _walk_bookmarks( $bookmarks, $args = '' ) { 52 52 $defaults = array( 53 'show_updated' => 0, 53 'show_updated' => 0, // Unused. 54 54 'show_description' => 0, 55 55 'show_images' => 1, 56 56 'show_name' => 0, … … 67 67 $output = ''; // Blank string to start with. 68 68 69 69 foreach ( (array) $bookmarks as $bookmark ) { 70 if ( ! isset( $bookmark->recently_updated ) ) {71 $bookmark->recently_updated = false;72 }73 70 $output .= $parsed_args['before']; 74 if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) {75 $output .= '<em>';76 }77 71 $the_link = '#'; 78 72 if ( ! empty( $bookmark->link_url ) ) { 79 73 $the_link = esc_url( $bookmark->link_url ); … … 80 74 } 81 75 $desc = esc_attr( sanitize_bookmark_field( 'link_description', $bookmark->link_description, $bookmark->link_id, 'display' ) ); 82 76 $name = esc_attr( sanitize_bookmark_field( 'link_name', $bookmark->link_name, $bookmark->link_id, 'display' ) ); 83 $title = $desc;84 77 85 if ( $parsed_args['show_updated'] ) {86 if ( '00' !== substr( $bookmark->link_updated_f, 0, 2 ) ) {87 $title .= ' (';88 $title .= sprintf(89 /* translators: %s: Date and time of last update. */90 __( 'Last updated: %s' ),91 gmdate(92 get_option( 'links_updated_date_format' ),93 $bookmark->link_updated_f + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS )94 )95 );96 $title .= ')';97 }98 }99 $alt = ' alt="' . $name . ( $parsed_args['show_description'] ? ' ' . $title : '' ) . '"';100 101 if ( '' !== $title ) {102 $title = ' title="' . $title . '"';103 }104 78 $rel = $bookmark->link_rel; 105 79 if ( '' !== $rel ) { 106 80 $rel = ' rel="' . esc_attr( $rel ) . '"'; … … 109 83 if ( '' !== $target ) { 110 84 $target = ' target="' . $target . '"'; 111 85 } 112 $output .= '<a href="' . $the_link . '"' . $rel . $t itle . $target . '>';86 $output .= '<a href="' . $the_link . '"' . $rel . $target . '>'; 113 87 114 88 $output .= $parsed_args['link_before']; 115 89 116 90 if ( null != $bookmark->link_image && $parsed_args['show_images'] ) { 117 91 if ( strpos( $bookmark->link_image, 'http' ) === 0 ) { 118 $ output .= "<img src=\"$bookmark->link_image\" $alt $title />";92 $linked_image = $bookmark->link_image; 119 93 } else { // If it's a relative path. 120 $ output .= '<img src="' . get_option( 'siteurl' ) . "$bookmark->link_image\" $alt $title />";94 $linked_image = site_url( $bookmark->link_image ); 121 95 } 122 96 if ( $parsed_args['show_name'] ) { 123 $output .= " $name"; 97 $output .= '<img src="' . $linked_image . '" alt="" /> ' . $name; 98 } else { 99 $output .= '<img src="' . $linked_image . '" alt="' . $name . '" />'; 124 100 } 125 101 } else { 126 102 $output .= $name; … … 130 106 131 107 $output .= '</a>'; 132 108 133 if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) {134 $output .= '</em>';135 }136 137 109 if ( $parsed_args['show_description'] && '' !== $desc ) { 138 110 $output .= $parsed_args['between'] . $desc; 139 111 }