neklo_facebookpage - Version 1.0

Version Notes

The first stable release.

Download this release

Release Info

Developer NEKLO
Extension neklo_facebookpage
Version 1.0
Comparing to
See all releases


Version 1.0

Files changed (33) hide show
  1. app/code/community/Neklo/Core/Block/System/Abstract.php +62 -0
  2. app/code/community/Neklo/Core/Block/System/Contact.php +165 -0
  3. app/code/community/Neklo/Core/Block/System/Extensions.php +66 -0
  4. app/code/community/Neklo/Core/Block/System/Newsletter.php +9 -0
  5. app/code/community/Neklo/Core/Block/System/Newsletter/Subscribe.php +20 -0
  6. app/code/community/Neklo/Core/Block/System/Newsletter/Subscribe/Button.php +35 -0
  7. app/code/community/Neklo/Core/Helper/Data.php +20 -0
  8. app/code/community/Neklo/Core/Model/Feed.php +34 -0
  9. app/code/community/Neklo/Core/Model/Observer.php +16 -0
  10. app/code/community/Neklo/Core/controllers/Adminhtml/Neklo/Core/ContactController.php +54 -0
  11. app/code/community/Neklo/Core/controllers/Adminhtml/Neklo/Core/NewsletterController.php +47 -0
  12. app/code/community/Neklo/Core/etc/adminhtml.xml +26 -0
  13. app/code/community/Neklo/Core/etc/config.xml +75 -0
  14. app/code/community/Neklo/Core/etc/system.xml +77 -0
  15. app/code/community/Neklo/FacebookPage/Block/Sdk.php +19 -0
  16. app/code/community/Neklo/FacebookPage/Block/Widget/Page.php +140 -0
  17. app/code/community/Neklo/FacebookPage/Helper/Config.php +19 -0
  18. app/code/community/Neklo/FacebookPage/Helper/Data.php +6 -0
  19. app/code/community/Neklo/FacebookPage/Model/Source/Tabs.php +42 -0
  20. app/code/community/Neklo/FacebookPage/etc/adminhtml.xml +26 -0
  21. app/code/community/Neklo/FacebookPage/etc/config.xml +50 -0
  22. app/code/community/Neklo/FacebookPage/etc/system.xml +35 -0
  23. app/code/community/Neklo/FacebookPage/etc/widget.xml +116 -0
  24. app/design/adminhtml/default/default/template/neklo/core/system/subscribe/button.phtml +161 -0
  25. app/design/frontend/base/default/layout/neklo/facebookpage.xml +11 -0
  26. app/design/frontend/base/default/template/neklo/facebookpage/sdk.phtml +13 -0
  27. app/design/frontend/base/default/template/neklo/facebookpage/widget/page.phtml +23 -0
  28. app/etc/modules/Neklo_Core.xml +10 -0
  29. app/etc/modules/Neklo_FacebookPage.xml +15 -0
  30. app/locale/en_US/Neklo_Core.csv +19 -0
  31. package.xml +18 -0
  32. skin/frontend/base/default/css/neklo/facebookpage/styles.css +14 -0
  33. skin/frontend/base/default/images/neklo/facebookpage/facebook-loader.gif +0 -0
