From a22a9f25c3d732f5b566ee49cc9bcab96dd4589a Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 30 Aug 2006 21:00:37 +0000 Subject: [PATCH] Deprecate link_pages(). Clean up wp_link_pages(). git-svn-id: http://svn.automattic.com/wordpress/trunk@4142 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/deprecated.php | 5 +++ wp-includes/post-template.php | 60 ++++++++++++++++------------------- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index bba457adbf..c65d06b404 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -486,4 +486,9 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') { return $link; } +function link_pages($before='
', $after='
', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') { + $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); + return wp_link_pages($args); +} + ?> diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 58ba562b24..4362176584 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -127,70 +127,66 @@ function get_the_excerpt($fakeit = true) { function wp_link_pages($args = '') { - parse_str($args, $r); - if ( !isset($r['before']) ) - $r['before'] = '

' . __('Pages:'); - if ( !isset($r['after']) ) - $r['after'] = '

'; - if ( !isset($r['next_or_number']) ) - $r['next_or_number'] = 'number'; - if ( !isset($r['nextpagelink']) ) - $r['nextpagelink'] = 'Next page'; - if ( !isset($r['previouspagelink']) ) - $r['previouspagelink'] = 'Previous page'; - if ( !isset($r['pagelink']) ) - $r['pagelink'] = '%'; - if ( !isset($r['more_file']) ) - $r['more_file'] = ''; + if ( is_array($args) ) + $r = &$args; + else + parse_str($args, $r); - link_pages($r['before'], $r['after'], $r['next_or_number'], $r['nextpagelink'], $r['previouspagelink'], $r['pagelink'], $r['more_file']); -} + $defaults = array('before' => '

' . __('Pages:'), 'after' => '

', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), + 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'more_file' => '', 'echo' => 1); + $r = array_merge($defaults, $r); + extract($r); - -function link_pages($before='
', $after='
', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') { global $id, $page, $numpages, $multipage, $more, $pagenow; if ( $more_file != '' ) $file = $more_file; else $file = $pagenow; + + $output = ''; if ( $multipage ) { if ( 'number' == $next_or_number ) { - echo $before; + $output .= $before; for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { $j = str_replace('%',"$i",$pagelink); - echo ' '; + $output .= ' '; if ( ($i != $page) || ((!$more) && ($page==1)) ) { if ( '' == get_settings('permalink_structure') ) - echo ''; + $output .= ''; else - echo ''; + $output .= ''; } - echo $j; + $output .= $j; if ( ($i != $page) || ((!$more) && ($page==1)) ) - echo ''; + $output .= ''; } - echo $after; + $output .= $after; } else { if ( $more ) { - echo $before; + $output .= $before; $i = $page - 1; if ( $i && $more ) { if ( '' == get_settings('permalink_structure') ) - echo ''.$previouspagelink.''; + $output .= ''.$previouspagelink.''; else - echo ''.$previouspagelink.''; + $output .= ''.$previouspagelink.''; } $i = $page + 1; if ( $i <= $numpages && $more ) { if ( '' == get_settings('permalink_structure') ) - echo ''.$nextpagelink.''; + $output .= ''.$nextpagelink.''; else - echo ''.$nextpagelink.''; + $output .= ''.$nextpagelink.''; } - echo $after; + $output .= $after; } } } + + if ( $echo ) + echo $output; + + return $output; }