From 80083a41ce7a4ccf3132621757c333c535179dbe Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sat, 10 Mar 2012 17:25:02 +0100
Subject: [PATCH] made tpl_license a bit more flexible

This way there's less custom code for the footer buttons needed
---
 inc/template.php | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/inc/template.php b/inc/template.php
index c23fd14c1..02e039b2d 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1350,8 +1350,9 @@ function tpl_actiondropdown($empty='',$button='&gt;'){
  * @author Andreas Gohr <andi@splitbrain.org>
  * @param  string $img    - print image? (|button|badge)
  * @param  bool   $return - when true don't print, but return HTML
+ * @param  bool   $wrap   - wrap in div with class="license"?
  */
-function tpl_license($img='badge',$imgonly=false,$return=false){
+function tpl_license($img='badge',$imgonly=false,$return=false,$wrap=true){
     global $license;
     global $conf;
     global $lang;
@@ -1359,22 +1360,29 @@ function tpl_license($img='badge',$imgonly=false,$return=false){
     if(!is_array($license[$conf['license']])) return '';
     $lic = $license[$conf['license']];
 
-    $out  = '<div class="license">';
+    $out = '';
+    if($wrap) $out  .= '<div class="license">';
     if($img){
         $src = license_img($img);
         if($src){
+            if(!$imgonly){
+                $left = 'medialeft';
+            }else{
+                $left = '';
+            }
+
             $out .= '<a href="'.$lic['url'].'" rel="license"';
             if($conf['target']['extern']) $out .= ' target="'.$conf['target']['extern'].'"';
-            $out .= '><img src="'.DOKU_BASE.$src.'" class="medialeft lic'.$img.'" alt="'.$lic['name'].'" /></a> ';
+            $out .= '><img src="'.DOKU_BASE.$src.'" class="'.$left.' lic'.$img.'" alt="'.$lic['name'].'" /></a> ';
         }
     }
     if(!$imgonly) {
         $out .= $lang['license'];
-        $out .= ' <a href="'.$lic['url'].'" rel="license" class="urlextern"';
+        $out .= '<a href="'.$lic['url'].'" rel="license" class="urlextern"';
         if($conf['target']['extern']) $out .= ' target="'.$conf['target']['extern'].'"';
         $out .= '>'.$lic['name'].'</a>';
     }
-    $out .= '</div>';
+    if($wrap) $out .= '</div>';
 
     if($return) return $out;
     echo $out;
-- 
GitLab