mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 17:23:00 +00:00
Properly escape search terms in the context highlighter.
This commit is contained in:
parent
b539cb4107
commit
0e3a7f345a
3 changed files with 3 additions and 3 deletions
|
@ -1957,7 +1957,7 @@ class search
|
||||||
foreach($qterms as $qterm)
|
foreach($qterms as $qterm)
|
||||||
{
|
{
|
||||||
// From http://stackoverflow.com/a/2483859/1460422
|
// From http://stackoverflow.com/a/2483859/1460422
|
||||||
$context = preg_replace("/" . preg_quote($qterm) . "/i", "<strong>$0</strong>", $context);
|
$context = preg_replace("/" . preg_quote(str_replace("/", "\/", $qterm)) . "/i", "<strong>$0</strong>", $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $context;
|
return $context;
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds proper search functionality to Pepperminty Wiki. Note that this module, at the moment, just contains test code while I figure out how best to write a search engine.",
|
"description": "Adds proper search functionality to Pepperminty Wiki. Note that this module, at the moment, just contains test code while I figure out how best to write a search engine.",
|
||||||
"id": "feature-search",
|
"id": "feature-search",
|
||||||
"lastupdate": 1447520172,
|
"lastupdate": 1447520515,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -472,7 +472,7 @@ class search
|
||||||
foreach($qterms as $qterm)
|
foreach($qterms as $qterm)
|
||||||
{
|
{
|
||||||
// From http://stackoverflow.com/a/2483859/1460422
|
// From http://stackoverflow.com/a/2483859/1460422
|
||||||
$context = preg_replace("/" . preg_quote($qterm) . "/i", "<strong>$0</strong>", $context);
|
$context = preg_replace("/" . preg_quote(str_replace("/", "\/", $qterm)) . "/i", "<strong>$0</strong>", $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $context;
|
return $context;
|
||||||
|
|
Loading…
Reference in a new issue