66 * A Twitter library in PHP.
77 *
88 * @package codebird
9- * @version 2.5.0-rc.2
9+ * @version 2.5.0
1010 * @author Jublo Solutions <support@jublo.net>
1111 * @copyright 2010-2014 Jublo Solutions <support@jublo.net>
1212 *
@@ -117,7 +117,7 @@ class Codebird
117117 /**
118118 * The current Codebird version
119119 */
120- protected $ _version = '2.5.0-rc.2 ' ;
120+ protected $ _version = '2.5.0 ' ;
121121
122122 /**
123123 * Request timeout
@@ -1051,21 +1051,28 @@ protected function _callApi($httpmethod, $method, $params = array(), $multipart
10511051 $ params ['application_id ' ] = 333903271 ;
10521052 }
10531053
1054- $ url = $ this ->_getEndpoint ($ method );
1054+ $ authorization = null ;
1055+ $ url = $ this ->_getEndpoint ($ method );
10551056 $ request_headers = array ();
10561057 if ($ httpmethod === 'GET ' ) {
10571058 $ url_with_params = $ url ;
10581059 if (json_encode ($ params ) !== '{} ' ) {
10591060 $ url_with_params .= '? ' . http_build_query ($ params );
10601061 }
1061- $ authorization = $ this ->_sign ($ httpmethod , $ url , $ params );
1062+ if (! $ app_only_auth ) {
1063+ $ authorization = $ this ->_sign ($ httpmethod , $ url , $ params );
1064+ }
10621065 $ ch = curl_init ($ url_with_params );
10631066 } else {
10641067 if ($ multipart ) {
1065- $ authorization = $ this ->_sign ($ httpmethod , $ url , array ());
1066- $ params = $ this ->_buildMultipart ($ method , $ params );
1068+ if (! $ app_only_auth ) {
1069+ $ authorization = $ this ->_sign ($ httpmethod , $ url , array ());
1070+ }
1071+ $ params = $ this ->_buildMultipart ($ method , $ params );
10671072 } else {
1068- $ authorization = $ this ->_sign ($ httpmethod , $ url , $ params );
1073+ if (! $ app_only_auth ) {
1074+ $ authorization = $ this ->_sign ($ httpmethod , $ url , $ params );
1075+ }
10691076 $ params = http_build_query ($ params );
10701077 }
10711078 $ ch = curl_init ($ url );
@@ -1079,8 +1086,10 @@ protected function _callApi($httpmethod, $method, $params = array(), $multipart
10791086 curl_setopt ($ ch , CURLOPT_POSTFIELDS , $ params );
10801087 }
10811088 if ($ app_only_auth ) {
1082- if (self ::$ _oauth_consumer_key === null ) {
1083- throw new \Exception ('To make an app-only auth API request, the consumer key must be set. ' );
1089+ if (self ::$ _oauth_consumer_key === null
1090+ && self ::$ _oauth_bearer_token === null
1091+ ) {
1092+ throw new \Exception ('To make an app-only auth API request, consumer key or bearer token must be set. ' );
10841093 }
10851094 // automatically fetch bearer token, if necessary
10861095 if (self ::$ _oauth_bearer_token === null ) {
0 commit comments