Changeset 28405
- Timestamp:
- 05/15/2014 02:17:52 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/bookmark-template.php
r28404 r28405 139 139 ); 140 140 } 141 $output .= $r[' $after'] . "\n";141 $output .= $r['after'] . "\n"; 142 142 } // end while 143 143 … … 211 211 * Default is not return anything. 212 212 */ 213 function wp_list_bookmarks( $args = '') {213 function wp_list_bookmarks( $args = '' ) { 214 214 $defaults = array( 215 215 'orderby' => 'name', 'order' => 'ASC', … … 225 225 226 226 $r = wp_parse_args( $args, $defaults ); 227 extract( $r, EXTR_SKIP );228 227 229 228 $output = ''; 230 229 231 if ( $categorize ) { 232 $cats = get_terms( 'link_category', array( 'name__like' => $category_name, 'include' => $category, 'exclude' => $exclude_category, 'orderby' => $category_orderby, 'order' => $category_order, 'hierarchical' => 0 ) ); 233 if ( empty( $cats ) ) 230 if ( $r['categorize'] ) { 231 $cats = get_terms( 'link_category', array( 232 'name__like' => $r['category_name'], 233 'include' => $r['category'], 234 'exclude' => $r['exclude_category'], 235 'orderby' => $r['category_orderby'], 236 'order' => $r['category_order'], 237 'hierarchical' => 0 238 ) ); 239 if ( empty( $cats ) ) { 234 240 $categorize = false; 241 } 235 242 } 236 243 … … 238 245 // Split the bookmarks into ul's for each category 239 246 foreach ( (array) $cats as $cat ) { 240 $params = array_merge( $r, array('category'=>$cat->term_id));241 $bookmarks = get_bookmarks( $params);242 if ( empty( $bookmarks) )247 $params = array_merge( $r, array( 'category' => $cat->term_id ) ); 248 $bookmarks = get_bookmarks( $params ); 249 if ( empty( $bookmarks ) ) { 243 250 continue; 244 $output .= str_replace(array('%id', '%class'), array("linkcat-$cat->term_id", $class), $category_before); 251 } 252 $output .= str_replace( 253 array( '%id', '%class' ), 254 array( "linkcat-$cat->term_id", $r['class'] ), 255 $r['category_before'] 256 ); 245 257 /** 246 258 * Filter the bookmarks category name. … … 252 264 $catname = apply_filters( 'link_category', $cat->name ); 253 265 254 $output .= "$title_before$catname$title_after\n\t<ul class='xoxo blogroll'>\n"; 255 $output .= _walk_bookmarks($bookmarks, $r); 256 $output .= "\n\t</ul>\n$category_after\n"; 266 $output .= $r['title_before']; 267 $output .= $catname; 268 $output .= $r['title_after']; 269 $output .= "\n\t<ul class='xoxo blogroll'>\n"; 270 $output .= _walk_bookmarks( $bookmarks, $r ); 271 $output .= "\n\t</ul>\n"; 272 $output .= $r['category_after'] . "\n"; 257 273 } 258 274 } else { 259 275 //output one single list using title_li for the title 260 $bookmarks = get_bookmarks($r); 261 262 if ( !empty($bookmarks) ) { 263 if ( !empty( $title_li ) ){ 264 $output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before); 265 $output .= "$title_before$title_li$title_after\n\t<ul class='xoxo blogroll'>\n"; 266 $output .= _walk_bookmarks($bookmarks, $r); 267 $output .= "\n\t</ul>\n$category_after\n"; 276 $bookmarks = get_bookmarks( $r ); 277 278 if ( ! empty( $bookmarks ) ) { 279 if ( ! empty( $r['title_li'] ) ) { 280 $output .= str_replace( 281 array( '%id', '%class' ), 282 array( "linkcat-" . $r['category'], $r['class'] ), 283 $r['category_before'] 284 ); 285 $output .= $r['title_before']; 286 $output .= $r['title_li']; 287 $output .= $r['title_after']; 288 $output .= "\n\t<ul class='xoxo blogroll'>\n"; 289 $output .= _walk_bookmarks( $bookmarks, $r ); 290 $output .= "\n\t</ul>\n"; 291 $output .= $r['category_after'] . "\n"; 268 292 } else { 269 $output .= _walk_bookmarks( $bookmarks, $r);293 $output .= _walk_bookmarks( $bookmarks, $r ); 270 294 } 271 295 } … … 277 301 * @since 2.5.0 278 302 * 279 * @param string $ outputThe HTML list of bookmarks.303 * @param string $html The HTML list of bookmarks. 280 304 */ 281 $output = apply_filters( 'wp_list_bookmarks', $output ); 282 283 if ( !$echo ) 284 return $output; 285 echo $output; 305 $html = apply_filters( 'wp_list_bookmarks', $output ); 306 307 if ( ! $r['echo'] ) { 308 return $html; 309 } 310 echo $html; 286 311 }
Note: See TracChangeset
for help on using the changeset viewer.