View file upload/src/addons/MMO/Hide/BbCode/Tag/HideTrophies.php

File size: 801B
<?php

namespace MMO\Hide\BbCode\Tag;

class HideTrophies extends AbstractTag
{
    /**
     * @inheritDoc
     */
    public function render($content, array $tagChildren, $tagOption, array $tag, array $options)
    {
        $canView = false;
        $tagOptions = intval($tagOption);
        $trophy_count = $this->visitor()->trophy_points;

        $title = \XF::phrase('mh_tag_trophies_x_y', [
            'need_trophies' => $tagOptions,
            'now_trophies' => $trophy_count
        ]);

        if ($tagOptions <= $trophy_count)
        {
            $canView = true;
        }

        return $this->renderTemplate($content, $title, [
            'canView' => $canView,
            'options' => $options,
            'tag' => $tag['tag']
        ]);
    }
}