blob: 9338ca421f84d2afc6cc81123830a5b136b56de7 (
plain)
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
|
<?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');
}
}
|