WordPress.org

Make WordPress Core

Ticket #5607: remove_admin_notices14.diff

File remove_admin_notices14.diff, 3.8 KB (added by filosofo, 10 years ago)
  • wp-admin/edit-category-form.php

     
    55        $form = '<form name="editcat" id="editcat" method="post" action="categories.php">';
    66        $action = 'editedcat';
    77        $nonce_action = 'update-category_' . $cat_ID;
    8         do_action('edit_category_form_pre', $category);
     8        do_action('edit_category_form_pre', ( isset($category) ) ? $category : null);
    99} else {
    1010        $heading = __('Add Category');
    1111        $submit_text = __('Add Category &raquo;');
    1212        $form = '<form name="addcat" id="addcat" method="post" action="categories.php" class="add:the-list:">';
    1313        $action = 'addcat';
    1414        $nonce_action = 'add-category';
    15         do_action('add_category_form_pre', $category);
     15        do_action('add_category_form_pre', ( isset($category) ) ? $category : null);
    1616}
    1717?>
    1818
     
    2020<h2><?php echo $heading ?></h2>
    2121<div id="ajax-response"></div>
    2222<?php echo $form ?>
    23 <input type="hidden" name="action" value="<?php echo $action ?>" />
    24 <input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
     23<input type="hidden" name="action" value="<?php echo ( isset($action) ) ? $action : '' ?>" />
     24<input type="hidden" name="cat_ID" value="<?php echo ( isset($category->term_id) ) ? $category->term_id : ''?>" />
    2525<?php wp_nonce_field($nonce_action); ?>
    2626        <table class="editform" width="100%" cellspacing="2" cellpadding="5">
    2727                <tr class="form-field form-required">
    2828                        <th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th>
    29                         <td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" /></td>
     29                        <td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo ( isset($category->name) ) ? attribute_escape($category->name) : ''; ?>" size="40" /></td>
    3030                </tr>
    3131                <tr class="form-field">
    3232                        <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th>
    33                         <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->slug); ?>" size="40" /></td>
     33                        <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo ( isset($category->attribute_escape) ) ? attribute_escape($category->slug) : ''; ?>" size="40" /></td>
    3434                </tr>
    3535                <tr class="form-field">
    3636                        <th scope="row" valign="top"><label for="category_parent"><?php _e('Category parent:') ?></label></th>
    3737                        <td>
    38                                 <?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
     38                                <?php $parent = ( isset($category->parent) ) ? $category->parent : '';
     39                                wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $parent . '&hierarchical=1&show_option_none=' . __('None')); ?>
    3940                        </td>
    4041                </tr>
    4142                <tr class="form-field">
    4243                        <th scope="row" valign="top"><label for="category_description"><?php _e('Description: (optional)') ?></label></th>
    43                         <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo wp_specialchars($category->description); ?></textarea></td>
     44                        <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo ( isset($category->description) ) ? wp_specialchars($category->description) : ''; ?></textarea></td>
    4445                </tr>
    4546        </table>
    4647<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
    47 <?php do_action('edit_category_form', $category); ?>
     48<?php do_action('edit_category_form', ( isset($category) ) ? $category : null); ?>
    4849</form>
    4950</div>