TYPO3 API  SVNRelease
class.tslib_content_scalablevectorgraphics.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2010-2011 Xavier Perseguers <typo3@perseguers.ch>
00006  *  (c) 2010-2011 Steffen Kamper <steffen@typo3.org>
00007  *  All rights reserved
00008  *
00009  *  This script is part of the TYPO3 project. The TYPO3 project is
00010  *  free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  The GNU General Public License can be found at
00016  *  http://www.gnu.org/copyleft/gpl.html.
00017  *  A copy is found in the textfile GPL.txt and important notices to the license
00018  *  from the author is found in LICENSE.txt distributed with these scripts.
00019  *
00020  *
00021  *  This script is distributed in the hope that it will be useful,
00022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  *  GNU General Public License for more details.
00025  *
00026  *  This copyright notice MUST APPEAR in all copies of the script!
00027  ***************************************************************/
00028 
00029 /**
00030  * Contains RESTORE_REGISTER class object.
00031  *
00032  * $Id: class.tslib_content.php 7905 2010-06-13 14:42:33Z ohader $
00033  * @author Xavier Perseguers <typo3@perseguers.ch>
00034  * @author Steffen Kamper <steffen@typo3.org>
00035  */
00036 class tslib_content_ScalableVectorGraphics extends tslib_content_Abstract {
00037 
00038     /**
00039      * Rendering the cObject, SVG
00040      *
00041      * @param   array       Array of TypoScript properties
00042      * @return  string      Empty string (the cObject only sets internal data!)
00043      */
00044     public function render($conf = array()) {
00045         $width = isset($conf['width.'])
00046              ? $this->cObj->stdWrap($conf['width'], $conf['width.'])
00047              : $conf['width'];
00048         if(!$width) {
00049             $width = 600;
00050         }
00051         $height = isset($conf['height.'])
00052             ? $this->cObj->stdWrap($conf['height'], $conf['height.'])
00053             : $conf['height'];
00054         if(!$height) {
00055             $height = 400;
00056         }
00057 
00058         $src = isset($conf['src.'])
00059             ? $this->cObj->stdWrap($conf['src'], $conf['src.'])
00060             : $conf['src'];
00061         if(!$src) {
00062             $src = NULL;
00063         }
00064         $value = isset($conf['value.'])
00065             ? $this->cObj->stdWrap($conf['value'], $conf['value.'])
00066             : $conf['value'];
00067 
00068         $noscript = isset($conf['noscript.'])
00069             ? $this->cObj->stdWrap($conf['noscript'], $conf['noscript.'])
00070             : $conf['noscript'];
00071 
00072         if ($src) {
00073             $content = '
00074 
00075                     <!--[if IE]>
00076                     <object src="' . $src . '" classid="image/svg+xml" width="' . $width . '" height="' . $height . '">
00077                     <![endif]-->
00078                     <!--[if !IE]>-->
00079                     <object data="' . $src . '" type="image/svg+xml" width="' . $width . '" height="' . $height . '">
00080                     <!--<![endif]-->
00081                     ' . $noscript . '
00082                     </object>
00083 
00084             ';
00085         } else {
00086             $content = '
00087                 <script type="image/svg+xml">
00088                     <svg xmlns="http://www.w3.org/2000/svg"
00089                     xmlns:xlink="http://www.w3.org/1999/xlink"
00090                     width="' . $width . '"
00091                     height="' . $height . '">
00092             ' . $value . '
00093                 </svg>
00094                 </script>
00095                 <noscript>
00096             ' . $noscript . '
00097                 </noscript>
00098             ';
00099         }
00100         $GLOBALS['TSFE']->getPageRenderer()->loadSvg();
00101 
00102         if (isset($conf['stdWrap.'])) {
00103             $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
00104         }
00105 
00106         return $content;
00107     }
00108 
00109 }
00110 
00111 
00112 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_scalablevectorgraphics.php'])) {
00113     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_scalablevectorgraphics.php']);
00114 }
00115 
00116 ?>