Changeset 149770
- Timestamp:
- 08/27/2009 10:52:16 PM (17 years ago)
- Location:
- wpcommenttwit/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
wpCommentTwit.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpcommenttwit/trunk/readme.txt
r149745 r149770 3 3 Tags: comments, twitter 4 4 Requires at least: 2.6 5 Tested up to: 2. 7.15 Tested up to: 2.8.4 6 6 Stable tag: 0.3 7 7 … … 25 25 * Switched to using Bit.ly as the shorten URL hashing 26 26 * Properly Encodes URL for shortening 27 * Ensured no white spaces mess up field values when submitting URL to bit.ly 27 28 28 29 = 0.2 = -
wpcommenttwit/trunk/wpCommentTwit.php
r149744 r149770 57 57 $q = $wpdb->get_results($s, ARRAY_A); 58 58 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) { 63 60 $url = get_permalink($q[0]['comment_post_ID']). "#comment-{$comment_ID}"; // Get the URL of the Post that is being commented on 61 64 62 $bitly = "http://api.bit.ly/shorten?version=2.0.1&longUrl=". urlencode($url) . "&login=". $wpComment_bitlyuser . "&apiKey=".$wpComment_apikey."&format=json&history=1"; 65 66 63 $ch = curl_init(); 67 64 curl_setopt($ch, CURLOPT_URL, $bitly); … … 72 69 73 70 $obj = json_decode($result, true); 74 $shortUrl = $obj['results'][$url]['shortUrl']; // This is the Shortened URL75 71 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 79 79 } 80 80 … … 90 90 { 91 91 if (isset($_POST['username'])) { 92 $username = $_POST['username'];92 $username = trim($_POST['username']); 93 93 } else { 94 94 $username = ''; … … 96 96 97 97 if (isset($_POST['password'])) { 98 $password = $_POST['password'];98 $password = trim($_POST['password']); 99 99 } else { 100 100 $password = ''; 101 101 } 102 102 if(isset($_POST['target'])) { 103 $target = $_POST['target'];103 $target = trim($_POST['target']); 104 104 } else { 105 105 $target = ''; 106 106 } 107 107 if(isset($_POST['apikey'])) { 108 $apikey = $_POST['apikey'];108 $apikey = trim($_POST['apikey']); 109 109 } else { 110 110 $apikey = ''; 111 111 } 112 112 if(isset($_POST['bitlyuser'])) { 113 $bitlyuser = $_POST['bitlyuser'];113 $bitlyuser = trim($_POST['bitlyuser']); 114 114 } else { 115 115 $bitlyuser = '';
Note: See TracChangeset
for help on using the changeset viewer.