diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -1428,16 +1428,10 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history) | |||
1428 | // If this is an HTTP(S) link, we try go get the page to extract the title (otherwise we will to straight to the edit form.) | 1428 | // If this is an HTTP(S) link, we try go get the page to extract the title (otherwise we will to straight to the edit form.) |
1429 | if (empty($title) && strpos(get_url_scheme($url), 'http') !== false) { | 1429 | if (empty($title) && strpos(get_url_scheme($url), 'http') !== false) { |
1430 | // Short timeout to keep the application responsive | 1430 | // Short timeout to keep the application responsive |
1431 | list($headers, $content) = get_http_response($url, 4); | 1431 | // The callback will fill $charset and $title with data from the downloaded page. |
1432 | if (strpos($headers[0], '200 OK') !== false) { | 1432 | get_http_response($url, 25, 4194304, get_curl_download_callback($charset, $title)); |
1433 | // Retrieve charset. | 1433 | if (! empty($title) && strtolower($charset) != 'utf-8') { |
1434 | $charset = get_charset($headers, $content); | 1434 | $title = mb_convert_encoding($title, 'utf-8', $charset); |
1435 | // Extract title. | ||
1436 | $title = html_extract_title($content); | ||
1437 | // Re-encode title in utf-8 if necessary. | ||
1438 | if (! empty($title) && strtolower($charset) != 'utf-8') { | ||
1439 | $title = mb_convert_encoding($title, 'utf-8', $charset); | ||
1440 | } | ||
1441 | } | 1435 | } |
1442 | } | 1436 | } |
1443 | 1437 | ||