Changeset 3962
- Timestamp:
- 09/05/2016 06:49:00 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php
r3925 r3962 17 17 abstract protected function do_view_header(); 18 18 19 var $loaded = false; 19 20 var $authors = null; 20 21 var $contributors = null; … … 33 34 34 35 // Check to see if an individual topic is compat. 35 add_action( ' template_redirect', array( $this, 'check_topic_for_compat' ) );36 add_action( 'wp', array( $this, 'check_topic_for_compat' ) ); 36 37 37 38 // Always check to see if a topic title needs a compat prefix. … … 48 49 add_filter( 'query_vars', array( $this, 'add_query_var' ) ); 49 50 add_action( 'bbp_add_rewrite_rules', array( $this, 'add_rewrite_rules' ) ); 50 51 } 52 51 } 52 53 /** 54 * At this point, compat, slug, and object should be loaded. 55 */ 53 56 public function maybe_load() { 54 if ( false !== $this->slug() ) {57 if ( false !== $this->slug() && false == $this->loaded ) { 55 58 // This must run before bbPress's parse_query at priority 2. 56 59 $this->register_views(); … … 58 61 // Add theme-specific filters and actions. 59 62 add_action( 'wporg_compat_view_sidebar', array( $this, 'do_view_sidebar' ) ); 63 add_action( 'wporg_compat_before_single_view', array( $this, 'do_view_header' ) ); 60 64 61 65 // Add output filters and actions. 62 66 add_filter( 'bbp_get_view_link', array( $this, 'get_view_link' ), 10, 2 ); 63 67 add_filter( 'bbp_breadcrumbs', array( $this, 'breadcrumbs' ) ); 64 65 add_action( 'wporg_compat_before_single_view', array( $this, 'do_view_header' ) );66 68 67 69 // Handle new topic form at the bottom of support view. … … 69 71 add_action( 'bbp_theme_before_topic_form_content', array( $this, 'add_topic_form_content' ) ); 70 72 add_filter( 'bbp_current_user_can_access_create_topic_form', array( $this, 'current_user_can_access_create_topic_form' ) ); 73 74 // Instantiate WPORG_Ratings compat mode for reviews. 75 if ( class_exists( 'WPORG_Ratings' ) && class_exists( 'WordPressdotorg\Forums\Ratings_Compat' ) ) { 76 $this->ratings = new Ratings_Compat( $this->compat(), $this->slug(), $this->get_object( $this->slug() ) ); 77 } 78 79 $this->loaded = true; 71 80 } 72 81 } 73 82 74 83 public function check_topic_for_compat() { 75 if ( bbp_is_single_topic()) {84 if ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && false == $this->loaded ) { 76 85 $terms = get_the_terms( bbp_get_topic_id(), $this->taxonomy() ); 77 86 if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { … … 90 99 } 91 100 add_action( 'wporg_compat_single_topic_sidebar_pre', array( $this, 'do_topic_sidebar' ) ); 101 102 // Instantiate WPORG_Ratings compat mode for reviews. 103 if ( class_exists( 'WPORG_Ratings' ) && class_exists( 'WordPressdotorg\Forums\Ratings_Compat' ) ) { 104 $this->ratings = new Ratings_Compat( $this->compat(), $this->slug(), $this->get_object( $this->slug() ) ); 105 } 106 107 $this->loaded = true; 92 108 } 93 109 } … … 97 113 if ( 98 114 ( bbp_is_single_forum() && bbp_get_forum_id() == $this->forum_id() ) 115 || 116 ( bbp_is_single_forum() && Plugin::REVIEWS_FORUM_ID == bbp_get_forum_id() ) 99 117 || 100 118 ( bbp_is_single_view() && ! in_array( bbp_get_view_id(), array( 'plugin', 'theme', 'reviews', 'active' ) ) )
Note: See TracChangeset
for help on using the changeset viewer.