summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-08 11:04:25 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-08 11:04:25 +0100
commitfe8dc0bd5e867831a70251fb8604e1a397f2901b (patch)
treece924a7349275ca64f124a83ca42a7112b75b18a /lib/private
parentc88438790cbaa3510c8dc8a251e241164da6c93f (diff)
parent6d3eb7673d1671a9e1f8437388f344a90e3d71dd (diff)
downloadnextcloud-server-fe8dc0bd5e867831a70251fb8604e1a397f2901b.tar.gz
nextcloud-server-fe8dc0bd5e867831a70251fb8604e1a397f2901b.zip
Merge pull request #21022 from owncloud/get-rid-of-by-reference
Get rid of by reference
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/template.php6
-rw-r--r--lib/private/template/functions.php4
-rw-r--r--lib/private/util.php10
3 files changed, 11 insertions, 9 deletions
diff --git a/lib/private/template.php b/lib/private/template.php
index 1476a964ef3..d794dacac23 100644
--- a/lib/private/template.php
+++ b/lib/private/template.php
@@ -226,12 +226,12 @@ class OC_Template extends \OC\Template\Base {
// Add custom headers
$headers = '';
foreach(OC_Util::$headers as $header) {
- $headers .= '<'.OC_Util::sanitizeHTML($header['tag']);
+ $headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']);
foreach($header['attributes'] as $name=>$value) {
- $headers .= ' '.OC_Util::sanitizeHTML($name).'="'.OC_Util::sanitizeHTML($value).'"';
+ $headers .= ' '.\OCP\Util::sanitizeHTML($name).'="'.\OCP\Util::sanitizeHTML($value).'"';
}
if ($header['text'] !== null) {
- $headers .= '>'.OC_Util::sanitizeHTML($header['text']).'</'.OC_Util::sanitizeHTML($header['tag']).'>';
+ $headers .= '>'.\OCP\Util::sanitizeHTML($header['text']).'</'.\OCP\Util::sanitizeHTML($header['tag']).'>';
} else {
$headers .= '/>';
}
diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php
index 79d18632d2f..d156d26f9ce 100644
--- a/lib/private/template/functions.php
+++ b/lib/private/template/functions.php
@@ -33,7 +33,7 @@
* @param string $string the string which will be escaped and printed
*/
function p($string) {
- print(OC_Util::sanitizeHTML($string));
+ print(\OCP\Util::sanitizeHTML($string));
}
/**
@@ -262,7 +262,7 @@ function html_select_options($options, $selected, $params=array()) {
$label = $label[$label_name];
}
$select = in_array($value, $selected) ? ' selected="selected"' : '';
- $html .= '<option value="' . OC_Util::sanitizeHTML($value) . '"' . $select . '>' . OC_Util::sanitizeHTML($label) . '</option>'."\n";
+ $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n";
}
return $html;
}
diff --git a/lib/private/util.php b/lib/private/util.php
index c31ad63b9be..eb188b649e8 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -1177,14 +1177,16 @@ class OC_Util {
* This function is used to sanitize HTML and should be applied on any
* string or array of strings before displaying it on a web page.
*
- * @param string|array &$value
+ * @param string|array $value
* @return string|array an array of sanitized strings or a single sanitized string, depends on the input parameter.
*/
- public static function sanitizeHTML(&$value) {
+ public static function sanitizeHTML($value) {
if (is_array($value)) {
- array_walk_recursive($value, 'OC_Util::sanitizeHTML');
+ $value = array_map(function($value) {
+ return self::sanitizeHTML($value);
+ }, $value);
} else {
- //Specify encoding for PHP<5.4
+ // Specify encoding for PHP<5.4
$value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
}
return $value;