2 /***************************************************************
5 * (c) 2005-2012 Stanislas Rolland <typo3(arobas)sjbr.ca>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Render custom attribute data-htmlarea-clickenlarge
30 * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
32 class tx_rtehtmlarea_pi3
extends tslib_pibase
{
34 // Default plugin variables:
35 var $prefixId = 'tx_rtehtmlarea_pi3'; // Same as class name
36 var $scriptRelPath = 'pi3/class.tx_rtehtmlarea_pi3.php'; // Path to this script relative to the extension dir.
37 var $extKey = 'rtehtmlarea'; // The extension key.
48 * Rendering the "data-htmlarea-clickenlarge" custom attribute, called from TypoScript
50 * @param string Content input. Not used, ignore.
51 * @param array TypoScript configuration
52 * @return string HTML output.
55 function render_clickenlarge($content,$conf) {
57 $clickenlarge = isset($this->cObj
->parameters
['datahtmlareaclickenlarge']) ?
$this->cObj
->parameters
['datahtmlareaclickenlarge'] : 0;
59 // Backward compatibility
60 $clickenlarge = isset($this->cObj
->parameters
['clickenlarge']) ?
$this->cObj
->parameters
['clickenlarge'] : 0;
62 $path = $this->cObj
->parameters
['src'];
63 $pathPre = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicC_';
64 if (t3lib_div
::isFirstPartOfStr($path,$pathPre)) {
65 // Find original file:
66 $pI = pathinfo(substr($path,strlen($pathPre)));
67 $filename = substr($pI['basename'],0,-strlen('.'.$pI['extension']));
68 $file = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicP_' . $filename;
70 $file = $this->cObj
->parameters
['src'];
73 unset($this->cObj
->parameters
['datahtmlareaclickenlarge']);
74 // Backward compatibility
75 unset($this->cObj
->parameters
['clickenlarge']);
76 unset($this->cObj
->parameters
['allParams']);
77 $content = '<img '. t3lib_div
::implodeAttributes($this->cObj
->parameters
, TRUE, TRUE) . ' />';
79 if ($clickenlarge && is_array($conf['imageLinkWrap.'])) {
80 $theImage = $file ?
$GLOBALS['TSFE']->tmpl
->getFileName($file) : '';
82 $this->cObj
->parameters
['origFile'] = $theImage;
83 if ($this->cObj
->parameters
['title']) {
84 $conf['imageLinkWrap.']['title'] = $this->cObj
->parameters
['title'];
86 if ($this->cObj
->parameters
['alt']) {
87 $conf['imageLinkWrap.']['alt'] = $this->cObj
->parameters
['alt'];
89 $content = $this->cObj
->imageLinkWrap($content,$theImage,$conf['imageLinkWrap.']);
90 $content = $this->cObj
->stdWrap($content,$conf['stdWrap.']);
96 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE
]['XCLASS']['ext/rtehtmlarea/pi3/class.tx_rtehtmlarea_pi3.php'])) {
97 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE
]['XCLASS']['ext/rtehtmlarea/pi3/class.tx_rtehtmlarea_pi3.php']);