Deprecate link_pages(). Clean up wp_link_pages().
git-svn-id: http://svn.automattic.com/wordpress/trunk@4142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3879ad5584
commit
a22a9f25c3
|
@ -486,4 +486,9 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') {
|
|||
return $link;
|
||||
}
|
||||
|
||||
function link_pages($before='<br />', $after='<br />', $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);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -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'] = '<p>' . __('Pages:');
|
||||
if ( !isset($r['after']) )
|
||||
$r['after'] = '</p>';
|
||||
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' => '<p>' . __('Pages:'), 'after' => '</p>', '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='<br />', $after='<br />', $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 '<a href="' . get_permalink() . '&page=' . $i . '">';
|
||||
$output .= '<a href="' . get_permalink() . '&page=' . $i . '">';
|
||||
else
|
||||
echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
|
||||
$output .= '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
|
||||
}
|
||||
echo $j;
|
||||
$output .= $j;
|
||||
if ( ($i != $page) || ((!$more) && ($page==1)) )
|
||||
echo '</a>';
|
||||
$output .= '</a>';
|
||||
}
|
||||
echo $after;
|
||||
$output .= $after;
|
||||
} else {
|
||||
if ( $more ) {
|
||||
echo $before;
|
||||
$output .= $before;
|
||||
$i = $page - 1;
|
||||
if ( $i && $more ) {
|
||||
if ( '' == get_settings('permalink_structure') )
|
||||
echo '<a href="' . get_permalink() . '&page=' . $i . '">'.$previouspagelink.'</a>';
|
||||
$output .= '<a href="' . get_permalink() . '&page=' . $i . '">'.$previouspagelink.'</a>';
|
||||
else
|
||||
echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
|
||||
$output .= '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
|
||||
}
|
||||
$i = $page + 1;
|
||||
if ( $i <= $numpages && $more ) {
|
||||
if ( '' == get_settings('permalink_structure') )
|
||||
echo '<a href="'.get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>';
|
||||
$output .= '<a href="'.get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>';
|
||||
else
|
||||
echo '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>';
|
||||
$output .= '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>';
|
||||
}
|
||||
echo $after;
|
||||
$output .= $after;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $echo )
|
||||
echo $output;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue