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

📄 class.tslib_pagegen.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 3 页
字号:
	/**	 * Rendering the page content	 *	 * @return	void	 */	function renderContent()	{		// PAGE CONTENT		$GLOBALS['TT']->incStackPointer();		$GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');			$pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);			if ($GLOBALS['TSFE']->pSetup['wrap'])	{$pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);}			if ($GLOBALS['TSFE']->pSetup['stdWrap.'])	{$pageContent = $GLOBALS['TSFE']->cObj->stdWrap($pageContent, $GLOBALS['TSFE']->pSetup['stdWrap.']);}			// PAGE HEADER (after content - maybe JS is inserted!			// if 'disableAllHeaderCode' is set, all the header-code is discarded!		if ($GLOBALS['TSFE']->config['config']['disableAllHeaderCode'])	{			$GLOBALS['TSFE']->content = $pageContent;		} else {			TSpagegen::renderContentWithHeader($pageContent);		}		$GLOBALS['TT']->pull($GLOBALS['TT']->LR?$GLOBALS['TSFE']->content:'');		$GLOBALS['TT']->decStackPointer();	}	/**	 * Rendering normal HTML-page with header by wrapping the generated content ($pageContent) in body-tags and setting the header accordingly.	 *	 * @param	string		The page content which TypoScript objects has generated	 * @return	void	 */	function renderContentWithHeader($pageContent)	{		$customContent = $GLOBALS['TSFE']->config['config']['headerComment'];		if (trim($customContent))	{			$customContent = chr(10).$customContent;		} else $customContent='';			// Setting charset:		$theCharset = $GLOBALS['TSFE']->metaCharset;			// Reset the content variables:		$GLOBALS['TSFE']->content='';		$htmlTagAttributes = array();		$htmlLang = $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] ? $GLOBALS['TSFE']->config['config']['htmlTag_langKey'] : 'en';			// Set content direction: (More info: http://www.tau.ac.il/~danon/Hebrew/HTML_and_Hebrew.html)		if ($GLOBALS['TSFE']->config['config']['htmlTag_dir'])	{			$htmlTagAttributes['dir'] = htmlspecialchars($GLOBALS['TSFE']->config['config']['htmlTag_dir']);		}			// Setting document type:		$docTypeParts = array();			// Part 1: XML prologue		switch((string)$GLOBALS['TSFE']->config['config']['xmlprologue'])	{			case 'none':			break;			case 'xml_10':				$docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';			break;			case 'xml_11':				$docTypeParts[]='<?xml version="1.1" encoding="'.$theCharset.'"?>';			break;			case '':				if ($GLOBALS['TSFE']->xhtmlVersion)	$docTypeParts[]='<?xml version="1.0" encoding="'.$theCharset.'"?>';			break;			default:				$docTypeParts[]=$GLOBALS['TSFE']->config['config']['xmlprologue'];		}			// Part 2: DTD		if ($GLOBALS['TSFE']->config['config']['doctype'])	{			switch((string)$GLOBALS['TSFE']->config['config']['doctype'])	{				case 'xhtml_trans':					$docTypeParts[]='<!DOCTYPE html     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';				break;				case 'xhtml_strict':					$docTypeParts[]='<!DOCTYPE html     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';				break;				case 'xhtml_frames':					$docTypeParts[]='<!DOCTYPE html     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';				break;				case 'xhtml_basic':					$docTypeParts[]='<!DOCTYPE html    PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"    "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';				break;				case 'xhtml_11':					$docTypeParts[]='<!DOCTYPE html     PUBLIC "-//W3C//DTD XHTML 1.1//EN"     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';				break;				case 'xhtml_2':					$docTypeParts[]='<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 2.0//EN"	"http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd">';				break;				case 'none':				break;				default:					$docTypeParts[] = $GLOBALS['TSFE']->config['config']['doctype'];			}		} else {			$docTypeParts[]='<!DOCTYPE html	PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';		}		if ($GLOBALS['TSFE']->xhtmlVersion)	{				// Setting <html> tag attributes:	 		$htmlTagAttributes['xmlns'] = 'http://www.w3.org/1999/xhtml';			$htmlTagAttributes['xml:lang'] = $htmlLang;			if ($GLOBALS['TSFE']->xhtmlVersion < 110)	{					$htmlTagAttributes['lang'] = $htmlLang;			}		}			// Swap XML and doctype order around (for MSIE / Opera standards compliance)		if ($GLOBALS['TSFE']->config['config']['doctypeSwitch'])	{			$docTypeParts = array_reverse($docTypeParts);		}			// Adding doctype parts:		$GLOBALS['TSFE']->content.= count($docTypeParts) ? implode(chr(10),$docTypeParts).chr(10) : '';			// Begin header section:		if (strcmp($GLOBALS['TSFE']->config['config']['htmlTag_setParams'],'none'))	{			$_attr = $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] ? $GLOBALS['TSFE']->config['config']['htmlTag_setParams'] : t3lib_div::implodeAttributes($htmlTagAttributes);		} else {			$_attr = '';		}		$GLOBALS['TSFE']->content.='<html'.($_attr ? ' '.$_attr : '').'>';			// Head tag:		$headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';		$GLOBALS['TSFE']->content.= chr(10).$headTag;			// Setting charset meta tag:		$GLOBALS['TSFE']->content.='	<meta http-equiv="Content-Type" content="text/html; charset='.$theCharset.'" />';$GLOBALS['TSFE']->content.='<!-- '.($customContent?$customContent.chr(10):'').'	This website is powered by TYPO3 - inspiring people to share!	TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.	TYPO3 is copyright 1998-2006 of Kasper Skaarhoj. Extensions are copyright of their respective owners.	Information and contribution at http://typo3.com/ and http://typo3.org/-->';		if ($GLOBALS['TSFE']->baseUrl) {			$GLOBALS['TSFE']->content.='	<base href="'.htmlspecialchars($GLOBALS['TSFE']->baseUrl).'" />';		}		if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {			$ss=$path.$GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['shortcutIcon']);			$GLOBALS['TSFE']->content.='	<link rel="SHORTCUT ICON" href="'.htmlspecialchars($ss).'" />';		}			// Including CSS files		if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.']))	{			$temp_styleLines=array();			foreach ($GLOBALS['TSFE']->tmpl->setup['plugin.'] as $key=>$iCSScode)	{				if (is_array($iCSScode) && $iCSScode['_CSS_DEFAULT_STYLE'])	{					$temp_styleLines[]='/* default styles for extension "'.substr($key,0,-1).'" */'.chr(10).$iCSScode['_CSS_DEFAULT_STYLE'];				}			}			if (count($temp_styleLines))	{				if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile'])	{					$GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile(implode(chr(10),$temp_styleLines),'css');				} else {					$GLOBALS['TSFE']->content.='	<style type="text/css">		/*<![CDATA[*/	<!--	'.implode(chr(10),$temp_styleLines).'	-->		/*]]>*/	</style>';				}			}		}		if ($GLOBALS['TSFE']->pSetup['stylesheet'])	{			$ss=$GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);			if ($ss)	{				$GLOBALS['TSFE']->content.='	<link rel="stylesheet" type="text/css" href="'.htmlspecialchars($ss).'" />';			}		}		if (is_array($GLOBALS['TSFE']->pSetup['includeCSS.']))	{			foreach ($GLOBALS['TSFE']->pSetup['includeCSS.'] as $key=>$iCSSfile)	{				if (!is_array($iCSSfile))	{					$ss=$GLOBALS['TSFE']->tmpl->getFileName($iCSSfile);					if ($ss)	{						if ($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['import'])	{							if (substr($ss,0,1)!='/')	{	// To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)								$ss = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/'.$ss;							}							$GLOBALS['TSFE']->content.='	<style type="text/css">	<!--	@import url("'.htmlspecialchars($ss).'") '.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media']).';	-->	</style>							';						} else {							$GLOBALS['TSFE']->content.='	<link rel="'.($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['alternate'] ? 'alternate stylesheet' : 'stylesheet').'" type="text/css" href="'.htmlspecialchars($ss).'"'.			($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['title'] ? ' title="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['title']).'"' : '').			($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media'] ? ' media="'.htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key.'.']['media']).'"' : '').			' />';						}					}				}			}		}			// Stylesheets		$style='';		$style.=trim($GLOBALS['TSFE']->pSetup['CSS_inlineStyle']).chr(10);		if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE'])	{			$pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();			$RTEclasses = $pageTSConfig['RTE.']['classes.'];			if (is_array($RTEclasses))	{				foreach ($RTEclasses as $RTEclassName=>$RTEvalueArray)	{					if ($RTEvalueArray['value'])	{						$style.='.'.substr($RTEclassName,0,-1).' {'.$RTEvalueArray['value'].'}';					}				}			}			if ($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs'] && is_array($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.']))	{				$mSOa_tList = t3lib_div::trimExplode(',',strtoupper($GLOBALS['TSFE']->pSetup['insertClassesFromRTE.']['add_mainStyleOverrideDefs']),1);				foreach ($pageTSConfig['RTE.']['default.']['mainStyleOverride_add.'] as $mSOa_key=>$mSOa_value)	{					if (!is_array($mSOa_value) && (in_array('*',$mSOa_tList)||in_array($mSOa_key,$mSOa_tList)))	{						$style.=''.$mSOa_key.' {'.$mSOa_value.'}';					}				}			}		}			// Setting body tag margins in CSS:		if (isset($GLOBALS['TSFE']->pSetup['bodyTagMargins']) && $GLOBALS['TSFE']->pSetup['bodyTagMargins.']['useCSS'])	{			$margins = intval($GLOBALS['TSFE']->pSetup['bodyTagMargins']);			$style.='	BODY {margin: '.$margins.'px '.$margins.'px '.$margins.'px '.$margins.'px;}';		}		if ($GLOBALS['TSFE']->pSetup['noLinkUnderline'])	{			$style.='	A:link {text-decoration: none}	A:visited {text-decoration: none}	A:active {text-decoration: none}';		}		if (trim($GLOBALS['TSFE']->pSetup['hover']))	{			$style.='	A:hover {color: '.trim($GLOBALS['TSFE']->pSetup['hover']).';}';		}		if (trim($GLOBALS['TSFE']->pSetup['hoverStyle']))	{			$style.='	A:hover {'.trim($GLOBALS['TSFE']->pSetup['hoverStyle']).'}';		}		if ($GLOBALS['TSFE']->pSetup['smallFormFields'])	{			$style.='	SELECT {  font-family: Verdana, Arial, Helvetica; font-size: 10px }	TEXTAREA  {  font-family: Verdana, Arial, Helvetica; font-size: 10px}	INPUT   {  font-family: Verdana, Arial, Helvetica; font-size: 10px }';		}		if ($GLOBALS['TSFE']->pSetup['adminPanelStyles'])	{			$style.='	/* Default styles for the Admin Panel */	TABLE.typo3-adminPanel { border: 1px solid black; background-color: #F6F2E6; }	TABLE.typo3-adminPanel TR.typo3-adminPanel-hRow TD { background-color: #9BA1A8; }	TABLE.typo3-adminPanel TR.typo3-adminPanel-itemHRow TD { background-color: #ABBBB4; }	TABLE.typo3-adminPanel TABLE, TABLE.typo3-adminPanel TD { border: 0px; }	TABLE.typo3-adminPanel TD FONT { font-family: verdana; font-size: 10px; color: black; }	TABLE.typo3-adminPanel TD A FONT { font-family: verdana; font-size: 10px; color: black; }	TABLE.typo3-editPanel { border: 1px solid black; background-color: #F6F2E6; }	TABLE.typo3-editPanel TD { border: 0px; }			';		}		if (trim($style))	{			if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile'])	{				$GLOBALS['TSFE']->content.=TSpagegen::inline2TempFile($style, 'css');			} else {				$GLOBALS['TSFE']->content.='	<style type="text/css">		/*<![CDATA[*/	<!--'.$style.'	-->		/*]]>*/	</style>';			}		}			// JavaScript files		if (is_array($GLOBALS['TSFE']->pSetup['includeJS.']))	{			foreach ($GLOBALS['TSFE']->pSetup['includeJS.'] as $key=>$JSfile)	{				if (!is_array($JSfile))	{					$ss = $GLOBALS['TSFE']->tmpl->getFileName($JSfile);					if ($ss)	{						$type = $GLOBALS['TSFE']->pSetup['includeJS.'][$key.'.']['type'];						if (!$type)	$type = 'text/javascript';						$GLOBALS['TSFE']->content.='	<script src="'.htmlspecialchars($ss).'" type="'.htmlspecialchars($type).'"></script>';					}				}			}		}

⌨️ 快捷键说明

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