[TASK] Remove XCLASS definitions from typo3/
[Packages/TYPO3.CMS.git] / typo3 / classes / class.typo3logo.php
index 07aaa85..eef7ad8 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2007 Ingo Renner <ingo@typo3.org>
+*  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  */
 class TYPO3Logo {
 
+       protected $logo;
+
+       /**
+        * constructor
+        *
+        * @return void
+        */
+       public function __construct() {
+               $this->logo = NULL;
+       }
+
        /**
         * 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="" />'.
+
+               $logoFile = 'gfx/alt_backend_logo.gif'; // default
+               if(is_string($this->logo)) {
+                               // overwrite
+                       $logoFile = $this->logo;
+               }
+               $imgInfo = getimagesize(PATH_site . TYPO3_mainDir . $logoFile);
+
+
+               $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' .
+                               '<img' . t3lib_iconWorks::skinImg('', $logoFile, $imgInfo[3]) . ' title="TYPO3 Content Management System" 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="" />'.
+                       $imgInfo = @getimagesize(t3lib_div::resolveBackPath(PATH_typo3 . $GLOBALS['TBE_STYLES']['logo'], 3));
+                       $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' .
+                               '<img src="' . $GLOBALS['TBE_STYLES']['logo'] . '" ' . $imgInfo[3] . ' title="TYPO3 Content Management System" alt="" />' .
                                '</a>';
                }
 
                return $logo;
        }
 
-}
-
+       /**
+        * sets the logo
+        *
+        * @param       string          path to logo file as seen from typo3/
+        */
+       public function setLogo($logo) {
+               if(!is_string($logo)) {
+                       throw new InvalidArgumentException('parameter $logo must be of type string', 1194041104);
+               }
 
-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']);
+               $this->logo = $logo;
+       }
 }
-
 ?>
\ No newline at end of file