[ Index ]

PHP Cross Reference of Wordpress 2.9.1

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Edit link 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 link categories for this blog.'));
  15  
  16  /**
  17   * @var object
  18   */
  19  if ( ! isset( $category ) )
  20      $category = (object) array();
  21  
  22  if ( ! empty($cat_ID) ) {
  23      /**
  24       * @var string
  25       */
  26      $heading = '<h2>' . __('Edit Link Category') . '</h2>';
  27      $submit_text = __('Update Category');
  28      $form = '<form name="editcat" id="editcat" method="post" action="link-category.php" class="validate">';
  29      $action = 'editedcat';
  30      $nonce_action = 'update-link-category_' . $cat_ID;
  31      do_action('edit_link_category_form_pre', $category);
  32  } else {
  33      $heading = '<h2>' . __('Add Link Category') . '</h2>';
  34      $submit_text = __('Add Category');
  35      $form = '<form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">';
  36      $action = 'addcat';
  37      $nonce_action = 'add-link-category';
  38      do_action('add_link_category_form_pre', $category);
  39  }
  40  
  41  /**
  42   * @ignore
  43   * @since 2.7
  44   * @internal Used to prevent errors in page when no category is being edited.
  45   *
  46   * @param object $category
  47   */
  48  function _fill_empty_link_category(&$category) {
  49      if ( ! isset( $category->name ) )
  50          $category->name = '';
  51  
  52      if ( ! isset( $category->slug ) )
  53          $category->slug = '';
  54  
  55      if ( ! isset( $category->description ) )
  56          $category->description = '';
  57  }
  58  
  59  _fill_empty_link_category($category);
  60  ?>
  61  
  62  <div class="wrap">
  63  <?php screen_icon(); ?>
  64  <?php echo $heading ?>
  65  <div id="ajax-response"></div>
  66  <?php echo $form ?>
  67  <input type="hidden" name="action" value="<?php echo esc_attr($action) ?>" />
  68  <input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
  69  <?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
  70      <table class="form-table">
  71          <tr class="form-field form-required">
  72              <th scope="row" valign="top"><label for="name"><?php _e('Link Category name') ?></label></th>
  73              <td><input name="name" id="name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /></td>
  74          </tr>
  75          <tr class="form-field">
  76              <th scope="row" valign="top"><label for="slug"><?php _e('Link Category slug') ?></label></th>
  77              <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
  78              <?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.'); ?></td>
  79          </tr>
  80          <tr class="form-field">
  81              <th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th>
  82              <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea><br />
  83              <span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span></td>
  84          </tr>
  85          <?php do_action('edit_link_category_form_fields', $category); ?>
  86      </table>
  87  <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr($submit_text) ?>" /></p>
  88  <?php do_action('edit_link_category_form', $category); ?>
  89  </form>
  90  </div>


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