Make WordPress Core

Changeset 2481


Ignore:
Timestamp:
03/28/2005 02:34:16 AM (20 years ago)
Author:
ryan
Message:

Add paging to Manage->Posts. http://mosquito.wordpress.org/view.php?id=1177

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r2452 r2481  
    6767<h2>
    6868<?php
    69 if ( $_GET['m'] ) {
    70     echo $month[substr( $_GET['m'], 4, 2 )] . ' ' . substr( $_GET['m'], 0, 4 );
    71 } elseif ( isset( $_GET['s'] ) ) {
     69$what_to_show = 'posts';
     70$posts_per_page = 15;
     71$posts_per_archive_page = -1;
     72
     73include(ABSPATH.'wp-blog-header.php');
     74
     75if ( is_month() ) {
     76    single_month_title(' ');
     77} elseif ( is_search() ) {
    7278    printf(__('Search for &#8220;%s&#8221;'), wp_specialchars($_GET['s']) );
    7379} else {
    74     _e('Last 15 Posts');
     80    if ( ! is_paged() || get_query_var('paged') == 1 )
     81        _e('Last 15 Posts');
     82    else
     83        _e('Previous Posts');
    7584}
    7685?>
     
    141150    </tr>
    142151<?php
    143 $what_to_show = 'posts';
    144 if ( empty($_GET['m']) || 0 == $_GET['m'] && empty($_GET['s']) ) {
    145   $showposts = 15;
    146 } else {
    147   $nopaging = true;
    148 }
    149 
    150 include(ABSPATH.'wp-blog-header.php');
    151 
    152152if ($posts) {
    153153$bgcolor = '';
     
    239239?>
    240240</table>
     241
     242<div class="navigation">
     243<div class="alignleft"><?php next_posts_link(__('&laquo; Previous Entries')) ?></div>
     244<div class="alignright"><?php previous_posts_link(__('Next Entries &raquo;')) ?></div>
     245</div>
     246
    241247<?php
    242248if ( 1 == count($posts) ) {
  • trunk/wp-admin/wp-admin.css

    r2460 r2481  
    142142}
    143143
     144.alignleft {
     145    float: left
     146}
     147
     148.alignright {
     149    float: right;
     150}
     151
    144152.alternate {
    145153    background: #eee;
     
    172180.hidden {
    173181    display: none;
     182}
     183
     184.navigation {
     185    display: block;
     186    text-align: center;
     187    margin-top: 10px;
     188    margin-bottom: 30px;
    174189}
    175190
  • trunk/wp-includes/functions.php

    r2479 r2481  
    13961396}
    13971397
     1398function is_admin () {
     1399    global $wp_query;
     1400
     1401    return $wp_query->is_admin;
     1402}
     1403
    13981404function is_home () {
    13991405    global $wp_query;
  • trunk/wp-includes/template-functions-links.php

    r2478 r2481  
    369369}
    370370
    371 function get_pagenum_link($pagenum = 1){
     371function get_pagenum_link($pagenum = 1) {
    372372    global $wp_rewrite;
    373373
    374    $qstr = $_SERVER['REQUEST_URI'];
    375 
    376    $page_querystring = "paged";
    377    $page_modstring = "page/";
    378    $page_modregex = "page/?";
    379    $permalink = 0;
    380      $index = 'index.php';
    381 
    382      $home_root = parse_url(get_settings('home'));
    383      $home_root = $home_root['path'];
    384    $home_root = trailingslashit($home_root);
    385    $qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
    386    $qstr = preg_replace('|^/+|', '', $qstr);
    387 
    388    // if we already have a QUERY style page string
    389    if( stristr( $qstr, $page_querystring ) ) {
    390        $replacement = "$page_querystring=$pagenum";
    391       $qstr = preg_replace("/".$page_querystring."[^\d]+\d+/", $replacement, $qstr);
    392    // if we already have a mod_rewrite style page string
    393    } elseif ( preg_match( '|'.$page_modregex.'\d+|', $qstr ) ){
    394       $permalink = 1;
    395       $qstr = preg_replace('|'.$page_modregex.'\d+|',"$page_modstring$pagenum",$qstr);
    396 
    397    // if we don't have a page string at all ...
    398    // lets see what sort of URL we have...
    399    } else {
    400       // we need to know the way queries are being written
    401       // if there's a querystring_start (a "?" usually), it's deffinitely not mod_rewritten
    402       if ( stristr( $qstr, '?' ) ){
    403          // so append the query string (using &, since we already have ?)
    404          $qstr .=  '&amp;' . $page_querystring . '=' . $pagenum;
    405          // otherwise, it could be rewritten, OR just the default index ...
    406       } elseif( '' != get_settings('permalink_structure')) {
    407          $permalink = 1;
    408 
    409      // If it's not a path info permalink structure, trim the index.
    410      if (! $wp_rewrite->using_index_permalinks()) {
    411        $qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
    412      } else {
    413        // If using path info style permalinks, make sure the index is in
    414        // the URI.
    415        if (strpos($qstr, $index) === false) {
    416          $qstr = '/' . $index . $qstr;
    417        }
    418      }
    419 
    420      $qstr =  trailingslashit($qstr) . $page_modstring . $pagenum;
    421       } else {
    422          $qstr = $index . '?' . $page_querystring . '=' . $pagenum;
    423       }
    424    }
    425 
    426    $qstr = preg_replace('|^/+|', '', $qstr);
    427    if ($permalink) $qstr = trailingslashit($qstr);
    428    return preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_settings('home') ) . $qstr );
     374    $qstr = $_SERVER['REQUEST_URI'];
     375
     376    $page_querystring = "paged";
     377    $page_modstring = "page/";
     378    $page_modregex = "page/?";
     379    $permalink = 0;
     380    //$index = 'index.php';
     381    $index = $_SERVER['SCRIPT_NAME'];
     382
     383    $home_root = parse_url(get_settings('home'));
     384    $home_root = $home_root['path'];
     385    $home_root = trailingslashit($home_root);
     386    $qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
     387    $qstr = preg_replace('|^/+|', '', $qstr);
     388
     389    // if we already have a QUERY style page string
     390    if( stristr( $qstr, $page_querystring ) ) {
     391        $replacement = "$page_querystring=$pagenum";
     392        $qstr = preg_replace("/".$page_querystring."[^\d]+\d+/", $replacement, $qstr);
     393        // if we already have a mod_rewrite style page string
     394    } elseif ( preg_match( '|'.$page_modregex.'\d+|', $qstr ) ){
     395        $permalink = 1;
     396        $qstr = preg_replace('|'.$page_modregex.'\d+|',"$page_modstring$pagenum",$qstr);
     397
     398        // if we don't have a page string at all ...
     399        // lets see what sort of URL we have...
     400    } else {
     401        // we need to know the way queries are being written
     402        // if there's a querystring_start (a "?" usually), it's definitely not mod_rewritten
     403        if ( stristr( $qstr, '?' ) ){
     404            // so append the query string (using &, since we already have ?)
     405            $qstr .=  '&amp;' . $page_querystring . '=' . $pagenum;
     406            // otherwise, it could be rewritten, OR just the default index ...
     407        } elseif( '' != get_settings('permalink_structure') && ! is_admin()) {
     408            $permalink = 1;
     409            $index = $wp_rewrite->index;
     410            // If it's not a path info permalink structure, trim the index.
     411            if (! $wp_rewrite->using_index_permalinks()) {
     412                $qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
     413            } else {
     414                // If using path info style permalinks, make sure the index is in
     415                // the URI.
     416                if (strpos($qstr, $index) === false) {
     417                    $qstr = '/' . $index . $qstr;
     418                }
     419            }
     420
     421            $qstr =  trailingslashit($qstr) . $page_modstring . $pagenum;
     422        } else {
     423            $qstr = $index . '?' . $page_querystring . '=' . $pagenum;
     424        }
     425    }
     426
     427    $qstr = preg_replace('|^/+|', '', $qstr);
     428    if ($permalink) $qstr = trailingslashit($qstr);
     429    return preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_settings('home') ) . $qstr );
    429430}
    430431
Note: See TracChangeset for help on using the changeset viewer.