Skip to content

Commit e06bea7

Browse files
committed
Remove news feed fetching
1 parent c239233 commit e06bea7

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

Block/Adminhtml/Dashboard.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class Dashboard extends Template
2525
/**
2626
* Holds the blog feed url
2727
*/
28-
const BLOG_FEED_URL = 'http://www.magenerds.com/category/magento-2/feed/';
28+
const BLOG_FEED_URL = null; # http://www.magenerds.com/category/magento-2/feed/
2929

3030
/**
3131
* Holds the news feed url
3232
*/
33-
const NEWS_FEED_URL = 'http://www.magenerds.com/category/dashboardnews/feed/';
33+
const NEWS_FEED_URL = null; # http://www.magenerds.com/category/dashboardnews/feed/
3434

3535
/**
3636
* Holds the number of blog feeds
@@ -62,18 +62,21 @@ protected function getReader()
6262
public function getBlogFeeds()
6363
{
6464
$feeds = [];
65+
if (!static::BLOG_FEED_URL) {
66+
return $feeds;
67+
}
6568
$reader = $this->getReader();
6669

6770
$ctr = 1;
6871
try {
69-
foreach ($reader->import(self::BLOG_FEED_URL) as $feed) {
72+
foreach ($reader->import(static::BLOG_FEED_URL) as $feed) {
7073
$feeds[] = [
7174
'link' => $feed->getLink(),
7275
'title' => $feed->getTitle(),
7376
'date' => substr($feed->getDateCreated(), 0, 10),
74-
'description' => $feed->getDescription()
77+
'description' => $feed->getDescription(),
7578
];
76-
if ($ctr == self::NUMBER_BLOG_FEEDS) {
79+
if ($ctr == static::NUMBER_BLOG_FEEDS) {
7780
break;
7881
}
7982
$ctr++;
@@ -93,18 +96,21 @@ public function getBlogFeeds()
9396
public function getNewsFeeds()
9497
{
9598
$feeds = [];
99+
if (!static::NEWS_FEED_URL) {
100+
return $feeds;
101+
}
96102
$reader = $this->getReader();
97103

98104
$ctr = 1;
99105
try {
100-
foreach ($reader->import(self::NEWS_FEED_URL) as $feed) {
106+
foreach ($reader->import(static::NEWS_FEED_URL) as $feed) {
101107
$feeds[] = [
102108
'link' => $feed->getLink(),
103109
'title' => $feed->getTitle(),
104110
'date' => substr($feed->getDateCreated(), 0, 10),
105-
'content' => $feed->getContent()
111+
'content' => $feed->getContent(),
106112
];
107-
if ($ctr == self::NUMBER_NEWS_FEEDS) {
113+
if ($ctr == static::NUMBER_NEWS_FEEDS) {
108114
break;
109115
}
110116
$ctr++;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magenerds/dashboard",
33
"description": "The Magenerds dashboard provides useful information about Magenerds",
44
"require": {
5-
"magento/framework": "^100.0.0|^101.0.0|^102.0.0|^103.0.0"
5+
"magento/framework": "*"
66
},
77
"type": "magento2-module",
88
"license": [

etc/module.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* @author Florian Sydekum <info@magenerds.com>
1818
*/
1919
-->
20-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
20+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
2122
<module name="Magenerds_Dashboard" setup_version="0.0.1"/>
2223
</config>

0 commit comments

Comments
 (0)