Plugin Directory

Changeset 601837


Ignore:
Timestamp:
09/21/2012 02:04:26 AM (14 years ago)
Author:
tech163
Message:

Version 0.8.3

Location:
wordpress-tweeter/trunk
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • wordpress-tweeter/trunk

    • Property svn:ignore set to
      .git
  • wordpress-tweeter/trunk/wptweeter.php

    r600147 r601837  
    3737    $status = substr($status, 0, 140);
    3838   
    39     $ch = curl_init();
    40     curl_setopt($ch, CURLOPT_URL, "https://api.twitter.com/1.1/statuses/update.json");
    41     curl_setopt($ch, CURLOPT_HEADER, 0);
    42     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    43     curl_setopt($ch, CURLOPT_POST, 1);
    44     curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents('http://lab.sliceone.com/29308/tweet?oauth_token=' . $token . '&oauth_token_secret=' . $tokensecret . '&status=' . urlencode($status)));
    45     curl_exec($ch);
    46     curl_close($ch);
     39
     40    $response = wp_remote_get('http://lab.sliceone.com/29308/tweet?oauth_token=' . $token . '&oauth_token_secret=' . $tokensecret . '&status=' . urlencode($status));
     41    if(!is_wp_error( $response ) ) {
     42        $ch = curl_init();
     43        curl_setopt($ch, CURLOPT_URL, "https://api.twitter.com/1.1/statuses/update.json");
     44        curl_setopt($ch, CURLOPT_HEADER, 0);
     45        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     46        curl_setopt($ch, CURLOPT_POST, 1);
     47        curl_setopt($ch, CURLOPT_POSTFIELDS, $response['body']);
     48        curl_exec($ch);
     49        curl_close($ch);
     50    }
     51   
    4752}
    4853
     
    194199    echo '<div class="wrap"><h2>WordPress Tweeter</h2>';
    195200    if(empty($_GET['oauth_token']) && empty($wptweeteroptions)) {
    196         parse_str(file_get_contents('https://api.twitter.com/oauth/request_token?' . file_get_contents('http://lab.sliceone.com/29308/request-token?oauth_callback=' . admin_url('options-general.php?page=wptweeter.php'))));
     201        $response = wp_remote_get('http://lab.sliceone.com/29308/request-token?oauth_callback=' . admin_url('options-general.php?page=wptweeter.php'));
     202        $response = wp_remote_get('https://api.twitter.com/oauth/request_token?' . $response['body']);
     203        parse_str($response['body']);
    197204        $link = 'https://api.twitter.com/oauth/authorize?oauth_token=' . $oauth_token;
    198205    ?>
     
    285292    $wptweeteroptions = get_option('wp_tweeter');
    286293    if(!empty($_GET['oauth_token']) && !empty($_GET['oauth_verifier'])) {
    287         parse_str(file_get_contents('https://api.twitter.com/oauth/access_token?' . file_get_contents('http://lab.sliceone.com/29308/access-token?oauth_token=' . $_GET['oauth_token'] . '&oauth_verifier='  . $_GET['oauth_verifier'])), $access_token_data);
     294        $response = wp_remote_get('http://lab.sliceone.com/29308/access-token?oauth_token=' . $_GET['oauth_token'] . '&oauth_verifier='  . $_GET['oauth_verifier']);
     295        $response = wp_remote_get('https://api.twitter.com/oauth/access_token?' . $response['body']);
     296        parse_str($response['body'], $access_token_data);
    288297        if(empty($wptweeteroptions)) {
    289298            $default = array(
Note: See TracChangeset for help on using the changeset viewer.