/** * A method that make a long url to short url * * @param string $link * * @return string */ private function getShortUrl($link) { $options = array("login" => $this->params->get("shortener_login"), "api_key" => $this->params->get("shortener_api_key"), "service" => $this->params->get("shortener_service")); $shortLink = ""; try { $shortUrl = new Prism\Utilities\ShortUrl($link, $options); $shortLink = $shortUrl->getUrl(); // Get original link if (!$shortLink) { $shortLink = $link; } } catch (Exception $e) { JLog::add($e->getMessage()); // Get original link if (!$shortLink) { $shortLink = $link; } } return $shortLink; }
/** * A method that make a long url to short url * * @param string $link * * @return string */ private function getShortUrl($link) { $options = array('login' => $this->params->get('shortener_login'), 'api_key' => $this->params->get('shortener_api_key'), 'service' => $this->params->get('shortener_service')); $shortLink = ''; try { $shortUrl = new Prism\Utilities\ShortUrl($link, $options); $shortLink = $shortUrl->getUrl(); // Get original link if (!$shortLink) { $shortLink = $link; } } catch (Exception $e) { JLog::add($e->getMessage()); // Get original link if (!$shortLink) { $shortLink = $link; } } return $shortLink; }