little refactoring

This commit is contained in:
Sébastien Lucas 2014-03-10 21:24:19 +01:00
parent e67e620ba3
commit 8a8b98620d

View file

@ -144,18 +144,9 @@ class Data extends Base {
return $out;
}
public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL)
{
public static function handleThumbnailLink ($urlParam, $height) {
global $config;
$urlParam = addURLParameter("", "data", $idData);
if (Base::useAbsolutePath () ||
$rel == Link::OPDS_THUMBNAIL_TYPE ||
($type == "epub" && $config['cops_update_epub-metadata']))
{
if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type);
if ($rel == Link::OPDS_THUMBNAIL_TYPE) {
if (is_null ($height)) {
if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) {
$height = $config['cops_opds_thumbnail_height'];
@ -168,6 +159,23 @@ class Data extends Base {
if ($config['cops_thumbnail_handling'] != "1") {
$urlParam = addURLParameter($urlParam, "height", $height);
}
return $urlParam;
}
public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL)
{
global $config;
$urlParam = addURLParameter("", "data", $idData);
if (Base::useAbsolutePath () ||
$rel == Link::OPDS_THUMBNAIL_TYPE ||
($type == "epub" && $config['cops_update_epub-metadata']))
{
if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type);
if ($rel == Link::OPDS_THUMBNAIL_TYPE) {
$urlParam = self::handleThumbnailLink($urlParam, $height);
}
$urlParam = addURLParameter($urlParam, "id", $book->id);
if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB));