⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.tslib_content.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 5 页
字号:
							unset($imgConf['file.']['ext.']);						}					}						// "alt", "title" and "longdesc" attributes:					if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {						$imgConf['altText'] = $conf['altText'];						$imgConf['altText.'] = $conf['altText.'];					}					if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {						$imgConf['titleText'] = $conf['titleText'];						$imgConf['titleText.'] = $conf['titleText.'];					}					if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {						$imgConf['longdescURL'] = $conf['longdescURL'];						$imgConf['longdescURL.'] = $conf['longdescURL.'];					}				} else {					$imgConf = array(						'altText' => $conf['altText'],						'titleText' => $conf['titleText'],						'longdescURL' => $conf['longdescURL'],						'file' => $totalImagePath					);				}				$imgsTag[$imgKey] = $this->IMAGE($imgConf);					// Store the original filepath				$origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo;				$imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];				if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)])	{					$imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1];				}			}				// calculating the tableWidth:				// TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth.			$tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2;				// make table for pictures			$index=$imgStart;			$noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);			$noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);			if ($noRows) {$noCols=0;}	// noRows overrides noCols. They cannot exist at the same time.			if ($equalHeight) {				$noCols=1;				$noRows=0;			}			$rowCount_temp=1;			$colCount_temp=$colCount;			if ($noRows)	{				$rowCount_temp = $rowCount;				$rowCount=1;			}			if ($noCols)	{				$colCount=1;			}				// col- and rowspans calculated			$colspan = (($colspacing) ? $colCount*2-1 : $colCount);			$rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap;				// Edit icons:			$editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';				// strech out table:			$tablecode='';			$flag=0;			if ($conf['noStretchAndMarginCells']!=1)	{				$tablecode.='<tr>';				if ($txtMarg && $align=='right')	{	// If right aligned, the textborder is added on the right side					$tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';					$editIconsHTML='';					$flag=1;				}				$tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';				if ($txtMarg && $align=='left')	{	// If left aligned, the textborder is added on the left side					$tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';					$editIconsHTML='';					$flag=1;				}				if ($flag) $tableWidth+=$txtMarg+1;	//			$tableWidth=0;				$tablecode.='</tr>';			}				// draw table			for ($c=0;$c<$rowCount;$c++) {	// Looping through rows. If 'noRows' is set, this is '1 time', but $rowCount_temp will hold the actual number of rows!				if ($c && $rowspacing)	{		// If this is NOT the first time in the loop AND if space is required, a row-spacer is added. In case of "noRows" rowspacing is done further down.					$tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td></tr>';				}				$tablecode.='<tr>';	// starting row				for ($b=0; $b<$colCount_temp; $b++)	{	// Looping through the columns					if ($b && $colspacing)	{		// If this is NOT the first iteration AND if column space is required. In case of "noCols", the space is done without a separate cell.						if (!$noCols)	{							$tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$colspacing.'" height="1"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td>';						} else {							$colSpacer='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($border?$colspacing-6:$colspacing).'" height="'.($imageRowsMaxHeights[$c]+($border?$borderThickness*2:0)).'"'.$this->getBorderAttr(' border="0"').' align="'.($border?'left':'top').'" alt="" title="" />';							$colSpacer='<td valign="top">'.$colSpacer.'</td>';	// added 160301, needed for the new "noCols"-table...							$tablecode.=$colSpacer;						}					}					if (!$noCols || ($noCols && !$b))	{						$tablecode.='<td valign="top">';	// starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image.						if ($noCols)	{$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';}		// In case of "noCols" we must set the table-tag that surrounds the images in the row.					}					for ($a=0;$a<$rowCount_temp;$a++)	{	// Looping through the rows IF "noRows" is set. "noRows"  means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set.						$GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;	// register previous imgIndex						$imgIndex = $index+$a*$colCount_temp;						$GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex;						if ($imgsTag[$imgIndex])	{							if ($rowspacing && $noRows && $a) {		// Puts distance between the images IF "noRows" is set and this is the first iteration of the loop								$tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';							}							if ($legacyCaptionSplit)	{								$thisCaption = $captionArray[$imgIndex];							} else if ($conf['captionSplit'] || $conf['imageTextSplit'])	{								$thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);							}							$imageHTML = $imgsTag[$imgIndex].'<br />';							$Talign = (!trim($thisCaption) && !$noRows) ? ' align="left"' : '';  // this is necessary if the tablerows are supposed to space properly together! "noRows" is excluded because else the images "layer" together.							if ($border)	{$imageHTML='<table border="0" cellpadding="'.$borderThickness.'" cellspacing="0" bgcolor="'.$borderColor.'"'.$Talign.'><tr><td>'.$imageHTML.'</td></tr></table>';}		// break-tag added 160301  , ($noRows?'':' align="left"')  removed 160301, break tag removed 160301 (later...)							$imageHTML.=$editIconsHTML;							$editIconsHTML='';							$imageHTML.=$thisCaption;	// Adds caption.							if ($noCols)	{$imageHTML='<td valign="top">'.$imageHTML.'</td>';}		// If noCols, put in table cell.							$tablecode.=$imageHTML;						}					}					$index++;					if (!$noCols || ($noCols && $b+1==$colCount_temp))	{						if ($noCols)	{$tablecode.='</tr></table>';}	// In case of "noCols" we must finish the table that surrounds the images in the row.						$tablecode.='</td>';	// Ending the cell. In case of "noCols" the cell holds all pictures!					}				}				$tablecode.='</tr>';	// ending row			}			if ($c)	{				switch ($contentPosition)	{					case '0':	// above					case '8':	// below						switch ($align)        {	// These settings are needed for Firefox							case 'center':								$table_align = 'margin-left: auto; margin-right: auto';							break;							case 'right':								$table_align = 'margin-left: auto; margin-right: 0px';							break;							default:	// Most of all: left								$table_align = 'margin-left: 0px; margin-right: auto';						}						$table_align = 'style="'.$table_align.'"';					break;					case '16':	// in text						$table_align = 'align="'.$align.'"';					break;					default:						$table_align = '';				}					// Table-tag is inserted				$tablecode = '<table'.($tableWidth?' width="'.$tableWidth.'"':'').' border="0" cellspacing="0" cellpadding="0" '.$table_align.' class="imgtext-table">'.$tablecode;				if ($editIconsHTML)	{	// IF this value is not long since reset.					$tablecode.='<tr><td colspan="'.$colspan.'">'.$editIconsHTML.'</td></tr>';					$editIconsHTML='';				}				if ($cap)	{					$tablecode.='<tr><td colspan="'.$colspan.'" align="'.$caption_align.'">'.$caption.'</td></tr>';				}				$tablecode.='</table>';				if ($conf['tableStdWrap.'])	{$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);}			}			$spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));			switch ($contentPosition)	{				case '0':	// above					$output= '<div style="text-align:'.$align.';">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');				break;				case '8':	// below					$output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div style="text-align:'.$align.';">'.$tablecode.'</div>';				break;				case '16':	// in text					$output= $tablecode.$content;				break;				case '24':	// in text, no wrap					$theResult = '';					$theResult.= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';					if ($align=='right')	{						$theResult.= '<td valign="top">'.$content.'</td><td valign="top">'.$tablecode.'</td>';					} else {						$theResult.= '<td valign="top">'.$tablecode.'</td><td valign="top">'.$content.'</td>';					}					$theResult.= '</tr></table>';					$output= $theResult;				break;			}		} else {			$output= $content;		}		if ($conf['stdWrap.']) {			$output = $this->stdWrap($output, $conf['stdWrap.']);		}		return $output;	}	/**	 * Rendering the cObject, CONTENT	 *	 * @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]=356&cHash=9f3b5c6ba2	 */	function CONTENT($conf)	{		$theValue='';		$originalRec = $GLOBALS['TSFE']->currentRecord;		if ($originalRec)	{		// If the currentRecord is set, we register, that this record has invoked this function. It's should not be allowed to do this again then!!			$GLOBALS['TSFE']->recordRegister[$originalRec]++;		}		if ($conf['table']=='pages' || substr($conf['table'],0,3)=='tt_' || substr($conf['table'],0,3)=='fe_' || substr($conf['table'],0,3)=='tx_' || substr($conf['table'],0,4)=='ttx_' || substr($conf['table'],0,5)=='user_')	{			$renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<'.$conf['table'];			$renderObjKey = $conf['renderObj'] ? 'renderObj' : '';			$renderObjConf = $conf['renderObj.'];			$slide = intval($conf['slide'])?intval($conf['slide']):0;			$slideCollect = intval($conf['slide.']['collect'])?intval($conf['slide.']['collect']):0;			$slideCollectReverse = intval($conf['slide.']['collectReverse'])?true:false;			$slideCollectFuzzy = $slideCollect?(intval($conf['slide.']['collectFuzzy'])?true:false):true;			$again = false;			do {				$res = $this->exec_getQuery($conf['table'],$conf['select.']);				if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {					$GLOBALS['TT']->setTSlogMessage($error,3);				} else {					$this->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);					$GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res));					$cObj =t3lib_div::makeInstance('tslib_cObj');					$cObj->setParent($this->data,$this->currentRecord);					$this->currentRecordNumber=0;					$cobjValue = '';					while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {							// Versioning preview:						$GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row);							// Language Overlay:						if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {							$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);						}						if (is_array($row)) { // Might be unset in the sys_language_contentOL							if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']]) {								$this->currentRecordNumber++;								$cObj->parentRecordNumber = $this->currentRecordNumber;								$GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];								$this->lastChanged($row['tstamp']);								$cObj->start($row,$conf['table']);								$tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);								$cobjValue .= $tmpValue;							}# else debug($GLOBALS['TSFE']->recordRegister,'CONTENT');						}					}				}				if ($slideCollectReverse) {					$theValue = $cobjValue.$theValue;				} else {					$theValue .= $cobjValue;				}				if ($slideCollect>0) {					$slideCollect--;				}				if ($slide) {					if ($slide>0) {						$slide--;					}					$conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);					$again = strlen($conf['select.']['pidInList'])?true:false;				}			} while ($again&&(($slide&&!strlen($tmpValue)&&$slideCollectFuzzy)||($slide&&$slideCollect)));		}		$theValue = $this->wrap($theValue,$conf['wrap']);		if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);		$GLOBALS['TSFE']->currentRecord = $originalRec;	// Restore		return $theValue;	}	/**	 * Rendering the cObject, RECORDS	 *	 * @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]=357&cHash=303e959472	 */	function RECORDS($conf)	{		$theValue='';		$originalRec = $GLOBALS['TSFE']->currentRecord;		if ($originalRec)	{		// If the currentRecord is set, we register, that this record has invoked this function. It's should not be allowed to do this again then!!			$GLOBALS['TSFE']->recordRegister[$originalRec]++;		}		$conf['source'] = $this->stdWrap($conf['source'],$conf['source.']);		if ($conf['tables'] && $conf['source']) {			$allowedTables = $conf['tables'];			if (is_array($conf['conf.']))	{				reset($conf['conf.']);				while(list($k)=each($conf['conf.']))	{					if (substr($k,-1)!='.')		$allowedTables.=','.$k;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -