| 1 | Index: bookmark-template.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- bookmark-template.php (revision 6475) |
|---|
| 4 | +++ bookmark-template.php (working copy) |
|---|
| 5 | @@ -1,5 +1,40 @@ |
|---|
| 6 | <?php |
|---|
| 7 | +/** |
|---|
| 8 | + * Bookmark Template Functions for usage in Themes |
|---|
| 9 | + * |
|---|
| 10 | + * @package WordPress |
|---|
| 11 | + * @subpackage Template |
|---|
| 12 | + */ |
|---|
| 13 | |
|---|
| 14 | +/** |
|---|
| 15 | + * _walk_bookmarks() - The formatted output of a list of bookmarks |
|---|
| 16 | + * |
|---|
| 17 | + * The $bookmarks array must contain bookmark objects and will be iterated over |
|---|
| 18 | + * to retrieve the bookmark to be used in the output. |
|---|
| 19 | + * |
|---|
| 20 | + * The output is formatted as HTML with no way to change that format. However, what |
|---|
| 21 | + * is between, before, and after can be changed. The link itself will be HTML. |
|---|
| 22 | + * |
|---|
| 23 | + * This function is used internally by wp_list_bookmarks() and should not be used by |
|---|
| 24 | + * themes. |
|---|
| 25 | + * |
|---|
| 26 | + * The defaults for overwriting are: |
|---|
| 27 | + * 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated. |
|---|
| 28 | + * 'show_description' - Default is 0 (integer). Whether to show the description of the bookmark. |
|---|
| 29 | + * 'show_images' - Default is 1 (integer). Whether to show link image if available. |
|---|
| 30 | + * 'before' - Default is '<li>' (string). The html or text to prepend to each bookmarks. |
|---|
| 31 | + * 'after' - Default is '</li>' (string). The html or text to append to each bookmarks. |
|---|
| 32 | + * 'between' - Default is '\n' (string). The string for use in between the link, description, and image. |
|---|
| 33 | + * 'show_rating' - Default is 0 (integer). Whether to show the link rating. |
|---|
| 34 | + * |
|---|
| 35 | + * @since 2.1 |
|---|
| 36 | + * @access private |
|---|
| 37 | + * @usedby wp_list_bookmarks() |
|---|
| 38 | + * |
|---|
| 39 | + * @param array $bookmarks List of bookmarks to traverse |
|---|
| 40 | + * @param string|array $args Optional. Overwrite the defaults. |
|---|
| 41 | + * @return string Formatted output in HTML |
|---|
| 42 | + */ |
|---|
| 43 | function _walk_bookmarks($bookmarks, $args = '' ) { |
|---|
| 44 | $defaults = array( |
|---|
| 45 | 'show_updated' => 0, 'show_description' => 0, |
|---|
| 46 | @@ -77,6 +112,46 @@ |
|---|
| 47 | return $output; |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | +/** |
|---|
| 51 | + * wp_list_bookmarks() - Retrieve or echo all of the bookmarks |
|---|
| 52 | + * |
|---|
| 53 | + * List of default arguments are as follows: |
|---|
| 54 | + * 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme. |
|---|
| 55 | + * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order. |
|---|
| 56 | + * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display. |
|---|
| 57 | + * 'category' - Default is empty string (string). Include the links in what category ID(s). |
|---|
| 58 | + * 'category_name' - Default is empty string (string). Get links by category name. |
|---|
| 59 | + * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'. |
|---|
| 60 | + * 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated. |
|---|
| 61 | + * 'echo' - Default is 1 (integer). Whether to echo (default) or return the formatted bookmarks. |
|---|
| 62 | + * 'categorize' - Default is 1 (integer). Whether to show links listed by category (default) or show links in one column. |
|---|
| 63 | + * |
|---|
| 64 | + * These options define how the Category name will appear before the category links are displayed, if 'categorize' is 1. |
|---|
| 65 | + * If 'categorize' is 0, then it will display for only the 'title_li' string and only if 'title_li' is not empty. |
|---|
| 66 | + * 'title_li' - Default is 'Bookmarks' (translatable string). What to show before the links appear. |
|---|
| 67 | + * 'title_before' - Default is '<h2>' (string). The HTML or text to show before the 'title_li' string. |
|---|
| 68 | + * 'title_after' - Default is '</h2>' (string). The HTML or text to show after the 'title_li' string. |
|---|
| 69 | + * 'class' - Default is 'linkcat' (string). The CSS class to use for the 'title_li'. |
|---|
| 70 | + * |
|---|
| 71 | + * 'category_before' - Default is '<li id="%id" class="%class">'. String must contain '%id' and '%class' to get |
|---|
| 72 | + * the id of the category and the 'class' argument. These are used for formatting in themes. Argument will be displayed |
|---|
| 73 | + * before the 'title_before' argument. |
|---|
| 74 | + * 'category_after' - Default is '</li>' (string). The HTML or text that will appear after the list of links. |
|---|
| 75 | + * |
|---|
| 76 | + * These are only used if 'categorize' is set to 1 or true. |
|---|
| 77 | + * 'category_orderby' - Default is 'name'. How to order the bookmark category based on term scheme. |
|---|
| 78 | + * 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending) or DESC (descending). |
|---|
| 79 | + * |
|---|
| 80 | + * @see _walk_bookmarks() For other arguments that can be set in this function and passed to _walk_bookmarks(). |
|---|
| 81 | + * @see get_bookmarks() For other arguments that can be set in this function and passed to get_bookmarks(). |
|---|
| 82 | + * |
|---|
| 83 | + * @since 2.1 |
|---|
| 84 | + * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return the html |
|---|
| 85 | + * @uses get_terms() Gets all of the categories that are for links. |
|---|
| 86 | + * |
|---|
| 87 | + * @param string|array $args Optional. Overwrite the defaults of the function |
|---|
| 88 | + * @return string|null Will only return if echo option is set to not echo. Default is not return anything. |
|---|
| 89 | + */ |
|---|
| 90 | function wp_list_bookmarks($args = '') { |
|---|
| 91 | $defaults = array( |
|---|
| 92 | 'orderby' => 'name', 'order' => 'ASC', |
|---|
| 93 | @@ -131,4 +206,4 @@ |
|---|
| 94 | echo $output; |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | -?> |
|---|
| 98 | +?> |
|---|
| 99 | \ No newline at end of file |
|---|