Project

General

Profile

Bug #17421 ยป typo3-typoLink-memorycaching.diff

Administrator Admin, 2007-06-27 13:17

View differences:

typo3/sysext/cms/tslib/class.tslib_content.php (Arbeitskopie)
* @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=321&cHash=59bd727a5e
*/
function typoLink($linktxt, $conf) {
$link_param = trim($this->stdWrap($conf['parameter'],$conf['parameter.']));
if( empty($conf['userFunc']) && function_exists('eaccelerator_get') )
{
$cache_key = 'inso_typoLink_'.md5(serialize($conf).serialize($link_param).serialize($linktxt));
$from_cache = eaccelerator_get($cache_key);
if( is_array($from_cache) )
{
list( $this->lastTypoLinkUrl, $this->lastTypoLinkTarget, $return ) = $from_cache;
return $return;
}
}
$finalTagParts = array();
$finalTagParts['aTagParams'] = $this->getATagParams($conf);
......
if ($conf['returnLast']) {
switch($conf['returnLast']) {
case 'url':
return $this->lastTypoLinkUrl;
$return = $this->lastTypoLinkUrl;
break;
case 'target':
return $this->lastTypoLinkTarget;
$return = $this->lastTypoLinkTarget;
break;
}
}
if ($conf['ATagBeforeWrap']) {
return $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
} else {
return $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
if( ! isset($return) )
{
if ($conf['ATagBeforeWrap']) {
$return = $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
} else {
$return = $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
}
}
} else {
return $linktxt;
}
// Save into memory cache:
if( empty($conf['userFunc']) && function_exists('eaccelerator_put') )
{
eaccelerator_put($cache_key, array($this->lastTypoLinkUrl, $this->lastTypoLinkTarget, $return), 3600);
}
return $return;
}
/**
    (1-1/1)