smartaddons_twitter - Version 1.0.0

Version Notes

test more than 100 hours

Download this release

Release Info

Developer magentech.com
Extension smartaddons_twitter
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Sm/Twitter/Block/List.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*------------------------------------------------------------------------
3
+ # SM Twitter - Version 1.1
4
+ # Copyright (c) 2013 YouTech Company. All Rights Reserved.
5
+ # @license - Copyrighted Commercial Software
6
+ # Author: YouTech Company
7
+ # Websites: http://www.magentech.com
8
+ -------------------------------------------------------------------------*/
9
+
10
+ class Sm_Twitter_Block_List extends Mage_Catalog_Block_Product_Abstract
11
+ {
12
+ protected $_config = null;
13
+ protected $_storeId = null;
14
+
15
+ public function __construct($attributes = array()){
16
+ parent::__construct();
17
+ $this->_config = Mage::helper('twitter/data')->get($attributes);
18
+ }
19
+
20
+ public function getConfig($name=null, $value=null){
21
+ if (is_null($this->_config)){
22
+ $this->_config = Mage::helper('twitter/data')->get(null);
23
+ }
24
+ if (!is_null($name) && !empty($name)){
25
+ $valueRet = isset($this->_config[$name]) ? $this->_config[$name] : $value;
26
+ return $valueRet;
27
+ }
28
+ return $this->_config;
29
+ }
30
+
31
+ public function setConfig($name, $value=null){
32
+ if (is_null($this->_config)) $this->getConfig();
33
+ if (is_array($name)){
34
+ $this->_config = array_merge($this->_config, $name);
35
+ return;
36
+ }
37
+ if (!empty($name)){
38
+ $this->_config[$name] = $value;
39
+ }
40
+ return true;
41
+ }
42
+
43
+ protected function _toHtml(){
44
+ if(!$this->_config['isenabled']) return;
45
+ $template_file = "sm/twitter/default.phtml";
46
+ $this->setTemplate($template_file);
47
+ return parent::_toHtml();
48
+ }
49
+
50
+ public function getConfigObject(){
51
+ return (object)$this->getConfig();
52
+ }
53
+
54
+ }
app/code/local/Sm/Twitter/Helper/Data.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*------------------------------------------------------------------------
3
+ # SM Twitter - Version 1.1
4
+ # Copyright (c) 2013 YouTech Company. All Rights Reserved.
5
+ # @license - Copyrighted Commercial Software
6
+ # Author: YouTech Company
7
+ # Websites: http://www.magentech.com
8
+ -------------------------------------------------------------------------*/
9
+
10
+ class Sm_Twitter_Helper_Data extends Mage_Core_Helper_Abstract {
11
+ public function __construct(){
12
+ $this->defaults = array(
13
+ /* General setting */
14
+ 'isenabled' => '1',
15
+ 'title' => 'SM Twitter',
16
+ /* Module setting */
17
+ 'theme' => 'light',
18
+ 'limit' => '3',
19
+ 'href' => 'https://twitter.com/magentech',
20
+ 'widgets_id' => '334892754301755392',
21
+ //'footer_text' => 'Tweets by @magentech',
22
+ /* advanced setting */
23
+ 'pretext' => '',
24
+ 'posttext' => ''
25
+ );
26
+ }
27
+
28
+ function get($attributes=array())
29
+ {
30
+ $data = $this->defaults;
31
+ $general = Mage::getStoreConfig("twitter_cfg/general");
32
+ $module_setting = Mage::getStoreConfig("twitter_cfg/module_setting");
33
+ $advanced = Mage::getStoreConfig("twitter_cfg/advanced");
34
+ if (!is_array($attributes)) {
35
+ $attributes = array($attributes);
36
+ }
37
+ if (is_array($general)) $data = array_merge($data, $general);
38
+ if (is_array($module_setting)) $data = array_merge($data, $module_setting);
39
+ if (is_array($advanced)) $data = array_merge($data, $advanced);
40
+ return array_merge($data, $attributes);;
41
+ }
42
+ }
43
+ ?>
app/code/local/Sm/Twitter/Helper/Utils.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*------------------------------------------------------------------------
3
+ # SM Twitter - Version 1.1
4
+ # Copyright (c) 2013 YouTech Company. All Rights Reserved.
5
+ # @license - Copyrighted Commercial Software
6
+ # Author: YouTech Company
7
+ # Websites: http://www.magentech.com
8
+ -------------------------------------------------------------------------*/
9
+
10
+ class Sm_Twitter_Helper_Utils extends Mage_Core_Helper_Abstract {
11
+ public function getTargetAttr($type=''){
12
+ $attribs = '';
13
+ switch($type){
14
+ default:
15
+ case '0':
16
+ case '':
17
+ break;
18
+ case '1':
19
+ case '_blank':
20
+ $attribs = "target=\"_blank\"";
21
+ break;
22
+ case '2':
23
+ case '_popup':
24
+ $attribs = "onclick=\"window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,false');return false;\"";
25
+ break;
26
+ }
27
+ return $attribs;
28
+ }
29
+ }
30
+ ?>
app/code/local/Sm/Twitter/Model/System/Config/Source/ListTheme.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*------------------------------------------------------------------------
3
+ # SM Twitter - Version 1.1
4
+ # Copyright (c) 2013 YouTech Company. All Rights Reserved.
5
+ # @license - Copyrighted Commercial Software
6
+ # Author: YouTech Company
7
+ # Websites: http://www.magentech.com
8
+ -------------------------------------------------------------------------*/
9
+
10
+ class Sm_Twitter_Model_System_Config_Source_ListTheme
11
+ {
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value'=>'light', 'label'=>Mage::helper('twitter')->__('Light')),
16
+ array('value'=>'dark', 'label'=>Mage::helper('twitter')->__('Dark')),
17
+ );
18
+ }
19
+ }
app/code/local/Sm/Twitter/controllers/IndexController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*------------------------------------------------------------------------
3
+ # SM Twitter - Version 1.1
4
+ # Copyright (c) 2013 YouTech Company. All Rights Reserved.
5
+ # @license - Copyrighted Commercial Software
6
+ # Author: YouTech Company
7
+ # Websites: http://www.magentech.com
8
+ -------------------------------------------------------------------------*/
9
+
10
+ class Sm_Twitter_IndexController extends Mage_Core_Controller_Front_Action{
11
+ public function IndexAction() {
12
+ $this->loadLayout();
13
+ $this->renderLayout();
14
+ }
15
+ }
app/code/local/Sm/Twitter/etc/config.xml ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <global>
4
+ <models>
5
+ <twitter>
6
+ <class>Sm_Twitter_Model</class>
7
+ </twitter>
8
+ </models>
9
+ <blocks>
10
+ <twitter>
11
+ <class>Sm_Twitter_Block</class>
12
+ </twitter>
13
+ </blocks>
14
+ <helpers>
15
+ <twitter>
16
+ <class>Sm_Twitter_Helper</class>
17
+ </twitter>
18
+ </helpers>
19
+ <resources>
20
+ <twitter_setup>
21
+ <setup>
22
+ <module>Sm_Twitter</module>
23
+ </setup>
24
+ </twitter_setup>
25
+ </resources>
26
+ </global>
27
+ <frontend>
28
+ <routers>
29
+ <twitter>
30
+ <use>standard</use>
31
+ <args>
32
+ <module>Sm_Twitter</module>
33
+ <frontName>twitter</frontName>
34
+ </args>
35
+ </twitter>
36
+ </routers>
37
+ <layout>
38
+ <updates>
39
+ <twitter module="Sm_Twitter">
40
+ <file>sm/twitter.xml</file>
41
+ </twitter>
42
+ </updates>
43
+ </layout>
44
+ <translate>
45
+ <modules>
46
+ <Sm_Twitter>
47
+ <files>
48
+ <default>Sm_Twitter.csv</default>
49
+ </files>
50
+ </Sm_Twitter>
51
+ </modules>
52
+ </translate>
53
+ </frontend>
54
+ <adminhtml>
55
+ <translate>
56
+ <modules>
57
+ <Sm_Twitter>
58
+ <files>
59
+ <default>Sm_Twitter.csv</default>
60
+ </files>
61
+ </Sm_Twitter>
62
+ </modules>
63
+ </translate>
64
+ <acl>
65
+ <resources>
66
+ <admin>
67
+ <children>
68
+ <system>
69
+ <children>
70
+ <config>
71
+ <children>
72
+ <twitter_cfg translate="title" module="twitter">
73
+ <title>SM Twitter Settings</title>
74
+ </twitter_cfg>
75
+ </children>
76
+ </config>
77
+ </children>
78
+ </system>
79
+ </children>
80
+ </admin>
81
+ </resources>
82
+ </acl>
83
+ </adminhtml>
84
+ <default>
85
+ <twitter_cfg>
86
+ <general>
87
+ <isenabled>1</isenabled>
88
+ <title>SM Twitter</title>
89
+ </general>
90
+ <module_setting>
91
+ <theme>light</theme>
92
+ <limit>3</limit>
93
+ <href>https://twitter.com/magentech</href>
94
+ <widgets_id>334892754301755392</widgets_id>
95
+ <!--footer_text>Tweets by @magentech</footer_text-->
96
+ </module_setting>
97
+ <advanced>
98
+ <pretext></pretext>
99
+ <posttext></posttext>
100
+ </advanced>
101
+ </twitter_cfg>
102
+ </default>
103
+ </config>
app/code/local/Sm/Twitter/etc/system.xml ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <sm>
5
+ <label>Magentech.com</label>
6
+ <sort_order>205</sort_order>
7
+ </sm>
8
+ </tabs>
9
+ <sections>
10
+ <twitter_cfg translate="label" module="twitter">
11
+ <label>SM Twitter</label>
12
+ <tab>sm</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>150</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
+ <!-- start general group -->
20
+ <general translate="label">
21
+ <label>General settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>10</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
+ <isenabled translate="label" module="core">
29
+ <label>Enabled</label>
30
+ <sort_order>10</sort_order>
31
+ <frontend_type>select</frontend_type>
32
+ <source_model>adminhtml/system_config_source_yesno</source_model>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </isenabled>
37
+ <title translate="label">
38
+ <label>Title</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>20</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
+ </title>
45
+ </fields>
46
+ </general>
47
+ <!-- end general group -->
48
+
49
+ <!-- start module setting group -->
50
+ <module_setting translate="label">
51
+ <label>Module settings</label>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>15</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ <fields>
58
+ <theme translate="label">
59
+ <label>Select template</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>twitter/system_config_source_listTheme</source_model>
62
+ <sort_order>10</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </theme>
67
+ <limit translate="label" module="core">
68
+ <label>Tweets Count</label>
69
+ <sort_order>20</sort_order>
70
+ <frontend_type>text</frontend_type>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </limit>
75
+ <href translate="label" module="core">
76
+ <label>Tweets Link</label>
77
+ <sort_order>30</sort_order>
78
+ <frontend_type>text</frontend_type>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ </href>
83
+ <widgets_id translate="label" module="core">
84
+ <label>Widgets Id</label>
85
+ <sort_order>40</sort_order>
86
+ <frontend_type>text</frontend_type>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ </widgets_id>
91
+ <!--footer_text translate="label" module="core">
92
+ <label>Footer Text</label>
93
+ <sort_order>50</sort_order>
94
+ <frontend_type>text</frontend_type>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ </footer_text-->
99
+ </fields>
100
+ </module_setting>
101
+ <!-- end module setting group -->
102
+
103
+ <advanced translate="label">
104
+ <label>Advanced settings</label>
105
+ <frontend_type>text</frontend_type>
106
+ <sort_order>45</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ <fields>
111
+ <pretext translate="label">
112
+ <label>Pre-text</label>
113
+ <frontend_type>textarea</frontend_type>
114
+ <sort_order>20</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </pretext>
119
+ <posttext translate="label">
120
+ <label>Post-text</label>
121
+ <frontend_type>textarea</frontend_type>
122
+ <sort_order>30</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </posttext>
127
+ </fields>
128
+ </advanced>
129
+ </groups>
130
+ </twitter_cfg>
131
+ </sections>
132
+ </config>
app/design/frontend/default/default/layout/sm/twitter.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><stylesheet>sm/twitter/css/twitter.css</stylesheet></action>
6
+ </reference>
7
+ </default>
8
+ <twitter_index_index>
9
+ <reference name="content">
10
+ <block type="twitter/list" name="twitter.list.default"></block>
11
+ </reference>
12
+ </twitter_index_index>
13
+ </layout>
14
+
app/design/frontend/default/default/template/sm/twitter/default.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*------------------------------------------------------------------------
3
+ # SM Twitter - Version 1.1
4
+ # Copyright (c) 2013 YouTech Company. All Rights Reserved.
5
+ # @license - Copyrighted Commercial Software
6
+ # Author: YouTech Company
7
+ # Websites: http://www.magentech.com
8
+ -------------------------------------------------------------------------*/
9
+ $options = $this->getConfigObject();
10
+ $theme = $options->theme;
11
+ $limit = $options->limit;
12
+ $href = $options->href;
13
+ $widgets_id = $options->widgets_id;
14
+ $pretext = $options->pretext;
15
+ $posttext = $options->posttext;
16
+
17
+ if( !empty($pretext) ){ ?>
18
+ <div class="sm-twitter-pre">
19
+ <?php echo $pretext;?>
20
+ </div>
21
+ <?php }?>
22
+ <a class="twitter-timeline" href="<?php echo $href;?>" data-widget-id="<?php echo $widgets_id;?>" data-tweet-limit="<?php echo $limit;?>" width="<?php //echo $width;?>" height="<?php //echo $height;?>" data-theme="<?php echo $theme;?>"><?php //echo $footer_text;?></a>
23
+
24
+ <script>
25
+ !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
26
+ </script>
27
+
28
+ <?php if( !empty($posttext) ){?>
29
+ <div class="sm-twitter-pos">
30
+ <?php echo $posttext;?>
31
+ </div>
32
+ <?php }?>
33
+
app/etc/modules/Sm_Twitter.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Sm_Twitter>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Catalog />
9
+ </depends>
10
+ <version>0.1.0</version>
11
+ </Sm_Twitter>
12
+ </modules>
13
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>smartaddons_twitter</name>
4
+ <version>1.0.0</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>A must have extension of Magento</summary>
10
+ <description>New design, More features, Store Offline </description>
11
+ <notes>test more than 100 hours</notes>
12
+ <authors><author><name>SmartAddons</name><user>smartaddons</user><email>marketing@ytcvn.com</email></author></authors>
13
+ <date>2013-08-17</date>
14
+ <time>02:02:33</time>
15
+ <contents><target name="magelocal"><dir name="Sm"><dir name="Twitter"><dir name="Block"><file name="List.php" hash="446dccbb380ac1d6fadadaf737883074"/></dir><dir name="Helper"><file name="Data.php" hash="f4deb67bfd5091fb81a99b3eca73320b"/><file name="Utils.php" hash="9729d6aaa79627b38eba437ad65f8820"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="ListTheme.php" hash="7ca4bdf2fc05a953370c690215347eda"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="85fa24683462fe03d17904dcba1030d1"/></dir><dir name="etc"><file name="config.xml" hash="1888a97361894f418eb4bb0e8a3437e9"/><file name="system.xml" hash="14a60855f2d6fe4c5a917bbf378170cc"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="sm"><file name="twitter.xml" hash="6f1010a487bc9bdc352177ca3d19010f"/></dir></dir><dir name="template"><dir name="sm"><dir name="twitter"><file name="default.phtml" hash="ed4f69a351569b80ae4a48bb6ac52a38"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="sm"><dir name="twitter"><dir name="css"><file name="twitter.css" hash="bb7a9eaf6e52f702a3c1789dd202eed0"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sm_Twitter.xml" hash="e176f5befc5985cb70e3925d3d402c08"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/default/default/sm/twitter/css/twitter.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .sm-twitter-pre ,
2
+ .sm-twitter-pos{
3
+ margin: 15px 0;
4
+ width: 100%;
5
+ }
6
+ .sm-twitter-pos{
7
+ margin-top: 10px;
8
+ }
9
+
10
+ .twitter-timeline.twitter-timeline-rendered{
11
+ width: 100%;
12
+ }
13
+
14
+ .timeline-footer {
15
+ padding: 0 !important;
16
+ }