diff options
author | Colin Smith <colin@pfsense.org> | 2005-07-13 20:42:04 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-07-13 20:42:04 +0000 |
commit | ddce8ef2e434da2ce81836e4ab3a9803855f9b79 (patch) | |
tree | 573b9c1b0d2d6db8b24efd608c6db8fb620438f5 /etc | |
parent | e315cfa19af80ea75899afd68f619a0cdb608a7b (diff) | |
download | pfsense-ddce8ef2e434da2ce81836e4ab3a9803855f9b79.zip pfsense-ddce8ef2e434da2ce81836e4ab3a9803855f9b79.tar.gz |
Instead of making 10+ calls to str_replace(), use a single call + array.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/util.inc | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 7e8fcc7..fdda3b9 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -424,39 +424,11 @@ function arp_get_mac_by_ip($ip) { /* return a fieldname that is safe for xml usage */ function xml_safe_fieldname($fieldname) { - $fieldname = str_replace("/","",$fieldname); - $fieldname = str_replace("-","",$fieldname); - $fieldname = str_replace(" ","",$fieldname); - $fieldname = str_replace("!","",$fieldname); - $fieldname = str_replace("@","",$fieldname); - $fieldname = str_replace("#","",$fieldname); - $fieldname = str_replace("$","",$fieldname); - $fieldname = str_replace("%","",$fieldname); - $fieldname = str_replace("^","",$fieldname); - $fieldname = str_replace("&","",$fieldname); - $fieldname = str_replace("*","",$fieldname); - $fieldname = str_replace("(","",$fieldname); - $fieldname = str_replace(")","",$fieldname); - $fieldname = str_replace("_","",$fieldname); - $fieldname = str_replace("+","",$fieldname); - $fieldname = str_replace("=","",$fieldname); - $fieldname = str_replace("{","",$fieldname); - $fieldname = str_replace("}","",$fieldname); - $fieldname = str_replace("[","",$fieldname); - $fieldname = str_replace("]","",$fieldname); - $fieldname = str_replace("|","",$fieldname); - $fieldname = str_replace("\\","",$fieldname); - $fieldname = str_replace("/","",$fieldname); - $fieldname = str_replace("<","",$fieldname); - $fieldname = str_replace(">","",$fieldname); - $fieldname = str_replace("?","",$fieldname); - $fieldname = str_replace(":","",$fieldname); - $fieldname = str_replace(",","",$fieldname); - $fieldname = str_replace(".","",$fieldname); - $fieldname = str_replace("'","",$fieldname); - $fieldname = str_replace("\"","",$fieldname); - $fieldname = strtolower($fieldname); - return $fieldname; + $replace = array('/', '-', ' ', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', + '_', '+', '=', '{', '}', '[', ']', '|', '\', '/', '<', '>', '?', + ':', ',', '.', '\'', '\\' + ); + return strtolower(str_replace($replace, "", $fieldname)); } ?>
\ No newline at end of file |