-
+ BBBEFEDB7B0EC84BC08D76D8C775BCC351D6E3E58918F0F398DAE35686BE8E3E76B2581A0F64D800C14D96D4A99EEDADAD42A916463DB6533932863B9B9457D8
mp-wp/wp-admin/edit.php
(0 . 0)(1 . 315)
13029 <?php
13030 /**
13031 * Edit Posts Administration Panel.
13032 *
13033 * @package WordPress
13034 * @subpackage Administration
13035 */
13036
13037 /** WordPress Administration Bootstrap */
13038 require_once('admin.php');
13039
13040 // Back-compat for viewing comments of an entry
13041 if ( $_redirect = intval( max( @$_GET['p'], @$_GET['attachment_id'], @$_GET['page_id'] ) ) ) {
13042 wp_redirect( admin_url('edit-comments.php?p=' . $_redirect ) );
13043 exit;
13044 } else {
13045 unset( $_redirect );
13046 }
13047
13048 // Handle bulk actions
13049 if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
13050 $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
13051
13052 switch ( $doaction ) {
13053 case 'delete':
13054 if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
13055 check_admin_referer('bulk-posts');
13056 $deleted = 0;
13057 foreach( (array) $_GET['post'] as $post_id_del ) {
13058 $post_del = & get_post($post_id_del);
13059
13060 if ( !current_user_can('delete_post', $post_id_del) )
13061 wp_die( __('You are not allowed to delete this post.') );
13062
13063 if ( $post_del->post_type == 'attachment' ) {
13064 if ( ! wp_delete_attachment($post_id_del) )
13065 wp_die( __('Error in deleting...') );
13066 } else {
13067 if ( !wp_delete_post($post_id_del) )
13068 wp_die( __('Error in deleting...') );
13069 }
13070 $deleted++;
13071 }
13072 }
13073 break;
13074 case 'edit':
13075 if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
13076 check_admin_referer('bulk-posts');
13077
13078 if ( -1 == $_GET['_status'] ) {
13079 $_GET['post_status'] = null;
13080 unset($_GET['_status'], $_GET['post_status']);
13081 } else {
13082 $_GET['post_status'] = $_GET['_status'];
13083 }
13084
13085 $done = bulk_edit_posts($_GET);
13086 }
13087 break;
13088 }
13089
13090 $sendback = wp_get_referer();
13091 if ( strpos($sendback, 'post.php') !== false ) $sendback = admin_url('post-new.php');
13092 elseif ( strpos($sendback, 'attachments.php') !== false ) $sendback = admin_url('attachments.php');
13093 if ( isset($done) ) {
13094 $done['updated'] = count( $done['updated'] );
13095 $done['skipped'] = count( $done['skipped'] );
13096 $done['locked'] = count( $done['locked'] );
13097 $sendback = add_query_arg( $done, $sendback );
13098 }
13099 if ( isset($deleted) )
13100 $sendback = add_query_arg('deleted', $deleted, $sendback);
13101 wp_redirect($sendback);
13102 exit();
13103 } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
13104 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
13105 exit;
13106 }
13107
13108 if ( empty($title) )
13109 $title = __('Edit Posts');
13110 $parent_file = 'edit.php';
13111 wp_enqueue_script('inline-edit-post');
13112
13113 list($post_stati, $avail_post_stati) = wp_edit_posts_query();
13114
13115 require_once('admin-header.php');
13116
13117 if ( !isset( $_GET['paged'] ) )
13118 $_GET['paged'] = 1;
13119
13120 if ( empty($_GET['mode']) )
13121 $mode = 'list';
13122 else
13123 $mode = attribute_escape($_GET['mode']); ?>
13124
13125 <div class="wrap">
13126 <?php screen_icon(); ?>
13127 <h2><?php echo wp_specialchars( $title );
13128 if ( isset($_GET['s']) && $_GET['s'] )
13129 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', wp_specialchars( get_search_query() ) ); ?>
13130 </h2>
13131
13132 <?php
13133 if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
13134 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
13135 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
13136 endif; ?>
13137
13138 <?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
13139 <div id="message" class="updated fade"><p>
13140 <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
13141 printf( __ngettext( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
13142 unset($_GET['updated']);
13143 }
13144
13145 if ( isset($_GET['skipped']) && (int) $_GET['skipped'] )
13146 unset($_GET['skipped']);
13147
13148 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
13149 printf( __ngettext( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) );
13150 unset($_GET['locked']);
13151 }
13152
13153 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
13154 printf( __ngettext( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
13155 unset($_GET['deleted']);
13156 }
13157
13158 $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
13159 ?>
13160 </p></div>
13161 <?php } ?>
13162
13163 <form id="posts-filter" action="" method="get">
13164
13165 <ul class="subsubsub">
13166 <?php
13167 if ( empty($locked_post_status) ) :
13168 $status_links = array();
13169 $num_posts = wp_count_posts( 'post', 'readable' );
13170 $total_posts = array_sum( (array) $num_posts );
13171 $class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
13172 $status_links[] = "<li><a href='edit.php' $class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts ), number_format_i18n( $total_posts ) ) . '</a>';
13173
13174
13175 foreach ( $post_stati as $status => $label ) {
13176 $class = '';
13177
13178 if ( !in_array( $status, $avail_post_stati ) )
13179 continue;
13180
13181 if ( empty( $num_posts->$status ) )
13182 continue;
13183 if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
13184 $class = ' class="current"';
13185
13186 $status_links[] = "<li><a href='edit.php?post_status=$status' $class>" . sprintf( __ngettext( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
13187 }
13188 echo implode( " |</li>\n", $status_links ) . '</li>';
13189 unset( $status_links );
13190 endif;
13191 ?>
13192 </ul>
13193
13194 <p class="search-box">
13195 <label class="hidden" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
13196 <input type="text" class="search-input" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
13197 <input type="submit" value="<?php _e( 'Search Posts' ); ?>" class="button" />
13198 </p>
13199
13200 <?php if ( isset($_GET['post_status'] ) ) : ?>
13201 <input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
13202 <?php endif; ?>
13203 <input type="hidden" name="mode" value="<?php echo $mode; ?>" />
13204
13205 <?php if ( have_posts() ) { ?>
13206
13207 <div class="tablenav">
13208 <?php
13209 $page_links = paginate_links( array(
13210 'base' => add_query_arg( 'paged', '%#%' ),
13211 'format' => '',
13212 'prev_text' => __('«'),
13213 'next_text' => __('»'),
13214 'total' => $wp_query->max_num_pages,
13215 'current' => $_GET['paged']
13216 ));
13217
13218 ?>
13219
13220 <div class="alignleft actions">
13221 <select name="action">
13222 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
13223 <option value="edit"><?php _e('Edit'); ?></option>
13224 <option value="delete"><?php _e('Delete'); ?></option>
13225 </select>
13226 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
13227 <?php wp_nonce_field('bulk-posts'); ?>
13228
13229 <?php // view filters
13230 if ( !is_singular() ) {
13231 $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";
13232
13233 $arc_result = $wpdb->get_results( $arc_query );
13234
13235 $month_count = count($arc_result);
13236
13237 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) {
13238 $m = isset($_GET['m']) ? (int)$_GET['m'] : 0;
13239 ?>
13240 <select name='m'>
13241 <option<?php selected( $m, 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
13242 <?php
13243 foreach ($arc_result as $arc_row) {
13244 if ( $arc_row->yyear == 0 )
13245 continue;
13246 $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
13247
13248 if ( $arc_row->yyear . $arc_row->mmonth == $m )
13249 $default = ' selected="selected"';
13250 else
13251 $default = '';
13252
13253 echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
13254 echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
13255 echo "</option>\n";
13256 }
13257 ?>
13258 </select>
13259 <?php } ?>
13260
13261 <?php
13262 $dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1,
13263 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat);
13264 wp_dropdown_categories($dropdown_options);
13265 do_action('restrict_manage_posts');
13266 ?>
13267 <input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
13268
13269 <?php } ?>
13270 </div>
13271
13272 <?php if ( $page_links ) { ?>
13273 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',
13274 number_format_i18n( ( $_GET['paged'] - 1 ) * $wp_query->query_vars['posts_per_page'] + 1 ),
13275 number_format_i18n( min( $_GET['paged'] * $wp_query->query_vars['posts_per_page'], $wp_query->found_posts ) ),
13276 number_format_i18n( $wp_query->found_posts ),
13277 $page_links
13278 ); echo $page_links_text; ?></div>
13279 <?php } ?>
13280
13281 <div class="view-switch">
13282 <a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'list' == $mode ) echo 'class="current"'; ?> id="view-switch-list" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('List View') ?>" alt="<?php _e('List View') ?>" /></a>
13283 <a href="<?php echo clean_url(add_query_arg('mode', 'excerpt', $_SERVER['REQUEST_URI'])) ?>"><img <?php if ( 'excerpt' == $mode ) echo 'class="current"'; ?> id="view-switch-excerpt" src="../wp-includes/images/blank.gif" width="20" height="20" title="<?php _e('Excerpt View') ?>" alt="<?php _e('Excerpt View') ?>" /></a>
13284 </div>
13285
13286 <div class="clear"></div>
13287 </div>
13288
13289 <div class="clear"></div>
13290
13291 <?php include( 'edit-post-rows.php' ); ?>
13292
13293 <div class="tablenav">
13294
13295 <?php
13296 if ( $page_links )
13297 echo "<div class='tablenav-pages'>$page_links_text</div>";
13298 ?>
13299
13300 <div class="alignleft actions">
13301 <select name="action2">
13302 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
13303 <option value="edit"><?php _e('Edit'); ?></option>
13304 <option value="delete"><?php _e('Delete'); ?></option>
13305 </select>
13306 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
13307 <br class="clear" />
13308 </div>
13309 <br class="clear" />
13310 </div>
13311
13312 <?php } else { // have_posts() ?>
13313 <div class="clear"></div>
13314 <p><?php _e('No posts found') ?></p>
13315 <?php } ?>
13316
13317 </form>
13318
13319 <?php inline_edit_row( 'post' ); ?>
13320
13321 <div id="ajax-response"></div>
13322
13323 <br class="clear" />
13324
13325 </div>
13326
13327 <script type="text/javascript">
13328 /* <![CDATA[ */
13329 (function($){
13330 $(document).ready(function(){
13331 $('#doaction, #doaction2').click(function(){
13332 if ( $('select[name^="action"]').val() == 'delete' ) {
13333 var m = '<?php echo js_escape(__("You are about to delete the selected posts.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
13334 return showNotice.warn(m);
13335 }
13336 });
13337 });
13338 })(jQuery);
13339 columns.init('edit');
13340 /* ]]> */
13341 </script>
13342
13343 <?php include('admin-footer.php'); ?>