util::var_subst_quotehtml (public)

 util::var_subst_quotehtml [ -ulevel ulevel ] string

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

Substitute in the provided string all variables with their values (like "subst -nobackslashes -nocommands ..."), and perform HTML quoting on the variable values before substitution. This command supports Tcl array syntax, and Tcl scalar variables with and without curly braces.

Switches:
-ulevel
(defaults to "1") (optional)
Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope.
Parameters:
string
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 ad_form ad_form (public) util::var_subst_quotehtml util::var_subst_quotehtml ad_form->util::var_subst_quotehtml template::element::validate template::element::validate (private) template::element::validate->util::var_subst_quotehtml

Testcases:
No testcase defined.
Source code:
    #
    # Protect evaluation characters
    #
    set escaped [string map {[ \\[ ] \\] \\ \\\\} $string]
    #
    # Handle array syntax:
    #
    regsub -all -- {\$([0-9a-zA-Z_:]*[\(][^\)]+[\)])} $escaped {[ns_quotehtml [set \1]]} escaped
    #
    # Handle plain variables:
    #
    regsub -all -- {\$([0-9a-zA-Z_:]+|[\{][^\}]+[\}])} $escaped {[ns_quotehtml $\1]} result
    #
    # Finally, "subst" the result.
    #
    return [uplevel $ulevel [list ::subst $result]]
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: