Forked from
ffbs / ffbs-gluon
3231 commits behind the upstream repository.
-
Matthias Schiffer authoredMatthias Schiffer authored
luci.lua 449 B
-- Config mode utility functions
local string = string
module 'gluon.luci'
function escape(s)
return (string.gsub(s, '[<>&"]', {
['<'] = '<',
['>'] = '>',
['&'] = '&',
['"'] = '"',
}))
end
function urlescape(s)
return (string.gsub(s, '[^a-zA-Z0-9%-_%.~]',
function(c)
local ret = ''
for i = 1, string.len(c) do
ret = ret .. string.format('%%%02X', string.byte(c, i, i))
end
return ret
end
))
end