[ Index ]
 

Code source de WordPress 2.1.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/wp-admin/ -> categories.php (source)

   1  <?php
   2  require_once ('admin.php');
   3  
   4  $title = __('Categories');
   5  $parent_file = 'edit.php';
   6  
   7  wp_reset_vars(array('action', 'cat'));
   8  
   9  switch($action) {
  10  
  11  case 'addcat':
  12  
  13      check_admin_referer('add-category');
  14  
  15      if ( !current_user_can('manage_categories') )
  16          wp_die(__('Cheatin&#8217; uh?'));
  17  
  18      if( wp_insert_category($_POST ) ) {
  19          wp_redirect('categories.php?message=1#addcat');
  20      } else {
  21          wp_redirect('categories.php?message=4#addcat');
  22      }
  23      exit;
  24  break;
  25  
  26  case 'delete':
  27      $cat_ID = (int) $_GET['cat_ID'];
  28      check_admin_referer('delete-category_' .  $cat_ID);
  29  
  30      if ( !current_user_can('manage_categories') )
  31          wp_die(__('Cheatin&#8217; uh?'));
  32  
  33      $cat_name = get_catname($cat_ID);
  34  
  35      // Don't delete the default cats.
  36      if ( $cat_ID == get_option('default_category') )
  37          wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
  38  
  39      if ( $cat_ID == get_option('default_link_category') )
  40          wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one for links"), $cat_name));
  41  
  42      wp_delete_category($cat_ID);
  43  
  44      wp_redirect('categories.php?message=2');
  45      exit;
  46  
  47  break;
  48  
  49  case 'edit':
  50  
  51      require_once  ('admin-header.php');
  52      $cat_ID = (int) $_GET['cat_ID'];
  53      $category = get_category_to_edit($cat_ID);
  54      include ('edit-category-form.php');
  55  
  56  break;
  57  
  58  case 'editedcat':
  59      $cat_ID = (int) $_POST['cat_ID'];
  60      check_admin_referer('update-category_' . $cat_ID);
  61  
  62      if ( !current_user_can('manage_categories') )
  63          wp_die(__('Cheatin&#8217; uh?'));
  64  
  65      if ( wp_update_category($_POST) )
  66          wp_redirect('categories.php?message=3'); 
  67      else
  68          wp_redirect('categories.php?message=5'); 
  69  
  70      exit;
  71  break;
  72  
  73  default:
  74  
  75  wp_enqueue_script( 'admin-categories' );
  76  require_once  ('admin-header.php');
  77  
  78  $messages[1] = __('Category added.');
  79  $messages[2] = __('Category deleted.');
  80  $messages[3] = __('Category updated.');
  81  $messages[4] = __('Category not added.');
  82  $messages[5] = __('Category not updated.');
  83  ?>
  84  
  85  <?php if (isset($_GET['message'])) : ?>
  86  <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
  87  <?php endif; ?>
  88  
  89  <div class="wrap">
  90  <?php if ( current_user_can('manage_categories') ) : ?>
  91      <h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
  92  <?php else : ?>
  93      <h2><?php _e('Categories') ?> </h2>
  94  <?php endif; ?>
  95  <table class="widefat">
  96      <thead>
  97      <tr>
  98          <th scope="col" style="text-align: center"><?php _e('ID') ?></th>
  99          <th scope="col"><?php _e('Name') ?></th>
 100          <th scope="col"><?php _e('Description') ?></th>
 101          <th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th>
 102          <th scope="col" width="90" style="text-align: center"><?php _e('Links') ?></th>
 103          <th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
 104      </tr>
 105      </thead>
 106      <tbody id="the-list">
 107  <?php
 108  cat_rows();
 109  ?>
 110      </tbody>
 111  </table>
 112  
 113  </div>
 114  
 115  <?php if ( current_user_can('manage_categories') ) : ?>
 116  <div class="wrap">
 117  <p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and links in that category.  Instead, posts in the deleted category are set to the category <strong>%s</strong> and links are set to <strong>%s</strong>.'), get_catname(get_option('default_category')), get_catname(get_option('default_link_category'))) ?></p>
 118  </div>
 119  
 120  <?php include ('edit-category-form.php'); ?>
 121  <?php endif; ?>
 122  
 123  <?php
 124  break;
 125  }
 126  
 127  include ('admin-footer.php');
 128  
 129  ?>


Généré le : Fri Mar 30 19:41:27 2007 par Balluche grâce à PHPXref 0.7