Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 9549)
+++ wp-includes/link-template.php	(working copy)
@@ -1054,25 +1054,32 @@
 }
 
 /**
- * Display the next posts pages link.
+ * Display or return the next posts pages link.
  *
  * @since 0.71
  *
  * @param int $max_page Optional. Max pages.
+ * @param boolean $echo Optional. Echo or return;
  */
-function next_posts($max_page = 0) {
-	echo clean_url(get_next_posts_page_link($max_page));
+function next_posts( $max_page = 0, $echo = true ) {
+	$output = clean_url( get_next_posts_page_link( $max_page ) );
+
+	if ( $echo )
+		echo $output;
+	else
+		return $output;
 }
 
 /**
- * Display the next posts pages link.
+ * Return the next posts pages link.
  *
- * @since 0.71
+ * @since 2.7.0
  *
  * @param string $label Content for link text.
  * @param int $max_page Optional. Max pages.
+ * @return string
  */
-function next_posts_link($label='Next Page &raquo;', $max_page=0) {
+function get_next_posts_link( $label = 'Next Page &raquo;', $max_page = 0 ) {
 	global $paged, $wp_query;
 	if ( !$max_page ) {
 		$max_page = $wp_query->max_num_pages;
@@ -1080,15 +1087,28 @@
 	if ( !$paged )
 		$paged = 1;
 	$nextpage = intval($paged) + 1;
-	if ( (! is_single()) && (empty($paged) || $nextpage <= $max_page) ) {
-		echo '<a href="';
-		next_posts($max_page);
+	$output = '';
+	if ( (!is_single() ) && ( empty($paged) || $nextpage <= $max_page) ) {
 		$attr = apply_filters( 'next_posts_link_attributes', '' );
-		echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
+		$output = '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
 	}
+	return $output;
 }
 
 /**
+ * Display the next posts pages link.
+ *
+ * @since 0.71
+ * @uses get_next_posts_link()
+ *
+ * @param string $label Content for link text.
+ * @param int $max_page Optional. Max pages.
+ */
+function next_posts_link( $label = 'Next Page &raquo;', $max_page = 0 ) {
+	echo get_next_posts_link( $label, $max_page );
+}
+
+/**
  * Retrieve previous post pages link.
  *
  * Will only return string, if not on a single page or post.
@@ -1111,32 +1131,52 @@
 }
 
 /**
- * Display previous posts pages link.
+ * Display or return the previous posts pages link.
  *
  * @since 0.71
+ *
+ * @param boolean $echo Optional. Echo or return;
  */
-function previous_posts() {
-	echo clean_url(get_previous_posts_page_link());
+function previous_posts( $echo = true ) {
+	$output = clean_url( get_previous_posts_page_link() );
+
+	if ( $echo )
+		echo $output;
+	else
+		return $output;
 }
 
 /**
- * Display previous posts page link.
+ * Return the previous posts pages link.
  *
- * @since 0.71
+ * @since 2.7.0
  *
  * @param string $label Optional. Previous page link text.
+ * @return string
  */
-function previous_posts_link($label='&laquo; Previous Page') {
+function get_previous_posts_link( $label = '&laquo; Previous Page' ) {
 	global $paged;
-	if ( (!is_single())	&& ($paged > 1) ) {
-		echo '<a href="';
-		previous_posts();
+	$output = '';
+	if ( (!is_single() ) && ( $paged > 1) ) {
 		$attr = apply_filters( 'previous_posts_link_attributes', '' );
-		echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
+		$output = '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label ) .'</a>';
 	}
+	return $output;
 }
 
 /**
+ * Display the previous posts page link.
+ *
+ * @since 0.71
+ * @uses get_previous_posts_link()
+ *
+ * @param string $label Optional. Previous page link text.
+ */
+function previous_posts_link( $label = '&laquo; Previous Page' ) {
+	echo get_previous_posts_link( $label );
+}
+
+/**
  * Display post pages link navigation for previous and next pages.
  *
  * @since 0.71
@@ -1145,7 +1185,7 @@
  * @param string $prelabel Optional. Label for previous pages.
  * @param string $nxtlabel Optional Label for next pages.
  */
-function posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nxtlabel='Next Page &raquo;') {
+function posts_nav_link( $sep = ' &#8212; ', $prelabel = '&laquo; Previous Page', $nxtlabel = 'Next Page &raquo;' ) {
 	global $wp_query;
 	if ( !is_singular() ) {
 		$max_num_pages = $wp_query->max_num_pages;

