Browse files

BUGFIX Respecting SSViewer::$options["rewriteHashlinks"] in SSViewer:…

…:process()
  • Loading branch information...
1 parent fbe8b7b commit bdd63913bc3bcca2f60c79b14f91d3ecbbe1725e @chillu chillu committed Oct 18, 2011
Showing with 10 additions and 8 deletions.
  1. +10 −8 core/SSViewer.php
View
18 core/SSViewer.php
@@ -371,16 +371,18 @@ public function process($item) {
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;
}

0 comments on commit bdd6391

Please sign in to comment.