diff options
| author | 2013-12-02 20:57:51 +0100 | |
|---|---|---|
| committer | 2013-12-02 20:57:51 +0100 | |
| commit | 986c7297e71d926afa584c6de293794a49f69adf (patch) | |
| tree | 3215140d47d5db2cdad0c30c03ccadf9fc181ede /lib/lib_rss.php | |
| parent | 56b269cef6bc54fa8d8fc69ff0f0e8b2ffb36afb (diff) | |
OPML import plus tolérant
Plus correction bug checkUrl()
Diffstat (limited to 'lib/lib_rss.php')
| -rw-r--r-- | lib/lib_rss.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 22e50a424..ae140827c 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -19,13 +19,13 @@ function checkUrl($url) { if (empty ($url)) { return ''; } - if (!preg_match ('#^https?://#i', $value)) { + if (!preg_match ('#^https?://#i', $url)) { $url = 'http://' . $url; } if (filter_var($url, FILTER_VALIDATE_URL) || - (version_compare(PHP_VERSION, '5.3.3', '<') && (strpos($value, '-') > 0) && //PHP bug #51192 - ($value === filter_var($value, FILTER_SANITIZE_URL)))) { - return url; + (version_compare(PHP_VERSION, '5.3.3', '<') && (strpos($url, '-') > 0) && //PHP bug #51192 + ($url === filter_var($url, FILTER_SANITIZE_URL)))) { + return $url; } else { return false; } @@ -113,7 +113,14 @@ function html_only_entity_decode($text) { function opml_import ($xml) { $xml = html_only_entity_decode($xml); //!\ Assume UTF-8 - $opml = simplexml_load_string ($xml); + + $dom = new DOMDocument(); + $dom->recover = true; + $dom->strictErrorChecking = false; + $dom->loadXML($xml); + $this->encoding = 'UTF-8'; + + $opml = simplexml_import_dom($dom); if (!$opml) { throw new OpmlException (); |
