Making WordPress.org

Changeset 10233


Ignore:
Timestamp:
09/03/2020 02:14:02 AM (4 years ago)
Author:
dd32
Message:

Plugin Directory: Search: When searches are performed from /browse/block/ limit the searches to the plugins in that section (block plugins).

This is mostly for debugging and to visually see any search modifications easier.

See https://github.com/WordPress/gutenberg/issues/24910
See #2753.

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r10215 r10233  
    11911191        $vars[] = 'plugin_advanced';
    11921192        $vars[] = 'geopattern_icon';
     1193        $vars[] = 'block_search';
    11931194
    11941195        // Remove support for any query vars the Plugin Directory doesn't support/need.
     
    13381339        // New-style search links.
    13391340        if ( get_query_var( 's' ) && isset( $_GET['s'] ) ) {
    1340             wp_safe_redirect( site_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ), 301 );
     1341            $url = site_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' );
     1342            if ( get_query_var( 'block_search' ) ) {
     1343                $url = add_query_arg( 'block_search', get_query_var( 'block_search' ), $url );
     1344            }
     1345
     1346            wp_safe_redirect( $url, 301 );
    13411347            die();
    13421348        }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/search.php

    r6284 r10233  
    2525                    ?>
    2626                </h1>
     27                <?php
     28                if ( get_query_var( 'block_search' ) ) {
     29                    printf(
     30                        /* translators: %s: Search URL */
     31                        '<p>' . __( 'Searching the block directory. <a href="%s">Search all plugins</a>.', 'wporg-plugins' ) . '</p>',
     32                        remove_query_arg( 'block_search' )
     33                    );
     34                }
     35                ?>
    2736            </header><!-- .page-header -->
    2837
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/searchform.php

    r6284 r10233  
    1212    <label for="s" class="screen-reader-text"><?php echo esc_html_x( 'Search for:', 'label', 'wporg-plugins' ); ?></label>
    1313    <input type="search" id="s" class="search-field" placeholder="<?php echo esc_attr_x( 'Search plugins', 'placeholder', 'wporg-plugins' ); ?>" value="<?php the_search_query(); ?>" name="s" />
     14    <?php if ( get_query_var( 'block_search' ) || 'block' === get_query_var( 'browse' ) ) : ?>
     15        <input type="hidden" value="1" name="block_search" />
     16    <?php endif; ?>
    1417    <button class="button button-primary button-search"><i class="dashicons dashicons-search"></i><span class="screen-reader-text"><?php esc_html_e( 'Search plugins', 'wporg-plugins' ); ?></span></button>
    1518</form>
Note: See TracChangeset for help on using the changeset viewer.