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
|
* @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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Local variables.
|
* Local variables.
|
||||||
*
|
*
|
||||||
* @var string $company_name
|
* @var string $company_name
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
@ -9,11 +9,11 @@
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<div id="company-name">
|
<div id="company-name">
|
||||||
<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">
|
||||||
<span class="display-selected-service me-1 pe-1 border-end invisible">
|
<span class="display-selected-service me-1 pe-1 border-end invisible">
|
||||||
<?= lang('service') ?>
|
<?= lang('service') ?>
|
||||||
|
|
Loading…
Reference in a new issue