if (Env::has('json') && count($this->_jsonVars)) {
return $this->jsonDisplay();
}
-
+
if (Env::v('display') == 'light') {
$this->_page_type = SIMPLE;
} elseif (Env::v('display') == 'raw') {
case SKINNED:
$this->register_modifier('escape_html', 'escape_html');
- $this->default_modifiers = Array('@escape_html');
+ $this->default_modifiers = Array('@escape_html');
}
$this->register_outputfilter('hide_emails');
$this->addJsLink('wiki.js');
{
if (!empty($css)) {
$this->append('xorg_inline_css', $css);
- }
+ }
}
// }}}
/**
* default smarty plugin, used to auto-escape dangerous html.
- *
+ *
* < --> <
* > --> >
* " --> "
function escape_html($string)
{
if (is_string($string)) {
- $transtbl = Array('<' => '<', '>' => '>', '"' => '"', '\'' => ''');
- return strtr($string, $transtbl);
+ return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
} else {
- return $string;
+ return $string;
}
}
$source = preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source);
$source = preg_replace("!&&&tags&&&!e", 'array_shift($tagsmatches[0])', $source);
- return $source;
+ return $source;
}
// }}}
$source = str_replace("\n", '', $source);
return '<script type="text/javascript">//<![CDATA[' . "\n" .
'Nix.decode("' . addslashes(str_rot13($source)) . '");' . "\n" .
- '//]]></script>';
+ '//]]></script>';
}
function hide_emails($source, &$smarty)
{
+ if (!strpos($source, '@')) {
+ return $source;
+ }
+
//prevent email replacement in <script> and <textarea>
$tags = '(script|textarea|select)';
preg_match_all("!<$tags.*?>.*?</(\\1)>!ius", $source, $tagsmatches);
$source = preg_replace("!<[^>]+[-a-z0-9_+.]+@[-a-z0-9_.]+.+?>!ius", '&&&misc&&&', $source);
//catch !
- $source = preg_replace('!([-a-z0-9_+.]+@[-a-z0-9_.]+)!iue', '_hide_email("\1")', $source);
+ $source = preg_replace('!([-a-z0-9_+.]+@[-a-z0-9_.]+)!iue', '_hide_email("\1")', $source);
$source = preg_replace('!&&&ahref&&&!e', '_hide_email(array_shift($ahref[0]))', $source);
// restore data