瀏覽代碼

[php] added php.Global.mb_scrub()

Aleksandr Kuzmenko 5 年之前
父節點
當前提交
8ef13067b9
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. 5 0
      std/php/Global.hx
  2. 10 0
      std/php/_polyfills.php

+ 5 - 0
std/php/Global.hx

@@ -1047,6 +1047,11 @@ extern class Global {
 	**/
 	static function mb_check_encoding(str:String = null, ?encoding:String):Bool;
 
+	/**
+		@see http://php.net/manual/en/function.mb-scrub.php
+	**/
+	static function mb_scrub(str:String, ?encoding:String):String;
+
 	/**
 		@see http://php.net/manual/en/function.mb-split.php
 	**/

+ 10 - 0
std/php/_polyfills.php

@@ -50,4 +50,14 @@ namespace { //Namespace declaration is required because this file is included un
 		}
 	}
 
+	/**
+	 * @see http://php.net/manual/en/function.mb-scrub.php
+	 */
+	if(!function_exists('mb_scrub')) {
+		function mb_scrub($s, $encoding = null) {
+			$encoding = null === $encoding ? mb_internal_encoding() : $encoding;
+			return mb_convert_encoding($s, $encoding, $encoding);
+		}
+	}
+
 }