if (!
in_array($context,
['html', 'js', 'css', 'url', 'attr'
], true
)) { throw new InvalidArgumentException('Invalid escape context provided.'
);
} $method =
$context === 'attr' ? 'escapeHtmlAttr' : 'escape' .
ucfirst($context);
static $escaper;
if (!
$escaper) { $escaper =
new Escaper($encoding);
} if ($encoding &&
$escaper->
getEncoding() !==
$encoding) { $escaper =
new Escaper($encoding);
} $data =
$escaper->
{$method}($data);
} return $data;
}}if (!
function_exists('force_https'
)) {