mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
实体字符编码
This commit is contained in:
@@ -1620,6 +1620,34 @@ function toArrayObject(str){
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实体字符编码
|
||||
* @param {*} text 待编码的文本
|
||||
* @returns
|
||||
*/
|
||||
function entitiesEncode(text) {
|
||||
text = text.replace(/&/g, "&");
|
||||
text = text.replace(/</g, "<");
|
||||
text = text.replace(/>/g, ">");
|
||||
text = text.replace(/ /g, " ");
|
||||
text = text.replace(/"/g, """);
|
||||
return text;
|
||||
}
|
||||
/**
|
||||
* 实体字符解码
|
||||
* @param {*} text 待解码的文本
|
||||
* @returns
|
||||
*/
|
||||
function entitiesDecode(text) {
|
||||
text = text.replace(/&/g, "&");
|
||||
text = text.replace(/</g, "<");
|
||||
text = text.replace(/>/g, ">");
|
||||
text = text.replace(/ /g, " ");
|
||||
text = text.replace(/"/g, "'");
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
function pluginService(_name, version){
|
||||
var data = {name:_name, func:'status'}
|
||||
if ( typeof(version) != 'undefined' ){
|
||||
|
||||
Reference in New Issue
Block a user