Make WordPress Core


Ignore:
Timestamp:
06/19/2005 02:51:48 AM (21 years ago)
Author:
ryan
Message:

Add get_post_to_edit() and get_default_post_to_edit(). More post.php cleanup.

File:
1 edited

Legend:

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

    r2639 r2651  
    2323$form_pingback = '<input type="hidden" name="post_pingback" value="' . get_option('default_pingback_flag') . '" id="post_pingback" />';
    2424
    25 $form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
    26 
    27 $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" />';
     25$form_prevstatus = '<input type="hidden" name="prev_status" value="' . $post->post_status . '" />';
     26
     27$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $post->to_ping) .'" />';
    2828
    2929if ('' != $pinged) {
    … …  
    3838$saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="' . __('Save and Continue Editing') . '" />';
    3939
    40 if (empty($post_status)) $post_status = 'draft';
     40if (empty($post->post_status)) $post->post_status = 'draft';
    4141
    4242?>
    … …  
    4444<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
    4545<input type="hidden" name="action" value="<?php echo $form_action ?>" />
    46 <input type="hidden" name="post_author" value="<?php echo $post_author ?>" />
     46<input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
    4747
    4848<?php echo $form_extra ?>
    … …  
    6868<input name="advanced_view" type="hidden" value="1" />
    6969<label for="comment_status" class="selectit">
    70 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($comment_status, 'open'); ?> />
     70<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
    7171<?php _e('Allow Comments') ?></label>
    72 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
     72<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
    7373</div>
    7474</fieldset>
    … …  
    7676<fieldset id="passworddiv" class="dbx-box">
    7777<h3 class="dbx-handle"><?php _e('Password-Protect Post') ?></h3>
    78 <div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post_password ?>" /></div>
     78<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div>
    7979</fieldset>
    8080
    8181<fieldset id="slugdiv" class="dbx-box">
    8282<h3 class="dbx-handle"><?php _e('Post slug') ?></h3>
    83 <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post_name ?>" /></div>
     83<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div>
    8484</fieldset>
    8585
    … …  
    9292<h3 class="dbx-handle"><?php _e('Post Status') ?></h3>
    9393<div class="dbx-content"><?php if ( user_can_create_post($user_ID) ) : ?>
    94 <label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post_status, 'publish'); ?> /> <?php _e('Published') ?></label>
    95 <?php endif; ?>
    96           <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
    97           <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
     94<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); ?> /> <?php _e('Published') ?></label>
     95<?php endif; ?>
     96          <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
     97          <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
    9898</fieldset>
    9999
    … …  
    113113foreach ($users as $o) :
    114114$o = get_userdata( $o->ID );
    115 if ( $post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
     115if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
    116116else $selected = '';
    117117echo "<option value='$o->ID' $selected>$o->display_name</option>";
    … …  
    128128<fieldset id="titlediv">
    129129  <legend><?php _e('Title') ?></legend>
    130   <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $edited_post_title; ?>" id="title" /></div>
     130  <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
    131131</fieldset>
    132132
    … …  
    140140 }
    141141?>
    142 <div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="5" id="content"><?php echo $content ?></textarea></div>
     142<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="5" id="content"><?php echo $post->post_content ?></textarea></div>
    143143</fieldset>
    144144<script type="text/javascript">
    … …  
    171171<fieldset id="postexcerpt" class="dbx-box">
    172172<h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
    173 <div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="4" id="excerpt"><?php echo $excerpt ?></textarea></div>
     173<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="4" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
    174174</fieldset>
    175175
    … …  
    203203
    204204<?php if ('edit' == $action) : ?>
    205 <p><input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), addslashes($edited_post_title) ) . "')\""; ?> /></p>
     205<p><input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), addslashes($post->post_title) ) . "')\""; ?> /></p>
    206206<?php endif; ?>
    207207
Note: See TracChangeset for help on using the changeset viewer.