[ Index ]

PHP Cross Reference of Wordpress 2.9.1

title

Body

[close]

/wp-admin/ -> edit-category-form.php (source)

   1  <?php
   2  /**
   3   * Edit category form for inclusion in administration panels.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  // don't load directly
  10  if ( !defined('ABSPATH') )
  11      die('-1');
  12  
  13  if ( !current_user_can('manage_categories') )
  14      wp_die(__('You do not have sufficient permissions to edit categories for this blog.'));
  15  
  16  /**
  17   * @var object
  18   */
  19  if ( ! isset( $category ) )
  20      $category = (object) array();
  21  
  22  /**
  23   * @ignore
  24   * @since 2.7
  25   * @internal Used to prevent errors in page when no category is being edited.
  26   *
  27   * @param object $category
  28   */
  29  function _fill_empty_category(&$category) {
  30      if ( ! isset( $category->name ) )
  31          $category->name = '';
  32  
  33      if ( ! isset( $category->slug ) )
  34          $category->slug = '';
  35  
  36      if ( ! isset( $category->parent ) )
  37          $category->parent = '';
  38  
  39      if ( ! isset( $category->description ) )
  40          $category->description = '';
  41  }
  42  
  43  do_action('edit_category_form_pre', $category);
  44  
  45  _fill_empty_category($category);
  46  ?>
  47  
  48  <div class="wrap">
  49  <?php screen_icon(); ?>
  50  <h2><?php _e('Edit Category'); ?></h2>
  51  <div id="ajax-response"></div>
  52  <form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
  53  <input type="hidden" name="action" value="editedcat" />
  54  <input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
  55  <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
  56      <table class="form-table">
  57          <tr class="form-field form-required">
  58              <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
  59              <td><input name="cat_name" id="cat_name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /><br />
  60          </tr>
  61          <tr class="form-field">
  62              <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
  63              <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
  64              <span class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></span></td>
  65          </tr>
  66          <tr class="form-field">
  67              <th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
  68              <td>
  69                    <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'exclude' => $category->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
  70                  <span class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></span>
  71                </td>
  72          </tr>
  73          <tr class="form-field">
  74              <th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th>
  75              <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($category->description); ?></textarea><br />
  76              <span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span></td>
  77          </tr>
  78          <?php do_action('edit_category_form_fields', $category); ?>
  79      </table>
  80  <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Category'); ?>" /></p>
  81  <?php do_action('edit_category_form', $category); ?>
  82  </form>
  83  </div>


Generated: Fri Jan 8 00:19:48 2010 Cross-referenced by PHPXref 0.7