TYPO3 API  SVNRelease
class.typo3logo.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2007-2011 Ingo Renner <ingo@typo3.org>
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 
00028 
00029 /**
00030  * class to render the TYPO3 logo in the backend
00031  *
00032  * $Id: class.typo3logo.php 10121 2011-01-18 20:15:30Z ohader $
00033  *
00034  * @author  Ingo Renner <ingo@typo3.org>
00035  * @package TYPO3
00036  * @subpackage core
00037  */
00038 class TYPO3Logo {
00039 
00040     protected $logo;
00041 
00042     /**
00043      * constructor
00044      *
00045      * @return void
00046      */
00047     public function __construct() {
00048         $this->logo = null;
00049     }
00050 
00051     /**
00052      * renders the actual logo code
00053      *
00054      * @return  string  logo html code snippet to use in the backend
00055      */
00056     public function render() {
00057 
00058         $logoFile = 'gfx/alt_backend_logo.gif'; // default
00059         if(is_string($this->logo)) {
00060                 // overwrite
00061             $logoFile = $this->logo;
00062         }
00063         $imgInfo = getimagesize(PATH_site . TYPO3_mainDir . $logoFile);
00064 
00065 
00066         $logo = '<a href="http://www.typo3.com/" target="_blank">'.
00067                 '<img'.t3lib_iconWorks::skinImg('', $logoFile, $imgInfo[3]).' title="TYPO3 Content Management System" alt="" />'.
00068                 '</a>';
00069 
00070             // overwrite with custom logo
00071         if($GLOBALS['TBE_STYLES']['logo'])  {
00072             $imgInfo = @getimagesize(t3lib_div::resolveBackPath(PATH_typo3 . $GLOBALS['TBE_STYLES']['logo'], 3));
00073             $logo = '<a href="http://www.typo3.com/" target="_blank">' .
00074                 '<img src="' . $GLOBALS['TBE_STYLES']['logo'] . '" ' . $imgInfo[3] . ' title="TYPO3 Content Management System" alt="" />' .
00075                 '</a>';
00076         }
00077 
00078         return $logo;
00079     }
00080 
00081     /**
00082      * sets the logo
00083      *
00084      * @param   string      path to logo file as seen from typo3/
00085      */
00086     public function setLogo($logo) {
00087         if(!is_string($logo)) {
00088             throw new InvalidArgumentException('parameter $logo must be of type string', 1194041104);
00089         }
00090 
00091         $this->logo = $logo;
00092     }
00093 
00094 }
00095 
00096 
00097 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/classes/class.typo3logo.php'])) {
00098     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/classes/class.typo3logo.php']);
00099 }
00100 
00101 ?>