PHP Cross Reference of WordPress Subversion HEAD

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

title

Body

[close]

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

   1  <?php
   2  require_once ('admin.php');
   3  
   4  $title = __('Posts');
   5  $parent_file = 'edit.php';
   6  wp_enqueue_script( 'admin-posts' );
   7  if ( 1 == $_GET['c'] )
   8      wp_enqueue_script( 'admin-comments' );
   9  require_once ('admin-header.php');
  10  
  11  add_filter( 'post_limits', $limit_filter = create_function( '$a', '$b = split(" ",$a); if ( !isset($b[2]) ) return $a; $start = intval(trim($b[1])) / 20 * 15; if ( !is_int($start) ) return $a; return "LIMIT $start, 20";' ) );
  12  list($post_stati, $avail_post_stati) = wp_edit_posts_query();
  13  $wp_query->max_num_pages = ceil( $wp_query->found_posts / 15 ); // We grab 20 but only show 15 ( 5 more for ajax extra )
  14  ?>
  15  
  16  <div class="wrap">
  17  
  18  <?php
  19  
  20  $posts_columns = wp_manage_posts_columns();
  21  
  22  ?>
  23  
  24  <h2><?php
  25  if ( is_single() ) {
  26      printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
  27  } else {
  28      if ( $post_listing_pageable && !is_archive() && !is_search() )
  29          $h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_status_label) : sprintf(__('Latest %s'), $post_status_label);
  30      else
  31          $h2_noun = $post_status_label;
  32      // Use $_GET instead of is_ since they can override each other
  33      $h2_author = '';
  34      $_GET['author'] = (int) $_GET['author'];
  35      if ( $_GET['author'] != 0 ) {
  36          if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion
  37              $h2_author = ' ' . __('by other authors');
  38          } else {
  39              $author_user = get_userdata( get_query_var( 'author' ) );
  40              $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
  41          }
  42      }
  43      $h2_search = isset($_GET['s'])   && $_GET['s']   ? ' ' . sprintf(__('matching &#8220;%s&#8221;'), wp_specialchars( get_search_query() ) ) : '';
  44      $h2_cat    = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in &#8220;%s&#8221;'), single_cat_title('', false) ) : '';
  45      $h2_month  = isset($_GET['m'])   && $_GET['m']   ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
  46      printf( _c( '%1$s%2$s%3$s%4$s%5$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_month );
  47  }
  48  ?></h2>
  49  
  50  <form name="searchform" id="searchform" action="" method="get">
  51      <fieldset><legend><?php _e('Search terms&hellip;'); ?></legend>
  52          <input type="text" name="s" id="s" value="<?php the_search_query(); ?>" size="17" />
  53      </fieldset>
  54  
  55      <fieldset><legend><?php _e('Status&hellip;'); ?></legend>
  56          <select name='post_status'>
  57              <option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
  58  <?php    foreach ( $post_stati as $status => $label ) : if ( !in_array($status, $avail_post_stati) ) continue; ?>
  59              <option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option>
  60  <?php    endforeach; ?>
  61          </select>
  62      </fieldset>
  63  
  64  <?php
  65  $editable_ids = get_editable_user_ids( $user_ID );
  66  if ( $editable_ids && count( $editable_ids ) > 1 ) :
  67  ?>
  68      <fieldset><legend><?php _e('Author&hellip;'); ?></legend>
  69          <?php wp_dropdown_users( array('include' => $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?>
  70      </fieldset>
  71  
  72  <?php
  73  endif;
  74  
  75  $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
  76  
  77  $arc_result = $wpdb->get_results( $arc_query );
  78  
  79  $month_count = count($arc_result);
  80  
  81  if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
  82  
  83      <fieldset><legend><?php _e('Month&hellip;') ?></legend>
  84          <select name='m'>
  85              <option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
  86          <?php
  87          foreach ($arc_result as $arc_row) {
  88              if ( $arc_row->yyear == 0 )
  89                  continue;
  90              $arc_row->mmonth = zeroise($arc_row->mmonth, 2);
  91  
  92              if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
  93                  $default = ' selected="selected"';
  94              else
  95                  $default = '';
  96  
  97              echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
  98              echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
  99              echo "</option>\n";
 100          }
 101          ?>
 102          </select>
 103      </fieldset>
 104  
 105  <?php } ?>
 106  
 107      <fieldset><legend><?php _e('Category&hellip;') ?></legend>
 108          <?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
 109      </fieldset>
 110      <input type="submit" id="post-query-submit" value="<?php _e('Filter &#187;'); ?>" class="button" />
 111  </form>
 112  
 113  <?php do_action('restrict_manage_posts'); ?>
 114  
 115  <br style="clear:both;" />
 116  
 117  <?php include ( 'edit-post-rows.php' ); ?>
 118  
 119  <form action="" method="post" id="get-extra-posts" class="add:the-extra-list:" style="display:none">
 120      <?php wp_nonce_field( 'add-post', '_ajax_nonce', false ); ?>
 121  </form>
 122  
 123  <div id="ajax-response"></div>
 124  
 125  <div class="navigation">
 126  <div class="alignleft"><?php next_posts_link(__('&laquo; Previous Entries')) ?></div>
 127  <div class="alignright"><?php previous_posts_link(__('Next Entries &raquo;')) ?></div>
 128  </div>
 129  
 130  <?php
 131  
 132  if ( 1 == count($posts) ) {
 133  
 134      $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
 135      if ($comments) {
 136          // Make sure comments, post, and post_author are cached
 137          update_comment_cache($comments);
 138          $post = get_post($id);
 139          $authordata = get_userdata($post->post_author);
 140      ?>
 141  <h3 id="comments"><?php _e('Comments') ?></h3>
 142  <ol id="the-comment-list" class="list:comment commentlist">
 143  <?php
 144          $i = 0;
 145          foreach ( $comments as $comment ) {
 146              _wp_comment_list_item( $comment->comment_ID, ++$i );
 147          }
 148      echo '</ol>';
 149      } // end if comments
 150  ?>
 151  <?php } ?>
 152  </div>
 153  
 154  <?php include ('admin-footer.php'); ?>


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