t('Related'), ); } /** * Return true if the provider can parse correctly the user input * * @access public * @return boolean */ public function match() { if (preg_match('/^https?:\/\/.*\.([^\/]+)$/', $this->userInput, $matches)) { return $this->isValidExtension($matches[1]); } return false; } /** * Get the link found with the properties * * @access public * @return \Kanboard\Core\ExternalLink\ExternalLinkInterface */ public function getLink() { $link = new AttachmentLink($this->container); $link->setUrl($this->userInput); return $link; } /** * Check file extension * * @access protected * @param string $extension * @return boolean */ protected function isValidExtension($extension) { $extension = strtolower($extension); foreach ($this->extensions as $ext) { if ($extension === $ext) { return false; } } return true; } }