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

File size: 783B
<?php

namespace MMO\Hide\BbCode\Tag;

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

        $title = \XF::phrase('mh_tag_likes_x_y', [
            'need_likes' => $tagOptions,
            'now_likes' => $like_count
        ]);

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

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