Plugin Directory

Changeset 149770


Ignore:
Timestamp:
08/27/2009 10:52:16 PM (17 years ago)
Author:
SharkBait
Message:

Modified README file & Plugin

Location:
wpcommenttwit/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wpcommenttwit/trunk/readme.txt

    r149745 r149770  
    33Tags: comments, twitter
    44Requires at least: 2.6
    5 Tested up to: 2.7.1
     5Tested up to: 2.8.4
    66Stable tag: 0.3
    77
     
    2525* Switched to using Bit.ly as the shorten URL hashing
    2626* Properly Encodes URL for shortening
     27* Ensured no white spaces mess up field values when submitting URL to bit.ly
    2728
    2829= 0.2 =
  • wpcommenttwit/trunk/wpCommentTwit.php

    r149744 r149770  
    5757    $q = $wpdb->get_results($s, ARRAY_A);
    5858   
    59     if(count($q) > 0) {
    60         // Not a spam Comment - Create SNURL for Twitter
    61         //$url = "http://snipr.com/site/snip?r=simple&link=". get_permalink($q[0]['comment_post_ID']) ."#comment-{$comment_ID}";
    62        
     59    if(count($q) > 0) {     
    6360        $url = get_permalink($q[0]['comment_post_ID']). "#comment-{$comment_ID}";               // Get the URL of the Post that is being commented on
     61
    6462        $bitly = "http://api.bit.ly/shorten?version=2.0.1&longUrl=". urlencode($url) . "&login=". $wpComment_bitlyuser . "&apiKey=".$wpComment_apikey."&format=json&history=1";
    65        
    6663        $ch = curl_init();
    6764        curl_setopt($ch, CURLOPT_URL, $bitly);
     
    7269       
    7370        $obj = json_decode($result, true);
    74         $shortUrl = $obj['results'][$url]['shortUrl'];      // This is the Shortened URL
    7571       
    76         $message .= ' - '. $shortUrl;
    77         // Send DM
    78         twit_send_dm($wpComment_username, $wpComment_password, $wpComment_target, $message);
     72        if($obj['errorCode'] == 0) {
     73            $newURL = $obj['results'][$url]['shortUrl'];
     74           
     75            $message .= ' - '. $newURL;
     76            // Send DM
     77            twit_send_dm($wpComment_username, $wpComment_password, $wpComment_target, $message);
     78        } // else we do nothing
    7979    }
    8080
     
    9090    {
    9191        if (isset($_POST['username'])) {
    92             $username = $_POST['username'];
     92            $username = trim($_POST['username']);
    9393        } else {
    9494            $username = '';
     
    9696
    9797        if (isset($_POST['password'])) {
    98             $password = $_POST['password'];
     98            $password = trim($_POST['password']);
    9999        } else {
    100100            $password = '';
    101101        }
    102102        if(isset($_POST['target'])) {
    103             $target = $_POST['target'];
     103            $target = trim($_POST['target']);
    104104        } else {
    105105            $target = '';
    106106        }
    107107        if(isset($_POST['apikey'])) {
    108             $apikey = $_POST['apikey'];
     108            $apikey = trim($_POST['apikey']);
    109109        } else {
    110110            $apikey = '';
    111111        }
    112112        if(isset($_POST['bitlyuser'])) {
    113             $bitlyuser = $_POST['bitlyuser'];
     113            $bitlyuser = trim($_POST['bitlyuser']);
    114114        } else {
    115115            $bitlyuser = '';
Note: See TracChangeset for help on using the changeset viewer.