aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-05-01 16:41:19 +0200
committerMax Kostikov <max@kostikov.co>2019-05-01 16:41:19 +0200
commitfa2f3d136fc0fee9213bf2999ad2042fd84d9466 (patch)
tree14a67122cc7100c276f1e271d1edb8d3c65e8920 /include
parent92b6026695b8f33d18a467bed7cb5f881ad65e21 (diff)
parent8847838c43e1909cabcc57dd7d21319345b7d9b4 (diff)
downloadvolse-hubzilla-fa2f3d136fc0fee9213bf2999ad2042fd84d9466.tar.gz
volse-hubzilla-fa2f3d136fc0fee9213bf2999ad2042fd84d9466.tar.bz2
volse-hubzilla-fa2f3d136fc0fee9213bf2999ad2042fd84d9466.zip
Merge branch 'xmlify' into 'dev'
address xmlify/unxmlify performance issue See merge request hubzilla/core!1616
Diffstat (limited to 'include')
-rw-r--r--include/text.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/text.php b/include/text.php
index 41603f6e4..276264162 100644
--- a/include/text.php
+++ b/include/text.php
@@ -409,7 +409,8 @@ function autoname($len) {
* @return string Escaped text.
*/
function xmlify($str) {
- $buffer = '';
+
+ //$buffer = '';
if(is_array($str)) {
@@ -418,7 +419,7 @@ function xmlify($str) {
btlogger('xmlify called with array: ' . print_r($str,true), LOGGER_NORMAL, LOG_WARNING);
}
-
+/*
$len = mb_strlen($str);
for($x = 0; $x < $len; $x ++) {
$char = mb_substr($str,$x,1);
@@ -452,6 +453,11 @@ function xmlify($str) {
$buffer = trim($buffer);
return($buffer);
+*/
+ $buffer = htmlspecialchars($str, ENT_QUOTES, "UTF-8");
+ $buffer = trim($buffer);
+ return $buffer;
+
}
/**
@@ -464,10 +470,14 @@ function xmlify($str) {
* @return string
*/
function unxmlify($s) {
+/*
$ret = str_replace('&amp;', '&', $s);
$ret = str_replace(array('&lt;', '&gt;', '&quot;', '&apos;'), array('<', '>', '"', "'"), $ret);
return $ret;
+*/
+ $ret = htmlspecialchars_decode($s, ENT_QUOTES);
+ return $ret;
}
/**