本文整理汇总了PHP中TYPO3\CMS\Core\TypoScript\TemplateService::matching方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateService::matching方法的具体用法?PHP TemplateService::matching怎么用?PHP TemplateService::matching使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\TypoScript\TemplateService
的用法示例。
在下文中一共展示了TemplateService::matching方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFromCache
/**
* See if page is in cache and get it if so
* Stores the page content in $this->content if something is found.
*
* @return void
* @todo Define visibility
*/
public function getFromCache()
{
if (!$this->no_cache) {
$cc = $this->tmpl->getCurrentPageData();
if (!is_array($cc)) {
$key = $this->id . '::' . $this->MP;
// Returns TRUE if the lock is active now
$isLocked = $this->acquirePageGenerationLock($this->pagesection_lockObj, $key);
if (!$isLocked) {
// Lock is no longer active, the data in "cache_pagesection" is now ready
$cc = $this->tmpl->getCurrentPageData();
if (is_array($cc)) {
// Release the lock
$this->releasePageGenerationLock($this->pagesection_lockObj);
}
}
}
if (is_array($cc)) {
// BE CAREFUL to change the content of the cc-array. This array is serialized and an md5-hash based on this is used for caching the page.
// If this hash is not the same in here in this section and after page-generation, then the page will not be properly cached!
// This array is an identification of the template. If $this->all is empty it's because the template-data is not cached, which it must be.
$cc = $this->tmpl->matching($cc);
ksort($cc);
$this->all = $cc;
}
unset($cc);
}
// clearing the content-variable, which will hold the pagecontent
$this->content = '';
// Unsetting the lowlevel config
unset($this->config);
$this->cacheContentFlag = 0;
// Look for page in cache only if caching is not disabled and if a shift-reload is not sent to the server.
if (!$this->no_cache && !$this->headerNoCache()) {
$lockHash = $this->getLockHash();
if ($this->all) {
$this->newHash = $this->getHash();
$GLOBALS['TT']->push('Cache Row', '');
$row = $this->getFromCache_queryRow();
if (!is_array($row)) {
$isLocked = $this->acquirePageGenerationLock($this->pages_lockObj, $lockHash);
if (!$isLocked) {
// Lock is no longer active, the data in "cache_pages" is now ready
$row = $this->getFromCache_queryRow();
if (is_array($row)) {
// Release the lock
$this->releasePageGenerationLock($this->pages_lockObj);
}
}
}
if (is_array($row)) {
// Release this lock
$this->releasePageGenerationLock($this->pages_lockObj);
// Call hook when a page is retrieved from cache:
if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache'])) {
$_params = array('pObj' => &$this, 'cache_pages_row' => &$row);
foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache'] as $_funcRef) {
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
}
}
// Fetches the lowlevel config stored with the cached data
$this->config = (array) unserialize($row['cache_data']);
// Getting the content
$this->content = $row['content'];
// Flag for temp content
$this->tempContent = $row['temp_content'];
// Setting flag, so we know, that some cached content has been loaded
$this->cacheContentFlag = 1;
$this->cacheExpires = $row['expires'];
if ($this->TYPO3_CONF_VARS['FE']['debug'] || isset($this->config['config']['debug']) && $this->config['config']['debug']) {
$dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
$timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
$this->content .= LF . '<!-- Cached page generated ' . date($dateFormat . ' ' . $timeFormat, $row['tstamp']) . '. Expires ' . Date($dateFormat . ' ' . $timeFormat, $row['expires']) . ' -->';
}
}
$GLOBALS['TT']->pull();
} else {
$this->acquirePageGenerationLock($this->pages_lockObj, $lockHash);
}
}
}
示例2: getFromCache
/**
* See if page is in cache and get it if so
* Stores the page content in $this->content if something is found.
*
* @throws \InvalidArgumentException
* @throws \RuntimeException
*/
public function getFromCache()
{
// clearing the content-variable, which will hold the pagecontent
$this->content = '';
// Unsetting the lowlevel config
unset($this->config);
$this->cacheContentFlag = false;
if ($this->no_cache) {
return;
}
$pageSectionCacheContent = $this->tmpl->getCurrentPageData();
if (!is_array($pageSectionCacheContent)) {
// Nothing in the cache, we acquire an "exclusive lock" for the key now.
// We use the Registry to store this lock centrally,
// but we protect the access again with a global exclusive lock to avoid race conditions
$this->acquireLock('pagesection', $this->id . '::' . $this->MP);
//
// from this point on we're the only one working on that page ($key)
//
// query the cache again to see if the page data are there meanwhile
$pageSectionCacheContent = $this->tmpl->getCurrentPageData();
if (is_array($pageSectionCacheContent)) {
// we have the content, nice that some other process did the work for us already
$this->releaseLock('pagesection');
} else {
// We keep the lock set, because we are the ones generating the page now
// and filling the cache.
// This indicates that we have to release the lock in the Registry later in releaseLocks()
}
}
if (is_array($pageSectionCacheContent)) {
// BE CAREFUL to change the content of the cc-array. This array is serialized and an md5-hash based on this is used for caching the page.
// If this hash is not the same in here in this section and after page-generation, then the page will not be properly cached!
// This array is an identification of the template. If $this->all is empty it's because the template-data is not cached, which it must be.
$pageSectionCacheContent = $this->tmpl->matching($pageSectionCacheContent);
ksort($pageSectionCacheContent);
$this->all = $pageSectionCacheContent;
}
unset($pageSectionCacheContent);
// Look for page in cache only if a shift-reload is not sent to the server.
$lockHash = $this->getLockHash();
if (!$this->headerNoCache()) {
if ($this->all) {
// we got page section information
$this->newHash = $this->getHash();
$this->getTimeTracker()->push('Cache Row', '');
$row = $this->getFromCache_queryRow();
if (!is_array($row)) {
// nothing in the cache, we acquire an exclusive lock now
$this->acquireLock('pages', $lockHash);
//
// from this point on we're the only one working on that page ($lockHash)
//
// query the cache again to see if the data are there meanwhile
$row = $this->getFromCache_queryRow();
if (is_array($row)) {
// we have the content, nice that some other process did the work for us
$this->releaseLock('pages');
} else {
// We keep the lock set, because we are the ones generating the page now
// and filling the cache.
// This indicates that we have to release the lock in the Registry later in releaseLocks()
}
}
if (is_array($row)) {
// we have data from cache
// Call hook when a page is retrieved from cache:
if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache'])) {
$_params = array('pObj' => &$this, 'cache_pages_row' => &$row);
foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache'] as $_funcRef) {
GeneralUtility::callUserFunction($_funcRef, $_params, $this);
}
}
// Fetches the lowlevel config stored with the cached data
$this->config = $row['cache_data'];
// Getting the content
$this->content = $row['content'];
// Flag for temp content
$this->tempContent = $row['temp_content'];
// Setting flag, so we know, that some cached content has been loaded
$this->cacheContentFlag = true;
$this->cacheExpires = $row['expires'];
// Restore page title information, this is needed to generate the page title for
// partially cached pages.
$this->page['title'] = $row['pageTitleInfo']['title'];
$this->altPageTitle = $row['pageTitleInfo']['altPageTitle'];
$this->indexedDocTitle = $row['pageTitleInfo']['indexedDocTitle'];
if (isset($this->config['config']['debug'])) {
$debugCacheTime = (bool) $this->config['config']['debug'];
} else {
$debugCacheTime = !empty($this->TYPO3_CONF_VARS['FE']['debug']);
}
if ($debugCacheTime) {
//.........这里部分代码省略.........