mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Implement better contextual escape for template v2
This commit is contained in:
parent
baadb36e37
commit
9689a1ed68
2 changed files with 21 additions and 4 deletions
|
|
@ -955,6 +955,23 @@ class Template
|
|||
return UA::isMobile() && (config('mobile.tablets') || !UA::isTablet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Contextual escape function for v2.
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
protected function _v2_escape(string $str, string $type = ''): string
|
||||
{
|
||||
switch ($this->config->context)
|
||||
{
|
||||
case 'CSS': return escape_css($str);
|
||||
case 'JS': return escape_js($str);
|
||||
default: return escape($str);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lang shortcut for v2.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue