Plugin Directory

Changeset 384111


Ignore:
Timestamp:
05/12/2011 05:08:00 PM (15 years ago)
Author:
maltpress
Message:

update to v0.2: fixes cache error when Twitter unavailable, fixes date/time bug

Location:
reet-pe-tweet/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • reet-pe-tweet/trunk/readme.txt

    r384100 r384111  
    29292. Activate the plugin through the 'Plugins' menu in WordPress
    30303. Place your widget. Make sure you set a Twitter user name.
     314. If you get errors on activating/first loading your page, make sure your wp-content/uploads folder is there and writeable.
    3132
    3233== Frequently Asked Questions ==
     
    6768== Screenshots ==
    6869
     701. The Widget control panel
     712. Widget in place and unstyled on the 2010 theme, with replies off and "via" links on.
    6972
    7073== Changelog ==
    7174
     75= 0.2 =
     76* Fixed error whereby cache would be emptied and error shown if connection to Twitter lost
     77* Fixed error with dates and times on some versions of PHP
     78
    7279= 0.1 =
    7380* Plugin released
  • reet-pe-tweet/trunk/reet-pe-tweet.php

    r384100 r384111  
    44 * Plugin URI: http://www.maltpress.co.uk/services-2/wordpress-plugin-development/reet-pe-tweet/
    55 * Description: Displays latest tweets from a particular user.
    6  * Version: 0.1
     6 * Version: 0.2
    77 * Author: Adam Maltpress
    88 * Author URI: http://www.maltpress.co.uk
     
    148148            $content = $tweet['text'];
    149149            $timeCreated = strtotime($tweet['created_at'][0]);
     150            $timeCreated = mktime($timeCreated);
    150151            $source = $tweet['source'];
    151152            $in_reply = $tweet['in_reply_to_user_id'];
     
    285286            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    286287
    287             $twit_output = curl_exec($ch);
    288             // now write the data to the file
    289             $filewrite = fopen($cache_final_path, 'w') or die("can't open file");
    290             curl_setopt($ch, CURLOPT_FILE, $filewrite);
    291             $data = curl_exec($ch);
    292             // close everything
    293             curl_close($ch);
    294             fclose($filewrite);
     288             //check connection to Twitter
     289            if(curl_exec($ch) === false)
     290                {
     291
     292                    curl_close($ch);
     293                    $ch = curl_init();
     294                    curl_setopt($ch, CURLOPT_URL, $cache_url);
     295                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     296                    $twit_output = curl_exec($ch);
     297                    curl_close($ch);
     298                }
     299                else
     300                {
     301                    $twit_output = curl_exec($ch);
     302                    // now write the data to the file
     303                    $filewrite = fopen($cache_final_path, 'w') or die("can't open file");
     304                    curl_setopt($ch, CURLOPT_FILE, $filewrite);
     305                    $data = curl_exec($ch);
     306                    // close everything
     307                    curl_close($ch);
     308                    fclose($filewrite);
     309                }
     310           
    295311        }
    296312    }
Note: See TracChangeset for help on using the changeset viewer.