HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers59/ferrumbv.nl/wwwroot/lib/ui/read_more.class.php
<?php
/**
 * Created by PhpStorm.
 * User: mike
 * Date: 08/10/14
 * Time: 13:32
 */

class UI_Read_More
{
    // English name of the page
    private $_pageName;

    // Language array
    private $_lang;

    public function __construct($pageName)
    {
        $this->_pageName = $pageName;

        // Translate
        $Translator = new Translator(URL_LANG);
        $this->_lang = $Translator->get();
    }

    public function create($data,$current)
    {
        $nextTitle = $output = '';
        $nextComingUp = false;

        // Loop through data to find current & next item
        foreach($data['entity'] as $entity)
        {
            if( ! isset($entity['title'])) continue;

            // Do we have the next title ?
            if($nextComingUp && $nextTitle == '') $nextTitle = $entity['title'];

            // If this is the current item, the item we need is coming up next.
            if($entity['title'] == $current['title'])
            {
                $nextComingUp = true;
            }
        }

        // If there is a next item
        if( ! empty($nextTitle))
        {
            $url = SITE_ROOT . Fn::encodeUrl($this->_lang[$this->_pageName]);

            $urlTitle = Fn::encodeUrl($nextTitle);
            $output .= '<a href="' . $url . '/' . $urlTitle . '" class="btn right">
                        ' . $nextTitle . '
                        <span class="arrow"></span>
                        </a>';

        }

        return $output;
    }
}