TypoScriptFrontendController implements LoggerAwareInterface uses LoggerAwareTrait, PublicPropertyDeprecationTrait
Main controller class of the TypoScript based frontend.
This is prepared in Frontend middlewares and the content rendering is ultimately called in \TYPO3\CMS\Frontend\Http\RequestHandler.
When calling a Frontend page, an instance of this object is available as $GLOBALS['TSFE'], even though the core development strives to get rid of this in the future.
Table of Contents
Interfaces
- LoggerAwareInterface
Properties
- $absRefPrefix : string
- Absolute Reference prefix
- $additionalFooterData : array<string|int, mixed>
- Used to accumulate additional HTML-code for the footer-section of the template
- $additionalHeaderData : array<string|int, mixed>
- Eg. insert JS-functions in this array ($additionalHeaderData) to include them once. Use associative keys.
- $applicationData : array<string|int, mixed>
- 'Global' Storage for various applications. Keys should be 'tx_'.extKey for extensions.
- $cObj : ContentObjectRenderer
- Page content render object
- $config : array<string, mixed>
- A central data array consisting of various keys, initialized and processed at various places in the class.
- $content : string
- All page content is accumulated in this variable. See RequestHandler
- $contentPid : int
- This will normally point to the same value as id, but can be changed to point to another page from which content will then be displayed instead.
- $currentRecord : string
- This is set to the [table]:[uid] of the latest record rendered. Note that class ContentObjectRenderer has an equal value, but that is pointing to the record delivered in the $data-array of the ContentObjectRenderer instance, if the cObjects CONTENT or RECORD created that instance
- $fe_user : FrontendUserAuthentication
- The frontend user
- $id : int
- The page id (int)
- $lastImgResourceInfo : array<string|int, mixed>|null
- Info-array of the last resulting image resource of content object IMG_RESOURCE (if any), containing width, height and so on.
- $linkVars : string
- A string prepared for insertion in all links on the page as url-parameters.
- $lock : ResourceMutex|null
- $MP : string
- $newHash : string
- This hash is unique to the template, the $this->id and $this->type vars and the list of groups. Used to get and later store the cached data
- $no_cache : bool
- Page will not be cached. Write only TRUE. Never clear value (some other code might have reasons to set it TRUE).
- $page : array<string|int, mixed>
- The pagerecord
- $pSetup : array<string|int, mixed>|string
- TypoScript configuration of the page-object.
- $recordRegister : array<string|int, mixed>
- Used by RecordContentObject and ContentContentObject to ensure the a records is NOT rendered twice through it!
- $register : array<string|int, mixed>
- $registerStack : array<string|int, mixed>
- Stack used for storing array and retrieving register arrays (see LOAD_REGISTER and RESTORE_REGISTER)
- $rootLine : array<int, array<string, mixed>>
- Rootline of page records all the way to the root.
- $sys_page : PageRepository|string
- sys_page-object, pagefunctions
- $tmpl : TemplateService
- The TypoScript template object. Used to parse the TypoScript template
- $baseUrl : string
- The base URL set for the page header.
- $cacheExpires : int
- Set to the expire time of cached content
- $cacheTimeOutDefault : int
- Is set to the time-to-live time of cached pages. Default is 60*60*24, which is 24 hours.
- $contentType : string
- Content type HTTP header being sent in the request.
- $context : Context
- The context for keeping the current state, mostly related to current page information, backend user / frontend user access, workspaceId
- $debugInformationHeader : string
- If debug mode is enabled, this contains the information if a page is fetched from cache, and sent as HTTP Response Header.
- $deprecatedPublicProperties : array<string|int, mixed>
- $extTarget : string
- Default external target
- $fileTarget : string
- Default file link target
- $intTarget : string
- Default internal target
- $language : SiteLanguage
- $languageService : LanguageService|null
- Internal calculations for labels
- $no_cacheBeforePageGen : bool
- This flag is set before the page is generated IF $this->no_cache is set. If this flag is set after the page content was generated, $this->no_cache is forced to be set.
- $originalMountPointPage : array<string|int, mixed>|null
- Gets set when we are processing a page of type mountpoint with enabled overlay in getPageAndRootline() Used later in checkPageForMountpointRedirect() to determine the final target URL where the user should be redirected to.
- $originalShortcutPage : array<string|int, mixed>|null
- Gets set when we are processing a page of type shortcut in the early stages of the request, used later in the request to resolve the shortcut and redirect again.
- $pageAccessFailureHistory : array<string|int, mixed>
- Array containing a history of why a requested page was not accessible.
- $pageArguments : PageArguments
- $pageCache : FrontendInterface
- The page cache object, use this to save pages to the cache and to retrieve them again
- $pageCacheTags : array<string|int, mixed>
- $pageContentWasLoadedFromCache : bool
- Set if cached content was fetched from the cache.
- $pageNotFound : int
- Is set to > 0 if the page could not be resolved. This will then result in early returns when resolving the page.
- $pageRenderer : PageRenderer|null
- $pagesTSconfig : array<string|int, mixed>|null
- May be set to the pagesTSconfig
- $requestedId : int
- Originally requested id from PageArguments
- $site : Site
- $spamProtectEmailAddresses : int
- If set, typolink() function encrypts email addresses.
- $type : int|string
- The type (read-only)
- $uniqueCounter : int
- Used to generate page-unique keys. Point is that uniqid() functions is very slow, so a unique key is made based on this, see function uniqueHash()
- $uniqueString : string
- $xhtmlDoctype : string
- Doctype to use
- $xhtmlVersion : int
Methods
- __construct() : mixed
- Since TYPO3 v10.0, TSFE is composed out of - Context - Site - SiteLanguage - PageArguments (containing ID, Type, cHash and MP arguments)
- __get() : mixed
- Gets the value of the property of the given name if tagged.
- __isset() : bool
- Checks if the property of the given name is set.
- __set() : mixed
- Sets the property of the given name if tagged.
- __unset() : mixed
- Unsets the property of the given name if tagged.
- addCacheTags() : mixed
- Adds tags to this page's cache entry, you can then f.e. remove cache entries by tag
- applyHttpHeadersToResponse() : ResponseInterface
- Add HTTP headers to the response object.
- baseUrlWrap() : string
- Prefixing the input URL with ->baseUrl If ->baseUrl is set and the input url is not absolute in some way.
- calculateLinkVars() : mixed
- Calculates and sets the internal linkVars based upon the current request parameters and the setting "config.linkVars".
- checkEnableFields() : bool
- Checks page record for enableFields Returns TRUE if enableFields does not disable the page record.
- clearPageCacheContent() : mixed
- Clears cache content (for $this->newHash)
- determineId() : ResponseInterface|null
- Resolves the page id and sets up several related properties.
- doWorkspacePreview() : bool
- Returns TRUE if workspace preview is enabled
- generatePage_postProcessing() : mixed
- Does processing of the content after the page content was generated.
- generatePage_preProcessing() : mixed
- Does some processing BEFORE the page content is generated / built.
- generatePageTitle() : string
- Generate the page title, can be called multiple times, as PageTitleProvider might have been modified by an uncached plugin etc.
- get_cache_timeout() : int
- Get the cache timeout for the current page.
- getContext() : Context
- getFromCache() : ServerRequestInterface
- This is a central and quite early method called by PrepareTypoScriptFrontendRendering middleware: This code is *always* executed for *every* frontend call if a general page rendering has to be done, if there is no early redirect or eid call or similar.
- getLanguage() : SiteLanguage
- getPageAccessFailureReasons() : array<string|int, mixed>
- Analysing $this->pageAccessFailureHistory into a summary array telling which features disabled display and on which pages and conditions. That data can be used inside a page-not-found handler
- getPageArguments() : PageArguments
- getPageCacheTags() : array<string|int, mixed>
- getPagesTSconfig() : array<string|int, mixed>
- Returns the pages TSconfig array based on the current ->rootLine
- getRedirectUriForMountPoint() : string|null
- Returns URI of target page, if the current page is an overlaid mountpoint.
- getRedirectUriForShortcut() : string|null
- Returns URI of target page, if the current page is a Shortcut.
- getRequestedId() : int
- Returns the originally requested page uid when TSFE was instantiated initially.
- getSite() : Site
- initUserGroups() : mixed
- Initializes the front-end user groups.
- INTincScript() : void
- Processes the INTinclude-scripts
- INTincScript_loadJSCode() : mixed
- Loads the JavaScript/CSS code for INTincScript, if there are non-cacheable content objects it prepares the placeholders, otherwise populates options directly.
- isBackendUserLoggedIn() : bool
- Checks if a backend user is logged in
- isGeneratePage() : bool
- Returns TRUE if the page content should be generated.
- isINTincScript() : bool
- Determines if there are any INTincScripts to include = "non-cacheable" parts
- isStaticCacheble() : bool
- Reporting status whether we can send cache control headers for proxy caching or publishing to static files
- isUserOrGroupSet() : bool
- Checking if a user is logged in or a group constellation different from "0,-1"
- logDeprecatedTyposcript() : mixed
- Logs access to deprecated TypoScript objects and properties.
- newCObj() : mixed
- Creates an instance of ContentObjectRenderer in $this->cObj This instance is used to start the rendering of the TypoScript template structure
- preparePageContentGeneration() : mixed
- Sets up TypoScript "config." options and set properties in $TSFE.
- releaseLocks() : void
- Release the page specific lock.
- set_cache_timeout_default() : mixed
- Sets the cache-timeout in seconds
- set_no_cache() : mixed
- Sets the cache-flag to 1. Could be called from user-included php-files in order to ensure that a page is not cached.
- setContentType() : mixed
- sL() : string
- Split Label function for front-end applications.
- uniqueHash() : string
- Returns a unique md5 hash.
- whichWorkspace() : int
- Returns the uid of the current workspace
- checkRootlineForIncludeSection() : bool
- Checks if visibility of the page is blocked upwards in the root line.
- createHashBase() : string
- This creates a hash used as page cache entry identifier and as page generation lock.
- disableCache() : mixed
- Disables caching of the current page.
- evaluatePageNotFound() : void
- If $this->pageNotFound is set, then throw an exception to stop further page generation process
- getAdditionalHeaders() : array<string|int, mixed>
- Send additional headers from config.additionalHeaders
- getBackendUser() : FrontendBackendUserAuthentication|null
- Returns the current BE user.
- getCacheHeaders() : array<string|int, mixed>
- Get cache headers good for client/reverse proxy caching.
- getPageAndRootline() : mixed
- Loads the page and root line records based on $this->id
- getRelevantParametersForCachingFromPageArguments() : array<string|int, mixed>
- Fetches the arguments that are relevant for creating the hash base from the given PageArguments object.
- getTimeTracker() : TimeTracker
- getUriToCurrentPageForRedirect() : string
- Instantiate \TYPO3\CMS\Frontend\ContentObject to generate the correct target URL
- getWebsiteTitle() : string
- initCaches() : mixed
- Initializes the caching system.
- initPageRenderer() : mixed
- Initializes the page renderer object
- logPageAccessFailure() : void
- Log the page access failure with additional request information
- populatePageDataFromCache() : void
- This method properly sets the values given from the pages cache into the corresponding TSFE variables. The counterpart is setPageCacheContent() where all relevant information is fetched.
- printTitle() : string
- Compiles the content for the page <title> tag.
- processNonCacheableContentPartsAndSubstituteContentMarkers() : mixed
- Processes the INTinclude-scripts and substitute in content.
- recursivelyReplaceIntPlaceholdersInContent() : mixed
- Replaces INT placeholders (COA_INT and USER_INT) in $this->content In case the replacement adds additional placeholders, it loops until no new placeholders are found any more.
- resolveContentPid() : int
- Check the value of "content_from_pid" of the current page record, and see if the current request should actually show content from another page.
- setAbsRefPrefix() : mixed
- Converts relative paths in the HTML source to absolute paths for fileadmin/, typo3conf/ext/ and media/ folders.
- setPageArguments() : void
- setPageCacheContent() : array<string|int, mixed>
- Sets cache content; Inserts the content string into the pages cache.
- setRegisterValueForSysLastChanged() : void
- Set the SYS_LASTCHANGED register value, is also called when a translated page is in use, so the register reflects the state of the translated page, not the page in the default language.
- setSysLastChanged() : mixed
- Setting the SYS_LASTCHANGED value in the pagerecord: This value will thus be set to the highest tstamp of records rendered on the page.
- settingLanguage() : mixed
- Setting the language key that will be used by the current page.
- shouldAcquireCacheData() : bool
- Detecting if shift-reload has been clicked.
- updateRootLinesWithTranslations() : mixed
- Updating content of the two rootLines IF the language key is set!
Properties
$absRefPrefix
Absolute Reference prefix
public
string
$absRefPrefix
= ''
$additionalFooterData
Used to accumulate additional HTML-code for the footer-section of the template
public
array<string|int, mixed>
$additionalFooterData
= []
$additionalHeaderData
Eg. insert JS-functions in this array ($additionalHeaderData) to include them once. Use associative keys.
public
array<string|int, mixed>
$additionalHeaderData
= []
Keys in use:
used to accumulate additional HTML-code for the header-section,
.... Insert either associative keys (like additionalHeaderData['myStyleSheet'], see reserved keys above) or num-keys (like additionalHeaderData[] = '...')$applicationData
'Global' Storage for various applications. Keys should be 'tx_'.extKey for extensions.
public
array<string|int, mixed>
$applicationData
= []
$cObj
Page content render object
public
ContentObjectRenderer
$cObj
$config
A central data array consisting of various keys, initialized and processed at various places in the class.
public
array<string, mixed>
$config
= []
This array is cached along with the rendered page content and contains for instance a list of INT identifiers used to calculate 'dynamic' page parts when a page is retrieved from cache.
Some sub keys:
'config': This is the TypoScript ['config.'] sub-array, with some settings being sanitized and merged.
'rootLine': This is the "local" rootline of a deep page that stops at the first parent sys_template record that has "root" flag set, in natural parent-child order.
Both language and version overlays are applied to these page records:
All "data" fields are set to language / version overlay values, *except* uid and
pid, which are the default-language and live-version ids.
When page uid 5 is called in this example:
[0] Project name
|- [2] An organizational page, probably with is_siteroot=1 and a site config
|- [3] Site root with a sys_template having "root" flag set
|- [5] Here you are
This rootLine is:
[0] => [uid = 3, pid = 2, title = Site root with a sys_template having "root" flag set, ...]
[1] => [uid = 5, pid = 3, title = Here you are, ...]
$content
All page content is accumulated in this variable. See RequestHandler
public
string
$content
= ''
$contentPid
This will normally point to the same value as id, but can be changed to point to another page from which content will then be displayed instead.
public
int
$contentPid
= 0
$currentRecord
This is set to the [table]:[uid] of the latest record rendered. Note that class ContentObjectRenderer has an equal value, but that is pointing to the record delivered in the $data-array of the ContentObjectRenderer instance, if the cObjects CONTENT or RECORD created that instance
public
string
$currentRecord
= ''
$fe_user
The frontend user
public
FrontendUserAuthentication
$fe_user
$id
The page id (int)
public
int
$id
$lastImgResourceInfo
Info-array of the last resulting image resource of content object IMG_RESOURCE (if any), containing width, height and so on.
public
array<string|int, mixed>|null
$lastImgResourceInfo
= null
$linkVars
A string prepared for insertion in all links on the page as url-parameters.
public
string
$linkVars
= ''
Based on configuration in TypoScript where you defined which GET parameters you would like to pass on.
if needed, generate linkVars via LinkVarsCalculator
$lock
public
ResourceMutex|null
$lock
= null
Internal locking. May move to a middleware soon.
$MP
public
string
$MP
= ''
$newHash
This hash is unique to the template, the $this->id and $this->type vars and the list of groups. Used to get and later store the cached data
public
string
$newHash
= ''
$no_cache
Page will not be cached. Write only TRUE. Never clear value (some other code might have reasons to set it TRUE).
public
bool
$no_cache
= false
$page
The pagerecord
public
array<string|int, mixed>
$page
= []
$pSetup
TypoScript configuration of the page-object.
public
array<string|int, mixed>|string
$pSetup
= ''
should only be used by TYPO3 Core
$recordRegister
Used by RecordContentObject and ContentContentObject to ensure the a records is NOT rendered twice through it!
public
array<string|int, mixed>
$recordRegister
= []
$register
public
array<string|int, mixed>
$register
= []
$registerStack
Stack used for storing array and retrieving register arrays (see LOAD_REGISTER and RESTORE_REGISTER)
public
array<string|int, mixed>
$registerStack
= []
$rootLine
Rootline of page records all the way to the root.
public
array<int, array<string, mixed>>
$rootLine
= []
Both language and version overlays are applied to these page records: All "data" fields are set to language / version overlay values, except uid and pid, which are the default-language and live-version ids.
First array row with the highest key is the deepest page (the requested page), then parent pages with descending keys until (but not including) the project root pseudo page 0.
When page uid 5 is called in this example: [0] Project name |- [2] An organizational page, probably with is_siteroot=1 and a site config |- [3] Site root with a sys_template having "root" flag set |- [5] Here you are
This $absoluteRootLine is: [3] => [uid = 5, pid = 3, title = Here you are, ...] [2] => [uid = 3, pid = 2, title = Site root with a sys_template having "root" flag set, ...] [1] => [uid = 2, pid = 0, title = An organizational page, probably with is_siteroot=1 and a site config, ...]
$sys_page
sys_page-object, pagefunctions
public
PageRepository|string
$sys_page
= ''
$tmpl
The TypoScript template object. Used to parse the TypoScript template
public
TemplateService
$tmpl
Tags
$baseUrl
The base URL set for the page header.
since TYPO3 v12.0. will be removed in TYPO3 v13.0.
protected
string
$baseUrl
= ''
$cacheExpires
Set to the expire time of cached content
protected
int
$cacheExpires
= 0
$cacheTimeOutDefault
Is set to the time-to-live time of cached pages. Default is 60*60*24, which is 24 hours.
protected
int
$cacheTimeOutDefault
= 0
$contentType
Content type HTTP header being sent in the request.
protected
string
$contentType
= 'text/html; charset=utf-8'
Should only be used by TYPO3 core for now
Tags
$context
The context for keeping the current state, mostly related to current page information, backend user / frontend user access, workspaceId
protected
Context
$context
$debugInformationHeader
If debug mode is enabled, this contains the information if a page is fetched from cache, and sent as HTTP Response Header.
protected
string
$debugInformationHeader
= ''
$deprecatedPublicProperties
protected
array<string|int, mixed>
$deprecatedPublicProperties
= ['intTarget' => '$TSFE->intTarget will be removed in TYPO3 v13.0. Use $TSFE->config[\'config\'][\'intTarget\'] instead.', 'extTarget' => '$TSFE->extTarget will be removed in TYPO3 v13.0. Use $TSFE->config[\'config\'][\'extTarget\'] instead.', 'fileTarget' => '$TSFE->fileTarget will be removed in TYPO3 v13.0. Use $TSFE->config[\'config\'][\'fileTarget\'] instead.', 'spamProtectEmailAddresses' => '$TSFE->spamProtectEmailAddresses will be removed in TYPO3 v13.0. Use $TSFE->config[\'config\'][\'spamProtectEmailAddresses\'] instead.', 'baseUrl' => '$TSFE->baseUrl will be removed in TYPO3 v13.0. Use $TSFE->config[\'config\'][\'baseURL\'] instead.', 'xhtmlDoctype' => '$TSFE->xhtmlDoctype will be removed in TYPO3 v13.0. Use PageRenderer->getDocType() instead.', 'xhtmlVersion' => '$TSFE->xhtmlVersion will be removed in TYPO3 v13.0. Use PageRenderer->getDocType() instead.', 'type' => '$TSFE->type will be removed in TYPO3 v13.0. Use $TSFE->getPageArguments()->getPageType() instead.']
$extTarget
Default external target
since TYPO3 v12.0. will be removed in TYPO3 v13.0.
protected
string
$extTarget
= ''
$fileTarget
Default file link target
since TYPO3 v12.0. will be removed in TYPO3 v13.0.
protected
string
$fileTarget
= ''
$intTarget
Default internal target
since TYPO3 v12.0. will be removed in TYPO3 v13.0.
protected
string
$intTarget
= ''
$language
protected
SiteLanguage
$language
$languageService
Internal calculations for labels
protected
LanguageService|null
$languageService
= null
$no_cacheBeforePageGen
This flag is set before the page is generated IF $this->no_cache is set. If this flag is set after the page content was generated, $this->no_cache is forced to be set.
protected
bool
$no_cacheBeforePageGen
= false
This is done in order to make sure that PHP code from Plugins / USER scripts does not falsely clear the no_cache flag.
$originalMountPointPage
Gets set when we are processing a page of type mountpoint with enabled overlay in getPageAndRootline() Used later in checkPageForMountpointRedirect() to determine the final target URL where the user should be redirected to.
protected
array<string|int, mixed>|null
$originalMountPointPage
= null
$originalShortcutPage
Gets set when we are processing a page of type shortcut in the early stages of the request, used later in the request to resolve the shortcut and redirect again.
protected
array<string|int, mixed>|null
$originalShortcutPage
= null
$pageAccessFailureHistory
Array containing a history of why a requested page was not accessible.
protected
array<string|int, mixed>
$pageAccessFailureHistory
= []
$pageArguments
protected
PageArguments
$pageArguments
$pageCache
The page cache object, use this to save pages to the cache and to retrieve them again
protected
FrontendInterface
$pageCache
$pageCacheTags
protected
array<string|int, mixed>
$pageCacheTags
= []
$pageContentWasLoadedFromCache
Set if cached content was fetched from the cache.
protected
bool
$pageContentWasLoadedFromCache
= false
$pageNotFound
Is set to > 0 if the page could not be resolved. This will then result in early returns when resolving the page.
protected
int
$pageNotFound
= 0
$pageRenderer
protected
PageRenderer|null
$pageRenderer
= null
$pagesTSconfig
May be set to the pagesTSconfig
protected
array<string|int, mixed>|null
$pagesTSconfig
= null
$requestedId
Originally requested id from PageArguments
protected
int
$requestedId
= 0
$site
protected
Site
$site
$spamProtectEmailAddresses
If set, typolink() function encrypts email addresses.
since TYPO3 v12.0. will be removed in TYPO3 v13.0.
protected
int
$spamProtectEmailAddresses
= 0
$type
The type (read-only)
protected
int|string
$type
= 0
since TYPO3 v12. Use $TSFE->getPageArguments()->getPageType() instead
$uniqueCounter
Used to generate page-unique keys. Point is that uniqid() functions is very slow, so a unique key is made based on this, see function uniqueHash()
protected
int
$uniqueCounter
= 0
$uniqueString
protected
string
$uniqueString
= ''
$xhtmlDoctype
Doctype to use
since TYPO3 v12, will be removed in TYPO3 v13. Use PageRenderer->getDocType() instead.
protected
string
$xhtmlDoctype
= ''
$xhtmlVersion
since TYPO3 v12, will be removed in TYPO3 v13. Use PageRenderer->getDocType() instead.
protected
int
$xhtmlVersion
Methods
__construct()
Since TYPO3 v10.0, TSFE is composed out of - Context - Site - SiteLanguage - PageArguments (containing ID, Type, cHash and MP arguments)
public
__construct(Context $context, Site $site, SiteLanguage $siteLanguage, PageArguments $pageArguments, FrontendUserAuthentication $frontendUser) : mixed
Also sets a unique string (->uniqueString) for this script instance; A md5 hash of the microtime()
Parameters
- $context : Context
-
the Context object to work with
- $site : Site
-
The resolved site to work with
- $siteLanguage : SiteLanguage
-
The resolved language to work with
- $pageArguments : PageArguments
-
The PageArguments object containing Page ID, type and GET parameters
- $frontendUser : FrontendUserAuthentication
-
a FrontendUserAuthentication object
__get()
Gets the value of the property of the given name if tagged.
public
__get(string $propertyName) : mixed
The evaluation is done in the assumption that this method is never reached for a public property.
Parameters
- $propertyName : string
__isset()
Checks if the property of the given name is set.
public
__isset(string $propertyName) : bool
Unmarked protected properties must return false as usual. Marked properties are evaluated by isset().
This method is not called for public properties.
Parameters
- $propertyName : string
Return values
bool__set()
Sets the property of the given name if tagged.
public
__set(string $propertyName, mixed $propertyValue) : mixed
Additionally it's allowed to set unknown properties.
The evaluation is done in the assumption that this method is never reached for a public property.
Parameters
- $propertyName : string
- $propertyValue : mixed
__unset()
Unsets the property of the given name if tagged.
public
__unset(string $propertyName) : mixed
Parameters
- $propertyName : string
addCacheTags()
Adds tags to this page's cache entry, you can then f.e. remove cache entries by tag
public
addCacheTags(array<string|int, mixed> $tags) : mixed
Parameters
- $tags : array<string|int, mixed>
-
An array of tag
applyHttpHeadersToResponse()
Add HTTP headers to the response object.
public
applyHttpHeadersToResponse(ResponseInterface $response) : ResponseInterface
Parameters
- $response : ResponseInterface
Return values
ResponseInterfacebaseUrlWrap()
Prefixing the input URL with ->baseUrl If ->baseUrl is set and the input url is not absolute in some way.
public
baseUrlWrap(string $url[, bool $internal = false ]) : string
will be removed in TYPO3 v13.0 along with config.baseURL
Designed as a wrapper functions for use with all frontend links that are processed by JavaScript (for "realurl" compatibility!). So each time a URL goes into window.open, window.location.href or otherwise, wrap it with this function!
Parameters
- $url : string
-
Input URL, relative or absolute
- $internal : bool = false
-
used for TYPO3 Core to avoid deprecation errors in v12 when calling this method directly.
only for TYPO3 Core internal purposes. Might be removed at a later point as it was related to RealURL functionality.
Return values
string —Processed input value.
calculateLinkVars()
Calculates and sets the internal linkVars based upon the current request parameters and the setting "config.linkVars".
public
calculateLinkVars(array<string|int, mixed> $queryParams) : mixed
Parameters
- $queryParams : array<string|int, mixed>
-
$_GET (usually called with a PSR-7 $request->getQueryParams())
checkEnableFields()
Checks page record for enableFields Returns TRUE if enableFields does not disable the page record.
public
checkEnableFields(array<string|int, mixed> $row[, bool $bypassGroupCheck = false ]) : bool
since TYPO3 v12, will be removed in TYPO3 v13. Use RecordAccessVoter instead.
Takes notice of the includeHiddenPages visibility aspect flag and uses SIM_ACCESS_TIME for start/endtime evaluation
Parameters
- $row : array<string|int, mixed>
-
The page record to evaluate (needs fields: hidden, starttime, endtime, fe_group)
- $bypassGroupCheck : bool = false
-
Bypass group-check
Return values
bool —TRUE, if record is viewable.
clearPageCacheContent()
Clears cache content (for $this->newHash)
public
clearPageCacheContent() : mixed
determineId()
Resolves the page id and sets up several related properties.
public
determineId(ServerRequestInterface $request) : ResponseInterface|null
At this point, the Context object already contains relevant preview settings (if a backend user is logged in etc).
If $this->id is not set at all, the method does its best to set the value to an integer. Resolving is based on this options:
- Finding the domain record start page
- First visible page
- Relocating the id below the site if outside the site / domain
The following properties may be set up or updated:
- id
- sys_page
- sys_page->where_groupAccess
- sys_page->where_hid_del
- register['SYS_LASTCHANGED']
- pageNotFound
Via getPageAndRootline()
- rootLine
- page
- MP
- originalShortcutPage
- originalMountPointPage
- pageAccessFailureHistory['direct_access']
- pageNotFound
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterface|nulldoWorkspacePreview()
Returns TRUE if workspace preview is enabled
public
doWorkspacePreview() : bool
will be removed in TYPO3 v13.0. Use the Context API directly.
Return values
bool —Returns TRUE if workspace preview is enabled
generatePage_postProcessing()
Does processing of the content after the page content was generated.
public
generatePage_postProcessing(ServerRequestInterface $request) : mixed
This includes caching the page, indexing the page (if configured) and setting sysLastChanged
Parameters
- $request : ServerRequestInterface
generatePage_preProcessing()
Does some processing BEFORE the page content is generated / built.
public
generatePage_preProcessing() : mixed
generatePageTitle()
Generate the page title, can be called multiple times, as PageTitleProvider might have been modified by an uncached plugin etc.
public
generatePageTitle() : string
Return values
string —the generated page title
get_cache_timeout()
Get the cache timeout for the current page.
public
get_cache_timeout() : int
Return values
intgetContext()
public
getContext() : Context
Return values
ContextgetFromCache()
This is a central and quite early method called by PrepareTypoScriptFrontendRendering middleware: This code is *always* executed for *every* frontend call if a general page rendering has to be done, if there is no early redirect or eid call or similar.
public
getFromCache(ServerRequestInterface $request) : ServerRequestInterface
The goal is to calculate dependencies up to a point to see if a possible page cache can be used, and to prepare TypoScript as far as really needed.
Parameters
- $request : ServerRequestInterface
This method may vanish from TypoScriptFrontendController without further notice.
Tags
Return values
ServerRequestInterface —New request object with typoscript attribute
getLanguage()
public
getLanguage() : SiteLanguage
Return values
SiteLanguagegetPageAccessFailureReasons()
Analysing $this->pageAccessFailureHistory into a summary array telling which features disabled display and on which pages and conditions. That data can be used inside a page-not-found handler
public
getPageAccessFailureReasons([string|null $failureReasonCode = null ]) : array<string|int, mixed>
Parameters
- $failureReasonCode : string|null = null
-
the error code to be attached (optional), see PageAccessFailureReasons list for details
Return values
array<string|int, mixed> —Summary of why page access was not allowed.
getPageArguments()
public
getPageArguments() : PageArguments
Return values
PageArgumentsgetPageCacheTags()
public
getPageCacheTags() : array<string|int, mixed>
Return values
array<string|int, mixed>getPagesTSconfig()
Returns the pages TSconfig array based on the current ->rootLine
public
getPagesTSconfig() : array<string|int, mixed>
since TYPO3 v12, will be removed in v13. Frontend should typically not depend on Backend TsConfig. If really needed, use PageTsConfigFactory, see usage in DatabaseRecordLinkBuilder. Remove together with class PageTsConfig.
Return values
array<string|int, mixed>getRedirectUriForMountPoint()
Returns URI of target page, if the current page is an overlaid mountpoint.
public
getRedirectUriForMountPoint(ServerRequestInterface $request) : string|null
If the current page is of type mountpoint and should be overlaid with the contents of the mountpoint page and is accessed directly, the user will be redirected to the mountpoint context.
Parameters
- $request : ServerRequestInterface
Return values
string|nullgetRedirectUriForShortcut()
Returns URI of target page, if the current page is a Shortcut.
public
getRedirectUriForShortcut(ServerRequestInterface $request) : string|null
If the current page is of type shortcut and accessed directly via its URL, the user will be redirected to shortcut target.
Parameters
- $request : ServerRequestInterface
Return values
string|nullgetRequestedId()
Returns the originally requested page uid when TSFE was instantiated initially.
public
getRequestedId() : int
Return values
intgetSite()
public
getSite() : Site
Return values
SiteinitUserGroups()
Initializes the front-end user groups.
public
initUserGroups() : mixed
will be removed in TYPO3 v13.0. Use the Context API directly.
Sets frontend.user aspect based on front-end user status.
INTincScript()
Processes the INTinclude-scripts
public
INTincScript(ServerRequestInterface $request) : void
Parameters
- $request : ServerRequestInterface
INTincScript_loadJSCode()
Loads the JavaScript/CSS code for INTincScript, if there are non-cacheable content objects it prepares the placeholders, otherwise populates options directly.
public
INTincScript_loadJSCode() : mixed
this method should be renamed as it does not only handle JS, but all additional header data
isBackendUserLoggedIn()
Checks if a backend user is logged in
public
isBackendUserLoggedIn() : bool
will be removed in TYPO3 v13.0. Use the Context API directly.
Return values
bool —whether a backend user is logged in
isGeneratePage()
Returns TRUE if the page content should be generated.
public
isGeneratePage() : bool
Return values
boolisINTincScript()
Determines if there are any INTincScripts to include = "non-cacheable" parts
public
isINTincScript() : bool
Return values
bool —Returns TRUE if scripts are found
isStaticCacheble()
Reporting status whether we can send cache control headers for proxy caching or publishing to static files
public
isStaticCacheble() : bool
Rules are: no_cache cannot be set: If it is, the page might contain dynamic content and should never be cached. There can be no USER_INT objects on the page ("isINTincScript()") because they implicitly indicate dynamic content There can be no logged in user because user sessions are based on a cookie and thereby does not offer client caching a chance to know if the user is logged in. Actually, there will be a reverse problem here; If a page will somehow change when a user is logged in he may not see it correctly if the non-login version sent a cache-header! So do NOT use cache headers in page sections where user logins change the page content. (unless using such as realurl to apply a prefix in case of login sections)
Return values
boolisUserOrGroupSet()
Checking if a user is logged in or a group constellation different from "0,-1"
public
isUserOrGroupSet() : bool
will be removed in TYPO3 v13.0. Use the Context API directly.
Return values
bool —TRUE if either a login user is found (array fe_user->user) OR if the gr_list is set to something else than '0,-1' (could be done even without a user being logged in!)
logDeprecatedTyposcript()
Logs access to deprecated TypoScript objects and properties.
public
logDeprecatedTyposcript(string $typoScriptProperty[, string $explanation = '' ]) : mixed
Dumps message to the TypoScript message log (admin panel) and the TYPO3 deprecation log.
Parameters
- $typoScriptProperty : string
-
Deprecated object or property
- $explanation : string = ''
-
Message or additional information
newCObj()
Creates an instance of ContentObjectRenderer in $this->cObj This instance is used to start the rendering of the TypoScript template structure
public
newCObj([ServerRequestInterface|null $request = null ]) : mixed
Parameters
- $request : ServerRequestInterface|null = null
preparePageContentGeneration()
Sets up TypoScript "config." options and set properties in $TSFE.
public
preparePageContentGeneration(ServerRequestInterface $request) : mixed
Parameters
- $request : ServerRequestInterface
releaseLocks()
Release the page specific lock.
public
releaseLocks() : void
Tags
set_cache_timeout_default()
Sets the cache-timeout in seconds
public
set_cache_timeout_default(int $seconds) : mixed
Parameters
- $seconds : int
-
Cache-timeout in seconds
set_no_cache()
Sets the cache-flag to 1. Could be called from user-included php-files in order to ensure that a page is not cached.
public
set_no_cache([string $reason = '' ][, bool $internalRequest = false ]) : mixed
Parameters
- $reason : string = ''
-
An optional reason to be written to the log.
- $internalRequest : bool = false
-
Whether the request is internal or not (true should only be used by core calls).
setContentType()
public
setContentType(string $contentType) : mixed
Parameters
- $contentType : string
Must only be used by TYPO3 core
sL()
Split Label function for front-end applications.
public
sL(string $input) : string
Parameters
- $input : string
-
Key string. Accepts the "LLL:" prefix.
Return values
string —Label value, if any.
uniqueHash()
Returns a unique md5 hash.
public
uniqueHash([string $str = '' ]) : string
There is no special magic in this, the only point is that you don't have to call md5(uniqid()) which is slow and by this you are sure to get a unique string each time in a little faster way.
Parameters
- $str : string = ''
-
Some string to include in what is hashed. Not significant at all.
Return values
string —MD5 hash of ->uniqueString, input string and uniqueCounter
whichWorkspace()
Returns the uid of the current workspace
public
whichWorkspace() : int
will be removed in TYPO3 v13.0. Use the Context API directly.
Return values
int —returns workspace integer for which workspace is being preview. 0 if none (= live workspace).
checkRootlineForIncludeSection()
Checks if visibility of the page is blocked upwards in the root line.
protected
checkRootlineForIncludeSection() : bool
If any page in the root line is blocking visibility, true is returned.
All pages from the blocking page downwards are removed from the root line, so that the remaining pages can be used to relocate the page up to lowest visible page.
The blocking feature of a page must be turned on by setting the page record field 'extendToSubpages' to 1 in case of hidden, starttime, endtime or fe_group restrictions.
Additionally, this method checks for backend user sections in root line and if found, evaluates if a backend user is logged in and has access.
Recyclers are also checked and trigger page not found if found in root line.
Tags
Return values
boolcreateHashBase()
This creates a hash used as page cache entry identifier and as page generation lock.
protected
createHashBase(array<string|int, mixed> $sysTemplateRows, array<string|int, mixed> $constantConditionList, array<string|int, mixed> $setupConditionList) : string
When multiple requests try to render the same page that will result in the same page cache entry, this lock allows creation by one request which typically puts the result into page cache, while the other requests wait until this finished and re-use the result.
This hash is unique to the TS template and constant and setup condition verdict, the variables ->id, ->type, list of frontend user groups, ->MP (Mount Points) and cHash array.
Parameters
- $sysTemplateRows : array<string|int, mixed>
- $constantConditionList : array<string|int, mixed>
- $setupConditionList : array<string|int, mixed>
Return values
string —Page cache entry identifier also used as page generation lock
disableCache()
Disables caching of the current page.
protected
disableCache() : mixed
evaluatePageNotFound()
If $this->pageNotFound is set, then throw an exception to stop further page generation process
protected
evaluatePageNotFound(int $pageNotFoundNumber, ServerRequestInterface $request) : void
Parameters
- $pageNotFoundNumber : int
- $request : ServerRequestInterface
getAdditionalHeaders()
Send additional headers from config.additionalHeaders
protected
getAdditionalHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getBackendUser()
Returns the current BE user.
protected
getBackendUser() : FrontendBackendUserAuthentication|null
Tags
Return values
FrontendBackendUserAuthentication|nullgetCacheHeaders()
Get cache headers good for client/reverse proxy caching.
protected
getCacheHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getPageAndRootline()
Loads the page and root line records based on $this->id
protected
getPageAndRootline(ServerRequestInterface $request) : mixed
A final page and the matching root line are determined and loaded by the algorithm defined by this method.
First it loads the initial page from the page repository for $this->id. If that can't be loaded directly, it gets the root line for $this->id. It walks up the root line towards the root page until the page repository can deliver a page record. (The loading restrictions of the root line records are more liberal than that of the page record.)
Now the page type is evaluated and handled if necessary. If the page is a short cut, it is replaced by the target page. If the page is a mount point in overlay mode, the page is replaced by the mounted page.
After this potential replacements are done, the root line is loaded (again) for this page record. It walks up the root line up to the first viewable record.
(While upon the first accessibility check of the root line it was done by loading page by page from the page repository, this time the method checkRootlineForIncludeSection() is used to find the most distant accessible page within the root line.)
Having found the final page id, the page record and the root line are loaded for last time by this method.
Exceptions may be thrown for DOKTYPE_SPACER and not loadable page records or root lines.
May set or update these properties:
Parameters
- $request : ServerRequestInterface
Tags
getRelevantParametersForCachingFromPageArguments()
Fetches the arguments that are relevant for creating the hash base from the given PageArguments object.
protected
getRelevantParametersForCachingFromPageArguments(PageArguments $pageArguments) : array<string|int, mixed>
Excluded parameters are not taken into account when calculating the hash base.
Parameters
- $pageArguments : PageArguments
Return values
array<string|int, mixed>getTimeTracker()
protected
getTimeTracker() : TimeTracker
Return values
TimeTrackergetUriToCurrentPageForRedirect()
Instantiate \TYPO3\CMS\Frontend\ContentObject to generate the correct target URL
protected
getUriToCurrentPageForRedirect(ServerRequestInterface $request) : string
Parameters
- $request : ServerRequestInterface
Return values
stringgetWebsiteTitle()
protected
getWebsiteTitle() : string
Return values
stringinitCaches()
Initializes the caching system.
protected
initCaches() : mixed
initPageRenderer()
Initializes the page renderer object
protected
initPageRenderer() : mixed
logPageAccessFailure()
Log the page access failure with additional request information
protected
logPageAccessFailure(string $message, ServerRequestInterface $request) : void
Parameters
- $message : string
- $request : ServerRequestInterface
populatePageDataFromCache()
This method properly sets the values given from the pages cache into the corresponding TSFE variables. The counterpart is setPageCacheContent() where all relevant information is fetched.
protected
populatePageDataFromCache(array<string|int, mixed> $cachedData) : void
This also contains all data that could be cached, even for pages that are partially cached, as they have non-cacheable content still to be rendered.
Parameters
- $cachedData : array<string|int, mixed>
Tags
printTitle()
Compiles the content for the page <title> tag.
protected
printTitle(string $pageTitle[, bool $noPageTitle = false ][, bool $showPageTitleFirst = false ][, string $pageTitleSeparator = '' ][, bool $showWebsiteTitle = true ]) : string
Parameters
- $pageTitle : string
-
The input title string, typically the "title" field of a page's record.
- $noPageTitle : bool = false
-
If set, the page title will not be printed
- $showPageTitleFirst : bool = false
-
If set, website title and page title are swapped
- $pageTitleSeparator : string = ''
-
an alternative to the ": " as the separator between site title and page title
- $showWebsiteTitle : bool = true
-
If set, the website title will be printed
Tags
Return values
string —The page title on the form "[website title]: [input-title]". Not htmlspecialchar()'ed.
processNonCacheableContentPartsAndSubstituteContentMarkers()
Processes the INTinclude-scripts and substitute in content.
protected
processNonCacheableContentPartsAndSubstituteContentMarkers(array<string|int, mixed> $nonCacheableData, ServerRequestInterface $request) : mixed
Takes $this->content, and splits the content by and then puts the content back together.
Parameters
- $nonCacheableData : array<string|int, mixed>
-
$GLOBALS['TSFE']->config['INTincScript'] or part of it
- $request : ServerRequestInterface
Tags
recursivelyReplaceIntPlaceholdersInContent()
Replaces INT placeholders (COA_INT and USER_INT) in $this->content In case the replacement adds additional placeholders, it loops until no new placeholders are found any more.
protected
recursivelyReplaceIntPlaceholdersInContent(ServerRequestInterface $request) : mixed
Parameters
- $request : ServerRequestInterface
resolveContentPid()
Check the value of "content_from_pid" of the current page record, and see if the current request should actually show content from another page.
protected
resolveContentPid(ServerRequestInterface $request) : int
By using $TSFE->getPageAndRootline() on the cloned object, all rootline restrictions (extendToSubPages) are evaluated as well.
Parameters
- $request : ServerRequestInterface
Return values
int —the current page ID or another one if resolved properly - usually set to $this->contentPid
setAbsRefPrefix()
Converts relative paths in the HTML source to absolute paths for fileadmin/, typo3conf/ext/ and media/ folders.
protected
setAbsRefPrefix() : mixed
Tags
setPageArguments()
protected
setPageArguments(PageArguments $pageArguments) : void
Parameters
- $pageArguments : PageArguments
setPageCacheContent()
Sets cache content; Inserts the content string into the pages cache.
protected
setPageCacheContent(string $content, array<string|int, mixed> $data, int $expirationTstamp[, array<string|int, mixed> $metaDataState = [] ]) : array<string|int, mixed>
Parameters
- $content : string
-
The content to store in the HTML field of the cache table
- $data : array<string|int, mixed>
-
The additional cache_data array, fx. $this->config
- $expirationTstamp : int
-
Expiration timestamp
- $metaDataState : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed>setRegisterValueForSysLastChanged()
Set the SYS_LASTCHANGED register value, is also called when a translated page is in use, so the register reflects the state of the translated page, not the page in the default language.
protected
setRegisterValueForSysLastChanged(array<string|int, mixed> $page) : void
Parameters
- $page : array<string|int, mixed>
Tags
setSysLastChanged()
Setting the SYS_LASTCHANGED value in the pagerecord: This value will thus be set to the highest tstamp of records rendered on the page.
protected
setSysLastChanged() : mixed
This includes all records with no regard to hidden records, userprotection and so on.
The important part is that this actually updates a translated "pages" record (_PAGES_OVERLAY_UID) if the Frontend is called with a translation.
Tags
settingLanguage()
Setting the language key that will be used by the current page.
protected
settingLanguage(ServerRequestInterface $request) : mixed
In this function it should be checked, 1) that this language exists, 2) that a page_overlay_record exists, .. and if not the default language, 0 (zero), should be set.
Parameters
- $request : ServerRequestInterface
shouldAcquireCacheData()
Detecting if shift-reload has been clicked.
protected
shouldAcquireCacheData(ServerRequestInterface $request) : bool
This option will have no effect if re-generation of page happens by other reasons (for instance that the page is not in cache yet). Also, a backend user MUST be logged in for the shift-reload to be detected due to DoS-attack-security reasons.
Parameters
- $request : ServerRequestInterface
Return values
bool —If shift-reload in client browser has been clicked, disable getting cached page and regenerate the page content.
updateRootLinesWithTranslations()
Updating content of the two rootLines IF the language key is set!
protected
updateRootLinesWithTranslations() : mixed