Strip HTML tags when searching for installed themes.

props enej, SergeyBiryukov, obenland.
fixes #27561.
Built from https://develop.svn.wordpress.org/trunk@31240


git-svn-id: http://core.svn.wordpress.org/trunk@31221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-01-18 20:40:23 +00:00
parent 247cdad571
commit eedb4857ba
3 changed files with 8 additions and 4 deletions

View File

@ -165,7 +165,7 @@ themes.Collection = Backbone.Collection.extend({
// Performs a search within the collection // Performs a search within the collection
// @uses RegExp // @uses RegExp
search: function( term ) { search: function( term ) {
var match, results, haystack; var match, results, haystack, name, description, author;
// Start with a full collection // Start with a full collection
this.reset( themes.data.themes, { silent: true } ); this.reset( themes.data.themes, { silent: true } );
@ -181,7 +181,11 @@ themes.Collection = Backbone.Collection.extend({
// Find results // Find results
// _.filter and .test // _.filter and .test
results = this.filter( function( data ) { results = this.filter( function( data ) {
haystack = _.union( data.get( 'name' ), data.get( 'id' ), data.get( 'description' ), data.get( 'author' ), data.get( 'tags' ) ); name = data.get( 'name' ).replace( /(<([^>]+)>)/ig, '' );
description = data.get( 'description' ).replace( /(<([^>]+)>)/ig, '' );
author = data.get( 'author' ).replace( /(<([^>]+)>)/ig, '' );
haystack = _.union( name, data.get( 'id' ), description, author, data.get( 'tags' ) );
if ( match.test( data.get( 'author' ) ) && term.length > 2 ) { if ( match.test( data.get( 'author' ) ) && term.length > 2 ) {
data.set( 'displayAuthor', true ); data.set( 'displayAuthor', true );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-alpha-31239'; $wp_version = '4.2-alpha-31240';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.