aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-22 14:56:53 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-22 14:56:53 +0100
commitd64bf7953b0e4e793d7f75ec50bf6e42652560b2 (patch)
treec4b024b290911a3521d5a5b6166718dd9475661e /src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
parent40f3ea57fbc86247495ef3c335f40f966a69aa50 (diff)
downloadwallabag-d64bf7953b0e4e793d7f75ec50bf6e42652560b2.tar.gz
wallabag-d64bf7953b0e4e793d7f75ec50bf6e42652560b2.tar.zst
wallabag-d64bf7953b0e4e793d7f75ec50bf6e42652560b2.zip
Added internal setting to enable/disable articles with paywall
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/HttpClientFactory.php')
-rw-r--r--src/Wallabag/CoreBundle/Helper/HttpClientFactory.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
index 161a5e9f..ca84c8da 100644
--- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
+++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
@@ -18,23 +18,31 @@ class HttpClientFactory
18 /** @var \GuzzleHttp\Cookie\CookieJar */ 18 /** @var \GuzzleHttp\Cookie\CookieJar */
19 private $cookieJar; 19 private $cookieJar;
20 20
21 private $restrictedAccess;
22
21 /** 23 /**
22 * HttpClientFactory constructor. 24 * HttpClientFactory constructor.
23 * 25 *
24 * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber 26 * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber
25 * @param \GuzzleHttp\Cookie\CookieJar $cookieJar 27 * @param \GuzzleHttp\Cookie\CookieJar $cookieJar
28 * @param string $restrictedAccess
26 */ 29 */
27 public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar) 30 public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar, $restrictedAccess)
28 { 31 {
29 $this->authenticatorSubscriber = $authenticatorSubscriber; 32 $this->authenticatorSubscriber = $authenticatorSubscriber;
30 $this->cookieJar = $cookieJar; 33 $this->cookieJar = $cookieJar;
34 $this->restrictedAccess = $restrictedAccess;
31 } 35 }
32 36
33 /** 37 /**
34 * @return \GuzzleHttp\Client 38 * @return \GuzzleHttp\Client|null
35 */ 39 */
36 public function buildHttpClient() 40 public function buildHttpClient()
37 { 41 {
42 if (0 === (int) $this->restrictedAccess) {
43 return null;
44 }
45
38 // we clear the cookie to avoid websites who use cookies for analytics 46 // we clear the cookie to avoid websites who use cookies for analytics
39 $this->cookieJar->clear(); 47 $this->cookieJar->clear();
40 // need to set the (shared) cookie jar 48 // need to set the (shared) cookie jar