📄 class.tx_cssstyledcontent_pi1.php
字号:
if ($titleText) { // This will be used by the IMAGE call later: $GLOBALS['TSFE']->ATagParams .= ' title="'. $titleText .'"'; } } if ($imgConf || $imgConf['file']) { if ($this->cObj->image_effects[$image_effects]) { $imgConf['file.']['params'] .= ' '.$this->cObj->image_effects[$image_effects]; } if ($image_frames) { if (is_array($conf['image_frames.'][$image_frames.'.'])) { $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.']; } } if ($image_compression && $imgConf['file'] != 'GIFBUILDER') { if ($image_compression == 1) { $tempImport = $imgConf['file.']['import']; $tempImport_dot = $imgConf['file.']['import.']; unset($imgConf['file.']); $imgConf['file.']['import'] = $tempImport; $imgConf['file.']['import.'] = $tempImport_dot; } elseif (isset($this->cObj->image_compression[$image_compression])) { $imgConf['file.']['params'] .= ' '.$this->cObj->image_compression[$image_compression]['params']; $imgConf['file.']['ext'] = $this->cObj->image_compression[$image_compression]['ext']; unset($imgConf['file.']['ext.']); } } if ($titleInLink && ! $titleInLinkAndImg) { // Check if the image will be linked $link = $this->cObj->imageLinkWrap('', $totalImagePath, $imgConf['imageLinkWrap.']); if ($link) { // Title in A-tag only (set above: ATagParams), not in IMG-tag unset($imgConf['titleText']); unset($imgConf['titleText.']); $imgConf['emptyTitleHandling'] = 'removeAttr'; } } $imgsTag[$imgKey] = $this->cObj->IMAGE($imgConf); } else { $imgsTag[$imgKey] = $this->cObj->IMAGE(Array('file' => $totalImagePath)); // currentValKey !!! } // Restore our ATagParams $GLOBALS['TSFE']->ATagParams = $oldATagParms; // Store the original filepath $origImages[$imgKey] = $GLOBALS['TSFE']->lastImageInfo; $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0]; } // How much space will the image-block occupy? $imageBlockWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*($borderSpace+$borderThickness)*2; $GLOBALS['TSFE']->register['rowwidth'] = $imageBlockWidth; $GLOBALS['TSFE']->register['rowWidthPlusTextMargin'] = $imageBlockWidth + $textMargin; // noRows is in fact just one ROW, with the amount of columns specified, where the images are placed in. // noCols is just one COLUMN, each images placed side by side on each row $noRows = $this->cObj->stdWrap($conf['noRows'],$conf['noRows.']); $noCols = $this->cObj->stdWrap($conf['noCols'],$conf['noCols.']); if ($noRows) {$noCols=0;} // noRows overrides noCols. They cannot exist at the same time. $rowCount_temp = 1; $colCount_temp = $colCount; if ($noRows) { $rowCount_temp = $rowCount; $rowCount = 1; } if ($noCols) { $colCount = 1; $columnWidths = array(); } // Edit icons: $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->cObj->editIcons('',$conf['editIcons'],$conf['editIcons.']) : ''; // If noRows, we need multiple imagecolumn wraps $imageWrapCols = 1; if ($noRows) { $imageWrapCols = $colCount; } // User wants to separate the rows, but only do that if we do have rows $separateRows = $this->cObj->stdWrap($conf['separateRows'], $conf['separateRows.']); if ($noRows) { $separateRows = 0; } if ($rowCount == 1) { $separateRows = 0; } // Apply optionSplit to the list of classes that we want to add to each image $addClassesImage = $conf['addClassesImage']; if ($conf['addClassesImage.']) { $addClassesImage = $this->cObj->stdWrap($addClassesImageConf, $conf['addClassesImage.']); } $addClassesImageConf = $GLOBALS['TSFE']->tmpl->splitConfArray(array('addClassesImage' => $addClassesImage), $colCount); // Render the images $images = ''; for ($c = 0; $c < $imageWrapCols; $c++) { $tmpColspacing = $colspacing; if (($c==$imageWrapCols-1 && $imagePosition==2) || ($c==0 && ($imagePosition==1||$imagePosition==0))) { // Do not add spacing after column if we are first column (left) or last column (center/right) $tmpColspacing = 0; } $thisImages = ''; $allRows = ''; $maxImageSpace = 0; for ($i = $c; $i<count($imgsTag); $i=$i+$imageWrapCols) { $imgKey = $i+$imgStart; $colPos = $i%$colCount; if ($separateRows && $colPos == 0) { $thisRow = ''; } // Render one image $imageSpace = $origImages[$imgKey][0] + $border*($borderSpace+$borderThickness)*2; $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgKey; $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgKey; $GLOBALS['TSFE']->register['ORIG_FILENAME'] = $origImages[$imgKey]['origFile']; $GLOBALS['TSFE']->register['imagewidth'] = $origImages[$imgKey][0]; $GLOBALS['TSFE']->register['imagespace'] = $imageSpace; $GLOBALS['TSFE']->register['imageheight'] = $origImages[$imgKey][1]; if ($imageSpace > $maxImageSpace) { $maxImageSpace = $imageSpace; } $thisImage = ''; $thisImage .= $this->cObj->stdWrap($imgsTag[$imgKey], $conf['imgTagStdWrap.']); if ($conf['captionSplit'] || $conf['imageTextSplit']) { $thisImage .= $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']); } if ($editIconsHTML) { $thisImage .= $this->cObj->stdWrap($editIconsHTML, $conf['editIconsStdWrap.']); } $thisImage = $this->cObj->stdWrap($thisImage, $conf['oneImageStdWrap.']); $classes = ''; if ($addClassesImageConf[$colPos]['addClassesImage']) { $classes = ' ' . $addClassesImageConf[$colPos]['addClassesImage']; } $thisImage = str_replace('###CLASSES###', $classes, $thisImage); if ($separateRows) { $thisRow .= $thisImage; } else { $allRows .= $thisImage; } $GLOBALS['TSFE']->register['columnwidth'] = $maxImageSpace + $tmpColspacing; if ($separateRows && ($colPos == ($colCount-1) || $i+1==count($imgsTag))) { // Close this row at the end (colCount), or the last row at the final end $allRows .= $this->cObj->stdWrap($thisRow, $conf['imageRowStdWrap.']); } } if ($separateRows) { $thisImages .= $allRows; } else { $thisImages .= $this->cObj->stdWrap($allRows, $conf['noRowsStdWrap.']); } if ($noRows) { // Only needed to make columns, rather than rows: $images .= $this->cObj->stdWrap($thisImages, $conf['imageColumnStdWrap.']); } else { $images .= $thisImages; } } // Add the global caption, if not split if ($caption) { $images .= $caption; } // CSS-classes $captionClass = ''; $classCaptionAlign = array( 'center' => 'csc-textpic-caption-c', 'right' => 'csc-textpic-caption-r', 'left' => 'csc-textpic-caption-l', ); $captionAlign = $this->cObj->stdWrap($conf['captionAlign'], $conf['captionAlign.']); if ($captionAlign) { $captionClass = $classCaptionAlign[$captionAlign]; } $borderClass = ''; if ($border) { $borderClass = 'csc-textpic-border'; } // Multiple classes with all properties, to be styled in CSS $class = ''; $class .= ($borderClass? ' '.$borderClass:''); $class .= ($captionClass? ' '.$captionClass:''); $class .= ($equalHeight? ' csc-textpic-equalheight':''); $addClasses = $this->cObj->stdWrap($conf['addClasses'], $conf['addClasses.']); $class .= ($addClasses ? ' '.$addClasses:''); // Do we need a width in our wrap around images? $imgWrapWidth = ''; if ($position == 0 || $position == 8) { // For 'center' we always need a width: without one, the margin:auto trick won't work $imgWrapWidth = $imageBlockWidth; } if ($rowCount > 1) { // For multiple rows we also need a width, so that the images will wrap $imgWrapWidth = $imageBlockWidth; } if ($caption) { // If we have a global caption, we need the width so that the caption will wrap $imgWrapWidth = $imageBlockWidth; } // Wrap around the whole image block $GLOBALS['TSFE']->register['totalwidth'] = $imgWrapWidth; if ($imgWrapWidth) { $images = $this->cObj->stdWrap($images, $conf['imageStdWrap.']); } else { $images = $this->cObj->stdWrap($images, $conf['imageStdWrapNoWidth.']); } $output = $this->cObj->cObjGetSingle($conf['layout'], $conf['layout.']); $output = str_replace('###TEXT###', $content, $output); $output = str_replace('###IMAGES###', $images, $output); $output = str_replace('###CLASSES###', $class, $output); if ($conf['stdWrap.']) { $output = $this->cObj->stdWrap($output, $conf['stdWrap.']); } return $output; } /************************************ * * Helper functions * ************************************/ /** * Returns table attributes for uploads / tables. * * @param array TypoScript configuration array * @param integer The "layout" type * @return array Array with attributes inside. */ function getTableAttributes($conf,$type) { // Initializing: $tableTagParams_conf = $conf['tableParams_'.$type.'.']; $conf['color.'][200] = ''; $conf['color.'][240] = 'black'; $conf['color.'][241] = 'white'; $conf['color.'][242] = '#333333'; $conf['color.'][243] = 'gray'; $conf['color.'][244] = 'silver'; // Create table attributes array: $tableTagParams = array(); $tableTagParams['border'] = $this->cObj->data['table_border'] ? intval($this->cObj->data['table_border']) : $tableTagParams_conf['border']; $tableTagParams['cellspacing'] = $this->cObj->data['table_cellspacing'] ? intval($this->cObj->data['table_cellspacing']) : $tableTagParams_conf['cellspacing']; $tableTagParams['cellpadding'] = $this->cObj->data['table_cellpadding'] ? intval($this->cObj->data['table_cellpadding']) : $tableTagParams_conf['cellpadding']; $tableTagParams['bgcolor'] = isset($conf['color.'][$this->cObj->data['table_bgColor']]) ? $conf['color.'][$this->cObj->data['table_bgColor']] : $conf['color.']['default']; // Return result: return $tableTagParams; } /** * Returns an object reference to the hook object if any * * @param string Name of the function you want to call / hook key * @return object Hook object, if any. Otherwise null. */ function &hookRequest($functionName) { global $TYPO3_CONF_VARS; // Hook: menuConfig_preProcessModMenu if ($TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks'][$functionName]) { $hookObj = &t3lib_div::getUserObj($TYPO3_CONF_VARS['EXTCONF']['css_styled_content']['pi1_hooks'][$functionName]); if (method_exists ($hookObj, $functionName)) { $hookObj->pObj = &$this; return $hookObj; } } }}if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']);}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -