Add a config item to specify a custom icon. Based on a patch by Tyler J. Wagner.

This commit is contained in:
Sébastien Lucas 2012-12-22 18:03:52 +01:00
parent 2134661ee7
commit 00d7e1da4a
4 changed files with 19 additions and 8 deletions

View file

@ -56,7 +56,7 @@ class OPDSRenderer
$xml->writeAttribute ("type", "image/x-icon");
$xml->writeAttribute ("width", "16");
$xml->writeAttribute ("height", "16");
$xml->text ("favicon.ico");
$xml->text ($config['cops_icon']);
$xml->endElement ();
$xml->startElement ("Url");
$xml->writeAttribute ("type", 'application/atom+xml');
@ -71,7 +71,7 @@ class OPDSRenderer
return $xml->outputMemory(true);
}
private function startXmlDocument ($title, $idPage) {
private function startXmlDocument ($page) {
global $config;
self::getXmlStream ()->startDocument('1.0','UTF-8');
self::getXmlStream ()->startElement ("feed");
@ -81,12 +81,12 @@ class OPDSRenderer
self::getXmlStream ()->writeAttribute ("xmlns:opensearch", "http://a9.com/-/spec/opensearch/1.1/");
self::getXmlStream ()->writeAttribute ("xmlns:dcterms", "http://purl.org/dc/terms/");
self::getXmlStream ()->startElement ("title");
self::getXmlStream ()->text ($title);
self::getXmlStream ()->text ($page->title);
self::getXmlStream ()->endElement ();
self::getXmlStream ()->startElement ("id");
if ($idPage)
if ($page->idPage)
{
self::getXmlStream ()->text ($idPage);
self::getXmlStream ()->text ($page->idPage);
}
else
{
@ -97,7 +97,7 @@ class OPDSRenderer
self::getXmlStream ()->text (self::getUpdatedTime ());
self::getXmlStream ()->endElement ();
self::getXmlStream ()->startElement ("icon");
self::getXmlStream ()->text ("favicon.ico");
self::getXmlStream ()->text ($page->favicon);
self::getXmlStream ()->endElement ();
self::getXmlStream ()->startElement ("author");
self::getXmlStream ()->startElement ("name");
@ -201,7 +201,7 @@ class OPDSRenderer
public function render ($page) {
global $config;
self::startXmlDocument ($page->title, $page->idPage);
self::startXmlDocument ($page);
if ($page->isPaginated ())
{
self::getXmlStream ()->startElement ("opensearch:totalResults");

View file

@ -191,6 +191,7 @@ class Page
public $idPage;
public $idGet;
public $query;
public $favicon;
public $n;
public $totalNumber = -1;
public $entryArray = array();
@ -230,9 +231,12 @@ class Page
}
public function __construct($pid, $pquery, $pn) {
global $config;
$this->idGet = $pid;
$this->query = $pquery;
$this->n = $pn;
$this->favicon = $config['cops_icon'];
}
public function InitializeContent ()

View file

@ -59,7 +59,13 @@
* Height of thumbnail image for HTML
*/
$config['cops_html_thumbnail_height'] = "70";
/*
* Icon for both OPDS and HTML catalog
* Note that this has to be a real icon (.ico)
*/
$config['cops_icon'] = "favicon.ico";
/*
* Show icon for authors, series, tags and books on OPDS feed
* 1 : enable

View file

@ -54,6 +54,7 @@
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox.pack.js?v=2.1.3"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.sortElements.js") ?>"></script>
<link rel="icon" type="image/vnd.microsoft.icon" href="<?php echo $currentPage->favicon ?>" />
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox.css?v=2.1.3" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("style.css") ?>" media="screen" />
<script type="text/javascript">