From 4a1cf7a38bf88ff295bb67f2e57d4f57bf997816 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 18 Jan 2015 20:39:39 +0000 Subject: [PATCH] Strip HTML tags when searching for installed themes. props enej, SergeyBiryukov, obenland. fixes #27561. git-svn-id: https://develop.svn.wordpress.org/trunk@31240 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/theme.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/js/theme.js b/src/wp-admin/js/theme.js index 344a8178ea..fc659ef869 100644 --- a/src/wp-admin/js/theme.js +++ b/src/wp-admin/js/theme.js @@ -165,7 +165,7 @@ themes.Collection = Backbone.Collection.extend({ // Performs a search within the collection // @uses RegExp search: function( term ) { - var match, results, haystack; + var match, results, haystack, name, description, author; // Start with a full collection this.reset( themes.data.themes, { silent: true } ); @@ -181,7 +181,11 @@ themes.Collection = Backbone.Collection.extend({ // Find results // _.filter and .test 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 ) { data.set( 'displayAuthor', true );