[ Root ] [ Search ] [ Index ]

PHP Cross Reference of WordPress 3.0

Provided by Yoast

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('show_ui' => 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 = $post_type_object->labels->add_new_item;
  30  
  31  $editing = true;
  32  
  33  if ( 'post' == $post_type && !current_user_can('edit_posts') ) {
  34      include ('./admin-header.php'); ?>
  35  <div class="wrap">
  36  <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 />
  37  You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
  38  When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_option('admin_email')); ?>
  39  </p>
  40  </div>
  41  <?php
  42      include ('./admin-footer.php');
  43      exit();
  44  }
  45  
  46  wp_enqueue_script('autosave');
  47  
  48  // Show post form.
  49  if ( current_user_can($post_type_object->cap->edit_posts) ) {
  50      $post = get_default_post_to_edit( $post_type, true );
  51      $post_ID = $post->ID;
  52      include ('edit-form-advanced.php');
  53  }
  54  
  55  include ('./admin-footer.php');
  56  ?>


Generated: Thu Oct 14 05:11:12 2010 Cross-referenced by PHPXref 0.7