Changeset 6287 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
- Timestamp:
- 12/19/2017 04:22:37 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
r5797 r6287 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory\Admin\List_Table; 3 3 4 use \WordPressdotorg\Plugin_Directory\Tools; 4 5 use \WordPressdotorg\Plugin_Directory\Template; … … 21 22 22 23 $post_type = $this->screen->post_type; 23 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );24 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); 24 25 25 26 /** This filter is documented in wp-admin/includes/post.php */ … … 33 34 $post_counts = (array) wp_count_posts( $post_type, 'readable' ); 34 35 35 if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'] 36 if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati ) ) { 36 37 $total_items = $post_counts[ $_REQUEST['post_status'] ]; 37 38 } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { … … 60 61 $this->set_pagination_args( array( 61 62 'total_items' => $total_items, 62 'per_page' => $per_page63 'per_page' => $per_page, 63 64 ) ); 64 65 } … … 69 70 */ 70 71 protected function get_bulk_actions() { 71 $actions = array();72 $actions = array(); 72 73 $post_type_obj = get_post_type_object( $this->screen->post_type ); 73 74 … … 92 93 $post_type = $this->screen->post_type; 93 94 $posts_columns = array( 94 'cb' 95 'cb' => '<input type="checkbox" />', 95 96 /* translators: manage posts column name */ 96 'title' 97 'author' 97 'title' => _x( 'Title', 'column name', 'wporg-plugins' ), 98 'author' => __( 'Submitter', 'wporg-plugins' ), 98 99 ); 99 100 … … 104 105 105 106 foreach ( $taxonomies as $taxonomy ) { 106 $column_key = 'taxonomy-' . $taxonomy;107 $column_key = 'taxonomy-' . $taxonomy; 107 108 $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; 108 109 } 109 110 110 111 $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Internal Notes', 'wporg-plugins' ) . '"><span class="screen-reader-text">' . __( 'Internal Notes', 'wporg-plugins' ) . '</span></span>'; 111 $posts_columns['date'] = __( 'Date', 'wporg-plugins' );112 $posts_columns['date'] = __( 'Date', 'wporg-plugins' ); 112 113 113 114 /** … … 133 134 * 134 135 * @param int|\WP_Post $post 135 * @param int $level136 * @param int $level 136 137 */ 137 138 public function single_row( $post, $level = 0 ) { 138 139 $global_post = get_post(); 139 140 140 $post = get_post( $post );141 $post = get_post( $post ); 141 142 $this->current_level = $level; 142 143 … … 155 156 156 157 if ( $post->post_parent ) { 157 $count = count( get_post_ancestors( $post->ID ) );158 $count = count( get_post_ancestors( $post->ID ) ); 158 159 $classes[] = 'level-' . $count; 159 160 } else { … … 184 185 185 186 $post_type_object = get_post_type_object( $post->post_type ); 186 $can_edit_post = current_user_can( 'edit_post', $post->ID );187 $actions = array();188 $title = _draft_or_post_title();187 $can_edit_post = current_user_can( 'edit_post', $post->ID ); 188 $actions = array(); 189 $title = _draft_or_post_title(); 189 190 190 191 if ( $can_edit_post && 'trash' != $post->post_status ) { … … 260 261 $screen = $this->screen; 261 262 262 $taxonomy_names = get_object_taxonomies( $screen->post_type );263 $taxonomy_names = get_object_taxonomies( $screen->post_type ); 263 264 $hierarchical_taxonomies = array(); 264 265 265 266 foreach ( $taxonomy_names as $taxonomy_name ) { 266 267 267 $taxonomy = get_taxonomy( $taxonomy_name ); 268 268 … … 302 302 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> 303 303 304 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span>304 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span> 305 305 <input type="hidden" name="tax_input[<?php echo esc_attr( $taxonomy->name ); ?>][]" value="0" /> 306 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ) ?>-checklist">307 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>306 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist"> 307 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?> 308 308 </ul> 309 309 … … 355 355 $mine = ''; 356 356 357 $plugins = Tools::get_users_write_access_plugins( $current_user_id );358 $plugins = array_map( 'sanitize_title_for_query', $plugins );359 $exclude_states 357 $plugins = Tools::get_users_write_access_plugins( $current_user_id ); 358 $plugins = array_map( 'sanitize_title_for_query', $plugins ); 359 $exclude_states = get_post_stati( array( 360 360 'show_in_admin_all_list' => false, 361 361 ) ); … … 378 378 379 379 if ( ! empty( $plugins ) ) { 380 $user_post_count_query = str_replace( 'AND post_author = %d', "AND ( post_author = %d OR post_name IN ( '" . implode( "','", $plugins ) . "' ) )", $user_post_count_query );380 $user_post_count_query = str_replace( 'AND post_author = %d', "AND ( post_author = %d OR post_name IN ( '" . implode( "','", $plugins ) . "' ) )", $user_post_count_query ); 381 381 } 382 382 … … 395 395 $mine_args = array( 396 396 'post_type' => $post_type, 397 'author' => $current_user_id 397 'author' => $current_user_id, 398 398 ); 399 399 … … 410 410 411 411 if ( ! current_user_can( 'plugin_review' ) ) { 412 $status_links['mine'] = $this->get_edit_link( $mine_args, $mine_inner_html, 'current' );; 412 $status_links['mine'] = $this->get_edit_link( $mine_args, $mine_inner_html, 'current' ); 413 413 414 return $status_links; 414 415 } else { … … 417 418 418 419 $all_args['all_posts'] = 1; 419 $class = '';420 $class = ''; 420 421 } 421 422 … … 440 441 } 441 442 442 foreach ( get_post_stati( array('show_in_admin_status_list' => true), 'objects') as $status ) {443 foreach ( get_post_stati( array( 'show_in_admin_status_list' => true ), 'objects' ) as $status ) { 443 444 $class = ''; 444 445 … … 453 454 } 454 455 455 if ( isset( $_REQUEST['post_status']) && $status_name === $_REQUEST['post_status'] ) {456 if ( isset( $_REQUEST['post_status'] ) && $status_name === $_REQUEST['post_status'] ) { 456 457 $class = 'current'; 457 458 } … … 459 460 $status_args = array( 460 461 'post_status' => $status_name, 461 'post_type' => $post_type,462 'post_type' => $post_type, 462 463 ); 463 464 … … 474 475 475 476 $sticky_args = array( 476 'post_type' 477 'show_sticky' => 1 477 'post_type' => $post_type, 478 'show_sticky' => 1, 478 479 ); 479 480 … … 490 491 491 492 $sticky_link = array( 492 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ) 493 'sticky' => $this->get_edit_link( $sticky_args, $sticky_inner_html, $class ), 493 494 ); 494 495 495 496 // Sticky comes after Publish, or if not listed, after All. 496 $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) );497 $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) ); 497 498 $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); 498 499 }
Note: See TracChangeset
for help on using the changeset viewer.