diff options
author | Arthur <arthur@hoa.ro> | 2016-05-03 19:53:57 +0200 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2016-05-03 19:53:57 +0200 |
commit | 47be06098396b5eef35234b88227d64ab81bd988 (patch) | |
tree | bb42c742179e75c7f15c4126ddf79838ceb94331 /application/LinkUtils.php | |
parent | 5a63c34f3a68ce2f53ee9164e2a35a0904676399 (diff) | |
parent | ce7b0b6480aa854ee6893f5c889277b0e3b13efc (diff) | |
download | Shaarli-47be06098396b5eef35234b88227d64ab81bd988.tar.gz Shaarli-47be06098396b5eef35234b88227d64ab81bd988.tar.zst Shaarli-47be06098396b5eef35234b88227d64ab81bd988.zip |
Merge pull request #532 from ArthurHoaro/hotfix/title-retrieve-the-return
Fixes #531 - Title retrieving is failing with multiple use case
Diffstat (limited to 'application/LinkUtils.php')
-rw-r--r-- | application/LinkUtils.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/application/LinkUtils.php b/application/LinkUtils.php index d8dc8b5e..2df76ba8 100644 --- a/application/LinkUtils.php +++ b/application/LinkUtils.php | |||
@@ -9,8 +9,8 @@ | |||
9 | */ | 9 | */ |
10 | function html_extract_title($html) | 10 | function html_extract_title($html) |
11 | { | 11 | { |
12 | if (preg_match('!<title>(.*?)</title>!is', $html, $matches)) { | 12 | if (preg_match('!<title.*?>(.*?)</title>!is', $html, $matches)) { |
13 | return trim(str_replace("\n", ' ', $matches[1])); | 13 | return trim(str_replace("\n", '', $matches[1])); |
14 | } | 14 | } |
15 | return false; | 15 | return false; |
16 | } | 16 | } |
@@ -70,7 +70,7 @@ function headers_extract_charset($headers) | |||
70 | function html_extract_charset($html) | 70 | function html_extract_charset($html) |
71 | { | 71 | { |
72 | // Get encoding specified in HTML header. | 72 | // Get encoding specified in HTML header. |
73 | preg_match('#<meta .*charset="?([^">/]+)"? */?>#Usi', $html, $enc); | 73 | preg_match('#<meta .*charset=["\']?([^";\'>/]+)["\']? */?>#Usi', $html, $enc); |
74 | if (!empty($enc[1])) { | 74 | if (!empty($enc[1])) { |
75 | return strtolower($enc[1]); | 75 | return strtolower($enc[1]); |
76 | } | 76 | } |