Update PicoFeed
This commit is contained in:
parent
bad2c0e4ab
commit
32a60fd614
@ -17,7 +17,7 @@
|
||||
"fguillot/simple-validator": "v1.0.0",
|
||||
"fguillot/json-rpc": "v1.2.3",
|
||||
"fguillot/picodb": "v1.0.14 ",
|
||||
"miniflux/picofeed": "v0.1.34",
|
||||
"miniflux/picofeed": "v0.1.35",
|
||||
"pda/pheanstalk": "v3.1.0",
|
||||
"ircmaxell/password-compat": "^1.0.4"
|
||||
},
|
||||
|
14
composer.lock
generated
14
composer.lock
generated
@ -4,8 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "90873f716813f79b0812e922cf08abb4",
|
||||
"content-hash": "757aaae3177772d2e5e6ba64b0cdd28f",
|
||||
"hash": "3cc07606516c51a4d77e4fee5f6470b7",
|
||||
"content-hash": "7a0eee4a959247fb9833c66ed8d1b775",
|
||||
"packages": [
|
||||
{
|
||||
"name": "fguillot/json-rpc",
|
||||
@ -166,16 +166,16 @@
|
||||
},
|
||||
{
|
||||
"name": "miniflux/picofeed",
|
||||
"version": "v0.1.34",
|
||||
"version": "v0.1.35",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/miniflux/picoFeed.git",
|
||||
"reference": "5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea"
|
||||
"reference": "3a27b47de31eedec075c719f961783c5db7a7b08"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/miniflux/picoFeed/zipball/5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea",
|
||||
"reference": "5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea",
|
||||
"url": "https://api.github.com/repos/miniflux/picoFeed/zipball/3a27b47de31eedec075c719f961783c5db7a7b08",
|
||||
"reference": "3a27b47de31eedec075c719f961783c5db7a7b08",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -215,7 +215,7 @@
|
||||
],
|
||||
"description": "Modern library to handle RSS/Atom feeds",
|
||||
"homepage": "https://github.com/miniflux/picoFeed",
|
||||
"time": "2017-06-12 00:22:06"
|
||||
"time": "2017-06-20 22:54:47"
|
||||
},
|
||||
{
|
||||
"name": "pda/pheanstalk",
|
||||
|
110
vendor/composer/installed.json
vendored
110
vendor/composer/installed.json
vendored
@ -167,61 +167,6 @@
|
||||
"zf2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "miniflux/picofeed",
|
||||
"version": "v0.1.34",
|
||||
"version_normalized": "0.1.34.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/miniflux/picoFeed.git",
|
||||
"reference": "5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/miniflux/picoFeed/zipball/5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea",
|
||||
"reference": "5c8a731d4e7a3589e562e4fdaa98bcb57fa8a2ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-iconv": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-xml": "*",
|
||||
"php": ">=5.3.0",
|
||||
"zendframework/zendxml": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpdocumentor/reflection-docblock": "2.0.4",
|
||||
"phpunit/phpunit": "4.8.26",
|
||||
"symfony/yaml": "2.8.7"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-curl": "PicoFeed will use cURL if present"
|
||||
},
|
||||
"time": "2017-06-12 00:22:06",
|
||||
"bin": [
|
||||
"picofeed"
|
||||
],
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"PicoFeed": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Frédéric Guillot"
|
||||
}
|
||||
],
|
||||
"description": "Modern library to handle RSS/Atom feeds",
|
||||
"homepage": "https://github.com/miniflux/picoFeed"
|
||||
},
|
||||
{
|
||||
"name": "pda/pheanstalk",
|
||||
"version": "v3.1.0",
|
||||
@ -317,5 +262,60 @@
|
||||
"hashing",
|
||||
"password"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "miniflux/picofeed",
|
||||
"version": "v0.1.35",
|
||||
"version_normalized": "0.1.35.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/miniflux/picoFeed.git",
|
||||
"reference": "3a27b47de31eedec075c719f961783c5db7a7b08"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/miniflux/picoFeed/zipball/3a27b47de31eedec075c719f961783c5db7a7b08",
|
||||
"reference": "3a27b47de31eedec075c719f961783c5db7a7b08",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-iconv": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-xml": "*",
|
||||
"php": ">=5.3.0",
|
||||
"zendframework/zendxml": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpdocumentor/reflection-docblock": "2.0.4",
|
||||
"phpunit/phpunit": "4.8.26",
|
||||
"symfony/yaml": "2.8.7"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-curl": "PicoFeed will use cURL if present"
|
||||
},
|
||||
"time": "2017-06-20 22:54:47",
|
||||
"bin": [
|
||||
"picofeed"
|
||||
],
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"PicoFeed": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Frédéric Guillot"
|
||||
}
|
||||
],
|
||||
"description": "Modern library to handle RSS/Atom feeds",
|
||||
"homepage": "https://github.com/miniflux/picoFeed"
|
||||
}
|
||||
]
|
||||
|
@ -106,6 +106,13 @@ abstract class Client
|
||||
*/
|
||||
protected $password = '';
|
||||
|
||||
/**
|
||||
* CURL options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $additional_curl_options = array();
|
||||
|
||||
/**
|
||||
* Client connection timeout.
|
||||
*
|
||||
@ -323,7 +330,6 @@ abstract class Client
|
||||
* Find content type from response headers.
|
||||
*
|
||||
* @param array $response Client response
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function findContentType(array $response)
|
||||
@ -339,7 +345,6 @@ abstract class Client
|
||||
public function findCharset()
|
||||
{
|
||||
$result = explode('charset=', $this->content_type);
|
||||
|
||||
return isset($result[1]) ? $result[1] : '';
|
||||
}
|
||||
|
||||
@ -348,7 +353,6 @@ abstract class Client
|
||||
*
|
||||
* @param array $response Client response
|
||||
* @param string $header Header name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHeader(array $response, $header)
|
||||
@ -360,13 +364,11 @@ abstract class Client
|
||||
* Set the Last-Modified HTTP header.
|
||||
*
|
||||
* @param string $last_modified Header value
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setLastModified($last_modified)
|
||||
{
|
||||
$this->last_modified = $last_modified;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -384,13 +386,11 @@ abstract class Client
|
||||
* Set the value of the Etag HTTP header.
|
||||
*
|
||||
* @param string $etag Etag HTTP header value
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setEtag($etag)
|
||||
{
|
||||
$this->etag = $etag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -490,13 +490,11 @@ abstract class Client
|
||||
* Set connection timeout.
|
||||
*
|
||||
* @param int $timeout Connection timeout
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
$this->timeout = $timeout ?: $this->timeout;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -504,13 +502,11 @@ abstract class Client
|
||||
* Set a custom user agent.
|
||||
*
|
||||
* @param string $user_agent User Agent
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setUserAgent($user_agent)
|
||||
{
|
||||
$this->user_agent = $user_agent ?: $this->user_agent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -518,13 +514,11 @@ abstract class Client
|
||||
* Set the maximum number of HTTP redirections.
|
||||
*
|
||||
* @param int $max Maximum
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setMaxRedirections($max)
|
||||
{
|
||||
$this->max_redirects = $max ?: $this->max_redirects;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -532,13 +526,11 @@ abstract class Client
|
||||
* Set the maximum size of the HTTP body.
|
||||
*
|
||||
* @param int $max Maximum
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setMaxBodySize($max)
|
||||
{
|
||||
$this->max_body_size = $max ?: $this->max_body_size;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -546,13 +538,11 @@ abstract class Client
|
||||
* Set the proxy hostname.
|
||||
*
|
||||
* @param string $hostname Proxy hostname
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setProxyHostname($hostname)
|
||||
{
|
||||
$this->proxy_hostname = $hostname ?: $this->proxy_hostname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -560,13 +550,11 @@ abstract class Client
|
||||
* Set the proxy port.
|
||||
*
|
||||
* @param int $port Proxy port
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setProxyPort($port)
|
||||
{
|
||||
$this->proxy_port = $port ?: $this->proxy_port;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -574,13 +562,11 @@ abstract class Client
|
||||
* Set the proxy username.
|
||||
*
|
||||
* @param string $username Proxy username
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setProxyUsername($username)
|
||||
{
|
||||
$this->proxy_username = $username ?: $this->proxy_username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -588,13 +574,11 @@ abstract class Client
|
||||
* Set the proxy password.
|
||||
*
|
||||
* @param string $password Password
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setProxyPassword($password)
|
||||
{
|
||||
$this->proxy_password = $password ?: $this->proxy_password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -603,12 +587,11 @@ abstract class Client
|
||||
*
|
||||
* @param string $username Basic Auth username
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username ?: $this->username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -617,36 +600,46 @@ abstract class Client
|
||||
*
|
||||
* @param string $password Basic Auth Password
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password ?: $this->password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CURL options.
|
||||
*
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function setAdditionalCurlOptions(array $options)
|
||||
{
|
||||
$this->additional_curl_options = $options ?: $this->additional_curl_options;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enable the passthrough mode.
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function enablePassthroughMode()
|
||||
{
|
||||
$this->passthrough = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the passthrough mode.
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function disablePassthroughMode()
|
||||
{
|
||||
$this->passthrough = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -654,8 +647,7 @@ abstract class Client
|
||||
* Set config object.
|
||||
*
|
||||
* @param \PicoFeed\Config\Config $config Config instance
|
||||
*
|
||||
* @return \PicoFeed\Client\Client
|
||||
* @return $this
|
||||
*/
|
||||
public function setConfig(Config $config)
|
||||
{
|
||||
@ -668,6 +660,7 @@ abstract class Client
|
||||
$this->setProxyPort($config->getProxyPort());
|
||||
$this->setProxyUsername($config->getProxyUsername());
|
||||
$this->setProxyPassword($config->getProxyPassword());
|
||||
$this->setAdditionalCurlOptions($config->getAdditionalCurlOptions() ?: array());
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -110,11 +110,6 @@ class Curl extends Client
|
||||
return $this->handleRedirection($headers['Location']);
|
||||
}
|
||||
|
||||
// Do not work with PHP-FPM
|
||||
if (strpos(PHP_SAPI, 'cgi') !== false) {
|
||||
header(':', true, $status);
|
||||
}
|
||||
|
||||
if (isset($headers['Content-Type'])) {
|
||||
header('Content-Type:' .$headers['Content-Type']);
|
||||
}
|
||||
@ -221,6 +216,20 @@ class Curl extends Client
|
||||
return $ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set additional CURL options.
|
||||
*
|
||||
* @param resource $ch
|
||||
*
|
||||
* @return resource $ch
|
||||
*/
|
||||
private function prepareAdditionalCurlOptions($ch){
|
||||
foreach( $this->additional_curl_options as $c_op => $c_val ){
|
||||
curl_setopt($ch, $c_op, $c_val);
|
||||
}
|
||||
return $ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare curl context.
|
||||
*
|
||||
@ -254,6 +263,7 @@ class Curl extends Client
|
||||
$ch = $this->prepareDownloadMode($ch);
|
||||
$ch = $this->prepareProxyContext($ch);
|
||||
$ch = $this->prepareAuthContext($ch);
|
||||
$ch = $this->prepareAdditionalCurlOptions($ch);
|
||||
|
||||
return $ch;
|
||||
}
|
||||
|
@ -50,10 +50,8 @@ class Url
|
||||
* Shortcut method to get an absolute url from relative url.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param mixed $item_url Unknown url (can be relative or not)
|
||||
* @param mixed $website_url Website url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function resolve($item_url, $website_url)
|
||||
@ -78,9 +76,7 @@ class Url
|
||||
* Shortcut method to get a base url.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function base($url)
|
||||
@ -94,7 +90,6 @@ class Url
|
||||
* Get the base URL.
|
||||
*
|
||||
* @param string $suffix Add a suffix to the url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseUrl($suffix = '')
|
||||
@ -106,7 +101,6 @@ class Url
|
||||
* Get the absolute URL.
|
||||
*
|
||||
* @param string $base_url Use this url as base url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAbsoluteUrl($base_url = '')
|
||||
@ -150,7 +144,8 @@ class Url
|
||||
* Imported from Guzzle library: https://github.com/guzzle/psr7/blob/master/src/Uri.php#L568-L582
|
||||
*
|
||||
* @param $path
|
||||
*
|
||||
* @param string $charUnreserved
|
||||
* @param string $charSubDelims
|
||||
* @return string
|
||||
*/
|
||||
public function filterPath($path, $charUnreserved = 'a-zA-Z0-9_\-\.~', $charSubDelims = '!\$&\'\(\)\*\+,;=')
|
||||
@ -226,7 +221,6 @@ class Url
|
||||
* Get the scheme.
|
||||
*
|
||||
* @param string $suffix Suffix to add when there is a scheme
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getScheme($suffix = '')
|
||||
@ -238,12 +232,12 @@ class Url
|
||||
* Set the scheme.
|
||||
*
|
||||
* @param string $scheme Set a scheme
|
||||
*
|
||||
* @return string
|
||||
* @return $this
|
||||
*/
|
||||
public function setScheme($scheme)
|
||||
{
|
||||
$this->components['scheme'] = $scheme;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -260,7 +254,6 @@ class Url
|
||||
* Get the port.
|
||||
*
|
||||
* @param string $prefix Prefix to add when there is a port
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPort($prefix = '')
|
||||
|
@ -7,9 +7,11 @@ namespace PicoFeed\Config;
|
||||
*
|
||||
* @author Frederic Guillot
|
||||
*
|
||||
* @method \PicoFeed\Config\Config setAdditionalCurlOptions(array $options)
|
||||
* @method \PicoFeed\Config\Config setClientTimeout(integer $value)
|
||||
* @method \PicoFeed\Config\Config setClientUserAgent(string $value)
|
||||
* @method \PicoFeed\Config\Config setMaxRedirections(integer $value)
|
||||
* @method \PicoFeed\Config\Config setMaxRecursions(integer $value)
|
||||
* @method \PicoFeed\Config\Config setMaxBodySize(integer $value)
|
||||
* @method \PicoFeed\Config\Config setProxyHostname(string $value)
|
||||
* @method \PicoFeed\Config\Config setProxyPort(integer $value)
|
||||
@ -36,6 +38,7 @@ namespace PicoFeed\Config;
|
||||
* @method integer getClientTimeout()
|
||||
* @method string getClientUserAgent()
|
||||
* @method integer getMaxRedirections()
|
||||
* @method integer getMaxRecursions()
|
||||
* @method integer getMaxBodySize()
|
||||
* @method string getProxyHostname()
|
||||
* @method integer getProxyPort()
|
||||
@ -59,6 +62,7 @@ namespace PicoFeed\Config;
|
||||
* @method string getFilterImageProxyUrl()
|
||||
* @method \Closure getFilterImageProxyCallback()
|
||||
* @method string getFilterImageProxyProtocol()
|
||||
* @method array getAdditionalCurlOptions()
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
@ -92,5 +96,7 @@ class Config
|
||||
|
||||
return isset($this->container[$parameter]) ? $this->container[$parameter] : $default_value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,8 @@ class Filter
|
||||
* Get the Html filter instance.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $html HTML content
|
||||
* @param string $website Site URL (used to build absolute URL)
|
||||
*
|
||||
* @return Html
|
||||
*/
|
||||
public static function html($html, $website)
|
||||
@ -30,7 +28,7 @@ class Filter
|
||||
* Escape HTML content.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
public static function escape($content)
|
||||
@ -42,7 +40,6 @@ class Filter
|
||||
* Remove HTML tags.
|
||||
*
|
||||
* @param string $data Input data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function removeHTMLTags($data)
|
||||
@ -54,9 +51,7 @@ class Filter
|
||||
* Remove the XML tag from a document.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $data Input data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function stripXmlTag($data)
|
||||
@ -80,9 +75,7 @@ class Filter
|
||||
* Strip head tag from the HTML content.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $data Input data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function stripHeadTags($data)
|
||||
@ -94,9 +87,7 @@ class Filter
|
||||
* Trim whitespace from the begining, the end and inside a string and don't break utf-8 string.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $value Raw data
|
||||
*
|
||||
* @return string Normalized data
|
||||
*/
|
||||
public static function stripWhiteSpace($value)
|
||||
@ -112,9 +103,7 @@ class Filter
|
||||
* Fixes before XML parsing.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $data Raw data
|
||||
*
|
||||
* @return string Normalized data
|
||||
*/
|
||||
public static function normalizeData($data)
|
||||
|
@ -90,7 +90,6 @@ class Html
|
||||
* Set config object.
|
||||
*
|
||||
* @param \PicoFeed\Config\Config $config Config instance
|
||||
*
|
||||
* @return \PicoFeed\Filter\Html
|
||||
*/
|
||||
public function setConfig($config)
|
||||
@ -160,7 +159,8 @@ class Html
|
||||
/**
|
||||
* Called after XML parsing.
|
||||
*
|
||||
* @param string $content the content that should be filtered
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
public function filterRules($content)
|
||||
{
|
||||
|
@ -77,7 +77,6 @@ class Tag extends Base
|
||||
*
|
||||
* @param string $tag Tag name
|
||||
* @param array $attributes Attributes dictionary
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAllowed($tag, array $attributes)
|
||||
@ -90,7 +89,6 @@ class Tag extends Base
|
||||
*
|
||||
* @param string $tag Tag name
|
||||
* @param string $attributes Attributes converted in html
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function openHtmlTag($tag, $attributes = '')
|
||||
@ -102,7 +100,6 @@ class Tag extends Base
|
||||
* Return the HTML closing tag.
|
||||
*
|
||||
* @param string $tag Tag name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function closeHtmlTag($tag)
|
||||
@ -114,7 +111,6 @@ class Tag extends Base
|
||||
* Return true is the tag is self-closing.
|
||||
*
|
||||
* @param string $tag Tag name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSelfClosingTag($tag)
|
||||
@ -126,7 +122,6 @@ class Tag extends Base
|
||||
* Check if a tag is on the whitelist.
|
||||
*
|
||||
* @param string $tag Tag name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAllowedTag($tag)
|
||||
@ -142,7 +137,6 @@ class Tag extends Base
|
||||
*
|
||||
* @param string $tag Tag name
|
||||
* @param array $attributes Tag attributes
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPixelTracker($tag, array $attributes)
|
||||
@ -156,7 +150,6 @@ class Tag extends Base
|
||||
* Remove script tags.
|
||||
*
|
||||
* @param string $data Input data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function removeBlacklistedTags($data)
|
||||
@ -182,7 +175,6 @@ class Tag extends Base
|
||||
* Remove empty tags.
|
||||
*
|
||||
* @param string $data Input data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function removeEmptyTags($data)
|
||||
@ -194,7 +186,6 @@ class Tag extends Base
|
||||
* Replace <br/><br/> by only one.
|
||||
*
|
||||
* @param string $data Input data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function removeMultipleBreakTags($data)
|
||||
@ -206,7 +197,6 @@ class Tag extends Base
|
||||
* Set whitelisted tags adn attributes for each tag.
|
||||
*
|
||||
* @param array $values List of tags: ['video' => ['src', 'cover'], 'img' => ['src']]
|
||||
*
|
||||
* @return Tag
|
||||
*/
|
||||
public function setWhitelistedTags(array $values)
|
||||
|
@ -25,8 +25,7 @@ class Atom extends Parser
|
||||
* Get the path to the items XML tree.
|
||||
*
|
||||
* @param SimpleXMLElement $xml Feed xml
|
||||
*
|
||||
* @return SimpleXMLElement
|
||||
* @return SimpleXMLElement[]
|
||||
*/
|
||||
public function getItemsTree(SimpleXMLElement $xml)
|
||||
{
|
||||
@ -307,7 +306,6 @@ class Atom extends Parser
|
||||
*
|
||||
* @param SimpleXMLElement $xml XML tag
|
||||
* @param string $rel Link relationship: alternate, enclosure, related, self, via
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getUrl(SimpleXMLElement $xml, $rel, $fallback = false)
|
||||
@ -331,7 +329,6 @@ class Atom extends Parser
|
||||
*
|
||||
* @param SimpleXMLElement $xml XML tag
|
||||
* @param string $rel Link relationship: alternate, enclosure, related, self, via
|
||||
*
|
||||
* @return SimpleXMLElement|null
|
||||
*/
|
||||
private function findLink(SimpleXMLElement $xml, $rel)
|
||||
@ -352,7 +349,6 @@ class Atom extends Parser
|
||||
* Get the entry content.
|
||||
*
|
||||
* @param SimpleXMLElement $entry XML Entry
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getContent(SimpleXMLElement $entry)
|
||||
|
@ -318,7 +318,7 @@ class Item
|
||||
/**
|
||||
* Get categories.
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function getCategories()
|
||||
{
|
||||
@ -468,7 +468,7 @@ class Item
|
||||
/**
|
||||
* Set item categories from xml.
|
||||
*
|
||||
* @param SimpleXMLElement[] $categories
|
||||
* @param |SimpleXMLElement[] $categories
|
||||
* @return Item
|
||||
*/
|
||||
public function setCategoriesFromXml($categories)
|
||||
@ -482,9 +482,8 @@ class Item
|
||||
$categories
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$categories = array();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,8 @@ abstract class Parser implements ParserInterface
|
||||
|
||||
/**
|
||||
* Parse the document.
|
||||
*
|
||||
* @return \PicoFeed\Parser\Feed
|
||||
* @return Feed
|
||||
* @throws MalformedXmlException
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
@ -279,9 +279,7 @@ abstract class Parser implements ParserInterface
|
||||
* Return true if the given language is "Right to Left".
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param string $language Language: fr-FR, en-US
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isLanguageRTL($language)
|
||||
@ -324,7 +322,6 @@ abstract class Parser implements ParserInterface
|
||||
* Set config object.
|
||||
*
|
||||
* @param \PicoFeed\Config\Config $config Config instance
|
||||
*
|
||||
* @return \PicoFeed\Parser\Parser
|
||||
*/
|
||||
public function setConfig($config)
|
||||
@ -352,7 +349,6 @@ abstract class Parser implements ParserInterface
|
||||
* scraped
|
||||
* @param null|\Closure $scraperCallback Callback function that gets called for each
|
||||
* scraper execution
|
||||
*
|
||||
* @return \PicoFeed\Parser\Parser
|
||||
*/
|
||||
public function enableContentGrabber($needsRuleFile = false, $scraperCallback = null)
|
||||
@ -375,7 +371,6 @@ abstract class Parser implements ParserInterface
|
||||
* Set ignored URLs for the content grabber.
|
||||
*
|
||||
* @param array $urls URLs
|
||||
*
|
||||
* @return \PicoFeed\Parser\Parser
|
||||
*/
|
||||
public function setGrabberIgnoreUrls(array $urls)
|
||||
@ -388,7 +383,6 @@ abstract class Parser implements ParserInterface
|
||||
* Register all supported namespaces to be used within an xpath query.
|
||||
*
|
||||
* @param SimpleXMLElement $xml Feed xml
|
||||
*
|
||||
* @return SimpleXMLElement
|
||||
*/
|
||||
public function registerSupportedNamespaces(SimpleXMLElement $xml)
|
||||
@ -399,6 +393,4 @@ abstract class Parser implements ParserInterface
|
||||
|
||||
return $xml;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ class Rss10 extends Parser
|
||||
* Get the path to the items XML tree.
|
||||
*
|
||||
* @param SimpleXMLElement $xml Feed xml
|
||||
*
|
||||
* @return SimpleXMLElement
|
||||
* @return SimpleXMLElement[]
|
||||
*/
|
||||
public function getItemsTree(SimpleXMLElement $xml)
|
||||
{
|
||||
|
@ -28,8 +28,7 @@ class Rss20 extends Parser
|
||||
* Get the path to the items XML tree.
|
||||
*
|
||||
* @param SimpleXMLElement $xml Feed xml
|
||||
*
|
||||
* @return SimpleXMLElement
|
||||
* @return SimpleXMLElement[]
|
||||
*/
|
||||
public function getItemsTree(SimpleXMLElement $xml)
|
||||
{
|
||||
@ -315,5 +314,4 @@ class Rss20 extends Parser
|
||||
$categories = XmlParser::getXPathResult($entry, 'category');
|
||||
$item->setCategoriesFromXml($categories);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class XmlParser
|
||||
*
|
||||
* @static
|
||||
* @param string $input XML content
|
||||
* @return DOMDocument
|
||||
* @return DOMDocument|bool
|
||||
*/
|
||||
public static function getDomDocument($input)
|
||||
{
|
||||
|
@ -33,5 +33,7 @@ class ContentFilterProcessor extends Base implements ItemProcessorInterface
|
||||
} else {
|
||||
Logger::setMessage(get_called_class().': Content filtering disabled');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class ItemPostProcessor extends Base
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wheather a specific processor is registered or not
|
||||
* Checks whether a specific processor is registered or not
|
||||
*
|
||||
* @access public
|
||||
* @param string $class
|
||||
|
@ -127,11 +127,11 @@ class Reader extends Base
|
||||
/**
|
||||
* Get a parser instance.
|
||||
*
|
||||
* @param string $url Site url
|
||||
* @param string $content Feed content
|
||||
* @param string $url Site url
|
||||
* @param string $content Feed content
|
||||
* @param string $encoding HTTP encoding
|
||||
*
|
||||
* @return \PicoFeed\Parser\Parser
|
||||
* @throws UnsupportedFeedFormatException
|
||||
*/
|
||||
public function getParser($url, $content, $encoding)
|
||||
{
|
||||
@ -154,7 +154,6 @@ class Reader extends Base
|
||||
* Detect the feed format.
|
||||
*
|
||||
* @param string $content Feed content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function detectFormat($content)
|
||||
@ -177,7 +176,7 @@ class Reader extends Base
|
||||
* Add the prefix "http://" if the end-user just enter a domain name.
|
||||
*
|
||||
* @param string $url Url
|
||||
* @retunr string
|
||||
* @return string
|
||||
*/
|
||||
public function prependScheme($url)
|
||||
{
|
||||
|
@ -181,7 +181,6 @@ class CandidateParser implements ParserInterface
|
||||
* Strip useless tags.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function stripGarbage($content)
|
||||
@ -257,8 +256,7 @@ class CandidateParser implements ParserInterface
|
||||
* Return false if the node should not be removed.
|
||||
*
|
||||
* @param DomDocument $dom
|
||||
* @param DomNode $node
|
||||
*
|
||||
* @param \DomNode $node
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldRemove(DomDocument $dom, $node)
|
||||
|
@ -17,7 +17,6 @@ class RuleLoader extends Base
|
||||
* Get the rules for an URL.
|
||||
*
|
||||
* @param string $url the URL that should be looked up
|
||||
*
|
||||
* @return array the array containing the rules
|
||||
*/
|
||||
public function getRules($url)
|
||||
@ -43,7 +42,6 @@ class RuleLoader extends Base
|
||||
* Get the list of possible rules file names for a given hostname.
|
||||
*
|
||||
* @param string $hostname Hostname
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRulesFileList($hostname)
|
||||
@ -70,7 +68,6 @@ class RuleLoader extends Base
|
||||
*
|
||||
* @param string $folder Rule directory
|
||||
* @param array $files List of possible file names
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function loadRuleFile($folder, array $files)
|
||||
|
@ -205,6 +205,9 @@ class Scraper extends Base
|
||||
|
||||
/**
|
||||
* Execute the scraper.
|
||||
*
|
||||
* @param string $pageContent
|
||||
* @param int $recursionDepth
|
||||
*/
|
||||
public function execute($pageContent = '', $recursionDepth = 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user