diff options
author | Andreas Gohr <andi@splitbrain.org> | 2008-10-12 13:31:50 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2008-10-12 13:31:50 +0200 |
commit | 066fee3089513b988d1beac2040e32a365921310 (patch) | |
tree | e20413f725f57ec6071c66b745fc25bea2e08b55 /inc/common.php | |
parent | 7aedde2e62651d550e6213d3852447b26255e8de (diff) | |
download | rpg-066fee3089513b988d1beac2040e32a365921310.tar.gz rpg-066fee3089513b988d1beac2040e32a365921310.tar.bz2 |
Make license selectable from config FS#312
darcs-hash:20081012113150-7ad00-6408da058bdb6c923159d445e03b76f54b579362.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 27 |
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 : |