67 if ($hookObj = $this->
hookRequest(
'render_bullets')) {
68 return $hookObj->render_bullets($content,
$conf);
71 $field = isset(
$conf[
'field']) && trim(
$conf[
'field']) ? trim(
$conf[
'field']) :
'bodytext';
72 $content = trim($this->cObj->data[$field]);
73 if ($content ===
'') {
78 foreach ($lines as &$val) {
79 $val =
'<li>' . $this->cObj->stdWrap($val,
$conf[
'innerStdWrap.']) .
'</li>';
83 $type = (int)$this->cObj->data[
'layout'];
86 <ul class="csc-bulletlist csc-bulletlist-' . $type .
'">' . implode(
'', $lines) .
' 102 if ($hookObj = $this->
hookRequest(
'render_table')) {
103 return $hookObj->render_table($content,
$conf);
108 $field = isset(
$conf[
'field']) && trim(
$conf[
'field']) ? trim(
$conf[
'field']) :
'bodytext';
109 $content = trim($this->cObj->data[$field]);
110 if ($content ===
'') {
114 $caption = trim(htmlspecialchars($this->
pi_getFFvalue($this->cObj->data[
'pi_flexform'],
'acctables_caption')));
115 $useTfoot = trim($this->
pi_getFFvalue($this->cObj->data[
'pi_flexform'],
'acctables_tfoot'));
116 $headerPos = $this->
pi_getFFvalue($this->cObj->data[
'pi_flexform'],
'acctables_headerpos');
117 $noStyles = $this->
pi_getFFvalue($this->cObj->data[
'pi_flexform'],
'acctables_nostyles');
118 $tableClass = $this->
pi_getFFvalue($this->cObj->data[
'pi_flexform'],
'acctables_tableclass');
119 $delimiter = trim($this->
pi_getFFvalue($this->cObj->data[
'pi_flexform'],
'tableparsing_delimiter',
's_parsing'));
121 $delimiter = chr((
int)$delimiter);
125 $quotedInput = trim($this->
pi_getFFvalue($this->cObj->data[
'pi_flexform'],
'tableparsing_quote',
's_parsing'));
127 $quotedInput = chr((
int)$quotedInput);
132 $headerScope = $headerPos ==
'top' ?
'col' :
'row';
133 $headerIdPrefix = $headerScope . $this->cObj->data[
'uid'] .
'-';
139 $this->cObj->data[
'cols'] ? $this->cObj->data[
'cols'] : count(str_getcsv(current($rows), $delimiter, $quotedInput)),
144 $rCount = count($rows);
145 foreach ($rows as $k => $v) {
146 $cells = str_getcsv($v, $delimiter, $quotedInput);
148 for ($a = 0; $a < $cols; $a++) {
149 if (trim($cells[$a]) ===
'') {
151 $cells[$a] = preg_replace(
'|<br */?>|i', LF, $cells[$a]);
153 $cellAttribs = $noStyles ?
'' : ($a > 0 && $cols - 1 == $a ?
' class="td-last td-' . $a .
'"' :
' class="td-' . $a .
'"');
154 if ($headerPos ==
'top' && !$k || $headerPos ==
'left' && !$a) {
155 $scope =
' scope="' . $headerScope .
'"';
156 $scope .=
' id="' . $headerIdPrefix . ($headerScope ==
'col' ? $a : $k) .
'"';
158 <th' . $cellAttribs . $scope .
'>' . $this->cObj->stdWrap($cells[$a],
$conf[
'innerStdWrap.']) .
'</th>';
160 if (empty($headerPos)) {
161 $accessibleHeader =
'';
163 $accessibleHeader =
' headers="' . $headerIdPrefix . ($headerScope ==
'col' ? $a : $k) .
'"';
166 <td' . $cellAttribs . $accessibleHeader .
'>' . $this->cObj->stdWrap($cells[$a],
$conf[
'innerStdWrap.']) .
'</td>';
170 $oddEven = $k % 2 ?
'tr-odd' :
'tr-even';
171 $rowAttribs = $k > 0 && $rCount - 1 == $k ?
' class="' . $oddEven .
' tr-last"' :
' class="' . $oddEven .
' tr-' . $k .
'"';
174 <tr' . $rowAttribs .
'>' . implode(
'', $newCells) .
' 181 <caption>' . $caption .
'</caption>';
183 if ($headerPos ==
'top' && $rows[0]) {
184 $tableContents .=
'<thead>' . $rows[0] .
' 191 <tfoot>' . $rows[($rCount - 1)] .
'</tfoot>';
192 unset($rows[$rCount - 1]);
195 $tmpTable = implode(
'', $rows);
197 $tmpTable =
'<tbody>' . $tmpTable .
'</tbody>';
199 $tableContents .= $tmpTable;
201 $type = (int)$this->cObj->data[
'layout'];
203 $tableTagParams = $this->getTableAttributes(
$conf, $type);
205 $tableTagParams[
'class'] =
'contenttable contenttable-' . $type . ($tableClass ?
' ' . $tableClass :
'') . $tableTagParams[
'class'];
206 } elseif ($tableClass) {
207 $tableTagParams[
'class'] = $tableClass;
227 if ($hookObj = $this->
hookRequest(
'render_uploads')) {
228 return $hookObj->render_uploads($content,
$conf);
234 $type = (int)$this->cObj->data[
'layout'];
236 $filePathConf = $this->cObj->stdWrap(
$conf[
'filePath'],
$conf[
'filePath.']);
238 $fileList = $this->cObj->filelist($filePathConf);
239 list($path) = explode(
'|', $filePathConf);
242 $field = trim(
$conf[
'field']) ?:
'media';
243 $fileList = $this->cObj->data[$field];
244 $path =
'uploads/media/';
246 is_array(
$GLOBALS[
'TCA'][
'tt_content'][
'columns'][$field]) &&
247 !empty(
$GLOBALS[
'TCA'][
'tt_content'][
'columns'][$field][
'config'][
'uploadfolder'])
250 $path =
$GLOBALS[
'TCA'][
'tt_content'][
'columns'][$field][
'config'][
'uploadfolder'] .
'/';
257 if (count($fileArray)) {
265 if ($this->cObj->data[
'target']) {
266 $conf[
'linkProc.'][
'target'] = $this->cObj->data[
'target'];
267 unset(
$conf[
'linkProc.'][
'target.']);
270 $conf[
'linkProc.'][
'path.'][
'current'] = 1;
271 if (
$conf[
'linkProc.'][
'combinedLink']) {
272 $conf[
'linkProc.'][
'icon'] = $type > 0 ? 1 : 0;
275 $conf[
'linkProc.'][
'icon'] = 1;
277 $conf[
'linkProc.'][
'icon.'][
'wrap'] =
' | //**//';
279 $conf[
'linkProc.'][
'icon_link'] = 1;
281 $conf[
'linkProc.'][
'icon_image_ext_list'] = $type == 2 || $type == 3 ?
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'] :
'';
283 if (
$conf[
'labelStdWrap.']) {
284 $conf[
'linkProc.'][
'labelStdWrap.'] =
$conf[
'labelStdWrap.'];
286 if (
$conf[
'useSpacesInLinkText'] ||
$conf[
'stripFileExtensionFromLinkText']) {
287 $conf[
'linkProc.'][
'removePrependedNumbers'] = 0;
290 $filesData = array();
291 foreach ($fileArray as $key => $fileName) {
293 if (@is_file($absPath)) {
294 $fI = pathinfo($fileName);
295 $filesData[$key] = array();
296 $currentPath = $path;
299 $fileName = substr($fileName, 6);
301 $filesData[$key][
'filename'] = $fileName;
302 $filesData[$key][
'path'] = $currentPath;
303 $filesData[$key][
'filesize'] = filesize($absPath);
304 $filesData[$key][
'fileextension'] = strtolower($fI[
'extension']);
305 $filesData[$key][
'description'] = trim($descriptions[$key]);
306 $filesData[$key][
'titletext'] = trim($titles[$key]);
307 $filesData[$key][
'alttext'] = trim($altTexts[$key]);
308 $conf[
'linkProc.'][
'title'] = trim($titles[$key]);
309 if (isset($altTexts[$key]) && !empty($altTexts[$key])) {
310 $altText = trim($altTexts[$key]);
312 $altText = sprintf($this->
pi_getLL(
'uploads.icon'), $fileName);
314 $conf[
'linkProc.'][
'altText'] = (
$conf[
'linkProc.'][
'iconCObject.'][
'altText'] = $altText);
315 $this->cObj->setCurrentVal($currentPath);
316 $GLOBALS[
'TSFE']->register[
'ICON_REL_PATH'] = $currentPath . $fileName;
317 $GLOBALS[
'TSFE']->register[
'filename'] = $filesData[$key][
'filename'];
318 $GLOBALS[
'TSFE']->register[
'path'] = $filesData[$key][
'path'];
319 $GLOBALS[
'TSFE']->register[
'fileSize'] = $filesData[$key][
'filesize'];
320 $GLOBALS[
'TSFE']->register[
'fileExtension'] = $filesData[$key][
'fileextension'];
321 $GLOBALS[
'TSFE']->register[
'description'] = $filesData[$key][
'description'];
322 $GLOBALS[
'TSFE']->register[
'titleText'] = $filesData[$key][
'titletext'];
323 $GLOBALS[
'TSFE']->register[
'altText'] = $filesData[$key][
'alttext'];
326 explode(
'//**//', $this->cObj->filelink($fileName,
$conf[
'linkProc.'])),
328 $conf[
'useSpacesInLinkText'],
329 $conf[
'stripFileExtensionFromLinkText']
334 $splitConf =
$GLOBALS[
'TSFE']->tmpl->splitConfArray(
$conf, count($filesData));
336 $outputEntries = array();
337 foreach ($filesData as $key => $fileData) {
338 $GLOBALS[
'TSFE']->register[
'linkedIcon'] = $fileData[
'linkedFilenameParts'][0];
339 $GLOBALS[
'TSFE']->register[
'linkedLabel'] = $fileData[
'linkedFilenameParts'][1];
340 $GLOBALS[
'TSFE']->register[
'filename'] = $fileData[
'filename'];
341 $GLOBALS[
'TSFE']->register[
'path'] = $fileData[
'path'];
342 $GLOBALS[
'TSFE']->register[
'description'] = $fileData[
'description'];
343 $GLOBALS[
'TSFE']->register[
'fileSize'] = $fileData[
'filesize'];
344 $GLOBALS[
'TSFE']->register[
'fileExtension'] = $fileData[
'fileextension'];
345 $GLOBALS[
'TSFE']->register[
'titleText'] = $fileData[
'titletext'];
346 $GLOBALS[
'TSFE']->register[
'altText'] = $fileData[
'alttext'];
347 $outputEntries[] = $this->cObj->cObjGetSingle($splitConf[$key][
'itemRendering'], $splitConf[$key][
'itemRendering.']);
349 if (isset(
$conf[
'outerWrap'])) {
351 $outerWrap = $this->cObj->stdWrap(
$conf[
'outerWrap'],
$conf[
'outerWrap.']);
355 $tableTagParams[
'class'] =
'csc-uploads csc-uploads-' . $type;
359 $out = $this->cObj->wrap(implode(
'', $outputEntries), $outerWrap);
377 $relations = array();
378 $equalRelations = array_fill(0, $colCount, 1);
379 $colRelationsTypoScript = trim($this->cObj->stdWrap(
$conf[
'colRelations'],
$conf[
'colRelations.']));
380 if ($colRelationsTypoScript) {
382 $relationParts = explode(
':', $colRelationsTypoScript);
384 if (count($relationParts) >= $colCount) {
386 for ($a = 0; $a < $colCount; $a++) {
387 $currentRelationValue = (int)$relationParts[$a];
388 if ($currentRelationValue >= 1) {
389 $out[$a] = $currentRelationValue;
391 GeneralUtility::devLog(
'colRelations used with a value smaller than 1 therefore colRelations setting is ignored.', $this->extKey, 2);
396 if (max($out) / min($out) <= 10) {
400 'The difference in size between the largest and smallest colRelation was not within' .
401 ' a factor of ten therefore colRelations setting is ignored..',
408 return $relations ?: $equalRelations;
420 $columnWidths = array();
423 $accumDesiredWidth = 0;
424 $relUnitCount = array_sum($colRelations);
425 for ($a = 0; $a < $colCount; $a++) {
427 $availableWidth = $netW - $accumWidth;
429 $desiredWidth = $netW / $relUnitCount * $colRelations[$a];
431 $accumDesiredWidth += $desiredWidth;
434 $suggestedWidth = round($accumDesiredWidth - $accumWidth);
436 $finalImgWidth = (int)min($availableWidth, $suggestedWidth);
437 $accumWidth += $finalImgWidth;
438 $columnWidths[$a] = $finalImgWidth;
440 return $columnWidths;
452 public function render_textpic($content,
$conf) {
454 if (method_exists($this,
'hookRequest') && ($hookObj = $this->
hookRequest(
'render_textpic'))) {
455 return $hookObj->render_textpic($content,
$conf);
457 $renderMethod = $this->cObj->stdWrap(
$conf[
'renderMethod'],
$conf[
'renderMethod.']);
459 if (!$renderMethod || $renderMethod ==
'table') {
460 return $this->cObj->IMGTEXT(
$conf);
462 $restoreRegisters = FALSE;
463 if (isset(
$conf[
'preRenderRegisters.'])) {
464 $restoreRegisters = TRUE;
465 $this->cObj->LOAD_REGISTER(
$conf[
'preRenderRegisters.'],
'LOAD_REGISTER');
468 if (is_array(
$conf[
'rendering.'][$renderMethod .
'.'])) {
469 $conf = array_replace_recursive(
$conf,
$conf[
'rendering.'][$renderMethod .
'.']);
472 if (is_array(
$conf[
'text.'])) {
473 $content = $this->cObj->stdWrap($this->cObj->cObjGet(
$conf[
'text.'],
'text.'),
$conf[
'text.']);
475 $imgList = trim($this->cObj->stdWrap(
$conf[
'imgList'],
$conf[
'imgList.']));
478 if ($restoreRegisters) {
479 $this->cObj->LOAD_REGISTER(array(),
'RESTORE_REGISTER');
484 if (count($imgs) === 0) {
486 if ($restoreRegisters) {
487 $this->cObj->LOAD_REGISTER(array(),
'RESTORE_REGISTER');
491 $imgStart = (int)$this->cObj->stdWrap(
$conf[
'imgStart'],
$conf[
'imgStart.']);
492 $imgCount = count($imgs) - $imgStart;
493 $imgMax = (int)$this->cObj->stdWrap(
$conf[
'imgMax'],
$conf[
'imgMax.']);
497 $imgPath = $this->cObj->stdWrap(
$conf[
'imgPath'],
$conf[
'imgPath.']);
499 $renderGlobalCaption = !
$conf[
'captionSplit'] && !
$conf[
'imageTextSplit'] && is_array(
$conf[
'caption.']);
500 if ($imgCount == 1) {
502 $renderGlobalCaption = FALSE;
504 $imgListContainsReferenceUids = (bool)(isset(
$conf[
'imgListContainsReferenceUids.'])
505 ? $this->cObj->stdWrap(
$conf[
'imgListContainsReferenceUids'],
$conf[
'imgListContainsReferenceUids.'])
506 :
$conf[
'imgListContainsReferenceUids']);
508 $GLOBALS[
'TSFE']->register[
'imageCount'] = $imgCount;
509 $GLOBALS[
'TSFE']->register[
'renderGlobalCaption'] = $renderGlobalCaption;
510 $fallbackRenderMethod =
'';
511 if (
$conf[
'fallbackRendering']) {
512 $fallbackRenderMethod = $this->cObj->cObjGetSingle(
$conf[
'fallbackRendering'],
$conf[
'fallbackRendering.']);
514 if ($fallbackRenderMethod && is_array(
$conf[
'rendering.'][$fallbackRenderMethod .
'.'])) {
515 $conf = array_replace_recursive(
$conf,
$conf[
'rendering.'][$fallbackRenderMethod .
'.']);
518 $accessibilityMode = FALSE;
519 if (strpos(strtolower($renderMethod),
'caption') || strpos(strtolower($fallbackRenderMethod),
'caption')) {
520 $accessibilityMode = TRUE;
524 if ($renderGlobalCaption) {
525 $globalCaption = $this->cObj->stdWrap($this->cObj->cObjGet(
$conf[
'caption.'],
'caption.'),
$conf[
'caption.']);
528 $position = $this->cObj->stdWrap(
$conf[
'textPos'],
$conf[
'textPos.']);
530 $imagePosition = $position & 7;
532 $contentPosition = $position & 24;
533 $textMargin = (int)$this->cObj->stdWrap(
$conf[
'textMargin'],
$conf[
'textMargin.']);
534 if (!
$conf[
'textMargin_outOfText'] && $contentPosition < 16) {
537 $colspacing = (int)$this->cObj->stdWrap(
$conf[
'colSpace'],
$conf[
'colSpace.']);
538 $border = (int)$this->cObj->stdWrap(
$conf[
'border'],
$conf[
'border.']) ? 1 : 0;
539 $borderThickness = (int)$this->cObj->stdWrap(
$conf[
'borderThick'],
$conf[
'borderThick.']);
540 $borderThickness = $borderThickness ?: 1;
541 $borderSpace =
$conf[
'borderSpace'] && $border ? (int)
$conf[
'borderSpace'] : 0;
543 $cols = (int)$this->cObj->stdWrap(
$conf[
'cols'],
$conf[
'cols.']);
544 $colCount = $cols > 1 ? $cols : 1;
545 if ($colCount > $imgCount) {
546 $colCount = $imgCount;
548 $rowCount = ceil($imgCount / $colCount);
550 $rows = (int)$this->cObj->stdWrap(
$conf[
'rows'],
$conf[
'rows.']);
553 if ($rowCount > $imgCount) {
554 $rowCount = $imgCount;
556 $colCount = $rowCount > 1 ? ceil($imgCount / $rowCount) : $imgCount;
559 $maxW = (int)$this->cObj->stdWrap(
$conf[
'maxW'],
$conf[
'maxW.']);
560 $maxWInText = (int)$this->cObj->stdWrap(
$conf[
'maxWInText'],
$conf[
'maxWInText.']);
561 $fiftyPercentWidthInText = round($maxW / 100 * 50);
563 if ($contentPosition >= 16) {
566 $maxW = $fiftyPercentWidthInText;
572 $netW = $maxW - $colspacing * ($colCount - 1) - $colCount * $border * ($borderThickness + $borderSpace) * 2;
575 $image_compression = (int)$this->cObj->stdWrap(
$conf[
'image_compression'],
$conf[
'image_compression.']);
576 $image_effects = (int)$this->cObj->stdWrap(
$conf[
'image_effects'],
$conf[
'image_effects.']);
577 $image_frames = (int)$this->cObj->stdWrap(
$conf[
'image_frames.'][
'key'],
$conf[
'image_frames.'][
'key.']);
579 $equalHeight = (int)$this->cObj->stdWrap(
$conf[
'equalH'],
$conf[
'equalH.']);
581 $relations_cols = array();
583 $imgWidths = array();
584 for ($a = 0; $a < $imgCount; $a++) {
585 $imgKey = $a + $imgStart;
589 if ($imgListContainsReferenceUids) {
590 $file = $this->
getResourceFactory()->getFileReferenceObject((
int)$imgs[$imgKey])->getOriginalFile();
596 $file = $this->
getResourceFactory()->getFileObjectFromCombinedIdentifier($imgPath . $imgs[$imgKey]);
600 $rel = $file->getProperty(
'height') / $equalHeight;
603 $imgWidths[$a] = $file->getProperty(
'width') / $rel;
605 $relations_cols[(int)floor($a / $colCount)] += $imgWidths[$a];
611 $splitArr[
'imgObjNum'] =
$conf[
'imgObjNum'];
612 $splitArr =
$GLOBALS[
'TSFE']->tmpl->splitConfArray($splitArr, $imgCount);
614 $imageRowsFinalWidths = array();
617 $origImages = array();
619 for ($a = 0; $a < $imgCount; $a++) {
620 $imgKey = $a + $imgStart;
623 $totalImagePath = (int)$imgs[$imgKey];
626 $totalImagePath = $imgPath . $imgs[$imgKey];
629 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM'] = $imgKey;
630 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM_CURRENT'] = $imgKey;
631 $GLOBALS[
'TSFE']->register[
'ORIG_FILENAME'] = $totalImagePath;
632 $this->cObj->data[$this->cObj->currentValKey] = $totalImagePath;
633 $imgObjNum = (int)$splitArr[$a][
'imgObjNum'];
634 $imgConf =
$conf[$imgObjNum .
'.'];
636 if ($a % $colCount == 0) {
641 $accumDesiredWidth = 0;
642 $rowTotalMaxW = $relations_cols[$rowIdx];
643 if ($rowTotalMaxW > $netW && $netW > 0) {
644 $scale = $rowTotalMaxW / $netW;
648 $desiredHeight = $equalHeight / $scale;
652 $availableWidth = $netW - $accumWidth;
654 $desiredWidth = $imgWidths[$a] / $scale;
656 $accumDesiredWidth += $desiredWidth;
659 $suggestedWidth = round($accumDesiredWidth - $accumWidth);
661 $finalImgWidth = (int)min($availableWidth, $suggestedWidth);
662 $accumWidth += $finalImgWidth;
663 $imgConf[
'file.'][
'width'] = $finalImgWidth;
664 $imgConf[
'file.'][
'height'] = round($desiredHeight);
666 unset($imgConf[
'file.'][
'maxW']);
667 unset($imgConf[
'file.'][
'maxH']);
668 unset($imgConf[
'file.'][
'minW']);
669 unset($imgConf[
'file.'][
'minH']);
670 unset($imgConf[
'file.'][
'width.']);
671 unset($imgConf[
'file.'][
'maxW.']);
672 unset($imgConf[
'file.'][
'maxH.']);
673 unset($imgConf[
'file.'][
'minW.']);
674 unset($imgConf[
'file.'][
'minH.']);
676 $imgConf[
'file.'][
'maxW'] = $columnWidths[$a % $colCount];
678 $titleInLink = $this->cObj->stdWrap($imgConf[
'titleInLink'], $imgConf[
'titleInLink.']);
679 $titleInLinkAndImg = $this->cObj->stdWrap($imgConf[
'titleInLinkAndImg'], $imgConf[
'titleInLinkAndImg.']);
680 $oldATagParms =
$GLOBALS[
'TSFE']->ATagParams;
683 $titleText = trim($this->cObj->stdWrap($imgConf[
'titleText'], $imgConf[
'titleText.']));
686 $GLOBALS[
'TSFE']->ATagParams .=
' title="' . htmlspecialchars($titleText) .
'"';
693 $customRendering =
'';
694 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'css_styled_content'][
'pi1_hooks'][
'render_singleMediaElement'])
695 && is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'css_styled_content'][
'pi1_hooks'][
'render_singleMediaElement'])) {
696 $hookParameters = array(
697 'file' => $totalImagePath,
698 'imageConfiguration' => $imgConf
701 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'css_styled_content'][
'pi1_hooks'][
'render_singleMediaElement'] as $reference) {
704 if (!empty($customRendering)) {
710 if (!empty($customRendering)) {
711 $imgsTag[$imgKey] = $customRendering;
712 } elseif ($imgConf || $imgConf[
'file']) {
713 if ($this->cObj->image_effects[$image_effects]) {
714 $imgConf[
'file.'][
'params'] .=
' ' . $this->cObj->image_effects[$image_effects];
717 if (is_array(
$conf[
'image_frames.'][$image_frames .
'.'])) {
718 $imgConf[
'file.'][
'm.'] =
$conf[
'image_frames.'][$image_frames .
'.'];
721 if ($image_compression && $imgConf[
'file'] !=
'GIFBUILDER') {
722 if ($image_compression == 1) {
723 $tempImport = $imgConf[
'file.'][
'import'];
724 $tempImport_dot = $imgConf[
'file.'][
'import.'];
725 $tempTreatIdAsReference = $imgConf[
'file.'][
'treatIdAsReference'];
726 unset($imgConf[
'file.']);
727 $imgConf[
'file.'][
'import'] = $tempImport;
728 $imgConf[
'file.'][
'import.'] = $tempImport_dot;
729 $imgConf[
'file.'][
'treatIdAsReference'] = $tempTreatIdAsReference;
730 } elseif (isset($this->cObj->image_compression[$image_compression])) {
731 $imgConf[
'file.'][
'params'] .=
' ' . $this->cObj->image_compression[$image_compression][
'params'];
732 $imgConf[
'file.'][
'ext'] = $this->cObj->image_compression[$image_compression][
'ext'];
733 unset($imgConf[
'file.'][
'ext.']);
736 if ($titleInLink && !$titleInLinkAndImg) {
738 $link = $this->cObj->imageLinkWrap(
'', $this->cObj->getCurrentFile() ?: $totalImagePath, $imgConf[
'imageLinkWrap.']);
741 unset($imgConf[
'titleText']);
742 unset($imgConf[
'titleText.']);
743 $imgConf[
'emptyTitleHandling'] =
'removeAttr';
746 $imgsTag[$imgKey] = $this->cObj->IMAGE($imgConf);
749 $imgsTag[$imgKey] = $this->cObj->IMAGE(array(
'file' => $totalImagePath));
752 $GLOBALS[
'TSFE']->ATagParams = $oldATagParms;
754 $origImages[$imgKey] =
$GLOBALS[
'TSFE']->lastImageInfo;
755 if (
$GLOBALS[
'TSFE']->lastImageInfo[0] == 0) {
756 $imageRowsFinalWidths[(int)floor($a / $colCount)] += $this->cObj->data[
'imagewidth'];
758 $imageRowsFinalWidths[(int)floor($a / $colCount)] +=
$GLOBALS[
'TSFE']->lastImageInfo[0];
762 $imageBlockWidth = max($imageRowsFinalWidths) + $colspacing * ($colCount - 1) + $colCount * $border * ($borderSpace + $borderThickness) * 2;
763 $GLOBALS[
'TSFE']->register[
'rowwidth'] = $imageBlockWidth;
764 $GLOBALS[
'TSFE']->register[
'rowWidthPlusTextMargin'] = $imageBlockWidth + $textMargin;
767 $noRows = $this->cObj->stdWrap(
$conf[
'noRows'],
$conf[
'noRows.']);
768 $noCols = $this->cObj->stdWrap(
$conf[
'noCols'],
$conf[
'noCols.']);
778 if (!is_array(
$conf[
'editIcons.'])) {
779 $conf[
'editIcons.'] = array();
781 $editIconsHTML =
$conf[
'editIcons'] &&
$GLOBALS[
'TSFE']->beUserLogin ? $this->cObj->editIcons(
'',
$conf[
'editIcons'],
$conf[
'editIcons.']) :
'';
785 $imageWrapCols = $colCount;
788 $separateRows = $this->cObj->stdWrap(
$conf[
'separateRows'],
$conf[
'separateRows.']);
792 if ($rowCount == 1) {
795 if ($accessibilityMode) {
796 $imagesInColumns = round($imgCount / ($rowCount * $colCount), 0, PHP_ROUND_HALF_UP);
798 $addClassesCol =
$conf[
'addClassesCol'];
799 if (isset(
$conf[
'addClassesCol.'])) {
800 $addClassesCol = $this->cObj->stdWrap($addClassesCol,
$conf[
'addClassesCol.']);
802 $addClassesColConf =
$GLOBALS[
'TSFE']->tmpl->splitConfArray(array(
'addClassesCol' => $addClassesCol), $colCount);
804 $addClassesImage =
$conf[
'addClassesImage'];
805 if (isset(
$conf[
'addClassesImage.'])) {
806 $addClassesImage = $this->cObj->stdWrap($addClassesImage,
$conf[
'addClassesImage.']);
808 $addClassesImageConf =
$GLOBALS[
'TSFE']->tmpl->splitConfArray(array(
'addClassesImage' => $addClassesImage), $imagesInColumns);
812 $classCaptionAlign = array(
813 'center' =>
'csc-textpic-caption-c',
814 'right' =>
'csc-textpic-caption-r',
815 'left' =>
'csc-textpic-caption-l' 817 $captionAlign = $this->cObj->stdWrap(
$conf[
'captionAlign'],
$conf[
'captionAlign.']);
819 for ($rowCounter = 1; $rowCounter <= $rowCount; $rowCounter++) {
820 $rowColumns = array();
822 for ($columnCounter = 1; $columnCounter <= $colCount; $columnCounter++) {
823 $columnImages = array();
825 for ($imagesCounter = 1; $imagesCounter <= $imagesInColumns; $imagesCounter++) {
827 $splitCaption = NULL;
828 $imageMarkers = ($captionMarkers = array());
831 $imageKey = $currentImage + $imgStart;
833 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM_CURRENT'] = $imageKey;
834 $this->cObj->data[$this->cObj->currentValKey] = $origImages[$imageKey][
'origFile'];
837 } elseif (!isset($imgs[$imageKey])) {
840 $this->cObj->setCurrentFile(NULL);
843 if (isset($imgsTag[$imageKey])) {
844 $image = $this->cObj->stdWrap($imgsTag[$imageKey],
$conf[
'imgTagStdWrap.']);
846 if ($editIconsHTML) {
847 $image .= $this->cObj->stdWrap($editIconsHTML,
$conf[
'editIconsStdWrap.']);
850 $single = $this->cObj->stdWrap($image,
$conf[
'singleStdWrap.']);
852 if (!$renderGlobalCaption) {
853 $imageMarkers[
'caption'] = $this->cObj->stdWrap($this->cObj->cObjGet(
$conf[
'caption.'],
'caption.'),
$conf[
'caption.']);
855 $captionMarkers[
'classes'] =
' ' . $classCaptionAlign[$captionAlign];
857 $imageMarkers[
'caption'] = $this->cObj->substituteMarkerArray($imageMarkers[
'caption'], $captionMarkers,
'###|###', 1, 1);
859 if ($addClassesImageConf[$imagesCounter - 1][
'addClassesImage']) {
860 $imageMarkers[
'classes'] =
' ' . $addClassesImageConf[($imagesCounter - 1)][
'addClassesImage'];
863 $columnImages[] = $this->cObj->substituteMarkerArray($single, $imageMarkers,
'###|###', 1, 1);
866 $rowColumn = $this->cObj->stdWrap(implode(LF, $columnImages),
$conf[
'columnStdWrap.']);
868 $columnMarkers = array();
869 if ($addClassesColConf[$columnCounter - 1][
'addClassesCol']) {
870 $columnMarkers[
'classes'] =
' ' . $addClassesColConf[($columnCounter - 1)][
'addClassesCol'];
872 $rowColumns[] = $this->cObj->substituteMarkerArray($rowColumn, $columnMarkers,
'###|###', 1, 1);
875 $rowConfiguration =
$conf[
'noRowsStdWrap.'];
876 } elseif ($rowCounter == $rowCount) {
877 $rowConfiguration =
$conf[
'lastRowStdWrap.'];
879 $rowConfiguration =
$conf[
'rowStdWrap.'];
881 $row = $this->cObj->stdWrap(implode(LF, $rowColumns), $rowConfiguration);
883 $rowMarkers = array();
884 $rows[] = $this->cObj->substituteMarkerArray($row, $rowMarkers,
'###|###', 1, 1);
886 $images = $this->cObj->stdWrap(implode(LF, $rows),
$conf[
'allStdWrap.']);
888 $allMarkers = array();
891 if ($globalCaption) {
892 $allMarkers[
'caption'] = $globalCaption;
894 $classes[] = $classCaptionAlign[$captionAlign];
898 $noWrapMargin = (int)(($maxWInText ? $maxWInText : $fiftyPercentWidthInText) + (int)$this->cObj->stdWrap(
$conf[
'textMargin'],
$conf[
'textMargin.']));
899 $this->
addPageStyle(
'.csc-textpic-intext-right-nowrap .csc-textpic-text',
'margin-right: ' . $noWrapMargin .
'px;');
900 $this->
addPageStyle(
'.csc-textpic-intext-left-nowrap .csc-textpic-text',
'margin-left: ' . $noWrapMargin .
'px;');
902 if ($contentPosition == 24 && $maxW != $imageBlockWidth) {
903 $noWrapMargin = $imageBlockWidth + $textMargin;
905 if ($imagePosition == 1) {
906 $this->
addPageStyle(
'.csc-textpic-intext-right-nowrap-' . $noWrapMargin .
' .csc-textpic-text',
'margin-right: ' . $noWrapMargin .
'px;');
907 $classes[] =
'csc-textpic-intext-right-nowrap-' . $noWrapMargin;
908 } elseif ($imagePosition == 2) {
909 $this->
addPageStyle(
'.csc-textpic-intext-left-nowrap-' . $noWrapMargin .
' .csc-textpic-text',
'margin-left: ' . $noWrapMargin .
'px;');
910 $classes[] =
'csc-textpic-intext-left-nowrap-' . $noWrapMargin;
915 $classes[] =
$conf[
'borderClass'] ?:
'csc-textpic-border';
919 $classes[] =
'csc-textpic-equalheight';
921 $addClasses = $this->cObj->stdWrap(
$conf[
'addClasses'],
$conf[
'addClasses.']);
923 $classes[] = $addClasses;
926 $class =
' ' . implode(
' ', $classes);
929 $images = $this->cObj->substituteMarkerArray($images, $allMarkers,
'###|###', 1, 1);
932 $addClassesImage =
$conf[
'addClassesImage'];
933 if (isset(
$conf[
'addClassesImage.'])) {
934 $addClassesImage = $this->cObj->stdWrap($addClassesImage,
$conf[
'addClassesImage.']);
936 $addClassesImageConf =
$GLOBALS[
'TSFE']->tmpl->splitConfArray(array(
'addClassesImage' => $addClassesImage), $colCount);
939 for ($c = 0; $c < $imageWrapCols; $c++) {
940 $tmpColspacing = $colspacing;
941 if ($c == $imageWrapCols - 1 && $imagePosition == 2 || $c == 0 && ($imagePosition == 1 || $imagePosition == 0)) {
948 $imgsTagCount = count($imgsTag);
949 for ($i = $c; $i < $imgsTagCount; $i = $i + $imageWrapCols) {
950 $imgKey = $i + $imgStart;
951 $colPos = $i % $colCount;
952 if ($separateRows && $colPos == 0) {
956 if ($origImages[$imgKey][0] == 0) {
957 $imageSpace = $this->cObj->data[
'imagewidth'] + $border * ($borderSpace + $borderThickness) * 2;
959 $imageSpace = $origImages[$imgKey][0] + $border * ($borderSpace + $borderThickness) * 2;
961 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM'] = $imgKey;
962 $GLOBALS[
'TSFE']->register[
'IMAGE_NUM_CURRENT'] = $imgKey;
963 $GLOBALS[
'TSFE']->register[
'ORIG_FILENAME'] = $origImages[$imgKey][
'origFile'];
964 $GLOBALS[
'TSFE']->register[
'imagewidth'] = $origImages[$imgKey][0];
965 $GLOBALS[
'TSFE']->register[
'imagespace'] = $imageSpace;
966 $GLOBALS[
'TSFE']->register[
'imageheight'] = $origImages[$imgKey][1];
970 if ($imageSpace > $maxImageSpace) {
971 $maxImageSpace = $imageSpace;
974 $thisImage .= $this->cObj->stdWrap($imgsTag[$imgKey],
$conf[
'imgTagStdWrap.']);
975 if (!$renderGlobalCaption) {
976 $thisImage .= $this->cObj->stdWrap($this->cObj->cObjGet(
$conf[
'caption.'],
'caption.'),
$conf[
'caption.']);
978 if ($editIconsHTML) {
979 $thisImage .= $this->cObj->stdWrap($editIconsHTML,
$conf[
'editIconsStdWrap.']);
981 $thisImage = $this->cObj->stdWrap($thisImage,
$conf[
'oneImageStdWrap.']);
983 if ($addClassesImageConf[$colPos][
'addClassesImage']) {
984 $classes =
' ' . $addClassesImageConf[$colPos][
'addClassesImage'];
986 $thisImage = str_replace(
'###CLASSES###', $classes, $thisImage);
988 $thisRow .= $thisImage;
990 $allRows .= $thisImage;
992 $GLOBALS[
'TSFE']->register[
'columnwidth'] = $maxImageSpace + $tmpColspacing;
994 if ($separateRows && $i + 1 == count($imgsTag)) {
996 $allRows .= $this->cObj->stdWrap(
998 is_array(
$conf[
'imageLastRowStdWrap.']) ?
$conf[
'imageLastRowStdWrap.'] :
$conf[
'imageRowStdWrap.']
1000 } elseif ($separateRows && $colPos == $colCount - 1) {
1001 $allRows .= $this->cObj->stdWrap($thisRow,
$conf[
'imageRowStdWrap.']);
1004 if ($separateRows) {
1005 $thisImages .= $allRows;
1007 $thisImages .= $this->cObj->stdWrap($allRows,
$conf[
'noRowsStdWrap.']);
1011 $images .= $this->cObj->stdWrap($thisImages,
$conf[
'imageColumnStdWrap.']);
1013 $images .= $thisImages;
1017 if ($globalCaption) {
1018 $images .= $globalCaption;
1022 $classCaptionAlign = array(
1023 'center' =>
'csc-textpic-caption-c',
1024 'right' =>
'csc-textpic-caption-r',
1025 'left' =>
'csc-textpic-caption-l' 1027 $captionAlign = $this->cObj->stdWrap(
$conf[
'captionAlign'],
$conf[
'captionAlign.']);
1028 if ($captionAlign) {
1029 $captionClass = $classCaptionAlign[$captionAlign];
1033 $borderClass =
$conf[
'borderClass'] ?:
'csc-textpic-border';
1037 $class .= $borderClass ?
' ' . $borderClass :
'';
1038 $class .= $captionClass ?
' ' . $captionClass :
'';
1039 $class .= $equalHeight ?
' csc-textpic-equalheight' :
'';
1040 $addClasses = $this->cObj->stdWrap(
$conf[
'addClasses'],
$conf[
'addClasses.']);
1041 $class .= $addClasses ?
' ' . $addClasses :
'';
1044 if ($position == 0 || $position == 8) {
1046 $imgWrapWidth = $imageBlockWidth;
1048 if ($rowCount > 1) {
1050 $imgWrapWidth = $imageBlockWidth;
1052 if ($globalCaption) {
1054 $imgWrapWidth = $imageBlockWidth;
1057 $GLOBALS[
'TSFE']->register[
'totalwidth'] = $imgWrapWidth;
1058 if ($imgWrapWidth) {
1059 $images = $this->cObj->stdWrap($images,
$conf[
'imageStdWrap.']);
1061 $images = $this->cObj->stdWrap($images,
$conf[
'imageStdWrapNoWidth.']);
1065 $output = str_replace(
1076 $this->cObj->cObjGetSingle(
$conf[
'layout'],
$conf[
'layout.'])
1079 if ($restoreRegisters) {
1080 $this->cObj->LOAD_REGISTER(array(),
'RESTORE_REGISTER');
1098 if ($treatAsReference) {
1099 $imageFile = $resourceFactory->getFileReferenceObject($fileUid);
1101 $imageFile = $resourceFactory->getFileObject($fileUid);
1103 $this->cObj->setCurrentFile($imageFile);
1122 if (method_exists($this,
'hookRequest') && ($hookObject = $this->
hookRequest(
'renderSpace'))) {
1123 return $hookObject->renderSpace($content, $configuration);
1125 if (isset($configuration[
'space']) && in_array($configuration[
'space'], array(
'before',
'after'))) {
1126 $constant = (int)$configuration[
'constant'];
1127 if ($configuration[
'space'] ===
'before') {
1128 $value = $constant + $this->cObj->data[
'spaceBefore'];
1129 $declaration =
'margin-top: ' . $value .
'px !important;';
1131 $value = $constant + $this->cObj->data[
'spaceAfter'];
1132 $declaration =
'margin-bottom: ' . $value .
'px !important;';
1134 if (!empty($value)) {
1135 if ($configuration[
'classStdWrap.']) {
1136 $className = $this->cObj->stdWrap($value, $configuration[
'classStdWrap.']);
1138 $className = $value;
1140 $selector =
'.' . trim($className);
1163 protected function beautifyFileLink(array $links, $fileName, $useSpaces = FALSE, $cutFileExtension = FALSE) {
1164 $linkText = $fileName;
1166 $linkText = str_replace(
'_',
' ', $linkText);
1168 if ($cutFileExtension) {
1169 $pos = strrpos($linkText,
'.');
1170 $linkText = substr($linkText, 0, $pos);
1172 $links[1] = str_replace(
'>' . $fileName .
'<',
'>' . htmlspecialchars($linkText) .
'<', $links[1]);
1186 $tableTagParams_conf =
$conf[
'tableParams_' . $type .
'.'];
1187 $border = $this->cObj->data[
'table_border'] ? (int)$this->cObj->data[
'table_border'] : $tableTagParams_conf[
'border'];
1188 $cellSpacing = $this->cObj->data[
'table_cellspacing'] ? (
int)$this->cObj->data[
'table_cellspacing'] : $tableTagParams_conf[
'cellspacing'];
1189 $cellPadding = $this->cObj->data[
'table_cellpadding'] ? (int)$this->cObj->data[
'table_cellpadding'] : $tableTagParams_conf[
'cellpadding'];
1190 $summary = trim(htmlspecialchars($this->
pi_getFFvalue($this->cObj->data[
'pi_flexform'],
'acctables_summary')));
1192 $tableTagParams = ($classes = array());
1194 if (
$GLOBALS[
'TSFE']->config[
'config'][
'doctype'] !==
'html5') {
1195 $tableTagParams[
'border'] = $border;
1196 $tableTagParams[
'cellspacing'] = $cellSpacing;
1197 $tableTagParams[
'cellpadding'] = $cellPadding;
1199 $tableTagParams[
'summary'] = $summary;
1204 $borderClass =
'contenttable-border-' . $border;
1205 $borderDeclaration =
'border-width: ' . $border .
'px; border-style: solid;';
1206 $this->
addPageStyle(
'.' . $borderClass, $borderDeclaration);
1207 $classes[] = $borderClass;
1211 $tableTagParams[
'border'] = 1;
1213 $cellSpacingClass =
'contenttable-cellspacing-' . $cellSpacing;
1214 $cellSpacingDeclaration =
'border-spacing: ' . $cellSpacing .
'px;';
1215 $this->
addPageStyle(
'.' . $cellSpacingClass, $cellSpacingDeclaration);
1216 $classes[] = $cellSpacingClass;
1220 $cellPaddingClass =
'contenttable-cellpadding-' . $cellPadding;
1221 $cellSpacingSelector =
'.' . $cellPaddingClass .
' td, .' . $cellPaddingClass .
' th';
1222 $cellPaddingDeclaration =
'padding: ' . $cellPadding .
'px;';
1223 $this->
addPageStyle($cellSpacingSelector, $cellPaddingDeclaration);
1224 $classes[] = $cellPaddingClass;
1228 if (isset(
$conf[
'color.'][$this->cObj->data[
'table_bgColor']]) && !empty(
$conf[
'color.'][$this->cObj->data[
'table_bgColor']])) {
1229 $classes[] =
'contenttable-color-' . $this->cObj->data[
'table_bgColor'];
1231 if (!empty($classes)) {
1232 $tableTagParams[
'class'] =
' ' . implode(
' ', $classes);
1235 return $tableTagParams;
1250 if (!isset(
$GLOBALS[
'TSFE']->tmpl->setup[
'plugin.'][
'tx_cssstyledcontent.'][
'_CSS_PAGE_STYLE'])) {
1251 $GLOBALS[
'TSFE']->tmpl->setup[
'plugin.'][
'tx_cssstyledcontent.'][
'_CSS_PAGE_STYLE'] = array();
1253 if (!isset(
$GLOBALS[
'TSFE']->tmpl->setup[
'plugin.'][
'tx_cssstyledcontent.'][
'_CSS_PAGE_STYLE'][$selector])) {
1254 $GLOBALS[
'TSFE']->tmpl->setup[
'plugin.'][
'tx_cssstyledcontent.'][
'_CSS_PAGE_STYLE'][$selector] = TAB . $selector .
' { ' . $declaration .
' }';
1268 if ($TYPO3_CONF_VARS[
'EXTCONF'][
'css_styled_content'][
'pi1_hooks'][$functionName]) {
1270 if (method_exists($hookObj, $functionName)) {
1271 $hookObj->pObj = $this;
1283 return \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
static implodeAttributes(array $arr, $xhtmlSafe=FALSE, $dontOmitBlankAttribs=FALSE)
$TYPO3_CONF_VARS['SYS']['contentTable']
pi_getFFvalue($T3FlexForm_array, $fieldName, $sheet='sDEF', $lang='lDEF', $value='vDEF')
render_uploads($content, $conf)
getImgColumnWidths($conf, $colCount, $netW)
pi_initPIflexForm($field='pi_flexform')
static devLog($msg, $extKey, $severity=0, $dataVar=FALSE)
static isFirstPartOfStr($str, $partStr)
static forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
static canBeInterpretedAsInteger($var)
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
addPageStyle($selector, $declaration)
beautifyFileLink(array $links, $fileName, $useSpaces=FALSE, $cutFileExtension=FALSE)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
render_table($content, $conf)
getImgColumnRelations($conf, $colCount)
getTableAttributes($conf, $type)
hookRequest($functionName)
pi_getLL($key, $alternativeLabel='', $hsc=FALSE)
initializeCurrentFileInContentObjectRenderer($fileUid, $treatAsReference)
render_bullets($content, $conf)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static getFileAbsFileName($filename, $onlyRelative=TRUE, $relToTYPO3_mainDir=FALSE)
static resolveBackPath($pathStr)
renderSpace($content, array $configuration)