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

📄 class.tslib_pagegen.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php/****************************************************************  Copyright notice**  (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)*  All rights reserved**  This script is part of the TYPO3 project. The TYPO3 project is*  free software; you can redistribute it and/or modify*  it under the terms of the GNU General Public License as published by*  the Free Software Foundation; either version 2 of the License, or*  (at your option) any later version.**  The GNU General Public License can be found at*  http://www.gnu.org/copyleft/gpl.html.*  A copy is found in the textfile GPL.txt and important notices to the license*  from the author is found in LICENSE.txt distributed with these scripts.***  This script is distributed in the hope that it will be useful,*  but WITHOUT ANY WARRANTY; without even the implied warranty of*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*  GNU General Public License for more details.**  This copyright notice MUST APPEAR in all copies of the script!***************************************************************//** * Libraries for pagegen.php * The script "pagegen.php" is included by "index_ts.php" when a page is not cached but needs to be rendered. * * $Id: class.tslib_pagegen.php 2065 2007-02-20 22:09:19Z ohader $ * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj * XHTML compliant * * @author	Kasper Skaarhoj <kasperYYYY@typo3.com> *//** * [CLASS/FUNCTION INDEX of SCRIPT] * * * *   88: class TSpagegen *   95:     function pagegenInit() *  271:     function getIncFiles() *  304:     function JSeventFunctions() *  338:     function renderContent() *  365:     function renderContentWithHeader($pageContent) * *              SECTION: Helper functions *  827:     function inline2TempFile($str,$ext) * * *  881: class FE_loadDBGroup extends t3lib_loadDBGroup * * TOTAL FUNCTIONS: 6 * (This index is automatically created/updated by the extension "extdeveval") * *//** * Class for starting TypoScript page generation * * The class is not instantiated as an objects but called directly with the "::" operator. * eg: TSpagegen::pagegenInit() * * @author	Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage tslib */class TSpagegen {	/**	 * Setting some vars in TSFE, primarily based on TypoScript config settings.	 *	 * @return	void	 */	function pagegenInit()	{		if ($GLOBALS['TSFE']->page['content_from_pid']>0)	{			$temp_copy_TSFE = clone($GLOBALS['TSFE']);	// make REAL copy of TSFE object - not reference!			$temp_copy_TSFE->id = $GLOBALS['TSFE']->page['content_from_pid'];	// Set ->id to the content_from_pid value - we are going to evaluate this pid as was it a given id for a page-display!			$temp_copy_TSFE->getPageAndRootlineWithDomain($GLOBALS['TSFE']->config['config']['content_from_pid_allowOutsideDomain']?0:$GLOBALS['TSFE']->domainStartPage);			$GLOBALS['TSFE']->contentPid = intval($temp_copy_TSFE->id);			unset($temp_copy_TSFE);		}		if ($GLOBALS['TSFE']->config['config']['MP_defaults'])	{			$temp_parts = t3lib_div::trimExplode('|',$GLOBALS['TSFE']->config['config']['MP_defaults'],1);			reset($temp_parts);			while(list(,$temp_p)=each($temp_parts))	{				list($temp_idP,$temp_MPp) = explode(':',$temp_p,2);				$temp_ids=t3lib_div::intExplode(',',$temp_idP);				reset($temp_ids);				while(list(,$temp_id)=each($temp_ids))	{					$GLOBALS['TSFE']->MP_defaults[$temp_id]=$temp_MPp;				}			}		}		if ($GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'])	{			$temp_parts = t3lib_div::trimExplode(',',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'],1);			foreach ($temp_parts as $temp_p)	{				$GLOBALS['TSFE']->pEncAllowedParamNames[$temp_p]=1;			}		}			// Global vars...		$GLOBALS['TSFE']->indexedDocTitle = $GLOBALS['TSFE']->page['title'];		$GLOBALS['TSFE']->debug = ''.$GLOBALS['TSFE']->config['config']['debug'];			// Base url:		if ($GLOBALS['TSFE']->config['config']['baseURL'])	{			if ($GLOBALS['TSFE']->config['config']['baseURL']==='1')	{					// Deprecated property, going to be dropped.				$error = 'Unsupported TypoScript property was found in this template: "config.baseURL="1"This setting has been deprecated in TYPO 3.8.1 due to security concerns.You need to change this value to the URL of your website root, otherwise TYPO3 will not work!See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.typo3.org/index.php/TYPO3_3.8.1</a> for more information.';				$GLOBALS['TSFE']->printError(nl2br($error));				exit;			} else {				$GLOBALS['TSFE']->baseUrl = $GLOBALS['TSFE']->config['config']['baseURL'];			}			$GLOBALS['TSFE']->anchorPrefix = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));		}			// Internal and External target defaults		$GLOBALS['TSFE']->intTarget = ''.$GLOBALS['TSFE']->config['config']['intTarget'];		$GLOBALS['TSFE']->extTarget = ''.$GLOBALS['TSFE']->config['config']['extTarget'];		if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'] === 'ascii') {			$GLOBALS['TSFE']->spamProtectEmailAddresses = 'ascii';		} else {			$GLOBALS['TSFE']->spamProtectEmailAddresses = t3lib_div::intInRange($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses'],-10,10,0);		}		$GLOBALS['TSFE']->absRefPrefix = trim(''.$GLOBALS['TSFE']->config['config']['absRefPrefix']);		if ((!strcmp($GLOBALS['TSFE']->config['config']['simulateStaticDocuments'],'PATH_INFO') || $GLOBALS['TSFE']->absRefPrefix_force)				&& !$GLOBALS['TSFE']->absRefPrefix)	{			$GLOBALS['TSFE']->absRefPrefix=t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';		}		// Force absRefPrefix to this value is PATH_INFO is used.		if ($GLOBALS['TSFE']->type && $GLOBALS['TSFE']->config['config']['frameReloadIfNotInFrameset'])	{			$tdlLD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'_top',$GLOBALS['TSFE']->no_cache,'');			$GLOBALS['TSFE']->JSCode = 'if(!parent.'.trim($GLOBALS['TSFE']->sPre).' && !parent.view_frame) top.location.href="'.$GLOBALS['TSFE']->baseUrlWrap($tdlLD['totalURL']).'"';		}		$GLOBALS['TSFE']->compensateFieldWidth = ''.$GLOBALS['TSFE']->config['config']['compensateFieldWidth'];		$GLOBALS['TSFE']->lockFilePath = ''.$GLOBALS['TSFE']->config['config']['lockFilePath'];		$GLOBALS['TSFE']->lockFilePath = $GLOBALS['TSFE']->lockFilePath ? $GLOBALS['TSFE']->lockFilePath : 'fileadmin/';		$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'] = isset($GLOBALS['TSFE']->config['config']['noScaleUp']) ? ''.$GLOBALS['TSFE']->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];		$GLOBALS['TSFE']->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];		$GLOBALS['TSFE']->ATagParams = trim($GLOBALS['TSFE']->config['config']['ATagParams']) ? ' '.trim($GLOBALS['TSFE']->config['config']['ATagParams']) : '';		if ($GLOBALS['TSFE']->config['config']['setJS_mouseOver'])	$GLOBALS['TSFE']->setJS('mouseOver');		if ($GLOBALS['TSFE']->config['config']['setJS_openPic'])	$GLOBALS['TSFE']->setJS('openPic');		$GLOBALS['TSFE']->sWordRegEx='';		$GLOBALS['TSFE']->sWordList = t3lib_div::_GP('sword_list');		if (is_array($GLOBALS['TSFE']->sWordList))	{			$standAlone = trim(''.$GLOBALS['TSFE']->config['config']['sword_standAlone']);			$noMixedCase = trim(''.$GLOBALS['TSFE']->config['config']['sword_noMixedCase']);			$space = ($standAlone) ? '[[:space:]]' : '';			reset($GLOBALS['TSFE']->sWordList);			while (list($key,$val) = each($GLOBALS['TSFE']->sWordList))	{				if (trim($val)) {					if (!$noMixedCase) {						$GLOBALS['TSFE']->sWordRegEx.= $space.sql_regcase(quotemeta($val)).$space.'|';					} else {						$GLOBALS['TSFE']->sWordRegEx.= $space.quotemeta($val).$space.'|';					}				}			}			$GLOBALS['TSFE']->sWordRegEx = ereg_replace('\|$','',$GLOBALS['TSFE']->sWordRegEx);		}			// linkVars		$linkVars = (string)$GLOBALS['TSFE']->config['config']['linkVars'];		if ($linkVars)	{			$linkVarArr = explode(',',$linkVars);			$GLOBALS['TSFE']->linkVars='';			$GET = t3lib_div::_GET();			foreach ($linkVarArr as $val)	{				$val = trim($val);				if (preg_match('/^(.*)\((.+)\)$/',$val,$match))	{					$val = trim($match[1]);					$test = trim($match[2]);				} else unset($test);				if ($val && isset($GET[$val]))	{					if (!is_array($GET[$val]))	{						$tmpVal = rawurlencode($GET[$val]);						if ($test && !TSpagegen::isAllowedLinkVarValue($tmpVal,$test))	{							continue;	// Error: This value was not allowed for this key						}						$value = '&'.$val.'='.$tmpVal;					} else {						if ($test && strcmp('array',$test))	{							continue;	// Error: This key must not be an array!						}						$value = t3lib_div::implodeArrayForUrl($val,$GET[$val]);					}				} else continue;				$GLOBALS['TSFE']->linkVars.= $value;			}			unset($GET);		} else {			$GLOBALS['TSFE']->linkVars='';		}			// Setting XHTML-doctype from doctype		if (!$GLOBALS['TSFE']->config['config']['xhtmlDoctype'])	{			$GLOBALS['TSFE']->config['config']['xhtmlDoctype'] = $GLOBALS['TSFE']->config['config']['doctype'];		}		if ($GLOBALS['TSFE']->config['config']['xhtmlDoctype'])	{			$GLOBALS['TSFE']->xhtmlDoctype = $GLOBALS['TSFE']->config['config']['xhtmlDoctype'];				// Checking XHTML-docytpe			switch((string)$GLOBALS['TSFE']->config['config']['xhtmlDoctype'])	{				case 'xhtml_trans':				case 'xhtml_strict':				case 'xhtml_frames':					$GLOBALS['TSFE']->xhtmlVersion = 100;				break;				case 'xhtml_basic':					$GLOBALS['TSFE']->xhtmlVersion = 105;				break;				case 'xhtml_11':					$GLOBALS['TSFE']->xhtmlVersion = 110;				break;				case 'xhtml_2':					$GLOBALS['TSFE']->xhtmlVersion = 200;				break;				default:					$GLOBALS['TSFE']->xhtmlDoctype = '';					$GLOBALS['TSFE']->xhtmlVersion = 0;			}		}	}	/**	 * Returns an array with files to include. These files are the ones set up in TypoScript config.	 *	 * @return	array		Files to include. Paths are relative to PATH_site.	 */	function getIncFiles()	{		$incFilesArray = array();			// Get files from config.includeLibrary		$includeLibrary = trim(''.$GLOBALS['TSFE']->config['config']['includeLibrary']);		if ($includeLibrary)	{			$incFile=$GLOBALS['TSFE']->tmpl->getFileName($includeLibrary);			if ($incFile)	{				$incFilesArray[] = $incFile;			}		}		if (is_array($GLOBALS['TSFE']->pSetup['includeLibs.']))	{$incLibs=$GLOBALS['TSFE']->pSetup['includeLibs.'];} else {$incLibs=array();}		if (is_array($GLOBALS['TSFE']->tmpl->setup['includeLibs.']))	{$incLibs+=$GLOBALS['TSFE']->tmpl->setup['includeLibs.'];}	// toplevel 'includeLibs' is added to the PAGE.includeLibs. In that way, PAGE-libs get first priority, because if the key already exist, it's not altered. (Due to investigation by me)		if (count($incLibs))	{			reset($incLibs);			while(list(,$theLib)=each($incLibs))	{				if (!is_array($theLib) && $incFile=$GLOBALS['TSFE']->tmpl->getFileName($theLib))	{					$incFilesArray[] = $incFile;				}			}		}			// Include HTML mail library?		if ($GLOBALS['TSFE']->config['config']['incT3Lib_htmlmail'])	{			$incFilesArray[] = 't3lib/class.t3lib_htmlmail.php';		}		return $incFilesArray;	}	/**	 * Processing JavaScript handlers	 *	 * @return	array		Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag.	 */	function JSeventFunctions()	{		$functions = array();		$setEvents = array();		$setBody = array();		foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers)	{			if (count($handlers))	{				$functions[] = '	function T3_'.$event.'Wrapper(e)	{	'.implode('   ',$handlers).'	}';				$setEvents[] = '	document.'.$event.'=T3_'.$event.'Wrapper;';				if ($event == 'onload')	{					$setBody[]='onload="T3_onloadWrapper();"';	// dubiuos double setting breaks on some browser - do we need it?				}			}		}		return Array(count($functions)?'<script type="text/javascript">	/*<![CDATA[*/'.implode(chr(10),$functions).''.implode(chr(10),$setEvents).'	/*]]>*/</script>			':'',$setBody);	}

⌨️ 快捷键说明

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