1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-01-19 15:52:10 +01:00

Bookmark: Avoid error when the title is not found

This commit is contained in:
Brice Maron 2013-03-30 17:17:06 +01:00
parent fce7e94942
commit ffc7f365da

View File

@ -430,11 +430,13 @@ class OC_Bookmarks_Bookmarks{
$page = OC_Util::getUrlContent($url);
if($page) {
if(preg_match( "/<title>(.*)<\/title>/sUi", $page, $match ) !== false)
$metadata['title'] = html_entity_decode($match[1], ENT_NOQUOTES , 'UTF-8');
//Not the best solution but....
$metadata['title'] = str_replace('&trade;', chr(153), $metadata['title']);
$metadata['title'] = str_replace('&dash;', '', $metadata['title']);
$metadata['title'] = str_replace('&ndash;', '', $metadata['title']);
if(isset($match[1])) {
$metadata['title'] = html_entity_decode($match[1], ENT_NOQUOTES , 'UTF-8');
//Not the best solution but....
$metadata['title'] = str_replace('&trade;', chr(153), $metadata['title']);
$metadata['title'] = str_replace('&dash;', '', $metadata['title']);
$metadata['title'] = str_replace('&ndash;', '', $metadata['title']);
}
}
return $metadata;
}