| | 262 | function _walk_bookmarks($bookmarks, $args = '' ) { |
|---|
| | 263 | if ( is_array($args) ) |
|---|
| | 264 | $r = &$args; |
|---|
| | 265 | else |
|---|
| | 266 | parse_str($args, $r); |
|---|
| | 267 | |
|---|
| | 268 | $defaults = array('show_updated' => 0, 'show_description' => 0, 'show_images' => 0, 'before' => '<li>', |
|---|
| | 269 | 'after' => '</li>', 'between' => "\n"); |
|---|
| | 270 | $r = array_merge($defaults, $r); |
|---|
| | 271 | extract($r); |
|---|
| | 272 | |
|---|
| | 273 | foreach ( (array) $bookmarks as $bookmark ) { |
|---|
| | 274 | if (!isset($bookmark->recently_updated)) $bookmark->recently_updated = false; |
|---|
| | 275 | $output .= $before; |
|---|
| | 276 | if ($show_updated && $bookmark->recently_updated) { |
|---|
| | 277 | $output .= get_settings('links_recently_updated_prepend'); |
|---|
| | 278 | } |
|---|
| | 279 | |
|---|
| | 280 | $the_link = '#'; |
|---|
| | 281 | if (!empty($bookmark->link_url)) |
|---|
| | 282 | $the_link = wp_specialchars($bookmark->link_url); |
|---|
| | 283 | |
|---|
| | 284 | $rel = $bookmark->link_rel; |
|---|
| | 285 | if ($rel != '') { |
|---|
| | 286 | $rel = ' rel="' . $rel . '"'; |
|---|
| | 287 | } |
|---|
| | 288 | |
|---|
| | 289 | $desc = wp_specialchars($bookmark->link_description, ENT_QUOTES); |
|---|
| | 290 | $name = wp_specialchars($bookmark->link_name, ENT_QUOTES); |
|---|
| | 291 | $title = $desc; |
|---|
| | 292 | |
|---|
| | 293 | if ($show_updated) { |
|---|
| | 294 | if (substr($bookmark->link_updated_f, 0, 2) != '00') { |
|---|
| | 295 | $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $bookmark->link_updated_f + (get_settings('gmt_offset') * 3600)) . ')'; |
|---|
| | 296 | } |
|---|
| | 297 | } |
|---|
| | 298 | |
|---|
| | 299 | if ('' != $title) { |
|---|
| | 300 | $title = ' title="' . $title . '"'; |
|---|
| | 301 | } |
|---|
| | 302 | |
|---|
| | 303 | $alt = ' alt="' . $name . '"'; |
|---|
| | 304 | |
|---|
| | 305 | $target = $bookmark->link_target; |
|---|
| | 306 | if ('' != $target) { |
|---|
| | 307 | $target = ' target="' . $target . '"'; |
|---|
| | 308 | } |
|---|
| | 309 | |
|---|
| | 310 | $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; |
|---|
| | 311 | |
|---|
| | 312 | if (($bookmark->link_image != null) && $show_images) { |
|---|
| | 313 | if (strstr($bookmark->link_image, 'http')) |
|---|
| | 314 | $output .= "<img src=\"$bookmark->link_image\" $alt $title />"; |
|---|
| | 315 | else // If it's a relative path |
|---|
| | 316 | $output .= "<img src=\"" . get_settings('siteurl') . "$bookmark->link_image\" $alt $title />"; |
|---|
| | 317 | } else { |
|---|
| | 318 | $output .= $name; |
|---|
| | 319 | } |
|---|
| | 320 | |
|---|
| | 321 | $output .= '</a>'; |
|---|
| | 322 | |
|---|
| | 323 | if ($show_updated && $bookmark->recently_updated) { |
|---|
| | 324 | $output .= get_settings('links_recently_updated_append'); |
|---|
| | 325 | } |
|---|
| | 326 | |
|---|
| | 327 | if ($show_description && ($desc != '')) { |
|---|
| | 328 | $output .= $between . $desc; |
|---|
| | 329 | } |
|---|
| | 330 | $output .= "$after\n"; |
|---|
| | 331 | } // end while |
|---|
| | 332 | |
|---|
| | 333 | return $output; |
|---|
| | 334 | } |
|---|
| | 335 | |
|---|
| 268 | | $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => 0, 'category' => 0, |
|---|
| 269 | | 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' =>1, |
|---|
| 270 | | 'categorize' => 1, 'title_li' => __('Bookmarks')); |
|---|
| | 342 | $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => 0, |
|---|
| | 343 | 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, |
|---|
| | 344 | 'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '<h2>', 'title_after' => '</h2>', |
|---|
| | 345 | 'category_orderby' => 'name', 'category_order' => 'ASC'); |
|---|