Ticket #1965: 1965.patch
| File 1965.patch, 4.7 KB (added by , 6 years ago) |
|---|
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-moderators.php
468 468 469 469 $permalink = $this->get_permalink( $post->ID ); 470 470 471 $classes = array(); 472 473 if ( bbp_is_topic( $r['post_id'] ) ) { 474 $classes[] = 'bbp-topic-archive-link'; 475 } else { 476 $classes[] = 'bbp-reply-archive-link'; 477 } 478 471 479 $url = esc_url( wp_nonce_url( add_query_arg( $query_args, $permalink ), 'toggle-post-archive_' . $user_id . '_' . $post->ID ) ); 472 return sprintf( "<a href='%s' >%s</a>", $url, esc_html( $text ) );480 return sprintf( "<a href='%s' class='%s'>%s</a>", $url, esc_attr( implode( ' ', $classes ) ), esc_html( $text ) ); 473 481 } 474 482 475 483 public function is_post_archived( $post_id ) { -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/js/forums.js
4 4 $( '[type="submit"]', $(this) ).prop( 'disabled', 'disabled' ); 5 5 }); 6 6 7 function wporg_bbp_ajax_moderator_action( link, element, type ) { 8 $.get( 9 link 10 ).done( function() { 11 element.fadeOut( 250, function() { 12 $( this ).html( '<div class="bbp-template-notice">' + wporgSupport.strings[ type ] + '</div>' ); 13 } ).fadeIn( 250 ); 14 } ).error( function() { 15 element.fadeOut( 250, function() { 16 $( '.bbp-topic-content', $( this ) ).prepend( '<div class="bbp-template-notice">' + wporgSupport.strings.action_failed + '</div>' ); 17 } ).fadeIn( 250 ); 18 } ); 19 } 20 21 $( '.bbp-topic-approve-link, .bbp-post-approve-link', 'body.bbp-view-pending, body.bbp-view-spam' ).click( function( e ) { 22 e.preventDefault(); 23 wporg_bbp_ajax_moderator_action( $( this ).attr( 'href' ), $( this ).closest( '.bbp-body' ), 'approve' ); 24 } ); 25 $( '.bbp-topic-spam-link, .bbp-post-spam-link', 'body.bbp-view-pending, body.bbp-view-spam' ).click( function( e ) { 26 e.preventDefault(); 27 wporg_bbp_ajax_moderator_action( $( this ).attr( 'href' ), $( this ).closest( '.bbp-body' ), 'spam' ); 28 } ); 29 $( '.bbp-topic-archive-link, .bbp-post-archive-link', 'body.bbp-view-pending, body.bbp-view-spam' ).click( function( e ) { 30 e.preventDefault(); 31 wporg_bbp_ajax_moderator_action( $( this ).attr( 'href' ), $( this ).closest( '.bbp-body' ), 'archive' ); 32 } ); 33 7 34 } )( window.jQuery ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
24 24 25 25 wp_enqueue_script( 'wporg-support-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20181209', true ); 26 26 wp_enqueue_script( 'wporg-support-forums', get_template_directory_uri() . '/js/forums.js', array( 'jquery' ), '20180801', true ); 27 28 wp_localize_script( 29 'wporg-support-forums', 30 'wporgSupport', 31 array( 32 'strings' => array( 33 'approve' => __( 'The approval status of this post has been changed.', 'wporg-forums' ), 34 'spam' => __( 'The spam status of this post has been changed.', 'wporg-forums' ), 35 'archive' => __( 'The archive status of this post has been changed.', 'wporg-forums' ), 36 'action_failed' => __( 'Unable to complete the requested action, please try again.', 'wporg-forums' ), 37 ), 38 ) 39 ); 27 40 } 28 41 add_action( 'wp_enqueue_scripts', 'wporg_support_scripts' ); 29 42 … … 165 178 } 166 179 add_filter( 'body_class', 'wporg_support_body_class' ); 167 180 181 /** 182 * Exten the bbPress body class when applicable. 183 */ 184 function wporg_support_bbp_body_class( $classes ) { 185 global $wp_query; 186 187 // If this is a single view, we will add a custom rule for it. 188 if ( ! empty( $wp_query->bbp_is_view ) && ( true === $wp_query->bbp_is_view ) ) { 189 $single_view = 'bbp-view-' . $wp_query->get( 'bbp_view' ); 190 if ( ! in_array( $single_view, $classes ) ) { 191 $classes[] = $single_view; 192 } 193 } 194 195 return $classes; 196 } 197 add_filter( 'bbp_body_class', 'wporg_support_bbp_body_class' ); 198 168 199 /** 169 200 * Change the amount of words allowed in excerpts on archive listings. 170 201 *