Created a function for correctly converting characters to entities.

This commit is contained in:
Stefan Printezis committed 2016-11-10 23:58:02 +01:00
1 parent df0e112720
commit 6d1d46a258
2 files changed
+14 -6

No files matched your search

+10 -2
View File
@@ -53,6 +53,14 @@ class HtmlBuilder
return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
}
/**
* Convert all applicable characters to HTML entities.
*/
public function escapeAll($value)
{
return htmlentities($value, ENT_QUOTES, 'UTF-8');
}
/**
* Convert entities to HTML characters.
*
@@ -387,7 +395,7 @@ class HtmlBuilder
if (is_array($value)) {
return $this->nestedListing($key, $type, $value);
} else {
return '<li>' . htmlentities($value, ENT_QUOTES, 'UTF-8') . '</li>';
return '<li>' . $this->html->escapeAll($value) . '</li>';
}
}
@@ -449,7 +457,7 @@ class HtmlBuilder
}
if (! is_null($value)) {
return $key . '="' . htmlentities($value, ENT_QUOTES, 'UTF-8') . '"';
return $key . '="' . $this->html->escapeAll($value) . '"';
}
}