@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | if (is_array($this->config[$name])) { |
78 | - if (! is_array($val)) { |
|
78 | + if (!is_array($val)) { |
|
79 | 79 | user_error("The value for {$name} must be an array"); |
80 | 80 | } |
81 | 81 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $parentAttributes = parent::getAttributes(); |
112 | 112 | $attributes = []; |
113 | 113 | |
114 | - if (! isset($parentAttributes['placeholder'])) { |
|
114 | + if (!isset($parentAttributes['placeholder'])) { |
|
115 | 115 | $attributes['placeholder'] = $this->config['defaultparts']['scheme'] . '://example.com'; //example url |
116 | 116 | } |
117 | 117 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | $this->value = trim($this->value); |
156 | 156 | $regex = $this->config['validregex']; |
157 | - if ($this->value && $regex && ! preg_match($regex, $this->value)) { |
|
157 | + if ($this->value && $regex && !preg_match($regex, $this->value)) { |
|
158 | 158 | $validator->validationError( |
159 | 159 | $this->name, |
160 | 160 | _t('ExternalURLField.VALIDATION', 'Please enter a valid URL'), |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | protected function rebuildURL($url) |
190 | 190 | { |
191 | 191 | $defaults = $this->config['defaultparts']; |
192 | - if (! preg_match('#^[a-zA-Z]+://#', $url)) { |
|
192 | + if (!preg_match('#^[a-zA-Z]+://#', $url)) { |
|
193 | 193 | $url = $defaults['scheme'] . '://' . $url; |
194 | 194 | } |
195 | 195 | |
196 | 196 | $parts = parse_url($url); |
197 | - if (! $parts) { |
|
197 | + if (!$parts) { |
|
198 | 198 | //can't parse url, abort |
199 | 199 | return ''; |
200 | 200 | } |
@@ -104,17 +104,17 @@ |
||
104 | 104 | $fieldName = $this->name; |
105 | 105 | if ($fieldName) { |
106 | 106 | $url = (string) $this->value; |
107 | - if (! $url) { |
|
107 | + if (!$url) { |
|
108 | 108 | return ''; |
109 | 109 | } |
110 | 110 | $config = Config::inst()->get(ExternalURLField::class, 'default_config'); |
111 | 111 | $defaults = $config['defaultparts']; |
112 | - if (! preg_match('#^[a-zA-Z]+://#', $url)) { |
|
112 | + if (!preg_match('#^[a-zA-Z]+://#', $url)) { |
|
113 | 113 | $url = $defaults['scheme'] . '://' . $url; |
114 | 114 | } |
115 | 115 | |
116 | 116 | $parts = parse_url($url); |
117 | - if (! $parts) { |
|
117 | + if (!$parts) { |
|
118 | 118 | //can't parse url, abort |
119 | 119 | return ''; |
120 | 120 | } |
@@ -20,12 +20,12 @@ |
||
20 | 20 | public static function find(string $link, string $className, string $field, ?bool $removeFinalSlash = true) |
21 | 21 | { |
22 | 22 | $link = strtolower($link); |
23 | - if($removeFinalSlash) { |
|
23 | + if ($removeFinalSlash) { |
|
24 | 24 | $link = rtrim($link, '/'); |
25 | 25 | } |
26 | 26 | $linkObject = DBField::create_field('ExternalURL', $link); |
27 | 27 | $domain = $linkObject->Domain(); |
28 | - if(strpos($domain, 'www.') === 0) { |
|
28 | + if (strpos($domain, 'www.') === 0) { |
|
29 | 29 | $domainWWW = $domain; |
30 | 30 | $domainNoWWW = $linkObject->Domain()->noWWW(); |
31 | 31 | } else { |