Show
Ignore:
Timestamp:
02/12/11 17:47:46 (2 years ago)
Author:
Torben Brodt
Message:

move twitter base package

Location:
de.easy-coding.wcf.twitter
Files:
1 modified
1 moved

Legend:

Unmodified
Added
Removed
  • de.easy-coding.wcf.twitter/files/lib/util/TwitterUtil.class.php

    r769 r1285  
    9696         
    9797        function getRateLimit($format, $since_id = 0) { 
    98                 $api_call = sprintf("http://twitter.com/account/rate_limit_status.%s", $format); 
     98                $api_call = sprintf("account/rate_limit_status.%s", $format); 
     99                return $this->APICall($api_call); 
     100        } 
     101         
     102        function getRateLimit($format, $since_id = 0) { 
     103                $api_call = sprintf("account/rate_limit_status.%s", $format); 
     104                return $this->APICall($api_call); 
     105        } 
     106         
     107        function getMentions($format, $since_id = 0) { 
     108                $api_call = sprintf("statuses/mentions.%s", $format); 
    99109                return $this->APICall($api_call); 
    100110        } 
    101111         
    102112        function getPublicTimeline($format, $since_id = 0) { 
    103                 $api_call = sprintf("http://twitter.com/statuses/public_timeline.%s", $format); 
     113                $api_call = sprintf("statuses/public_timeline.%s", $format); 
    104114                if ($since_id > 0) { 
    105115                        $api_call .= sprintf("?since_id=%d", $since_id); 
     
    110120        function getFriendsTimeline($format, $id = NULL, $since = NULL) { 
    111121                if ($id != NULL) { 
    112                         $api_call = sprintf("http://twitter.com/statuses/friends_timeline/%s.%s", $id, $format); 
     122                        $api_call = sprintf("statuses/friends_timeline/%s.%s", $id, $format); 
    113123                } 
    114124                else { 
    115                         $api_call = sprintf("http://twitter.com/statuses/friends_timeline.%s", $format); 
     125                        $api_call = sprintf("statuses/friends_timeline.%s", $format); 
    116126                } 
    117127                if ($since != NULL) { 
     
    123133        function getUserTimeline($format, $id = NULL, $count = 20, $since = NULL) { 
    124134                if ($id != NULL) { 
    125                         $api_call = sprintf("http://twitter.com/statuses/user_timeline/%s.%s", $id, $format); 
     135                        $api_call = sprintf("statuses/user_timeline/%s.%s", $id, $format); 
    126136                } 
    127137                else { 
    128                         $api_call = sprintf("http://twitter.com/statuses/user_timeline.%s", $format); 
     138                        $api_call = sprintf("statuses/user_timeline.%s", $format); 
    129139                } 
    130140                if ($count != 20) { 
     
    138148         
    139149        function showStatus($format, $id) { 
    140                 $api_call = sprintf("http://twitter.com/statuses/show/%d.%s", $id, $format); 
     150                $api_call = sprintf("statuses/show/%d.%s", $id, $format); 
    141151                return $this->APICall($api_call); 
    142152        } 
     
    144154        function updateStatus($format, $status) { 
    145155                $status = urlencode(stripslashes(urldecode($status))); 
    146                 $api_call = sprintf("http://twitter.com/statuses/update.%s?status=%s", $format, $status); 
     156                $api_call = sprintf("statuses/update.%s?status=%s", $format, $status); 
    147157                return $this->APICall($api_call, true, true); 
    148158        } 
    149159         
    150160        function getReplies($format, $page = 0) { 
    151                 $api_call = sprintf("http://twitter.com/statuses/replies.%s", $format); 
     161                $api_call = sprintf("statuses/replies.%s", $format); 
    152162                if ($page) { 
    153163                        $api_call .= sprintf("?page=%d", $page); 
     
    157167         
    158168        function destroyStatus($format, $id) { 
    159                 $api_call = sprintf("http://twitter.com/statuses/destroy/%d.%s", $id, $format); 
     169                $api_call = sprintf("statuses/destroy/%d.%s", $id, $format); 
    160170                return $this->APICall($api_call, true); 
    161171        } 
     
    163173        function getFriends($format, $page = 1) { 
    164174                // take care of the id parameter 
    165                 $api_call = sprintf("http://twitter.com/statuses/friends.%s%s", $format, "?page=$page"); 
     175                $api_call = sprintf("statuses/friends.%s%s", $format, "?page=$page"); 
    166176                return $this->APICall($api_call, true); 
    167177        } 
    168178         
    169179        function getFollowers($format, $page = 1) { 
    170                 $api_call = sprintf("http://twitter.com/statuses/followers.%s%s", $format, "?page=$page"); 
     180                $api_call = sprintf("statuses/followers.%s%s", $format, "?page=$page"); 
    171181                return $this->APICall($api_call, true); 
    172182        } 
    173183         
    174184        function getFeatured($format) { 
    175                 $api_call = sprintf("http://twitter.com/statuses/featured.%s", $format); 
     185                $api_call = sprintf("statuses/featured.%s", $format); 
    176186                return $this->APICall($api_call); 
    177187        } 
     
    179189        function showUser($format, $id, $email = NULL) { 
    180190                if ($email == NULL) { 
    181                         $api_call = sprintf("http://twitter.com/users/show/%s.%s", $id, $format); 
     191                        $api_call = sprintf("users/show/%s.%s", $id, $format); 
    182192                } 
    183193                else { 
    184                         $api_call = sprintf("http://twitter.com/users/show.xml?email=%s", $email); 
     194                        $api_call = sprintf("users/show.xml?email=%s", $email); 
    185195                } 
    186196                return $this->APICall($api_call, true); 
     
    188198         
    189199        function getMessages($format, $since = NULL, $since_id = 0, $page = 1) { 
    190                 $api_call = sprintf("http://twitter.com/direct_messages.%s", $format); 
     200                $api_call = sprintf("direct_messages.%s", $format); 
    191201                if ($since != NULL) { 
    192202                        $api_call .= sprintf("?since=%s", urlencode($since)); 
     
    202212         
    203213        function getSentMessages($format, $since = NULL, $since_id = 0, $page = 1) { 
    204                 $api_call = sprintf("http://twitter.com/direct_messages/sent.%s", $format); 
     214                $api_call = sprintf("direct_messages/sent.%s", $format); 
    205215                if ($since != NULL) { 
    206216                        $api_call .= sprintf("?since=%s", urlencode($since)); 
     
    217227        function newMessage($format, $user, $text) { 
    218228                $text = urlencode(stripslashes(urldecode($text))); 
    219                 $api_call = sprintf("http://twitter.com/direct_messages/new.%s?user=%s&text=%s", $format, $user, $text); 
     229                $api_call = sprintf("direct_messages/new.%s?user=%s&text=%s", $format, $user, $text); 
    220230                return $this->APICall($api_call, true, true); 
    221231        } 
    222232         
    223233        function destroyMessage($format, $id) { 
    224                 $api_call = sprintf("http://twitter.com/direct_messages/destroy/%s.%s", $id, $format); 
     234                $api_call = sprintf("direct_messages/destroy/%s.%s", $id, $format); 
    225235                return $this->APICall($api_call, true); 
    226236        } 
    227237         
    228238        function createFriendship($format, $id) { 
    229                 $api_call = sprintf("http://twitter.com/friendships/create/%d.%s", $id, $format); 
     239                $api_call = sprintf("friendships/create/%d.%s", $id, $format); 
    230240                return $this->APICall($api_call, true, true); 
    231241        } 
    232242         
    233243        function destroyFriendship($format, $id) { 
    234                 $api_call = sprintf("http://twitter.com/friendships/destroy/%s.%s", $id, $format); 
     244                $api_call = sprintf("friendships/destroy/%s.%s", $id, $format); 
    235245                return $this->APICall($api_call, true, true); 
    236246        } 
    237247         
    238248        function verifyCredentials($format = NULL) { 
    239                 $api_call = sprintf("http://twitter.com/account/verify_credentials%s", ($format != NULL) ? sprintf(".%s", $format) : NULL); 
     249                $api_call = sprintf("account/verify_credentials%s", ($format != NULL) ? sprintf(".%s", $format) : NULL); 
    240250                return $this->APICall($api_call, true); 
    241251        } 
    242252         
    243253        function endSession() { 
    244                 $api_call = "http://twitter.com/account/end_session"; 
     254                $api_call = "account/end_session"; 
    245255                return $this->APICall($api_call, true); 
    246256        } 
    247257         
    248258        function getArchive($format, $page = 1) { 
    249                 $api_call = sprintf("http://twitter.com/account/archive.%s", $format); 
     259                $api_call = sprintf("account/archive.%s", $format); 
    250260                if ($page > 1) { 
    251261                        $api_call .= sprintf("?page=%d", $page); 
     
    256266        function getFavorites($format, $id = NULL, $page = 1) { 
    257267                if ($id == NULL) { 
    258                         $api_call = sprintf("http://twitter.com/favourings.%s", $format); 
     268                        $api_call = sprintf("favourings.%s", $format); 
    259269                } 
    260270                else { 
    261                         $api_call = sprintf("http://twitter.com/favourings/%s.%s", $id, $format); 
     271                        $api_call = sprintf("favourings/%s.%s", $id, $format); 
    262272                } 
    263273                if ($page > 1) { 
     
    268278         
    269279        function createFavorite($format, $id) { 
    270                 $api_call = sprintf("http://twitter.com/favourings/create/%d.%s", $id, $format); 
     280                $api_call = sprintf("favourings/create/%d.%s", $id, $format); 
    271281                return $this->APICall($api_call, true); 
    272282        } 
    273283         
    274284        function destroyFavorite($format, $id) { 
    275                 $api_call = sprintf("http://twitter.com/favourings/destroy/%d.%s", $id, $format); 
     285                $api_call = sprintf("favourings/destroy/%d.%s", $id, $format); 
    276286                return $this->APICall($api_call, true); 
    277287        } 
    278288         
    279289        private function APICall($api_url, $require_credentials = false, $http_post = false) { 
     290                $api_url = 'http://api.twitter.com/1/'; 
     291         
    280292                $curl_handle = curl_init(); 
    281293                curl_setopt($curl_handle, CURLOPT_URL, $api_url);