forked from mirrors/easyappointments
Add a new string escape helper function
This commit is contained in:
parent
10ce6bbf11
commit
9a6233ad3a
3 changed files with 24 additions and 5 deletions
|
@ -11,6 +11,25 @@
|
|||
* @since v1.4.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
if ( ! function_exists('e'))
|
||||
{
|
||||
/**
|
||||
* HTML escape function for templates.
|
||||
*
|
||||
* Use this helper function to easily escape all the outputted HTML markup.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* <?= e($string) ?>
|
||||
*
|
||||
* @param mixed $string Provide anything that can be converted to a string.
|
||||
*/
|
||||
function e(mixed $string): string
|
||||
{
|
||||
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('component'))
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,6 @@ if ( ! function_exists('lang'))
|
|||
$result = '<label for="' . $for . '"' . _stringify_attributes($attributes) . '>' . $result . '</label>';
|
||||
}
|
||||
|
||||
return $result ?: $line;
|
||||
return e($result ?: $line);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<img src="<?= vars('company_logo') ?: base_url('assets/img/logo.png') ?>" alt="logo" id="company-logo">
|
||||
|
||||
<span>
|
||||
<?= $company_name ?>
|
||||
<?= e($company_name) ?>
|
||||
</span>
|
||||
|
||||
<div class="d-flex justify-content-center justify-content-md-start">
|
||||
|
|
Loading…
Reference in a new issue