Add a config item to specify a custom icon. Based on a patch by Tyler J. Wagner.
This commit is contained in:
parent
2134661ee7
commit
00d7e1da4a
|
@ -56,7 +56,7 @@ class OPDSRenderer
|
||||||
$xml->writeAttribute ("type", "image/x-icon");
|
$xml->writeAttribute ("type", "image/x-icon");
|
||||||
$xml->writeAttribute ("width", "16");
|
$xml->writeAttribute ("width", "16");
|
||||||
$xml->writeAttribute ("height", "16");
|
$xml->writeAttribute ("height", "16");
|
||||||
$xml->text ("favicon.ico");
|
$xml->text ($config['cops_icon']);
|
||||||
$xml->endElement ();
|
$xml->endElement ();
|
||||||
$xml->startElement ("Url");
|
$xml->startElement ("Url");
|
||||||
$xml->writeAttribute ("type", 'application/atom+xml');
|
$xml->writeAttribute ("type", 'application/atom+xml');
|
||||||
|
@ -71,7 +71,7 @@ class OPDSRenderer
|
||||||
return $xml->outputMemory(true);
|
return $xml->outputMemory(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function startXmlDocument ($title, $idPage) {
|
private function startXmlDocument ($page) {
|
||||||
global $config;
|
global $config;
|
||||||
self::getXmlStream ()->startDocument('1.0','UTF-8');
|
self::getXmlStream ()->startDocument('1.0','UTF-8');
|
||||||
self::getXmlStream ()->startElement ("feed");
|
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:opensearch", "http://a9.com/-/spec/opensearch/1.1/");
|
||||||
self::getXmlStream ()->writeAttribute ("xmlns:dcterms", "http://purl.org/dc/terms/");
|
self::getXmlStream ()->writeAttribute ("xmlns:dcterms", "http://purl.org/dc/terms/");
|
||||||
self::getXmlStream ()->startElement ("title");
|
self::getXmlStream ()->startElement ("title");
|
||||||
self::getXmlStream ()->text ($title);
|
self::getXmlStream ()->text ($page->title);
|
||||||
self::getXmlStream ()->endElement ();
|
self::getXmlStream ()->endElement ();
|
||||||
self::getXmlStream ()->startElement ("id");
|
self::getXmlStream ()->startElement ("id");
|
||||||
if ($idPage)
|
if ($page->idPage)
|
||||||
{
|
{
|
||||||
self::getXmlStream ()->text ($idPage);
|
self::getXmlStream ()->text ($page->idPage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ class OPDSRenderer
|
||||||
self::getXmlStream ()->text (self::getUpdatedTime ());
|
self::getXmlStream ()->text (self::getUpdatedTime ());
|
||||||
self::getXmlStream ()->endElement ();
|
self::getXmlStream ()->endElement ();
|
||||||
self::getXmlStream ()->startElement ("icon");
|
self::getXmlStream ()->startElement ("icon");
|
||||||
self::getXmlStream ()->text ("favicon.ico");
|
self::getXmlStream ()->text ($page->favicon);
|
||||||
self::getXmlStream ()->endElement ();
|
self::getXmlStream ()->endElement ();
|
||||||
self::getXmlStream ()->startElement ("author");
|
self::getXmlStream ()->startElement ("author");
|
||||||
self::getXmlStream ()->startElement ("name");
|
self::getXmlStream ()->startElement ("name");
|
||||||
|
@ -201,7 +201,7 @@ class OPDSRenderer
|
||||||
|
|
||||||
public function render ($page) {
|
public function render ($page) {
|
||||||
global $config;
|
global $config;
|
||||||
self::startXmlDocument ($page->title, $page->idPage);
|
self::startXmlDocument ($page);
|
||||||
if ($page->isPaginated ())
|
if ($page->isPaginated ())
|
||||||
{
|
{
|
||||||
self::getXmlStream ()->startElement ("opensearch:totalResults");
|
self::getXmlStream ()->startElement ("opensearch:totalResults");
|
||||||
|
|
4
base.php
4
base.php
|
@ -191,6 +191,7 @@ class Page
|
||||||
public $idPage;
|
public $idPage;
|
||||||
public $idGet;
|
public $idGet;
|
||||||
public $query;
|
public $query;
|
||||||
|
public $favicon;
|
||||||
public $n;
|
public $n;
|
||||||
public $totalNumber = -1;
|
public $totalNumber = -1;
|
||||||
public $entryArray = array();
|
public $entryArray = array();
|
||||||
|
@ -230,9 +231,12 @@ class Page
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($pid, $pquery, $pn) {
|
public function __construct($pid, $pquery, $pn) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
$this->idGet = $pid;
|
$this->idGet = $pid;
|
||||||
$this->query = $pquery;
|
$this->query = $pquery;
|
||||||
$this->n = $pn;
|
$this->n = $pn;
|
||||||
|
$this->favicon = $config['cops_icon'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function InitializeContent ()
|
public function InitializeContent ()
|
||||||
|
|
|
@ -59,7 +59,13 @@
|
||||||
* Height of thumbnail image for HTML
|
* Height of thumbnail image for HTML
|
||||||
*/
|
*/
|
||||||
$config['cops_html_thumbnail_height'] = "70";
|
$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
|
* Show icon for authors, series, tags and books on OPDS feed
|
||||||
* 1 : enable
|
* 1 : enable
|
||||||
|
|
|
@ -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="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="fancybox/jquery.fancybox.pack.js?v=2.1.3"></script>
|
||||||
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery.sortElements.js") ?>"></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="fancybox/jquery.fancybox.css?v=2.1.3" media="screen" />
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("style.css") ?>" media="screen" />
|
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("style.css") ?>" media="screen" />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
Loading…
Reference in a new issue