Changeset 9857
- Timestamp:
- 05/13/2020 03:31:34 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin-directory-compat.php
r9041 r9857 74 74 */ 75 75 public function parse_query() { 76 global $wp; 77 76 78 $slug = get_query_var( 'wporg_plugin' ); 77 79 if ( ! $slug ) { 78 return; 80 // bbPress feeds are bad and don't actually fill in globals. 81 if ( isset( $wp->query_vars['feed'] ) && ! empty( $wp->query_vars['wporg_plugin'] ) ) { 82 $slug = $wp->query_vars['wporg_plugin']; 83 } else { 84 return; 85 } 79 86 } 80 87 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-ratings-compat.php
r9600 r9857 73 73 add_action( 'bbp_new_topic_post_extras', array( $this, 'topic_post_extras' ) ); 74 74 add_action( 'bbp_edit_topic_post_extras', array( $this, 'topic_post_extras' ) ); 75 76 // Add the rating to the Feed body/title 77 if ( did_action( 'bbp_feed' ) ) { 78 add_filter( 'bbp_get_topic_content', array( $this, 'feed_prepend_rating' ), 10, 2 ); 79 add_filter( 'bbp_get_topic_title', array( $this, 'feed_append_rating' ), 10, 2 ); 80 } 75 81 } 76 82 … … 440 446 return false; 441 447 } 448 449 /** 450 * Prepend the Rating to the feed content. 451 */ 452 public function feed_prepend_rating( $content, $topic_id ) { 453 if ( Plugin::REVIEWS_FORUM_ID == bbp_get_topic_forum_id( $topic_id ) ) { 454 $user_id = bbp_get_topic_author_id( $topic_id ); 455 $rating = \WPORG_Ratings::get_user_rating( $this->compat, $this->slug, $user_id ); 456 457 if ( $rating ) { 458 $content = sprintf( 459 "<p>%s</p>\n%s", 460 sprintf( 461 __( 'Rating: %s', 'wporg-forums' ), 462 sprintf( 463 _n( '%s star', '%s stars', $rating, 'wporg-forums' ), 464 $rating 465 ) 466 ), 467 $content 468 ); 469 } 470 } 471 472 return $content; 473 } 474 475 /** 476 * Append the Rating to the feed title. 477 */ 478 public function feed_append_rating( $title, $topic_id ) { 479 if ( Plugin::REVIEWS_FORUM_ID == bbp_get_topic_forum_id( $topic_id ) ) { 480 $user_id = bbp_get_topic_author_id( $topic_id ); 481 $rating = \WPORG_Ratings::get_user_rating( $this->compat, $this->slug, $user_id ); 482 483 if ( $rating ) { 484 $title = sprintf( 485 "%s (%s)", 486 $title, 487 sprintf( 488 _n( '%s star', '%s stars', $rating, 'wporg-forums' ), 489 $rating 490 ) 491 ); 492 } 493 } 494 495 return $title; 496 } 442 497 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-theme-directory-compat.php
r9041 r9857 74 74 */ 75 75 public function parse_query() { 76 global $wp; 77 76 78 $slug = get_query_var( 'wporg_theme' ); 77 79 if ( ! $slug ) { 78 return; 80 // bbPress feeds are bad and don't actually fill in globals. 81 if ( isset( $wp->query_vars['feed'] ) && ! empty( $wp->query_vars['wporg_theme'] ) ) { 82 $slug = $wp->query_vars['wporg_theme']; 83 } else { 84 return; 85 } 79 86 } 80 87 … … 88 95 status_header( 404 ); 89 96 return; 90 } else {91 $this->slug = $slug;92 $this->theme = $theme;93 $this->authors = $this->get_authors( $slug );94 $this->contributors = $this->get_contributors( $slug );95 $this->support_reps = $this->get_support_reps( $slug );96 97 } 98 99 $this->slug = $slug; 100 $this->theme = $theme; 101 $this->authors = $this->get_authors( $slug ); 102 $this->contributors = $this->get_contributors( $slug ); 103 $this->support_reps = $this->get_support_reps( $slug ); 97 104 } 98 105
Note: See TracChangeset
for help on using the changeset viewer.