Justuno_Social - Version 1.0.3

Version Notes

Stable release. Add auto logging in user via API

Download this release

Release Info

Developer Justuno
Extension Justuno_Social
Version 1.0.3
Comparing to
See all releases


Version 1.0.3

app/code/community/Justuno/Social/Block/Dashboard.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Justuno_Social_Block_Dashboard extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
3
+ {
4
+ /*protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $email = Mage::getStoreConfig('advanced/account/email');
7
+ $domain = Mage::getStoreConfig('advanced/account/domain');
8
+ $jusdata = Mage::getStoreConfig('advanced/account/embed');
9
+ if ($email && $jusdata) {
10
+ $jusdata = json_decode($jusdata);
11
+ include_once realpath(dirname(__FILE__) . '/../Model/JustunoAccess.php');
12
+ $jAccess = new JustunoAccess(array('apiKey'=>JUSTUNO_KEY,'email'=>$email, 'guid'=>$jusdata->guid, 'domain'=>$domain));
13
+ $url = $jAccess->getDashboardLink();
14
+ }
15
+ else {
16
+ $url = 'https://www.justuno.com/dashboard.html?loggedin=true';
17
+ }
18
+ return '<button title="Justuno Dashboard" class="scalable" onClick="window.open(\'' . $url . '\',\'_blank\'); return false;">Justuno Dashboard</button>';
19
+ }*/
20
+ public function render(Varien_Data_Form_Element_Abstract $element)
21
+ {
22
+
23
+ $email = Mage::getStoreConfig('justuno/account/email',0);
24
+ $domain = Mage::getStoreConfig('justuno/account/domain',0);
25
+ $jusdata = Mage::getStoreConfig('justuno/account/embed',1);
26
+ //$jusdata = Mage::getStoreConfig('advanced/account/embed');
27
+ if ($jusdata) {
28
+ $jusdata = json_decode($jusdata);
29
+ }
30
+ $dashboard = $jusdata->dashboard;
31
+
32
+ $this->setElement($element);
33
+ $html = $this->_getHeaderHtml($element);
34
+
35
+ if ($email && $jusdata) {
36
+ $html.= "<span>You are already connected. <a href=".Mage::helper('adminhtml')->getUrl("adminhtml/custom/index/").">Click here to disconnect if necessary</a></span>";
37
+ //$html.="<br/><span>Justuno Dashboard <a href=".$dashboard." target='_blank'> Click here </a></span>";
38
+ }
39
+ else{
40
+ foreach ($element->getSortedElements() as $field) {
41
+ $html.= $field->toHtml();
42
+ }
43
+ }
44
+
45
+ $html .= $this->_getFooterHtml($element);
46
+ return $html;
47
+ }
48
+ }
app/code/community/Justuno/Social/Block/Dashboard1.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Justuno_Social_Block_Dashboard1 extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
3
+ {
4
+ /*protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $email = Mage::getStoreConfig('advanced/account/email');
7
+ $domain = Mage::getStoreConfig('advanced/account/domain');
8
+ $jusdata = Mage::getStoreConfig('advanced/account/embed');
9
+ if ($email && $jusdata) {
10
+ $jusdata = json_decode($jusdata);
11
+ include_once realpath(dirname(__FILE__) . '/../Model/JustunoAccess.php');
12
+ $jAccess = new JustunoAccess(array('apiKey'=>JUSTUNO_KEY,'email'=>$email, 'guid'=>$jusdata->guid, 'domain'=>$domain));
13
+ $url = $jAccess->getDashboardLink();
14
+ }
15
+ else {
16
+ $url = 'https://www.justuno.com/dashboard.html?loggedin=true';
17
+ }
18
+ return '<button title="Justuno Dashboard" class="scalable" onClick="window.open(\'' . $url . '\',\'_blank\'); return false;">Justuno Dashboard</button>';
19
+ }*/
20
+ public function render(Varien_Data_Form_Element_Abstract $element)
21
+ {
22
+
23
+ $email = Mage::getStoreConfig('justuno/account/email',0);
24
+ $domain = Mage::getStoreConfig('justuno/account/domain',0);
25
+ $jusdata = Mage::getStoreConfig('justuno/account/embed',1);
26
+ //$jusdata = Mage::getStoreConfig('advanced/account/embed');
27
+ if ($jusdata) {
28
+ $jusdata = json_decode($jusdata);
29
+ }
30
+ $dashboard = $jusdata->dashboard;
31
+
32
+ $this->setElement($element);
33
+ $html = $this->_getHeaderHtml($element);
34
+
35
+ if ($email && $jusdata) {
36
+ $html.= "<span>You are already connected. <a href=".Mage::helper('adminhtml')->getUrl("adminhtml/custom/index/").">Click here to disconnect if necessary</a></span>";
37
+ //$html.="<br/><span>Justuno Dashboard <a href=".$dashboard." target='_blank'> Click here </a></span>";
38
+ }
39
+ else{
40
+ foreach ($element->getSortedElements() as $field) {
41
+ $html.= $field->toHtml();
42
+
43
+ }
44
+ $html .= $this->_getFooterHtml($element);
45
+ return $html;
46
+ }
47
+
48
+
49
+ }
50
+ }
app/code/community/Justuno/Social/Block/Domain.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Justuno_Social_Block_Domain extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
3
+ {
4
+ /*protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ //return '<input id="advanced_account_domain" class=" input-text" type="text" value="' . $_SERVER['HTTP_HOST'] . '" name="groups[account][fields][domain][value]" readonly="true"></input>';
7
+ }*/
8
+
9
+ public function render(Varien_Data_Form_Element_Abstract $element)
10
+ {
11
+
12
+ $email = Mage::getStoreConfig('justuno/account/email',0);
13
+ $domain = Mage::getStoreConfig('justuno/account/domain',0);
14
+ $jusdata = Mage::getStoreConfig('justuno/account/embed',1);
15
+ //$jusdata = Mage::getStoreConfig('advanced/account/embed');
16
+ if ($jusdata) {
17
+ $jusdata = json_decode($jusdata);
18
+ }
19
+ $dashboard = $jusdata->dashboard;
20
+
21
+ $this->setElement($element);
22
+ $html = $this->_getHeaderHtml($element);
23
+
24
+ if ($email && $jusdata) {
25
+ //$html.= "<span>You are already connected. <a href=".Mage::helper('adminhtml')->getUrl("adminhtml/custom/index/").">Click here to disconnect if necessary</a></span>";
26
+ $html.="<span>Justuno Dashboard <a href=".$dashboard." target='_blank'> Click here </a></span>";
27
+ }
28
+ else{
29
+ $justuno_link = Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/justuno");
30
+ $html.="<span>Please <a href=".$justuno_link."> click here </a> to first update your magento / justuno app settings.</span>";
31
+ /*foreach ($element->getSortedElements() as $field) {
32
+ $html.= $field->toHtml();
33
+ }*/
34
+ }
35
+
36
+ $html .= $this->_getFooterHtml($element);
37
+ return $html;
38
+ }
39
+ }
app/code/community/Justuno/Social/Block/Widget.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Justuno_Social_Block_Widget extends Mage_Core_Block_Template
3
+ {
4
+ public function getEmbed()
5
+ {
6
+ $jusdata = Mage::getStoreConfig('advanced/account/embed');
7
+ if ($jusdata) {
8
+ $jusdata = json_decode($jusdata);
9
+ }
10
+ return $jusdata->embed;
11
+ }
12
+ }
app/code/community/Justuno/Social/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Justuno_Social_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Justuno/Social/Model/Adminhtml/Comment.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Justuno_Social_Model_Adminhtml_Comment{
3
+ public function getCommentText(){ //this method must exits. It returns the text for the comment
4
+ return "<a href='https://www.justuno.com/login.html' target='_blank'>Forget your password?</a>";
5
+ }
6
+ }
app/code/community/Justuno/Social/Model/Embed.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Justuno_Social_Model_Embed extends Mage_Core_Model_Config_Data
3
+ {
4
+ public function save()
5
+ {
6
+
7
+ $fdata = array();
8
+ foreach ($this->groups['register']['fields'] as $name=>$field) {
9
+ $fdata[$name] = $field['value'];
10
+ }
11
+ /*if($fdata){
12
+ if(!$fdata['email']) {
13
+ Mage::throwException("Please enter valid email address");
14
+ }
15
+ if(!$fdata['password']) {
16
+ Mage::throwException("Please enter valid pasword");
17
+ }
18
+ if(!$fdata['phone']) {
19
+ Mage::throwException("Please enter phone no");
20
+ }
21
+ if(!$fdata['domain']) {
22
+ Mage::throwException("Please enter domain name");
23
+ }
24
+
25
+ }*/
26
+ //print_r($fdata);exit;
27
+ if($fdata['email'] && $fdata['password']){
28
+ /*if ($fdata['embed']) {
29
+ $obj = json_decode($fdata['embed']);
30
+ $fdata['embed'] = $obj->embed;
31
+ $fdata['guid'] = $obj->guid;
32
+ }*/
33
+ $fdata['guid'] = "";
34
+ include_once dirname(__FILE__) . '/JustunoAccess.php';
35
+ $params = array('apiKey'=>JUSTUNO_KEY,
36
+ 'email'=>$fdata['email'],
37
+ 'domain'=>$fdata['domain'],
38
+ 'guid'=>$fdata['guid'],
39
+ 'phone'=>$fdata['phone']);
40
+ if($fdata['password'])
41
+ $params['password'] = $fdata['password'];
42
+ $jAccess = new JustunoAccess($params);
43
+ try {
44
+ $justuno = $jAccess->getWidgetConfig();
45
+ $jusdata = array();
46
+ $jusdata['dashboard'] = (string)$jAccess->getDashboardLink();
47
+ $jusdata['guid'] = (string)$justuno['guid'];
48
+ $jusdata['embed'] = (string)$justuno['embed'];
49
+ $embed_db = (string)json_encode($jusdata);
50
+ Mage::getConfig()->saveConfig('justuno/account/embed', $embed_db, 'default', 1);
51
+ Mage::getConfig()->saveConfig('justuno/account/email', $fdata['email'], 'default', 0);
52
+ Mage::getConfig()->saveConfig('justuno/account/password', $fdata['password'], 'default', 0);
53
+ Mage::getConfig()->saveConfig('justuno/account/domain', $fdata['domain'], 'default', 0);
54
+
55
+ }
56
+ catch(JustunoAccessException $e) {
57
+ Mage::throwException($e->getMessage());
58
+ }
59
+ }
60
+ $flogindata = array();
61
+ foreach ($this->groups['account']['fields'] as $name=>$field) {
62
+ $flogindata[$name] = $field['value'];
63
+ }
64
+ /*if($flogindata){
65
+ if(!$flogindata['email']) {
66
+ Mage::throwException("Please enter valid email address");
67
+ }
68
+ if(!$flogindata['password']) {
69
+ Mage::throwException("Please enter valid pasword");
70
+ }
71
+
72
+ }*/
73
+ if($flogindata['email'] && $flogindata['password']){
74
+ if ($flogindata['embed']) {
75
+ $obj = json_decode($flogindata['embed']);
76
+ $flogindata['embed'] = $obj->embed;
77
+ $flogindata['guid'] = $obj->guid;
78
+ }
79
+ include_once dirname(__FILE__) . '/JustunoAccess.php';
80
+ $login_params = array('apiKey'=>JUSTUNO_KEY,'email'=>$flogindata['email'],'domain'=>'','guid'=>$flogindata['guid']);
81
+ print_r($login_params);
82
+ if($flogindata['password'])
83
+ $login_params['password'] = $flogindata['password'];
84
+ $jAccess = new JustunoAccess($login_params);
85
+ try {
86
+ //$justuno = $jAccess->getWidgetConfig();
87
+ $jusdata = array();
88
+ $jusdata['dashboard'] = (string)$jAccess->getDashboardLink();
89
+ $jusdata['guid'] = (string)$justuno['guid'];
90
+ $jusdata['embed'] = (string)$justuno['embed'];
91
+ $flogin_embed_db = (string)json_encode($jusdata);
92
+
93
+ $storeCode = 'default';
94
+ $store = Mage::getModel('core/store')->load($storeCode);
95
+ $path = 'justuno/account/embed';
96
+ $config = Mage::getModel('core/config_data');
97
+ $config->setValue($flogin_embed_db);
98
+ $config->setPath($path);
99
+ $config->setScope('default');
100
+ $config->setScopeId($store->getId());
101
+ $config->save();
102
+
103
+ //Mage::getConfig()->saveConfig('justuno/account/embed', $flogin_embed_db, 'default', 0);
104
+ Mage::getConfig()->saveConfig('justuno/account/email', $flogindata['email'], 'default', 0);
105
+ Mage::getConfig()->saveConfig('justuno/account/password', $flogindata['password'], 'default', 0);
106
+ Mage::getConfig()->saveConfig('justuno/account/domain', $flogindata['domain'], 'default', 0);
107
+ }
108
+ catch(JustunoAccessException $e) {
109
+ Mage::throwException($e->getMessage());
110
+ }
111
+ }
112
+ return parent::save();
113
+ }
114
+ }
app/code/community/Justuno/Social/Model/JustunoAccess.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ define('JUSTUNO_KEY', '467cd758-5745-4385-906b-6c76271c343a');
3
+ /**
4
+ * @file
5
+ * Class to perform operations with Justuno server.
6
+ *
7
+ * @version 13-08-2013
8
+ */
9
+
10
+ class JustunoAccess {
11
+ protected $apiKey;
12
+ protected $domain;
13
+ protected $email;
14
+ protected $apiEndpointUrl;
15
+ protected $guid;
16
+ protected $password;
17
+
18
+ /**
19
+ * Set initial data in constructor.
20
+ */
21
+ public function __construct($settings) {
22
+ $this->apiKey = $settings['apiKey'];
23
+ $this->domain = $settings['domain'];
24
+ $this->email = $settings['email'];
25
+ $this->guid = isset($settings['guid']) ? $settings['guid'] : NULL;
26
+ $this->password = isset($settings['password']) ? $settings['password'] : NULL;
27
+ $this->apiEndpointUrl = 'https://www.justuno.com/api/endpoint.html';
28
+ }
29
+
30
+ /**
31
+ * Retreives Justuno widget data.
32
+ */
33
+ public function getWidgetConfig() {
34
+ if (!extension_loaded("curl")) {
35
+ throw new JustunoAccessException('Plug-in requires php `curl` extension which seems to be not activated on this server. Please activate it.');
36
+ }
37
+ $params = array(
38
+ 'key' => $this->apiKey,
39
+ 'email' => $this->email,
40
+ 'domain' => $this->domain,
41
+ 'action' => 'install',
42
+ );
43
+ if (isset($this->password)) {
44
+ $params['password'] = $this->password;
45
+ }
46
+ $query = http_build_query($params);
47
+ $tucurl = curl_init();
48
+ curl_setopt($tucurl, CURLOPT_URL, "{$this->apiEndpointUrl}?$query");
49
+ curl_setopt($tucurl, CURLOPT_SSL_VERIFYPEER, FALSE);
50
+ curl_setopt($tucurl, CURLOPT_RETURNTRANSFER, 1);
51
+ $tudata = curl_exec($tucurl);
52
+ try {
53
+ if (curl_errno($tucurl)) {
54
+ throw new Exception(curl_error($tucurl));
55
+ }
56
+ $dom = new DOMDocument();
57
+ $dom->loadXML($tudata);
58
+ $nodes = $dom->getElementsByTagName('result');
59
+ if (!$nodes || ($nodes->length == 0)) {
60
+ throw new Exception('Incorrect response from remote server');
61
+ }
62
+
63
+ if ($nodes->item(0)->nodeValue == 0) {
64
+ $nodes = $dom->getElementsByTagName('error');
65
+ throw new Exception($nodes->item(0)->nodeValue);
66
+ }
67
+ $justuno_conf = array();
68
+ $nodes = $dom->getElementsByTagName('guid');
69
+ if ($nodes && $nodes->length !== 0) {
70
+ $this->guid = $justuno_conf['guid'] = $nodes->item(0)->nodeValue;
71
+ }
72
+ $nodes = $dom->getElementsByTagName('embed');
73
+ if ($nodes && $nodes->length !== 0) {
74
+ $justuno_conf['embed'] = $nodes->item(0)->nodeValue;
75
+ }
76
+ $nodes = $dom->getElementsByTagName('conversion');
77
+ if ($nodes && $nodes->length !== 0) {
78
+ $justuno_conf['conversion'] = $nodes->item(0)->nodeValue;
79
+ }
80
+ curl_close($tucurl);
81
+ return $justuno_conf;
82
+ }
83
+ catch (Exception $e) {
84
+ curl_close($tucurl);
85
+ throw new JustunoAccessException('Request error: ' . $e->getMessage());
86
+ }
87
+
88
+ }
89
+
90
+ /**
91
+ * Get link to Jutsuno dashbord link using API
92
+ */
93
+ public function getDashboardLink() {
94
+ $params = array(
95
+ 'key'=>$this->apiKey,
96
+ 'email'=>$this->email,
97
+ 'domain'=>$this->domain,
98
+ 'action'=>'login',
99
+ 'guid'=>$this->guid
100
+ );
101
+
102
+ if(isset($this->password)){
103
+ $params['password'] = $this->password;
104
+ }
105
+ $query = http_build_query($params);
106
+ $tuCurl = curl_init();
107
+ curl_setopt($tuCurl, CURLOPT_URL, "{$this->apiEndpointUrl}?$query");
108
+ curl_setopt($tuCurl,CURLOPT_SSL_VERIFYPEER,false);
109
+ curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
110
+ $tuData = curl_exec($tuCurl);
111
+ try{
112
+ if(curl_errno($tuCurl)){
113
+ throw new Exception(curl_error($tuCurl));
114
+ }
115
+ $dom = new DOMDocument;
116
+ $dom->loadXML($tuData);
117
+ $nodes = $dom->getElementsByTagName('result');
118
+ if(!$nodes || $nodes->length == 0)
119
+ throw new Exception('Incorrect response from remote server');
120
+
121
+ if($nodes->item(0)->nodeValue == 0){
122
+ $nodes = $dom->getElementsByTagName('error');
123
+ throw new Exception($nodes->item(0)->nodeValue);
124
+ }
125
+ $nodes = $dom->getElementsByTagName('secure_login_url');
126
+ if($nodes && $nodes->length !== 0){
127
+ $secureLoginUrl = $nodes->item(0)->nodeValue;
128
+ }
129
+ curl_close($tuCurl);
130
+ return $secureLoginUrl;
131
+ }
132
+ catch(Exception $e){
133
+ curl_close($tuCurl);
134
+ throw new JustunoAccessException('Request error: '.$e->getMessage());
135
+ }
136
+ }
137
+ }
138
+
139
+
140
+ /**
141
+ * Exception child to throw.
142
+ */
143
+ class JustunoAccessException extends Exception {
144
+
145
+ }
app/code/community/Justuno/Social/controllers/Adminhtml/CustomController.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Justuno_Social_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ /*$this->loadLayout()
8
+ ->_setActiveMenu('mycustomtab')
9
+ ->_title($this->__('Index Action'));
10
+ */
11
+ Mage::getConfig()->saveConfig('justuno/account/embed', '', 'default', 1);
12
+ Mage::getConfig()->saveConfig('justuno/account/email', '', 'default', 0);
13
+ Mage::getConfig()->saveConfig('justuno/account/password', '', 'default', 0);
14
+ Mage::getConfig()->saveConfig('justuno/account/domain', '', 'default', 0);
15
+
16
+ Mage::getConfig()->saveConfig('justuno/register/embed', '', 'default', 0);
17
+ Mage::getConfig()->saveConfig('justuno/register/email', '', 'default', 0);
18
+ Mage::getConfig()->saveConfig('justuno/register/password', '', 'default', 0);
19
+ Mage::getConfig()->saveConfig('justuno/register/domain', '', 'default', 0);
20
+ Mage::getConfig()->saveConfig('justuno/register/phone', '', 'default', 0);
21
+
22
+ $url = Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/justuno");
23
+ $this->_redirect('adminhtml/system_config/edit/section/justuno');
24
+ //$this->renderLayout();
25
+ }
26
+
27
+ public function listAction()
28
+ {
29
+ $this->loadLayout()
30
+ ->_setActiveMenu('mycustomtab')
31
+ ->_title($this->__('List Action'));
32
+
33
+ // my stuff
34
+
35
+ $this->renderLayout();
36
+ }
37
+ }
app/code/community/Justuno/Social/etc/adminhtml.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <justuno translate="title" module="social">
12
+ <title>Justuno</title>
13
+ <sort_order>0</sort_order>
14
+ </justuno>
15
+ <dashboard translate="title" module="social">
16
+ <title>Dashboard</title>
17
+ <sort_order>1</sort_order>
18
+ </dashboard>
19
+ </children>
20
+ </config>
21
+ </children>
22
+ </system>
23
+ </children>
24
+ </admin>
25
+ </resources>
26
+ </acl>
27
+ </config>
app/code/community/Justuno/Social/etc/config.xml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Justuno_Social>
5
+ <version>1.0.3</version>
6
+ </Justuno_Social>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <social>
11
+ <class>Justuno_Social_Model</class>
12
+ <resourceModel>social_embed</resourceModel>
13
+ </social>
14
+ <social_embed>
15
+ <class>Justuno_Social_Model_Embed</class>
16
+ </social_embed>
17
+ </models>
18
+ <blocks>
19
+ <social>
20
+ <class>Justuno_Social_Block</class>
21
+ </social>
22
+ <social_domain>
23
+ <class>Justuno_Social_Block_Domain</class>
24
+ </social_domain>
25
+ <social_dashboard>
26
+ <class>Justuno_Social_Block_Dashboard</class>
27
+ </social_dashboard>
28
+ </blocks>
29
+ <helpers>
30
+ <social>
31
+ <class>Justuno_Social_Helper</class>
32
+ </social>
33
+ </helpers>
34
+ </global>
35
+ <adminhtml>
36
+ <acl>
37
+ <resources>
38
+ <all>
39
+ <title>Allow Everything</title>
40
+ </all>
41
+ <admin>
42
+ <children>
43
+ <system>
44
+ <children>
45
+ <config>
46
+ <children>
47
+ <justuno>
48
+ <title>Justuno</title>
49
+ </justuno>
50
+ </children>
51
+ </config>
52
+ </children>
53
+ </system>
54
+ </children>
55
+ </admin>
56
+ </resources>
57
+ </acl>
58
+ </adminhtml>
59
+ <frontend>
60
+ <layout>
61
+ <updates>
62
+ <social>
63
+ <file>justuno_social.xml</file>
64
+ </social>
65
+ </updates>
66
+ </layout>
67
+ </frontend>
68
+ <admin>
69
+ <routers>
70
+ <adminhtml>
71
+ <args>
72
+ <modules>
73
+ <foo_bar before="Mage_Adminhtml">Justuno_Social_Adminhtml</foo_bar>
74
+ </modules>
75
+ </args>
76
+ </adminhtml>
77
+ </routers>
78
+ </admin>
79
+ </config>
app/code/community/Justuno/Social/etc/system.xml ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <justuno translate="label">
5
+ <label>Justuno</label>
6
+ <sort_order>150</sort_order>
7
+ </justuno>
8
+ </tabs>
9
+ <sections>
10
+ <justuno translate="label" module="social">
11
+ <label>Account Settings</label>
12
+ <tab>justuno</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>0</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
+ <account translate="label">
20
+ <label>Connect Magento to existing Justuno Account</label>
21
+ <frontend_type>text</frontend_type>
22
+ <frontend_model>social/dashboard</frontend_model>
23
+ <sort_order>0</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
+ <fields>
28
+ <email translate="label">
29
+ <label>Enter your justuno account email:</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>0</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
+ <comment></comment>
36
+ </email>
37
+ <password translate="label">
38
+ <label>Enter your justuno account password:</label>
39
+ <frontend_type>password</frontend_type>
40
+ <sort_order>1</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
+ <comment></comment>
45
+ </password>
46
+ <forgetpassword translate="label">
47
+ <comment>
48
+ <model>social/adminhtml_comment</model>
49
+ </comment>
50
+ <frontend_type>hidden</frontend_type>
51
+ <sort_order>2</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </forgetpassword>
56
+ <domain translate="label">
57
+ <label></label>
58
+ <frontend_type>hidden</frontend_type>
59
+ <sort_order>3</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ <comment></comment>
64
+ </domain>
65
+ <embed translate="label">
66
+ <label></label>
67
+ <frontend_type>hidden</frontend_type>
68
+ <backend_model>social/embed</backend_model>
69
+ <sort_order>3</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ <comment></comment>
74
+ </embed>
75
+ </fields>
76
+ </account>
77
+
78
+ <register translate="label">
79
+ <label>Create New Justuno Account</label>
80
+ <frontend_type>text</frontend_type>
81
+ <frontend_model>social/dashboard1</frontend_model>
82
+ <sort_order>1</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ <fields>
87
+ <email translate="label">
88
+ <label>Enter an e-mail address:</label>
89
+ <frontend_type>text</frontend_type>
90
+ <sort_order>0</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ <comment></comment>
95
+ </email>
96
+ <phone translate="label">
97
+ <label>Enter your phone number:</label>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>3</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ <comment></comment>
104
+ </phone>
105
+ <password translate="label">
106
+ <label>Enter a password:</label>
107
+ <frontend_type>password</frontend_type>
108
+ <sort_order>1</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>1</show_in_store>
112
+ <comment></comment>
113
+ </password>
114
+ <domain translate="label">
115
+ <label>Enter your website domain:</label>
116
+ <frontend_type>text</frontend_type>
117
+ <sort_order>2</sort_order>
118
+ <show_in_default>1</show_in_default>
119
+ <show_in_website>1</show_in_website>
120
+ <show_in_store>1</show_in_store>
121
+ <comment></comment>
122
+ </domain>
123
+ <embed translate="label">
124
+ <label></label>
125
+ <frontend_type>hidden</frontend_type>
126
+ <backend_model>social/embed</backend_model>
127
+ <sort_order>3</sort_order>
128
+ <show_in_default>0</show_in_default>
129
+ <show_in_website>0</show_in_website>
130
+ <show_in_store>0</show_in_store>
131
+ <comment></comment>
132
+ </embed>
133
+ </fields>
134
+ </register>
135
+
136
+ <!--<dashboard translate="label">
137
+ <label>Set Up or Manage Account</label>
138
+ <frontend_type>text</frontend_type>
139
+ <sort_order>2</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>1</show_in_store>
143
+ <fields>
144
+ <dashboard translate="label">
145
+ <frontend_type>hidden</frontend_type>
146
+ <frontend_model>social/dashboard</frontend_model>
147
+ <sort_order>0</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ <comment></comment>
152
+ </dashboard>
153
+ </fields>
154
+ </dashboard>-->
155
+ </groups>
156
+
157
+
158
+ </justuno>
159
+ </sections>
160
+ <sections>
161
+ <dashboard translate="label" module="social">
162
+ <label>Dashboard</label>
163
+ <tab>justuno</tab>
164
+ <frontend_type>text</frontend_type>
165
+ <sort_order>0</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ <groups>
170
+ <dashboardlink translate="label">
171
+ <label>Dashboard</label>
172
+ <frontend_type>text</frontend_type>
173
+ <frontend_model>social/domain</frontend_model>
174
+ <sort_order>0</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>1</show_in_store>
178
+ </dashboardlink>
179
+ </groups>
180
+ </dashboard>
181
+ </sections>
182
+ </config>
app/design/frontend/base/default/layout/justuno_social.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="after_body_start">
5
+ <block type="social/widget" name="justuno_social" as="justuno_social" template="justuno_social/widget.phtml" />
6
+ </reference>
7
+ </default>
8
+ </layout>
app/design/frontend/base/default/template/justuno_social/widget.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Justuno Social plugin for Magento
4
+ *
5
+ * @category design
6
+ * @package base_default
7
+ * @author Justuno (http://www.justuno.com/)
8
+ * @copyright Copyright (c) 2013 Justuno (http://www.justuno.com/)
9
+ * @license Open Software License
10
+ */
11
+ ?>
12
+ <script>
13
+ <?php echo $this->getEmbed(); ?>
14
+
15
+ </script>
app/etc/modules/Justuno_Social.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @package Justuno_Social
5
+ */
6
+ -->
7
+ <config>
8
+ <modules>
9
+ <Justuno_Social>
10
+ <active>true</active>
11
+ <codePool>community</codePool>
12
+ <version>1.0.3</version>
13
+ </Justuno_Social>
14
+ </modules>
15
+ </config>
package.xml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Justuno_Social</name>
4
+ <version>1.0.3</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Convert website visitors into high quality fans, followers &amp; email subscribers with Justuno social offers.</summary>
10
+ <description>Justuno is the premier social marketing tool to convert website visitors to social and email leads via a simple instant offer widget on your site. In exchange for a coupon code, customers must either Facebook Like, Twitter Follow, Google+1, Join your mailing list or other available options all without ever having to leave your website. &#xD;
11
+ &lt;br /&gt;&lt;br /&gt;&#xD;
12
+ &lt;strong&gt;Key Features:&lt;/strong&gt;&lt;br /&gt;&#xD;
13
+ -Present instant offers in exchange for a social or email lead capture &lt;br /&gt;&#xD;
14
+ -Convert up to 3% of your daily website traffic&lt;br /&gt;&#xD;
15
+ -Easy to set-up and manage. No technical skills needed.&lt;br /&gt;&#xD;
16
+ -Available in any language&lt;br /&gt;&#xD;
17
+ &#xD;
18
+ &#xD;
19
+ To understand how Justuno works it&#x2019;s best to just see him in action ;) Please visit </description>
20
+ <notes>Stable release. Add auto logging in user via API</notes>
21
+ <authors><author><name>Justuno</name><user>MAG000180786</user><email>erik@justuno.com</email></author></authors>
22
+ <date>2013-10-16</date>
23
+ <time>13:49:14</time>
24
+ <contents>
25
+ <target name="magecommunity">
26
+ <dir name="Justuno">
27
+ <dir name="Social">
28
+ <dir name="Block">
29
+ <file name="Dashboard.php" hash="65c748c957380488645c75cbb292267a"/>
30
+ <file name="Dashboard1.php" hash=""/>
31
+ <file name="Domain.php" hash="d9375f0f7b4e9198793959a86e96d4de"/>
32
+ <file name="Widget.php" hash="5d61c43647ed55827acfd0bd3baed473"/>
33
+ </dir>
34
+ <dir name="Model">
35
+ <dir name="Adminhtml">
36
+ <file name="Comment.php" hash=""/>
37
+ </dir>
38
+ <file name="Embed.php" hash="c5a033a067c424ef17bcab29c192424c"/>
39
+ <file name="JustunoAccess.php" hash="092c586e980c5840c3db6775e260e93b"/>
40
+ </dir>
41
+ <dir name="Helper">
42
+ <file name="Data.php" hash=""/>
43
+ </dir>
44
+ <dir name="controllers">
45
+ <dir name="Adminhtml">
46
+ <file name="CustomController.php" hash=""/>
47
+ </dir>
48
+ </dir>
49
+ <dir name="etc">
50
+ <file name="adminhtml.xml" hash="798e1cb0f2843594e7b45d3601dfc6c4"/>
51
+ <file name="config.xml" hash="e82b6ecab3d744cb15a64e7170fb662c"/>
52
+ <file name="system.xml" hash="137c952fe96f7093a73e8144716107d5"/>
53
+ </dir>
54
+ </dir>
55
+ </dir>
56
+ </target>
57
+ <target name="magedesign">
58
+ <dir>
59
+ <dir name="frontend">
60
+ <dir name="base">
61
+ <dir name="default">
62
+ <dir name="layout">
63
+ <file name="justuno_social.xml" hash="d098f0a90ce0f311d0f233d416646183"/>
64
+ </dir>
65
+ <dir name="template">
66
+ <dir name="justuno_social">
67
+ <file name="widget.phtml" hash="7c6cbd4fe1df046562bc7bcc654f84d1"/>
68
+ </dir>
69
+ </dir>
70
+ </dir>
71
+ </dir>
72
+ </dir>
73
+ </dir>
74
+ </target>
75
+ <target name="mageetc">
76
+ <dir>
77
+ <dir name="modules">
78
+ <file name="Justuno_Social.xml" hash="936992f02fadf29a8de2af307d4c2dd0"/>
79
+ </dir>
80
+ </dir>
81
+ </target>
82
+ </contents>
83
+ <compatible/>
84
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
85
+ </package>