mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-26 00:23:33 +03:00
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
|
* @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'))
|
if ( ! function_exists('component'))
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,6 +37,6 @@ if ( ! function_exists('lang'))
|
||||||
$result = '<label for="' . $for . '"' . _stringify_attributes($attributes) . '>' . $result . '</label>';
|
$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">
|
<img src="<?= vars('company_logo') ?: base_url('assets/img/logo.png') ?>" alt="logo" id="company-logo">
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
<?= $company_name ?>
|
<?= e($company_name) ?>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="d-flex justify-content-center justify-content-md-start">
|
<div class="d-flex justify-content-center justify-content-md-start">
|
||||||
|
|
Loading…
Reference in a new issue