1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-18 12:21:45 +02:00

Fixes #850 - Gallery missing description when using simple brackets. Fixes #607 - embedded English text.

This commit is contained in:
Cameron
2015-02-01 17:27:05 -08:00
parent 2a4caa6cb7
commit 274069184f
4 changed files with 19 additions and 10 deletions

View File

@@ -1857,16 +1857,17 @@ class e_parse extends e_parser
return trim($ret_parser);
}
/**
* Use it on html attributes to avoid breaking markup .
* @example echo "<a href='#' title='".$tp->toAttribute($text)."'>Hello</a>";
*/
function toAttribute($text)
{
// URLs posted without HTML access may have an &amp; in them.
$text = str_replace('&amp;', '&', $text);
// Xhtml compliance.
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
if(!preg_match('/&#|\'|"|\(|\)|<|>/s', $text))
if(!preg_match('/&#|\'|"|<|>/s', $text))
{
$text = $this->replaceConstants($text);
return $text;