forked from stevencorona/php-twitpic
/
TwitPic.php
51 lines (42 loc) · 1.31 KB
/
TwitPic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?
/*
* TwitPic API for PHP
* Copyright 2010 Ryan LeFevre - @meltingice
* PHP version 5.3.0+
*
* Licensed under the New BSD License, more info in LICENSE file
* included with this software.
*
* Source code is hosted at http://github.com/meltingice/TwitPic-API-for-PHP
*/
include 'includes/config.php';
include 'includes/TwitPic_API.php';
include 'includes/TwitPicAPIException.php';
require_once 'HTTP/Request2.php';
require_once 'HTTP/OAuth/Consumer.php';
class TwitPic {
private $api;
public function __construct($api_key = "", $consumer_key = "", $consumer_secret = "", $oauth_token = "", $oauth_secret = "") {
TwitPic_Config::setAPIKey($api_key);
TwitPic_Config::setConsumer($consumer_key, $consumer_secret);
TwitPic_Config::setOAuth($oauth_token, $oauth_secret);
$this->api = new TwitPic_API($this->api_key);
}
public static function mode() {
return TwitPic_Config::mode();
}
public function upload($method_args, $options=array()) {
$options['tweet'] = false;
return $this->api->upload($method_args, $options);
}
public function uploadAndPost($method_args, $options=array()) {
$options['tweet'] = true;
return $this->api->upload($method_args, $options);
}
/*
* Throw the request over to the API class to handle
*/
public function __get($key) {
return $this->api->{$key};
}
}