Plumrocket_Base - Version 1.0.1

Version Notes

Minor fixes

Download this release

Release Info

Developer Plumrocket Team
Extension Plumrocket_Base
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Plumrocket/Base/Helper/Data.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+
5
+ Plumrocket Inc.
6
+
7
+ NOTICE OF LICENSE
8
+
9
+ This source file is subject to the End-user License Agreement
10
+ that is available through the world-wide-web at this URL:
11
+ http://wiki.plumrocket.net/wiki/EULA
12
+ If you are unable to obtain it through the world-wide-web, please
13
+ send an email to support@plumrocket.com so we can send you a copy immediately.
14
+
15
+ @package Plumrocket_Base-v1.x.x
16
+ @copyright Copyright (c) 2014 Plumrocket Inc. (http://www.plumrocket.com)
17
+ @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
18
+
19
+ */
20
+
21
+ class Plumrocket_Base_Helper_Data extends Mage_Core_Helper_Abstract
22
+ {
23
+ public function isAdminNotificationEnabled()
24
+ {
25
+ return (($module = Mage::getConfig()->getModuleConfig('Mage_AdminNotification'))
26
+ && ($module->is('active', 'true'))
27
+ && !Mage::getStoreConfig('advanced/modules_disable_output/Mage_AdminNotification'));
28
+ }
29
+ }
30
+
app/code/community/Plumrocket/Base/Model/Feed.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+
5
+ Plumrocket Inc.
6
+
7
+ NOTICE OF LICENSE
8
+
9
+ This source file is subject to the End-user License Agreement
10
+ that is available through the world-wide-web at this URL:
11
+ http://wiki.plumrocket.net/wiki/EULA
12
+ If you are unable to obtain it through the world-wide-web, please
13
+ send an email to support@plumrocket.com so we can send you a copy immediately.
14
+
15
+ @package Plumrocket_Base-v1.x.x
16
+ @copyright Copyright (c) 2014 Plumrocket Inc. (http://www.plumrocket.com)
17
+ @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
18
+
19
+ */
20
+
21
+ class Plumrocket_Base_Model_Feed extends Mage_AdminNotification_Model_Feed
22
+ {
23
+ const XML_USE_HTTPS_PATH = 'plumbase/notifications/use_https';
24
+ const XML_FEED_URL_PATH = 'plumbase/notifications/feed_url';
25
+ const XML_FREQUENCY_PATH = 'plumbase/notifications/frequency';
26
+
27
+ protected $_feedUrl;
28
+
29
+ public function getFeedUrl()
30
+ {
31
+ if (is_null($this->_feedUrl)) {
32
+ $this->_feedUrl = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://')
33
+ . Mage::getStoreConfig(self::XML_FEED_URL_PATH);
34
+ }
35
+
36
+ $urlInfo = parse_url(Mage::getBaseUrl());
37
+ $domain = isset($urlInfo['host']) ? $urlInfo['host'] : '';
38
+
39
+ if (!strpos($this->_feedUrl, '/index/')){
40
+ $this->_feedUrl .= 'index/';
41
+ }
42
+
43
+ return $this->_feedUrl . 'domain/' . urlencode($domain);
44
+ }
45
+
46
+ public function checkUpdate()
47
+ {
48
+ if (! Mage::getSingleton('admin/session')->isLoggedIn()
49
+ || (($this->getFrequency() + $this->getLastUpdate()) > time())
50
+ || !Mage::helper('plumbase')->isAdminNotificationEnabled()
51
+ ) {
52
+ return $this;
53
+ }
54
+
55
+ try {
56
+ $feedData = array();
57
+ $feedXml = $this->getFeedData();
58
+
59
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
60
+ foreach ($feedXml->channel->item as $item) {
61
+ $feedData[] = array(
62
+ 'severity' => (int)$item->severity,
63
+ 'date_added' => $this->getDate( (string)$item->pubDate ),
64
+ 'title' => (string)$item->title,
65
+ 'description' => (string)$item->description,
66
+ 'url' => (string)$item->link,
67
+ );
68
+ }
69
+ }
70
+
71
+ if ($feedData) {
72
+ Mage::getModel('adminnotification/inbox')->parse($feedData);
73
+ }
74
+ $this->setLastUpdate();
75
+ return $this;
76
+ } catch (Exception $E) {
77
+ return false;
78
+ }
79
+ }
80
+
81
+ public function getLastUpdate()
82
+ {
83
+ return Mage::app()->loadCache('plumrocket_rss_admin_notifications_lastcheck');
84
+ }
85
+
86
+ public function setLastUpdate()
87
+ {
88
+ Mage::app()->saveCache(time(), 'plumrocket_rss_admin_notifications_lastcheck');
89
+ return $this;
90
+ }
91
+
92
+ public function getFrequency()
93
+ {
94
+ return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
95
+ }
96
+ }
app/code/community/Plumrocket/Base/etc/config.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+
4
+ <modules>
5
+ <Plumrocket_Base>
6
+ <version>1.0.0</version>
7
+ </Plumrocket_Base>
8
+ </modules>
9
+
10
+ <global>
11
+ <helpers>
12
+ <plumbase>
13
+ <class>Plumrocket_Base_Helper</class>
14
+ </plumbase>
15
+ </helpers>
16
+ <models>
17
+ <plumbase>
18
+ <class>Plumrocket_Base_Model</class>
19
+ <resourceModel>base_mysql4</resourceModel>
20
+ </plumbase>
21
+ </models>
22
+ </global>
23
+
24
+ <adminhtml>
25
+ <events>
26
+ <controller_action_predispatch>
27
+ <observers>
28
+ <plumrocket_base_notitications>
29
+ <type>singleton</type>
30
+ <class>plumbase/feed</class>
31
+ <method>checkUpdate</method>
32
+ </plumrocket_base_notitications>
33
+ </observers>
34
+ </controller_action_predispatch>
35
+ </events>
36
+ </adminhtml>
37
+
38
+ <default>
39
+ <plumbase>
40
+ <notifications>
41
+ <feed_url>store.plumrocket.com/notificationmanager/feed/</feed_url>
42
+ <popup_url>widgets.magentocommerce.com/notificationPopup</popup_url>
43
+ <severity_icons_url>widgets.magentocommerce.com/%s/%s.gif</severity_icons_url>
44
+ <use_https>1</use_https>
45
+ <frequency>1</frequency>
46
+ </notifications>
47
+ </plumbase>
48
+ </default>
49
+ </config>
app/etc/modules/Plumrocket_Base.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Plumrocket_Base>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>1.0.0</version>
8
+ </Plumrocket_Base>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Plumrocket_Base</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://wiki.plumrocket.net/wiki/EULA">End-user License Agreement</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This PlumrocketBase module is a useful tool for syncing important information between Plumrocket extensions installed on your online store and Plumrocket database.</summary>
10
+ <description>This PlumrocketBase module is a useful tool for syncing important information between Plumrocket extensions installed on your online store and Plumrocket database.&#xD;
11
+ It will notify you about the new changes, fixes and updates using notifications popup at your magento backend and will let you be on track with the recent modifications.</description>
12
+ <notes>Minor fixes</notes>
13
+ <authors><author><name>Plumrocket Team</name><user>plumrocket</user><email>support@plumrocket.com</email></author></authors>
14
+ <date>2014-07-09</date>
15
+ <time>11:00:44</time>
16
+ <contents><target name="magecommunity"><dir name="Plumrocket"><dir name="Base"><dir name="Helper"><file name="Data.php" hash="9e534ce8140731b96a0257a0a25060a7"/></dir><dir name="Model"><file name="Feed.php" hash="7412a21e6d1edd226fce19f3609de602"/></dir><dir name="etc"><file name="config.xml" hash="f01dda8545a580cfbe6d723cf5490def"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Plumrocket_Base.xml" hash="a168acb7d8c05758401655a26857ff50"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
+ </package>