TYPO3 CMS  TYPO3_6-2
CustomAttributeController.php
Go to the documentation of this file.
1 <?php
3 
22 
23  // Default plugin variables:
27  public $prefixId = 'tx_rtehtmlarea_pi3';
28 
29  // Same as class name
33  public $scriptRelPath = 'pi3/class.tx_rtehtmlarea_pi3.php';
34 
35  // Path to this script relative to the extension dir.
39  public $extKey = 'rtehtmlarea';
40 
41  // The extension key.
45  public $conf = array();
46 
53  public $cObj;
54 
64  public function render_clickenlarge($content, $conf) {
65  $clickenlarge = isset($this->cObj->parameters['data-htmlarea-clickenlarge']) ? $this->cObj->parameters['data-htmlarea-clickenlarge'] : 0;
66  if (!$clickenlarge) {
67  // Backward compatibility
68  $clickenlarge = isset($this->cObj->parameters['clickenlarge']) ? $this->cObj->parameters['clickenlarge'] : 0;
69  }
71  $fileTable = $this->cObj->parameters['data-htmlarea-file-table'];
72  $fileUid = $this->cObj->parameters['data-htmlarea-file-uid'];
73  if ($fileUid) {
74  $fileObject = $fileFactory->getFileObject($fileUid);
75  $filePath = $fileObject->getForLocalProcessing(FALSE);
77  } else {
78  // Pre-FAL backward compatibility
79  $path = $this->cObj->parameters['src'];
80  $magicFolder = $fileFactory->getFolderObjectFromCombinedIdentifier($GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']);
81  if ($magicFolder instanceof \TYPO3\CMS\Core\Resource\Folder) {
82  $magicFolderPath = $magicFolder->getPublicUrl();
83  $pathPre = $magicFolderPath . 'RTEmagicC_';
84  if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($path, $pathPre)) {
85  // Find original file:
86  $pI = pathinfo(substr($path, strlen($pathPre)));
87  $filename = substr($pI['basename'], 0, -strlen(('.' . $pI['extension'])));
88  $file = $magicFolderPath . 'RTEmagicP_' . $filename;
89  } else {
90  $file = $this->cObj->parameters['src'];
91  }
92  }
93  }
94  // Unset clickenlarge custom attribute
95  unset($this->cObj->parameters['data-htmlarea-clickenlarge']);
96  // Backward compatibility
97  unset($this->cObj->parameters['clickenlarge']);
98  unset($this->cObj->parameters['allParams']);
99  $content = '<img ' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeAttributes($this->cObj->parameters, TRUE, TRUE) . ' />';
100  if ($clickenlarge && is_array($conf['imageLinkWrap.'])) {
101  $theImage = $file ? $GLOBALS['TSFE']->tmpl->getFileName($file) : '';
102  if ($theImage) {
103  $this->cObj->parameters['origFile'] = $theImage;
104  if ($this->cObj->parameters['title']) {
105  $conf['imageLinkWrap.']['title'] = $this->cObj->parameters['title'];
106  }
107  if ($this->cObj->parameters['alt']) {
108  $conf['imageLinkWrap.']['alt'] = $this->cObj->parameters['alt'];
109  }
110  $content = $this->cObj->imageLinkWrap($content, $theImage, $conf['imageLinkWrap.']);
111  $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
112  }
113  }
114  return $content;
115  }
116 
117 }
static implodeAttributes(array $arr, $xhtmlSafe=FALSE, $dontOmitBlankAttribs=FALSE)
static isFirstPartOfStr($str, $partStr)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]