diff options
author | Jouveer <35312684+Jouveer@users.noreply.github.com> | 2018-01-18 23:46:02 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2018-01-18 23:46:02 +0300 |
commit | df04267946c691fc77bee8964abe176fa26c94f1 (patch) | |
tree | dc3bcbe949bc8fd4b4ab4c5fc15877384b58ec36 | |
parent | db47ea850722f731f9e14adbaaaed8cd8d16088d (diff) |
Changed Feeds URL to HTTPS (#12449)
* Changed Feeds URL to HTTPS
* Fixed issue if an exception is called with https
* Update RssChangelog.php
* Fixed 2nd Feed URL
-rw-r--r-- | plugins/RssWidget/RssRenderer.php | 3 | ||||
-rw-r--r-- | plugins/RssWidget/Widgets/RssChangelog.php | 27 | ||||
-rw-r--r-- | plugins/RssWidget/Widgets/RssPiwik.php | 21 |
3 files changed, 30 insertions, 21 deletions
diff --git a/plugins/RssWidget/RssRenderer.php b/plugins/RssWidget/RssRenderer.php index 51c831cd4c..8673443216 100644 --- a/plugins/RssWidget/RssRenderer.php +++ b/plugins/RssWidget/RssRenderer.php @@ -46,8 +46,7 @@ class RssRenderer $content = Http::fetchRemoteFile($this->url); $rss = simplexml_load_string($content); } catch (\Exception $e) { - echo "Error while importing feed: {$e->getMessage()}\n"; - exit; + throw new \Exception("Error while importing feed: {$e->getMessage()}\n"); } $output = '<div style="padding:10px 15px;"><ul class="rss">'; diff --git a/plugins/RssWidget/Widgets/RssChangelog.php b/plugins/RssWidget/Widgets/RssChangelog.php index 4f215fd6a6..9a58d0c367 100644 --- a/plugins/RssWidget/Widgets/RssChangelog.php +++ b/plugins/RssWidget/Widgets/RssChangelog.php @@ -20,20 +20,25 @@ class RssChangelog extends \Piwik\Widget\Widget $config->setName('Matomo Changelog'); } + private function getFeed($URL) { + $rss = new RssRenderer($URL); + $rss->setCountPosts(1); + $rss->showDescription(true); + $rss->showContent(false); + return $rss->get(); + } + public function render() - { + { try { - $rss = new RssRenderer('http://feeds.feedburner.com/PiwikReleases'); - $rss->setCountPosts(1); - $rss->showDescription(true); - $rss->showContent(false); - - return $rss->get(); - + return $this->getFeed('https://feeds.feedburner.com/PiwikReleases'); } catch (\Exception $e) { - - return $this->error($e); - } + try { + return $this->getFeed('http://feeds.feedburner.com/PiwikReleases'); + } catch (\Exception $e) { + return $this->error($e); + } + } } /** diff --git a/plugins/RssWidget/Widgets/RssPiwik.php b/plugins/RssWidget/Widgets/RssPiwik.php index 9cf78247a0..2234488c49 100644 --- a/plugins/RssWidget/Widgets/RssPiwik.php +++ b/plugins/RssWidget/Widgets/RssPiwik.php @@ -20,18 +20,23 @@ class RssPiwik extends \Piwik\Widget\Widget $config->setName('Matomo.org Blog'); } + private function getFeed($URL){ + $rss = new RssRenderer($URL); + $rss->showDescription(true); + return $rss->get(); + } + public function render() { try { - $rss = new RssRenderer('http://feeds.feedburner.com/Piwik'); - $rss->showDescription(true); - - return $rss->get(); - + return $this->getFeed('https://feeds.feedburner.com/Piwik'); } catch (\Exception $e) { - - return $this->error($e); - } + try { + return $this->getFeed('http://feeds.feedburner.com/Piwik'); + } catch (\Exception $e) { + return $this->error($e); + } + } } /** |