Changeset 2034
- Timestamp:
- 11/03/2015 05:26:50 AM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications-db.php
r2030 r2034 86 86 return $this->db->get_results( "SELECT name, completed FROM milestone 87 87 WHERE name <> 'WordPress.org' AND (completed = 0 OR completed >= 1386864000000000) 88 ORDER BY (completed = 0) DESC, name DESC", OBJECT_K);88 ORDER BY (completed = 0) DESC, name DESC", ARRAY_A ); 89 89 } 90 90 … … 104 104 ); 105 105 106 if ( $meta['get_trac_ticket'] ->reporter!== $username ) {107 $meta['get_reporter_last_activity'] = $this->get_reporter_past_activity( $meta['get_trac_ticket'] ->reporter, $ticket_id );106 if ( $meta['get_trac_ticket']['reporter'] !== $username ) { 107 $meta['get_reporter_last_activity'] = $this->get_reporter_past_activity( $meta['get_trac_ticket']['reporter'], $ticket_id ); 108 108 } 109 109 … … 112 112 113 113 function get_trac_ticket( $ticket_id ) { 114 return $this->db->get_row( $this->db->prepare( "SELECT * FROM ticket WHERE id = %d", $ticket_id ) );114 return $this->db->get_row( $this->db->prepare( "SELECT * FROM ticket WHERE id = %d", $ticket_id ), ARRAY_A ); 115 115 } 116 116 … … 164 164 165 165 $activity['tickets'] = $this->db->get_results( $this->db->prepare( "SELECT id, summary, type, status, resolution 166 FROM ticket WHERE reporter = %s AND id <= %d LIMIT 5", $reporter, $ticket ) );166 FROM ticket WHERE reporter = %s AND id <= %d LIMIT 5", $reporter, $ticket ), ARRAY_A ); 167 167 168 168 if ( count( $previous_tickets ) === 1 ) { -
sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications.php
r2031 r2034 61 61 62 62 function ticket_link( $ticket ) { 63 $ticket = (object) $ticket; 63 64 $status_res = $ticket->status; 64 65 if ( $ticket->resolution ) { … … 206 207 $ticket = $meta['get_trac_ticket']; 207 208 $focuses = $meta['get_trac_ticket_focuses']; 208 $notifications = $meta['get_trac_ ticket_focuses'];209 $notifications = $meta['get_trac_notifications_for_user']; 209 210 $ticket_sub = $meta['get_trac_ticket_subscription_status_for_user']; 210 211 $ticket_subscriptions = $meta['get_trac_ticket_subscriptions']; … … 221 222 $reasons = array(); 222 223 223 if ( $username == $ticket ->reporter) {224 if ( $username == $ticket['reporter'] ) { 224 225 $reasons['reporter'] = 'you reported this ticket'; 225 226 } 226 if ( $username == $ticket ->owner) {227 if ( $username == $ticket['owner'] ) { 227 228 $reasons['owner'] = 'you own this ticket'; 228 229 } … … 245 246 } 246 247 247 if ( ! empty( $notifications['component'][ $ticket ->component] ) ) {248 $reasons['component'] = sprintf( 'you have subscribed to the %s component', $ticket ->component);249 } 250 if ( ! empty( $notifiations['milestone'][ $ticket ->milestone] ) ) {251 $reasons['milestone'] = sprintf( 'you have subscribed to the %s milestone', $ticket ->milestone);248 if ( ! empty( $notifications['component'][ $ticket['component'] ] ) ) { 249 $reasons['component'] = sprintf( 'you have subscribed to the %s component', $ticket['component'] ); 250 } 251 if ( ! empty( $notifiations['milestone'][ $ticket['milestone'] ] ) ) { 252 $reasons['milestone'] = sprintf( 'you have subscribed to the %s milestone', $ticket['milestone'] ); 252 253 } 253 254 … … 316 317 $send = array( 'notifications-box' => ob_get_clean() ); 317 318 if ( isset( $this->components ) ) { 318 $send['maintainers'] = $this->components->get_component_maintainers( $ticket ->component);319 $send['maintainers'] = $this->components->get_component_maintainers( $ticket['component'] ); 319 320 } 320 321 wp_send_json_success( $send ); … … 323 324 324 325 function ticket_notes( $ticket, $username, $meta ) { 325 if ( $username == $ticket ->reporter) {326 if ( $username == $ticket['reporter'] ) { 326 327 return; 327 328 } … … 334 335 335 336 if ( 1 == count( $activity['tickets'] ) ) { 336 $output = '<strong>Make sure ' . $ticket->reporter . ' receives a warm welcome.</strong><br/>';337 $output = sprintf( '<strong>Make sure %s receives a warm welcome.</strong><br/>', $ticket['reporter'] ); 337 338 338 339 if ( ! empty( $activity['comments'] ) ) { … … 344 345 $mapping = array( 2 => 'second', 3 => 'third', 4 => 'fourth' ); 345 346 346 $output = '<strong>This is only ' . $ticket->reporter . '’s ' . $mapping[ count( $activity['tickets'] ) ] . ' ticket!</strong><br/>Previously:'; 347 $output = sprintf( '<strong>This is only %s’s %s ticket!</strong><br/>Previously:', 348 $ticket['reporter'], $mapping[ count( $activity['tickets'] ) ] ); 347 349 348 350 foreach ( $activity['tickets'] as $t ) { 349 if ( $t ->id != $ticket->id) {351 if ( $t['id'] != $ticket['id'] ) { 350 352 $output .= ' ' . $this->ticket_link( $t ); 351 353 } … … 354 356 } 355 357 356 $gravatar_url = ' //wordpress.org/grav-redirect.php?user=' . esc_attr( $ticket->reporter);358 $gravatar_url = 'https://wordpress.org/grav-redirect.php?user=' . esc_attr( $ticket['reporter'] ); 357 359 358 360 echo '<p class="ticket-note note-new-reporter">'; 359 echo '<img width="36" height="36" src="'. $gravatar_url . '&s=36" srcset="'. $gravatar_url . '&s=72 2x" /> ';361 printf( '<img width="36" height="36" src="%1$s&s=36" srcset="%1$s&s=72 2x" /> ', $gravatar_url ); 360 362 echo '<span class="note">' . $output . '</span>'; 361 363 echo '<span class="dashicons dashicons-welcome-learn-more"></span>'; … … 399 401 if ( empty( $_POST['notifications']['newticket'] ) && ! empty( $notifications['newticket'] ) ) { 400 402 $changes['delete'][] = array( 'username' => $username, 'type' => 'newticket' ); 401 $notifications[ 'newticket'] = false;403 $notifications['newticket'] = false; 402 404 } elseif ( ! empty( $_POST['notifications']['newticket'] ) && empty( $notifications['newticket'] ) ) { 403 405 $changes['insert'][] = array( 'username' => $username, 'type' => 'newticket', 'value' => '1' ); 404 $notifications[ 'newticket'] = true;406 $notifications['newticket'] = true; 405 407 } 406 408 $this->api->update_notifications( $changes ); … … 511 513 echo '<ul>'; 512 514 foreach ( $milestones as $milestone ) { 513 $checked = checked( ! empty( $notifications['milestone'][ $milestone ->name] ), true, false );515 $checked = checked( ! empty( $notifications['milestone'][ $milestone['name'] ] ), true, false ); 514 516 $class = ''; 515 if ( ! empty( $milestone ->completed) ) {517 if ( ! empty( $milestone['completed'] ) ) { 516 518 $class = 'completed-milestone'; 517 519 if ( $checked ) { … … 520 522 $class = ' class="' . $class . '"'; 521 523 } 522 echo '<li' . $class . '><label><input type="checkbox" ' . $checked . 'name="notifications[milestone][' . esc_attr( $milestone ->name ) . ']" /> ' . $milestone->name. '</label></li>';524 echo '<li' . $class . '><label><input type="checkbox" ' . $checked . 'name="notifications[milestone][' . esc_attr( $milestone['name'] ) . ']" /> ' . $milestone['name'] . '</label></li>'; 523 525 } 524 526 echo '<li id="show-completed"><a href="#">Show recently completed…</a></li>';
Note: See TracChangeset
for help on using the changeset viewer.