Explorar o código

Update 'src/RequestResponse/Request.php'

ahwelp %!s(int64=7) %!d(string=hai) anos
pai
achega
0dada2ebbb
Modificáronse 1 ficheiros con 15 adicións e 15 borrados
  1. 15 15
      src/RequestResponse/Request.php

+ 15 - 15
src/RequestResponse/Request.php

@@ -148,12 +148,12 @@ class Request{
         switch ($type) {
             case self::PARAM_RAW:
                 // No cleaning at all.
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 return $param;
 
             case self::PARAM_RAW_TRIMMED:
                 // No cleaning, but strip leading and trailing whitespace.
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 return trim($param);
 
             case self::PARAM_INT:
@@ -198,12 +198,12 @@ class Request{
 
             case self::PARAM_NOTAGS:
                 // Strip all tags.
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 return strip_tags($param);
 
             case self::PARAM_TEXT:
                 // Leave only tags needed for multilang.
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 // If the multilang syntax is not correct we strip all tags because it would break xhtml strict which is required
                 // for accessibility standards please note this cleaning does not strip unbalanced '>' for BC compatibility reasons.
                 do {
@@ -293,7 +293,7 @@ class Request{
 
             case self::PARAM_FILE:
                 // Strip all suspicious characters from filename.
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 $param = preg_replace('~[[:cntrl:]]|[&<>"`\|\':\\\\/]~u', '', $param);
                 if ($param === '.' || $param === '..') {
                     $param = '';
@@ -302,7 +302,7 @@ class Request{
 
             case self::PARAM_PATH:
                 // Strip all suspicious characters from file path.
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 $param = str_replace('\\', '/', $param);
 
                 // Explode the path and clean each element using the PARAM_FILE rules.
@@ -347,7 +347,7 @@ class Request{
                 return $param;
 
             case self::PARAM_URL:          // Allow safe ftp, http, mailto urls.
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 if (!empty($param) && self::validateUrlSyntax($param, 's?H?S?F?E?u-P-a?I?p?f?q?r?')) {
                     // All is ok, param is respected.
                 } else {
@@ -406,7 +406,7 @@ class Request{
                 }
 
             case self::PARAM_TAGLIST:
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 $tags = explode(',', $param);
                 $result = array();
                 foreach ($tags as $tag) {
@@ -422,7 +422,7 @@ class Request{
                 }
 
             case self::PARAM_USERNAME:
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 $param = trim($param);
                 // Convert uppercase to lowercase MDL-16919.
                 $param = core_text::strtolower($param);
@@ -435,7 +435,7 @@ class Request{
                 return $param;
 
             case self::PARAM_EMAIL:
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 if (validate_email($param)) {
                     return $param;
                 } else {
@@ -451,7 +451,7 @@ class Request{
 
             case self::PARAM_TIMEZONE:
                 // Can be int, float(with .5 or .0) or string seperated by '/' and can have '-_'.
-                $param = fix_utf8($param);
+                $param = self::fix_utf8($param);
                 $timezonepattern = '/^(([+-]?(0?[0-9](\.[5|0])?|1[0-3](\.0)?|1[0-2]\.5))|(99)|[[:alnum:]]+(\/?[[:alpha:]_-])+)$/';
                 if (preg_match($timezonepattern, $param)) {
                     return $param;
@@ -465,7 +465,7 @@ class Request{
         }
     }
 
-    function fix_utf8($value) {
+    private static function fix_utf8($value) {
         if (is_null($value) or $value === '') {
             return $value;
 
@@ -477,7 +477,7 @@ class Request{
             // No null bytes expected in our data, so let's remove it.
             $value = str_replace("\0", '', $value);
 
-            // Note: this duplicates min_fix_utf8() intentionally.
+            // Note: this duplicates min_self::self::fix_utf8() intentionally.
             static $buggyiconv = null;
             if ($buggyiconv === null) {
                 $buggyiconv = (!function_exists('iconv') or @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
@@ -503,7 +503,7 @@ class Request{
 
         } else if (is_array($value)) {
             foreach ($value as $k => $v) {
-                $value[$k] = fix_utf8($v);
+                $value[$k] = self::fix_utf8($v);
             }
             return $value;
 
@@ -511,7 +511,7 @@ class Request{
             // Do not modify original.
             $value = clone($value);
             foreach ($value as $k => $v) {
-                $value->$k = fix_utf8($v);
+                $value->$k = self::fix_utf8($v);
             }
             return $value;