Fixed bug 6539: Move the BE logo generation code into a separate method so it can...
authorIngo Renner <ingo.renner@typo3.org>
Wed, 24 Oct 2007 14:18:13 +0000 (14:18 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Wed, 24 Oct 2007 14:18:13 +0000 (14:18 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2615 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/alt_toplogo.php
typo3/classes/class.typo3logo.php [new file with mode: 0644]

index 831bc6b..8d8970e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-24  Ingo Renner  <ingo@typo3.org>
+
+       * Fixed bug 6539: Move the BE logo generation code into a separate method so it can be used from other classes
+
 2007-10-24  Benjamin Mack  <mack@xnos.org>
 
        * Fixed Bug #6582: Deprecated use of language="text/javascript" in function loadJavascriptLib in template.php (thanks to Christian Kuhn)
        * (minor) indexed_search - Added more info where the manual can be found
 
 2007-10-21  Thomas Hempel <thomas@typo3-unleashed.net>
-       
+
        * Fixed bug: #6531: Function getUpdateJS doesn't work properly (Thanks to Philip Almeida)
        * Fixed bug: #434: function getUpdateJS produce JS error messages
-       
+
 2007-10-20  Martin Kutschker  <martin.t.kutschker@blackbox.net>
 
        * Fixed bug #6559: Spelling error in Object Browser
index e5250cb..e749cd3 100755 (executable)
@@ -52,6 +52,7 @@
 
 require ('init.php');
 require ('template.php');
+require ('classes/class.typo3logo.php');
 
 
 
@@ -80,18 +81,8 @@ class SC_alt_toplogo {
                $this->content.=$TBE_TEMPLATE->startPage('Logo frame');
 
                        // Set logo:
-               if ($TBE_STYLES['logo'])        {
-                       if (substr($TBE_STYLES['logo'],0,3)=='../')     {
-                               $imgInfo = @getimagesize(PATH_site.substr($TBE_STYLES['logo'],3));
-                       }
-                       $this->content.='<a href="http://www.typo3.com/" target="_blank" onclick="'.$TBE_TEMPLATE->thisBlur().'">'.
-                               '<img src="'.$TBE_STYLES['logo'].'" '.$imgInfo[3].' title="TYPO3 Content Management Framework" alt="" />'.
-                               '</a>';
-               } else {
-                       $this->content.='<a href="http://www.typo3.com/" target="_blank" onclick="'.$TBE_TEMPLATE->thisBlur().'">'.
-                               '<img'.t3lib_iconWorks::skinImg('','gfx/alt_backend_logo.gif','width="117" height="32"').' title="TYPO3 Content Management Framework" alt="" />'.
-                               '</a>';
-               }
+               $logo = t3lib_div::makeInstance('TYPO3logo');
+               $this->content .= $logo->render();
 
                        // End page:
                $this->content.=$TBE_TEMPLATE->endPage();
diff --git a/typo3/classes/class.typo3logo.php b/typo3/classes/class.typo3logo.php
new file mode 100644 (file)
index 0000000..07aaa85
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+/**
+ * class to render the TYPO3 logo in the backend
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class TYPO3Logo {
+
+       /**
+        * renders the actual logo code
+        *
+        * @return      string  logo html code snippet to use in the backend
+        */
+       public function render() {
+               $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
+                               '<img'.t3lib_iconWorks::skinImg('','gfx/alt_backend_logo.gif','width="117" height="32"').' title="TYPO3 Content Management Framework" alt="" />'.
+                               '</a>';
+
+                       // overwrite with custom logo
+               if($GLOBALS['TBE_STYLES']['logo'])      {
+                       if(substr($GLOBALS['TBE_STYLES']['logo'], 0, 3) == '../')       {
+                               $imgInfo = @getimagesize(PATH_site.substr($GLOBALS['TBE_STYLES']['logo'], 3));
+                       }
+
+                       $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
+                               '<img src="'.$GLOBALS['TBE_STYLES']['logo'].'" '.$imgInfo[3].' title="TYPO3 Content Management Framework" alt="" />'.
+                               '</a>';
+               }
+
+               return $logo;
+       }
+
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.typo3logo.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.typo3logo.php']);
+}
+
+?>
\ No newline at end of file