Skip to content

Commit

Permalink
Merge pull request #47 from pierrocknroll/master
Browse files Browse the repository at this point in the history
Add curl timeout option
  • Loading branch information
willvincent authored Jul 19, 2018
2 parents ffb4ccd + 304df95 commit 00689db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/FeedsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function make($feed_url = [], $limit = 0, $force_feed = false, $options =
} else {
$this->simplepie->strip_attributes(false);
}
if (isset($this->config['curl.timeout']) && is_int($this->config['curl.timeout'])) {
$this->simplepie->set_timeout($this->config['curl.timeout']);
}
if (isset($options) && is_array($options)) {
if (isset($options['curl.options']) && is_array($options['curl.options'])) {
$this->simplepie->set_curl_options($this->simplepie->curl_options + $options['curl.options']);
Expand All @@ -53,6 +56,9 @@ public function make($feed_url = [], $limit = 0, $force_feed = false, $options =
if (isset($options['strip_attribute.tags']) && is_array($options['strip_attribute.tags'])) {
$this->simplepie->strip_attributes($options['strip_attribute.tags']);
}
if (isset($options['curl.timeout']) && is_int($options['curl.timeout'])) {
$this->simplepie->set_timeout($options['curl.timeout']);
}
}
$this->simplepie->init();

Expand Down
2 changes: 2 additions & 0 deletions src/config/feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,7 @@
|
*/
'curl.options' => null,

'curl.timeout' => null,

];

0 comments on commit 00689db

Please sign in to comment.