mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Respecting SSViewer::$options["rewriteHashlinks"] in SSViewer::process()
This commit is contained in:
parent
fbe8b7bec3
commit
bdd63913bc
@ -371,16 +371,18 @@ class SSViewer extends Object {
|
||||
array_pop(SSViewer::$topLevel);
|
||||
|
||||
if(isset($_GET['debug_profile'])) Profiler::unmark("SSViewer::process", " for $template");
|
||||
|
||||
|
||||
// If we have our crazy base tag, then fix # links referencing the current page.
|
||||
if(strpos($output, '<base') !== false) {
|
||||
if(SSViewer::$options['rewriteHashlinks'] === 'php') {
|
||||
$thisURLRelativeToBase = "<?php echo strip_tags(\$_SERVER['REQUEST_URI']); ?>";
|
||||
} else {
|
||||
$thisURLRelativeToBase = strip_tags($_SERVER['REQUEST_URI']);
|
||||
if(SSViewer::$options['rewriteHashlinks']) {
|
||||
if(strpos($output, '<base') !== false) {
|
||||
if(SSViewer::$options['rewriteHashlinks'] === 'php') {
|
||||
$thisURLRelativeToBase = "<?php echo strip_tags(\$_SERVER['REQUEST_URI']); ?>";
|
||||
} else {
|
||||
$thisURLRelativeToBase = strip_tags($_SERVER['REQUEST_URI']);
|
||||
}
|
||||
$output = preg_replace('/(<a[^>]+href *= *)"#/i', '\\1"' . $thisURLRelativeToBase . '#', $output);
|
||||
}
|
||||
$output = preg_replace('/(<a[^>+]href *= *)"#/i', '\\1"' . $thisURLRelativeToBase . '#', $output);
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user