X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/67f24b02807a1ff7e9d1a97453ed84c404c0af0f..fa11948979fd6a4ea5705dc613b239699a459db3:/wp-includes/bookmark-template.php diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php index cf24da6c..64e73a88 100644 --- a/wp-includes/bookmark-template.php +++ b/wp-includes/bookmark-template.php @@ -42,7 +42,6 @@ * * @since 2.1.0 * @access private - * @usedby wp_list_bookmarks() * * @param array $bookmarks List of bookmarks to traverse * @param string|array $args Optional. Overwrite the defaults. @@ -79,7 +78,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) { if ( $show_updated ) if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) { $title .= ' ('; - $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600))); + $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS))); $title .= ')'; } @@ -153,6 +152,8 @@ function _walk_bookmarks($bookmarks, $args = '' ) { * formatted bookmarks. * 'categorize' - Default is 1 (integer). Whether to show links listed by * category (default) or show links in one column. + * 'show_description' - Default is 0 (integer). Whether to show the description + * of the bookmark. * * These options define how the Category name will appear before the category * links are displayed, if 'categorize' is 1. If 'categorize' is 0, then it will @@ -187,7 +188,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) { * @link http://codex.wordpress.org/Template_Tags/wp_list_bookmarks * * @since 2.1.0 - * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return + * @uses _walk_bookmarks() Used to iterate over all of the bookmarks and return * the html * @uses get_terms() Gets all of the categories that are for links. * @@ -214,16 +215,28 @@ function wp_list_bookmarks($args = '') { $output = ''; if ( $categorize ) { - //Split the bookmarks into ul's for each category - $cats = get_terms('link_category', array('name__like' => $category_name, 'include' => $category, 'exclude' => $exclude_category, 'orderby' => $category_orderby, 'order' => $category_order, 'hierarchical' => 0)); + $cats = get_terms( 'link_category', array( 'name__like' => $category_name, 'include' => $category, 'exclude' => $exclude_category, 'orderby' => $category_orderby, 'order' => $category_order, 'hierarchical' => 0 ) ); + if ( empty( $cats ) ) + $categorize = false; + } + if ( $categorize ) { + // Split the bookmarks into ul's for each category foreach ( (array) $cats as $cat ) { $params = array_merge($r, array('category'=>$cat->term_id)); $bookmarks = get_bookmarks($params); if ( empty($bookmarks) ) continue; $output .= str_replace(array('%id', '%class'), array("linkcat-$cat->term_id", $class), $category_before); - $catname = apply_filters( "link_category", $cat->name ); + /** + * Filter the bookmarks category name. + * + * @since 2.2.0 + * + * @param string $cat->name The category name of bookmarks. + */ + $catname = apply_filters( 'link_category', $cat->name ); + $output .= "$title_before$catname$title_after\n\t\n$category_after\n"; @@ -244,11 +257,16 @@ function wp_list_bookmarks($args = '') { } } + /** + * Filter the bookmarks list before it is echoed or returned. + * + * @since 2.5.0 + * + * @param string $output The HTML list of bookmarks. + */ $output = apply_filters( 'wp_list_bookmarks', $output ); if ( !$echo ) return $output; echo $output; } - -?>