Make WordPress Core

Ticket #1177: page_post_editor.diff

File page_post_editor.diff, 7.2 KB (added by MC_incubus, 21 years ago)
  • wp-includes/template-functions-links.php

     
    368368    }
    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'];
     374        $qstr = $_SERVER['REQUEST_URI'];
    375375
    376    $page_querystring = "paged";
    377    $page_modstring = "page/";
    378    $page_modregex = "page/?";
    379    $permalink = 0;
    380          $index = 'index.php';
     376        $page_querystring = "paged";
     377        $page_modstring = "page/";
     378        $page_modregex = "page/?";
     379        $permalink = 0;
     380        //$index = 'index.php';
     381        $index = $_SERVER['SCRIPT_NAME'];
    381382
    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);
     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);
    387388
    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);
     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);
    396397
    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 .=  '&' . $page_querystring . '=' . $pagenum;
    405          // otherwise, it could be rewritten, OR just the default index ...
    406       } elseif( '' != get_settings('permalink_structure')) {
    407          $permalink = 1;
     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 .=  '&' . $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                        }
    408420
    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          }
     421                        $qstr =  trailingslashit($qstr) . $page_modstring . $pagenum;
     422                } else {
     423                        $qstr = $index . '?' . $page_querystring . '=' . $pagenum;
     424                }
     425        }
    419426
    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};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr );
     427        $qstr = preg_replace('|^/+|', '', $qstr);
     428        if ($permalink) $qstr = trailingslashit($qstr);
     429        return preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr );
    429430}
    430431
    431432function next_posts($max_page = 0) { // original by cfactor at cooltux.org
  • wp-includes/functions.php

     
    13951395    return $wp_query->is_trackback;
    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;
    14001406
  • wp-admin/wp-admin.css

     
    141141        padding: 3px;
    142142}
    143143
     144.alignleft {
     145        float: left
     146}
     147
     148.alignright {
     149        float: right;
     150}
     151
    144152.alternate {
    145153        background: #eee;
    146154}
     
    173181        display: none;
    174182}
    175183
     184.navigation {
     185        display: block;
     186        text-align: center;
     187        margin-top: 10px;
     188        margin-bottom: 30px;
     189}
     190
    176191.post-categories {
    177192        display: inline;
    178193        margin: 0;
  • wp-admin/edit.php

     
    6666<div class="wrap">
    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?>
    7786</h2>
     
    140149
    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 }
     152// $what_to_show = 'posts';
     153// $posts_per_page = 15;
     154// $posts_per_archive_page = -1;
    149155
    150 include(ABSPATH.'wp-blog-header.php');
     156// include(ABSPATH.'wp-blog-header.php');
    151157
    152158if ($posts) {
    153159$bgcolor = '';
     
    238244} // end if ($posts)
    239245?>
    240246</table>
     247
     248<div class="navigation">
     249<div class="alignleft"><?php next_posts_link(__('&laquo; Previous Entries')) ?></div>
     250<div class="alignright"><?php previous_posts_link(__('Next Entries &raquo;')) ?></div>
     251</div>
     252
    241253<?php
    242254if ( 1 == count($posts) ) {
    243255