File size: 779 Bytes
e4f4821 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<?php
namespace Kanboard\ExternalLink;
use Kanboard\Core\ExternalLink\ExternalLinkInterface;
/**
* Web Link
*
* @package externalLink
* @author Frederic Guillot
*/
class WebLink extends BaseLink implements ExternalLinkInterface
{
/**
* Get link title
*
* @access public
* @return string
*/
public function getTitle()
{
$html = $this->httpClient->get($this->url);
if (preg_match('/<title>(.*)<\/title>/siU', $html, $matches)) {
return trim($matches[1]);
}
$components = parse_url($this->url);
if (! empty($components['host']) && ! empty($components['path'])) {
return $components['host'].$components['path'];
}
return t('Title not found');
}
}
|