|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2005-2011 Stanislas Rolland <typo3(arobas)sjbr.ca> 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 * Render custom attribute clickenlarge 00029 * 00030 * @author Stanislas Rolland <typo3(arobas)sjbr.ca> 00031 * 00032 * $Id: class.tx_rtehtmlarea_pi3.php 10120 2011-01-18 20:03:36Z ohader $ * 00033 */ 00034 class tx_rtehtmlarea_pi3 extends tslib_pibase { 00035 00036 // Default plugin variables: 00037 var $prefixId = 'tx_rtehtmlarea_pi3'; // Same as class name 00038 var $scriptRelPath = 'pi3/class.tx_rtehtmlarea_pi3.php'; // Path to this script relative to the extension dir. 00039 var $extKey = 'rtehtmlarea'; // The extension key. 00040 var $conf = array(); 00041 00042 /** 00043 * cObj object 00044 * 00045 * @var tslib_cObj 00046 */ 00047 var $cObj; 00048 00049 /** 00050 * Rendering the "clickenlarge" custom attribute, called from TypoScript 00051 * 00052 * @param string Content input. Not used, ignore. 00053 * @param array TypoScript configuration 00054 * @return string HTML output. 00055 * @access private 00056 */ 00057 function render_clickenlarge($content,$conf) { 00058 00059 $clickenlarge = isset($this->cObj->parameters['clickenlarge']) ? $this->cObj->parameters['clickenlarge'] : 0; 00060 $path = $this->cObj->parameters['src']; 00061 $pathPre = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicC_'; 00062 if (t3lib_div::isFirstPartOfStr($path,$pathPre)) { 00063 // Find original file: 00064 $pI = pathinfo(substr($path,strlen($pathPre))); 00065 $filename = substr($pI['basename'],0,-strlen('.'.$pI['extension'])); 00066 $file = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicP_' . $filename; 00067 } else { 00068 $file = $this->cObj->parameters['src']; 00069 } 00070 00071 unset($this->cObj->parameters['clickenlarge']); 00072 unset($this->cObj->parameters['allParams']); 00073 $content = '<img '. t3lib_div::implodeAttributes($this->cObj->parameters, TRUE, TRUE) . ' />'; 00074 00075 if ($clickenlarge && is_array($conf['imageLinkWrap.'])) { 00076 $theImage = $file ? $GLOBALS['TSFE']->tmpl->getFileName($file) : ''; 00077 if ($theImage) { 00078 $this->cObj->parameters['origFile'] = $theImage; 00079 if ($this->cObj->parameters['title']) { 00080 $conf['imageLinkWrap.']['title'] = $this->cObj->parameters['title']; 00081 } 00082 if ($this->cObj->parameters['alt']) { 00083 $conf['imageLinkWrap.']['alt'] = $this->cObj->parameters['alt']; 00084 } 00085 $content = $this->cObj->imageLinkWrap($content,$theImage,$conf['imageLinkWrap.']); 00086 $content = $this->cObj->stdWrap($content,$conf['stdWrap.']); 00087 } 00088 } 00089 return $content; 00090 } 00091 } 00092 00093 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi3/class.tx_rtehtmlarea_pi3.php'])) { 00094 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi3/class.tx_rtehtmlarea_pi3.php']); 00095 } 00096 00097 ?>
1.8.0