White-space and docblock updates.
This commit is contained in:
parent
f37073b0c1
commit
e40d98ec8e
@ -39,7 +39,6 @@ class bitly_Controller extends Controller {
|
||||
if ($short_url) {
|
||||
message::success("Item URL shortened to $short_url");
|
||||
} else {
|
||||
|
||||
message::error("Unable to shorten " . url::abs_site($item->relative_url_cache));
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,8 @@ class bitly_Core {
|
||||
|
||||
/**
|
||||
* Check a login and an API Key against bit.ly to make sure they're valid
|
||||
* @param string $login the login
|
||||
* @param string $api_key the API key
|
||||
* @param string $login bit.ly login
|
||||
* @param string $api_key bit.ly API key
|
||||
* @return boolean
|
||||
*/
|
||||
static function validate_config($login, $api_key) {
|
||||
@ -115,15 +115,15 @@ class bitly_Core {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <type> $type
|
||||
* @param <type> $parameters
|
||||
* Assemble a bitly API request
|
||||
* @param string $type Type of API request, ex. shorten
|
||||
* @param array $params Query string key/value pairs
|
||||
* @return string
|
||||
*/
|
||||
private static function _build_http_request($type, $parameters) {
|
||||
private static function _build_http_request($type, $params) {
|
||||
$http_request = '';
|
||||
if (!empty($type) && count($parameters)) {
|
||||
foreach($parameters as $k => $v) {
|
||||
if (!empty($type) && count($params)) {
|
||||
foreach($params as $k => $v) {
|
||||
$query_string[] = "$k=" . urlencode($v);
|
||||
}
|
||||
$path = "/" . self::$api_version . "/$type?" . implode('&', $query_string);
|
||||
@ -175,7 +175,6 @@ class bitly_Core {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
$short_url = '';
|
||||
$long_url = url::abs_site($item->relative_url_cache);
|
||||
|
||||
$parameters = array(
|
||||
"login" => module::get_var("bitly", "login"),
|
||||
'apiKey' => module::get_var("bitly", "api_key"),
|
||||
@ -183,7 +182,6 @@ class bitly_Core {
|
||||
'domain' => module::get_var("bitly", "domain"),
|
||||
'format' => $format,
|
||||
);
|
||||
|
||||
$request = self::_build_http_request('shorten', $parameters);
|
||||
$response = self::_http_post($request, self::$api_host);
|
||||
$json_response = json_decode($response->body[0]);
|
||||
@ -198,7 +196,6 @@ class bitly_Core {
|
||||
$link->global_hash = $json_response->data->global_hash;
|
||||
$link->save();
|
||||
return $json_response->data->url;
|
||||
|
||||
} else {
|
||||
$status_code = $json_response->status_code;
|
||||
log::error("content", "Shortened URL", "Error: $status_code $status_txt <a href=\"{$long_url}\">item</a>");
|
||||
|
Reference in New Issue
Block a user