diff options
author | Andrew Dolgov <[email protected]> | 2013-07-31 14:58:14 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-07-31 14:58:16 +0400 |
commit | 87721123b7c6af608fa73036e8cc562c1cc9876e (patch) | |
tree | b04764ee75a8bd63ce4c23d29cb383852f8606e0 /include/functions.php | |
parent | d41ad03712160a7362ea0486001f59eefe79b5c2 (diff) |
remove plaintext url rewriting for twitter posts
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/include/functions.php b/include/functions.php index 4d24d0e26..5b7521249 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2765,9 +2765,6 @@ $res = trim($str); if (!$res) return ''; - if (strpos($res, "href=") === false) - $res = rewrite_urls($res); - $charset_hack = '<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head>'; @@ -3992,52 +3989,6 @@ } - function rewrite_urls($html) { - libxml_use_internal_errors(true); - - $charset_hack = '<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> - </head>'; - - $doc = new DOMDocument(); - $doc->loadHTML($charset_hack . $html); - $xpath = new DOMXPath($doc); - - $entries = $xpath->query('//*/text()'); - - foreach ($entries as $entry) { - if (strstr($entry->wholeText, "://") !== false) { - $text = preg_replace("/((?<!=.)((http|https|ftp)+):\/\/[^ ,!]+)/i", - "<a target=\"_blank\" href=\"\\1\">\\1</a>", $entry->wholeText); - - if ($text != $entry->wholeText) { - $cdoc = new DOMDocument(); - $cdoc->loadHTML($charset_hack . $text); - - - foreach ($cdoc->childNodes as $cnode) { - $cnode = $doc->importNode($cnode, true); - - if ($cnode) { - $entry->parentNode->insertBefore($cnode); - } - } - - $entry->parentNode->removeChild($entry); - - } - } - } - - $node = $doc->getElementsByTagName('body')->item(0); - - // http://tt-rss.org/forum/viewtopic.php?f=1&t=970 - if ($node) - return $doc->saveXML($node); - else - return $html; - } - function filter_to_sql($filter, $owner_uid) { $query = array(); |