-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #221 from tractorcow/pulls/1.1/fix-https
API Add option to specify http / https on subsite domains
- Loading branch information
Showing
9 changed files
with
588 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
language: php | ||
|
||
sudo: false | ||
|
||
php: | ||
- 5.4 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/** | ||
* A text field that accepts only valid domain names, but allows the wildcard (*) character | ||
*/ | ||
class WildcardDomainField extends TextField | ||
{ | ||
/** | ||
* Validate this field as a valid hostname | ||
* | ||
* @param Validator $validator | ||
* @return bool | ||
*/ | ||
public function validate($validator) | ||
{ | ||
if ($this->checkHostname($this->Value())) { | ||
return true; | ||
} | ||
|
||
$validator->validationError( | ||
$this->getName(), | ||
_t("DomainNameField.INVALID_DOMAIN", "Invalid domain name"), | ||
"validation" | ||
); | ||
return false; | ||
} | ||
|
||
/** | ||
* Check if the given hostname is valid. | ||
* | ||
* @param string $hostname | ||
* @return bool True if this hostname is valid | ||
*/ | ||
public function checkHostname($hostname) | ||
{ | ||
return (bool)preg_match('/^([a-z0-9\*]+[\-\.])*([a-z0-9\*]+)$/', $hostname); | ||
} | ||
|
||
public function Type() | ||
{ | ||
return 'text wildcarddomain'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.