Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/05/2020 07:21:41 PM (5 years ago)
Author:
johnjamesjacoby
Message:

Search/Rewrites: unslash search terms inside bbp_get_search_terms().

This commit ensures that search terms appear correctly inside of template output, without additional slashes.

It also eliminates a few repeated calls to bbp_get_search_rewrite_id(), and more strictly compares rewrite rule query vars to null results for improved code clarity & consistency.

Props dd32, johnjamesjacoby.

See #3357. Trunk, for 2.7.0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/shortcodes.php

    r6791 r7076  
    672672
    673673        // Set passed attribute to $search_terms for clarity
    674         $search_terms = empty( $attr['search'] ) ? bbp_get_search_terms() : $attr['search'];
     674        $search_terms = empty( $attr['search'] )
     675            ? bbp_get_search_terms()
     676            : $attr['search'];
     677
     678        // Get the rewrite ID (one time, to avoid repeated calls)
     679        $rewrite_id = bbp_get_search_rewrite_id();
    675680
    676681        // Unset globals
     
    678683
    679684        // Set terms for query
    680         set_query_var( bbp_get_search_rewrite_id(), $search_terms );
    681 
    682         // Start output buffer
    683         $this->start( bbp_get_search_rewrite_id() );
     685        set_query_var( $rewrite_id, $search_terms );
     686
     687        // Start output buffer
     688        $this->start( $rewrite_id );
    684689
    685690        // Output template
Note: See TracChangeset for help on using the changeset viewer.