Amasty_Fbreview - Version 1.0.0

Version Notes

Initial release

Download this release

Release Info

Developer Magento Core Team
Extension Amasty_Fbreview
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Amasty/Fbreview/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Amasty_Fbreview_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/community/Amasty/Fbreview/etc/adminhtml.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <translate>
3
+ <modules>
4
+ <amfbreview>
5
+ <files>
6
+ <default>Amasty_Fbreview.csv</default>
7
+ </files>
8
+ </amfbreview>
9
+ </modules>
10
+ </translate>
11
+ <acl>
12
+ <resources>
13
+ <all>
14
+ <title>Allow Everything</title>
15
+ </all>
16
+ <admin>
17
+ <children>
18
+ <system>
19
+ <children>
20
+ <config>
21
+ <children>
22
+ <amfbreview translate="title">
23
+ <title>Facebook Reviews</title>
24
+ <sort_order>333</sort_order>
25
+ </amfbreview>
26
+ </children>
27
+ </config>
28
+ </children>
29
+ </system>
30
+ </children>
31
+ </admin>
32
+ </resources>
33
+ </acl>
34
+ </config>
app/code/community/Amasty/Fbreview/etc/config.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Amasty_Fbreview>
5
+ <version>1.0.0</version>
6
+ </Amasty_Fbreview>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <layout>
11
+ <updates>
12
+ <amfbreview>
13
+ <file>amfbreview.xml</file>
14
+ </amfbreview>
15
+ </updates>
16
+ </layout>
17
+ </frontend>
18
+
19
+ <global>
20
+ <helpers>
21
+ <amfbreview>
22
+ <class>Amasty_Fbreview_Helper</class>
23
+ </amfbreview>
24
+ </helpers>
25
+ </global>
26
+
27
+ <adminhtml>
28
+ <translate>
29
+ <modules>
30
+ <amfbreview>
31
+ <files>
32
+ <default>Amasty_Fbreview.csv</default>
33
+ </files>
34
+ </amfbreview>
35
+ </modules>
36
+ </translate>
37
+ <acl>
38
+ <resources>
39
+ <all>
40
+ <title>Allow Everything</title>
41
+ </all>
42
+ <admin>
43
+ <children>
44
+ <system>
45
+ <children>
46
+ <config>
47
+ <children>
48
+ <amfbreview translate="title">
49
+ <title>Facebook Reviews</title>
50
+ <sort_order>333</sort_order>
51
+ </amfbreview>
52
+ </children>
53
+ </config>
54
+ </children>
55
+ </system>
56
+ </children>
57
+ </admin>
58
+ </resources>
59
+ </acl>
60
+ </adminhtml>
61
+ <default>
62
+ <amfbreview>
63
+ <general>
64
+ <title></title>
65
+ <perpage>10</perpage>
66
+ <ascending>0</ascending>
67
+ </general>
68
+ <display>
69
+ <width>630</width>
70
+ <nostyles>0</nostyles>
71
+ <css>/skin/frontend/default/default/css/amfbreview.css</css>
72
+ </display>
73
+ </amfbreview>
74
+ </default>
75
+ </config>
app/code/community/Amasty/Fbreview/etc/system.xml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <amfbreview translate="label">
5
+ <label>Facebook Reviews</label>
6
+ <tab>amasty</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>20</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <general translate="label">
14
+ <label>General Settings</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>10</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+
22
+ <appid translate="label comment">
23
+ <label>Facebook AppID</label>
24
+ <comment>Get at http://www.facebook.com/developers/createapp.php </comment>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </appid>
31
+
32
+ <title translate="label comment">
33
+ <label>Review Title</label>
34
+ <comment>Leave empty to use the product page title</comment>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>30</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </title>
41
+
42
+ <perpage translate="label comment">
43
+ <label>Reviews per Page</label>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>40</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </perpage>
50
+
51
+ <ascending translate="label comment">>
52
+ <label>Chronological order</label>
53
+ <frontend_type>select</frontend_type>
54
+ <source_model>adminhtml/system_config_source_yesno</source_model>
55
+ <sort_order>50</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ </ascending>
60
+
61
+ </fields>
62
+ </general>
63
+
64
+ <display translate="label">
65
+ <label>Display Options</label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>20</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <fields>
72
+
73
+ <width translate="label comment">
74
+ <label>Block Width (px)</label>
75
+ <frontend_type>text</frontend_type>
76
+ <sort_order>30</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </width>
81
+
82
+ <nostyles translate="label comment">>
83
+ <label>No default styles</label>
84
+ <frontend_type>select</frontend_type>
85
+ <source_model>adminhtml/system_config_source_yesno</source_model>
86
+ <sort_order>50</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ </nostyles>
91
+
92
+ <css translate="label comment">
93
+ <label>Custom CSS</label>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>70</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </css>
100
+
101
+ </fields>
102
+ </display>
103
+ </groups>
104
+ </amfbreview>
105
+ </sections>
106
+ </config>
app/code/local/Amasty/Base/Block/Extensions.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2010 Amasty
4
+ */
5
+ class Amasty_Base_Block_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
6
+ {
7
+ protected $_dummyElement;
8
+ protected $_fieldRenderer;
9
+ protected $_values;
10
+
11
+ public function render(Varien_Data_Form_Element_Abstract $element)
12
+ {
13
+ $html = $this->_getHeaderHtml($element);
14
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
15
+ sort($modules);
16
+
17
+ foreach ($modules as $moduleName) {
18
+ if (strstr($moduleName, 'Amasty_') === false) {
19
+ continue;
20
+ }
21
+
22
+ if ($moduleName == 'Amasty_Base'){
23
+ continue;
24
+ }
25
+
26
+ $html.= $this->_getFieldHtml($element, $moduleName);
27
+ }
28
+ $html .= $this->_getFooterHtml($element);
29
+
30
+ return $html;
31
+ }
32
+
33
+ protected function _getFieldRenderer()
34
+ {
35
+ if (empty($this->_fieldRenderer)) {
36
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
37
+ }
38
+ return $this->_fieldRenderer;
39
+ }
40
+
41
+ protected function _getFieldHtml($fieldset, $moduleCode)
42
+ {
43
+ $currentVer = Mage::getConfig()->getModuleConfig($moduleCode)->version;
44
+ if (!$currentVer)
45
+ return '';
46
+
47
+ $moduleName = substr($moduleCode, strpos($moduleCode, '_') + 1); // in case we have no data in the RSS
48
+
49
+ $allExtensions = unserialize(Mage::app()->loadCache('ambase_extensions'));
50
+
51
+ $status = '<a target="_blank"><img src="'.$this->getSkinUrl('images/ambase/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
52
+
53
+ if ($allExtensions && isset($allExtensions[$moduleCode])){
54
+ $ext = $allExtensions[$moduleCode];
55
+
56
+ $url = $ext['url'];
57
+ $name = $ext['name'];
58
+ $lastVer = $ext['version'];
59
+
60
+ $moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
61
+
62
+ if ($this->_convertVersion($currentVer) < $this->_convertVersion($lastVer)){
63
+ $status = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('images/ambase/update.gif').'" alt="'.$this->__("Update available").'" title="'.$this->__("Update available").'"/></a>';
64
+ }
65
+ }
66
+
67
+ //TODO check if module output disabled in future
68
+
69
+ $moduleName = $status . ' ' . $moduleName;
70
+
71
+ $field = $fieldset->addField($moduleCode, 'label', array(
72
+ 'name' => 'dummy',
73
+ 'label' => $moduleName,
74
+ 'value' => $currentVer,
75
+ ))->setRenderer($this->_getFieldRenderer());
76
+
77
+ return $field->toHtml();
78
+ }
79
+
80
+ protected function _convertVersion($v)
81
+ {
82
+ $digits = @explode(".", $v);
83
+ $version = 0;
84
+ if (is_array($digits)){
85
+ foreach ($digits as $k=>$v){
86
+ $version += ($v * pow(10, max(0, (3-$k))));
87
+ }
88
+
89
+ }
90
+ return $version;
91
+ }
92
+ }
app/code/local/Amasty/Base/Helper/Data.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2010 Amasty (http://www.amasty.com)
4
+ */
5
+ class Amasty_Base_Helper_Data extends Mage_Core_Helper_Abstract
6
+ {
7
+ public function isVersionLessThan($major=1, $minor=4)
8
+ {
9
+ $curr = explode('.', Mage::getVersion()); // 1.3. compatibility
10
+ $need = func_get_args();
11
+ foreach ($need as $k => $v){
12
+ if ($curr[$k] != $v)
13
+ return ($curr[$k] < $v);
14
+ }
15
+ return false;
16
+ }
17
+
18
+ public function isModuleActive($code)
19
+ {
20
+ return ('true' == (string)Mage::getConfig()->getNode('modules/'.$code.'/active'));
21
+ }
22
+
23
+ }
app/code/local/Amasty/Base/Model/Feed.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2010 Amasty (http://www.amasty.com)
4
+ */
5
+ class Amasty_Base_Model_Feed extends Mage_AdminNotification_Model_Feed
6
+ {
7
+ const XML_FREQUENCY_PATH = 'ambase/feed/check_frequency';
8
+ const XML_LAST_UPDATE_PATH = 'ambase/feed/last_update';
9
+ const XML_ITERESTS = 'ambase/feed/interests';
10
+
11
+ const URL_EXTENSIONS = 'http://amasty.com/feed-extensions.xml';
12
+ const URL_NEWS = 'http://amasty.com/feed-news.xml';
13
+
14
+
15
+ public static function check()
16
+ {
17
+ return Mage::getModel('ambase/feed')->checkUpdate();
18
+ }
19
+
20
+ public function checkUpdate()
21
+ {
22
+ if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
23
+ return $this;
24
+ }
25
+
26
+ $this->setLastUpdate();
27
+
28
+ if (!extension_loaded('curl')) {
29
+ return $this;
30
+ }
31
+
32
+ // load all new and relevant updates into inbox
33
+ $feedData = array();
34
+ $feedXml = $this->getFeedData();
35
+ $wasInstalled = gmdate('Y-m-d H:i:s', Mage::getStoreConfig('ambase/feed/installed'));
36
+
37
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
38
+ foreach ($feedXml->channel->item as $item) {
39
+ $date = $this->getDate((string)$item->pubDate);
40
+
41
+ // compare strings, but they are well-formmatted
42
+ if ($date < $wasInstalled){
43
+ continue;
44
+ }
45
+ if (!$this->isInteresting($item)){
46
+ continue;
47
+ }
48
+
49
+ $feedData[] = array(
50
+ 'severity' => 3,
51
+ 'date_added' => $this->getDate($date),
52
+ 'title' => (string)$item->title,
53
+ 'description' => (string)$item->description,
54
+ 'url' => (string)$item->link,
55
+ );
56
+ }
57
+ if ($feedData) {
58
+ Mage::getModel('adminnotification/inbox')->parse($feedData);
59
+ }
60
+ }
61
+
62
+ //load all available extensions in the cache
63
+ $this->_feedUrl = self::URL_EXTENSIONS;
64
+ $feedData = array();
65
+ $feedXml = $this->getFeedData();
66
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
67
+ foreach ($feedXml->channel->item as $item) {
68
+ $feedData[(string)$item->code] = array(
69
+ 'name' => (string)$item->title,
70
+ 'url' => (string)$item->link,
71
+ 'version' => (string)$item->version,
72
+ );
73
+ }
74
+ if ($feedData) {
75
+ Mage::app()->saveCache(serialize($feedData), 'ambase_extensions');
76
+ }
77
+ }
78
+
79
+ return $this;
80
+ }
81
+
82
+ public function getFrequency()
83
+ {
84
+ return Mage::getStoreConfig(self::XML_FREQUENCY_PATH);
85
+ }
86
+
87
+ public function getLastUpdate()
88
+ {
89
+ return Mage::app()->loadCache('ambase_notifications_lastcheck');
90
+ }
91
+
92
+ public function setLastUpdate()
93
+ {
94
+ Mage::app()->saveCache(time(), 'ambase_notifications_lastcheck');
95
+ return $this;
96
+ }
97
+
98
+ public function getFeedUrl()
99
+ {
100
+ if (is_null($this->_feedUrl)) {
101
+ $this->_feedUrl = self::URL_NEWS;
102
+ }
103
+ $query = '?s=' . urlencode(Mage::getStoreConfig('web/unsecure/base_url'));
104
+ return $this->_feedUrl . $query;
105
+ }
106
+
107
+ protected function getInterests()
108
+ {
109
+ return Mage::getStoreConfig(self::XML_ITERESTS);
110
+ }
111
+
112
+ protected function isInteresting($item)
113
+ {
114
+ $interests = @explode(',', $this->getInterests());
115
+ $types = @explode(':', (string)$item->type);
116
+ $extenion = (string)$item->extension;
117
+
118
+ $selfUpgrades = array_search(Amasty_Base_Model_Source_Updates_Type::TYPE_INSTALLED_UPDATE, $types);
119
+
120
+ foreach ($types as $type){
121
+ if (array_search($type, $interests) !== false){
122
+ return true;
123
+ }
124
+
125
+ if ($extenion && ($type == Amasty_Base_Model_Source_Updates_Type::TYPE_UPDATE_RELEASE) && $selfUpgrades){
126
+ if ($this->isExtensionInstalled($extenion)){
127
+ return true;
128
+ }
129
+ }
130
+ }
131
+
132
+ return false;
133
+ }
134
+
135
+ protected function isExtensionInstalled($code)
136
+ {
137
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
138
+ foreach ($modules as $moduleName) {
139
+ if ($moduleName == $code){
140
+ return true;
141
+ }
142
+ }
143
+
144
+ return false;
145
+ }
146
+
147
+ }
app/code/local/Amasty/Base/Model/Source/Updates/Type.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2010 Amasty (http://www.amasty.com)
4
+ */
5
+ class Amasty_Base_Model_Source_Updates_Type extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
6
+ {
7
+ const TYPE_PROMO = 'PROMO';
8
+ const TYPE_NEW_RELEASE = 'NEW_RELEASE';
9
+ const TYPE_UPDATE_RELEASE = 'UPDATE_RELEASE';
10
+ const TYPE_INFO = 'INFO';
11
+ const TYPE_INSTALLED_UPDATE = 'INSTALLED_UPDATE';
12
+
13
+
14
+ public function toOptionArray()
15
+ {
16
+ $hlp = Mage::helper('ambase');
17
+ return array(
18
+ array('value' => self::TYPE_INSTALLED_UPDATE, 'label' => $hlp->__('My extensions updates')),
19
+ array('value' => self::TYPE_UPDATE_RELEASE, 'label' => $hlp->__('All extensions updates')),
20
+ array('value' => self::TYPE_NEW_RELEASE, 'label' => $hlp->__('New Releases')),
21
+ array('value' => self::TYPE_PROMO, 'label' => $hlp->__('Promotions/Discounts')),
22
+ array('value' => self::TYPE_INFO, 'label' => $hlp->__('Other information'))
23
+ );
24
+ }
25
+
26
+ /**
27
+ * Retrive all attribute options
28
+ *
29
+ * @return array
30
+ */
31
+ public function getAllOptions()
32
+ {
33
+ return $this->toOptionArray();
34
+ }
35
+
36
+
37
+ /**
38
+ * Returns label for value
39
+ * @param string $value
40
+ * @return string
41
+ */
42
+ public function getLabel($value)
43
+ {
44
+ $options = $this->toOptionArray();
45
+ foreach($options as $v){
46
+ if($v['value'] == $value){
47
+ return $v['label'];
48
+ }
49
+ }
50
+ return '';
51
+ }
52
+
53
+ /**
54
+ * Returns array ready for use by grid
55
+ * @return array
56
+ */
57
+ public function getGridOptions()
58
+ {
59
+ $items = $this->getAllOptions();
60
+ $out = array();
61
+ foreach($items as $item){
62
+ $out[$item['value']] = $item['label'];
63
+ }
64
+ return $out;
65
+ }
66
+ }
app/code/local/Amasty/Base/etc/adminhtml.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <ambase>
15
+ <title>Amasty - Extensions Information</title>
16
+ </ambase>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ <events>
26
+ <controller_action_predispatch>
27
+ <observers>
28
+ <ambase_upds>
29
+ <type>singleton</type>
30
+ <class>ambase/feed</class>
31
+ <method>check</method>
32
+ </ambase_upds>
33
+ </observers>
34
+ </controller_action_predispatch>
35
+ </events>
36
+ </config>
app/code/local/Amasty/Base/etc/config.xml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Amasty_Base>
5
+ <version>1.0.2</version>
6
+ <platform>ee</platform>
7
+ </Amasty_Base>
8
+ </modules>
9
+
10
+ <global>
11
+ <blocks>
12
+ <ambase>
13
+ <class>Amasty_Base_Block</class>
14
+ </ambase>
15
+ </blocks>
16
+ <resources>
17
+ <ambase_setup>
18
+ <setup>
19
+ <module>Amasty_Base</module>
20
+ </setup>
21
+ <connection>
22
+ <use>core_setup</use>
23
+ </connection>
24
+ </ambase_setup>
25
+ <ambase_write>
26
+ <connection>
27
+ <use>core_write</use>
28
+ </connection>
29
+ </ambase_write>
30
+ <ambase_read>
31
+ <connection>
32
+ <use>core_read</use>
33
+ </connection>
34
+ </ambase_read>
35
+ </resources>
36
+ <models>
37
+ <ambase>
38
+ <class>Amasty_Base_Model</class>
39
+ </ambase>
40
+ </models>
41
+ <helpers>
42
+ <ambase>
43
+ <class>Amasty_Base_Helper</class>
44
+ </ambase>
45
+ </helpers>
46
+ </global>
47
+
48
+ <adminhtml>
49
+ <acl>
50
+ <resources>
51
+ <all>
52
+ <title>Allow Everything</title>
53
+ </all>
54
+ <admin>
55
+ <children>
56
+ <system>
57
+ <children>
58
+ <config>
59
+ <children>
60
+ <ambase>
61
+ <title>Amasty - Extensions Information</title>
62
+ </ambase>
63
+ </children>
64
+ </config>
65
+ </children>
66
+ </system>
67
+ </children>
68
+ </admin>
69
+ </resources>
70
+ </acl>
71
+ <events>
72
+ <controller_action_predispatch>
73
+ <observers>
74
+ <ambase_upds>
75
+ <type>singleton</type>
76
+ <class>ambase/feed</class>
77
+ <method>check</method>
78
+ </ambase_upds>
79
+ </observers>
80
+ </controller_action_predispatch>
81
+ </events>
82
+ </adminhtml>
83
+ <default>
84
+ <ambase>
85
+ <feed>
86
+ <check_frequency>86400</check_frequency>
87
+ <interests>INFO,PROMO,UPDATE_RELEASE,NEW_RELEASE,INSTALLED_UPDATE</interests>
88
+ </feed>
89
+ </ambase>
90
+ </default>
91
+ </config>
app/code/local/Amasty/Base/etc/system.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <amasty translate="label" module="ambase">
5
+ <label>Amasty Extensions</label>
6
+ <sort_order>400</sort_order>
7
+ </amasty>
8
+ </tabs>
9
+ <sections>
10
+ <ambase translate="label" module="ambase">
11
+ <label>General</label>
12
+ <tab>amasty</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>777</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <extensions translate="label">
20
+ <label>Installed Extensions</label>
21
+ <frontend_type>text</frontend_type>
22
+ <frontend_model>ambase/extensions</frontend_model>
23
+ <sort_order>2</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ </extensions>
28
+ <feed>
29
+ <label>Notifications</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>90</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <fields>
36
+ <interests translate="label">
37
+ <label>I'd like to be informed by Amasty about:</label>
38
+ <comment></comment>
39
+ <frontend_type>multiselect</frontend_type>
40
+ <sort_order>100</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <can_be_empty>1</can_be_empty>
45
+ <source_model>ambase/source_updates_type</source_model>
46
+ </interests>
47
+ </fields>
48
+ </feed>
49
+ </groups>
50
+ </ambase>
51
+ </sections>
52
+ </config>
app/code/local/Amasty/Base/sql/ambase_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+ $this->endSetup();
app/code/local/Amasty/Base/sql/ambase_setup/mysql4-upgrade-1.0.0-1.0.1.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+
4
+ Mage::getModel('core/config_data')
5
+ ->setScope('default')
6
+ ->setPath('ambase/feed/installed')
7
+ ->setValue(time())
8
+ ->save();
9
+
10
+ $feedData = array();
11
+ $feedData[] = array(
12
+ 'severity' => 4,
13
+ 'date_added' => gmdate('Y-m-d H:i:s', time()),
14
+ 'title' => 'Amasty`s extension has been installed. Important: Log off and then log in back to see the Admin > Configuration > Amasty section.',
15
+ 'description' => 'You can see versions of the installed extensions right in the admin, as well as configure notifications about major updates.',
16
+ 'url' => 'http://amasty.com/news/updates-and-notifications-configuration-9.html'
17
+ );
18
+
19
+ Mage::getModel('adminnotification/inbox')->parse($feedData);
20
+
21
+ $this->endSetup();
app/design/frontend/default/default/layout/amfbreview.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <catalog_product_view>
3
+ <reference name="head">
4
+ <block type="core/template" name="amfbreview.head" template="amfbreview/head.phtml" />
5
+ </reference>
6
+ <reference name="product.info">
7
+ <block type="core/template" name="amfbreview.list" template="amfbreview/list.phtml">
8
+ <action method="addToParentGroup">
9
+ <group>detailed_info</group>
10
+ </action>
11
+ <action method="setTitle">
12
+ <title>Facebook Reviews</title>
13
+ </action>
14
+ </block>
15
+ </reference>
16
+ </catalog_product_view>
17
+ </layout>
app/design/frontend/default/default/template/amfbreview/head.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php if ($p = Mage::registry('product')): ?>
2
+ <meta property="og:title" content="<?php echo $this->htmlEscape($p->getName()); ?>" />
3
+ <meta property="og:description" content="<?php echo $this->htmlEscape($p->getShortDescription()); ?>" />
4
+ <meta property="og:image" content="<?php echo Mage::helper('catalog/image')->init($p, 'small_image')->resize(150); ?>" />
5
+ <meta property="fb:app_id" content="<?php echo Mage::getStoreConfig('amfbreview/general/appid'); ?>" />
6
+ <?php endif ?>
app/design/frontend/default/default/template/amfbreview/list.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="fb-root"></div>
2
+ <script src="http://connect.facebook.net/<?php echo Mage::app()->getLocale()->getLocale()?>/all.js#xfbml=1"></script>
3
+ <fb:comments
4
+ href="<?php echo Mage::helper('core/url')->getCurrentUrl()?>"
5
+
6
+ <?php if ($title = Mage::getStoreConfig('amfbreview/general/title')) :?>
7
+ title="<?php echo $this->htmlEscape($title)?>"
8
+ reverse="<?php echo Mage::getStoreConfig('amfbreview/general/ascending') ? 'true' : 'false' ?>"
9
+ numposts="<?php echo Mage::getStoreConfig('amfbreview/general/perpage')?>"
10
+ <?php endif ?>
11
+
12
+ width="<?php echo Mage::getStoreConfig('amfbreview/display/width')?>"
13
+ simple="<?php echo Mage::getStoreConfig('amfbreview/display/nostyles') ? 'true' : 'false' ?>"
14
+ <?php if ($css = Mage::getStoreConfig('amfbreview/display/css')) :?>
15
+ css="<?php echo Mage::getBaseURL() . $css ?>"
16
+ <?php endif ?>
17
+
18
+ publish_feed="false"
19
+ >
20
+ </fb:comments>
21
+ <script>
22
+ FB.init({appId : <?php echo $this->getConfigData('appid') ?>, cookie : true, xfbml : true, status : true});
23
+ </script>
app/etc/modules/Amasty_Base.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Amasty_Base>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Amasty_Base>
8
+ </modules>
9
+ </config>
app/etc/modules/Amasty_Fbreview.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Amasty_Fbreview>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Amasty_Fbreview>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Amasty_Fbreview</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>AFL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Get user-generated content on your Facebook pages. Gain more credibility and attract more customers. Amasty</summary>
10
+ <description>This extension is another one in our line of social media related modules. While the purpose of Facebook</description>
11
+ <notes>Initial release</notes>
12
+ <authors><author><name>Amasty</name><user>auto-converted</user><email>support@amasty.com</email></author></authors>
13
+ <date>2012-03-29</date>
14
+ <time>19:31:37</time>
15
+ <contents><target name="magecommunity"><dir name="Amasty"><dir name="Fbreview"><dir name="Helper"><file name="Data.php" hash="7d77f32f9926d056cdd3aeaff1d855c4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="79ad11528d4a38e3f61d0387c6970a0e"/><file name="config.xml" hash="37ae213867eb917819e3756636ae3827"/><file name="system.xml" hash="b7d9c4dbb0a5e2654e937934bf874e7e"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="amfbreview.xml" hash="afb34a01cc7f973373232a1eb3b1ea80"/></dir><dir name="template"><dir name="amfbreview"><file name="head.phtml" hash="a4980071ea3c2ba06014e06956473f92"/><file name="list.phtml" hash="f6bc488b992055b717ce64eef5579766"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Amasty_Fbreview.xml" hash="023682e8c2a9335fde0b4e2a06c78df0"/><file name="Amasty_Base.xml" hash="651f99cee7568ab645fdef118f7933ca"/></dir></target><target name="magelocal"><dir name="Amasty"><dir name="Base"><dir name="Block"><file name="Extensions.php" hash="e0f76a6c0e9d3db6f634562cbb0266bc"/></dir><dir name="Helper"><file name="Data.php" hash="b36b76d52650c0f2982a0403d04407bd"/></dir><dir name="Model"><dir name="Source"><dir name="Updates"><file name="Type.php" hash="dbb958c4aa01c61578cfb22a1c88a482"/></dir></dir><file name="Feed.php" hash="86fb0e24d6b1c9706caf69c908e710ad"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2134fcecc3d5cb639a2446dded0032d5"/><file name="config.xml" hash="85fb35cf777412bc6d8cbe993e1d846f"/><file name="system.xml" hash="d7e5cda7d0b09152931039fdf1d4b2bc"/></dir><dir name="sql"><dir name="ambase_setup"><file name="mysql4-install-1.0.0.php" hash="ba30c778afd0f4a959ec9f86d439ea0a"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="26476d7e59961bfe0fc5748c589a010c"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="ambase"><file name="bad.gif" hash="b8379f1ba7ab552ca46b9d5fd0452345"/><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/adminhtml/default/default/images/ambase/bad.gif ADDED
Binary file
skin/adminhtml/default/default/images/ambase/ok.gif ADDED
Binary file
skin/adminhtml/default/default/images/ambase/update.gif ADDED
Binary file