Cleaned up regular expressions by using a more appropriate delimiter
This commit is contained in:
@@ -28,12 +28,12 @@ class PicoSearch extends AbstractPicoPlugin
|
|||||||
public function onRequestUrl(&$url)
|
public function onRequestUrl(&$url)
|
||||||
{
|
{
|
||||||
// If form was submitted without being intercepted by JavaScript, redirect to the canonical search URL.
|
// If form was submitted without being intercepted by JavaScript, redirect to the canonical search URL.
|
||||||
if (preg_match('/^(.+\/)?search$/', $url) && $_GET['q']) {
|
if (preg_match('~^(.+/)?search$~', $url) && $_GET['q']) {
|
||||||
header('Location: ' . $this->getPico()->getBaseUrl() . $url . '/' . urlencode($_GET['q']));
|
header('Location: ' . $this->getPico()->getBaseUrl() . $url . '/' . urlencode($_GET['q']));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^(.+\/)?search\/([^\/]+)(\/.+)?$/', $url, $matches)) {
|
if (preg_match('~^(.+/)?search/([^/]+)(/.+)?$~', $url, $matches)) {
|
||||||
$this->search_terms = urldecode($matches[2]);
|
$this->search_terms = urldecode($matches[2]);
|
||||||
|
|
||||||
if (!empty($matches[1])) {
|
if (!empty($matches[1])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user