| <?php |
|
|
| namespace Kanboard\ExternalLink; |
|
|
| use Kanboard\Core\ExternalLink\ExternalLinkProviderInterface; |
|
|
| |
| |
| |
| |
| |
| |
| class WebLinkProvider extends BaseLinkProvider implements ExternalLinkProviderInterface |
| { |
| |
| |
| |
| |
| |
| |
| public function getName() |
| { |
| return t('Web Link'); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getType() |
| { |
| return 'weblink'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getDependencies() |
| { |
| return array( |
| 'related' => t('Related'), |
| ); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function match() |
| { |
| $startWithHttp = strpos($this->userInput, 'http://') === 0 || strpos($this->userInput, 'https://') === 0; |
| $validUrl = filter_var($this->userInput, FILTER_VALIDATE_URL); |
|
|
| return $startWithHttp && $validUrl; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getLink() |
| { |
| $link = new WebLink($this->container); |
| $link->setUrl($this->userInput); |
|
|
| return $link; |
| } |
| } |
|
|