[ Index ]

PHP Cross Reference of WordPress 3.0 beta 1

[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/wp-admin/ -> post-new.php (source)

   1  <?php
   2  /**
   3   * New Post Administration Panel.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** Load WordPress Administration Bootstrap */
  10  require_once ('admin.php');
  11  
  12  if ( !isset($_GET['post_type']) )
  13      $post_type = 'post';
  14  elseif ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) )
  15      $post_type = $_GET['post_type'];
  16  else
  17      wp_die( __('Invalid post type') );
  18  
  19  if ( 'post' != $post_type ) {
  20      $parent_file = "edit.php?post_type=$post_type";
  21      $submenu_file = "post-new.php?post_type=$post_type";
  22  } else {
  23      $parent_file = 'edit.php';
  24      $submenu_file = 'post-new.php';
  25  }
  26  
  27  $post_type_object = get_post_type_object($post_type);
  28  
  29  $title = sprintf(__('Add New %s'), $post_type_object->singular_label);
  30  
  31  $editing = true;
  32  wp_enqueue_script('autosave');
  33  wp_enqueue_script('post');
  34  if ( user_can_richedit() )
  35      wp_enqueue_script('editor');
  36  add_thickbox();
  37  wp_enqueue_script('media-upload');
  38  wp_enqueue_script('word-count');
  39  
  40  if ( 'post' == $post_type && !current_user_can('edit_posts') ) {
  41      require_once  ('./admin-header.php'); ?>
  42  <div class="wrap">
  43  <p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br />
  44  You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
  45  When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_option('admin_email')); ?>
  46  </p>
  47  </div>
  48  <?php
  49      include ('admin-footer.php');
  50      exit();
  51  }
  52  
  53  // Show post form.
  54  if ( current_user_can($post_type_object->edit_type_cap) ) {
  55      $post = get_default_post_to_edit( $post_type, true );
  56      $post_ID = $post->ID;
  57      include ('edit-form-advanced.php');
  58  }
  59  
  60  include ('admin-footer.php');
  61  ?>


Generated: Mon Apr 5 14:26:09 2010 Cross-referenced by PHPXref 0.7