Changeset 13778 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
- Timestamp:
- 06/06/2024 04:13:41 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r13721 r13778 975 975 // Sanitize / cleanup the search query a little bit. 976 976 if ( $wp_query->is_search() ) { 977 $s = $wp_query->get( 's');977 $s = wp_unslash( $wp_query->get( 's' ) ); 978 978 $s = urldecode( $s ); 979 979 … … 988 988 } 989 989 990 // Trim off special characters, only allowing wordy characters at the end of searches. 991 $s = preg_replace( '!(\W+)$!iu', '', $s ); 992 // ..and whitespace 990 // Trim whitespace 993 991 $s = trim( $s ); 994 992 995 $wp_query->set( 's', $s ); 993 // If we're searching for a phrase, only trim non-quotey+wordy characters. 994 if ( str_starts_with( $s, '"' ) || str_starts_with( $s, "'" ) ) { 995 $s = preg_replace( '!(\s*[^\'"\w]+)$!iu', '', $s ); 996 } else { 997 // If we're searching for a word, trim all non-wordy characters. 998 $s = preg_replace( '!(\s*\W+)$!iu', '', $s ); 999 } 1000 1001 $wp_query->set( 's', wp_slash( $s ) ); 996 1002 997 1003 // If the search is in the block directory, require that.
Note: See TracChangeset
for help on using the changeset viewer.