|
| __construct ($consumerkey, $consumersecret, $callbackurl='') |
| Set up OAuth and initialize the client. More...
|
|
| call ($function, array $params=[], $method='GET') |
| Call a Flickr API method. More...
|
|
| get ($url, $params=array(), $token='', $secret='') |
| shortcut to start http get request
|
|
| get_access_token ($token, $secret, $verifier='') |
| Request oauth access token from server. More...
|
|
| get_nonce () |
| Generate nonce for oauth request.
|
|
| get_photo_url ($photoid) |
| Return the URL to fetch the given photo from. More...
|
|
| get_request_token_secret (array $identifiers) |
| Returns previously stored request token secret. More...
|
|
| get_signable_parameters ($params) |
| Build parameters list: oauth_consumer_key="0685bd9184jfhq22", oauth_nonce="4572616e48616d6d65724c61686176", oauth_token="ad180jjd733klru7", oauth_signature_method="HMAC-SHA1", oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D", oauth_timestamp="137131200", oauth_version="1.0" oauth_verifier="1.0". More...
|
|
| get_timestamp () |
| Generate timestamp.
|
|
| parse_result ($str) |
| A method to parse oauth response to get oauth_token and oauth_token_secret. More...
|
|
| post ($url, $params=array(), $token='', $secret='') |
| shortcut to start http post request
|
|
| prepare_oauth_parameters ($url, $params, $http_method='POST') |
| Initilize oauth request parameters, including: oauth_consumer_key="0685bd9184jfhq22", oauth_token="ad180jjd733klru7", oauth_signature_method="HMAC-SHA1", oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D", oauth_timestamp="137131200", oauth_nonce="4572616e48616d6d65724c61686176", oauth_version="1.0" To access protected resources, oauth_token should be defined. More...
|
|
| request ($method, $url, $params=array(), $token='', $secret='') |
| Request oauth protected resources. More...
|
|
| request_token () |
| Request token for authentication This is the first step to use OAuth, it will return oauth_token and oauth_token_secret. More...
|
|
| set_access_token ($token, $secret) |
| Set oauth access token for oauth request. More...
|
|
| set_nonce ($str) |
| Set nonce.
|
|
| set_request_token_secret (array $identifiers, $secret) |
| Temporarily store the request token secret in the session. More...
|
|
| set_timestamp ($time) |
| Set timestamp.
|
|
| setup_oauth_http_header ($params) |
|
| setup_oauth_http_options ($options) |
| Sets the options for the next curl request. More...
|
|
| sign ($http_method, $url, $params, $secret) |
| Create signature for oauth request. More...
|
|
| upload (stored_file $photo, array $meta=[]) |
| Upload a photo from Moodle file pool to Flickr. More...
|
|
Simple Flickr API client implementing the features needed by Moodle.
- Copyright
- 2017 David Mudrak david.nosp@m.@moo.nosp@m.dle.c.nosp@m.om
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
oauth_helper::prepare_oauth_parameters |
( |
|
$url, |
|
|
|
$params, |
|
|
|
$http_method = 'POST' |
|
) |
| |
|
inherited |
Initilize oauth request parameters, including: oauth_consumer_key="0685bd9184jfhq22", oauth_token="ad180jjd733klru7", oauth_signature_method="HMAC-SHA1", oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D", oauth_timestamp="137131200", oauth_nonce="4572616e48616d6d65724c61686176", oauth_version="1.0" To access protected resources, oauth_token should be defined.
- Parameters
-
string | $url | |
string | $token | |
string | $http_method | |
- Return values
-
flickr_client::set_request_token_secret |
( |
array |
$identifiers, |
|
|
|
$secret |
|
) |
| |
Temporarily store the request token secret in the session.
The request token secret is returned by the oauth request_token method. It needs to be stored in the session before the user is redirected to the Flickr to authorize the client. After redirecting back, this secret is used for exchanging the request token with the access token.
The identifiers help to avoid collisions between multiple calls to this method from different plugins in the same session. They are used as the session cache identifiers. Provide an associative array identifying the particular method call. At least, the array must contain the 'caller' with the caller's component name. Use additional items if needed.
- Parameters
-
array | $identifiers | Identification of the call |
string | $secret | |
flickr_client::upload |
( |
stored_file |
$photo, |
|
|
array |
$meta = [] |
|
) |
| |
Upload a photo from Moodle file pool to Flickr.
Optional meta information are title, description, tags, is_public, is_friend, is_family, safety_level, content_type and hidden. See https://www.flickr.com/services/api/upload.api.html.
Upload can't be asynchronous because then the query would not return the photo ID which we need to add the photo to a photoset (album) eventually.
- Parameters
-
stored_file | $photo | stored in Moodle file pool |
array | $meta | optional meta information |
- Return values
-
int|bool | photo id, false on authentication failure |