Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sydekumf committed Feb 6, 2017
1 parent b04ec5b commit c337b28
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 80 deletions.
35 changes: 4 additions & 31 deletions Block/Adminhtml/Dashboard.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
/**
* Magenerds\Dashboard\Block\AfterPrice
*
* Copyright (c) 2017 Magenerds
* All rights reserved
*
Expand All @@ -12,21 +10,14 @@
* [email protected]
*/

/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage Block
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
*/
namespace Magenerds\Dashboard\Block\Adminhtml;

use Magento\Backend\Block\Template;

/**
* Class Dashboard
* @package Magenerds\Dashboard\Block\Adminhtml
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
*/
class Dashboard extends Template
{
Expand Down Expand Up @@ -62,19 +53,10 @@ public function getBlogFeeds()

$ctr = 1;
foreach ($reader->import(self::BLOG_FEED_URL) as $feed) {
$matches = [];
preg_match('/^src=".*\..{3}"/', $feed->getContent(), $matches);
$img = '';

if (count($matches)) {
$img = substr($matches[0], 4, strlen($matches[0]));
}

$feeds[] = [
'link' => $feed->getLink(),
'title' => $feed->getTitle(),
'date' => substr($feed->getDateCreated(), 0, 10),
'image' => $img,
'description' => $feed->getDescription()
];
if ($ctr == self::NUMBER_BLOG_FEEDS) break;
Expand All @@ -96,20 +78,11 @@ public function getNewsFeeds()

$ctr = 1;
foreach ($reader->import(self::NEWS_FEED_URL) as $feed) {
$matches = [];
preg_match('/^src=".*\..{3}"/', $feed->getContent(), $matches);
$img = '';

if (count($matches)) {
$img = substr($matches[0], 4, strlen($matches[0]));
}

$feeds[] = [
'link' => $feed->getLink(),
'title' => $feed->getTitle(),
'date' => substr($feed->getDateCreated(), 0, 10),
'image' => $img,
'description' => $feed->getDescription()
'content' => $feed->getContent()
];
if ($ctr == self::NUMBER_NEWS_FEEDS) break;
$ctr++;
Expand Down
15 changes: 3 additions & 12 deletions Controller/Adminhtml/Dashboard/Index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
/**
* Magenerds\Dashboard\Block\AfterPrice
*
* Copyright (c) 2017 Magenerds
* All rights reserved
*
Expand All @@ -12,23 +10,16 @@
* [email protected]
*/

/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage Controller
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
*/
namespace Magenerds\Dashboard\Controller\Adminhtml\Dashboard;

use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use Magento\Backend\App\Action;

/**
* Class Index
* @package Magenerds\Dashboard\Controller\Adminhtml\Dashboard
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
*/
class Index extends Action
{
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"magento/framework": "100.0.*|100.1.*"
},
"type": "magento2-module",
"version": "0.0.1",
"license": [
"proprietary"
],
Expand Down
3 changes: 0 additions & 3 deletions etc/acl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage etc
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
Expand Down
3 changes: 0 additions & 3 deletions etc/adminhtml/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage etc
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
Expand Down
3 changes: 0 additions & 3 deletions etc/adminhtml/routes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage etc
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
Expand Down
3 changes: 0 additions & 3 deletions etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage etc
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
Expand Down
5 changes: 0 additions & 5 deletions registration.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php
/**
* Magenerds\Dashboard\Block\AfterPrice
*
* Copyright (c) 2017 Magenerds
* All rights reserved
*
Expand All @@ -13,9 +11,6 @@
*/

/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage Module
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
Expand Down
3 changes: 0 additions & 3 deletions view/adminhtml/layout/magenerds_dashboard_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage view
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
Expand Down
17 changes: 4 additions & 13 deletions view/adminhtml/templates/dashboard.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
*/

/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage view
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
Expand Down Expand Up @@ -59,10 +56,10 @@
to for contacting us. We only support cases issued via our bug report form.
</div>
<div class="buttons">
<button class="action-primary" title="Get support" id="support" onclick="setLocation('')">
<button class="action-primary" title="Get support" id="support" onclick="setLocation('http://www.magenerds.com/report-a-bug/')">
<span>Get support</span>
</button>
<button class="action-primary" title="Documentation" id="documentation" onclick="setLocation('')">
<button class="action-primary" title="Documentation" id="documentation" onclick="setLocation('http://doc.magenerds.com/')">
<span>Documentation</span>
</button>
<button class="action-primary" title="Website" id="website" onclick="setLocation('http://www.magenerds.com')">
Expand All @@ -83,9 +80,6 @@
<?php foreach ($block->getBlogFeeds() as $feed): ?>
<li>
<div class="title"><a href="<?php echo $feed['link'] ?>" target="_blank"><?php echo $feed['title'] ?></a> (<?php echo $feed['date']; ?>)</div>
<?php if ($feed['image'] != ''): ?>
<div><img src="<?php echo $feed['image'] ?>" /></div>
<?php endif; ?>
<div class="description"><?php echo $feed['description'] ?>... <a href="<?php echo $feed['link'] ?>" target="_blank">(read more)</a></div>
</li>
<?php endforeach; ?>
Expand All @@ -96,11 +90,8 @@
<ul>
<?php foreach ($block->getNewsFeeds() as $feed): ?>
<li>
<div class="title"><a href="<?php echo $feed['link'] ?>" target="_blank"><?php echo $feed['title'] ?></a> (<?php echo $feed['date']; ?>)</div>
<?php if ($feed['image'] != ''): ?>
<div><img src="<?php echo $feed['image'] ?>" /></div>
<?php endif; ?>
<div class="description"><?php echo $feed['description'] ?>... <a href="<?php echo $feed['link'] ?>" target="_blank">(read more)</a></div>
<div class="title"><?php echo $feed['title'] ?></div>
<div class="content"><?php echo $feed['content'] ?></div>
</li>
<?php endforeach; ?>
</ul>
Expand Down
3 changes: 0 additions & 3 deletions view/adminhtml/web/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
*/

/**
* @category Magenerds
* @package Magenerds_Dashboard
* @subpackage view
* @copyright Copyright (c) 2017 Magenerds (http://www.magenerds.com)
* @link http://www.magenerds.com/
* @author Florian Sydekum <[email protected]>
Expand Down

0 comments on commit c337b28

Please sign in to comment.