summaryrefslogtreecommitdiff
path: root/inc/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/common.php')
-rw-r--r--inc/common.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/inc/common.php b/inc/common.php
index 82a5b7086..a8a6dd5ff 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1314,8 +1314,33 @@ function editorinfo($username){
return hsc($username);
}
} else {
- return hsc($username);
+ return hsc($username);
+ }
+}
+
+/**
+ * Returns the path to a image file for the currently chosen license.
+ * When no image exists, returns an empty string
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @param string $type - type of image 'badge' or 'button'
+ */
+function license_img($type){
+ global $license;
+ global $conf;
+ if(!$conf['license']) return '';
+ if(!is_array($license[$conf['license']])) return '';
+ $lic = $license[$conf['license']];
+ $try = array();
+ $try[] = 'lib/images/license/'.$type.'/'.$conf['license'].'.png';
+ $try[] = 'lib/images/license/'.$type.'/'.$conf['license'].'.gif';
+ if(substr($conf['license'],0,3) == 'cc-'){
+ $try[] = 'lib/images/license/'.$type.'/cc.png';
+ }
+ foreach($try as $src){
+ if(@file_exists(DOKU_INC.$src)) return $src;
}
+ return '';
}
//Setup VIM: ex: et ts=2 enc=utf-8 :