diff --git a/wp-includes/links.php b/wp-includes/links.php
index 1997c54d88..1c4e7d6e5d 100644
--- a/wp-includes/links.php
+++ b/wp-includes/links.php
@@ -168,19 +168,27 @@ function get_links($category = -1, $before = '', $after = '
',
if (!$results) {
return;
}
+
+ $output = "";
+
foreach ($results as $row) {
if (!isset($row->recently_updated)) $row->recently_updated = false;
- echo($before);
+ $output .= ($before);
+
if ($show_updated && $row->recently_updated) {
- echo get_settings('links_recently_updated_prepend');
+ $output .= get_settings('links_recently_updated_prepend');
}
+
$the_link = '#';
+
if ( !empty($row->link_url) )
$the_link = wp_specialchars($row->link_url);
$rel = $row->link_rel;
+
if ($rel != '') {
$rel = " rel='$rel'";
}
+
$desc = wp_specialchars($row->link_description, ENT_QUOTES);
$name = wp_specialchars($row->link_name, ENT_QUOTES);
@@ -202,27 +210,37 @@ function get_links($category = -1, $before = '', $after = '
',
if ('' != $target) {
$target = " target='$target'";
}
- echo("');
+
+ $output.= "';
+
if (($row->link_image != null) && $show_images) {
if (strstr($row->link_image, 'http'))
- echo "";
+ $output.= "";
else // If it's a relative path
- echo "link_image' $alt $title />";
+ $output.= "link_image' $alt $title />";
} else {
- echo($name);
+ $output.= $name;
}
- echo('');
+
+ $output.= '';
+
if ($show_updated && $row->recently_updated) {
- echo get_settings('links_recently_updated_append');
+ $output.= get_settings('links_recently_updated_append');
}
if ($show_description && ($desc != '')) {
- echo($between.$desc);
+ $output.= $between.$desc;
}
- echo("$after\n");
+ $output.= "$after\n";
} // end while
+
+ if($echo) {
+ echo $output;
+ } else {
+ return $output;
+ }
}