Adodis_Latesttweets - Version 1.0.0

Version Notes

Initial step to display latest tweets

Download this release

Release Info

Developer Jextn Themes
Extension Adodis_Latesttweets
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Adodis/Latesttweets/Block/Latesttweets.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Adodis_Latesttweets_Block_Latesttweets extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getLatesttweets()
10
+ {
11
+ if (!$this->hasData('latesttweets')) {
12
+ $this->setData('latesttweets', Mage::registry('latesttweets'));
13
+ }
14
+ return $this->getData('latesttweets');
15
+
16
+ }
17
+ }
app/code/community/Adodis/Latesttweets/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Adodis_Latesttweets_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Adodis/Latesttweets/Model/Adminhtml/System/Config/Source/Enabledisable.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Adodis_Latesttweets_Model_Adminhtml_System_Config_Source_Enabledisable
3
+ {
4
+
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Enable')),
9
+ array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Disable')),
10
+ );
11
+ }
12
+
13
+ }
app/code/community/Adodis/Latesttweets/Model/Adminhtml/System/Config/Source/Enablescroll.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Adodis_Latesttweets_Model_Adminhtml_System_Config_Source_Enablescroll
3
+ {
4
+
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Enable')),
9
+ array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Disable')),
10
+ );
11
+ }
12
+
13
+ }
app/code/community/Adodis/Latesttweets/etc/config.xml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Adodis_Latesttweets>
5
+ <version>0.1.0</version>
6
+ </Adodis_Latesttweets>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <latesttweets>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Adodis_Latesttweets</module>
14
+ <frontName>latesttweets</frontName>
15
+ </args>
16
+ </latesttweets>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <latesttweets>
21
+ <file>latesttweets.xml</file>
22
+ </latesttweets>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <latesttweets>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Adodis_Latesttweets</module>
32
+ <frontName>latesttweets</frontName>
33
+ </args>
34
+ </latesttweets>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <latesttweets>
40
+ <title>Latest Tweets</title>
41
+ <sort_order>71</sort_order>
42
+ <children>
43
+ <items module="latesttweets">
44
+ <title>Settings</title>
45
+ <sort_order>0</sort_order>
46
+ <action>adminhtml/system_config/edit/section/adodis_latesttweets/</action>
47
+ </items>
48
+ </children>
49
+ </latesttweets>
50
+ </menu>
51
+ <acl>
52
+ <resources>
53
+ <admin>
54
+ <children>
55
+ <system>
56
+ <children>
57
+ <config>
58
+ <children>
59
+ <adodis_latesttweets>
60
+ <title>Latest Tweets</title>
61
+ </adodis_latesttweets>
62
+ </children>
63
+ </config>
64
+ </children>
65
+ </system>
66
+ </children>
67
+ </admin>
68
+ </resources>
69
+ </acl>
70
+ <layout>
71
+ <updates>
72
+ <latesttweets>
73
+ <file>latesttweets.xml</file>
74
+ </latesttweets>
75
+ </updates>
76
+ </layout>
77
+ </adminhtml>
78
+ <global>
79
+ <models>
80
+ <latesttweets>
81
+ <class>Adodis_Latesttweets_Model</class>
82
+ </latesttweets>
83
+ </models>
84
+ <blocks>
85
+ <latesttweets>
86
+ <class>Adodis_Latesttweets_Block</class>
87
+ </latesttweets>
88
+ </blocks>
89
+ <helpers>
90
+ <latesttweets>
91
+ <class>Adodis_Latesttweets_Helper</class>
92
+ </latesttweets>
93
+ </helpers>
94
+ </global>
95
+ <default>
96
+ <adodis_latesttweets>
97
+ <adodis_general>
98
+ <adodis_latesttweets_enable>1</adodis_latesttweets_enable>
99
+ <adodis_latest_tweets_display_number>10</adodis_latest_tweets_display_number>
100
+ <adodis_latest_tweets_display_scroll>0</adodis_latest_tweets_display_scroll>
101
+ <adodis_latest_tweets_scroll_height>250</adodis_latest_tweets_scroll_height>
102
+ </adodis_general>
103
+ </adodis_latesttweets>
104
+ </default>
105
+ </config>
app/code/community/Adodis/Latesttweets/etc/system.xml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <tabs>
3
+ <adodis translate="label">
4
+ <label>Adodis</label>
5
+ <sort_order>190</sort_order>
6
+ </adodis>
7
+ </tabs>
8
+ <sections>
9
+ <adodis_latesttweets>
10
+ <label>Latest Tweets</label>
11
+ <tab>adodis</tab>
12
+ <frontend_type>text</frontend_type>
13
+ <sort_order>220</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <adodis_general translate="label">
19
+ <label>General</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>10</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <adodis_latesttweets_enable>
27
+ <label>Activate Latest Tweets</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>latesttweets/adminhtml_system_config_source_enabledisable</source_model>
30
+ <sort_order>1</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </adodis_latesttweets_enable>
35
+ <adodis_latest_tweets_username>
36
+ <label>Enter Twitter Username</label>
37
+ <frontend_type>Text</frontend_type>
38
+ <sort_order>2</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </adodis_latest_tweets_username>
43
+ <adodis_latest_tweets_display_number>
44
+ <label>Enter Number of tweets to be displayed</label>
45
+ <frontend_type>Text</frontend_type>
46
+ <sort_order>3</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ </adodis_latest_tweets_display_number>
51
+ <adodis_latest_tweets_display_scroll>
52
+ <label>Enable scroll</label>
53
+ <frontend_type>select</frontend_type>
54
+ <source_model>latesttweets/adminhtml_system_config_source_enablescroll</source_model>
55
+ <sort_order>4</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ </adodis_latest_tweets_display_scroll>
60
+ <adodis_latest_tweets_scroll_height>
61
+ <label>Enter height to limit Twitter container(in px)</label>
62
+ <frontend_type>Text</frontend_type>
63
+ <sort_order>5</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ </adodis_latest_tweets_scroll_height>
68
+ </fields>
69
+ </adodis_general>
70
+ </groups>
71
+ </adodis_latesttweets>
72
+ </sections>
73
+ </config>
app/design/frontend/default/default/layout/latesttweets.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <latesttweets_index_index>
6
+ <reference name="right">
7
+ <block type="latesttweets/latesttweets" name="latesttweets" template="latesttweets/latesttweets.phtml" />
8
+ </reference>
9
+ </latesttweets_index_index>
10
+ </layout>
app/design/frontend/default/default/template/latesttweets/latesttweets.phtml ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* backend options*/
2
+ $adodis_twitter_uername=Mage::getStoreConfig('adodis_latesttweets/adodis_general/adodis_latest_tweets_username');
3
+ $adodis_tweets_filter=Mage::getStoreConfig('adodis_latesttweets/adodis_general/adodis_latest_tweets_display_number');
4
+ $scroll=Mage::getStoreConfig('adodis_latesttweets/adodis_general/adodis_latest_tweets_display_scroll');
5
+ $scroll_height=Mage::getStoreConfig('adodis_latesttweets/adodis_general/adodis_latest_tweets_scroll_height');
6
+ $recent_tweets_enable=Mage::getStoreConfig('adodis_latesttweets/adodis_general/adodis_latesttweets_enable');
7
+ ?>
8
+ <?php
9
+ function getTime($time){
10
+ $tweetdate = $time;
11
+ $tweet = $tweettag["content"];
12
+ $timedate = explode(" ",$tweetdate);
13
+ $date = $timedate[0];
14
+ $time = substr($timedate[1],0, -1);
15
+ $tweettime = (strtotime($date." ".$time))+3600; // This is the value of the time difference - UK + 1 hours (3600 seconds)
16
+ $nowtime = time();
17
+ $timeago = ($nowtime-$tweettime);
18
+ $thehours = floor($timeago/3600);
19
+ $theminutes = floor($timeago/60);
20
+ $thedays = floor($timeago/86400);
21
+ /********************* Checking the times and returning correct value */
22
+ if($theminutes < 60){
23
+ if($theminutes < 1){
24
+ $timemessage = "Less than 1 minute ago";
25
+ } else if($theminutes == 1) {
26
+ $timemessage = $theminutes." minute ago.";
27
+ } else {
28
+ $timemessage = $theminutes." minutes ago.";
29
+ }
30
+ } else if($theminutes > 60 && $thedays < 1){
31
+ if($thehours == 1){
32
+ $timemessage = $thehours." hour ago.";
33
+ } else {
34
+ $timemessage = $thehours." hours ago.";
35
+ }
36
+ } else {
37
+ if($thedays == 1){
38
+ $timemessage = $thedays." day ago.";
39
+ } else {
40
+ $timemessage = $thedays." days ago.";
41
+ }
42
+ }
43
+ return $timemessage;
44
+ }
45
+ ?>
46
+ <?php if($recent_tweets_enable==1){?>
47
+ <link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('css/twitter.css') ?>" />
48
+ <h2 class="tut">Recent Tweets</h2>
49
+ <?php if($scroll==1){?>
50
+ <div id="twitter-ticker" style="overflow-y:scroll;height:<?php echo $scroll_height; ?>px;">
51
+ <?php } else{ ?>
52
+ <div id="twitter-ticker">
53
+ <?php } ?>
54
+ <div id="top-bar">
55
+ <div id="tweet-container">
56
+ <ul id="twitter_update_list">
57
+ <?php
58
+ $channel = new Zend_Feed_Rss('http://twitter.com/statuses/user_timeline/'.$adodis_twitter_uername.'.rss'); // Here you can add your twitter account link
59
+ $i = 0;
60
+ foreach ($channel as $item):
61
+ if ($i<$adodis_tweets_filter){ // limit to 3 ?>
62
+ <?php
63
+ $date = $item->pubDate('j F Y');
64
+ $date = substr($date, 0, -15);
65
+ $text = $item->description;
66
+ utf8_encode($text);
67
+ $timemessage = strtotime($item->pubDate());
68
+ $timemessage = date("Y-m-d H:i:s",$timemessage);
69
+ ?>
70
+ <li class="tweet"><?php echo $item->title; ?><br/>
71
+ <a href="<?php echo $item->link; ?>" title="<?php echo $item->title; ?>">Read Tweet &raquo;</a>
72
+ <span><?php echo getTime($timemessage); ?></span></li>
73
+ <?php
74
+ } // end the loop
75
+ $i++;
76
+ endforeach;
77
+ ?>
78
+ </ul>
79
+ </div>
80
+
81
+ </div>
82
+ </div>
83
+ <?php }?>
app/etc/modules/Adodis_Latesttweets.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Adodis_Latesttweets>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Adodis_Latesttweets>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Adodis_Latesttweets</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/gpl-license.php">GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Latest tweets Community Extension</summary>
10
+ <description>Support 1.5.X and 1.6.2</description>
11
+ <notes>Initial step to display latest tweets </notes>
12
+ <authors><author><name>Jextn Themes</name><user>adodistheme</user><email>magento-support@jextn.com</email></author></authors>
13
+ <date>2012-03-08</date>
14
+ <time>09:02:54</time>
15
+ <contents><target name="magecommunity"><dir><dir name="Adodis"><dir name="Latesttweets"><dir name="Block"><file name="Latesttweets.php" hash="486d9d9187c95b2d95c91dfd7d344564"/></dir><dir name="Helper"><file name="Data.php" hash="8ee1abf1b43d38819a9f6a3043a0568a"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Enabledisable.php" hash="93282f5774cc69646101147c8234a56d"/><file name="Enablescroll.php" hash="d49f91984dc2f630a30d1de618a49217"/></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="ed9f8cc8ca703af8a8d613de90132566"/><file name="system.xml" hash="be34a1fb01f07c3e8737002845be4800"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Adodis_Latesttweets.xml" hash="029a9fdceb465d2e03d71a86de6db130"/></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="latesttweets"><file name="latesttweets.phtml" hash="4318d6eb655644babc5c9077e894b875"/></dir></dir><dir name="layout"><file name="latesttweets.xml" hash="6c26f8785b058d83ef8608c90582133b"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="twitter.css" hash="44f11b94379892192255fe30ed3e9f44"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0</min><max>1.6.2</max></package></required></dependencies>
18
+ </package>
skin/frontend/default/default/css/twitter.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+ #twitter-ticker #twitter_update_list .tweet{margin-top:10px;margin-bottom:10px;padding-bottom: 12px;border-bottom:1px solid #ccc;}
2
+ .tut{margin-top:10px;}