Skip to content

Commit 0cd1183

Browse files
authored
Merge pull request #54 from webaddicto/patch-7
Support url_pattern_regex (one plugin for more sites)
2 parents 1e5a93a + 0595954 commit 0cd1183

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Plugin/AbstractPlugin.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@ final public function route(ProxyEvent $event){
3232
$url = $event['request']->getUri();
3333

3434
// url filter provided and current request url does not match it
35-
if($this->url_pattern && strpos($url, $this->url_pattern) === false){
36-
return;
35+
if($this->url_pattern){
36+
if(strpos($this->url_pattern, '/') === 0){
37+
if(!preg_match($this->url_pattern, $url))
38+
return;
39+
}
40+
else
41+
{
42+
if(stripos($url, $this->url_pattern) === false)
43+
return;
44+
}
3745
}
3846

3947
switch($event->getName()){
@@ -66,4 +74,4 @@ final public static function getSubscribedEvents(){
6674
}
6775
}
6876

69-
?>
77+
?>

0 commit comments

Comments
 (0)