Removed bit.ly

This commit is contained in:
Romain Neutron
2011-12-30 12:47:25 +01:00
5 changed files with 2 additions and 61 deletions

View File

@@ -97,8 +97,6 @@ interface record_Interface
public function get_reg_name();
public function get_bitly_link();
public function get_hd_file();
public function delete();

View File

@@ -1376,54 +1376,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
return $regname;
}
/**
*
* @return string
*/
public function get_bitly_link()
{
$registry = registry::get_instance();
if ($this->bitly_link !== null)
return $this->bitly_link;
$this->bitly_link = false;
if (trim($registry->get('GV_bitly_user')) == ''
&& trim($registry->get('GV_bitly_key')) == '')
return $this->bitly_link;
try
{
$short = new PHPShortener();
$bitly = $short->encode($url . 'view/', 'bit.ly', $registry);
if (preg_match('/^(http:\/\/)?(www\.)?([^\/]*)\/(.*)$/', $bitly, $results))
{
if ($results[3] && $results[4])
{
$hash = 'http://bit.ly/' . $results[4];
$sql = 'UPDATE record SET bitly = :hash WHERE record_id = :record_id';
$connbas = connection::getPDOConnection($this->get_sbas_id());
$stmt = $connbas->prepare($sql);
$stmt->execute(array(':hash' => $hash, ':record_id' => $this->get_record_id()));
$stmt->closeCursor();
$this->bitly_link = 'http://bit.ly/' . $hash;
}
}
}
catch (Exception $e)
{
unset($e);
}
$this->delete_data_from_cache();
return $this->bitly_link;
}
/**
*
* @param collection $collection