]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/bookmark-template.php
Wordpress 3.7
[autoinstalls/wordpress.git] / wp-includes / bookmark-template.php
index bb4f6ef37aacb19c02d5b2b60152c5de81c97744..64e73a88d0175e3c9a3ad92305ffe3c7a7ab9a8c 100644 (file)
@@ -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 .= ')';
                        }
 
@@ -90,7 +89,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
 
                $rel = $bookmark->link_rel;
                if ( '' != $rel )
-                       $rel = ' rel="' . $rel . '"';
+                       $rel = ' rel="' . esc_attr($rel) . '"';
 
                $target = $bookmark->link_target;
                if ( '' != $target )
@@ -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<ul class='xoxo blogroll'>\n";
                        $output .= _walk_bookmarks($bookmarks, $r);
                        $output .= "\n\t</ul>\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;
 }
-
-?>