Changeset 3880
- Timestamp:
- 06/16/2006 11:35:48 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/classic/sidebar.php
r3517 r3880 5 5 <ul> 6 6 <?php wp_list_pages(); ?> 7 <?php get_links_list(); ?>7 <?php wp_list_bookmarks(); ?> 8 8 <li id="categories"><?php _e('Categories:'); ?> 9 9 <ul> -
trunk/wp-content/themes/default/sidebar.php
r3517 r3880 54 54 55 55 <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> 56 <?php get_links_list(); ?>56 <?php wp_list_bookmarks(); ?> 57 57 58 58 <li><h2>Meta</h2> -
trunk/wp-includes/bookmark-template.php
r3845 r3880 260 260 } 261 261 262 function _walk_bookmarks($bookmarks, $args = '' ) { 263 if ( is_array($args) ) 264 $r = &$args; 265 else 266 parse_str($args, $r); 267 268 $defaults = array('show_updated' => 0, 'show_description' => 0, 'show_images' => 0, 'before' => '<li>', 269 'after' => '</li>', 'between' => "\n"); 270 $r = array_merge($defaults, $r); 271 extract($r); 272 273 foreach ( (array) $bookmarks as $bookmark ) { 274 if (!isset($bookmark->recently_updated)) $bookmark->recently_updated = false; 275 $output .= $before; 276 if ($show_updated && $bookmark->recently_updated) { 277 $output .= get_settings('links_recently_updated_prepend'); 278 } 279 280 $the_link = '#'; 281 if (!empty($bookmark->link_url)) 282 $the_link = wp_specialchars($bookmark->link_url); 283 284 $rel = $bookmark->link_rel; 285 if ($rel != '') { 286 $rel = ' rel="' . $rel . '"'; 287 } 288 289 $desc = wp_specialchars($bookmark->link_description, ENT_QUOTES); 290 $name = wp_specialchars($bookmark->link_name, ENT_QUOTES); 291 $title = $desc; 292 293 if ($show_updated) { 294 if (substr($bookmark->link_updated_f, 0, 2) != '00') { 295 $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $bookmark->link_updated_f + (get_settings('gmt_offset') * 3600)) . ')'; 296 } 297 } 298 299 if ('' != $title) { 300 $title = ' title="' . $title . '"'; 301 } 302 303 $alt = ' alt="' . $name . '"'; 304 305 $target = $bookmark->link_target; 306 if ('' != $target) { 307 $target = ' target="' . $target . '"'; 308 } 309 310 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; 311 312 if (($bookmark->link_image != null) && $show_images) { 313 if (strstr($bookmark->link_image, 'http')) 314 $output .= "<img src=\"$bookmark->link_image\" $alt $title />"; 315 else // If it's a relative path 316 $output .= "<img src=\"" . get_settings('siteurl') . "$bookmark->link_image\" $alt $title />"; 317 } else { 318 $output .= $name; 319 } 320 321 $output .= '</a>'; 322 323 if ($show_updated && $bookmark->recently_updated) { 324 $output .= get_settings('links_recently_updated_append'); 325 } 326 327 if ($show_description && ($desc != '')) { 328 $output .= $between . $desc; 329 } 330 $output .= "$after\n"; 331 } // end while 332 333 return $output; 334 } 335 262 336 function wp_list_bookmarks($args = '') { 263 337 if ( is_array($args) ) … … 266 340 parse_str($args, $r); 267 341 268 $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => 0, 'category' => 0, 269 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' =>1, 270 'categorize' => 1, 'title_li' => __('Bookmarks')); 342 $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => 0, 343 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, 344 'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '<h2>', 'title_after' => '</h2>', 345 'category_orderby' => 'name', 'category_order' => 'ASC'); 271 346 $r = array_merge($defaults, $r); 272 347 extract($r); … … 279 354 // When using each category's name as a title li, use before and after args for specifying 280 355 // any markup. We don't want to hardcode h2. 356 357 $output = ''; 358 359 if ( $categorize ) { 360 $cats = get_categories("type=link&orderby=$category_orderby&order=$category_order&hierarchical=0"); 361 foreach ( (array) $cats as $cat ) { 362 $bookmarks = get_bookmarks($r); 363 if ( empty($bookmarks) ) 364 continue; 365 $output .= "<li id=\"linkcat-$cat->cat_ID\">$title_before$cat->cat_name$title_after\n\t<ul>\n"; 366 $r['category'] = $cat->cat_ID; 367 $output .= _walk_bookmarks($bookmarks, $r); 368 $output .= "\n\t</ul>\n</li>\n"; 369 } 370 } 371 372 if ($echo) 373 echo $output; 374 375 return $output; 281 376 } 282 377
Note: See TracChangeset
for help on using the changeset viewer.