PHP Cross Reference of WordPress Subversion HEAD

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

title

Body

[close]

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

   1  <?php
   2  require_once ('admin.php');
   3  $title = __('Create New Post');
   4  $parent_file = 'post-new.php';
   5  $editing = true;
   6  wp_enqueue_script('prototype');
   7  wp_enqueue_script('interface');
   8  wp_enqueue_script('autosave');
   9  require_once  ('./admin-header.php');
  10  
  11  if ( ! current_user_can('edit_posts') ) { ?>
  12  <div class="wrap">
  13  <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 />
  14  You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
  15  When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_option('admin_email')); ?>
  16  </p>
  17  </div>
  18  <?php
  19      include ('admin-footer.php');
  20      exit();
  21  }
  22  
  23  if ( isset($_GET['posted']) && $_GET['posted'] ) : ?>
  24  <div id="message" class="updated fade"><p><strong><?php _e('Post saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post &raquo;'); ?></a></p></div>
  25  <?php
  26  endif;
  27  ?>
  28  
  29  
  30  <?php
  31  $my_drafts = get_users_drafts($user_ID);
  32  $pending = get_others_pending($user_ID);
  33  $others_drafts = get_others_drafts($user_ID);
  34  
  35  $nag_posts_limit = (int) apply_filters('nag_posts_limit', 3);
  36  
  37  $nag_posts = array(
  38      array(
  39          'my_drafts',
  40          __('Your Drafts:'),
  41          'edit.php?post_status=draft&amp;author=' . $user_ID,
  42          count($my_drafts)),
  43      array(
  44          'pending',
  45          __('Pending Review:'),
  46          'edit.php?post_status=pending',
  47          count($pending)),
  48      array(
  49          'others_drafts',
  50          __('Others&#8217; Drafts:'),
  51          'edit.php?post_status=draft&author=-' . $user_ID,
  52          count($others_drafts))
  53      );
  54  
  55  if ( !empty($my_drafts) || !empty($pending) || !empty($others_drafts) ) {
  56      echo '<div class="wrap" id="draft-nag">';
  57  
  58      foreach ( $nag_posts as $nag ) {
  59          if ( ${$nag[0]} ) {
  60              echo '<p><strong>' . wp_specialchars($nag[1]) . '</strong> ';
  61              $i = 0;
  62              foreach ( ${$nag[0]} as $post ) {
  63                  $i++;
  64                  if ( $i > $nag_posts_limit )
  65                      break;
  66                  echo '<a href="post.php?action=edit&amp;post=' . $post->ID . '">';
  67                  ( '' == the_title('', '', FALSE) ) ? printf( __('Post #%s'), $post->ID ) : the_title();
  68                  echo '</a>';
  69                  if ( $i < min($nag[3], $nag_posts_limit) )
  70                      echo ', ';
  71              }
  72              if ( $nag[3] > $nag_posts_limit )
  73                  printf(__(', and <a href="%s">%d more</a>'), $nag[2], $nag[3] - $nag_posts_limit);
  74              echo '.</p>';
  75          }
  76      }
  77      echo "</div>\n";
  78  }
  79  ?>
  80  
  81  
  82  <?php
  83  // Show post form.
  84  $post = get_default_post_to_edit();
  85  include ('edit-form-advanced.php');
  86  ?>
  87  
  88  <?php if ( $is_NS4 || $is_gecko || $is_winIE ) { ?>
  89  <div id="wp-bookmarklet" class="wrap">
  90  <h3><?php _e('WordPress Bookmarklet'); ?></h3>
  91  <p><?php _e('Right click on the following link and choose &#0147;Bookmark This Link...&#0148; or &#0147;Add to Favorites...&#0148; to create a posting shortcut.'); ?></p>
  92  <p>
  93  
  94  <?php
  95  if ($is_NS4 || $is_gecko) {
  96  ?>
  97  <a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), get_bloginfo('name', 'display')); ?></a>
  98  <?php
  99  } else if ($is_winIE) {
 100  ?>
 101  <a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_bloginfo('name', 'display')); ?></a>
 102  <script type="text/javascript">
 103  <!--
 104  function oneclickbookmarklet(blah) {
 105  window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120");
 106  }
 107  // -->
 108  </script>
 109  <br />
 110  <br />
 111  <?php _e('One-click bookmarklet:') ?><br />
 112  <a href="javascript:oneclickbookmarklet(0);"><?php _e('click here') ?></a>
 113  <?php
 114  } else if ($is_opera) {
 115  ?>
 116  <a href="javascript:location.href='<?php echo get_option('siteurl'); ?>/wp-admin/post-new.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
 117  <?php
 118  } else if ($is_macIE) {
 119  ?>
 120  <a href="javascript:Q='';location.href='<?php echo get_option('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a>
 121  <?php
 122  }
 123  ?>
 124  </p>
 125  </div>
 126  <?php } ?>
 127  
 128  <?php include ('admin-footer.php'); ?>


Generated Thu Dec 6 06:47:08 2007 for RedAlt XRefs Cross-referenced by PHPXref 0.6 and RedAlt