mirror of
https://github.com/openwrt/luci.git
synced 2026-04-15 19:01:56 +00:00
luci-base(-libs): move pcdata() and striptags() from util- to xml-class
To complete the previous commit these functions are defined in the resulting luci-base package but are also used in the new luci-base-libs package. So move them into the new xml-module of the new package. Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
This commit is contained in:
committed by
Jo-Philipp Wich
parent
8b8d83e42d
commit
68521fca04
@@ -159,8 +159,12 @@ end
|
||||
-- String and data manipulation routines
|
||||
--
|
||||
|
||||
-- compatibility wrapper for xml.pcdata
|
||||
function pcdata(value)
|
||||
return value and tparser.pcdata(tostring(value))
|
||||
local xml = require "luci.xml"
|
||||
|
||||
perror("luci.util.pcdata() has been replaced by luci.xml.pcdata() - Please update your code.")
|
||||
return xml.pcdata(value)
|
||||
end
|
||||
|
||||
function urlencode(value)
|
||||
@@ -182,8 +186,12 @@ function urldecode(value, decode_plus)
|
||||
return nil
|
||||
end
|
||||
|
||||
-- compatibility wrapper for xml.striptags
|
||||
function striptags(value)
|
||||
return value and tparser.striptags(tostring(value))
|
||||
local xml = require "luci.xml"
|
||||
|
||||
perror("luci.util.striptags() has been replaced by luci.xml.striptags() - Please update your code.")
|
||||
return xml.striptags(value)
|
||||
end
|
||||
|
||||
function shellquote(value)
|
||||
@@ -343,8 +351,6 @@ function parse_units(ustr)
|
||||
end
|
||||
|
||||
-- also register functions above in the central string class for convenience
|
||||
string.pcdata = pcdata
|
||||
string.striptags = striptags
|
||||
string.split = split
|
||||
string.trim = trim
|
||||
string.cmatch = cmatch
|
||||
|
||||
@@ -70,10 +70,13 @@ Recursively dumps a table to stdout, useful for testing and debugging.
|
||||
---[[
|
||||
Create valid XML PCDATA from given string.
|
||||
|
||||
This is just a compatibility wrapper for luci.xml.padata()
|
||||
|
||||
@class function
|
||||
@name pcdata
|
||||
@param value String value containing the data to escape
|
||||
@return String value containing the escaped data
|
||||
@see luci.xml.pcdata
|
||||
]]
|
||||
|
||||
---[[
|
||||
@@ -100,10 +103,13 @@ URL-encode given string.
|
||||
---[[
|
||||
Strip HTML tags from given string.
|
||||
|
||||
This is just a compatibility wrapper for luci.xml.striptags()
|
||||
|
||||
@class function
|
||||
@name striptags
|
||||
@param value String containing the HTML text
|
||||
@return String with HTML tags stripped of
|
||||
@see luci.xml.striptags
|
||||
]]
|
||||
|
||||
---[[
|
||||
|
||||
Reference in New Issue
Block a user