summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnika Henke <anika@selfthinker.org>2012-01-29 20:03:50 +0000
committerAnika Henke <anika@selfthinker.org>2012-01-29 20:03:50 +0000
commit27833958afc4d9d54460bd5273a6a56d94c1923f (patch)
tree53f201cbdbed3ed3d32db499cfde38287cd19c3e
parent91e9045718073c3a4ad4ce581e9192f0a87baaf7 (diff)
downloadrpg-27833958afc4d9d54460bd5273a6a56d94c1923f.tar.gz
rpg-27833958afc4d9d54460bd5273a6a56d94c1923f.tar.bz2
added tpl_getMediaFile() to replace tpl_getFavicon()
The function tpl_getFavicon() was doing more than its name was implying. Therefore the new tpl_getMediaFile() was introduced (which is doing nearly exactly the same) and tpl_getFavicon() was deprecated. tpl_favicon() can still be used, though.
-rw-r--r--feed.php2
-rw-r--r--inc/template.php26
2 files changed, 19 insertions, 9 deletions
diff --git a/feed.php b/feed.php
index 298777eb9..a7fa95620 100644
--- a/feed.php
+++ b/feed.php
@@ -50,7 +50,7 @@ $rss->cssStyleSheet = DOKU_URL.'lib/exe/css.php?s=feed';
$image = new FeedImage();
$image->title = $conf['title'];
-$image->url = tpl_getFavicon(true);
+$image->url = tpl_getMediaFile('favicon.ico', true);
$image->link = DOKU_URL;
$rss->image = $image;
diff --git a/inc/template.php b/inc/template.php
index d6b7af1e8..f7a49f002 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1458,16 +1458,15 @@ function tpl_flush(){
flush();
}
-
/**
- * Returns icon from data/media root directory if it exists, otherwise
- * the one in the template's image directory.
+ * Returns link to media file 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
+ * @param bool $abs - if to use absolute URL
* @author Anika Henke <anika@selfthinker.org>
*/
-function tpl_getFavicon($abs=false, $fileName='favicon.ico') {
+function tpl_getMediaFile($fileName, $abs=false) {
if (file_exists(mediaFN($fileName))) {
return ml($fileName, '', true, '', $abs);
}
@@ -1479,6 +1478,17 @@ function tpl_getFavicon($abs=false, $fileName='favicon.ico') {
}
/**
+ * Returns icon from data/media root directory if it exists, otherwise
+ * the one in the template's image directory.
+ *
+ * @deprecated Use tpl_getMediaFile() instead
+ * @author Anika Henke <anika@selfthinker.org>
+ */
+function tpl_getFavicon($abs=false, $fileName='favicon.ico') {
+ return tpl_getMediaFile($fileName, $abs);
+}
+
+/**
* Returns <link> tag for various icon types (favicon|mobile|generic)
*
* @param array $types - list of icon types to display (favicon|mobile|generic)
@@ -1491,14 +1501,14 @@ function tpl_favicon($types=array('favicon')) {
foreach ($types as $type) {
switch($type) {
case 'favicon':
- $return .= '<link rel="shortcut icon" href="'.tpl_getFavicon().'" />'.NL;
+ $return .= '<link rel="shortcut icon" href="'.tpl_getMediaFile('favicon.ico').'" />'.NL;
break;
case 'mobile':
- $return .= '<link rel="apple-touch-icon" href="'.tpl_getFavicon(false, 'apple-touch-icon.png').'" />'.NL;
+ $return .= '<link rel="apple-touch-icon" href="'.tpl_getMediaFile('apple-touch-icon.png').'" />'.NL;
break;
case 'generic':
// ideal world solution, which doesn't work in any browser yet
- $return .= '<link rel="icon" href="'.tpl_getFavicon(false, 'icon.svg').'" type="image/svg+xml" />'.NL;
+ $return .= '<link rel="icon" href="'.tpl_getMediaFile('icon.svg').'" type="image/svg+xml" />'.NL;
break;
}
}