diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php
index 8bed640000..e33baa38a2 100644
--- a/wp-includes/bookmark-template.php
+++ b/wp-includes/bookmark-template.php
@@ -20,17 +20,17 @@ function wp_get_links($args = '') {
parse_str($args);
- if (! isset($category)) $category = -1;
- if (! isset($before)) $before = '';
- if (! isset($after)) $after = '
';
- if (! isset($between)) $between = ' ';
- if (! isset($show_images)) $show_images = true;
- if (! isset($orderby)) $orderby = 'name';
- if (! isset($show_description)) $show_description = true;
- if (! isset($show_rating)) $show_rating = false;
- if (! isset($limit)) $limit = -1;
- if (! isset($show_updated)) $show_updated = 1;
- if (! isset($echo)) $echo = true;
+ if ( !isset($category) ) $category = -1;
+ if ( !isset($before) ) $before = '';
+ if ( !isset($after) ) $after = '
';
+ if ( !isset($between) ) $between = ' ';
+ if ( !isset($show_images) ) $show_images = true;
+ if ( !isset($orderby) ) $orderby = 'name';
+ if ( !isset($show_description) ) $show_description = true;
+ if ( !isset($show_rating) ) $show_rating = false;
+ if ( !isset($limit) ) $limit = -1;
+ if ( !isset($show_updated) ) $show_updated = 1;
+ if ( !isset($echo) ) $echo = true;
return get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo);
} // end wp_get_links
@@ -73,65 +73,55 @@ function get_links($category = -1,
global $wpdb;
$order = 'ASC';
- if (substr($orderby, 0, 1) == '_') {
+ if ( substr($orderby, 0, 1) == '_' ) {
$order = 'DESC';
$orderby = substr($orderby, 1);
}
-
- if ($category == -1) { //get_bookmarks uses '' to signify all categories
+
+ if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
$category = '';
- }
$results = get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=$show_updated&limit=$limit");
- if (!$results) {
+ if ( !$results )
return;
- }
-
$output = '';
- foreach ($results as $row) {
- if (!isset($row->recently_updated)) $row->recently_updated = false;
- $output .= $before;
- if ($show_updated && $row->recently_updated) {
+ foreach ( (array) $results as $row ) {
+ if ( !isset($row->recently_updated) )
+ $row->recently_updated = false;
+ $output .= $before;
+ if ( $show_updated && $row->recently_updated )
$output .= get_settings('links_recently_updated_prepend');
- }
-
$the_link = '#';
- if (!empty($row->link_url))
+ if ( !empty($row->link_url) )
$the_link = wp_specialchars($row->link_url);
-
$rel = $row->link_rel;
- if ($rel != '') {
+ if ( '' != $rel )
$rel = ' rel="' . $rel . '"';
- }
$desc = wp_specialchars($row->link_description, ENT_QUOTES);
$name = wp_specialchars($row->link_name, ENT_QUOTES);
$title = $desc;
- if ($show_updated) {
- if (substr($row->link_updated_f, 0, 2) != '00') {
+ if ( $show_updated )
+ if (substr($row->link_updated_f, 0, 2) != '00')
$title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $row->link_updated_f + (get_settings('gmt_offset') * 3600)) . ')';
- }
- }
- if ('' != $title) {
+ if ( '' != $title )
$title = ' title="' . $title . '"';
- }
$alt = ' alt="' . $name . '"';
$target = $row->link_target;
- if ('' != $target) {
+ if ( '' != $target )
$target = ' target="' . $target . '"';
- }
$output .= '';
- if (($row->link_image != null) && $show_images) {
- if (strstr($row->link_image, 'http'))
+ if ( $row->link_image != null && $show_images ) {
+ if ( strpos($row->link_image, 'http') !== false )
$output .= "link_image\" $alt $title />";
else // If it's a relative path
$output .= "
link_image\" $alt $title />";
@@ -141,21 +131,18 @@ function get_links($category = -1,
$output .= '';
- if ($show_updated && $row->recently_updated) {
+ if ( $show_updated && $row->recently_updated )
$output .= get_settings('links_recently_updated_append');
- }
- if ($show_description && ($desc != '')) {
+ if ( $show_description && '' != $desc )
$output .= $between . $desc;
- }
+
$output .= "$after\n";
} // end while
- if ($echo) {
- echo $output;
- } else {
+ if ( !$echo )
return $output;
- }
+ echo $output;
}
function get_linkrating($link) {
@@ -170,9 +157,9 @@ function get_linkrating($link) {
function get_linkcatname($id = 0) {
$id = (int) $id;
- if ( empty($id) )
- return '';
-
+ if ( empty($id) )
+ return '';
+
$cats = wp_get_link_cats($id);
if ( empty($cats) || ! is_array($cats) )
@@ -194,24 +181,18 @@ function get_linkcatname($id = 0) {
** file (default linkspopup.php) - the page to open in the popup window
** count (default true) - the number of links in the db
*/
-function links_popup_script($text = 'Links', $width=400, $height=400,
- $file='links.all.php', $count = true) {
- if ($count == true) {
- $counts = $wpdb->get_var("SELECT count(*) FROM $wpdb->links");
- }
+function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
+ if ( $count )
+ $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links");
- $javascript = "";
- $javascript .= $text;
+ $javascript = "";
+ $javascript .= $text;
- if ($count == true) {
- $javascript .= " ($counts)";
- }
+ if ( $count )
+ $javascript .= " ($counts)";
- $javascript .="\n\n";
- echo $javascript;
+ $javascript .= "\n\n";
+ echo $javascript;
}
@@ -233,25 +214,25 @@ function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
// Handle link category sorting
$direction = 'ASC';
- if (substr($order,0,1) == '_') {
+ if ( '_' == substr($order,0,1) ) {
$direction = 'DESC';
$order = substr($order,1);
}
- if (!isset($direction)) $direction = '';
+ if ( !isset($direction) )
+ $direction = '';
$cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0");
// Display each category
- if ($cats) {
- foreach ($cats as $cat) {
+ if ( $cats ) {
+ foreach ( (array) $cats as $cat ) {
// Handle each category.
// Display the category name
echo '