📄 class.tslib_content.php
字号:
* @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=351&cHash=a09db0329c */ function COBJ_ARRAY($conf,$ext='') { $content=''; switch($ext) { case 'INT': $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash(); $content.='<!--'.$substKey.'-->'; $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array( 'file'=>$incFile, 'conf'=>$conf, 'cObj'=>serialize($this), 'type'=>'COA' ); break; default: if ($this->checkIf($conf['if.'])) { $content=$this->cObjGet($conf); if ($conf['wrap']) { $content=$this->wrap($content, $conf['wrap']); } if ($conf['stdWrap.']) { $content=$this->stdWrap($content, $conf['stdWrap.']); } } break; } return $content; } /** * Rendering the cObject, USER and USER_INT * * @param array Array of TypoScript properties * @param string If "INT" then the cObject is a "USER_INT" (non-cached), otherwise just "USER" (cached) * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=369&cHash=b623aca0a9 */ function USER($conf,$ext='') { $content=''; switch($ext) { case 'INT': $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash(); $content.='<!--'.$substKey.'-->'; $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array( 'file' => $incFile, 'conf' => $conf, 'cObj' => serialize($this), 'type' => 'FUNC' ); break; default: $content.=$this->callUserFunction($conf['userFunc'],$conf,''); break; } return $content; } /** * Rendering the cObject, FILE * * @param array Array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=352&cHash=379c60f8bc */ function FILE($conf) { $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']), trim($this->getAltParam($conf, false))); if ($conf['linkWrap']) { $theValue = $this->linkWrap($theValue,$conf['linkWrap']); } return $this->wrap($theValue,$conf['wrap']); } /** * Rendering the cObject, IMAGE * * @param array Array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=353&cHash=440681ea56 * @see cImage() */ function IMAGE($conf) { $content=''; if ($this->checkIf($conf['if.'])) { $theValue = $this->cImage($conf['file'],$conf); if ($conf['stdWrap.']) { $theValue = $this->stdWrap($theValue,$conf['stdWrap.']); } return $theValue; } } /** * Rendering the cObject, IMG_RESOURCE * * @param array Array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=354&cHash=46f9299706 * @see getImgResource() */ function IMG_RESOURCE($conf) { $GLOBALS['TSFE']->lastImgResourceInfo = $this->getImgResource($conf['file'],$conf['file.']); return $this->stdWrap($GLOBALS['TSFE']->lastImgResourceInfo[3],$conf['stdWrap.']); } /** * Rendering the cObject, IMGTEXT * * @param array Array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=363&cHash=cf2969bce1 */ function IMGTEXT($conf) { $content=''; if (is_array($conf['text.'])) { $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']); // this gets the surrounding content } $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.'])); // gets images if ($imgList) { $imgs = t3lib_div::trimExplode(',',$imgList); $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.'])); $imgCount= count($imgs)-$imgStart; $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.'])); if ($imgMax) { $imgCount = t3lib_div::intInRange($imgCount,0,$imgMax); // reduces the number of images. } $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']); // initialisation $caption=''; $captionArray = array(); if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) { $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']); // global caption, no splitting } if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) { $legacyCaptionSplit = 1; $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']); if (!$capSplit) {$capSplit=chr(10);} $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject')); while (list($ca_key, $ca_val) = each($captionArray)) { $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']); } } $tablecode=''; $position=$this->stdWrap($conf['textPos'],$conf['textPos.']); $tmppos = $position&7; $contentPosition = $position&24; $align = $this->align[$tmppos]; $cap = ($caption)?1:0; $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.'])); if (!$conf['textMargin_outOfText'] && $contentPosition<16) { $txtMarg=0; } $cols = intval($this->stdWrap($conf['cols'],$conf['cols.'])); $rows = intval($this->stdWrap($conf['rows'],$conf['rows.'])); $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.'])); $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.'])); $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0; $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']); $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.'])); $borderColor=$borderColor?$borderColor:'black'; $borderThickness=$borderThickness?$borderThickness:1; $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']); if (!$caption_align) { $caption_align = $align; } // generate cols $colCount = ($cols > 1) ? $cols : 1; if ($colCount > $imgCount) {$colCount = $imgCount;} $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount; // generate rows if ($rows>1) { $rowCount = $rows; if ($rowCount > $imgCount) {$rowCount = $imgCount;} $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount; } // max Width $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.'])); $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.'])); $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.'])); if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 50 % of the max... $maxWInText = round($maxW/2); } if ($maxWInText && $contentPosition>=16) { // inText $maxW = $maxWInText; } if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column/* debug($border*$borderThickness*2); debug($maxW); debug($colspacing); debug(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)); */ $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount); } // create the relation between rows $colMaxW = Array(); if ($colRelations) { $rel_parts = explode(':',$colRelations); $rel_total = 0; for ($a=0;$a<$colCount;$a++) { $rel_parts[$a] = intval($rel_parts[$a]); $rel_total+= $rel_parts[$a]; } if ($rel_total) { for ($a=0;$a<$colCount;$a++) { $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]); } if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) { // The difference in size between the largest and smalles must be within a factor of ten. $colMaxW = Array(); } } } $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.'])); $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.'])); $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.'])); // fetches pictures $splitArr=array(); $splitArr['imgObjNum']=$conf['imgObjNum']; $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount); // EqualHeight $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.'])); if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder'); $gifCreator->init(); $relations = Array(); $relations_cols = Array(); $totalMaxW = $maxW*$colCount; for($a=0;$a<$imgCount;$a++) { $imgKey = $a+$imgStart; $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]); $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height if ($relations[$a]) { // if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error. $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a]; // counts the total width of the row with the new height taken into consideration. } } } $imageRowsFinalWidths = Array(); // contains the width of every image row $imageRowsMaxHeights = Array(); $imgsTag=array(); $origImages=array(); for($a=0;$a<$imgCount;$a++) { $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a; $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a; $imgKey = $a+$imgStart; $totalImagePath = $imgPath.$imgs[$imgKey]; $this->data[$this->currentValKey] = $totalImagePath; $imgObjNum = intval($splitArr[$a]['imgObjNum']); $imgConf = $conf[$imgObjNum.'.']; if ($equalHeight) { $scale = 1; if ($totalMaxW) { $rowTotalMaxW = $relations_cols[floor($a/$colCount)]; if ($rowTotalMaxW > $totalMaxW) { $scale = $rowTotalMaxW / $totalMaxW; } } // transfer info to the imageObject. Please note, that $imgConf['file.']['height'] = round($equalHeight/$scale); unset($imgConf['file.']['width']); unset($imgConf['file.']['maxW']); unset($imgConf['file.']['maxH']); unset($imgConf['file.']['minW']); unset($imgConf['file.']['minH']); unset($imgConf['file.']['width.']); unset($imgConf['file.']['maxW.']); unset($imgConf['file.']['maxH.']); unset($imgConf['file.']['minW.']); unset($imgConf['file.']['minH.']); $maxW = 0; // setting this to zero, so that it doesn't disturb } if ($maxW) { if (count($colMaxW)) { $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)]; } else { $imgConf['file.']['maxW'] = $maxW; } } // Image Object supplied: if (is_array($imgConf)) { if ($this->image_effects[$image_effects]) { $imgConf['file.']['params'].= ' '.$this->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->image_compression[$image_compression])) { $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params']; $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext'];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -