projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9e2759e
)
More luci.util optimizations
author
Steven Barth
<steven@midlink.org>
Wed, 10 Sep 2008 12:47:21 +0000
(12:47 +0000)
committer
Steven Barth
<steven@midlink.org>
Wed, 10 Sep 2008 12:47:21 +0000
(12:47 +0000)
libs/core/luasrc/util.lua
patch
|
blob
|
history
diff --git
a/libs/core/luasrc/util.lua
b/libs/core/luasrc/util.lua
index
c84df1a
..
95491cf
100644
(file)
--- a/
libs/core/luasrc/util.lua
+++ b/
libs/core/luasrc/util.lua
@@
-194,13
+194,13
@@
end
-- @param value String value containing the data to escape
-- @return String value containing the escaped data
function pcdata(value)
-- @param value String value containing the data to escape
-- @return String value containing the escaped data
function pcdata(value)
- if not value then return end
- value = tostring(value)
- value = value:gsub("&", "&")
- value = value:gsub('"', """)
- value = value:gsub("'", "'")
- value = value:gsub("<", "<")
-
return value:gsub(">", ">"
)
+ return value and tostring(value):gsub("[&\"'<>]", {
+ ["&"] = "&",
+ ['"'] = """,
+ ["'"] = "'",
+ ["<"] = "<",
+ [">"] = ">"
+
}
)
end
--- Strip HTML tags from given string.
end
--- Strip HTML tags from given string.
@@
-567,13
+567,12
@@
function _sortiter( t, f )
end
local _pos = 0
end
local _pos = 0
- local _len = table.getn( keys )
table.sort( keys, f )
return function()
_pos = _pos + 1
table.sort( keys, f )
return function()
_pos = _pos + 1
- if _pos <=
_len
then
+ if _pos <=
#keys
then
return keys[_pos], t[keys[_pos]]
end
end
return keys[_pos], t[keys[_pos]]
end
end