create method for savely printing text
This commit is contained in:
parent
f83048f8dc
commit
ab4c1fde6d
5 changed files with 33 additions and 6 deletions
|
|
@ -19,6 +19,33 @@
|
||||||
*/
|
*/
|
||||||
class Utils
|
class Utils
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mask HTML-chars for save output.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @param string $string String to be masked
|
||||||
|
* @return string Masked string
|
||||||
|
*/
|
||||||
|
static function t($string)
|
||||||
|
{
|
||||||
|
return nl2br(htmlspecialchars($string));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ‚htmlspecialchars‘ with support for UTF-8.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @param string $string String to be masked
|
||||||
|
* @return string Masked string
|
||||||
|
*/
|
||||||
|
public static function htmlspecialchars_utf8($string)
|
||||||
|
{
|
||||||
|
return htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<h3><?=$questgroupshierarchy['title_singular']?> <?=$questgroup['pos']?>: <?=$questgroup['title']?></h3>
|
<h3><?=$questgroupshierarchy['title_singular']?> <?=$questgroup['pos']?>: <?=$questgroup['title']?></h3>
|
||||||
<?php foreach($texts as &$text) : ?>
|
<?php foreach($texts as &$text) : ?>
|
||||||
<p><?=$text['text']?></p>
|
<p><?=\hhu\z\Utils::t($text['text'])?></p>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|
||||||
<?php foreach($childquestgroupshierarchy as &$hierarchy) : ?>
|
<?php foreach($childquestgroupshierarchy as &$hierarchy) : ?>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<section>
|
<section>
|
||||||
<h1><?=$questtext['type']?></h1>
|
<h1><?=$questtext['type']?></h1>
|
||||||
<p><?=$questtext['text']?></p>
|
<p><?=\hhu\z\Utils::t($questtext['text'])?></p>
|
||||||
|
|
||||||
<?php if(!empty($questtext['sidequests'])) : ?>
|
<?php if(!empty($questtext['sidequests'])) : ?>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
@ -35,6 +35,6 @@
|
||||||
<?php if($showtask) : ?>
|
<?php if($showtask) : ?>
|
||||||
<section>
|
<section>
|
||||||
<h1><?=_('Task')?></h1>
|
<h1><?=_('Task')?></h1>
|
||||||
<p><?=$quest['task']?></p>
|
<p><?=\hhu\z\Utils::t($quest['task'])?></p>
|
||||||
</section>
|
</section>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<section>
|
<section>
|
||||||
<h1><?=$sidequesttext['type']?></h1>
|
<h1><?=$sidequesttext['type']?></h1>
|
||||||
<p><?=$sidequesttext['text']?></p>
|
<p><?=\hhu\z\Utils::t($sidequesttext['text'])?></p>
|
||||||
|
|
||||||
<?php if(!empty($sidequesttext['out_text'])) : ?>
|
<?php if(!empty($sidequesttext['out_text'])) : ?>
|
||||||
<?php if(!empty($sidequesttext['abort_text'])) : ?>
|
<?php if(!empty($sidequesttext['abort_text'])) : ?>
|
||||||
|
|
@ -33,6 +33,6 @@
|
||||||
<?php if($showtask) : ?>
|
<?php if($showtask) : ?>
|
||||||
<section>
|
<section>
|
||||||
<h1><?=_('Task')?></h1>
|
<h1><?=_('Task')?></h1>
|
||||||
<p><?=$sidequest['task']?></p>
|
<p><?=\hhu\z\Utils::t(($sidequest['task'])?></p>
|
||||||
</section>
|
</section>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<?=sprintf(_('created by %s on %s'), $seminary['creator']['username'], $dateFormatter->format(new \DateTime($seminary['created'])))?>
|
<?=sprintf(_('created by %s on %s'), $seminary['creator']['username'], $dateFormatter->format(new \DateTime($seminary['created'])))?>
|
||||||
</p>
|
</p>
|
||||||
<h3>Beschreibung</h3>
|
<h3>Beschreibung</h3>
|
||||||
<p><?=$seminary['description']?></p>
|
<p><?=\hhu\z\Utils::t($seminary['description'])?></p>
|
||||||
|
|
||||||
<?php foreach($questgroupshierarchy as &$hierarchy) : ?>
|
<?php foreach($questgroupshierarchy as &$hierarchy) : ?>
|
||||||
<h3><?=$hierarchy['title_plural']?></h3>
|
<h3><?=$hierarchy['title_plural']?></h3>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue