@@ -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 | } |
@@ -22,12 +22,12 @@ |
||
| 22 | 22 | public static function find(string $link, string $className, string $field, ?bool $removeFinalSlash = true): DataList |
| 23 | 23 | { |
| 24 | 24 | $link = strtolower($link); |
| 25 | - if($removeFinalSlash) { |
|
| 25 | + if ($removeFinalSlash) { |
|
| 26 | 26 | $link = rtrim($link, '/'); |
| 27 | 27 | } |
| 28 | 28 | $linkObject = DBField::create_field('ExternalURL', $link); |
| 29 | 29 | $domain = $linkObject->Domain(); |
| 30 | - if(strpos($domain, 'www.') === 0) { |
|
| 30 | + if (strpos($domain, 'www.') === 0) { |
|
| 31 | 31 | $domainWWW = $domain; |
| 32 | 32 | $domainNoWWW = $linkObject->Domain()->noWWW(); |
| 33 | 33 | } else { |