Patch remaining usages of html_entity_decode

Document
This commit is contained in:
Garvin Hicking 2014-11-24 09:57:47 +01:00
parent 92afc37753
commit 26535ec09c
4 changed files with 10 additions and 15 deletions

View File

@ -3,6 +3,12 @@
Version 2.0-beta4/5/6 / RC? ()
------------------------------------------------------------------------
* PHP 5.4+ fix to properly call htmlspecialchars() / htmlentities() /
html_entity_decode() with a charset option, that has been
set to to default to UTF-8 and will yield empty strings when
being used in NON-UTF-8 environments. Now we utilize a
serendipity_specialchars() wrapper call.
* New personal preference to choose CKEditor toolbar presets.
Presets can be overwritte through a
templates/xxx/admin/ckeditor_custom_config.js if needed.

View File

@ -268,7 +268,7 @@ function serendipity_getTemplateFile($file, $key = 'serendipityHTTPPath', $force
if ($force_frontend_fallback) {
// If enabled, even when within the admin suite it will be possible to reference files that
// reside within a template directory.
// reside within a frontend-only template directory.
$directories[] = $serendipity['template'] . '/';
if (isset($serendipity['template_engine']) && $serendipity['template_engine'] != null) {
$p = explode(',', $serendipity['template_engine']);

View File

@ -778,7 +778,7 @@ class serendipity_event_gravatar extends serendipity_event
{
// Attempt to grab an avatar link from their webpage url
$linkUrl = html_entity_decode($matches[1]);
$linkUrl = serendipity_entity_decode($matches[1]);
if (substr($linkUrl, 0, 1) == '/') {
if ($urlParts = parse_url($url)) {
$faviconURL = $urlParts['scheme'] . '://' . $urlParts['host'] . $linkUrl;

View File

@ -2,17 +2,6 @@
@serendipity_plugin_api::load_language(dirname(__FILE__));
if (!function_exists('html_entity_decode')) {
function html_entity_decode($given_html, $quote_style = ENT_QUOTES) {
$trans_table = get_html_translation_table(HTML_SPECIALCHARS, $quote_style);
if ($trans_table["'"] != ''') { # some versions of PHP match single quotes to '
$trans_table["'"] = ''';
}
return (strtr($given_html, array_flip($trans_table)));
}
}
class serendipity_event_xhtmlcleanup extends serendipity_event
{
var $title = PLUGIN_EVENT_XHTMLCLEANUP_NAME;
@ -254,7 +243,7 @@ class serendipity_event_xhtmlcleanup extends serendipity_event
// Reconstruct XHTML tag.
$atts = ' ';
foreach($vals[0]['attributes'] AS $att => $att_con) {
$atts .= strtolower($att) . '="' . ($this->cleanup_parse ? htmlspecialchars($att_con) : $att_con) . '" ';
$atts .= strtolower($att) . '="' . ($this->cleanup_parse ? serendipity_specialchars($att_con) : $att_con) . '" ';
}
return '<' . strtolower($tag) . $atts . ' />';
@ -264,7 +253,7 @@ class serendipity_event_xhtmlcleanup extends serendipity_event
}
function clean_htmlspecialchars($given, $quote_style = ENT_QUOTES) {
return '<' . $given[1] . $given[2] . $given[3] . '=' . $given[4] . htmlspecialchars(html_entity_decode($given[5], $quote_style), $quote_style) . $given[6];
return '<' . $given[1] . $given[2] . $given[3] . '=' . $given[4] . serendipity_specialchars(serendipity_entity_decode($given[5], $quote_style), $quote_style) . $given[6];
}
}