wp/wp-includes/bookmark-template.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
   193  *                                      is true. Default 'name'.
   193  *                                      is true. Default 'name'.
   194  *     @type string   $category_order   Whether to order categories in ascending or descending order if
   194  *     @type string   $category_order   Whether to order categories in ascending or descending order if
   195  *                                      $categorize is true. Accepts 'ASC' (ascending) or 'DESC' (descending).
   195  *                                      $categorize is true. Accepts 'ASC' (ascending) or 'DESC' (descending).
   196  *                                      Default 'ASC'.
   196  *                                      Default 'ASC'.
   197  * }
   197  * }
   198  * @return string|null Will only return if echo option is set to not echo. Default is not return anything.
   198  * @return string|void Will only return if echo option is set to not echo. Default is not return anything.
   199  */
   199  */
   200 function wp_list_bookmarks( $args = '' ) {
   200 function wp_list_bookmarks( $args = '' ) {
   201 	$defaults = array(
   201 	$defaults = array(
   202 		'orderby' => 'name', 'order' => 'ASC',
   202 		'orderby' => 'name', 'order' => 'ASC',
   203 		'limit' => -1, 'category' => '', 'exclude_category' => '',
   203 		'limit' => -1, 'category' => '', 'exclude_category' => '',
   212 
   212 
   213 	$r = wp_parse_args( $args, $defaults );
   213 	$r = wp_parse_args( $args, $defaults );
   214 
   214 
   215 	$output = '';
   215 	$output = '';
   216 
   216 
       
   217 	if ( ! is_array( $r['class'] ) ) {
       
   218 		$r['class'] = explode( ' ', $r['class'] );
       
   219 	}
       
   220  	$r['class'] = array_map( 'sanitize_html_class', $r['class'] );
       
   221  	$r['class'] = trim( join( ' ', $r['class'] ) );
       
   222 
   217 	if ( $r['categorize'] ) {
   223 	if ( $r['categorize'] ) {
   218 		$cats = get_terms( 'link_category', array(
   224 		$cats = get_terms( 'link_category', array(
   219 			'name__like' => $r['category_name'],
   225 			'name__like' => $r['category_name'],
   220 			'include' => $r['category'],
   226 			'include' => $r['category'],
   221 			'exclude' => $r['exclude_category'],
   227 			'exclude' => $r['exclude_category'],
   240 				array( '%id', '%class' ),
   246 				array( '%id', '%class' ),
   241 				array( "linkcat-$cat->term_id", $r['class'] ),
   247 				array( "linkcat-$cat->term_id", $r['class'] ),
   242 				$r['category_before']
   248 				$r['category_before']
   243 			);
   249 			);
   244 			/**
   250 			/**
   245 			 * Filter the bookmarks category name.
   251 			 * Filters the bookmarks category name.
   246 			 *
   252 			 *
   247 			 * @since 2.2.0
   253 			 * @since 2.2.0
   248 			 *
   254 			 *
   249 			 * @param string $cat_name The category name of bookmarks.
   255 			 * @param string $cat_name The category name of bookmarks.
   250 			 */
   256 			 */
   281 			}
   287 			}
   282 		}
   288 		}
   283 	}
   289 	}
   284 
   290 
   285 	/**
   291 	/**
   286 	 * Filter the bookmarks list before it is echoed or returned.
   292 	 * Filters the bookmarks list before it is echoed or returned.
   287 	 *
   293 	 *
   288 	 * @since 2.5.0
   294 	 * @since 2.5.0
   289 	 *
   295 	 *
   290 	 * @param string $html The HTML list of bookmarks.
   296 	 * @param string $html The HTML list of bookmarks.
   291 	 */
   297 	 */