Ticket #7: 7.patch
File 7.patch, 5.4 KB (added by , 8 years ago) |
---|
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php
277 277 $this->term = get_term_by( 'slug', $this->slug(), $this->taxonomy() ); 278 278 279 279 // Add plugin- and theme-specific filters and actions. 280 add_action( 'wporg_compat_view_sidebar', array( $this, 'do_view_sidebar' ) );280 add_action( 'wporg_compat_view_sidebar', array( $this, 'do_view_sidebar' ) ); 281 281 add_action( 'wporg_compat_before_single_view', array( $this, 'do_view_header' ) ); 282 282 add_action( 'wporg_compat_before_single_view', array( $this, 'do_subscription_link' ), 11 ); 283 add_action( 'wporg_compat_before_single_view', array( $this, 'do_search_form' ), 11 ); 283 284 284 285 // Add output filters and actions. 285 286 add_filter( 'bbp_get_view_link', array( $this, 'get_view_link' ), 10, 2 ); … … 707 708 } 708 709 709 710 /** 711 * Display a project-specific search form in compat views. 712 */ 713 function do_search_form() { 714 get_search_form(); 715 } 716 717 /** 710 718 * Term subscriptions use `get_term_link` for the redirect. This needs to be 711 719 * filtered to redirect to the appropriate theme/plugin support view. 712 720 * -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php
86 86 $search_terms = get_search_query( false ); 87 87 } 88 88 89 if ( isset( $_GET['intext'] ) ) { 90 $search_terms .= ' intext:"' . esc_attr( $_GET['intext'] ) . '"'; 91 } 92 89 93 if ( $search_terms ) { 90 94 $search_url = sprintf( 'https://wordpress.org/search/%s/?forums=1', urlencode( $search_terms ) ); 91 95 $search_url = esc_url_raw( $search_url ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
261 261 } 262 262 263 263 /** 264 * Get current plugin or theme object in plugin- or theme-specific views. 265 * 266 * @return object|null Plugin or theme object on success, false on failure. 267 */ 268 function wporg_support_get_compat_object() { 269 if ( ! class_exists( 'WordPressdotorg\Forums\Plugin' ) ) { 270 return null; 271 } 272 273 $object = null; 274 $plugin_instance = WordPressdotorg\Forums\Plugin::get_instance(); 275 276 if ( ! empty( $plugin_instance->plugins->plugin ) ) { 277 $object = $plugin_instance->plugins->plugin; 278 279 /* translators: %s: link to plugin support or review forum */ 280 $object->prefixed_title = sprintf( __( 'Plugin: %s', 'wporg-forums' ), $object->post_title ); 281 $object->type = 'plugin'; 282 } elseif ( ! empty( $plugin_instance->themes->theme ) ) { 283 $object = $plugin_instance->themes->theme; 284 285 /* translators: %s: link to theme support or review forum */ 286 $object->prefixed_title = sprintf( __( 'Theme: %s', 'wporg-forums' ), $object->post_title ); 287 $object->type = 'theme'; 288 } 289 290 return $object; 291 } 292 293 /** 264 294 * Display a notice for messages caught in the moderation queue. 265 295 */ 266 296 function wporg_support_add_moderation_notice() { -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/searchform.php
15 15 16 16 <form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>"> 17 17 <label for="s" class="screen-reader-text"><?php _ex( 'Search for:', 'label', 'wporg-forums' ); ?></label> 18 <input type="search" id="s" class="search-field" placeholder="<?php echo esc_attr_x( 'Search forums', 'placeholder', 'wporg-forums' ); ?>" value="<?php the_search_query(); ?>" name="s" /> 18 <?php 19 if ( 'wporg_compat_before_single_view' === current_action() ) { 20 $placeholder = _x( 'Search this forum', 'placeholder', 'wporg-forums' ); 21 $project = wporg_support_get_compat_object(); 22 } else { 23 $placeholder = _x( 'Search forums', 'placeholder', 'wporg-forums' ); 24 $project = null; 25 } 26 ?> 27 <input type="search" id="s" class="search-field" placeholder="<?php echo esc_attr( $placeholder ); ?>" value="<?php the_search_query(); ?>" name="s" /> 28 <?php if ( $project ) : ?> 29 <input type="hidden" name="intext" value="<?php echo esc_attr( $project->prefixed_title ); ?>" /> 30 <?php endif; ?> 19 31 <button class="button button-primary button-search"><i class="dashicons dashicons-search"></i><span class="screen-reader-text"><?php _e( 'Search forums', 'wporg-forums' ); ?></span></button> 20 32 </form> 21 33