Changeset 8961 for trunk/wp-includes/link-template.php
- Timestamp:
- 09/23/2008 09:11:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r8896 r8961 794 794 } 795 795 796 function get_comments_pagenum_link($pagenum = 1) { 797 global $wp_rewrite; 798 799 $pagenum = (int) $pagenum; 800 801 $request = remove_query_arg( 'cpage' ); 802 803 $home_root = parse_url(get_option('home')); 804 $home_root = ( isset($home_root['path']) ) ? $home_root['path'] : ''; 805 $home_root = preg_quote( trailingslashit( $home_root ), '|' ); 806 807 $request = preg_replace('|^'. $home_root . '|', '', $request); 808 $request = preg_replace('|^/+|', '', $request); 809 810 $base = trailingslashit( get_bloginfo( 'home' ) ); 811 812 if ( $pagenum > 1 ) { 813 $result = add_query_arg( 'cpage', $pagenum, $base . $request ); 814 } else { 815 $result = $base . $request; 816 } 817 818 $result = apply_filters('get_comments_pagenum_link', $result); 819 820 return $result; 821 } 822 823 function next_comments_link($label='', $max_page = 0) { 824 global $wp_query; 825 826 if ( !is_singular() ) 827 return; 828 829 $page = get_query_var('cpage'); 830 831 if ( !$page ) 832 $page = 1; 833 834 if ( !$page ) 835 $page = 1; 836 837 $nextpage = intval($page) + 1; 838 839 if ( empty($max_page) ) 840 $max_page = $wp_query->max_num_comment_pages; 841 842 if ( $nextpage > $max_page ) 843 return; 844 845 if ( empty($label) ) 846 $label = __('» Newer Comments'); 847 848 echo '<a href="' . clean_url(get_comments_pagenum_link($nextpage)); 849 $attr = apply_filters( 'next_comments_link_attributes', '' ); 850 echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 851 } 852 853 function previous_comments_link($label='') { 854 global $wp_query; 855 856 if ( !is_singular() ) 857 return; 858 859 $page = get_query_var('cpage'); 860 861 if ( $page <= 1 ) 862 return; 863 864 $nextpage = intval($page) - 1; 865 866 if ( empty($label) ) 867 $label = __('« Older Comments'); 868 869 echo '<a href="' . clean_url(get_comments_pagenum_link($nextpage)); 870 $attr = apply_filters( 'previous_comments_link_attributes', '' ); 871 echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 872 } 873 796 874 function get_shortcut_link() { 797 875 $link = "javascript:
Note: See TracChangeset
for help on using the changeset viewer.