WordPress.org

Make WordPress Core

Changeset 1527 for trunk


Ignore:
Timestamp:
08/10/2004 05:35:59 AM (17 years ago)
Author:
rboren
Message:

Static pages. Take 1.

Location:
trunk
Files:
10 edited

Legend:

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

    r1494 r1527  
    9494<ul id="adminmenu2">
    9595  <li><a href="edit.php"><?php _e('Posts') ?></a></li>
     96  <li><a href="edit-pages.php"><?php _e('Pages') ?></a></li>
    9697  <li><a href="categories.php" class="current"><?php _e('Categories') ?></a></li>
    9798  <li><a href="edit-comments.php"><?php _e('Comments') ?></a></li>
     
    154155<ul id="adminmenu2">
    155156    <li><a href="edit.php"><?php _e('Posts') ?></a></li>
     157    <li><a href="edit-pages.php"><?php _e('Pages') ?></a></li>
    156158    <li><a class="current"><?php _e('Categories') ?></a></li>
    157159    <li><a href="edit-comments.php"><?php _e('Comments') ?></a></li>
  • trunk/wp-admin/edit-comments.php

    r1494 r1527  
    1010<ul id="adminmenu2">
    1111    <li><a href="edit.php"><?php _e('Posts') ?></a></li>
     12  <li><a href="edit-pages.php"><?php _e('Pages') ?></a></li>
    1213    <li><a href="categories.php"><?php _e('Categories') ?></a></li>
    1314    <li><a href="edit-comments.php" class="current"><?php _e('Comments') ?></a></li>
  • trunk/wp-admin/edit.php

    r1494 r1527  
    88 <ul id="adminmenu2">
    99  <li><a href="edit.php" class="current"><?php _e('Posts') ?></a></li>
     10  <li><a href="edit-pages.php"><?php _e('Pages') ?></a></li>
    1011  <li><a href="categories.php"><?php _e('Categories') ?></a></li>
    1112  <li><a href="edit-comments.php"><?php _e('Comments') ?></a></li>
  • trunk/wp-admin/moderation.php

    r1494 r1527  
    100100<ul id="adminmenu2">
    101101    <li><a href="edit.php"> <?php _e('Posts') ?></a></li>
     102    <li><a href="edit-pages.php"><?php _e('Pages') ?></a></li>
    102103    <li><a href="categories.php"><?php _e('Categories') ?></a></li>
    103104    <li><a href="edit-comments.php"> <?php _e('Comments') ?></a></li>
  • trunk/wp-admin/post.php

    r1512 r1527  
    108108    if ('' != $_POST['publish']) $post_status = 'publish';
    109109    if ('' != $_POST['advanced']) $post_status = 'draft';
    110 
     110    if ('' != $_POST['savepage']) $post_status = 'static';
    111111
    112112    if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) {
     
    143143    if ( '' != $_POST['advanced'] || isset($_POST['save']) )
    144144        $location = "post.php?action=edit&post=$post_ID";
     145
     146    if ( '' != $_POST['savepage'] )
     147        $location = "post.php?action=createpage";
    145148
    146149    header("Location: $location"); // Send user on their way while we keep working
     
    234237        $post_name = $postdata->post_name;
    235238
    236         include('edit-form-advanced.php');
     239        if ($post_status == 'static') {
     240            include('edit-page-form.php');
     241        } else {
     242            include('edit-form-advanced.php');
     243        }
    237244
    238245        $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
     
    712719    do_action('edit_comment', $comment_ID);
    713720    break;
     721
     722 case 'createpage':
     723    $standalone = 0;
     724    $title = __('Create New Page');
     725    require_once ('./admin-header.php');
     726
     727    if ($user_level > 0) {
     728        $action = 'post';
     729        get_currentuserinfo();
     730        //set defaults
     731        $post_status = 'static';
     732        $comment_status = get_settings('default_comment_status');
     733        $ping_status = get_settings('default_ping_status');
     734        $post_pingback = get_settings('default_pingback_flag');
     735        $default_post_cat = get_settings('default_post_category');
     736
     737        include('edit-page-form.php');
     738    } else {
     739?>
     740<div class="wrap">
     741        <p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />
     742You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
     743When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_settings('admin_email')); ?>
     744        </p>
     745</div>
     746<?php
     747
     748    }
     749
     750     break;
    714751
    715752default:
  • trunk/wp-blog-header.php

    r1516 r1527  
    5151}
    5252
    53 $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name');
     53$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static');
    5454
    5555for ($i=0; $i<count($wpvarstoreset); $i += 1) {
  • trunk/wp-includes/classes.php

    r1516 r1527  
    455455            $distinct = 'DISTINCT';
    456456        }
    457         $where .= ' AND (post_status = "publish"';
     457
     458    if ('' != $q['static']) {
     459      $where .= ' AND (post_status = "static"';
     460    } else {
     461      $where .= ' AND (post_status = "publish"';
     462    }
    458463
    459464        // Get private posts
    460465        if (isset($user_ID) && ('' != intval($user_ID)))
    461             $where .= " OR post_author = $user_ID AND post_status != 'draft')";
     466            $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";
    462467        else
    463468            $where .= ')';
  • trunk/wp-includes/functions.php

    r1523 r1527  
    11761176}
    11771177
     1178
     1179function page_permastruct() {
     1180    $permalink_structure = get_settings('permalink_structure');
     1181       
     1182    if (empty($permalink_structure)) {
     1183        return '';
     1184    }
     1185
     1186    $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));   
     1187    $index = get_settings('blogfilename');
     1188    $prefix = '';
     1189    if (preg_match('#^/*' . $index . '#', $front)) {
     1190        $prefix = $index . '/';
     1191    }
     1192
     1193    return '/' . $prefix . 'site/%pagename%';   
     1194}
     1195
    11781196function generate_rewrite_rules($permalink_structure = '', $matches = '') {
    11791197    $rewritecode =
     
    11881206    '%post_id%',
    11891207    '%category%',
    1190     '%author%'
     1208    '%author%',
     1209    '%pagename%'
    11911210    );
    11921211
     
    12021221    '([0-9]+)',
    12031222    '([/_0-9a-z-]+)',
    1204     '([_0-9a-z-]+)'
     1223    '([_0-9a-z-]+)',
     1224    '([_0-9a-z-]+)',
    12051225    );
    12061226
     
    12161236    'p=',
    12171237    'category_name=',
    1218     'author_name='
     1238    'author_name=',
     1239    'static=1&name=',   
    12191240    );
    12201241
     
    13561377    $author_rewrite = generate_rewrite_rules($author_structure, $matches);
    13571378
     1379    // Site static pages
     1380    $page_structure = $prefix . 'site/%pagename%';
     1381    $page_rewrite = generate_rewrite_rules($page_structure, $matches);
     1382
    13581383    // Put them together.
    1359     $rewrite = $site_rewrite + $category_rewrite + $author_rewrite;
     1384    $rewrite = $site_rewrite + $page_rewrite + $category_rewrite + $author_rewrite;
    13601385
    13611386    // Add on archive rewrite rules if needed.
     
    14651490        WHERE category_id = cat_ID AND post_id = ID AND post_id IN ($post_id_list)");
    14661491       
    1467     foreach ($dogs as $catt) {
    1468         $category_cache[$catt->ID][] = $catt;
     1492    if (!empty($dogs)) {
     1493        foreach ($dogs as $catt) {
     1494            $category_cache[$catt->ID][] = $catt;
     1495        }
    14691496    }
    14701497
  • trunk/wp-includes/template-functions-category.php

    r1486 r1527  
    6565function the_category($seperator = '', $parents='') {
    6666    $categories = get_the_category();
     67    if (empty($categories)) {
     68        _e('Uncategorized');
     69        return;
     70    }
     71
    6772    $thelist = '';
    6873    if ('' == $seperator) {
  • trunk/wp-includes/template-functions-links.php

    r1514 r1527  
    4040        '%postname%',
    4141        '%post_id%',
    42         '%category%'
     42        '%category%',
     43        '%pagename%'
    4344    );
    4445
    4546    if ($id) {
    46         $idpost = $wpdb->get_row("SELECT ID, post_date, post_name FROM $wpdb->posts WHERE ID = $id");
     47        $idpost = $wpdb->get_row("SELECT ID, post_date, post_name, post_status FROM $wpdb->posts WHERE ID = $id");
    4748    } else {
    4849        $idpost = $post;
    4950    }
    50        
    51     if ('' != get_settings('permalink_structure')) {
     51
     52    $permalink = get_settings('permalink_structure');
     53
     54    if ('' != $permalink) {
     55        if ($idpost->post_status == 'static') {
     56            $permalink = page_permastruct();
     57        }
     58
    5259        $unixtime = strtotime($idpost->post_date);
    5360
     
    6471                                $idpost->post_name,
    6572                                $idpost->ID,
    66                                 $category
     73                                $category,
     74                                $idpost->post_name,
    6775                                );
    68         return get_settings('home') . str_replace($rewritecode, $rewritereplace, get_settings('permalink_structure'));
     76        return get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink);
    6977    } else { // if they're not using the fancy permalink option
    70         return get_settings('home') . '/' . get_settings('blogfilename').$querystring_start.'p'.$querystring_equal.$idpost->ID;
     78        $permalink = get_settings('home') . '/' . get_settings('blogfilename').$querystring_start.'p'.$querystring_equal.$idpost->ID;
     79        if ($idpost->post_status == 'static') {
     80            $permalink .=  $querystring_separator . "static=1";
     81        }
    7182    }
    7283}
Note: See TracChangeset for help on using the changeset viewer.