Changeset 5575
- Timestamp:
- 05/28/2007 06:34:06 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-pages.php
r5361 r5575 5 5 wp_enqueue_script( 'listman' ); 6 6 require_once('admin-header.php'); 7 8 $post_stati = array( // array( adj, noun ) 9 'draft' => array(__('Draft'), __('Draft pages')), 10 'future' => array(__('Future dated'), __('Future dated pages')), 11 'private' => array(__('Private'), __('Private pages')), 12 'publish' => array(__('Published'), __('Published pages')) 13 ); 14 15 16 $post_status_label = _c('Pages|manage pages header'); 17 $post_listing_pageable = true; 18 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { 19 $post_status_label = $post_stati[$_GET['post_status']][1]; 20 $post_listing_pageable = false; 21 $post_status_q = '&post_status=' . $_GET['post_status']; 22 if ( 'publish' == $_GET['post_status'] ); 23 $post_listing_pageable = true; 24 } 25 7 26 ?> 8 27 9 28 <div class="wrap"> 10 <h2><?php _e('Page Management'); ?></h2> 29 30 <h2><?php 31 // Use $_GET instead of is_ since they can override each other 32 $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( stripslashes( $_GET['s'] ) ) ) : ''; 33 printf( _c( '%1$s%2$s|manage pages header' ), $post_status_label, $h2_search ); 34 ?></h2> 35 11 36 <p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page »'); ?></a></p> 12 37 13 38 <form name="searchform" id="searchform" action="" method="get"> 14 <fieldset> 15 <legend><?php _e('Search Pages…') ?></legend> 16 <input type="text" name="s" id="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" /> 17 <input type="submit" name="submit" value="<?php _e('Search') ?>" /> 39 <fieldset><legend><?php _e('Search Terms…') ?></legend> 40 <input type="text" name="s" id="s" value="<?php echo attribute_escape( stripslashes( $_GET['s'] ) ); ?>" size="17" /> 18 41 </fieldset> 42 43 44 <fieldset><legend><?php _e('Page Type…'); ?></legend> 45 <select name='post_status'> 46 <option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option> 47 <?php foreach ( $post_stati as $status => $label ) : ?> 48 <option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option> 49 <?php endforeach; ?> 50 </select> 51 </fieldset> 52 53 <input type="submit" id="post-query-submit" value="<?php _e('Go »'); ?>" class="button" /> 19 54 </form> 20 55 … … 22 57 23 58 <?php 24 wp( 'post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc');59 wp("post_type=page&orderby=menu_order&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc"); 25 60 26 61 if ( $_GET['s'] ) … … 42 77 </thead> 43 78 <tbody id="the-list"> 44 <?php 45 page_rows(0, 0, $posts, $all); 46 ?> 79 <?php page_rows(0, 0, $posts, $all); ?> 47 80 </tbody> 48 81 </table> … … 53 86 } else { 54 87 ?> 55 <p><?php _e('No pages yet.') ?></p>88 <p><?php _e('No pages found.') ?></p> 56 89 <?php 57 90 } // end if ($posts) -
trunk/wp-admin/edit.php
r5331 r5575 7 7 require_once('admin-header.php'); 8 8 9 $_GET['m'] = (int) $_GET['m']; 10 11 $drafts = get_users_drafts( $user_ID ); 12 $other_drafts = get_others_drafts( $user_ID); 13 14 if ($drafts || $other_drafts) { 15 ?> 9 $_GET['m'] = (int) $_GET['m']; 10 $_GET['cat'] = (int) $_GET['cat']; 11 $post_stati = array( // array( adj, noun ) 12 'draft' => array(__('Draft'), _c('Drafts|manage posts header')), 13 'future' => array(__('Future dated'), __('Future dated posts')), 14 'private' => array(__('Private'), __('Private posts')), 15 'publish' => array(__('Published'), __('Published posts')) 16 ); 17 18 $post_status_q = ''; 19 $author_q = ''; 20 $post_status_label = _c('Posts|manage posts header'); 21 $post_listing_pageable = true; 22 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { 23 $post_status_label = $post_stati[$_GET['post_status']][1]; 24 $post_listing_pageable = false; 25 $post_status_q = '&post_status=' . $_GET['post_status']; 26 if ( in_array( $_GET['post_status'], array('draft', 'private') ) ) 27 $author_q = "&author=$user_ID"; 28 elseif ( 'publish' == $_GET['post_status'] ); 29 $post_listing_pageable = true; 30 } 31 ?> 32 16 33 <div class="wrap"> 17 <?php if ($drafts) { ?> 18 <p><strong><?php _e('Your Drafts:') ?></strong> 19 <?php 20 $i = 0; 21 foreach ($drafts as $draft) { 22 if (0 != $i) 23 echo ', '; 24 $draft->post_title = apply_filters('the_title', stripslashes($draft->post_title)); 25 if ($draft->post_title == '') 26 $draft->post_title = sprintf(__('Post #%s'), $draft->ID); 27 echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; 28 ++$i; 29 } 30 ?> 31 .</p> 32 <?php } ?> 33 34 <?php if ($other_drafts) { ?> 35 <p><strong><?php _e('Other’s Drafts:') ?></strong> 36 <?php 37 $i = 0; 38 foreach ($other_drafts as $draft) { 39 if (0 != $i) 40 echo ', '; 41 $draft->post_title = apply_filters('the_title', stripslashes($draft->post_title)); 42 if ($draft->post_title == '') 43 $draft->post_title = sprintf(__('Post #%s'), $draft->ID); 44 echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; 45 ++$i; 46 } 47 ?> 48 .</p> 49 50 <?php } ?> 51 52 </div> 53 <?php } ?> 54 55 <div class="wrap"> 56 <h2> 57 <?php 58 59 wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1'); 60 61 if ( is_month() ) { 62 single_month_title(' '); 63 } elseif ( is_search() ) { 64 printf(__('Search for “%s”'), wp_specialchars($_GET['s']) ); 65 } else { 66 if ( is_single() ) 67 printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title)); 68 elseif ( ! is_paged() || get_query_var('paged') == 1 ) 69 _e('Last 15 Posts'); 70 else 71 _e('Previous Posts'); 72 } 73 ?> 74 </h2> 75 76 <form name="searchform" id="searchform" action="" method="get"> 77 <fieldset> 78 <legend><?php _e('Search Posts…') ?></legend> 79 <input type="text" name="s" id="s" value="<?php if (isset($s)) echo attribute_escape($s); ?>" size="17" /> 80 <input type="submit" name="submit" value="<?php _e('Search') ?>" class="button" /> 81 </fieldset> 82 </form> 83 84 <?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC"); 85 86 if ( count($arc_result) ) { ?> 87 88 <form name="viewarc" id="viewarc" action="" method="get"> 89 <fieldset> 90 <legend><?php _e('Browse Month…') ?></legend> 91 <select name='m'> 92 <?php 93 foreach ($arc_result as $arc_row) { 94 if ( $arc_row->yyear == 0 ) 95 continue; 96 $arc_row->mmonth = zeroise($arc_row->mmonth, 2); 97 98 if( isset($_GET['m']) && $arc_row->yyear . $arc_row->mmonth == (int) $_GET['m'] ) 99 $default = 'selected="selected"'; 100 else 101 $default = null; 102 103 echo "<option $default value='$arc_row->yyear$arc_row->mmonth'>"; 104 echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear"; 105 echo "</option>\n"; 106 } 107 ?> 108 </select> 109 <input type="submit" name="submit" value="<?php _e('Show Month') ?>" class="button" /> 110 </fieldset> 111 </form> 112 113 <?php } ?> 114 115 <form name="viewcat" id="viewcat" action="" method="get"> 116 <fieldset> 117 <legend><?php _e('Browse Category…') ?></legend> 118 <?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?> 119 <input type="submit" name="submit" value="<?php _e('Show Category') ?>" class="button" /> 120 </fieldset> 121 </form> 122 123 <?php do_action('restrict_manage_posts'); ?> 124 125 <br style="clear:both;" /> 126 127 <?php 34 35 <?php 36 37 wp("what_to_show=posts$author_q$post_status_q&posts_per_page=15&posts_per_archive_page=-1"); 38 39 do_action('restrict_manage_posts'); 40 128 41 // define the columns to display, the syntax is 'internal name' => 'display name' 129 42 $posts_columns = array( … … 144 57 ?> 145 58 146 <table class="widefat"> 147 <thead> 148 <tr> 149 150 <?php foreach($posts_columns as $column_display_name) { ?> 151 <th scope="col"><?php echo $column_display_name; ?></th> 59 <h2><?php 60 if ( is_single() ) { 61 printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title)); 62 } else { 63 if ( $post_listing_pageable && !is_archive() && !is_search() ) 64 $h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_status_label) : sprintf(__('Latest %s'), $post_status_label); 65 else 66 $h2_noun = $post_status_label; 67 // Use $_GET instead of is_ since they can override each other 68 $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( get_search_query() ) ) : ''; 69 $h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in “%s”'), single_cat_title('', false) ) : ''; 70 $h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : ''; 71 printf( _c( '%1$s%2$s%3$s%4$s|manage posts header' ), $h2_noun, $h2_search, $h2_cat, $h2_month ); 72 } 73 ?></h2> 74 75 <form name="searchform" id="searchform" action="" method="get"> 76 <fieldset><legend><?php _e('Search terms…'); ?></legend> 77 <input type="text" name="s" id="s" value="<?php the_search_query(); ?>" size="17" /> 78 </fieldset> 79 80 <fieldset><legend><?php _e('Post Type…'); ?></legend> 81 <select name='post_status'> 82 <option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option> 83 <?php foreach ( $post_stati as $status => $label ) : ?> 84 <option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label[0]; ?></option> 85 <?php endforeach; ?> 86 </select> 87 </fieldset> 88 89 <?php 90 91 92 $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"; 93 94 $arc_result = $wpdb->get_results( $arc_query ); 95 96 $month_count = count($arc_result); 97 98 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?> 99 100 <fieldset><legend><?php _e('Month…') ?></legend> 101 <select name='m'> 102 <option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Any'); ?></option> 103 <?php 104 foreach ($arc_result as $arc_row) { 105 if ( $arc_row->yyear == 0 ) 106 continue; 107 $arc_row->mmonth = zeroise($arc_row->mmonth, 2); 108 109 if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) 110 $default = ' selected="selected"'; 111 else 112 $default = ''; 113 114 echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>"; 115 echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear"; 116 echo "</option>\n"; 117 } 118 ?> 119 </select> 120 </fieldset> 121 152 122 <?php } ?> 153 123 154 </tr> 155 </thead> 156 <tbody id="the-list"> 157 <?php 158 if ($posts) { 159 $bgcolor = ''; 160 while (have_posts()) : the_post(); 161 add_filter('the_title','wp_specialchars'); 162 $class = ('alternate' == $class) ? '' : 'alternate'; 163 ?> 164 <tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'> 165 166 <?php 167 168 foreach($posts_columns as $column_name=>$column_display_name) { 169 170 switch($column_name) { 171 172 case 'id': 173 ?> 174 <th scope="row" style="text-align: center"><?php echo $id ?></th> 175 <?php 176 break; 177 178 case 'date': 179 ?> 180 <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td> 181 <?php 182 break; 183 case 'title': 184 ?> 185 <td><?php the_title() ?> 186 <?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td> 187 <?php 188 break; 189 190 case 'categories': 191 ?> 192 <td><?php the_category(','); ?></td> 193 <?php 194 break; 195 196 case 'comments': 197 ?> 198 <td style="text-align: center"> 199 <?php comments_number("<a href='edit.php?p=$id&c=1'>" . __('0') . '</a>', "<a href='edit.php?p=$id&c=1'>" . __('1') . '</a>', "<a href='edit.php?p=$id&c=1'>" . __('%') . '</a>') ?> 200 </td> 201 <?php 202 break; 203 204 case 'author': 205 ?> 206 <td><?php the_author() ?></td> 207 <?php 208 break; 209 210 case 'control_view': 211 ?> 212 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td> 213 <?php 214 break; 215 216 case 'control_edit': 217 ?> 218 <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 219 <?php 220 break; 221 222 case 'control_delete': 223 ?> 224 <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td> 225 <?php 226 break; 227 228 default: 229 ?> 230 <td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td> 231 <?php 232 break; 124 <fieldset><legend><?php _e('Category…') ?></legend> 125 <?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?> 126 </fieldset> 127 <input type="submit" id="post-query-submit" value="<?php _e('Go »'); ?>" class="button" /> 128 </form> 129 130 <br style="clear:both;" /> 131 132 <?php 133 if ( $post_status_q && ( false !== strpos($post_status_q, 'draft') || false !== strpos($post_status_q, 'private') ) ) { 134 echo '<h3>' . __('Your Posts') . "</h3>\n"; 135 include( 'edit-post-rows.php' ); 136 137 $editable_ids = get_editable_user_ids( $user_ID ); 138 139 if ( $editable_ids && count($editable_ids) > 1 ) { 140 $_editable_ids = join(',', array_diff($editable_ids, array($user_ID))); 141 142 $post_status_q = "&post_status=" . $_GET['post_status']; 143 144 unset($GLOBALS['day']); // setup_postdata does this 145 wp("what_to_show=posts&author=$_editable_ids$post_status_q&posts_per_page=-1&posts_per_archive_page=-1"); 146 147 if ( have_posts() ) { 148 echo '<h3>' . __("Others' Posts") . "</h3>\n"; 149 include( 'edit-post-rows.php' ); 150 } 233 151 } 234 } 235 ?> 236 </tr> 237 <?php 238 endwhile; 152 239 153 } else { 240 ?> 241 <tr style='background-color: <?php echo $bgcolor; ?>'> 242 <td colspan="8"><?php _e('No posts found.') ?></td> 243 </tr> 244 <?php 245 } // end if ($posts) 246 ?> 247 </tbody> 248 </table> 154 include( 'edit-post-rows.php' ); 155 } 156 ?> 249 157 250 158 <div id="ajax-response"></div> … … 256 164 257 165 <?php 166 258 167 if ( 1 == count($posts) ) { 259 168 … … 280 189 <?php comment_text() ?> 281 190 282 <p><?php comment_date(__('M j, g:i A')); 191 <p><?php comment_date(__('M j, g:i A')); ?> — [ 283 192 <?php 284 193 if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 285 echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . 194 echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>'; 286 195 echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; 287 196 if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { … … 289 198 echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>'; 290 199 } 291 echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=" . $comment->comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) 200 echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=" . $comment->comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> "; 292 201 } 293 202 ?> … … 302 211 <?php } ?> 303 212 </div> 304 <?php 305 include('admin-footer.php'); 306 ?> 213 214 <?php include('admin-footer.php'); ?> -
trunk/wp-admin/wp-admin.css
r5430 r5575 791 791 } 792 792 793 #searchform {793 #searchform fieldset { 794 794 float: left; 795 margin-right: 1em; 796 width: 18em; 797 } 798 799 #viewarc { 795 margin: 0 1.5ex 1em 0; 796 padding: 0; 797 } 798 799 #searchform fieldset legend { 800 padding: 0 0 .2em 1px; 801 } 802 803 #searchform #s { 804 padding: 4px 3px; 805 } 806 807 #searchform #post-query-submit { 800 808 float: left; 801 width: 23em; 802 margin-bottom: 1em; 803 } 804 805 #viewcat { 806 float: left; 807 width: 30em; 808 margin-bottom: 1em; 809 margin: 14px 0 1em; 810 position: relative; 811 top: .35em; 809 812 } 810 813 -
trunk/wp-includes/capabilities.php
r4825 r5575 446 446 $current_user = wp_get_current_user(); 447 447 448 if ( empty($current_user) ) 449 return false; 450 448 451 $args = array_slice(func_get_args(), 1); 449 452 $args = array_merge(array($capability), $args); 450 451 if ( empty($current_user) )452 return false;453 453 454 454 return call_user_func_array(array(&$current_user, 'has_cap'), $args); -
trunk/wp-includes/classes.php
r5530 r5575 4 4 var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots'); 5 5 6 var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type' );6 var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type', 'post_status'); 7 7 var $extra_query_vars = array(); 8 8 -
trunk/wp-includes/link-template.php
r5569 r5575 472 472 $request = preg_replace('|^/+|', '', $request); 473 473 474 if ( !$wp_rewrite->using_permalinks() ) {474 if ( !$wp_rewrite->using_permalinks() || is_admin() ) { 475 475 $base = trailingslashit( get_bloginfo( 'home' ) ); 476 476 477 477 if ( $pagenum > 1 ) { 478 478 $result = add_query_arg( 'paged', $pagenum, $base . $request ); -
trunk/wp-includes/query.php
r5530 r5575 996 996 997 997 if ( $this->is_attachment ) { 998 $where .= " AND (post_type = 'attachment')";998 $where .= " AND post_type = 'attachment'"; 999 999 } elseif ($this->is_page) { 1000 $where .= " AND (post_type = 'page')";1000 $where .= " AND post_type = 'page'"; 1001 1001 } elseif ($this->is_single) { 1002 $where .= " AND (post_type = 'post')";1002 $where .= " AND post_type = 'post'"; 1003 1003 } else { 1004 $where .= " AND (post_type = '$post_type' AND (post_status = 'publish'"; 1004 $where .= " AND post_type = '$post_type'"; 1005 } 1006 1007 if ( isset($q['post_status']) && '' != $q['post_status'] ) { 1008 $q_status = explode(',', $q['post_status']); 1009 $r_status = array(); 1010 if ( in_array( 'draft' , $q_status ) ) 1011 $r_status[] = "post_status = 'draft'"; 1012 if ( in_array( 'future' , $q_status ) ) 1013 $r_status[] = "post_status = 'future'"; 1014 if ( in_array( 'inherit' , $q_status ) ) 1015 $r_status[] = "post_status = 'inherit'"; 1016 if ( in_array( 'private', $q_status ) ) 1017 $r_status[] = "post_status = 'private'"; 1018 if ( in_array( 'publish', $q_status ) ) 1019 $r_status[] = "post_status = 'publish'"; 1020 if ( !empty($r_status) ) 1021 $where .= " AND (" . join( ' OR ', $r_status ) . ")"; 1022 } elseif ( !$this->is_singular ) { 1023 $where .= " AND (post_status = 'publish'"; 1005 1024 1006 1025 if ( is_admin() ) 1007 1026 $where .= " OR post_status = 'future' OR post_status = 'draft'"; 1008 1027 1009 if ( is_user_logged_in() ) { 1010 if ( 'post' == $post_type ) 1011 $cap = 'read_private_posts'; 1012 else 1013 $cap = 'read_private_pages'; 1014 1015 if ( current_user_can($cap) ) 1016 $where .= " OR post_status = 'private'"; 1017 else 1018 $where .= " OR post_author = $user_ID AND post_status = 'private'"; 1019 } 1020 1021 $where .= '))'; 1028 $where .= current_user_can( "read_private_{$post_type}s" ) ? " OR post_status = 'private'" : " OR post_author = $user_ID AND post_status = 'private'"; 1029 1030 $where .= ')'; 1022 1031 } 1023 1032
Note: See TracChangeset
for help on using the changeset viewer.