Changeset 904 for sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-components.php
- Timestamp:
- 10/11/2014 06:37:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-components.php
r903 r904 13 13 add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) ); 14 14 add_action( 'component_table_row', array( $this, 'component_table_row' ) ); 15 add_filter( 'manage_component_posts_columns', array( $this, 'manage_posts_columns' ) ); 16 add_action( 'manage_component_posts_custom_column', array( $this, 'manage_posts_custom_column' ), 10, 2 ); 15 17 $this->trac = $GLOBALS['wpdb']; 16 18 } … … 147 149 function admin_menu() { 148 150 remove_submenu_page( 'edit.php?post_type=component', 'post-new.php?post_type=component' ); 151 } 152 153 function manage_posts_columns( $columns ) { 154 return array_merge( 155 array_slice( $columns, 0, 2 ), 156 array( 'maintainers' => 'Maintainers' ), 157 array_slice( $columns, 2 ) 158 ); 159 } 160 161 function manage_posts_custom_column( $column_name, $post_id ) { 162 switch ( $column_name ) { 163 case 'maintainers' : 164 echo esc_html( get_post_meta( $post_id, '_active_maintainers', true ) ); 165 break; 166 } 149 167 } 150 168 … … 204 222 205 223 $post = get_post(); 206 if ( ! $this->page_is_component( $post ) ) {224 if ( ! $this->page_is_component( $post ) || doing_action( 'wp_head' ) || ! did_action( 'wp_head' ) ) { 207 225 return $content; 208 226 } … … 230 248 ) ); 231 249 250 $subcomponents = array(); 232 251 if ( $subcomponents_query->have_posts() ) { 233 $subcomponents = array();234 252 foreach ( $subcomponents_query->posts as $subcomponent ) { 235 253 $subcomponents[ $subcomponent->ID ] = '<a href="' . get_permalink( $subcomponent ) . '">' . $subcomponent->post_title . '</a>'; … … 279 297 } 280 298 281 $this->maintainers_note();282 299 echo "\n" . "Many contributors help maintain one or more components. These maintainers are vital to keeping WordPress development running as smoothly as possible. They triage new tickets, look after existing ones, spearhead or mentor tasks, pitch new ideas, curate roadmaps, and provide feedback to other contributors. Longtime maintainers with a deep understanding of particular areas of core are always seeking to mentor others to impart their knowledge.\n\n"; 283 300 echo "<strong>Want to help? Start following this component!</strong> <a href='/core/notifications/'>Adjust your notifications here</a>. Feel free to dig into any ticket." . "\n\n"; … … 302 319 303 320 function generate_component_breakdowns() { 304 if ( isset( $this->breakdown_component_type, $this->breakdown_component_milestone_type ) ) {321 if ( isset( $this->breakdown_component_type, $this->breakdown_component_milestone_type, $this->breakdown_component_unreplied ) ) { 305 322 return; 306 323 } … … 326 343 } 327 344 345 $component_unreplied = wp_cache_get( 'trac_tickets_by_component_unreplied' ); 346 if ( ! $component_unreplied ) { 347 $rows = $this->trac->get_results( $this->trac->prepare( "SELECT id, component FROM ticket t 348 WHERE id NOT IN (SELECT ticket FROM ticket_change WHERE ticket = t.id AND t.reporter <> author AND field = 'comment' AND newvalue <> '') 349 AND status <> 'closed'" ) ); 350 $component_unreplied = array(); 351 foreach ( $rows as $row ) { 352 $component_unreplied[ $row->component ][] = $row->id; 353 } 354 wp_cache_add( 'trac_tickets_by_component_unreplied', $component_unreplied, '', 300 ); 355 } 356 328 357 $this->breakdown_component_type = $component_type; 329 358 $this->breakdown_component_milestone_type = $component_milestone_type; 359 $this->breakdown_component_unreplied = $component_unreplied; 330 360 } 331 361 … … 539 569 if ( $once ) { 540 570 $once = false; 541 echo '<thead><tr><th>Component</th><th style="width: 50px">Tickets</th><th style="width: 50px">7 Days</th><th >Maintainers</th></tr></thead>';571 echo '<thead><tr><th>Component</th><th style="width: 50px">Tickets</th><th style="width: 50px">7 Days</th><th style="width: 50px">0 Replies</th><th>Maintainers</th></tr></thead>'; 542 572 } 543 573 … … 567 597 } 568 598 599 if ( isset( $this->breakdown_component_unreplied[ $component ] ) ) { 600 $unreplied = $this->breakdown_component_unreplied[ $component ]; 601 echo '<td class="right">' . $this->trac_query_link( count( $unreplied ), array( 'component' => $component, 'id' => $unreplied ) ); 602 echo ' <span style="color: red; font-weight: bold">!!</span></td>'; 603 } else { 604 echo '<td></td>'; 605 } 606 569 607 $maintainers = get_post_meta( $post->ID, '_active_maintainers', true ); 570 608 $maintainers = array_filter( array_map( 'trim', explode( ',', $maintainers ) ) );
Note: See TracChangeset
for help on using the changeset viewer.