Twig updates

Moved non-global functions from twig back into PHP.
This commit is contained in:
Lee 2021-01-04 13:11:18 +00:00
parent 8c06bd1738
commit 5547ccffd6
3 changed files with 14 additions and 19 deletions

View File

@ -13,10 +13,19 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = "Creatures";
if (empty($_REQUEST['creature'])) {
$creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc');
$preview = config('creature_images_preview');
$creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc')->fetchAll();
if ($preview) {
foreach($creatures as $key => &$creature)
{
$creature['img_link'] = getCreatureImgPath($creature['name']);
}
}
$twig->display('creatures.html.twig', array(
'creatures' => $creatures->fetchAll(),
'preview' => config('creature_images_preview'),
'creatures' => $creatures,
'preview' => $preview
));
} else {

View File

@ -34,7 +34,7 @@
<div class="creatureImages">
<a href="{{ getMonsterLink(creature.name, false)|raw }}">
<div class="creature_img " style="background-image: url({{ creature.img_link }}"></div>
<img class=" {{ (creature.rewardboss ? 'creatureBoss' : '') }}" src="{{ getCreatureImgPath(creature.name) }}" border="0"/>
<img class=" {{ (creature.rewardboss ? 'creatureBoss' : '') }}" src="{{ creature.img_link }}" border="0"/>
</a>
<div>{{ creature.name }}</div>
</div>

View File

@ -24,11 +24,6 @@ $function = new TwigFunction('getStyle', function ($i) {
});
$twig->addFunction($function);
$function = new TwigFunction('getCreatureImgPath', function ($i) {
return getCreatureImgPath($i);
});
$twig->addFunction($function);
$function = new TwigFunction('getLink', function ($s) {
return getLink($s);
});
@ -55,19 +50,10 @@ $function = new TwigFunction('getGuildLink', function ($s, $p) {
$twig->addFunction($function);
$function = new TwigFunction('truncate', function ($s, $n) {
return truncate($s, $n);
return truncate($s, $n);
});
$twig->addFunction($function);
$function = new TwigFunction('getChangelogType', function ($n) {
return getChangelogType($n);
});
$twig->addFunction($function);
$function = new TwigFunction('getChangelogWhere', function ($n) {
return getChangelogWhere($n);
});
$twig->addFunction($function);
$function = new TwigFunction('hook', function ($hook) {
global $hooks;