. */ use Alledia\OSMap\Factory; use Alledia\OSMap\Helper\General; use Joomla\CMS\Application\SiteApplication; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView; // phpcs:disable PSR1.Files.SideEffects defined('_JEXEC') or die(); // phpcs:enable PSR1.Files.SideEffects // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace class OsmapViewXsl extends HtmlView { /** * @var SiteApplication */ protected $app = null; /** * @var string */ protected $pageHeading = null; /** * @var string */ protected $pageTitle = null; /** * @var string */ protected $language = null; /** * @inheritDoc * @throws Exception */ public function __construct($config = []) { parent::__construct($config); $this->app = Factory::getApplication(); } /** * @inheritDoc */ public function display($tpl = null) { $document = $this->app->getDocument(); $this->language = $document->getLanguage(); $menu = $this->app->getMenu()->getActive(); $isOsmap = $menu && $menu->query['option'] == 'com_osmap'; $params = $this->app->getParams(); $type = General::getSitemapTypeFromInput(); $sitemap = Factory::getSitemap($this->app->input->getInt('id'), $type); $title = $params->get('page_title', ''); if ($isOsmap == false) { $title = $sitemap->name ?: $title; } if (empty($title)) { $title = $this->app->get('sitename'); } elseif ($this->app->get('sitename_pagetitles', 0) == 1) { $title = Text::sprintf('JPAGETITLE', $this->app->get('sitename'), $title); } elseif ($this->app->get('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $this->app->get('sitename')); } $this->pageTitle = $this->escape($title); if ($isOsmap && $params->get('show_page_heading')) { $this->pageHeading = $this->escape($params->get('page_heading') ?: $sitemap->name); } // We're going to cheat Joomla here because some referenced urls MUST remain http/insecure header(sprintf('Content-Type: text/xsl; charset="%s"', $this->_charset)); header('Content-Disposition: inline'); parent::display($tpl); jexit(); } }