Ignore:
Timestamp:
02/24/10 05:57:23 (3 years ago)
Author:
catchpen
Message:

twitter_widget updates... good for release

Location:
branches/1.2/content/plugins/twitter_widget
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/content/plugins/twitter_widget/css/twitter_widget.css

    r1162 r1235  
    1 /* by Antonio Lupetti http://woork.blogspot.com/2009/06/super-simple-way-to-work-with-twitter.html */ 
    2  
     1/* Thanks to Antonio Lupetti http://woork.blogspot.com/2009/06/super-simple-way-to-work-with-twitter.html */ 
    32 
    43.twitter_container{ 
     
    98        margin: 0 auto; 
    109} 
    11  
    1210.twitter_container a { 
    1311        color:#0066CC; 
     
    2220} 
    2321.twitter_header h3{ 
    24    padding-top:4px; 
     22   padding-top:7px; 
    2523} 
    2624.twitter_header h3 a{ 
    27    font-size:1.2em; 
     25   font-size:14px; 
    2826   padding-top:4px; 
    2927   color:#0066CC; 
     
    3937} 
    4038.twitter_status{ 
     39        border-bottom:solid 1px #DEDEDE; 
    4140        height:50px; 
     41        *height:64px; 
     42        overflow:hidden; 
    4243        padding:6px; 
    43         border-bottom:solid 1px #DEDEDE; 
    44  
    4544} 
    4645.twitter_image{ 
     
    5150        height:48px; 
    5251} 
     52 
    5353.twitter_posted_at{ 
    5454         font-size:11px; 
  • branches/1.2/content/plugins/twitter_widget/languages/twitter_widget_language.php

    r1159 r1235  
    3737/* Sidebar */ 
    3838$lang["twitter_widget_follow_us"] = "Follow Us on Twitter!"; 
     39$lang["twitter_widget_followers"] = "Followers"; 
     40 
    3941?> 
  • branches/1.2/content/plugins/twitter_widget/readme.txt

    r1151 r1235  
    22--------------------------------- 
    33Created by: Jon Harvey 
    4 Uses Twitterlibphp 
     4Uses: Twitterlibphp 
    55Thanks to : Antonio Lupetti 
    66 
     
    1919Changelog 
    2020--------- 
    21 v.0.1 2010/--/-- - JonH - Released first version 
     21v.0.1 2010/02/24 - JonH - Released first version 
  • branches/1.2/content/plugins/twitter_widget/twitter_widget.php

    r1203 r1235  
    22/** 
    33 * name: Twitter Widget 
    4  * description: Sidebar widget that shows your sites Twitter follower count and tweets 
     4 * description: Sidebar widget that shows your sites Twitter follower count and friends tweets 
    55 * version: 0.1 
    66 * folder: twitter_widget 
    77 * class: TwitterWidget 
    8  * requires: widgets 0.7 
     8 * requires: widgets 0.7, sb_base 0.1 
    99 * hooks: install_plugin, header_include, admin_plugin_settings, admin_sidebar_plugin_settings 
    1010 * author: Jon Harvey 
     
    5858    public function widget_twitter_widget($h) 
    5959    { 
     60         
     61                // your twitter username and password 
     62        $twitter_widget_username = $h->getSetting('twitter_widget_username', 'twitter_widget');  
     63        $twitter_widget_password = $h->getSetting('twitter_widget_password', 'twitter_widget'); 
     64         
     65        // include Twitterlibphp 
     66        require_once(PLUGINS . 'twitter_widget/libs/twitter_lib.php'); 
     67                 
     68                // initialize the twitter class 
     69        $twitter = new Twitter($twitter_widget_username, $twitter_widget_password); 
     70         
     71 
     72                ///// testing purposes (doesn't count against your hit limit to call up remaining hits) 
     73        if ($h->isDebug) { 
     74                    // grabs status for API rate limit for testing cache 
     75                        $calls = $twitter->rateLimitStatus(); 
     76                         
     77                        $hits = new SimpleXMLElement($calls); 
     78                         
     79            echo '<br/>'; 
     80            echo 'remaining hits for this hour = ' . $hits->{'remaining-hits'}; 
     81        } 
     82         
    6083        $need_cache = false; 
    6184 
    6285        // check for a cached version and use it if no recent update: 
    63         $cached_output = $h->smartCache('html', 'posts', 60, '', 'twitter_widget'); 
     86        $cached_output = $h->smartCache('html', 'posts', 10, '', 'twitter_widget'); 
    6487        if ($cached_output) { 
    6588            echo $cached_output; // cached HTML 
     
    6992        } 
    7093 
    71         // your twitter username and password 
    72         $twitter_widget_username = $h->getSetting('twitter_widget_username', 'twitter_widget');  
    73         $twitter_widget_password = $h->getSetting('twitter_widget_password', 'twitter_widget'); 
    74          
    75         // include Twitterlibphp 
    76         require_once(PLUGINS . 'twitter_widget/libs/twitter_lib.php'); 
    77          
    78         // initialize the twitter class 
    79         $twitter = new Twitter($twitter_widget_username, $twitter_widget_password); 
    80          
    81         // grabs status for API rate limit for testing cache 
    82         $calls = $twitter->rateLimitStatus(); 
    83          
    84         $hits = new SimpleXMLElement($calls); 
    85      
    8694        // fetch your profile in xml format 
    8795        $user = $twitter->showUser(); 
     
    8997        $my_info = new SimpleXMLElement($user); 
    9098         
    91         // fetch your friends in xml format or use getUserTimeline to show your own  
     99        // fetch your friends (people you follow) in xml format or use getUserTimeline() to show your own  
    92100        $xml = $twitter->getFriendsTimeline(); 
    93101         
     
    109117           
    110118         
    111          
    112119    // show twitter widget template 
    113120        $output = "<div class='twitter_container'>\n";         
    114121        $output .= "<div class='twitter_header'>\n"; 
    115122        $output .= "<img src='".$my_info->profile_image_url."' alt=".$my_info->screen_name." title=".$my_info->screen_name." >\n"; 
    116         $output .= "<h3><a href='http://www.twitter.com/".$my_info->screen_name."'>".$my_info->followers_count." Followers</a></h3>\n"; 
     123        $output .= "<h3><a href='http://www.twitter.com/".$my_info->screen_name."'>".$my_info->followers_count ."&nbsp;". $h->lang['twitter_widget_followers']."</a></h3>\n"; 
    117124        //$output .= "<br/>\n"; 
    118125        $output .= "<a href='http://www.twitter.com/".$my_info->screen_name."'>".$h->lang['twitter_widget_follow_us']."</a>\n"; 
     
    124131            $output .= "<div class='twitter_status'>\n"; 
    125132            foreach($status->user as $user){ 
    126                 $output .= "<img src='".$user->profile_image_url."' class='twitter_image'>\n"; 
     133                $output .= "<img src='".$user->profile_image_url."' alt=".$user->screen_name." title=".$user->screen_name." class='twitter_image'>\n"; 
    127134                $output .= "<a href='http://www.twitter.com/".$user->screen_name."'>".$user->name."</a>: \n"; 
    128135            } 
     
    137144        $output .= "</div>"; 
    138145 
    139         ///// testing purposes (doesn't count against your hit limit to call up remaining hits) 
    140         if ($h->isDebug) { 
    141             $output .= '<br/>'; 
    142             $output .= 'remaining hits for this hour = ' . $hits->{'remaining-hits'}; 
    143         } 
    144146         
    145  
    146         ///////////////////////////////////       
    147  
    148147        if ($need_cache) { 
    149148            $h->smartCache('html', 'posts', 10, $output, 'twitter_widget');  
     
    152151        echo $output; 
    153152 
    154         ////////////////////////////////////////// 
    155          
    156153    } 
    157154 
Note: See TracChangeset for help on using the changeset viewer.