@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | $this->hostname = $config['hostname']; |
51 | 51 | $this->url = isset($config['resolves_to']) ? $config['resolves_to'] : null; |
52 | 52 | |
53 | - $globalAllowed = (array) Config::inst()->get('MultiDomain','allow'); |
|
54 | - $globalForced = (array) Config::inst()->get('MultiDomain','force'); |
|
55 | - $myAllowed = isset($config['allow']) ? $config['allow'] : array (); |
|
56 | - $myForced = isset($config['force']) ? $config['force'] : array (); |
|
53 | + $globalAllowed = (array) Config::inst()->get('MultiDomain', 'allow'); |
|
54 | + $globalForced = (array) Config::inst()->get('MultiDomain', 'force'); |
|
55 | + $myAllowed = isset($config['allow']) ? $config['allow'] : array(); |
|
56 | + $myForced = isset($config['force']) ? $config['force'] : array(); |
|
57 | 57 | $this->allowedPaths = array_merge($globalAllowed, $myAllowed); |
58 | 58 | $this->forcedPaths = array_merge($globalForced, $myForced); |
59 | 59 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return boolean |
82 | 82 | */ |
83 | 83 | public function isActive() { |
84 | - if($this->isAllowedPath($_SERVER['REQUEST_URI'])) { |
|
84 | + if ($this->isAllowedPath($_SERVER['REQUEST_URI'])) { |
|
85 | 85 | return false; |
86 | 86 | } |
87 | 87 | |
@@ -94,8 +94,7 @@ discard block |
||
94 | 94 | $hostname = $this->getHostname(); |
95 | 95 | |
96 | 96 | return $allow_subdomains ? |
97 | - preg_match('/(\.|^)'.$hostname.'$/', $currentHost) : |
|
98 | - ($currentHost == $hostname); |
|
97 | + preg_match('/(\.|^)'.$hostname.'$/', $currentHost) : ($currentHost == $hostname); |
|
99 | 98 | } |
100 | 99 | |
101 | 100 | /** |
@@ -114,11 +113,11 @@ discard block |
||
114 | 113 | * @return string |
115 | 114 | */ |
116 | 115 | public function getNativeURL($url) { |
117 | - if($this->isPrimary()) { |
|
116 | + if ($this->isPrimary()) { |
|
118 | 117 | throw new Exception("Cannot convert a native URL on the primary domain"); |
119 | 118 | } |
120 | 119 | |
121 | - if($this->isAllowedPath($url) || $this->isForcedPath($url)) { |
|
120 | + if ($this->isAllowedPath($url) || $this->isForcedPath($url)) { |
|
122 | 121 | return $url; |
123 | 122 | } |
124 | 123 | |
@@ -133,7 +132,7 @@ discard block |
||
133 | 132 | * @return string |
134 | 133 | */ |
135 | 134 | public function getVanityURL($url) { |
136 | - if($this->isPrimary() || $this->isAllowedPath($url)) { |
|
135 | + if ($this->isPrimary() || $this->isAllowedPath($url)) { |
|
137 | 136 | return $url; |
138 | 137 | } |
139 | 138 | |
@@ -146,9 +145,9 @@ discard block |
||
146 | 145 | * @return boolean |
147 | 146 | */ |
148 | 147 | public function hasURL($url) { |
149 | - if($this->isForcedPath($url)) return true; |
|
150 | - $domainBaseURL = trim($this->getURL(),'/'); |
|
151 | - if(preg_match('/^'.$domainBaseURL.'/', $url)) { |
|
148 | + if ($this->isForcedPath($url)) return true; |
|
149 | + $domainBaseURL = trim($this->getURL(), '/'); |
|
150 | + if (preg_match('/^'.$domainBaseURL.'/', $url)) { |
|
152 | 151 | return true; |
153 | 152 | } |
154 | 153 | |
@@ -180,13 +179,13 @@ discard block |
||
180 | 179 | * @return boolean |
181 | 180 | */ |
182 | 181 | protected static function match_url($url, $patterns) { |
183 | - if(!is_array($patterns)) return false; |
|
182 | + if (!is_array($patterns)) return false; |
|
184 | 183 | |
185 | 184 | $url = ltrim($url, '/'); |
186 | - if(substr($url, -1) !== '/') $url .= '/'; |
|
185 | + if (substr($url, -1) !== '/') $url .= '/'; |
|
187 | 186 | |
188 | - foreach($patterns as $pattern) { |
|
189 | - if(fnmatch($pattern, $url)) return true; |
|
187 | + foreach ($patterns as $pattern) { |
|
188 | + if (fnmatch($pattern, $url)) return true; |
|
190 | 189 | } |
191 | 190 | |
192 | 191 | return false; |