Bug #17636 » 6415.diff
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy) | ||
---|---|---|
/**
|
||
* Substitutes all occurencies of <a href="#"... in $this->content with <a href="[path-to-url]#"...
|
||
*
|
||
* @return void Works directly on $this->content
|
||
* @return void The substituted content.
|
||
*/
|
||
function prefixLocalAnchorsWithScript() {
|
||
$scriptPath = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
|
||
$this->content = preg_replace('/(<(a|area).*?href=")(#[^"]*")/i','${1}' . htmlspecialchars($scriptPath) . '${3}',$this->content);
|
||
$original_content = $this->content;
|
||
$this->content = preg_replace('/(<(a|area).+href=")(#[^"]*")/i','${1}' . htmlspecialchars($scriptPath) . '${3}',$original_content);
|
||
if(preg_last_error()>0) {
|
||
//The was an error in call to preg_replace, so keep original content (Behavior prior t PHP 5.2).
|
||
t3lib_div::sysLog('preg_replace returned error-code: ' . preg_last_error().' in function prefixLocalAnchorsWithScript. Replacement not done!' , 'cms', 4);
|
||
$this->content = $original_content;
|
||
}
|
||
}
|
||
/**
|