Changeset 28404 for trunk/src/wp-includes/bookmark-template.php
- Timestamp:
- 05/15/2014 02:04:50 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/bookmark-template.php
r27916 r28404 48 48 * @return string Formatted output in HTML 49 49 */ 50 function _walk_bookmarks( $bookmarks, $args = '' ) {50 function _walk_bookmarks( $bookmarks, $args = '' ) { 51 51 $defaults = array( 52 52 'show_updated' => 0, 'show_description' => 0, … … 57 57 58 58 $r = wp_parse_args( $args, $defaults ); 59 extract( $r, EXTR_SKIP );60 59 61 60 $output = ''; // Blank string to start with. 62 61 63 62 foreach ( (array) $bookmarks as $bookmark ) { 64 if ( ! isset($bookmark->recently_updated) )63 if ( ! isset( $bookmark->recently_updated ) ) { 65 64 $bookmark->recently_updated = false; 66 $output .= $before; 67 if ( $show_updated && $bookmark->recently_updated ) 65 } 66 $output .= $r['before']; 67 if ( $r['show_updated'] && $bookmark->recently_updated ) { 68 68 $output .= '<em>'; 69 69 } 70 70 $the_link = '#'; 71 if ( ! empty($bookmark->link_url) )72 $the_link = esc_url( $bookmark->link_url);73 74 $desc = esc_attr( sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display'));75 $name = esc_attr( sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display'));71 if ( ! empty( $bookmark->link_url ) ) { 72 $the_link = esc_url( $bookmark->link_url ); 73 } 74 $desc = esc_attr( sanitize_bookmark_field( 'link_description', $bookmark->link_description, $bookmark->link_id, 'display' ) ); 75 $name = esc_attr( sanitize_bookmark_field( 'link_name', $bookmark->link_name, $bookmark->link_id, 'display' ) ); 76 76 $title = $desc; 77 77 78 if ( $ show_updated )79 if ( '00' != substr( $bookmark->link_updated_f, 0, 2) ) {78 if ( $r['show_updated'] ) { 79 if ( '00' != substr( $bookmark->link_updated_f, 0, 2 ) ) { 80 80 $title .= ' ('; 81 $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS))); 81 $title .= sprintf( 82 __('Last updated: %s'), 83 date( 84 get_option( 'links_updated_date_format' ), 85 $bookmark->link_updated_f + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) 86 ) 87 ); 82 88 $title .= ')'; 83 89 } 84 85 $alt = ' alt="' . $name . ( $ show_description? ' ' . $title : '' ) . '"';86 87 if ( '' != $title ) 90 } 91 $alt = ' alt="' . $name . ( $r['show_description'] ? ' ' . $title : '' ) . '"'; 92 93 if ( '' != $title ) { 88 94 $title = ' title="' . $title . '"'; 89 95 } 90 96 $rel = $bookmark->link_rel; 91 if ( '' != $rel ) 97 if ( '' != $rel ) { 92 98 $rel = ' rel="' . esc_attr($rel) . '"'; 93 99 } 94 100 $target = $bookmark->link_target; 95 if ( '' != $target ) 101 if ( '' != $target ) { 96 102 $target = ' target="' . $target . '"'; 97 103 } 98 104 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>'; 99 105 100 $output .= $ link_before;101 102 if ( $bookmark->link_image != null && $ show_images) {103 if ( strpos( $bookmark->link_image, 'http') === 0 )106 $output .= $r['link_before']; 107 108 if ( $bookmark->link_image != null && $r['show_images'] ) { 109 if ( strpos( $bookmark->link_image, 'http' ) === 0 ) { 104 110 $output .= "<img src=\"$bookmark->link_image\" $alt $title />"; 105 else// If it's a relative path111 } else { // If it's a relative path 106 112 $output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />"; 107 108 if ( $ show_name )113 } 114 if ( $r['show_name'] ) { 109 115 $output .= " $name"; 116 } 110 117 } else { 111 118 $output .= $name; 112 119 } 113 120 114 $output .= $ link_after;121 $output .= $r['link_after']; 115 122 116 123 $output .= '</a>'; 117 124 118 if ( $ show_updated && $bookmark->recently_updated )125 if ( $r['show_updated'] && $bookmark->recently_updated ) { 119 126 $output .= '</em>'; 120 121 if ( $show_description && '' != $desc ) 122 $output .= $between . $desc; 123 124 if ( $show_rating ) 125 $output .= $between . sanitize_bookmark_field('link_rating', $bookmark->link_rating, $bookmark->link_id, 'display'); 126 127 $output .= "$after\n"; 127 } 128 129 if ( $r['show_description'] && '' != $desc ) { 130 $output .= $r['between'] . $desc; 131 } 132 133 if ( $r['show_rating'] ) { 134 $output .= $r['between'] . sanitize_bookmark_field( 135 'link_rating', 136 $bookmark->link_rating, 137 $bookmark->link_id, 138 'display' 139 ); 140 } 141 $output .= $r['$after'] . "\n"; 128 142 } // end while 129 143
Note: See TracChangeset
for help on using the changeset viewer.