<?php /** * @package com_speasyimagegallery * @author JoomShaper http://www.joomshaper.com * @copyright Copyright (c) 2010 - 2021 JoomShaper * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Factory; use Joomla\CMS\Log\Log; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView; jimport('joomla.filesystem.file'); jimport('joomla.application.component.helper'); class SpeasyimagegalleryViewAlbums extends HtmlView { protected $items; protected $params; function display($tpl = null) { // Assign data to the view $this->items = $this->get('Items'); $app = Factory::getApplication(); $this->params = $app->getParams(); $menus = Factory::getApplication()->getMenu(); $menu = $menus->getActive(); $this->pagination = $this->get('Pagination'); if($menu) { $this->params->merge($menu->getParams()); } // Check for errors. if (count($errors = $this->get('Errors'))) { Log::add(implode('<br />', $errors), Log::WARNING, 'jerror'); return false; } $this->_prepareDocument(); parent::display($tpl); } protected function _prepareDocument() { $app = Factory::getApplication(); $menus = $app->getMenu(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', Text::_('COM_SPEASYIMAGEGALLERY_DEFAULT_PAGE_TITLE')); } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = $app->get('sitename'); } elseif ($app->get('sitename_pagetitles', 0) == 1) { $title = Text::sprintf('JPAGETITLE', $app->get('sitename'), $title); } elseif ($app->get('sitename_pagetitles', 0) == 2) { $title = Text::sprintf('JPAGETITLE', $title, $app->get('sitename')); } $this->document->setTitle($title); if ($this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } } }