Version Notes
0.1.0
Download this release
Release Info
Developer | Nick |
Extension | ts_core_extension |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Templatestudio/Core/Block/Adminhtml/System/Config/Form/Field/Array/Abstract.php +31 -0
- app/code/local/Templatestudio/Core/Block/Adminhtml/System/Config/Form/Field/Version.php +37 -0
- app/code/local/Templatestudio/Core/Block/Adminhtml/System/Config/Form/Fieldset/Templatestudio/Extensions.php +120 -0
- app/code/local/Templatestudio/Core/Helper/Abstract.php +73 -0
- app/code/local/Templatestudio/Core/Helper/Data.php +225 -0
- app/code/local/Templatestudio/Core/Model/Config/Abstract.php +183 -0
- app/code/local/Templatestudio/Core/Model/Extension.php +189 -0
- app/code/local/Templatestudio/Core/Model/Feed.php +37 -0
- app/code/local/Templatestudio/Core/etc/adminhtml.xml +31 -0
- app/code/local/Templatestudio/Core/etc/config.xml +89 -0
- app/code/local/Templatestudio/Core/etc/system.xml +55 -0
- app/design/adminhtml/default/default/layout/templatestudio/core.xml +12 -0
- app/etc/modules/Templatestudio_Core.xml +12 -0
- app/locale/en_US/Templatestudio_Core.csv +10 -0
- package.xml +22 -0
- skin/adminhtml/default/default/templatestudio/css/core.css +6 -0
- skin/adminhtml/default/default/templatestudio/images/bad.gif +0 -0
- skin/adminhtml/default/default/templatestudio/images/logo-core-tab.gif +0 -0
- skin/adminhtml/default/default/templatestudio/images/ok.gif +0 -0
- skin/adminhtml/default/default/templatestudio/images/templatestudio-quote.jpg +0 -0
- skin/adminhtml/default/default/templatestudio/images/update.gif +0 -0
app/code/local/Templatestudio/Core/Block/Adminhtml/System/Config/Form/Field/Array/Abstract.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author TemplateStudio UK
|
5 |
+
*/
|
6 |
+
|
7 |
+
abstract class Templatestudio_Core_Block_Adminhtml_System_Config_Form_Field_Array_Abstract extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Render block HTML
|
11 |
+
*
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
protected function _toHtml()
|
15 |
+
{
|
16 |
+
$html = parent::_toHtml();
|
17 |
+
|
18 |
+
if ( ! empty($html))
|
19 |
+
{
|
20 |
+
if (is_null($this->_frameOpenTag))
|
21 |
+
{
|
22 |
+
$this->setFrameTags('div');
|
23 |
+
}
|
24 |
+
|
25 |
+
$html = '<' . $this->_frameOpenTag . ' id="' . $this->getElement()->getId() . '">'
|
26 |
+
. $html . '</' . $this->_frameCloseTag . '>';
|
27 |
+
}
|
28 |
+
|
29 |
+
return $html;
|
30 |
+
}
|
31 |
+
}
|
app/code/local/Templatestudio/Core/Block/Adminhtml/System/Config/Form/Field/Version.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author TemplateStudio UK
|
5 |
+
*/
|
6 |
+
|
7 |
+
class Templatestudio_Core_Block_Adminhtml_System_Config_Form_Field_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Get element html
|
11 |
+
*
|
12 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
$element->setReadonly(TRUE, TRUE)
|
18 |
+
->setValue($this->_getVersion());
|
19 |
+
|
20 |
+
if ('note' === $element->getType())
|
21 |
+
{
|
22 |
+
$element->setText(
|
23 |
+
$element->getValue()
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
return parent::_getElementHtml($element);
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _getVersion()
|
31 |
+
{
|
32 |
+
return Mage::getConfig()
|
33 |
+
->getModuleConfig($this->getModuleName())
|
34 |
+
->version
|
35 |
+
->__toString();
|
36 |
+
}
|
37 |
+
}
|
app/code/local/Templatestudio/Core/Block/Adminhtml/System/Config/Form/Fieldset/Templatestudio/Extensions.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author Templatestudio UK
|
5 |
+
*/
|
6 |
+
|
7 |
+
class Templatestudio_Core_Block_Adminhtml_System_Config_Form_Fieldset_Templatestudio_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Render element
|
11 |
+
*
|
12 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
$modules = $this->helper('tscore')->getExtensions();
|
18 |
+
$modulesData = @unserialize(Mage::app()->loadCache(Templatestudio_Core_Model_Extension::CACHE_KEY));
|
19 |
+
$fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
20 |
+
|
21 |
+
$fieldRenderer->setForm($element->getForm());
|
22 |
+
$fieldRenderer->setConfigData($element->getConfigData());
|
23 |
+
|
24 |
+
if ( ! empty($modules))
|
25 |
+
{
|
26 |
+
foreach ($modules as $moduleName => $moduleConfig)
|
27 |
+
{
|
28 |
+
$label = ltrim(strstr($moduleName, '_'), '_');
|
29 |
+
$version = ! empty($moduleConfig['version']) ? $moduleConfig['version'] : '—';
|
30 |
+
$hasUpdate = FALSE;
|
31 |
+
$warning = FALSE;
|
32 |
+
|
33 |
+
if (is_array($modulesData) AND key_exists($moduleName, $modulesData))
|
34 |
+
{
|
35 |
+
$module = $modulesData[$moduleName];
|
36 |
+
|
37 |
+
if ( ! empty($module['display_name']))
|
38 |
+
{
|
39 |
+
$label = $module['display_name'];
|
40 |
+
}
|
41 |
+
elseif ( ! empty($module['name']))
|
42 |
+
{
|
43 |
+
$label = $module['name'];
|
44 |
+
}
|
45 |
+
|
46 |
+
if ( ! empty($module['url']))
|
47 |
+
{
|
48 |
+
$label = '<a href="' . $module['url'] . '" title="' . $label . '" onclick="this.target=\'_blank\'">' . $label . '</a>';
|
49 |
+
}
|
50 |
+
elseif ($this->helper('tscore')->getDeveloperUrl())
|
51 |
+
{
|
52 |
+
$label = '<a href="' . $this->helper('tscore')->getDeveloperUrl() . '" title="' . $label . '" onclick="this.target=\'_blank\'">' . $label . '</a>';
|
53 |
+
}
|
54 |
+
|
55 |
+
if ( ! empty($moduleConfig['version']) AND ! empty($module['version']))
|
56 |
+
{
|
57 |
+
$hasUpdate = version_compare($moduleConfig['version'], $module['version'], 'gt');
|
58 |
+
}
|
59 |
+
|
60 |
+
if ( ! empty($modulConfig['platform']))
|
61 |
+
{
|
62 |
+
$warning = $this->helper('tscore')->getCurrentPlatform() !== strtolower(trim($modulConfig['platform']));
|
63 |
+
}
|
64 |
+
}
|
65 |
+
elseif ($this->helper('tscore')->getDeveloperUrl())
|
66 |
+
{
|
67 |
+
$label = '<a href="' . $this->helper('tscore')->getDeveloperUrl() . '" title="' . $label . '" onclick="this.target=\'_blank\'">' . $label . '</a>';
|
68 |
+
}
|
69 |
+
|
70 |
+
if (TRUE === $warning)
|
71 |
+
{
|
72 |
+
$labelNotification = '<img src="' . $this->getSkinUrl('templatestudio/images/bad.gif') . '" alt="' . $this->__('Wrong extension platform') . '" title="' . $this->__('Wrong extension platform') . '"/>';
|
73 |
+
}
|
74 |
+
else
|
75 |
+
{
|
76 |
+
$labelNotification = '<img src="' . $this->getSkinUrl('templatestudio/images/ok.gif') . '" alt="' . $this->__('Installed') . '" title="' . $this->__('Installed') . '"/>';
|
77 |
+
}
|
78 |
+
|
79 |
+
if (TRUE === $hasUpdate)
|
80 |
+
{
|
81 |
+
$labelNotification .= '<img src="' . $this->getSkinUrl('templatestudio/images/update.gif') . '" alt="' . $this->__('Update available') . '" title="' . $this->__("Update available") . '"/>';
|
82 |
+
}
|
83 |
+
|
84 |
+
$element->addField($moduleName, 'note', array(
|
85 |
+
'label' => $labelNotification . $label,
|
86 |
+
'text' => $version
|
87 |
+
))
|
88 |
+
->setRenderer($fieldRenderer);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
else
|
92 |
+
{
|
93 |
+
$element->addField('no-extensions', 'note', array(
|
94 |
+
'label' => '',
|
95 |
+
'text' => $this->__('There are no TemplateStudio extensions installed.')
|
96 |
+
))
|
97 |
+
->setRenderer($fieldRenderer);
|
98 |
+
}
|
99 |
+
|
100 |
+
return parent::render($element);
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Return header html for fieldset
|
105 |
+
*
|
106 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
protected function _getHeaderHtml($element)
|
110 |
+
{
|
111 |
+
$html = parent::_getHeaderHtml($element);
|
112 |
+
|
113 |
+
$html .= '
|
114 |
+
<a id="templatestudio-core-quote" href="' . $this->helper('tscore')->getQuoteUrl() . '" title="' . $this->__('Get in touch') . '" target="_blank">
|
115 |
+
<img src="' . $this->getSkinUrl('templatestudio/images/templatestudio-quote.jpg') . '" alt="' . $this->__('Get in touch') . '" />
|
116 |
+
</a>';
|
117 |
+
|
118 |
+
return $html;
|
119 |
+
}
|
120 |
+
}
|
app/code/local/Templatestudio/Core/Helper/Abstract.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author TemplateStudio UK
|
4 |
+
*/
|
5 |
+
|
6 |
+
abstract class Templatestudio_Core_Helper_Abstract extends Mage_Core_Helper_Abstract
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* Section Name
|
10 |
+
*
|
11 |
+
* @var string|null
|
12 |
+
*/
|
13 |
+
protected $_section;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get store config
|
17 |
+
*
|
18 |
+
* @param string $node Optional
|
19 |
+
* @param mixed $store Optional
|
20 |
+
* @return string|array|null
|
21 |
+
*/
|
22 |
+
public function getConfigData($node = NULL, $store = NULL)
|
23 |
+
{
|
24 |
+
if (1 < substr_count($node, '/'))
|
25 |
+
{
|
26 |
+
return Mage::getStoreConfig($node, $store);
|
27 |
+
}
|
28 |
+
|
29 |
+
if (is_null($this->_section))
|
30 |
+
{
|
31 |
+
return Mage::getStoreConfig($node, $store);
|
32 |
+
}
|
33 |
+
|
34 |
+
if ( ! is_null($node))
|
35 |
+
{
|
36 |
+
return Mage::getStoreConfig($this->_section . '/' . $node, $store);
|
37 |
+
}
|
38 |
+
|
39 |
+
return Mage::getStoreConfig($this->_section, $store);
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get store config flag
|
44 |
+
*
|
45 |
+
* @param string $node
|
46 |
+
* @param mixed $store Optional
|
47 |
+
* @return bool
|
48 |
+
*/
|
49 |
+
public function getConfigFlag($node, $store = NULL)
|
50 |
+
{
|
51 |
+
if (1 < substr_count($node, '/'))
|
52 |
+
{
|
53 |
+
return Mage::getStoreConfigFlag($node, $store);
|
54 |
+
}
|
55 |
+
|
56 |
+
if (is_null($this->_section))
|
57 |
+
{
|
58 |
+
return Mage::getStoreConfigFlag($node, $store);
|
59 |
+
}
|
60 |
+
|
61 |
+
return Mage::getStoreConfigFlag($this->_section . '/' . $node, $store);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get section
|
66 |
+
*
|
67 |
+
* @return string|null
|
68 |
+
*/
|
69 |
+
public function getSection()
|
70 |
+
{
|
71 |
+
return $this->_section;
|
72 |
+
}
|
73 |
+
}
|
app/code/local/Templatestudio/Core/Helper/Data.php
ADDED
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author TemplateStudio UK
|
5 |
+
*/
|
6 |
+
|
7 |
+
class Templatestudio_Core_Helper_Data extends Mage_Core_Helper_Abstract
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Developer URL
|
11 |
+
*/
|
12 |
+
const VENDOR_URL = 'http://www.templatestudio.com/';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Vendor URLs
|
16 |
+
*/
|
17 |
+
protected $_vendorUrl;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Magento platform/edition abbreviations
|
21 |
+
*
|
22 |
+
* @return array|null
|
23 |
+
*/
|
24 |
+
static protected $_platforms;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Extensions list
|
28 |
+
*
|
29 |
+
* @return array|null
|
30 |
+
*/
|
31 |
+
protected $_extensions;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Retrieve Developer/Vendor URL
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
public function getDeveloperUrl()
|
39 |
+
{
|
40 |
+
$vendorUrl = $this->getUrl('vendor');
|
41 |
+
|
42 |
+
if (! empty($vendorUrl))
|
43 |
+
{
|
44 |
+
return $vendorUrl;
|
45 |
+
}
|
46 |
+
|
47 |
+
return self::VENDOR_URL;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Retrieve notification feed URL
|
52 |
+
*
|
53 |
+
* @return string|null
|
54 |
+
*/
|
55 |
+
public function getNotificationFeedUrl()
|
56 |
+
{
|
57 |
+
return $this->getUrl('notification');
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Retrieve extensions URL
|
62 |
+
*
|
63 |
+
* @return string|null
|
64 |
+
*/
|
65 |
+
public function getExtensionUrl()
|
66 |
+
{
|
67 |
+
return $this->getUrl('extension');
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Retrieve quote URL
|
72 |
+
*
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
public function getQuoteUrl()
|
76 |
+
{
|
77 |
+
$quoteUrl = $this->getUrl('quote');
|
78 |
+
|
79 |
+
if (empty($quoteUrl))
|
80 |
+
{
|
81 |
+
$quoteUrl = self::VENDOR_URL;
|
82 |
+
}
|
83 |
+
|
84 |
+
return $quoteUrl;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Retrieve vendor URLs
|
89 |
+
*
|
90 |
+
* @return array|null
|
91 |
+
*/
|
92 |
+
public function getVendorUrls()
|
93 |
+
{
|
94 |
+
if (is_null($this->_vendorUrl))
|
95 |
+
{
|
96 |
+
$this->_vendorUrl = Mage::getConfig()->getNode('global/tscore/url')
|
97 |
+
->asCanonicalArray();
|
98 |
+
|
99 |
+
if ( ! empty($this->_vendorUrl) AND is_array($this->_vendorUrl))
|
100 |
+
{
|
101 |
+
foreach ($this->_vendorUrl as $type => $url)
|
102 |
+
{
|
103 |
+
$url = parse_url($url);
|
104 |
+
|
105 |
+
if ( ! $url OR ! isset($url['scheme']))
|
106 |
+
{
|
107 |
+
$this->_vendorUrl[$type] = 'http://' . $this->_vendorUrl[$type];
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
return $this->_vendorUrl;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Retrieve url
|
118 |
+
*
|
119 |
+
* @param string $type
|
120 |
+
* @return null|string
|
121 |
+
*/
|
122 |
+
public function getUrl($type)
|
123 |
+
{
|
124 |
+
$this->getVendorUrls();
|
125 |
+
|
126 |
+
if (is_array($this->_vendorUrl) AND key_exists($type, $this->_vendorUrl))
|
127 |
+
{
|
128 |
+
return $this->_vendorUrl[$type];
|
129 |
+
}
|
130 |
+
|
131 |
+
return NULL;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Retrieve installed extensions
|
136 |
+
*
|
137 |
+
* @param string|array|null $field
|
138 |
+
* @return array
|
139 |
+
*/
|
140 |
+
public function getExtensions($field = NULL)
|
141 |
+
{
|
142 |
+
if (is_null($this->_extensions))
|
143 |
+
{
|
144 |
+
$modules = Mage::getConfig()->getNode('modules')->asArray();
|
145 |
+
$namespace = strstr(get_class($this), '_', TRUE);
|
146 |
+
$coreModule = $this->_getModuleName();
|
147 |
+
$this->_extensions = array();
|
148 |
+
|
149 |
+
foreach ($modules as $moduleName => $moduleConfig)
|
150 |
+
{
|
151 |
+
if ($namespace === strstr($moduleName, '_', TRUE)
|
152 |
+
AND $moduleName !== $coreModule)
|
153 |
+
{
|
154 |
+
$this->_extensions[$moduleName] = $moduleConfig;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( ! empty($field) AND ! is_bool($field) AND ! is_resource($field))
|
160 |
+
{
|
161 |
+
$extensions = array();
|
162 |
+
|
163 |
+
if ( ! is_scalar($field))
|
164 |
+
{
|
165 |
+
$field = array_fill_keys((array) $field, NULL);
|
166 |
+
}
|
167 |
+
|
168 |
+
foreach ($this->_extensions as $moduleName => $moduleConfig)
|
169 |
+
{
|
170 |
+
if (is_string($field))
|
171 |
+
{
|
172 |
+
$extensions[$moduleName] = isset($moduleConfig[$field]) ? $moduleConfig[$field] : NULL;
|
173 |
+
}
|
174 |
+
else
|
175 |
+
{
|
176 |
+
$extensions[$moduleName] = array_merge($field, array_intersect_key($moduleConfig, $field));
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
return $extensions;
|
181 |
+
}
|
182 |
+
|
183 |
+
return $this->_extensions;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Retrieve platform/edition abbreviations
|
188 |
+
*
|
189 |
+
* @return array
|
190 |
+
*/
|
191 |
+
static public function getAvailablePlatforms()
|
192 |
+
{
|
193 |
+
if (is_null(self::$_platforms))
|
194 |
+
{
|
195 |
+
self::$_platforms = array();
|
196 |
+
|
197 |
+
if (class_exists('ReflectionClass'))
|
198 |
+
{
|
199 |
+
$reflection = new ReflectionClass('Mage');
|
200 |
+
foreach($reflection->getConstants() as $const => $value)
|
201 |
+
{
|
202 |
+
if ('EDITION' === strtok($const, '_'))
|
203 |
+
{
|
204 |
+
$edition = ltrim(strstr($const, '_'), '_');
|
205 |
+
$platform = strtolower($edition[0] . $const[0]);
|
206 |
+
|
207 |
+
self::$_platforms[$platform] = $value;
|
208 |
+
}
|
209 |
+
}
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
return self::$_platforms;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Get current platform abbreviation
|
218 |
+
*
|
219 |
+
* @return string|bool
|
220 |
+
*/
|
221 |
+
static public function getCurrentPlatform()
|
222 |
+
{
|
223 |
+
return array_search(Mage::getEdition(), self::getAvailablePlatforms());
|
224 |
+
}
|
225 |
+
}
|
app/code/local/Templatestudio/Core/Model/Config/Abstract.php
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author TemplateStudio UK
|
4 |
+
*/
|
5 |
+
|
6 |
+
abstract class Templatestudio_Core_Model_Config_Abstract extends Mage_Core_Model_Config_Base
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
* JS Config Options
|
10 |
+
*
|
11 |
+
* @var null|array
|
12 |
+
*/
|
13 |
+
protected $_jsConfig;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Constructor
|
17 |
+
*/
|
18 |
+
public function __construct()
|
19 |
+
{
|
20 |
+
parent::__construct($this->_getConfigNode());
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get config node
|
25 |
+
*
|
26 |
+
* @return Varien_Simplexml_Element
|
27 |
+
*/
|
28 |
+
abstract protected function _getConfigNode();
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Get helper
|
32 |
+
*
|
33 |
+
* @return Templatestudio_Core_Helper_Abstract
|
34 |
+
*/
|
35 |
+
abstract protected function _getHelper();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get config node
|
39 |
+
*
|
40 |
+
* @return Varien_Simplexml_Element
|
41 |
+
*/
|
42 |
+
public function getJsConfigNode()
|
43 |
+
{
|
44 |
+
return $this->getNode('jsconfig');
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Retrieve js config
|
49 |
+
*
|
50 |
+
* @param mixed $store Optional
|
51 |
+
* @return Varien_Object
|
52 |
+
*/
|
53 |
+
public function getJsConfig($store = NULL)
|
54 |
+
{
|
55 |
+
$store = Mage::app()->getStore($store);
|
56 |
+
|
57 |
+
if (is_null($this->_jsConfig) OR ! array_key_exists($store->getId(), $this->_jsConfig))
|
58 |
+
{
|
59 |
+
if ( ! is_array($this->_jsConfig))
|
60 |
+
{
|
61 |
+
$this->_jsConfig = array();
|
62 |
+
}
|
63 |
+
|
64 |
+
$this->_jsConfig[$store->getId()] = new Varien_Object(
|
65 |
+
$this->_getJsConfig($this->getJsConfigNode()->children(), $store)
|
66 |
+
);
|
67 |
+
}
|
68 |
+
|
69 |
+
return $this->_jsConfig[$store->getId()];
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Retrieve js theme config
|
74 |
+
*
|
75 |
+
* @param Varien_Simplexml_Element $node
|
76 |
+
* @param Mage_Core_Model_Store $store
|
77 |
+
* @return array
|
78 |
+
*/
|
79 |
+
protected function _getJsConfig(Varien_Simplexml_Element $node, Mage_Core_Model_Store $store)
|
80 |
+
{
|
81 |
+
$jsConfig = array();
|
82 |
+
foreach($node as $key => $config)
|
83 |
+
{
|
84 |
+
$ifconfig = $config->getAttribute('ifconfig');
|
85 |
+
$ifvalue = $config->getAttribute('ifvalue');
|
86 |
+
if ( ! empty($ifconfig))
|
87 |
+
{
|
88 |
+
if ( ! is_null($ifvalue))
|
89 |
+
{
|
90 |
+
$ifseparator = $config->getAttribute('ifseparator');
|
91 |
+
|
92 |
+
if ( ! empty($ifseparator))
|
93 |
+
{
|
94 |
+
$values = explode($ifseparator, Mage::getStoreConfig($ifconfig, $store));
|
95 |
+
|
96 |
+
if ( ! empty($values) AND ! in_array($ifvalue, $values))
|
97 |
+
{
|
98 |
+
continue;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
elseif ($ifvalue != Mage::getStoreConfig($ifconfig, $store))
|
102 |
+
{
|
103 |
+
continue;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
elseif (FALSE === Mage::getStoreConfigFlag($ifconfig, $store))
|
107 |
+
{
|
108 |
+
continue;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
if (FALSE === $config->hasChildren())
|
113 |
+
{
|
114 |
+
$path = $config->__toString();
|
115 |
+
$type = $config->getAttribute('type');
|
116 |
+
|
117 |
+
$path = trim(preg_replace(array('/[^A-Za-z0-9 _\/]/', '/\/+/', '/_+/'), array('_', '/', '_'), $path), ' /_');
|
118 |
+
if (empty($path))
|
119 |
+
{
|
120 |
+
continue;
|
121 |
+
}
|
122 |
+
|
123 |
+
if (is_a($this->_getHelper(), 'Templatestudio_Core_Helper_Abstract'))
|
124 |
+
{
|
125 |
+
$value = $this->_getHelper()->getConfigData($path, $store);
|
126 |
+
}
|
127 |
+
else
|
128 |
+
{
|
129 |
+
$value = Mage::getStoreConfig($path, $store);
|
130 |
+
}
|
131 |
+
|
132 |
+
if ( ! empty($type) AND in_array($type, $this->_getDataTypes()))
|
133 |
+
{
|
134 |
+
settype($value, $type);
|
135 |
+
}
|
136 |
+
|
137 |
+
$value = $this->_prepareJsConfig($key, $value, $node, $store);
|
138 |
+
|
139 |
+
if ( ! is_null($value))
|
140 |
+
{
|
141 |
+
$jsConfig[$key] = $value;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
else
|
145 |
+
{
|
146 |
+
$jsConfig[$key] = $this->_getJsConfig($config, $store);
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
return $jsConfig;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Prepare JS Config
|
155 |
+
*
|
156 |
+
* @param string $key
|
157 |
+
* @param mixed $value
|
158 |
+
* @param Varien_Simplexml_Element $node
|
159 |
+
* @param Mage_Core_Model_Store $store
|
160 |
+
* @return mixed
|
161 |
+
*/
|
162 |
+
protected function _prepareJsConfig($key, $value, $node, $store)
|
163 |
+
{
|
164 |
+
return $value;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Retrieve data types
|
169 |
+
*
|
170 |
+
* @return array
|
171 |
+
*/
|
172 |
+
final protected function _getDataTypes()
|
173 |
+
{
|
174 |
+
$dataTypes = array('boolean', 'integer', 'double', 'string', 'array', 'object');
|
175 |
+
|
176 |
+
if (version_compare(PHP_VERSION, '4.2.0', 'ge'))
|
177 |
+
{
|
178 |
+
$dataTypes = array_merge($dataTypes, array('bool', 'int', 'float', 'null'));
|
179 |
+
}
|
180 |
+
|
181 |
+
return $dataTypes;
|
182 |
+
}
|
183 |
+
}
|
app/code/local/Templatestudio/Core/Model/Extension.php
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author Templatestudio UK
|
5 |
+
*/
|
6 |
+
|
7 |
+
class Templatestudio_Core_Model_Extension
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Default check frequency
|
11 |
+
*/
|
12 |
+
const DEFAULT_CHECK_FREQUENCY = 86400;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Cache ID
|
16 |
+
*/
|
17 |
+
const CACHE_KEY = 'templatestudio_extensions';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Check frequency
|
21 |
+
*
|
22 |
+
* @return string|int|null
|
23 |
+
*/
|
24 |
+
protected $_checkFrequency;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Retrieve extensions url
|
28 |
+
*
|
29 |
+
* @return string|null
|
30 |
+
*/
|
31 |
+
public function getUrl()
|
32 |
+
{
|
33 |
+
return Mage::helper('tscore')->getExtensionUrl();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Retrieve check frequency
|
38 |
+
*
|
39 |
+
* @return int
|
40 |
+
*/
|
41 |
+
public function getCheckFrequency()
|
42 |
+
{
|
43 |
+
if ( ! is_null($this->_checkFrequency))
|
44 |
+
{
|
45 |
+
return $this->_checkFrequency;
|
46 |
+
}
|
47 |
+
|
48 |
+
return self::DEFAULT_CHECK_FREQUENCY;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Retrieve check frequency
|
53 |
+
*
|
54 |
+
* @param int $frequency
|
55 |
+
* @return Templatestudio_Core_Model_Extension
|
56 |
+
*/
|
57 |
+
public function setCheckFrequency($frequency)
|
58 |
+
{
|
59 |
+
$this->_checkFrequency = abs(intval($frequency));
|
60 |
+
|
61 |
+
return $this;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Check feed for modification
|
66 |
+
*
|
67 |
+
* @return Templatestudio_Core_Model_Extension
|
68 |
+
*/
|
69 |
+
public function checkUpdate()
|
70 |
+
{
|
71 |
+
if ( ! (Mage::app()->loadCache(self::CACHE_KEY))
|
72 |
+
OR (time() - $this->getLastUpdate()) > $this->getCheckFrequency())
|
73 |
+
{
|
74 |
+
$data = $this->getData();
|
75 |
+
|
76 |
+
if ( ! empty($data) AND is_a($data, 'SimpleXMLElement'))
|
77 |
+
{
|
78 |
+
$extensions = array();
|
79 |
+
foreach ($data->children() as $extension)
|
80 |
+
{
|
81 |
+
$extensions[$extension->name->__toString()] = $extension->asCanonicalArray();
|
82 |
+
}
|
83 |
+
|
84 |
+
Mage::app()->saveCache(serialize($extensions), self::CACHE_KEY);
|
85 |
+
$this->setLastUpdate();
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Retrieve Last update time
|
94 |
+
*
|
95 |
+
* @return int
|
96 |
+
*/
|
97 |
+
public function getLastUpdate()
|
98 |
+
{
|
99 |
+
return Mage::app()->loadCache('templatestudio_extensions_lastcheck');
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Set last update time (now)
|
104 |
+
*
|
105 |
+
* @return Templatestudio_Core_Model_Extension
|
106 |
+
*/
|
107 |
+
public function setLastUpdate()
|
108 |
+
{
|
109 |
+
Mage::app()->saveCache(time(), 'templatestudio_extensions_lastcheck');
|
110 |
+
return $this;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Retrieve feed data as XML element
|
115 |
+
*
|
116 |
+
* @return SimpleXMLElement
|
117 |
+
*/
|
118 |
+
public function getData()
|
119 |
+
{
|
120 |
+
$curl = new Varien_Http_Adapter_Curl();
|
121 |
+
$curl->setConfig(array(
|
122 |
+
'timeout' => 2
|
123 |
+
));
|
124 |
+
|
125 |
+
$curl->write(Zend_Http_Client::POST, $this->getUrl(), Zend_Http_Client::HTTP_0, array('Content-Type: text/xml'), $this->_prepareXml());
|
126 |
+
$data = $curl->read();
|
127 |
+
|
128 |
+
if (FALSE === $data)
|
129 |
+
{
|
130 |
+
return FALSE;
|
131 |
+
}
|
132 |
+
|
133 |
+
$data = preg_split('/^\r?$/m', $data, 2);
|
134 |
+
$data = trim($data[1]);
|
135 |
+
|
136 |
+
$curl->close();
|
137 |
+
|
138 |
+
try
|
139 |
+
{
|
140 |
+
$xml = new SimpleXMLElement($data);
|
141 |
+
}
|
142 |
+
catch (Exception $e)
|
143 |
+
{
|
144 |
+
Mage::logException($e);
|
145 |
+
return FALSE;
|
146 |
+
}
|
147 |
+
|
148 |
+
return $xml;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Retrieve installed extensions
|
153 |
+
*
|
154 |
+
* @return array
|
155 |
+
*/
|
156 |
+
protected function _getExtensions()
|
157 |
+
{
|
158 |
+
return Mage::helper('tscore')->getExtensions('version');
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Prepare XML
|
163 |
+
*
|
164 |
+
* @return string|Varien_Simplexml_Element
|
165 |
+
*/
|
166 |
+
protected function _prepareXml($asXML = TRUE)
|
167 |
+
{
|
168 |
+
$xml = new Varien_Simplexml_Element('<?xml version="1.0" encoding="UTF-8"?><customer/>');
|
169 |
+
|
170 |
+
$xml->addChild('base_url', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
|
171 |
+
$xml->addChild('server_addr', Mage::helper('core/http')->getServerAddr());
|
172 |
+
|
173 |
+
$extensions = $xml->addChild('modules');
|
174 |
+
foreach ($this->_getExtensions() as $moduleName => $version)
|
175 |
+
{
|
176 |
+
$extension = $extensions->addChild($moduleName);
|
177 |
+
$extension->addChild('name', $moduleName);
|
178 |
+
$extension->addChild('version', $version);
|
179 |
+
$extension->addChild('enabled', Mage::helper('tscore')->isModuleOutputEnabled($moduleName));
|
180 |
+
}
|
181 |
+
|
182 |
+
if (TRUE === $asXML)
|
183 |
+
{
|
184 |
+
return $xml->asXML();
|
185 |
+
}
|
186 |
+
|
187 |
+
return $xml;
|
188 |
+
}
|
189 |
+
}
|
app/code/local/Templatestudio/Core/Model/Feed.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Templatestudio UK
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Templatestudio_Core_Model_Feed extends Mage_AdminNotification_Model_Feed
|
7 |
+
{
|
8 |
+
const XML_PATH_NOTIFY = 'templatestudio/feed/notify';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Retrieve feed url
|
12 |
+
*
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getFeedUrl()
|
16 |
+
{
|
17 |
+
if (is_null($this->_feedUrl))
|
18 |
+
{
|
19 |
+
$feedUrl = Mage::helper('tscore')->getNotificationFeedUrl();
|
20 |
+
if ( ! empty($feedUrl))
|
21 |
+
{
|
22 |
+
$feedUrl = preg_replace('#^https?:\/\/#i', '', $feedUrl);
|
23 |
+
$this->_feedUrl = (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://') . $feedUrl;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
return $this->_feedUrl;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function observe()
|
31 |
+
{
|
32 |
+
if (TRUE === Mage::getStoreConfigFlag(self::XML_PATH_NOTIFY))
|
33 |
+
{
|
34 |
+
$this->checkUpdate();
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
app/code/local/Templatestudio/Core/etc/adminhtml.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
TemplateStudio UK
|
4 |
+
-->
|
5 |
+
<config>
|
6 |
+
<menu>
|
7 |
+
<tepmplatestudio translate="title" module="tscore">
|
8 |
+
<title>Templatestudio</title>
|
9 |
+
<sort_order>9999</sort_order>
|
10 |
+
</tepmplatestudio>
|
11 |
+
</menu>
|
12 |
+
<acl>
|
13 |
+
<resources>
|
14 |
+
<admin>
|
15 |
+
<children>
|
16 |
+
<system>
|
17 |
+
<children>
|
18 |
+
<config>
|
19 |
+
<children>
|
20 |
+
<templatestudio translate="title" module="tscore">
|
21 |
+
<title>Templatestudio</title>
|
22 |
+
</templatestudio>
|
23 |
+
</children>
|
24 |
+
</config>
|
25 |
+
</children>
|
26 |
+
</system>
|
27 |
+
</children>
|
28 |
+
</admin>
|
29 |
+
</resources>
|
30 |
+
</acl>
|
31 |
+
</config>
|
app/code/local/Templatestudio/Core/etc/config.xml
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
TemplateStudio UK
|
4 |
+
-->
|
5 |
+
<config>
|
6 |
+
<modules>
|
7 |
+
<Templatestudio_Core>
|
8 |
+
<version>0.1.0</version>
|
9 |
+
</Templatestudio_Core>
|
10 |
+
</modules>
|
11 |
+
<global>
|
12 |
+
<blocks>
|
13 |
+
<tscore>
|
14 |
+
<class>Templatestudio_Core_Block</class>
|
15 |
+
</tscore>
|
16 |
+
</blocks>
|
17 |
+
<helpers>
|
18 |
+
<tscore>
|
19 |
+
<class>Templatestudio_Core_Helper</class>
|
20 |
+
</tscore>
|
21 |
+
</helpers>
|
22 |
+
<models>
|
23 |
+
<tscore>
|
24 |
+
<class>Templatestudio_Core_Model</class>
|
25 |
+
</tscore>
|
26 |
+
</models>
|
27 |
+
<tscore>
|
28 |
+
<url>
|
29 |
+
<vendor><![CDATA[www.templatestudio.com]]></vendor>
|
30 |
+
<notification><![CDATA[www.templatestudio.com/feed/file.rss]]></notification>
|
31 |
+
<extension><![CDATA[www.templatestudio.com/extmanager/extension/feed]]></extension>
|
32 |
+
<quote><![CDATA[www.templatestudio.com/quote]]></quote>
|
33 |
+
</url>
|
34 |
+
</tscore>
|
35 |
+
</global>
|
36 |
+
<adminhtml>
|
37 |
+
<translate>
|
38 |
+
<modules>
|
39 |
+
<Templatestudio_Core>
|
40 |
+
<files>
|
41 |
+
<default>Templatestudio_Core.csv</default>
|
42 |
+
</files>
|
43 |
+
</Templatestudio_Core>
|
44 |
+
</modules>
|
45 |
+
</translate>
|
46 |
+
<events>
|
47 |
+
<controller_action_predispatch>
|
48 |
+
<observers>
|
49 |
+
<tscore_check_notifications>
|
50 |
+
<type>model</type>
|
51 |
+
<class>tscore/feed</class>
|
52 |
+
<method>observe</method>
|
53 |
+
</tscore_check_notifications>
|
54 |
+
<tscore_check_extensions>
|
55 |
+
<type>model</type>
|
56 |
+
<class>tscore/extension</class>
|
57 |
+
<method>checkUpdate</method>
|
58 |
+
</tscore_check_extensions>
|
59 |
+
</observers>
|
60 |
+
</controller_action_predispatch>
|
61 |
+
</events>
|
62 |
+
<layout>
|
63 |
+
<updates>
|
64 |
+
<tscore>
|
65 |
+
<file>templatestudio/core.xml</file>
|
66 |
+
</tscore>
|
67 |
+
</updates>
|
68 |
+
</layout>
|
69 |
+
</adminhtml>
|
70 |
+
<default>
|
71 |
+
<templatestudio>
|
72 |
+
<feed>
|
73 |
+
<notify>1</notify>
|
74 |
+
</feed>
|
75 |
+
</templatestudio>
|
76 |
+
</default>
|
77 |
+
<crontab>
|
78 |
+
<jobs>
|
79 |
+
<tscore_check_extensions>
|
80 |
+
<schedule>
|
81 |
+
<cron_expr>0 4 * * *</cron_expr>
|
82 |
+
</schedule>
|
83 |
+
<run>
|
84 |
+
<model>tscore/extension::checkUpdate</model>
|
85 |
+
</run>
|
86 |
+
</tscore_check_extensions>
|
87 |
+
</jobs>
|
88 |
+
</crontab>
|
89 |
+
</config>
|
app/code/local/Templatestudio/Core/etc/system.xml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
TemplateStudio UK
|
4 |
+
-->
|
5 |
+
<config>
|
6 |
+
<tabs>
|
7 |
+
<templatestudio translate="label" module="tscore">
|
8 |
+
<label><![CDATA[<img style="margin-top:5px;" border="0" id="templatestio_tab_label" alt="TemplateStudio UK" /><script type="text/javascript">$('templatestio_tab_label').src=SKIN_URL.substring(0,SKIN_URL.indexOf('adminhtml'))+'adminhtml/default/default/templatestudio/images/logo-core-tab.gif';</script>]]></label>
|
9 |
+
<sort_order>100</sort_order>
|
10 |
+
</templatestudio>
|
11 |
+
</tabs>
|
12 |
+
<sections>
|
13 |
+
<templatestudio translate="label" module="tscore">
|
14 |
+
<label>Info</label>
|
15 |
+
<tab>templatestudio</tab>
|
16 |
+
<frontend_type>text</frontend_type>
|
17 |
+
<sort_order>999</sort_order>
|
18 |
+
<show_in_default>1</show_in_default>
|
19 |
+
<show_in_website>0</show_in_website>
|
20 |
+
<show_in_store>0</show_in_store>
|
21 |
+
<groups>
|
22 |
+
<extensions translate="label">
|
23 |
+
<label>Installed Extensions</label>
|
24 |
+
<frontend_type>text</frontend_type>
|
25 |
+
<frontend_model>tscore/adminhtml_system_config_form_fieldset_templatestudio_extensions</frontend_model>
|
26 |
+
<expanded>1</expanded>
|
27 |
+
<sort_order>10</sort_order>
|
28 |
+
<show_in_default>1</show_in_default>
|
29 |
+
<show_in_website>0</show_in_website>
|
30 |
+
<show_in_store>0</show_in_store>
|
31 |
+
<fieldset_css>templatestudio-installed-extensions</fieldset_css>
|
32 |
+
</extensions>
|
33 |
+
<feed>
|
34 |
+
<label>Notifications</label>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>20</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>0</show_in_website>
|
39 |
+
<show_in_store>0</show_in_store>
|
40 |
+
<fields>
|
41 |
+
<notify translate="label">
|
42 |
+
<label><![CDATA[I would like to be notified by Templatestudio]]></label>
|
43 |
+
<frontend_type>select</frontend_type>
|
44 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
45 |
+
<sort_order>0</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>0</show_in_website>
|
48 |
+
<show_in_store>0</show_in_store>
|
49 |
+
</notify>
|
50 |
+
</fields>
|
51 |
+
</feed>
|
52 |
+
</groups>
|
53 |
+
</templatestudio>
|
54 |
+
</sections>
|
55 |
+
</config>
|
app/design/adminhtml/default/default/layout/templatestudio/core.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!--
|
3 |
+
TemplateStudio UK
|
4 |
+
-->
|
5 |
+
<layout>
|
6 |
+
<adminhtml_system_config_edit>
|
7 |
+
<reference name="head">
|
8 |
+
<action method="addCss"><name>templatestudio/css/core.css</name></action>
|
9 |
+
</reference>
|
10 |
+
</adminhtml_system_config_edit>
|
11 |
+
</layout>
|
12 |
+
|
app/etc/modules/Templatestudio_Core.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
TemplateStudio UK
|
4 |
+
-->
|
5 |
+
<config>
|
6 |
+
<modules>
|
7 |
+
<Templatestudio_Core>
|
8 |
+
<active>true</active>
|
9 |
+
<codePool>local</codePool>
|
10 |
+
</Templatestudio_Core>
|
11 |
+
</modules>
|
12 |
+
</config>
|
app/locale/en_US/Templatestudio_Core.csv
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Templatestudio","Templatestudio"
|
2 |
+
"Notifications","Notifications"
|
3 |
+
"Installed Extensions","Installed Extensions"
|
4 |
+
"Info","Info"
|
5 |
+
"I would like to be notified by Templatestudio","I would like to be notified by Templatestudio"
|
6 |
+
"There are no TemplateStudio extensions installed.","There are no TemplateStudio extensions installed."
|
7 |
+
"Wrong extension platform","Wrong extension platform"
|
8 |
+
"Update available","Update available"
|
9 |
+
"Installed","Installed"
|
10 |
+
"Get in touch","Get in touch"
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Templatestudio_Core</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>CL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>A core module that other Templatestudio modules depend on.</summary>
|
10 |
+
<description><h2>Templatestudio_Core</h2>
|
11 |
+
<p>Templatestudio_Core is the base extension required by all our other extensions.</p> 
|
12 |
+

|
13 |
+
<h3>Template Studio</h3>
|
14 |
+
<p>The Template Studio website design team has been creating professional grade Magento e-commerce websites for as long as Magento has existed as a platform. Our dedicated Magento web designers simply know this platform better than anyone else because this is not one of the many platforms we work with, this is our central focus. We also know how to make sure that your site is Search Engine Optimized, so that not only do you have a beautifully designed cyber storefront, but the kind of traffic that will actually make that beauty pay off in not just clicks but sales. Magento is not just what we do - Magento is who we are.</p></description>
|
15 |
+
<notes>0.1.0</notes>
|
16 |
+
<authors><author><name>TemplateStudio</name><user>TemplateStudio</user><email>nick@seofriendlydesign.com</email></author></authors>
|
17 |
+
<date>2016-01-18</date>
|
18 |
+
<time>15:57:38</time>
|
19 |
+
<contents><target name="magelocal"><dir name="Templatestudio"><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Array"><file name="Abstract.php" hash="1f119e4fbd7c506c8681e61339fd2c96"/></dir><file name="Version.php" hash="d0f6b81c14d3fb3f6aa456439bfa285f"/></dir><dir name="Fieldset"><dir name="Templatestudio"><file name="Extensions.php" hash="b2574a3e7050f52cd67230a866a74b22"/></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Abstract.php" hash="a10c6e031cee83400dbbcb3587d33792"/><file name="Data.php" hash="7a6ccccc427846ef170a5c0fec39d815"/></dir><dir name="Model"><dir name="Config"><file name="Abstract.php" hash="98ffa860d669cf5d711802dd53e16281"/></dir><file name="Extension.php" hash="d9c3d2a1567ae2b47e1850e1feb3b8b4"/><file name="Feed.php" hash="348d78a59243febb59dbe773080b8b79"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9302da64941aa729aacd592dc9112838"/><file name="config.xml" hash="bb5f757899097224c805384bba50a189"/><file name="system.xml" hash="a1ed89b2b00337c481054fb3d07aa3f8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Templatestudio_Core.xml" hash="0957c5b2490c3bbacbf3d92ee6f126d4"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Templatestudio_Core.csv" hash="eb3e5f0931b3d0208389e360636847ff"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="templatestudio"><file name="core.xml" hash="5f79ca7af6eb7bc7464e43386c87e97d"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="templatestudio"><dir name="css"><file name="core.css" hash="756531704f2199bfd71588b46a1f934a"/></dir><dir name="images"><file name="logo-core-tab.gif" hash="889994234872a52a69f2cb737dc4494d"/><file name="templatestudio-quote.jpg" hash="ce70aeec0f257d2ebfe68f585f4047f3"/><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/><file name="bad.gif" hash="b8379f1ba7ab552ca46b9d5fd0452345"/></dir></dir></dir></dir></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
+
</package>
|
skin/adminhtml/default/default/templatestudio/css/core.css
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
Templatestudio UK
|
3 |
+
*/
|
4 |
+
.templatestudio-installed-extensions td.label label img { margin-right: 5px; vertical-align: middle; }
|
5 |
+
.templatestudio-installed-extensions td.value img { margin-left: 5px; vertical-align: middle; }
|
6 |
+
#templatestudio-core-quote { float: right; }
|
skin/adminhtml/default/default/templatestudio/images/bad.gif
ADDED
Binary file
|
skin/adminhtml/default/default/templatestudio/images/logo-core-tab.gif
ADDED
Binary file
|
skin/adminhtml/default/default/templatestudio/images/ok.gif
ADDED
Binary file
|
skin/adminhtml/default/default/templatestudio/images/templatestudio-quote.jpg
ADDED
Binary file
|
skin/adminhtml/default/default/templatestudio/images/update.gif
ADDED
Binary file
|