10000 Merge pull request #18 from freen/master · codezninja/codebird-php@fffa914 · GitHub
[go: up one dir, main page]

Skip to content

Commit fffa914

Browse files
committed
Merge pull request jublo#18 from freen/master
2 parents aa1cb54 + 3731477 commit fffa914

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ codebird-php - changelog
22
========================
33

44
2.3.5 (not yet released)
5+
+ Fix fatal error: Class 'Codebird\Exception' not found
56

67
2.3.4 (2013-04-28)
78
+ Fix namespace not properly cased

src/codebird.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public function __call($fn, $params)
241241
for ($i = 0; $i < 26; $i++) {
242242
$method_template = str_replace(chr(65 + $i), '_' . chr(97 + $i), $method_template);
243243
}
244-
throw new Exception(
244+
throw new \Exception(
245245
'To call the templated method "' . $method_template
246246
. '", specify the parameter value for "' . $param_l . '".'
247247
);
@@ -285,7 +285,7 @@ public function __call($fn, $params)
285285
public function oauth_authenticate($force_login = NULL, $screen_name = NULL)
286286
{
287287
if ($this->_oauth_token == null) {
288-
throw new Exception('To get the authenticate URL, the OAuth token must be set.');
288+
throw new \Exception('To get the authenticate URL, the OAuth token must be set.');
289289
}
290290
$url = self::$_endpoint_oauth . 'oauth/authenticate?oauth_token=' . $this->_url($this->_oauth_token);
291291
if ($force_login) {
@@ -305,7 +305,7 @@ public function oauth_authenticate($force_login = NULL, $screen_name = NULL)
305305
public function oauth_authorize($force_login = NULL, $screen_name = NULL)
306306
{
307307
if ($this->_oauth_token == null) {
308-
throw new Exception('To get the authorize URL, the OAuth token must be set.');
308+
throw new \Exception('To get the authorize URL, the OAuth token must be set.');
309309
}
310310
$url = self::$_endpoint_oauth . 'oauth/authorize?oauth_token=' . $this->_url($this->_oauth_token);
311311
if ($force_login) {
@@ -326,10 +326,10 @@ public function oauth_authorize($force_login = NULL, $screen_name = NULL)
326326
public function oauth2_token()
327327
{
328328
if (! function_exists('curl_init')) {
329-
throw new Exception('To make API requests, the PHP curl extension must be available.');
329+
throw new \Exception('To make API requests, the PHP curl extension must be available.');
330330
}
331331
if (self::$_oauth_consumer_key == null) {
332-
throw new Exception('To obtain a bearer token, the consumer key must be set.');
332+
throw new \Exception('To obtain a bearer token, the consumer key must be set.');
333333
}
334334
$ch = false;
335335
$post_fields = array(
@@ -414,10 +414,10 @@ private function _url($data)
414414
private function _sha1($data)
415415
{
416416
if (self::$_oauth_consumer_secret == null) {
417-
throw new Exception('To generate a hash, the consumer secret must be set.');
417+
throw new \Exception('To generate a hash, the consumer secret must be set.');
418418
}
419419
if (!function_exists('hash_hmac')) {
420-
throw new Exception('To generate a hash, the PHP hash extension must be available.');
420+
throw new \Exception('To generate a hash, the PHP hash extension must be available.');
421421
}
422422
return base64_encode(hash_hmac('sha1', $data, self::$_oauth_consumer_secret . '&'
423423
. ($this->_oauth_token_secret != null ? $this->_oauth_token_secret : ''), true));
@@ -433,7 +433,7 @@ private function _sha1($data)
433433
protected function _nonce($length = 8)
434434
{
435435
if ($length < 1) {
436-
throw new Exception('Invalid nonce length.');
436+
throw new \Exception('Invalid nonce length.');
437437
}
438438
return substr(md5(microtime(true)), 0, $length);
439439
}
@@ -450,7 +450,7 @@ protected function _nonce($length = 8)
450450
protected function _sign($httpmethod, $method, $params = array())
451451
{
452452
if (self::$_oauth_consumer_key == null) {
453-
throw new Exception('To generate a signature, the consumer key must be set.');
453+
throw new \Exception('To generate a signature, the consumer key must be set.');
454454
}
455455
$sign_params = array(
456456
'consumer_key' => self::$_oauth_consumer_key,
@@ -659,7 +659,7 @@ protected function _detectMethod($method, $params)
659659
return $httpmethod;
660660
}
661661
}
662-
throw new Exception('Can\'t find HTTP method to use for "' . $method . '".');
662+
throw new \Exception('Can\'t find HTTP method to use for "' . $method . '".');
663663
}
664664

665665
/**
@@ -721,7 +721,7 @@ protected function _detectFilenames($method, &$params)
721721
}
722722
// is it an array?
723723
if (is_array($params[$possible_file])) {
724-
throw new Exception('Using URL-encoded parameters is not supported for uploading media.');
724+
throw new \Exception('Using URL-encoded parameters is not supported for uploading media.');
725725
continue;
726726
}
727727
// is it a file, a readable one?
@@ -785,7 +785,7 @@ protected function _getEndpoint($method, $method_template)
785785
protected function _callApi($httpmethod, $method, $method_template, $params = array(), $multipart = false, $app_only_auth = false)
786786
{
787787
if (! function_exists('curl_init')) {
788-
throw new Exception('To make API requests, the PHP curl extension must be available.');
788+
throw new \Exception('To make API requests, the PHP curl extension must be available.');
789789
}
790790
$url = $this->_getEndpoint($method, $method_template);
791791
$ch = false;
@@ -809,7 +809,7 @@ protected function _callApi($httpmethod, $method, $method_template, $params = ar
809809
}
810810
if ($app_only_auth) {
811811
if (self::$_oauth_consumer_key == null) {
812-
throw new Exception('To make an app-only auth API request, the consumer key must be set.');
812+
throw new \Exception('To make an app-only auth API request, the consumer key must be set.');
813813
}
814814
// automatically fetch bearer token, if necessary
815815
if (self::$_oauth_bearer_token == null) {

0 commit comments

Comments
 (0)
0