diff options
| author | 2018-06-16 09:59:46 +0200 | |
|---|---|---|
| committer | 2018-06-16 09:59:46 +0200 | |
| commit | 3306a1679c2570c30d4b662c887b4a71ce147398 (patch) | |
| tree | 35fb1616c1166723676c789d6127a98db3260148 /lib/lib_rss.php | |
| parent | c0122003fe3031926546012b86a38b5187082613 (diff) | |
| parent | 8fcacc8cf41c14dd7d9712329d75ff4f041f3caf (diff) | |
Merge pull request #1921 from FreshRSS/dev1.11.1
FreshRSS 1.11.1
Diffstat (limited to 'lib/lib_rss.php')
| -rw-r--r-- | lib/lib_rss.php | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php index abb20f16a..5f460862e 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -253,68 +253,6 @@ function sanitizeHTML($data, $base = '') { return html_only_entity_decode($simplePie->sanitize->sanitize($data, SIMPLEPIE_CONSTRUCT_HTML, $base)); } -/* permet de récupérer le contenu d'un article pour un flux qui n'est pas complet */ -function get_content_by_parsing($url, $path, $attributes = array()) { - require_once(LIB_PATH . '/lib_phpQuery.php'); - $system_conf = Minz_Configuration::get('system'); - $limits = $system_conf->limits; - $feed_timeout = empty($attributes['timeout']) ? 0 : intval($attributes['timeout']); - - if ($system_conf->simplepie_syslog_enabled) { - syslog(LOG_INFO, 'FreshRSS GET ' . SimplePie_Misc::url_remove_credentials($url)); - } - - $ch = curl_init(); - curl_setopt_array($ch, array( - CURLOPT_URL => $url, - CURLOPT_REFERER => SimplePie_Misc::url_remove_credentials($url), - CURLOPT_HTTPHEADER => array('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'), - CURLOPT_USERAGENT => FRESHRSS_USERAGENT, - CURLOPT_CONNECTTIMEOUT => $feed_timeout > 0 ? $feed_timeout : $limits['timeout'], - CURLOPT_TIMEOUT => $feed_timeout > 0 ? $feed_timeout : $limits['timeout'], - //CURLOPT_FAILONERROR => true; - CURLOPT_MAXREDIRS => 4, - CURLOPT_RETURNTRANSFER => true, - )); - if (version_compare(PHP_VERSION, '5.6.0') >= 0 || ini_get('open_basedir') == '') { - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //Keep option separated for open_basedir PHP bug 65646 - } - if (defined('CURLOPT_ENCODING')) { - curl_setopt($ch, CURLOPT_ENCODING, ''); //Enable all encodings - } - curl_setopt_array($ch, $system_conf->curl_options); - if (isset($attributes['ssl_verify'])) { - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $attributes['ssl_verify'] ? 2 : 0); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $attributes['ssl_verify'] ? true : false); - } - $html = curl_exec($ch); - $c_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $c_error = curl_error($ch); - curl_close($ch); - - if ($c_status != 200 || $c_error != '') { - Minz_Log::warning('Error fetching content: HTTP code ' . $c_status . ': ' . $c_error . ' ' . $url); - } - - if ($html) { - $doc = phpQuery::newDocument($html); - $content = $doc->find($path); - - foreach (pq('img[data-src]') as $img) { - $imgP = pq($img); - $dataSrc = $imgP->attr('data-src'); - if (strlen($dataSrc) > 4) { - $imgP->attr('src', $dataSrc); - $imgP->removeAttr('data-src'); - } - } - - return sanitizeHTML($content->__toString(), $url); - } else { - throw new Exception(); - } -} - /** * Add support of image lazy loading * Move content from src attribute to data-original @@ -542,7 +480,6 @@ function recursive_unlink($dir) { return rmdir($dir); } - /** * Remove queries where $get is appearing. * @param $get the get attribute which should be removed. @@ -559,29 +496,6 @@ function remove_query_by_get($get, $queries) { return $final_queries; } - -/** - * Add a value in an array and take care it is unique. - * @param $array the array in which we add the value. - * @param $value the value to add. - */ -function array_push_unique(&$array, $value) { - $found = array_search($value, $array) !== false; - if (!$found) { - $array[] = $value; - } -} - - -/** - * Remove a value from an array. - * @param $array the array from wich value is removed. - * @param $value the value to remove. - */ -function array_remove(&$array, $value) { - $array = array_diff($array, array($value)); -} - //RFC 4648 function base64url_encode($data) { return strtr(rtrim(base64_encode($data), '='), '+/', '-_'); |
