WordPress.org

Make WordPress Core

Ticket #5607: remove_admin_notices12.diff

File remove_admin_notices12.diff, 5.8 KB (added by filosofo, 10 years ago)
  • wp-admin/edit-form-advanced.php

     
    1717<div class="wrap">
    1818<?php
    1919
    20 if (0 == $post_ID) {
     20if (! isset($post_ID) || 0 == $post_ID) {
    2121        $form_action = 'post';
    2222        $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
    2323        $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
     
    3333
    3434$form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
    3535
    36 $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
     36$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. ((isset($post->to_ping)) ? attribute_escape( str_replace("\n", ' ', $post->to_ping) ) : '').'" />';
    3737
    38 if ('' != $post->pinged) {
     38if (isset($post->pinged) && '' != $post->pinged) {
    3939        $pings = '<p>'. __('Already pinged:') . '</p><ul>';
    4040        $already_pinged = explode("\n", trim($post->pinged));
    4141        foreach ($already_pinged as $pinged_url) {
     
    5353<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
    5454<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
    5555<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
    56 <input type="hidden" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
     56<input type="hidden" name="post_author" value="<?php echo ( (isset($post->post_author)) ? attribute_escape( $post->post_author ) : ''); ?>" />
    5757<input type="hidden" id="post_type" name="post_type" value="post" />
    5858
    5959<?php echo $form_extra ?>
     
    8282<?php echo $form_prevstatus ?>
    8383
    8484<p class="submit">
    85 <?php if ( 'publish' == $post->post_status ) { ?>
     85<?php if ( isset($post->post_status) && 'publish' == $post->post_status ) { ?>
    8686<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" class="view-link" target="_blank"><?php _e('View &raquo;'); ?></a>
    87 <?php } elseif ( 'edit' == $action ) { ?>
     87<?php } elseif ( isset($action) && 'edit' == $action ) { ?>
    8888<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" class="view-link" target="_blank"><?php _e('Preview &raquo;'); ?></a>
    8989<?php } ?>
    9090<span id="autosave"></span>
     
    104104<input name="referredby" type="hidden" id="referredby" value="<?php
    105105if ( !empty($_REQUEST['popupurl']) )
    106106        echo clean_url(stripslashes($_REQUEST['popupurl']));
    107 else if ( url_to_postid(wp_get_referer()) == $post_ID )
     107else if ( isset($post_ID) && url_to_postid(wp_get_referer()) == $post_ID )
    108108        echo 'redo';
    109109else
    110110        echo clean_url(stripslashes(wp_get_referer()));
     
    113113<div id="tagsdiv" class="postbox">
    114114<h3><?php _e('Tags'); ?></h3>
    115115<div class="inside">
    116 <p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p>
     116<p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( (isset($post_ID)) ? $post_ID : null ); ?>" /></p>
    117117<p id="tagchecklist"></p>
    118118</div>
    119119</div>
     
    191191<div id="passworddiv" class="postbox">
    192192<h3><?php _e('Post Password') ?></h3>
    193193<div class="inside">
    194 <input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" />
     194<input name="post_password" type="text" size="13" id="post_password" value="<?php echo (! empty($post->post_password) ) ? attribute_escape( $post->post_password ) : ''; ?>" />
    195195</div>
    196196</div>
    197197
    198198<div id="slugdiv" class="postbox">
    199199<h3><?php _e('Post Slug') ?></h3>
    200200<div class="inside">
    201 <input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
     201<input name="post_name" type="text" size="13" id="post_name" value="<?php echo ( ! empty($post->post_name) ) ? attribute_escape( $post->post_name ) : ''; ?>" />
    202202</div>
    203203</div>
    204204
     
    217217<?php if ( current_user_can('edit_posts') ) : ?>
    218218<div id="posttimestampdiv" class="postbox">
    219219<h3><?php _e('Post Timestamp'); ?></h3>
    220 <div class="inside"><?php touch_time(($action == 'edit')); ?></div>
     220<div class="inside"><?php touch_time( ( ! empty($action) && $action == 'edit' ) ? true : false ); ?></div>
    221221</div>
    222222<?php endif; ?>
    223223
    224224<?php
    225225$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
    226 if ( $post->post_author && !in_array($post->post_author, $authors) )
     226if ( ! empty($post->post_author) && !in_array($post->post_author, $authors) )
    227227        $authors[] = $post->post_author;
    228228if ( $authors && count( $authors ) > 1 ) :
    229229?>
     
    239239
    240240</div>
    241241
    242 <?php if ('edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?>
     242<?php if (! empty($action) && 'edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?>
    243243<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php echo ( 'draft' == $post->post_status ) ? __('Delete this draft') : __('Delete this post'); ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
    244244<?php endif; ?>
    245245