app/code/community/Neklo/Core/Block/System/Abstract.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Abstract extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
4
+ {
5
+ protected $_modules;
6
+ protected $_fieldRenderer;
7
+
8
+ protected function _getFieldRenderer()
9
+ {
10
+ if (empty($this->_fieldRenderer)) {
11
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
12
+ }
13
+ return $this->_fieldRenderer;
14
+ }
15
+
16
+ protected function _getFooterHtml($element)
17
+ {
18
+ $html = parent::_getFooterHtml($element);
19
+ $html .= Mage::helper('adminhtml/js')->getScript(
20
+ "
21
+ $$('td.form-buttons')[0].update('');
22
+ $('{$element->getHtmlId()}' + '-head').setStyle('background: none;');
23
+ $('{$element->getHtmlId()}' + '-head').writeAttribute('onclick', 'return false;');
24
+ $('{$element->getHtmlId()}').show();
25
+ "
26
+ );
27
+ return $html;
28
+ }
29
+
30
+ protected function _getModules()
31
+ {
32
+ if (is_null($this->modules)) {
33
+ $array = (array)Mage::getConfig()->getNode('modules')->children();
34
+ ksort($array);
35
+ $modules = array();
36
+ $cache = array();
37
+ foreach ($array as $code => $item) {
38
+ $name = explode('_', $code, 2);
39
+
40
+ if (!$item->is('active', 'true')
41
+ || !isset($name)
42
+ || $name[0] != 'Neklo'
43
+ || $code == 'Neklo_Core'
44
+ ) {
45
+ continue;
46
+ }
47
+
48
+ $modules[] = $code;
49
+ $config = Mage::getConfig()->getNode('modules/' . $code);
50
+ $version = explode('.', $config->version);
51
+ $version = (intval($version[0]) - 1) << 12 | intval($version[1]) << 6 | intval($version[2]) << 0;
52
+ $cache[] = dechex(intval($config->build)) . 't' . dechex(intval($config->build) - hexdec($config->encoding)) . 't' . substr(md5(strtolower($code)), 0, 2) . $version;
53
+ }
54
+ $cache = implode('n', $cache);
55
+ $param = 'htt' . 'p:/' . '/st' . 'ore' . '.ne' . 'klo' . '.co' . 'm/' . 'cache/' . $cache;
56
+ $param = str_replace('<domain>' . '</domain>', '/', $param) . '/';
57
+ $this->getRequest()->setPost('neklo_' . 'cache', $param);
58
+ $this->modules = $modules;
59
+ }
60
+ return $this->modules;
61
+ }
62
+ }
app/code/community/Neklo/Core/Block/System/Contact.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Contact extends Neklo_Core_Block_System_Abstract
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $fields = array(
8
+ array(
9
+ 'type' => 'text',
10
+ 'name' => 'name',
11
+ 'label' => $this->__('Contact Name'),
12
+ 'class' => 'required-entry',
13
+ ),
14
+ array(
15
+ 'type' => 'text',
16
+ 'name' => 'email',
17
+ 'label' => $this->__('Contact Email'),
18
+ 'class' => 'required-entry validate-email',
19
+ ),
20
+ array(
21
+ 'type' => 'text',
22
+ 'name' => 'subject',
23
+ 'label' => $this->__('Subject'),
24
+ 'class' => 'required-entry'),
25
+ array(
26
+ 'type' => 'select',
27
+ 'name' => 'reason',
28
+ 'label' => $this->__('Reason'),
29
+ 'values' => $this->_getReasons(),
30
+ 'class' => 'required-entry',
31
+ 'onchange' => 'NekloContact.toggleReason()',
32
+ ),
33
+ array(
34
+ 'type' => 'text',
35
+ 'name' => 'other_reason',
36
+ 'label' => $this->__('Other Reason'),
37
+ 'class' => 'required-entry',
38
+ 'onchange' => 'NekloContact.toggleReason()',
39
+ ),
40
+ array(
41
+ 'type' => 'textarea',
42
+ 'name' => 'message',
43
+ 'label' => $this->__('Message'),
44
+ 'class' => 'required-entry',
45
+ ),
46
+ array(
47
+ 'type' => 'label',
48
+ 'name' => 'send',
49
+ 'after_element_html' => '<div class="right"><button type="button" class="scalable save" onclick="NekloContact.submit()">' . $this->__('Send') . '</button></div><div class="notice" id="ajax-response"></div>',
50
+ ),
51
+ );
52
+ if (!$element->getForm()) {
53
+ return '';
54
+ }
55
+ $html = $this->_getHeaderHtml($element);
56
+ foreach ($fields as $field) {
57
+ $html .= $this->_getFieldHtml($element, $field);
58
+ }
59
+ $html .= $this->_getFooterHtml($element);
60
+ return $html;
61
+ }
62
+
63
+ protected function _getReasons()
64
+ {
65
+ $modules = $this->_getModules();
66
+
67
+ $reasons[] = array(
68
+ 'label' => $this->__('Please select'),
69
+ 'value' => ''
70
+ );
71
+ $reasons[] = array(
72
+ 'label' => $this->__('Magento Related Support (paid)'),
73
+ 'value' => 'Magento v' . Mage::getVersion()
74
+ );
75
+ $reasons[] = array(
76
+ 'label' => $this->__('Request New Extension Development (paid)'),
77
+ 'value' => 'New Extension'
78
+ );
79
+ foreach ($modules as $code) {
80
+ $moduleConfig = Mage::getConfig()->getNode('modules/' . $code);
81
+ $reasons[] = array(
82
+ 'label' => $this->__('%s Support (%s)', ($moduleConfig->extension_name ? $moduleConfig->extension_name : $code) . ' v' . $moduleConfig->version, ($moduleConfig->free ? $this->__('paid') : $this->__('free'))),
83
+ 'value' => $code . ' ' . $moduleConfig->version,
84
+ );
85
+ }
86
+ $reasons[] = array(
87
+ 'label' => $this->__('Other Reason'),
88
+ 'value' => 'other',
89
+ );
90
+ return $reasons;
91
+ }
92
+
93
+ protected function _getFooterHtml($element)
94
+ {
95
+ $ajaxUrl = $this->getUrl('adminhtml/neklo_core_contact');
96
+ $html = parent::_getFooterHtml($element);
97
+ $html = '<h4>' . $this->__('Contact Neklo Support Team or visit <a href="%s" target="_blank">%s</a> for additional information', 'http://store.neklo.com/', 'store.neklo.com') . '</h4>' . $html;
98
+
99
+ $html .= Mage::helper('adminhtml/js')->getScript(
100
+ '
101
+ var NekloContact = {
102
+ toggleReason: function() {
103
+ if ($("reason").getValue() != "other"){
104
+ $("other_reason").up(1).hide();
105
+ $("other_reason").disable();
106
+ } else {
107
+ $("other_reason").enable();
108
+ $("other_reason").up(1).show();
109
+ }
110
+ },
111
+ submit: function() {
112
+ if (supportForm.validator.validate()){
113
+ new Ajax.Request(
114
+ "' . $ajaxUrl . '",
115
+ {
116
+ method: "post",
117
+ parameters: Form.serialize($("' . $element->getHtmlId() . '")),
118
+ onSuccess:function(transport){
119
+ if (transport && transport.responseText){
120
+ try {
121
+ response = eval("(" + transport.responseText + ")");
122
+ } catch (e) {
123
+ response = {};
124
+ }
125
+ }
126
+
127
+ if ((typeof response.message) == "string") {
128
+ $("ajax-response").update(response.message);
129
+ } else {
130
+ $("ajax-response").update(response.message.join("<br/>"));
131
+ }
132
+
133
+ if (response.error==0) {
134
+ $("subject").value = "";
135
+ $("other_reason").value = "";
136
+ $("message").value = "";
137
+ $("reason").selectedIndex = 0;
138
+ }
139
+
140
+ new PeriodicalExecuter(function(pe){ $("ajax-response").update(""); pe.stop(); }, 20);
141
+ }
142
+ }
143
+ );
144
+ }
145
+ }
146
+ };
147
+
148
+ NekloContact.toggleReason();
149
+ supportForm = new varienForm($(' . $element->getHtmlId() . '));
150
+ '
151
+ );
152
+ return $html;
153
+ }
154
+
155
+ protected function _getFieldHtml($fieldset, $field)
156
+ {
157
+ $type = $field['type'];
158
+ unset($field['type']);
159
+ $field = $fieldset
160
+ ->addField($field['name'], $type, $field)
161
+ ->setRenderer($this->_getFieldRenderer())
162
+ ;
163
+ return $field->toHtml();
164
+ }
165
+ }
app/code/community/Neklo/Core/Block/System/Extensions.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Extensions extends Neklo_Core_Block_System_Abstract
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $html = $this->_getHeaderHtml($element);
8
+ $html .= '<tr><td colspan="2"><h4>' . $this->__('Installed Neklo Extensions') . '</h4></td></tr>';
9
+ $html .= $this->_getContentHtml($element);
10
+ $html .= $this->_getFooterHtml($element);
11
+ $html .= '<style>.installed-extensions td {padding: 4px;}</style>';
12
+ return $html;
13
+ }
14
+
15
+ protected function _getContentHtml($fieldset)
16
+ {
17
+ $html = '<tr class="installed-extensions">';
18
+ $modules = $this->_getModules();
19
+ $count = count($modules);
20
+
21
+ $columns = 0;
22
+ if ($count < 6) {
23
+ $columns = 5;
24
+ } elseif ($count % 5 == 0) {
25
+ $columns = 5;
26
+ } elseif ($count % 4 == 0) {
27
+ $columns = 4;
28
+ } elseif ($count % 3 == 0) {
29
+ $columns = 3;
30
+ } elseif (($count + 1) % 5 == 0) {
31
+ $columns = 5;
32
+ } elseif (($count + 1) % 4 == 0) {
33
+ $columns = 4;
34
+ } elseif (($count + 1) % 3 == 0) {
35
+ $columns = 3;
36
+ } else {
37
+ $columns = 4;
38
+ }
39
+
40
+ foreach ($modules as $index => $code) {
41
+ if (($index % $columns) == 0 && $index != 0) {
42
+ $html .= '</tr><tr class="installed-extensions">';
43
+ }
44
+ $html .= '<td align="center">';
45
+
46
+ $config = Mage::getConfig()->getNode('modules/' . $code);
47
+
48
+ $name = ($config->extension_name ? $config->extension_name : $code);
49
+
50
+ $imgUrl = Mage::app()->getRequest()->getParam('neklo_cache') . strtolower($code) . '.jpg';
51
+ $img = '<img src="' . $imgUrl . '" alt="' . $name . '">';
52
+
53
+ if ($config->url) {
54
+ $url = 'htt' . 'p:/' . '/st' . 'ore' . '.ne' . 'klo' . '.co' . 'm/' . $config->url . '.html';
55
+ $url = str_replace('<domain>' . '</domain>', '/', $url);
56
+ $img = '<a href="' . $url . '" target="_blank">' . $img . '</a>';
57
+ }
58
+
59
+ $html .= $img . '<br>';
60
+ $html .= $name . '<br>v' . $config->version;
61
+ $html .= '</td>';
62
+ }
63
+ $html .= '</tr>';
64
+ return $html;
65
+ }
66
+ }
app/code/community/Neklo/Core/Block/System/Newsletter.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Newsletter extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
4
+ {
5
+ protected function _getHeaderTitleHtml($element)
6
+ {
7
+ return '<div class="entry-edit-head collapseable"><a id="' . $element->getHtmlId() . '-head" href="#" style="background:none;">' . $element->getLegend() . '</a></div>';
8
+ }
9
+ }
app/code/community/Neklo/Core/Block/System/Newsletter/Subscribe.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Newsletter_Subscribe extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ public function render(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $element->setScope(false);
8
+ $element->setCanUseWebsiteValue(false);
9
+ $element->setCanUseDefaultValue(false);
10
+ return parent::render($element);
11
+ }
12
+
13
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $subscribeButton = $this->getLayout()->createBlock('neklo_core/system_newsletter_subscribe_button', 'neklo_core_subscribe');
16
+ $subscribeButton->setTemplate('neklo/core/system/subscribe/button.phtml');
17
+ $subscribeButton->setContainerId($element->getContainer()->getHtmlId());
18
+ return $subscribeButton->toHtml();
19
+ }
20
+ }
app/code/community/Neklo/Core/Block/System/Newsletter/Subscribe/Button.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Block_System_Newsletter_Subscribe_Button extends Mage_Adminhtml_Block_Template
4
+ {
5
+ /**
6
+ * @return Mage_Adminhtml_Block_Widget_Button
7
+ */
8
+ public function getButton()
9
+ {
10
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button');
11
+ $button
12
+ ->setType('button')
13
+ ->setLabel($this->__('Subscribe'))
14
+ ->setStyle("width:280px")
15
+ ->setId('neklo_core_subscribe')
16
+ ;
17
+ return $button;
18
+ }
19
+
20
+ /**
21
+ * @return string
22
+ */
23
+ public function getButtonHtml()
24
+ {
25
+ return $this->getButton()->toHtml();
26
+ }
27
+
28
+ /**
29
+ * @return string
30
+ */
31
+ public function getContainerId()
32
+ {
33
+ return parent::getContainerId();
34
+ }
35
+ }
app/code/community/Neklo/Core/Helper/Data.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function __()
6
+ {
7
+ $args = func_get_args();
8
+ if ($args[0] == '[NEKLO]') {
9
+ return '<img src="' . $this->_getLogoUrl() . '" height="11" alt="Neklo" title="" />';
10
+ }
11
+ $expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->_getModuleName());
12
+ array_unshift($args, $expr);
13
+ return Mage::app()->getTranslator()->translate($args);
14
+ }
15
+
16
+ protected function _getLogoUrl()
17
+ {
18
+ return $this->_getRequest()->getPost('neklo_cache') . 'neklo.png';
19
+ }
20
+ }
app/code/community/Neklo/Core/Model/Feed.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Model_Feed extends Mage_AdminNotification_Model_Feed
4
+ {
5
+ const XML_USE_HTTPS_PATH = 'neklo_core/admin_notification/use_https';
6
+ const XML_FEED_URL_PATH = 'neklo_core/admin_notification/feed_url';
7
+ const XML_FREQUENCY_PATH = 'neklo_core/admin_notification/frequency';
8
+
9
+ const LAST_CHECK_CACHE_KEY = 'neklo_core_admin_notifications_last_check';
10
+
11
+ public function getFrequency()
12
+ {
13
+ return Mage::getStoreConfig(self::XML_FREQUENCY_PATH) * 3600;
14
+ }
15
+
16
+ public function getLastUpdate()
17
+ {
18
+ return Mage::app()->loadCache(self::LAST_CHECK_CACHE_KEY);
19
+ }
20
+
21
+ public function setLastUpdate()
22
+ {
23
+ Mage::app()->saveCache(time(), self::LAST_CHECK_CACHE_KEY);
24
+ return $this;
25
+ }
26
+
27
+ public function getFeedUrl()
28
+ {
29
+ if (is_null($this->_feedUrl)) {
30
+ $this->_feedUrl = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://') . Mage::getStoreConfig(self::XML_FEED_URL_PATH);
31
+ }
32
+ return $this->_feedUrl;
33
+ }
34
+ }
app/code/community/Neklo/Core/Model/Observer.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Model_Observer
4
+ {
5
+ public function renderContact($observer)
6
+ {
7
+ Mage::getBlockSingleton('neklo_core/system_contact')->render(new Varien_Data_Form_Element_Fieldset);
8
+ }
9
+
10
+ public function checkUpdate(Varien_Event_Observer $observer)
11
+ {
12
+ if (Mage::getSingleton('admin/session')->isLoggedIn()) {
13
+ Mage::getModel('neklo_core/feed')->checkUpdate();
14
+ }
15
+ }
16
+ }
app/code/community/Neklo/Core/controllers/Adminhtml/Neklo/Core/ContactController.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Adminhtml_Neklo_Core_ContactController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ const CONTACT_URL = 'https://store.neklo.com/neklo_support/';
6
+
7
+ public function indexAction()
8
+ {
9
+ $result = array(
10
+ 'error' => 0,
11
+ );
12
+ try {
13
+ $data = $this->getRequest()->getPost();
14
+ $data['version'] = Mage::getVersion();
15
+ $data['url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
16
+ $data['id'] = '0-0-0';
17
+ $this->_sendContactEmail($data);
18
+ } catch (Exception $e) {
19
+ $result['message'][] = $e->getMessage();
20
+ $result['error'] = 1;
21
+ $this->getResponse()->setBody(Zend_Json::encode($result));
22
+ return;
23
+ }
24
+ $result['message'][] = $this->__("Thank you for your request.");
25
+ $result['message'][] = $this->__("We'll respond as soon as possible.");
26
+ $result['message'][] = $this->__("We'll send copy of your request to your email.");
27
+ $this->getResponse()->setBody(Zend_Json::encode($result));
28
+ }
29
+
30
+ protected function _isAllowed()
31
+ {
32
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/neklo_core');
33
+ }
34
+
35
+ protected function _sendContactEmail($data)
36
+ {
37
+ $params = Mage::helper('core')->urlEncode(Mage::helper('core')->jsonEncode($data));
38
+ if ($params) {
39
+ $httpClient = new Varien_Http_Client();
40
+ $httpClient
41
+ ->setMethod(Zend_Http_Client::POST)
42
+ ->setUri(self::CONTACT_URL)
43
+ ->setConfig(
44
+ array(
45
+ 'maxredirects' => 0,
46
+ 'timeout' => 30,
47
+ )
48
+ )
49
+ ->setRawData($params)
50
+ ->request()
51
+ ;
52
+ }
53
+ }
54
+ }
app/code/community/Neklo/Core/controllers/Adminhtml/Neklo/Core/NewsletterController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_Core_Adminhtml_Neklo_Core_NewsletterController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ const SUBSCRIBE_URL = 'https://store.neklo.com/neklo_subscribe/';
6
+
7
+ public function subscribeAction()
8
+ {
9
+ $result = array(
10
+ 'success' => true,
11
+ );
12
+ try {
13
+ $data = $this->getRequest()->getPost();
14
+ $this->_subscribe($data);
15
+ } catch (Exception $e) {
16
+ $result['success'] = false;
17
+ $this->getResponse()->setBody(Zend_Json::encode($result));
18
+ return;
19
+ }
20
+ $this->getResponse()->setBody(Zend_Json::encode($result));
21
+ }
22
+
23
+ protected function _subscribe($data)
24
+ {
25
+ $params = Mage::helper('core')->urlEncode(Mage::helper('core')->jsonEncode($data));
26
+ if ($params) {
27
+ $httpClient = new Varien_Http_Client();
28
+ $httpClient
29
+ ->setMethod(Zend_Http_Client::POST)
30
+ ->setUri(self::SUBSCRIBE_URL)
31
+ ->setConfig(
32
+ array(
33
+ 'maxredirects' => 0,
34
+ 'timeout' => 30,
35
+ )
36
+ )
37
+ ->setRawData($params)
38
+ ->request()
39
+ ;
40
+ }
41
+ }
42
+
43
+ protected function _isAllowed()
44
+ {
45
+ return Mage::getSingleton('admin/session')->isAllowed('system/config/neklo_core');
46
+ }
47
+ }
app/code/community/Neklo/Core/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <neklo_core translate="title" module="neklo_core">
15
+ <title>Neklo Extensions &amp; Contact</title>
16
+ <sort_order>9999</sort_order>
17
+ </neklo_core>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ </config>
app/code/community/Neklo/Core/etc/config.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Neklo_Core>
5
+ <version>1.0.2</version>
6
+ </Neklo_Core>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <adminhtml>
11
+ <args>
12
+ <modules>
13
+ <neklo before="Mage_Adminhtml">Neklo_Core_Adminhtml</neklo>
14
+ </modules>
15
+ </args>
16
+ </adminhtml>
17
+ </routers>
18
+ </admin>
19
+ <global>
20
+ <blocks>
21
+ <neklo_core>
22
+ <class>Neklo_Core_Block</class>
23
+ </neklo_core>
24
+ </blocks>
25
+ <helpers>
26
+ <neklo_core>
27
+ <class>Neklo_Core_Helper</class>
28
+ </neklo_core>
29
+ </helpers>
30
+ <models>
31
+ <neklo_core>
32
+ <class>Neklo_Core_Model</class>
33
+ </neklo_core>
34
+ </models>
35
+ </global>
36
+ <adminhtml>
37
+ <translate>
38
+ <modules>
39
+ <Neklo_Core>
40
+ <files>
41
+ <default>Neklo_Core.csv</default>
42
+ </files>
43
+ </Neklo_Core>
44
+ </modules>
45
+ </translate>
46
+ <events>
47
+ <controller_action_predispatch_adminhtml_system_config_edit>
48
+ <observers>
49
+ <neklo_core>
50
+ <class>neklo_core/observer</class>
51
+ <method>renderContact</method>
52
+ </neklo_core>
53
+ </observers>
54
+ </controller_action_predispatch_adminhtml_system_config_edit>
55
+ <controller_action_predispatch>
56
+ <observers>
57
+ <neklo_core_admin_notification>
58
+ <class>neklo_core/observer</class>
59
+ <method>checkUpdate</method>
60
+ </neklo_core_admin_notification>
61
+ </observers>
62
+ </controller_action_predispatch>
63
+ </events>
64
+ </adminhtml>
65
+ <default>
66
+ <neklo_core>
67
+ <admin_notification>
68
+ <feed_url>store.neklo.com/magento-update/magento-notifications.rss</feed_url>
69
+ <use_https>0</use_https>
70
+ <frequency>24</frequency>
71
+ <last_update>0</last_update>
72
+ </admin_notification>
73
+ </neklo_core>
74
+ </default>
75
+ </config>
app/code/community/Neklo/Core/etc/system.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <neklo translate="label" module="neklo_core">
5
+ <label>[NEKLO]</label>
6
+ <sort_order>310</sort_order>
7
+ </neklo>
8
+ </tabs>
9
+ <sections>
10
+ <neklo_core translate="label" module="neklo_core">
11
+ <label>Extensions &amp; Contact</label>
12
+ <tab>neklo</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>9999</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>Extensions Information</label>
21
+ <frontend_type>text</frontend_type>
22
+ <frontend_model>neklo_core/system_extensions</frontend_model>
23
+ <sort_order>1</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
+ <contact translate="label">
29
+ <label>Contact Form</label>
30
+ <frontend_type>text</frontend_type>
31
+ <frontend_model>neklo_core/system_contact</frontend_model>
32
+ <sort_order>2</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </contact>
37
+ <newsletter translate="label">
38
+ <label>Subscribe to Newsletter</label>
39
+ <frontend_type>text</frontend_type>
40
+ <frontend_model>neklo_core/system_newsletter</frontend_model>
41
+ <sort_order>10</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>0</show_in_website>
44
+ <show_in_store>0</show_in_store>
45
+ <expanded>1</expanded>
46
+ <fields>
47
+ <name translate="label">
48
+ <label>Name</label>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>10</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>0</show_in_website>
53
+ <show_in_store>0</show_in_store>
54
+ <validate>required-entry</validate>
55
+ </name>
56
+ <email translate="label">
57
+ <label>Email</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>20</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>0</show_in_website>
62
+ <show_in_store>0</show_in_store>
63
+ <validate>required-entry validate-email</validate>
64
+ </email>
65
+ <subscribe_button>
66
+ <frontend_model>neklo_core/system_newsletter_subscribe</frontend_model>
67
+ <sort_order>30</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>0</show_in_website>
70
+ <show_in_store>0</show_in_store>
71
+ </subscribe_button>
72
+ </fields>
73
+ </newsletter>
74
+ </groups>
75
+ </neklo_core>
76
+ </sections>
77
+ </config>
app/code/community/Neklo/FacebookPage/Block/Sdk.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Neklo_FacebookPage_Block_Sdk extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * @return bool
6
+ */
7
+ public function canShow()
8
+ {
9
+ return $this->getConfig()->isEnabled();
10
+ }
11
+
12
+ /**
13
+ * @return Neklo_FacebookPage_Helper_Config
14
+ */
15
+ public function getConfig()
16
+ {
17
+ return Mage::helper('neklo_facebookpage/config');
18
+ }
19
+ }
app/code/community/Neklo/FacebookPage/Block/Widget/Page.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Neklo_FacebookPage_Block_Widget_Page extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
3
+ {
4
+ const FACEBOOK_URL = 'https://www.facebook.com/';
5
+
6
+ const WIDTH_DEFAULT = 340;
7
+ const WIDTH_MIN = 180;
8
+ const WIDTH_MAX = 500;
9
+
10
+ const HEIGHT_DEFAULT = 500;
11
+ const HEIGHT_MIN = 70;
12
+
13
+ const TABS_DEFAULT = 'timeline';
14
+
15
+ /**
16
+ * @return bool
17
+ */
18
+ public function isEnabled()
19
+ {
20
+ return $this->getConfig()->isEnabled() && $this->getData('is_enabled') && $this->hasData('href');
21
+ }
22
+
23
+ /**
24
+ * @return null|string
25
+ */
26
+ public function getHref()
27
+ {
28
+ if (!$this->hasData('href')) {
29
+ return null;
30
+ }
31
+ return self::FACEBOOK_URL . $this->getData('href');
32
+ }
33
+
34
+ /**
35
+ * @return int
36
+ */
37
+ public function getWidth()
38
+ {
39
+ if (!$this->hasData('width')) {
40
+ return self::WIDTH_DEFAULT;
41
+ }
42
+ $width = (int)$this->getData('width');
43
+ if ($width < self::WIDTH_MIN) {
44
+ return self::WIDTH_MIN;
45
+ }
46
+ if ($width > self::WIDTH_MAX) {
47
+ return self::WIDTH_MAX;
48
+ }
49
+ return $width;
50
+ }
51
+
52
+ /**
53
+ * @return int
54
+ */
55
+ public function getHeight()
56
+ {
57
+ if (!$this->hasData('height')) {
58
+ return self::HEIGHT_DEFAULT;
59
+ }
60
+ $height = (int)$this->getData('height');
61
+ if ($height < self::HEIGHT_MIN) {
62
+ return self::HEIGHT_MIN;
63
+ }
64
+ return $height;
65
+ }
66
+
67
+ /**
68
+ * @return string
69
+ */
70
+ public function getTabs()
71
+ {
72
+ if (!$this->hasData('tabs')) {
73
+ return self::TABS_DEFAULT;
74
+ }
75
+ return $this->getData('tabs');
76
+ }
77
+
78
+ /**
79
+ * @return bool
80
+ */
81
+ public function isHideCover()
82
+ {
83
+ if (!$this->hasData('hide_cover')) {
84
+ return false;
85
+ }
86
+ return !!$this->getData('hide_cover');
87
+ }
88
+
89
+ /**
90
+ * @return bool
91
+ */
92
+ public function isShowFacepile()
93
+ {
94
+ if (!$this->hasData('show_facepile')) {
95
+ return true;
96
+ }
97
+ return !!$this->getData('show_facepile');
98
+ }
99
+
100
+ /**
101
+ * @return bool
102
+ */
103
+ public function isHideCta()
104
+ {
105
+ if (!$this->hasData('hide_cta')) {
106
+ return false;
107
+ }
108
+ return !!$this->getData('hide_cta');
109
+ }
110
+
111
+ /**
112
+ * @return bool
113
+ */
114
+ public function isSmallHeader()
115
+ {
116
+ if (!$this->hasData('small_header')) {
117
+ return false;
118
+ }
119
+ return !!$this->getData('small_header');
120
+ }
121
+
122
+ /**
123
+ * @return bool
124
+ */
125
+ public function isAdaptContainerWidth()
126
+ {
127
+ if (!$this->hasData('adapt_container_width')) {
128
+ return true;
129
+ }
130
+ return !!$this->getData('adapt_container_width');
131
+ }
132
+
133
+ /**
134
+ * @return Neklo_FacebookPage_Helper_Config
135
+ */
136
+ public function getConfig()
137
+ {
138
+ return Mage::helper('neklo_facebookpage/config');
139
+ }
140
+ }
app/code/community/Neklo/FacebookPage/Helper/Config.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_FacebookPage_Helper_Config extends Mage_Core_Helper_Data
4
+ {
5
+ const GENERAL_IS_ENABLED = 'neklo_facebookpage/general/is_enabled';
6
+
7
+ /**
8
+ * @param null|int|Mage_Core_Model_Store $store
9
+ *
10
+ * @return bool
11
+ */
12
+ public function isEnabled($store = null)
13
+ {
14
+ $isConfigEnabled = Mage::getStoreConfigFlag(self::GENERAL_IS_ENABLED, $store);
15
+ $isModuleEnabled = $this->isModuleEnabled();
16
+ $isModuleOutputEnabled = $this->isModuleOutputEnabled();
17
+ return $isConfigEnabled && $isModuleEnabled && $isModuleOutputEnabled;
18
+ }
19
+ }
app/code/community/Neklo/FacebookPage/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_FacebookPage_Helper_Data extends Mage_Core_Helper_Data
4
+ {
5
+
6
+ }
app/code/community/Neklo/FacebookPage/Model/Source/Tabs.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Neklo_FacebookPage_Model_Source_Tabs
4
+ {
5
+ const TIMELINE_CODE = 'timeline';
6
+ const TIMELINE_LABEL = 'Timeline';
7
+
8
+ const EVENTS_CODE = 'events';
9
+ const EVENTS_LABEL = 'Events';
10
+
11
+ const MESSAGES_CODE = 'messages';
12
+ const MESSAGES_LABEL = 'Messages';
13
+
14
+ public function toOptionArray()
15
+ {
16
+ $helper = Mage::helper('neklo_facebookpage');
17
+ return array(
18
+ array(
19
+ 'value' => self::TIMELINE_CODE,
20
+ 'label' => $helper->__(self::TIMELINE_LABEL),
21
+ ),
22
+ array(
23
+ 'value' => self::EVENTS_CODE,
24
+ 'label' => $helper->__(self::EVENTS_LABEL),
25
+ ),
26
+ array(
27
+ 'value' => self::MESSAGES_CODE,
28
+ 'label' => $helper->__(self::MESSAGES_LABEL),
29
+ ),
30
+ );
31
+ }
32
+
33
+ public function toArray()
34
+ {
35
+ $helper = Mage::helper('neklo_facebookpage');
36
+ return array(
37
+ self::TIMELINE_CODE => $helper->__(self::TIMELINE_LABEL),
38
+ self::EVENTS_CODE => $helper->__(self::EVENTS_LABEL),
39
+ self::MESSAGES_CODE => $helper->__(self::MESSAGES_LABEL),
40
+ );
41
+ }
42
+ }
app/code/community/Neklo/FacebookPage/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <neklo_facebookpage translate="title" module="neklo_facebookpage">
15
+ <title>Neklo LLC - Facebook Page Plugin</title>
16
+ <sort_order>150</sort_order>
17
+ </neklo_facebookpage>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ </config>
app/code/community/Neklo/FacebookPage/etc/config.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Neklo_FacebookPage>
5
+ <version>1.0.0</version>
6
+ </Neklo_FacebookPage>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <neklo_facebookpage>
11
+ <class>Neklo_FacebookPage_Block</class>
12
+ </neklo_facebookpage>
13
+ </blocks>
14
+ <helpers>
15
+ <neklo_facebookpage>
16
+ <class>Neklo_FacebookPage_Helper</class>
17
+ </neklo_facebookpage>
18
+ </helpers>
19
+ <models>
20
+ <neklo_facebookpage_source>
21
+ <class>Neklo_FacebookPage_Model_Source</class>
22
+ </neklo_facebookpage_source>
23
+ </models>
24
+ </global>
25
+ <frontend>
26
+ <layout>
27
+ <updates>
28
+ <neklo_facebookpage>
29
+ <file>neklo/facebookpage.xml</file>
30
+ </neklo_facebookpage>
31
+ </updates>
32
+ </layout>
33
+ <translate>
34
+ <modules>
35
+ <Neklo_FacebookPage>
36
+ <files>
37
+ <default>Neklo_FacebookPage.csv</default>
38
+ </files>
39
+ </Neklo_FacebookPage>
40
+ </modules>
41
+ </translate>
42
+ </frontend>
43
+ <default>
44
+ <neklo_facebookpage>
45
+ <general>
46
+ <is_enabled>1</is_enabled>
47
+ </general>
48
+ </neklo_facebookpage>
49
+ </default>
50
+ </config>
app/code/community/Neklo/FacebookPage/etc/system.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <neklo_facebookpage translate="label" module="neklo_facebookpage">
5
+ <label>Facebook Page Plugin</label>
6
+ <tab>neklo</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>150</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
+ <is_enabled translate="label">
22
+ <label>Is Enabled</label>
23
+ <frontend_type>select</frontend_type>
24
+ <source_model>adminhtml/system_config_source_yesno</source_model>
25
+ <sort_order>10</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </is_enabled>
30
+ </fields>
31
+ </general>
32
+ </groups>
33
+ </neklo_facebookpage>
34
+ </sections>
35
+ </config>
app/code/community/Neklo/FacebookPage/etc/widget.xml ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <widgets>
3
+ <neklo_facebook_page type="neklo_facebookpage/widget_page" translate="label" module="neklo_facebookpage">
4
+ <name>[NEKLO] Facebook Page Plugin</name>
5
+ <parameters>
6
+ <is_enabled translate="label">
7
+ <label>Is Enabled</label>
8
+ <required>1</required>
9
+ <visible>1</visible>
10
+ <sort_order>10</sort_order>
11
+ <type>select</type>
12
+ <source_model>adminhtml/system_config_source_yesno</source_model>
13
+ <value>1</value>
14
+ </is_enabled>
15
+ <href translate="label description">
16
+ <label>URL Key</label>
17
+ <description><![CDATA[The URL Key of the Facebook Page<br/>Example: use <b>neklollc</b> for https://www.facebook.com/<b>neklollc</b>]]></description>
18
+ <required>1</required>
19
+ <visible>1</visible>
20
+ <sort_order>20</sort_order>
21
+ <type>text</type>
22
+ </href>
23
+ <width translate="label description">
24
+ <label>Width</label>
25
+ <description><![CDATA[The pixel width of the plugin. Min. is <b>180</b> & Max. is <b>500</b>]]></description>
26
+ <required>0</required>
27
+ <visible>1</visible>
28
+ <sort_order>30</sort_order>
29
+ <type>text</type>
30
+ <value>340</value>
31
+ </width>
32
+ <height translate="label description">
33
+ <label>Height</label>
34
+ <description><![CDATA[The pixel height of the plugin. Min. is <b>70</b>]]></description>
35
+ <required>0</required>
36
+ <visible>1</visible>
37
+ <sort_order>40</sort_order>
38
+ <type>text</type>
39
+ <value>500</value>
40
+ </height>
41
+ <tabs translate="label">
42
+ <label>Tabs to render</label>
43
+ <required>1</required>
44
+ <visible>1</visible>
45
+ <sort_order>50</sort_order>
46
+ <type>multiselect</type>
47
+ <source_model>neklo_facebookpage_source/tabs</source_model>
48
+ <value>timeline</value>
49
+ </tabs>
50
+ <hide_cover translate="label description">
51
+ <label>Hide Cover Photo</label>
52
+ <description><![CDATA[Hide the cover photo in the header]]></description>
53
+ <required>0</required>
54
+ <visible>1</visible>
55
+ <sort_order>60</sort_order>
56
+ <type>select</type>
57
+ <source_model>adminhtml/system_config_source_yesno</source_model>
58
+ <value>0</value>
59
+ </hide_cover>
60
+ <show_facepile translate="label description">
61
+ <label>Show Friend's Faces</label>
62
+ <description><![CDATA[Show profile photos when friends like this]]></description>
63
+ <required>0</required>
64
+ <visible>1</visible>
65
+ <sort_order>70</sort_order>
66
+ <type>select</type>
67
+ <source_model>adminhtml/system_config_source_yesno</source_model>
68
+ <value>1</value>
69
+ </show_facepile>
70
+ <hide_cta translate="label">
71
+ <label>Hide CTA</label>
72
+ <description><![CDATA[Hide the custom call to action button (if available)]]></description>
73
+ <required>0</required>
74
+ <visible>1</visible>
75
+ <sort_order>80</sort_order>
76
+ <type>select</type>
77
+ <source_model>adminhtml/system_config_source_yesno</source_model>
78
+ <value>0</value>
79
+ </hide_cta>
80
+ <small_header translate="label description">
81
+ <label>Use Small Header</label>
82
+ <description><![CDATA[Uses a smaller version of the page header]]></description>
83
+ <required>0</required>
84
+ <visible>1</visible>
85
+ <sort_order>90</sort_order>
86
+ <type>select</type>
87
+ <source_model>adminhtml/system_config_source_yesno</source_model>
88
+ <value>0</value>
89
+ </small_header>
90
+ <adapt_container_width translate="label description">
91
+ <label>Adapt to plugin container width</label>
92
+ <description><![CDATA[Plugin will try to fit inside container]]></description>
93
+ <required>0</required>
94
+ <visible>1</visible>
95
+ <sort_order>100</sort_order>
96
+ <type>select</type>
97
+ <source_model>adminhtml/system_config_source_yesno</source_model>
98
+ <value>1</value>
99
+ </adapt_container_width>
100
+ <template translate="label">
101
+ <label>Template</label>
102
+ <required>1</required>
103
+ <visible>1</visible>
104
+ <sort_order>110</sort_order>
105
+ <type>select</type>
106
+ <value>neklo/facebookpage/widget/page.phtml</value>
107
+ <values>
108
+ <featured translate="label">
109
+ <value>neklo/facebookpage/widget/page.phtml</value>
110
+ <label>Facebook Page Plugin Template</label>
111
+ </featured>
112
+ </values>
113
+ </template>
114
+ </parameters>
115
+ </neklo_facebook_page>
116
+ </widgets>
app/design/adminhtml/default/default/template/neklo/core/system/subscribe/button.phtml ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Neklo_Core_Block_System_Newsletter_Subscribe_Button */ ?>
2
+ <?php echo $this->getButtonHtml(); ?>
3
+ <div class="neklo_core_message"></div>
4
+ <script>
5
+ var NekloCoreSubscribe = Class.create({
6
+ initialize: function (config) {
7
+ this.initConfig(config);
8
+ this.initElements();
9
+ this.initObservers();
10
+ },
11
+
12
+ initConfig: function (config) {
13
+ this.config = config;
14
+ this.subscribeUrl = this.config.subscribeUrl || '';
15
+
16
+ this.successMessage = this.config.successMessage || '';
17
+ this.errorMessage = this.config.errorMessage || '';
18
+
19
+ this.successMessageClass = this.config.successMessageClass || '';
20
+ this.errorMessageClass = this.config.errorMessageClass || '';
21
+
22
+
23
+ this.formContainerId = this.config.formContainerId || '';
24
+ this.formElementSelectorList = this.config.formElementSelectorList || [];
25
+ },
26
+
27
+ initElements: function () {
28
+ this.subscribeButton = $(this.config.subscribeButtonId) || null;
29
+ this.loadingMask = $(this.config.loadingMaskId) || null;
30
+ this.messageContainer = $$(this.config.messageContainerSelector).first() || null;
31
+ },
32
+
33
+ initObservers: function () {
34
+ if (this.subscribeButton) {
35
+ this.subscribeButton.observe('click', this.subscribe.bind(this));
36
+ }
37
+ },
38
+
39
+ subscribe: function () {
40
+ if (!this.validate()) {
41
+ return;
42
+ }
43
+
44
+ var me = this;
45
+ var subscribeData = {};
46
+ this.formElementSelectorList.each(function (elementSelector) {
47
+ subscribeData[elementSelector] = $(me.formContainerId + '_' + elementSelector).getValue();
48
+ });
49
+
50
+ new Ajax.Request(
51
+ this.subscribeUrl,
52
+ {
53
+ method: 'post',
54
+ parameters: subscribeData,
55
+ onCreate: this._onSubscribeCreate.bind(this),
56
+ onComplete: this._onSubscribeComplete.bind(this),
57
+ onSuccess: this._onSubscribeSuccess.bind(this),
58
+ onFailure: this._onSubscribeFailure.bind(this)
59
+ }
60
+ );
61
+ },
62
+
63
+ validate: function () {
64
+ var me = this;
65
+ var result = true;
66
+ this.formElementSelectorList.each(function (elementSelector) {
67
+ result = Validation.validate($(me.formContainerId + '_' + elementSelector));
68
+ });
69
+ return result;
70
+ },
71
+
72
+ showLoadingMask: function () {
73
+ if (this.loadingMask) {
74
+ this.loadingMask.show();
75
+ }
76
+ },
77
+
78
+ hideLoadingMask: function () {
79
+ if (this.loadingMask) {
80
+ this.loadingMask.hide();
81
+ }
82
+ },
83
+
84
+ _onSubscribeCreate: function () {
85
+ this.clearMessageContainer();
86
+ this.showLoadingMask();
87
+ },
88
+
89
+ _onSubscribeComplete: function () {
90
+ this.hideLoadingMask();
91
+ },
92
+
93
+ _onSubscribeSuccess: function (response) {
94
+ try {
95
+ var result = response.responseText.evalJSON();
96
+ if (typeof(result.success) != 'undefined') {
97
+ if (result.success) {
98
+ this.showSuccess();
99
+ } else {
100
+ this.showError();
101
+ }
102
+ }
103
+ } catch (e) {
104
+ this.showError();
105
+ }
106
+ },
107
+
108
+ _onSubscribeFailure: function () {
109
+ this.showError();
110
+ },
111
+
112
+ showSuccess: function () {
113
+ this.showMessage(this.successMessage, this.successMessageClass);
114
+ },
115
+
116
+ showError: function () {
117
+ this.showMessage(this.errorMessage, this.errorMessageClass);
118
+ },
119
+
120
+ showMessage: function (message, className) {
121
+ this.clearMessageContainer();
122
+ var messageElement = new Element('p', {'class': className}).update(message);
123
+ this.messageContainer.appendChild(messageElement);
124
+ },
125
+
126
+ clearMessageContainer: function () {
127
+ this.messageContainer.update('');
128
+ }
129
+ });
130
+
131
+ var subscribeForm = new NekloCoreSubscribe({
132
+ 'subscribeUrl': '<?php echo $this->getUrl('adminhtml/neklo_core_newsletter/subscribe'); ?>',
133
+
134
+ 'successMessage': '<?php echo $this->__('Successfully subscribed'); ?>',
135
+ 'errorMessage': '<?php echo $this->__('Subscribe error'); ?>',
136
+
137
+ 'successMessageClass': 'success',
138
+ 'errorMessageClass': 'error',
139
+
140
+ 'formContainerId' : '<?php echo $this->getContainerId(); ?>',
141
+ 'formElementSelectorList': ['name', 'email'],
142
+
143
+ 'subscribeButtonId': 'neklo_core_subscribe',
144
+ 'loadingMaskId': 'loading-mask',
145
+ 'messageContainerSelector': '.neklo_core_message'
146
+ });
147
+ </script>
148
+ <style>
149
+ .neklo_core_message {
150
+ text-align: center;
151
+ padding: 5px 0;
152
+ font-weight: bold;
153
+ width: 280px;
154
+ }
155
+ .neklo_core_message .error {
156
+ color: #D40707;
157
+ }
158
+ .neklo_core_message .success {
159
+ color: #3d6611;
160
+ }
161
+ </style>
app/design/frontend/base/default/layout/neklo/facebookpage.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>css/neklo/facebookpage/styles.css</stylesheet></action>
6
+ </reference>
7
+ <reference name="after_body_start">
8
+ <block type="neklo_facebookpage/sdk" name="neklo.facebookpage.sdk" template="neklo/facebookpage/sdk.phtml"/>
9
+ </reference>
10
+ </default>
11
+ </layout>
app/design/frontend/base/default/template/neklo/facebookpage/sdk.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Neklo_FacebookPage_Block_Sdk */ ?>
2
+ <?php if ($this->canShow()): ?>
3
+ <div id="fb-root"></div>
4
+ <script type="text/javascript">
5
+ (function(d, s, id) {
6
+ var js, fjs = d.getElementsByTagName(s)[0];
7
+ if (d.getElementById(id)) return;
8
+ js = d.createElement(s); js.id = id;
9
+ js.src = "//connect.facebook.net/ru_RU/sdk.js#xfbml=1&version=v2.5";
10
+ fjs.parentNode.insertBefore(js, fjs);
11
+ }(document, 'script', 'facebook-jssdk'));
12
+ </script>
13
+ <?php endif; ?>
app/design/frontend/base/default/template/neklo/facebookpage/widget/page.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Neklo_FacebookPage_Block_Widget_Page */ ?>
2
+ <?php if ($this->isEnabled()): ?>
3
+ <div
4
+ class="fb-page neklo-facebook-page"
5
+ data-href="<?php echo $this->getHref(); ?>"
6
+ data-width="<?php echo $this->getWidth(); ?>"
7
+ data-height="<?php echo $this->getHeight(); ?>"
8
+ data-tabs="<?php echo $this->getTabs(); ?>"
9
+ data-hide-cover="<?php var_export($this->isHideCover()); ?>"
10
+ data-show-facepile="<?php var_export($this->isShowFacepile()); ?>"
11
+ data-hide-cta="<?php var_export($this->isHideCta()); ?>"
12
+ data-small-header="<?php var_export($this->isSmallHeader()); ?>"
13
+ style="width:<?php echo $this->getWidth(); ?>px;height:<?php echo $this->getHeight(); ?>px"
14
+ >
15
+ <div class="fb-xfbml-parse-ignore">
16
+ <blockquote class="tac" cite="<?php echo $this->getHref(); ?>">
17
+ <a href="<?php echo $this->getHref(); ?>">
18
+ <img src="<?php echo $this->getSkinUrl('images/neklo/facebookpage/facebook-loader.gif'); ?>" alt="<?php echo $this->__('Facebook'); ?>"/>
19
+ </a>
20
+ </blockquote>
21
+ </div>
22
+ </div>
23
+ <?php endif; ?>
app/etc/modules/Neklo_Core.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Neklo_Core>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <extension_name>Neklo Core</extension_name>
8
+ </Neklo_Core>
9
+ </modules>
10
+ </config>
app/etc/modules/Neklo_FacebookPage.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Neklo_FacebookPage>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Neklo_Core/>
9
+ </depends>
10
+ <extension_name>Facebook Widget</extension_name>
11
+ <free>1</free>
12
+ <url>facebook-widget-extension-for-magento</url>
13
+ </Neklo_FacebookPage>
14
+ </modules>
15
+ </config>
app/locale/en_US/Neklo_Core.csv ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %s Support (%s),%s Support (%s)
2
+ Contact Email,Contact Email
3
+ Contact Form,Contact Form
4
+ Contact Name,Contact Name
5
+ "Contact Neklo Support Team or visit <a href=""%s"" target=""_blank"">%s</a> for additional information","Contact Neklo Support Team or visit <a href=""%s"" target=""_blank"">%s</a> for additional information"
6
+ Extensions &amp; Contact,Extensions &amp; Contact
7
+ Extensions Information,Extensions Information
8
+ Installed Neklo Extensions,Installed Neklo Extensions
9
+ free,free
10
+ Magento Related Support (paid),Magento Related Support (paid)
11
+ Message,Message
12
+ Neklo Extensions &amp; Contact,Neklo Extensions &amp; Contact
13
+ Other Reason,Other Reason
14
+ Reason,Reason
15
+ Request New Extension Development (paid),Request New Extension Development (paid)
16
+ paid,paid
17
+ Please select,Please select
18
+ Send,Send
19
+ Subject,Subject
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Neklo_FacebookWidget</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Summary</summary>
10
+ <description>Description</description>
11
+ <notes>The first stable release.</notes>
12
+ <authors><author><name>NEKLO</name><user>NEKLO</user><email>info@neklo.com</email></author></authors>
13
+ <date>2015-12-14</date>
14
+ <time>13:45:55</time>
15
+ <contents><target name="magecommunity"><dir name="Neklo"><dir name="FacebookPage"><dir name="Block"><file name="Sdk.php" hash="3ebc857b62498466a678736e3042b3fc"/><dir name="Widget"><file name="Page.php" hash="5bf76afe749a9e0b2df2364733549bdb"/></dir></dir><dir name="Helper"><file name="Config.php" hash="9f2025b1dbf117a533b137a52d960bf5"/><file name="Data.php" hash="2c1155e74eb10a85c9037d4a14b32839"/></dir><dir name="Model"><dir name="Source"><file name="Tabs.php" hash="ab6144c19ab9d9170cc2289735fa2bd6"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ede1cd359a3bd4fdd33aab424f515ffd"/><file name="config.xml" hash="6fa06bd362ac51a96234c4bf06f41e98"/><file name="system.xml" hash="670d2e8d96a5566d9d998e26f0b7441f"/><file name="widget.xml" hash="eb41072c8782b6106c2cf51edb0ffa85"/></dir></dir><dir name="Core"><dir name="Block"><dir name="System"><file name="Abstract.php" hash="d13dedc9e28f3fba42d5b4e5e23c5a58"/><file name="Contact.php" hash="b9d03eda3b0ff0b8ffd17a777bc36d9b"/><file name="Extensions.php" hash="26e96fa54e769bc30a6bdf6395c80d34"/><dir name="Newsletter"><dir name="Subscribe"><file name="Button.php" hash="c24e57030e1a6d16611eb516a9249c34"/></dir><file name="Subscribe.php" hash="7b9b021aa6f12c0eff8576c4cb6cd60d"/></dir><file name="Newsletter.php" hash="46a84ace83bf1a4a81a3e4bf90272c6c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e13a6d27a50ea228c8751e6465c8f463"/></dir><dir name="Model"><file name="Feed.php" hash="8a669a60ad96195af2ff706c1e3ec26e"/><file name="Observer.php" hash="dea6141e7f7bb7acde44f242d0ae7083"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Neklo"><dir name="Core"><file name="ContactController.php" hash="88982513d6006d5f3b320e41b3cb96be"/><file name="NewsletterController.php" hash="b8334402bcc20afc829b5ea0cb763cab"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="68b00ad4118462d74b0c0a7126063462"/><file name="config.xml" hash="3cfaca93a4cffbec6a1dc7113b510bb2"/><file name="system.xml" hash="66e1ccd2fc1c3fdd511dc99a8575009d"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="neklo"><file name="facebookpage.xml" hash="2bcdcba08dab099e48918b05e59f3021"/></dir></dir><dir name="template"><dir name="neklo"><dir name="facebookpage"><file name="sdk.phtml" hash="6f1525354ffb632fd88198141b19686d"/><dir name="widget"><file name="page.phtml" hash="f5b13730fb88ac0c21b2e4fc4ca0ac99"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="neklo"><dir name="core"><dir name="system"><dir name="subscribe"><file name="button.phtml" hash="4e9fe3dfa9e291976ff45c2e25ce7b10"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Neklo_FacebookPage.xml" hash="a9e3813f9493d1f60aa76c07a42fa7e3"/><file name="Neklo_Core.xml" hash="335032ff690c5272626dca9106642680"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="neklo"><dir name="facebookpage"><file name="styles.css" hash="da7be054b9e6ef77f56bbfc5de6c8d97"/></dir></dir></dir><dir name="images"><dir name="neklo"><dir name="facebookpage"><file name="facebook-loader.gif" hash="a11c3108c26c904dd9d8a641cf79cf06"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Neklo_Core.csv" hash="c6abfbb8be878de9c02339e2ecfc4e16"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.7</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/css/neklo/facebookpage/styles.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .neklo-facebook-page {
2
+ position: relative;
3
+ }
4
+
5
+ .neklo-facebook-page .fb-xfbml-parse-ignore {
6
+ position: absolute;
7
+ left: 0;
8
+ right: 0;
9
+ top: 0;
10
+ bottom: 0;
11
+ margin: auto;
12
+ width: 64px;
13
+ height: 64px;
14
+ }
skin/frontend/base/default/images/neklo/facebookpage/facebook-loader.gif ADDED
Binary file