File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public function view()
1515
1616 $ input = $ query ->get ('keywords ' );
1717 $ filter = $ query ->get ('filter ' );
18- $ tags = $ query ->get ('tags ' );
18+ $ tags = $ this -> extractTags ( $ query ->get ('tags ' ) );
1919 $ itemsPerPage = $ query ->get ('ipp ' );
2020 $ filterLabel = 'Anything ' ;
2121
@@ -63,7 +63,7 @@ public function view()
6363 }
6464 } else {
6565 if ($ tags ) {
66- foreach (( array ) $ tags as $ tag ) {
66+ foreach ($ tags as $ tag ) {
6767 $ list ->filterByAssetTags ($ tag );
6868 }
6969 $ keywords = $ tags ;
@@ -122,6 +122,24 @@ public function view()
122122 $ this ->set ('showCollectionResults ' , $ showCollectionResults );
123123 }
124124
125+ /**
126+ * @param mixed $tags
127+ * @return array
128+ */
129+ protected function extractTags ($ tags ) : array
130+ {
131+ $ return = [];
132+ if (is_array ($ tags )) {
133+ foreach ($ tags as $ tag ) {
134+ $ tag = preg_replace ('/[<>" \']/ ' , '' , $ tag );
135+ if ($ tag ) {
136+ $ return [] = $ tag ;
137+ }
138+ }
139+ }
140+ return $ return ;
141+ }
142+
125143 public function getRemoveTagUrl ($ keyword )
126144 {
127145 $ url = \URL ::to ('/search ' );
Original file line number Diff line number Diff line change 6565 <?php foreach ($ keywords as $ keyword ) {
6666 $ tagUrl = $ view ->controller ->getRemoveTagUrl ($ keyword );
6767 ?>
68- <span><?= $ keyword ?> <a href="<?= $ tagUrl?> "><i class="fa fa-close"></i></a></span>
68+ <span><?= h ( $ keyword) ?> <a href="<?= $ tagUrl?> "><i class="fa fa-close"></i></a></span>
6969 <?php } ?>
7070 </div>
7171 <?php } ?>
You can’t perform that action at this time.
0 commit comments