Version Notes
New instagram api support added
Download this release
Release Info
Developer | NEKLO |
Extension | neklo_instagram |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.1.1
- app/code/community/Neklo/Core/etc/config.xml +2 -2
- app/code/community/Neklo/Instagram/Block/Adminhtml/System/Config/Frontend/Oauth/Connect.php +3 -3
- app/code/community/Neklo/Instagram/Helper/Config.php +28 -0
- app/code/community/Neklo/Instagram/Helper/Data.php +1 -1
- app/code/community/Neklo/Instagram/controllers/Adminhtml/Neklo/Instagram/ApiController.php +1 -41
- app/code/community/Neklo/Instagram/controllers/Adminhtml/Neklo/Instagram/ConfigController.php +62 -0
- app/code/community/Neklo/Instagram/controllers/ApiController.php +87 -0
- app/code/community/Neklo/Instagram/etc/config.xml +10 -8
- app/design/adminhtml/default/default/layout/neklo/instagram.xml +0 -10
- app/design/adminhtml/default/default/template/neklo/instagram/system/config/oauth/connect.phtml +36 -10
- app/design/frontend/base/default/layout/neklo_instagram.xml +7 -0
- app/design/{adminhtml/default/default/template/neklo/instagram → frontend/base/default/template/neklo_instagram}/reload.phtml +0 -0
- package.xml +1 -1
app/code/community/Neklo/Core/etc/config.xml
CHANGED
@@ -36,9 +36,9 @@
|
|
36 |
<adminhtml>
|
37 |
<layout>
|
38 |
<updates>
|
39 |
-
<
|
40 |
<file>neklo/core.xml</file>
|
41 |
-
</
|
42 |
</updates>
|
43 |
</layout>
|
44 |
<translate>
|
36 |
<adminhtml>
|
37 |
<layout>
|
38 |
<updates>
|
39 |
+
<neklo_core module="Neklo_Core">
|
40 |
<file>neklo/core.xml</file>
|
41 |
+
</neklo_core>
|
42 |
</updates>
|
43 |
</layout>
|
44 |
<translate>
|
app/code/community/Neklo/Instagram/Block/Adminhtml/System/Config/Frontend/Oauth/Connect.php
CHANGED
@@ -40,9 +40,9 @@ class Neklo_Instagram_Block_Adminhtml_System_Config_Frontend_Oauth_Connect exten
|
|
40 |
return $this->_getApi()->getLoginUrl(array('basic', 'public_content'));
|
41 |
}
|
42 |
|
43 |
-
public function
|
44 |
{
|
45 |
-
return Mage::helper("adminhtml")->getUrl("adminhtml/
|
46 |
}
|
47 |
|
48 |
/**
|
@@ -56,7 +56,7 @@ class Neklo_Instagram_Block_Adminhtml_System_Config_Frontend_Oauth_Connect exten
|
|
56 |
array(
|
57 |
'apiKey' => $this->_getConfig()->getClientId(),
|
58 |
'apiSecret' => $this->_getConfig()->getClientSecret(),
|
59 |
-
'apiCallback' => $this->getRedirectUrl(),
|
60 |
)
|
61 |
);
|
62 |
}
|
40 |
return $this->_getApi()->getLoginUrl(array('basic', 'public_content'));
|
41 |
}
|
42 |
|
43 |
+
public function getSaveConfigUrl()
|
44 |
{
|
45 |
+
return Mage::helper("adminhtml")->getUrl("adminhtml/neklo_instagram_config/save");
|
46 |
}
|
47 |
|
48 |
/**
|
56 |
array(
|
57 |
'apiKey' => $this->_getConfig()->getClientId(),
|
58 |
'apiSecret' => $this->_getConfig()->getClientSecret(),
|
59 |
+
'apiCallback' => $this->_getConfig()->getRedirectUrl(),
|
60 |
)
|
61 |
);
|
62 |
}
|
app/code/community/Neklo/Instagram/Helper/Config.php
CHANGED
@@ -41,16 +41,44 @@ class Neklo_Instagram_Helper_Config extends Mage_Core_Helper_Abstract
|
|
41 |
return Mage::helper('core')->decrypt(Mage::getStoreConfig(self::API_ACCESS_TOKEN, $store));
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
public function getClientId($store = null)
|
45 |
{
|
46 |
return Mage::getStoreConfig(self::API_CLIENT_ID, $store);
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
public function getClientSecret($store = null)
|
50 |
{
|
51 |
return Mage::getStoreConfig(self::API_CLIENT_SECRET, $store);
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
protected function _saveConfig($path, $value, $scope = 'default', $scopeId = 0)
|
55 |
{
|
56 |
$configModel = Mage::getModel('core/config');
|
41 |
return Mage::helper('core')->decrypt(Mage::getStoreConfig(self::API_ACCESS_TOKEN, $store));
|
42 |
}
|
43 |
|
44 |
+
public function saveClientId($clientId)
|
45 |
+
{
|
46 |
+
$this->_saveConfig(self::API_CLIENT_ID, $clientId);
|
47 |
+
|
48 |
+
// reinit configuration cache
|
49 |
+
Mage::getConfig()->reinit();
|
50 |
+
}
|
51 |
+
|
52 |
public function getClientId($store = null)
|
53 |
{
|
54 |
return Mage::getStoreConfig(self::API_CLIENT_ID, $store);
|
55 |
}
|
56 |
|
57 |
+
public function saveClientSecret($clientSecret)
|
58 |
+
{
|
59 |
+
$this->_saveConfig(self::API_CLIENT_SECRET, $clientSecret);
|
60 |
+
|
61 |
+
// reinit configuration cache
|
62 |
+
Mage::getConfig()->reinit();
|
63 |
+
}
|
64 |
+
|
65 |
public function getClientSecret($store = null)
|
66 |
{
|
67 |
return Mage::getStoreConfig(self::API_CLIENT_SECRET, $store);
|
68 |
}
|
69 |
|
70 |
+
public function getRedirectUrl()
|
71 |
+
{
|
72 |
+
$url = Mage::getUrl("neklo_instagram/api/connect");
|
73 |
+
if (stripos($url, 'index.php')) {
|
74 |
+
return $url;
|
75 |
+
}
|
76 |
+
$baseUrl = Mage::getBaseUrl();
|
77 |
+
$baseUrl = str_ireplace('index.php', '', $baseUrl);
|
78 |
+
$url = str_ireplace($baseUrl, '', $url);
|
79 |
+
return $baseUrl . 'index.php/' . $url;
|
80 |
+
}
|
81 |
+
|
82 |
protected function _saveConfig($path, $value, $scope = 'default', $scopeId = 0)
|
83 |
{
|
84 |
$configModel = Mage::getModel('core/config');
|
app/code/community/Neklo/Instagram/Helper/Data.php
CHANGED
@@ -10,7 +10,7 @@ class Neklo_Instagram_Helper_Data extends Mage_Core_Helper_Abstract
|
|
10 |
return '';
|
11 |
}
|
12 |
$args[0] = 'Add <b>%s</b> to redirect urls for Instagram application';
|
13 |
-
$args[1] =
|
14 |
}
|
15 |
$expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->_getModuleName());
|
16 |
array_unshift($args, $expr);
|
10 |
return '';
|
11 |
}
|
12 |
$args[0] = 'Add <b>%s</b> to redirect urls for Instagram application';
|
13 |
+
$args[1] = $this->_getConfig()->getRedirectUrl();
|
14 |
}
|
15 |
$expr = new Mage_Core_Model_Translate_Expr(array_shift($args), $this->_getModuleName());
|
16 |
array_unshift($args, $expr);
|
app/code/community/Neklo/Instagram/controllers/Adminhtml/Neklo/Instagram/ApiController.php
CHANGED
@@ -4,41 +4,6 @@ class Neklo_Instagram_Adminhtml_Neklo_Instagram_ApiController extends Mage_Admin
|
|
4 |
{
|
5 |
protected $_api = null;
|
6 |
|
7 |
-
public function connectAction()
|
8 |
-
{
|
9 |
-
$code = $this->getRequest()->getParam('code', null);
|
10 |
-
if ($code === null) {
|
11 |
-
$this->_getConfig()->disconnect();
|
12 |
-
$this->loadLayout();
|
13 |
-
$this->renderLayout();
|
14 |
-
$this->_getSession()->addError(Mage::helper('neklo_instagram')->__('Incorrect Instagram authorization code.'));
|
15 |
-
return $this;
|
16 |
-
}
|
17 |
-
try {
|
18 |
-
$accessToken = $this->_getApi()->getOAuthToken($code, true);
|
19 |
-
} catch (Exception $e) {
|
20 |
-
$this->_getConfig()->disconnect();
|
21 |
-
$this->loadLayout();
|
22 |
-
$this->renderLayout();
|
23 |
-
$this->_getSession()->addError(Mage::helper('neklo_instagram')->__($e->getMessage()));
|
24 |
-
return $this;
|
25 |
-
}
|
26 |
-
|
27 |
-
if (!$accessToken) {
|
28 |
-
$this->_getConfig()->disconnect();
|
29 |
-
$this->loadLayout();
|
30 |
-
$this->renderLayout();
|
31 |
-
$this->_getSession()->addError(Mage::helper('neklo_instagram')->__('Incorrect Instagram authorization code.'));
|
32 |
-
return $this;
|
33 |
-
}
|
34 |
-
|
35 |
-
$this->_getConfig()->connect($accessToken);
|
36 |
-
$this->loadLayout();
|
37 |
-
$this->renderLayout();
|
38 |
-
$this->_getSession()->addSuccess(Mage::helper('neklo_instagram')->__('Instagram connect is successful.'));
|
39 |
-
return $this;
|
40 |
-
}
|
41 |
-
|
42 |
public function disconnectAction()
|
43 |
{
|
44 |
$this->_getConfig()->disconnect();
|
@@ -46,11 +11,6 @@ class Neklo_Instagram_Adminhtml_Neklo_Instagram_ApiController extends Mage_Admin
|
|
46 |
return $this->_redirect('adminhtml/system_config/edit', array('section' => 'neklo_instagram'));
|
47 |
}
|
48 |
|
49 |
-
public function getRedirectUrl()
|
50 |
-
{
|
51 |
-
return Mage::helper("adminhtml")->getUrl("adminhtml/neklo_instagram_api/connect");
|
52 |
-
}
|
53 |
-
|
54 |
/**
|
55 |
* @return Neklo_Instagram_Model_Instagram_Api
|
56 |
*/
|
@@ -62,7 +22,7 @@ class Neklo_Instagram_Adminhtml_Neklo_Instagram_ApiController extends Mage_Admin
|
|
62 |
array(
|
63 |
'apiKey' => $this->_getConfig()->getClientId(),
|
64 |
'apiSecret' => $this->_getConfig()->getClientSecret(),
|
65 |
-
'apiCallback' => $this->getRedirectUrl(),
|
66 |
)
|
67 |
);
|
68 |
}
|
4 |
{
|
5 |
protected $_api = null;
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
public function disconnectAction()
|
8 |
{
|
9 |
$this->_getConfig()->disconnect();
|
11 |
return $this->_redirect('adminhtml/system_config/edit', array('section' => 'neklo_instagram'));
|
12 |
}
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
* @return Neklo_Instagram_Model_Instagram_Api
|
16 |
*/
|
22 |
array(
|
23 |
'apiKey' => $this->_getConfig()->getClientId(),
|
24 |
'apiSecret' => $this->_getConfig()->getClientSecret(),
|
25 |
+
'apiCallback' => $this->_getConfig()->getRedirectUrl(),
|
26 |
)
|
27 |
);
|
28 |
}
|
app/code/community/Neklo/Instagram/controllers/Adminhtml/Neklo/Instagram/ConfigController.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Neklo_Instagram_Adminhtml_Neklo_Instagram_ConfigController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected $_api = null;
|
6 |
+
|
7 |
+
public function saveAction()
|
8 |
+
{
|
9 |
+
$result = array(
|
10 |
+
'success' => true,
|
11 |
+
'login_url' => null,
|
12 |
+
);
|
13 |
+
$clientId = $this->getRequest()->getParam('client_id', null);
|
14 |
+
$clientSecret = $this->getRequest()->getParam('client_secret', null);
|
15 |
+
|
16 |
+
try {
|
17 |
+
$this->_getConfig()->saveClientId($clientId);
|
18 |
+
$this->_getConfig()->saveClientSecret($clientSecret);
|
19 |
+
} catch (Exception $e) {
|
20 |
+
$result['success'] = false;
|
21 |
+
}
|
22 |
+
|
23 |
+
$result['login_url'] = $this->_getApi()->getLoginUrl(
|
24 |
+
array('basic', 'public_content')
|
25 |
+
);
|
26 |
+
|
27 |
+
$this->getResponse()->setBody(
|
28 |
+
Zend_Json::encode($result)
|
29 |
+
);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @return Neklo_Instagram_Model_Instagram_Api
|
34 |
+
*/
|
35 |
+
protected function _getApi()
|
36 |
+
{
|
37 |
+
if ($this->_api === null) {
|
38 |
+
$this->_api = $this->_api = Mage::getModel(
|
39 |
+
'neklo_instagram/instagram_api',
|
40 |
+
array(
|
41 |
+
'apiKey' => $this->_getConfig()->getClientId(),
|
42 |
+
'apiSecret' => $this->_getConfig()->getClientSecret(),
|
43 |
+
'apiCallback' => $this->_getConfig()->getRedirectUrl(),
|
44 |
+
)
|
45 |
+
);
|
46 |
+
}
|
47 |
+
return $this->_api;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @return Neklo_Instagram_Helper_Config
|
52 |
+
*/
|
53 |
+
protected function _getConfig()
|
54 |
+
{
|
55 |
+
return Mage::helper('neklo_instagram/config');
|
56 |
+
}
|
57 |
+
|
58 |
+
protected function _isAllowed()
|
59 |
+
{
|
60 |
+
return Mage::getSingleton('admin/session')->isAllowed('system/config/neklo_instagram');
|
61 |
+
}
|
62 |
+
}
|
app/code/community/Neklo/Instagram/controllers/ApiController.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Neklo_Instagram_ApiController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
protected $_api = null;
|
6 |
+
|
7 |
+
public function connectAction()
|
8 |
+
{
|
9 |
+
$code = $this->getRequest()->getParam('code', null);
|
10 |
+
if ($code === null) {
|
11 |
+
$this->loadLayout();
|
12 |
+
$this->renderLayout();
|
13 |
+
$this->_getAdminSession()->addError(
|
14 |
+
Mage::helper('neklo_instagram')->__('Incorrect Instagram authorization code.')
|
15 |
+
);
|
16 |
+
return $this;
|
17 |
+
}
|
18 |
+
|
19 |
+
try {
|
20 |
+
$accessToken = $this->_getApi()->getOAuthToken($code);
|
21 |
+
if ($accessToken->code === 400) {
|
22 |
+
throw new Exception($accessToken->error_message);
|
23 |
+
}
|
24 |
+
$accessToken = $accessToken->access_token;
|
25 |
+
} catch (Exception $e) {
|
26 |
+
$this->loadLayout();
|
27 |
+
$this->renderLayout();
|
28 |
+
$this->_getAdminSession()->addError(
|
29 |
+
Mage::helper('neklo_instagram')->__($e->getMessage())
|
30 |
+
);
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
if (!$accessToken) {
|
35 |
+
$this->loadLayout();
|
36 |
+
$this->renderLayout();
|
37 |
+
$this->_getAdminSession()->addError(
|
38 |
+
Mage::helper('neklo_instagram')->__('Incorrect Instagram authorization code.')
|
39 |
+
);
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
$this->_getConfig()->connect($accessToken);
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
$this->_getAdminSession()->addSuccess(
|
47 |
+
Mage::helper('neklo_instagram')->__('Instagram connect is successful.')
|
48 |
+
);
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @return Neklo_Instagram_Model_Instagram_Api
|
54 |
+
*/
|
55 |
+
protected function _getApi()
|
56 |
+
{
|
57 |
+
if ($this->_api === null) {
|
58 |
+
$this->_api = $this->_api = Mage::getModel(
|
59 |
+
'neklo_instagram/instagram_api',
|
60 |
+
array(
|
61 |
+
'apiKey' => $this->_getConfig()->getClientId(),
|
62 |
+
'apiSecret' => $this->_getConfig()->getClientSecret(),
|
63 |
+
'apiCallback' => $this->_getConfig()->getRedirectUrl(),
|
64 |
+
)
|
65 |
+
);
|
66 |
+
}
|
67 |
+
return $this->_api;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @return Neklo_Instagram_Helper_Config
|
72 |
+
*/
|
73 |
+
protected function _getConfig()
|
74 |
+
{
|
75 |
+
return Mage::helper('neklo_instagram/config');
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Retrieve adminhtml session model object
|
80 |
+
*
|
81 |
+
* @return Mage_Adminhtml_Model_Session
|
82 |
+
*/
|
83 |
+
protected function _getAdminSession()
|
84 |
+
{
|
85 |
+
return Mage::getSingleton('adminhtml/session');
|
86 |
+
}
|
87 |
+
}
|
app/code/community/Neklo/Instagram/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Neklo_Instagram>
|
5 |
-
<version>1.1.
|
6 |
</Neklo_Instagram>
|
7 |
</modules>
|
8 |
<admin>
|
@@ -17,6 +17,15 @@
|
|
17 |
</routers>
|
18 |
</admin>
|
19 |
<frontend>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
<layout>
|
21 |
<updates>
|
22 |
<neklo_instagram>
|
@@ -26,13 +35,6 @@
|
|
26 |
</layout>
|
27 |
</frontend>
|
28 |
<adminhtml>
|
29 |
-
<layout>
|
30 |
-
<updates>
|
31 |
-
<neklo_instagram>
|
32 |
-
<file>neklo/instagram.xml</file>
|
33 |
-
</neklo_instagram>
|
34 |
-
</updates>
|
35 |
-
</layout>
|
36 |
<translate>
|
37 |
<modules>
|
38 |
<Neklo_Instagram>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Neklo_Instagram>
|
5 |
+
<version>1.1.1</version>
|
6 |
</Neklo_Instagram>
|
7 |
</modules>
|
8 |
<admin>
|
17 |
</routers>
|
18 |
</admin>
|
19 |
<frontend>
|
20 |
+
<routers>
|
21 |
+
<neklo_instagram>
|
22 |
+
<use>standard</use>
|
23 |
+
<args>
|
24 |
+
<module>Neklo_Instagram</module>
|
25 |
+
<frontName>neklo_instagram</frontName>
|
26 |
+
</args>
|
27 |
+
</neklo_instagram>
|
28 |
+
</routers>
|
29 |
<layout>
|
30 |
<updates>
|
31 |
<neklo_instagram>
|
35 |
</layout>
|
36 |
</frontend>
|
37 |
<adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
<translate>
|
39 |
<modules>
|
40 |
<Neklo_Instagram>
|
app/design/adminhtml/default/default/layout/neklo/instagram.xml
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="1.0.0">
|
3 |
-
<adminhtml_neklo_instagram_api_connect>
|
4 |
-
<reference name="root">
|
5 |
-
<action method="setTemplate">
|
6 |
-
<template>neklo/instagram/reload.phtml</template>
|
7 |
-
</action>
|
8 |
-
</reference>
|
9 |
-
</adminhtml_neklo_instagram_api_connect>
|
10 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/neklo/instagram/system/config/oauth/connect.phtml
CHANGED
@@ -1,19 +1,45 @@
|
|
1 |
-
<?php /* @var $this
|
2 |
<?php echo $this->getButtonHtml(); ?>
|
3 |
<script type="text/javascript">
|
4 |
-
var popupWidth = 640;
|
5 |
-
var popupHeight = 560;
|
6 |
-
var popupLeftOffset = screen.width / 2 - 640 / 2;
|
7 |
-
var popupTopOffset = screen.height / 2 - 480 / 2;
|
8 |
-
|
9 |
var button = $('<?php echo $this->getButton()->getId(); ?>');
|
10 |
if (button) {
|
11 |
Event.observe(button, 'click', function(e) {
|
12 |
Event.stop(e);
|
13 |
-
|
14 |
-
|
15 |
-
'
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
);
|
18 |
});
|
19 |
}
|
1 |
+
<?php /* @var $this Neklo_Instagram_Block_Adminhtml_System_Config_Frontend_Oauth_Connect */ ?>
|
2 |
<?php echo $this->getButtonHtml(); ?>
|
3 |
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
|
4 |
var button = $('<?php echo $this->getButton()->getId(); ?>');
|
5 |
if (button) {
|
6 |
Event.observe(button, 'click', function(e) {
|
7 |
Event.stop(e);
|
8 |
+
|
9 |
+
new Ajax.Request(
|
10 |
+
'<?php echo $this->getSaveConfigUrl() ?>',
|
11 |
+
{
|
12 |
+
parameters: {
|
13 |
+
'client_id' : $('neklo_instagram_api_client_id').getValue(),
|
14 |
+
'client_secret' : $('neklo_instagram_api_client_secret').getValue()
|
15 |
+
},
|
16 |
+
method: 'POST',
|
17 |
+
onSuccess: function(transport) {
|
18 |
+
var response = null;
|
19 |
+
try {
|
20 |
+
response = eval('(' + transport.responseText + ')');
|
21 |
+
} catch (exception) {
|
22 |
+
response = {};
|
23 |
+
}
|
24 |
+
|
25 |
+
if (!response.success || !response.login_url) {
|
26 |
+
location.reload();
|
27 |
+
} else {
|
28 |
+
var popupWidth = 640;
|
29 |
+
var popupHeight = 560;
|
30 |
+
var popupLeftOffset = screen.width / 2 - 640 / 2;
|
31 |
+
var popupTopOffset = screen.height / 2 - 480 / 2;
|
32 |
+
popWin(
|
33 |
+
response.login_url,
|
34 |
+
'instagram_oauth',
|
35 |
+
'width=' + popupWidth + ',height=' + popupHeight + ',left=' + popupLeftOffset + ',top=' + popupTopOffset + ',location=no,status=no,menubar=no,toolbar=no,resizable=no,scrollbars=no'
|
36 |
+
);
|
37 |
+
}
|
38 |
+
},
|
39 |
+
onFailure: function () {
|
40 |
+
location.reload();
|
41 |
+
}
|
42 |
+
}
|
43 |
);
|
44 |
});
|
45 |
}
|
app/design/frontend/base/default/layout/neklo_instagram.xml
CHANGED
@@ -5,4 +5,11 @@
|
|
5 |
<action method="addCss"><stylesheet>neklo/instagram/css/style.css</stylesheet></action>
|
6 |
</reference>
|
7 |
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
</layout>
|
5 |
<action method="addCss"><stylesheet>neklo/instagram/css/style.css</stylesheet></action>
|
6 |
</reference>
|
7 |
</default>
|
8 |
+
<neklo_instagram_api_connect>
|
9 |
+
<reference name="root">
|
10 |
+
<action method="setTemplate">
|
11 |
+
<template>neklo_instagram/reload.phtml</template>
|
12 |
+
</action>
|
13 |
+
</reference>
|
14 |
+
</neklo_instagram_api_connect>
|
15 |
</layout>
|
app/design/{adminhtml/default/default/template/neklo/instagram → frontend/base/default/template/neklo_instagram}/reload.phtml
RENAMED
File without changes
|
package.xml
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>Neklo_Instagram</name><version>1.1.
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>Neklo_Instagram</name><version>1.1.1</version><stability>stable</stability><license>License</license><channel>community</channel><extends></extends><summary>API Changes</summary><description>Free Magento Community extension that adds Instagram to your online store.</description><notes>New instagram api support added</notes><authors><author><name>NEKLO</name><user>NEKLO</user><email>info@neklo.com</email></author></authors><date>2016-06-15</date><time>6:45:00</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Neklo_Core.xml" hash="335032ff690c5272626dca9106642680"/><file name="Neklo_Instagram.xml" hash="067c0c1356e12cb92baa0661d5be032f"/></dir></dir><dir name="code"><dir name="community"><dir name="Neklo"><dir name="Instagram"><dir name="etc"><file name="adminhtml.xml" hash="61d458d177562d7d0911574267601ffa"/><file name="config.xml" hash="5bb908ecc5c4f9c84d9bb91dc91347f2"/><file name="system.xml" hash="8a1fc85d0a95df0a883c8a27ee1772e7"/><file name="widget.xml" hash="bc457cb843224b227402220fa130d087"/></dir><dir name="controllers"><file name="ApiController.php" hash="25968365e97815bdf050656e8265a66c"/><dir name="Adminhtml"><dir name="Neklo"><dir name="Instagram"><file name="ApiController.php" hash="a2d181b7295d832d574684a38136a5cb"/><file name="ConfigController.php" hash="f318dd4d25cda0d4af1ad741e1ce1334"/></dir></dir></dir></dir><dir name="Block"><dir name="Widget"><file name="Feed.php" hash="f7d2e2b4118d1da76cc0ff0b03a90a85"/></dir><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Frontend"><file name="Oauth.php" hash="f31ead7dc8bfc0041b0a9983eec564e0"/><file name="Status.php" hash="8e1250a678b93d1bef87094ff87b6505"/><dir name="Oauth"><file name="Connect.php" hash="782b3c2013d0997b8e71299ec2f96846"/><file name="Disconnect.php" hash="6bd4158fab8ecf9f437d3feacd0881ce"/></dir></dir></dir></dir></dir></dir><dir name="sql"><dir name="neklo_instagram_setup"><file name="mysql4-install-1.0.0.php" hash="a6857b5b44abb5870ec20455a8e204d9"/></dir></dir><dir name="Model"><file name="Instagram.php" hash="b5ec40e45e05f713459c3f494dde1716"/><dir name="Source"><file name="Mode.php" hash="389e64a529cb0763c88f6a95e18d9aa2"/></dir><dir name="Instagram"><file name="Api.php" hash="490df368f82d4169056dd773ac2738f4"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Empty.php" hash="f9c2bb9852a805356c9240ccd5a8a1ef"/></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="b29ee6fe8176822968d4a2841edd0717"/><file name="Data.php" hash="a7fa42ab27dd29de2e68ac55d434c1f4"/></dir></dir><dir name="Core"><dir name="etc"><file name="adminhtml.xml" hash="68b00ad4118462d74b0c0a7126063462"/><file name="config.xml" hash="dba97e16300307cae724d784309ec72d"/><file name="system.xml" hash="f9ee62f79b22584cc6180ec5e8049539"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Neklo"><dir name="Core"><file name="ContactController.php" hash="fe735a9c3c0ad9c4ecb88edd009059a9"/><file name="NewsletterController.php" hash="b9342c80bf94c29a463251b1c7b02705"/></dir></dir></dir></dir><dir name="Block"><dir name="System"><file name="Contact.php" hash="a0e89ca48de64bb8526c35598f99802b"/><file name="Extension.php" hash="8cd6609bd4f00bf8a8f5913d20e98e65"/><dir name="Contact"><file name="Header.php" hash="a6c4f8dbf002a0d2f6be0ea37445a562"/><file name="Send.php" hash="333d3059033faa826ef3781946676b16"/><dir name="Send"><file name="Button.php" hash="c94e2ae59246a968d7eb2e89e63485c8"/></dir></dir><dir name="Newsletter"><file name="Subscribe.php" hash="1015b8e49758e40c829667e94bb06220"/><dir name="Subscribe"><file name="Button.php" hash="98162d3c3280bdc3da75c90c45fc9500"/></dir></dir><dir name="Extension"><file name="List.php" hash="0006ff459c6b19de9349fa31c8be6b2b"/></dir></dir></dir><dir name="Model"><file name="Feed.php" hash="b5e0d2343b2c9db1f4d86ca0e8b3a922"/><file name="Observer.php" hash="dfc8c917e3f3882d1d99c734831c6e0b"/><dir name="Source"><file name="Reason.php" hash="02eb3c4cfe3433e5a8194862aef636c4"/><dir name="Subscription"><file name="Type.php" hash="616c3f7e7e4ebe3e42e16d54d159d378"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><file name="Empty.php" hash="2af2d53c7c56b9ea4a148a2862da224b"/></dir></dir></dir><dir name="Feed"><file name="Extension.php" hash="1ff201b02db7827df350b11c19902fa2"/></dir></dir><dir name="Helper"><file name="Config.php" hash="42eff18ca97b961e1186a790abcb8690"/><file name="Data.php" hash="5492cb13c72b737d85e9009f0f623336"/><file name="Extension.php" hash="c0c987bd848e5270ec31544460438eab"/></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="neklo"><file name="core.xml" hash="8851b2c111c8e0745fb78af2bb57e6a6"/></dir></dir><dir name="template"><dir name="neklo"><dir name="core"><dir name="system"><dir name="contact"><file name="button.phtml" hash="f7b5f21ddb974aa32c888c29f3057d18"/><file name="header.phtml" hash="3c0a401955a9b2bac799aa65b5bf7a81"/></dir><dir name="extension"><file name="list.phtml" hash="29378800cc0a7488badb2698a02220d7"/></dir><dir name="subscribe"><file name="button.phtml" hash="865b84befba4d00e6a1e4de2b989776e"/></dir></dir></dir><dir name="instagram"><dir name="system"><dir name="config"><dir name="oauth"><file name="connect.phtml" hash="d07f6c04918cc87e4a1da2975e506367"/><file name="disconnect.phtml" hash="f43c3861f99228fef4618d63997f02f1"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="neklo_instagram.xml" hash="2403395d9fc13fd5461071fd490625ba"/></dir><dir name="template"><dir name="neklo_instagram"><file name="reload.phtml" hash="61baa41a07077596ee66bcfe01d6bad6"/><dir name="widget"><file name="feed.phtml" hash="ffc05dfd132f1cb2334d724b205e8e19"/></dir></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><file name="Neklo_Core.csv" hash="c6abfbb8be878de9c02339e2ecfc4e16"/><file name="Neklo_Instagram.csv" hash="dcead4bc71dfaaceb20875ae801a63b2"/></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="neklo"><dir name="core"><dir name="images"><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/></dir><dir name="css"><file name="style.css" hash="77e35507d6f2e748afc08f11f322120d"/></dir></dir><dir name="instagram"><dir name="css"><file name="styles.css" hash="df91963d1eedebd6d4e9d0f1619b784b"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="neklo"><dir name="instagram"><dir name="sass"><file name="style.scss" hash="12dd85564e0664258ee1ff950276adab"/><dir name="mixin"><file name="_mixin.scss" hash="d5c2ae437ecf2c7f23fe5823563acf45"/></dir></dir><dir name="css"><file name="style.css" hash="7b2330ee08465bc44daa82263cee7c9a"/></dir></dir></dir></dir></dir></dir></dir></target></contents></package>
|