BUGFIX: Fix href rewriting in text

This commit is contained in:
Hamish Friedlander 2011-03-10 17:38:03 +13:00
parent 31c5bb24f7
commit 08faf03673
2 changed files with 14 additions and 2 deletions

View File

@ -3700,9 +3700,15 @@ class SSTemplateParser extends Parser {
function Text__finalise(&$res) { function Text__finalise(&$res) {
$text = $res['text']; $text = $res['text'];
// TODO: This is _super_ ugly, and a performance killer to boot.
$text = preg_replace( $text = preg_replace(
'/href\s*\=\s*\"\#/', '/href\s*\=\s*\"\#/',
'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#', 'href="' . PHP_EOL .
'SSVIEWER;' . PHP_EOL .
'$val .= SSViewer::$options[\'rewriteHashlinks\'] ? Convert::raw2att( $_SERVER[\'REQUEST_URI\'] ) : "";' . PHP_EOL .
'$val .= <<<SSVIEWER' . PHP_EOL .
'#',
$text $text
); );

View File

@ -859,9 +859,15 @@ class SSTemplateParser extends Parser {
function Text__finalise(&$res) { function Text__finalise(&$res) {
$text = $res['text']; $text = $res['text'];
// TODO: This is _super_ ugly, and a performance killer to boot.
$text = preg_replace( $text = preg_replace(
'/href\s*\=\s*\"\#/', '/href\s*\=\s*\"\#/',
'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#', 'href="' . PHP_EOL .
'SSVIEWER;' . PHP_EOL .
'$val .= SSViewer::$options[\'rewriteHashlinks\'] ? Convert::raw2att( $_SERVER[\'REQUEST_URI\'] ) : "";' . PHP_EOL .
'$val .= <<<SSVIEWER' . PHP_EOL .
'#',
$text $text
); );