Add curly braces

This commit is contained in:
Romain Neutron
2012-04-26 01:55:12 +02:00
parent ade22295ad
commit 33b10d6746
86 changed files with 2969 additions and 2698 deletions

View File

@@ -108,8 +108,10 @@ class Bridge_Api
*/
public function is_disabled()
{
if ($this->disable_time === null)
if ($this->disable_time === null) {
return false;
}
$date_obj = new DateTime();
if ($date_obj > $this->disable_time) {
$this->enable();

View File

@@ -647,14 +647,17 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
public function is_configured()
{
if ( ! $this->registry->get('GV_dailymotion_api'))
if ( ! $this->registry->get('GV_dailymotion_api')) {
return false;
}
if (trim($this->registry->get('GV_dailymotion_client_id')) === '')
if (trim($this->registry->get('GV_dailymotion_client_id')) === '') {
return false;
}
if (trim($this->registry->get('GV_dailymotion_client_secret')) === '')
if (trim($this->registry->get('GV_dailymotion_client_secret')) === '') {
return false;
}
return true;
}

View File

@@ -353,8 +353,10 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
$response = $this->_api->executeMethod('flickr.photosets.addPhoto', $params);
if ( ! $response->isOk()) {
if ($response->err_code === 3) //Already exists in photoset
if ($response->err_code === 3) { //Already exists in photoset
return;
}
throw new Bridge_Exception_ApiConnectorRequestFailed();
}
break;
@@ -626,14 +628,17 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
public function is_configured()
{
if ( ! $this->registry->get('GV_flickr_api'))
if ( ! $this->registry->get('GV_flickr_api')) {
return false;
}
if (trim($this->registry->get('GV_flickr_client_id')) === '')
if (trim($this->registry->get('GV_flickr_client_id')) === '') {
return false;
}
if (trim($this->registry->get('GV_flickr_client_secret')) === '')
if (trim($this->registry->get('GV_flickr_client_secret')) === '') {
return false;
}
return true;
}

View File

@@ -98,8 +98,10 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface
private function generate_page_url($entry)
{
if (isset($entry["owner"]) && isset($entry["id"]))
if (isset($entry["owner"]) && isset($entry["id"])) {
return sprintf("http://www.flickr.com/%ss/%s/%s/", $this->type, (string) $entry["owner"], (string) $entry["id"]);
}
return "";
}
@@ -112,27 +114,30 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface
*/
private function generate_thumb_url($entry, $size = '', $extension = '')
{
if (isset($entry["url_t"]))
if (isset($entry["url_t"])) {
return (string) $entry["url_t"];
}
if ( ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]))
if ( ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"])) {
return '';
}
$farm = (string) $entry["farm"];
$server_id = (string) $entry["server"];
$id_photo = (string) $entry["id"];
$secret = (string) $entry["secret"];
if (empty($size) && empty($extension))
if (empty($size) && empty($extension)) {
return sprintf('https://farm%s.static.flickr.com/%s/%s_%s.jpg', $farm, $server_id, $id_photo, $secret);
elseif ( ! empty($size) && ! empty($extension))
} elseif ( ! empty($size) && ! empty($extension)) {
return sprintf('https://farm%s.static.flickr.com/%s/%s_%s_%s.jpg', $farm, $server_id, $id_photo, $secret, $size);
elseif ( ! empty($size))
} elseif ( ! empty($size)) {
return sprintf('https://farm%s.static.flickr.com/%s/%s_%s_%s.jpg', $farm, $server_id, $id_photo, $secret, $size, '.jpg');
elseif ( ! empty($extension))
} elseif ( ! empty($extension)) {
return sprintf('https://farm%s.static.flickr.com/%s/%s_%s_o.%s', $farm, $server_id, $id_photo, $secret, $extension);
else
} else {
return "";
}
}
/**

View File

@@ -632,8 +632,9 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
$xml = simplexml_load_string($string);
libxml_clear_errors();
if ( ! $xml)
if ( ! $xml) {
return false;
}
if (isset($xml->HEAD) || isset($xml->head)) {
return array();
@@ -793,14 +794,17 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
public function is_configured()
{
if ( ! $this->registry->get('GV_youtube_api'))
if ( ! $this->registry->get('GV_youtube_api')) {
return false;
}
if (trim($this->registry->get('GV_youtube_client_id')) === '')
if (trim($this->registry->get('GV_youtube_client_id')) === '') {
return false;
}
if (trim($this->registry->get('GV_youtube_dev_key')) === '')
if (trim($this->registry->get('GV_youtube_dev_key')) === '') {
return false;
}
return true;
}

View File

@@ -63,8 +63,9 @@ class Bridge_Api_Youtube_Element implements Bridge_Api_ElementInterface
$video_thumbnails = $this->entry->getVideoThumbnails();
foreach ($video_thumbnails as $thumb) {
if (120 == $thumb['width'] && 90 == $thumb['height'])
if (120 == $thumb['width'] && 90 == $thumb['height']) {
return $thumb['url'];
}
}
}