From 872a6d295eacbfa8abad2877ec4e367930da3692 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 31 Jul 2011 00:52:10 +0100 Subject: added apple-touch-icon (aka 'mobile favicon') --- inc/template.php | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/template.php b/inc/template.php index a476e78ab..5184929b8 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1340,21 +1340,50 @@ function tpl_flush(){ /** - * Use favicon.ico from data/media root directory if it exists, otherwise use + * Returns icon from data/media root directory if it exists, otherwise * the one in the template's image directory. * + * @param bool $abs - if to use absolute URL + * @param string $fileName - file name of icon * @author Anika Henke */ -function tpl_getFavicon($abs=false) { - if (file_exists(mediaFN('favicon.ico'))) { - return ml('favicon.ico', '', true, '', $abs); +function tpl_getFavicon($abs=false, $fileName='favicon.ico') { + if (file_exists(mediaFN($fileName))) { + return ml($fileName, '', true, '', $abs); } if($abs) { - return DOKU_URL.substr(DOKU_TPL.'images/favicon.ico', strlen(DOKU_REL)); + return DOKU_URL.substr(DOKU_TPL.'images/'.$fileName, strlen(DOKU_REL)); + } + return DOKU_TPL.'images/'.$fileName; +} + +/** + * Returns tag for various icon types (favicon|mobile|generic) + * + * @param array $types - list of icon types to display (favicon|mobile|generic) + * @author Anika Henke + */ +function tpl_favicon($types=array('favicon')) { + + $return = ''; + + foreach ($types as $type) { + switch($type) { + case 'favicon': + $return .= ''.NL; + break; + case 'mobile': + $return .= ''.NL; + break; + case 'generic': + // ideal world solution, which doesn't work in any browser yet + $return .= ''.NL; + break; + } } - return DOKU_TPL.'images/favicon.ico'; + return $return; } -- cgit v1.2.3