primo commit
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Factory;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
Factory::getApplication()->input->set('tmpl', 'component');
|
||||
|
||||
if (empty($this->message)) :
|
||||
echo $this->loadTemplate('items');
|
||||
|
||||
else : ?>
|
||||
<div class="alert alert-warning">
|
||||
<?php echo $this->message; ?>
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
jexit();
|
||||
@ -0,0 +1,217 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Version;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
|
||||
$frequncyOptions = HTMLHelper::_('osmap.frequencyList');
|
||||
array_walk(
|
||||
$frequncyOptions,
|
||||
function (string &$text, string $value) {
|
||||
$text = HTMLHelper::_('select.option', $value, $text);
|
||||
}
|
||||
);
|
||||
|
||||
$priorityOptions = array_map(
|
||||
function (float $priority) {
|
||||
return HTMLHelper::_('select.option', $priority, $priority);
|
||||
},
|
||||
HTMLHelper::_('osmap.priorityList')
|
||||
);
|
||||
|
||||
$showItemUid = $this->osmapParams->get('show_item_uid', 0);
|
||||
$showExternalLinks = (int)$this->osmapParams->get('show_external_links', 0);
|
||||
$items = [];
|
||||
|
||||
$this->sitemap->traverse(
|
||||
/**
|
||||
* @param object $item
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function (object $item) use (&$items, &$showItemUid, &$showExternalLinks) {
|
||||
if (
|
||||
($item->isInternal == false && $showExternalLinks === 0)
|
||||
|| $item->hasCompatibleLanguage() == false
|
||||
) :
|
||||
return false;
|
||||
endif;
|
||||
|
||||
if ($showExternalLinks === 2) :
|
||||
// Display only in the HTML sitemap
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_IGNORED_EXTERNAL_HTML');
|
||||
endif;
|
||||
|
||||
// Add notes about sitemap visibility
|
||||
if ($item->visibleForXML == false) :
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_VISIBLE_HTML_ONLY');
|
||||
endif;
|
||||
|
||||
if ($item->visibleForHTML == false) :
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_VISIBLE_XML_ONLY');
|
||||
endif;
|
||||
|
||||
if ($item->visibleForRobots == false) :
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_INVISIBLE_FOR_ROBOTS');
|
||||
endif;
|
||||
|
||||
if ($item->parentIsVisibleForRobots == false) :
|
||||
$item->addAdminNote('COM_OSMAP_ADMIN_NOTE_PARENT_INVISIBLE_FOR_ROBOTS');
|
||||
endif;
|
||||
|
||||
$items[] = $item;
|
||||
|
||||
return true;
|
||||
},
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
$count = count($items);
|
||||
?>
|
||||
<table class="adminlist table table-striped" id="itemList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 1%;min-width:55px" class="text-center center">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_STATUS'); ?>
|
||||
</th>
|
||||
|
||||
<th class="title">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_URL'); ?>
|
||||
</th>
|
||||
|
||||
<th class="title">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_TITLE'); ?>
|
||||
</th>
|
||||
|
||||
<th class="text-center center">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_PRIORITY'); ?>
|
||||
</th>
|
||||
|
||||
<th class="text-center center">
|
||||
<?php echo Text::_('COM_OSMAP_HEADING_CHANGE_FREQ'); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($items as $row => $item) : ?>
|
||||
<tr class="sitemapitem <?php echo 'row' . $row; ?> <?php echo ($showItemUid) ? 'with-uid' : ''; ?>"
|
||||
data-uid="<?php echo $item->uid; ?>"
|
||||
data-settings-hash="<?php echo $item->settingsHash; ?>">
|
||||
|
||||
<td class="text-center center">
|
||||
<div class="sitemapitem-published"
|
||||
data-original="<?php echo $item->published ? '1' : '0'; ?>"
|
||||
data-value="<?php echo $item->published ? '1' : '0'; ?>">
|
||||
|
||||
<?php
|
||||
$class = $item->published ? 'publish' : 'unpublish';
|
||||
$title = $item->published
|
||||
? 'COM_OSMAP_TOOLTIP_CLICK_TO_UNPUBLISH'
|
||||
: 'COM_OSMAP_TOOLTIP_CLICK_TO_PUBLISH';
|
||||
?>
|
||||
|
||||
<span title="<?php echo Text::_($title); ?>"
|
||||
class="hasTooltip icon-<?php echo $class; ?>">
|
||||
</span>
|
||||
</div>
|
||||
<?php
|
||||
if ($notes = $item->getAdminNotesString()) : ?>
|
||||
<span class="icon-warning hasTooltip osmap-info" title="<?php echo $notes; ?>"></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<td class="sitemapitem-link">
|
||||
<?php if ($item->level > 0) : ?>
|
||||
<span class="level-mark"><?php echo str_repeat('—', $item->level); ?></span>
|
||||
<?php endif;
|
||||
|
||||
if ($item->rawLink !== '#' && $item->link !== '#') :
|
||||
if (Version::MAJOR_VERSION < 4) :
|
||||
echo '<span class="icon-new-tab"></span>';
|
||||
endif;
|
||||
|
||||
echo HTMLHelper::_(
|
||||
'link',
|
||||
$item->rawLink,
|
||||
$item->rawLink,
|
||||
[
|
||||
'target' => '_blank',
|
||||
'class' => 'hasTooltip',
|
||||
'title' => $item->link,
|
||||
]
|
||||
);
|
||||
|
||||
else :
|
||||
echo sprintf('<span>%s</span>', $item->name ?? '');
|
||||
endif;
|
||||
|
||||
if ($showItemUid) :
|
||||
echo sprintf(
|
||||
'<br><div class="small osmap-item-uid">%s: %s</div>',
|
||||
Text::_('COM_OSMAP_UID'),
|
||||
$item->uid
|
||||
);
|
||||
endif;
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td class="sitemapitem-name">
|
||||
<?php echo $item->name ?? ''; ?>
|
||||
</td>
|
||||
|
||||
<td class="text-center center">
|
||||
<div class="sitemapitem-priority"
|
||||
data-original="<?php echo $item->priority; ?>"
|
||||
data-value="<?php echo sprintf('%03.1f', $item->priority); ?>">
|
||||
|
||||
<?php echo sprintf('%03.1f', $item->priority); ?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="text-center center">
|
||||
<div class="sitemapitem-changefreq"
|
||||
data-original="<?php echo $item->changefreq; ?>"
|
||||
data-value="<?php echo $item->changefreq; ?>">
|
||||
|
||||
<?php echo Text::_('COM_OSMAP_' . strtoupper($item->changefreq)); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div><?php echo Text::sprintf('COM_OSMAP_NUMBER_OF_ITEMS_FOUND', $count); ?></div>
|
||||
|
||||
<?php if (empty($count)) : ?>
|
||||
<div class="alert alert-warning">
|
||||
<?php echo Text::_('COM_OSMAP_NO_ITEMS'); ?>
|
||||
</div>
|
||||
<?php endif;
|
||||
108
components/com_osmap/views/adminsitemapitems/view.html.php
Normal file
108
components/com_osmap/views/adminsitemapitems/view.html.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Component\Helper as ComponentHelper;
|
||||
use Alledia\OSMap\Factory;
|
||||
use Alledia\OSMap\Sitemap\SitemapInterface;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
use Joomla\Input\Input;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
class OSMapViewAdminSitemapItems extends HtmlView
|
||||
{
|
||||
/**
|
||||
* @var Registry
|
||||
*/
|
||||
protected $params = null;
|
||||
|
||||
/**
|
||||
* @var SitemapInterface
|
||||
*/
|
||||
protected $sitemap = null;
|
||||
|
||||
/**
|
||||
* @var Registry
|
||||
*/
|
||||
protected $osmapParams = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $message = null;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws Exception
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->checkAccess();
|
||||
|
||||
$container = Factory::getPimpleContainer();
|
||||
|
||||
try {
|
||||
$id = $container->input->getInt('id');
|
||||
|
||||
$this->params = Factory::getApplication()->getParams();
|
||||
|
||||
// Load the sitemap instance
|
||||
$this->sitemap = Factory::getSitemap($id);
|
||||
$this->osmapParams = ComponentHelper::getParams();
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->message = $e->getMessage();
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* This view should only be available from the backend
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkAccess()
|
||||
{
|
||||
$server = new Input(array_change_key_case($_SERVER, CASE_LOWER));
|
||||
$referer = parse_url($server->getString('http_referer'));
|
||||
|
||||
if (empty($referer['query']) == false) {
|
||||
parse_str($referer['query'], $query);
|
||||
|
||||
$option = empty($query['option']) ? null : $query['option'];
|
||||
$view = empty($query['view']) ? null : $query['view'];
|
||||
|
||||
if ($option == 'com_osmap' && $view == 'sitemapitems') {
|
||||
// Good enough
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception(Text::_('JERROR_PAGE_NOT_FOUND'), 404);
|
||||
}
|
||||
}
|
||||
71
components/com_osmap/views/html/tmpl/default.php
Normal file
71
components/com_osmap/views/html/tmpl/default.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
if ($this->params->get('use_css', 1)) :
|
||||
HTMLHelper::_('stylesheet', 'com_osmap/sitemap_html.min.css', ['relative' => true]);
|
||||
endif;
|
||||
|
||||
if ($this->debug) :
|
||||
Factory::getApplication()->input->set('tmpl', 'component');
|
||||
HTMLHelper::_('stylesheet', 'com_osmap/sitemap_html_debug.min.css', ['relative' => true]);
|
||||
endif;
|
||||
|
||||
if ($this->params->get('menu_text') !== null) :
|
||||
// We have a menu, so let's use its params to display the heading
|
||||
$pageHeading = $this->params->get('page_heading', $this->params->get('page_title'));
|
||||
else :
|
||||
// We don't have a menu, so lets use the sitemap name
|
||||
$pageHeading = $this->sitemap->name;
|
||||
endif;
|
||||
|
||||
$class = join(' ', array_filter([
|
||||
'osmap-sitemap',
|
||||
$this->debug ? 'osmap-debug' : '',
|
||||
$this->params->get('pageclass_sfx', '')
|
||||
]));
|
||||
?>
|
||||
|
||||
<div id="osmap" class="<?php echo $class; ?>">
|
||||
<!-- Heading -->
|
||||
<?php if ($this->params->get('show_page_heading', 1)) : ?>
|
||||
<div class="page-header">
|
||||
<h1><?php echo $this->escape($pageHeading); ?></h1>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Description -->
|
||||
<?php if ($this->params->get('show_sitemap_description', 1)) : ?>
|
||||
<div class="osmap-sitemap-description">
|
||||
<?php echo $this->params->get('sitemap_description', ''); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Items -->
|
||||
<?php echo $this->loadTemplate('items'); ?>
|
||||
</div>
|
||||
74
components/com_osmap/views/html/tmpl/default.xml
Normal file
74
components/com_osmap/views/html/tmpl/default.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_OSMAP_SITEMAP_HTML_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_OSMAP_SITEMAP_HTML_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<fields name="request">
|
||||
<fieldset name="request" addfieldpath="/administrator/components/com_osmap/form/fields">
|
||||
<field name="id"
|
||||
type="osmap.sitemaps"
|
||||
required="true"
|
||||
label="COM_OSMAP_SITEMAP"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<fields name="params">
|
||||
<fieldset name="basic" label="COM_OSMAP_FIELDSET_SITEMAP_SETTINGS_LABEL">
|
||||
<field name="debug"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="COM_OSMAP_OPTION_DEBUG_LABEL"
|
||||
description="COM_OSMAP_OPTION_DEBUG_DESC"
|
||||
default="0">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="use_css"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="COM_OSMAP_OPTION_USE_CSS_LABEL"
|
||||
description="COM_OSMAP_OPTION_USE_CSS_DESC"
|
||||
default="1">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="show_menu_titles"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="COM_OSMAP_OPTION_SHOW_MENU_TITLES_LABEL"
|
||||
description="COM_OSMAP_OPTION_SHOW_MENU_TITLES_DESC"
|
||||
default="1">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="show_sitemap_description"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="COM_OSMAP_SHOW_SITEMAP_DESCRIPTION_LABEL"
|
||||
description="COM_OSMAP_SHOW_SITEMAP_DESCRIPTION_DESC"
|
||||
default="0">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="sitemap_description"
|
||||
type="editor"
|
||||
label="COM_OSMAP_SITEMAP_DESCRIPTION_LABEL"
|
||||
description="COM_OSMAP_SITEMAP_DESCRIPTION_DESC"
|
||||
buttons="true"
|
||||
hide="pagebreak,readmore"
|
||||
filter="safehtml"
|
||||
showon="show_sitemap_description:1"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
||||
46
components/com_osmap/views/html/tmpl/default_items.php
Normal file
46
components/com_osmap/views/html/tmpl/default_items.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
if ($this->debug) : ?>
|
||||
<div class="osmap-debug-sitemap">
|
||||
<h1><?php echo Text::_('COM_OSMAP_DEBUG_ALERT_TITLE'); ?></h1>
|
||||
<p><?php echo Text::_('COM_OSMAP_DEBUG_ALERT'); ?></p>
|
||||
<?php echo Text::_('COM_OSMAP_SITEMAP_ID'); ?>: <?php echo $this->sitemap->id; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="osmap-items">
|
||||
<?php $this->sitemap->traverse([$this, 'registerNodeIntoList']); ?>
|
||||
<?php $this->renderSitemap(); ?>
|
||||
</div>
|
||||
|
||||
<?php if ($this->debug) : ?>
|
||||
<div class="osmap-debug-items-count">
|
||||
<?php echo Text::_('COM_OSMAP_SITEMAP_ITEMS_COUNT'); ?>: <?php echo $this->generalCounter; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
34
components/com_osmap/views/html/view.html.php
Normal file
34
components/com_osmap/views/html/view.html.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\View\Site\AbstractList;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
defined('_JEXEC') or die();
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
|
||||
class OSMapViewHtml extends AbstractList
|
||||
{
|
||||
}
|
||||
45
components/com_osmap/views/xml/tmpl/default.php
Normal file
45
components/com_osmap/views/xml/tmpl/default.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Language\Language;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/**
|
||||
* @var OsmapViewXml $this
|
||||
* @var object $template
|
||||
* @var string $layout
|
||||
* @var string $layoutTemplate
|
||||
* @var Language $lang
|
||||
* @var string $filetofind
|
||||
*/
|
||||
|
||||
echo sprintf('<?xml version="1.0" encoding="%s"?>' . "\n", $this->_charset);
|
||||
|
||||
if (empty($this->message)) {
|
||||
echo $this->loadTemplate($this->type);
|
||||
|
||||
} else {
|
||||
echo '<message>' . $this->message . '</message>';
|
||||
}
|
||||
56
components/com_osmap/views/xml/tmpl/default.xml
Normal file
56
components/com_osmap/views/xml/tmpl/default.xml
Normal file
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="COM_OSMAP_SITEMAP_XML_VIEW_DEFAULT_TITLE">
|
||||
<message>
|
||||
<![CDATA[COM_OSMAP_SITEMAP_XML_VIEW_DEFAULT_DESC]]>
|
||||
</message>
|
||||
</layout>
|
||||
|
||||
<fields name="request">
|
||||
<fieldset name="request"
|
||||
addfieldpath="/administrator/components/com_osmap/form/fields">
|
||||
|
||||
<field name="id"
|
||||
type="osmap.sitemaps"
|
||||
required="true"
|
||||
label="COM_OSMAP_SITEMAP"/>
|
||||
|
||||
<field name="format"
|
||||
type="hidden"
|
||||
default="xml"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
||||
<fields name="params">
|
||||
<fieldset name="basic"
|
||||
label="COM_OSMAP_FIELDSET_SITEMAP_SETTINGS_LABEL">
|
||||
|
||||
<field name="add_styling"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="COM_OSMAP_OPTION_ADD_STYLING_LABEL"
|
||||
description="COM_OSMAP_OPTION_ADD_STYLING_DESC"
|
||||
default="1">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="debug"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="COM_OSMAP_OPTION_DEBUG_LABEL"
|
||||
description="COM_OSMAP_OPTION_DEBUG_DESC"
|
||||
default="0">
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="news_publication_name"
|
||||
type="text"
|
||||
label="COM_OSMAP_NEWS_PUBLICATION_NAME_LABEL"
|
||||
description="COM_OSMAP_NEWS_PUBLICATION_NAME_DESC"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</metadata>
|
||||
93
components/com_osmap/views/xml/tmpl/default_images.php
Normal file
93
components/com_osmap/views/xml/tmpl/default_images.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Sitemap\Item;
|
||||
use Joomla\CMS\Language\Language;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/**
|
||||
* @var OSMapViewXml $this
|
||||
* @var string $template
|
||||
* @var string $layout
|
||||
* @var string $layoutTemplate
|
||||
* @var Language $lang
|
||||
* @var string $filetofind
|
||||
*/
|
||||
|
||||
$ignoreDuplicates = (int)$this->osmapParams->get('ignore_duplicated_uids', 1);
|
||||
|
||||
$printNodeCallback = function (Item $node) use ($ignoreDuplicates) {
|
||||
$display = !$node->ignore
|
||||
&& $node->published
|
||||
&& (!$node->duplicate || !$ignoreDuplicates)
|
||||
&& $node->visibleForRobots
|
||||
&& $node->parentIsVisibleForRobots
|
||||
&& $node->visibleForXML
|
||||
&& $node->isInternal
|
||||
&& trim($node->fullLink) != ''
|
||||
&& $node->hasCompatibleLanguage();
|
||||
|
||||
if ($display && !empty($node->images)) {
|
||||
echo '<url>';
|
||||
echo sprintf('<loc><![CDATA[%s]]></loc>', $node->fullLink);
|
||||
|
||||
foreach ($node->images as $image) {
|
||||
if (!empty($image->src)) {
|
||||
echo '<image:image>';
|
||||
echo '<image:loc><![CDATA[' . $image->src . ']]></image:loc>';
|
||||
echo empty($image->title)
|
||||
? '<image:title/>'
|
||||
: '<image:title><![CDATA[' . $image->title . ']]></image:title>';
|
||||
|
||||
if (!empty($image->license)) {
|
||||
echo '<image:license><![CDATA[' . $image->license . ']]></image:license>';
|
||||
}
|
||||
|
||||
echo '</image:image>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</url>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if there were no images
|
||||
* so any child nodes will get checked
|
||||
*/
|
||||
return $display || empty($node->images);
|
||||
};
|
||||
|
||||
echo $this->addStylesheet();
|
||||
|
||||
$attributes = [
|
||||
'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
|
||||
'xmlns:image' => 'http://www.google.com/schemas/sitemap-image/1.1'
|
||||
];
|
||||
echo sprintf('<urlset %s>', ArrayHelper::toString($attributes));
|
||||
|
||||
$this->sitemap->traverse($printNodeCallback);
|
||||
|
||||
echo '</urlset>';
|
||||
98
components/com_osmap/views/xml/tmpl/default_news.php
Normal file
98
components/com_osmap/views/xml/tmpl/default_news.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Sitemap\Item;
|
||||
use Joomla\CMS\Language\Language;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/**
|
||||
* @var OSMapViewXml $this
|
||||
* @var string $template
|
||||
* @var string $layout
|
||||
* @var string $layoutTemplate
|
||||
* @var Language $lang
|
||||
* @var string $filetofind
|
||||
*/
|
||||
|
||||
$debug = $this->params->get('debug', 0) ? "\n" : '';
|
||||
|
||||
$printNodeCallback = function (Item $node) {
|
||||
$display = !$node->ignore
|
||||
&& $node->published
|
||||
&& (!$node->duplicate || !$this->osmapParams->get('ignore_duplicated_uids', 1))
|
||||
&& isset($node->newsItem)
|
||||
&& !empty($node->newsItem)
|
||||
&& $node->visibleForRobots
|
||||
&& $node->parentIsVisibleForRobots
|
||||
&& $node->visibleForXML
|
||||
&& $node->isInternal
|
||||
&& trim($node->fullLink) != ''
|
||||
&& $node->hasCompatibleLanguage();
|
||||
|
||||
/** @var DateTime $publicationDate */
|
||||
$publicationDate = $this->isNewsPublication($node);
|
||||
if ($display && $publicationDate) {
|
||||
echo '<url>';
|
||||
echo sprintf('<loc><![CDATA[%s]]></loc>', $node->fullLink);
|
||||
echo '<news:news>';
|
||||
|
||||
echo '<news:publication>';
|
||||
echo ($publicationName = $this->params->get('news_publication_name', ''))
|
||||
? '<news:name><![CDATA[' . $publicationName . ']]></news:name>'
|
||||
: '<news:name/>';
|
||||
|
||||
if (empty($node->language) || $node->language == '*') {
|
||||
$node->language = $this->language;
|
||||
}
|
||||
echo '<news:language>' . $node->language . '</news:language>';
|
||||
echo '</news:publication>';
|
||||
|
||||
echo '<news:publication_date>' . $publicationDate->format('Y-m-d\TH:i:s\Z') . '</news:publication_date>';
|
||||
echo '<news:title><![CDATA[' . $node->name . ']]></news:title>';
|
||||
|
||||
if (!empty($node->keywords)) {
|
||||
echo '<news:keywords><![CDATA[' . $node->keywords . ']]></news:keywords>';
|
||||
}
|
||||
|
||||
echo '</news:news>';
|
||||
echo '</url>';
|
||||
}
|
||||
|
||||
return $display;
|
||||
};
|
||||
|
||||
echo $this->addStylesheet();
|
||||
|
||||
$attribs = [
|
||||
'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
|
||||
'xmlns:news' => 'http://www.google.com/schemas/sitemap-news/0.9'
|
||||
];
|
||||
|
||||
echo sprintf($debug . '<urlset %s>' . $debug, ArrayHelper::toString($attribs));
|
||||
|
||||
$this->sitemap->traverse($printNodeCallback);
|
||||
|
||||
echo '</urlset>';
|
||||
90
components/com_osmap/views/xml/tmpl/default_standard.php
Normal file
90
components/com_osmap/views/xml/tmpl/default_standard.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Helper\General;
|
||||
use Alledia\OSMap\Sitemap\Item;
|
||||
use Joomla\CMS\Language\Language;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/**
|
||||
* @var OSMapViewXml $this
|
||||
* @var string $template
|
||||
* @var string $layout
|
||||
* @var string $layoutTemplate
|
||||
* @var Language $lang
|
||||
* @var string $filetofind
|
||||
*/
|
||||
|
||||
$showExternalLinks = (int)$this->osmapParams->get('show_external_links', 0);
|
||||
$ignoreDuplicates = (int)$this->osmapParams->get('ignore_duplicated_uids', 1);
|
||||
$debug = $this->params->get('debug', 0) ? "\n" : '';
|
||||
|
||||
$printNodeCallback = function (Item $node) use ($showExternalLinks, $ignoreDuplicates, $debug) {
|
||||
$display = !$node->ignore
|
||||
&& $node->published
|
||||
&& (!$node->duplicate || !$ignoreDuplicates)
|
||||
&& $node->visibleForRobots
|
||||
&& $node->parentIsVisibleForRobots
|
||||
&& $node->visibleForXML
|
||||
&& trim($node->fullLink) != '';
|
||||
|
||||
if ($display && !$node->isInternal) {
|
||||
// Show external links
|
||||
$display = $showExternalLinks === 1;
|
||||
}
|
||||
|
||||
if (!$node->hasCompatibleLanguage()) {
|
||||
$display = false;
|
||||
}
|
||||
|
||||
if (!$display) {
|
||||
return false;
|
||||
}
|
||||
|
||||
echo $debug;
|
||||
|
||||
echo '<url>';
|
||||
echo '<loc><![CDATA[' . $node->fullLink . ']]></loc>';
|
||||
|
||||
if (!General::isEmptyDate($node->modified)) {
|
||||
echo '<lastmod>' . $node->modified . '</lastmod>';
|
||||
}
|
||||
|
||||
echo '<changefreq>' . $node->changefreq . '</changefreq>';
|
||||
echo '<priority>' . $node->priority . '</priority>';
|
||||
echo '</url>';
|
||||
|
||||
echo $debug;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
echo $this->addStylesheet();
|
||||
|
||||
echo $debug . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . $debug;
|
||||
|
||||
$this->sitemap->traverse($printNodeCallback);
|
||||
|
||||
echo '</urlset>';
|
||||
31
components/com_osmap/views/xml/view.html.php
Normal file
31
components/com_osmap/views/xml/view.html.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/*
|
||||
* Having a view.html.php file allows adding a .xml suffix to
|
||||
* the url, if the sitemap is attached to a menu entry
|
||||
*/
|
||||
require_once __DIR__ . '/view.xml.php';
|
||||
187
components/com_osmap/views/xml/view.xml.php
Normal file
187
components/com_osmap/views/xml/view.xml.php
Normal file
@ -0,0 +1,187 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Alledia\OSMap\Factory;
|
||||
use Alledia\OSMap\Helper\General;
|
||||
use Alledia\OSMap\Sitemap\Item;
|
||||
use Alledia\OSMap\Sitemap\Standard;
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\HtmlView;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
defined('_JEXEC') or die();
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
|
||||
class OsmapViewXml extends HtmlView
|
||||
{
|
||||
/**
|
||||
* @var SiteApplication
|
||||
*/
|
||||
protected $app = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $type = null;
|
||||
|
||||
/**
|
||||
* @var Registry
|
||||
*/
|
||||
protected $params = null;
|
||||
|
||||
/**
|
||||
* @var Registry
|
||||
*/
|
||||
protected $osmapParams = null;
|
||||
|
||||
/**
|
||||
* @var Standard
|
||||
*/
|
||||
protected $sitemap = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $language = null;
|
||||
|
||||
/**
|
||||
* @var DateTime
|
||||
*/
|
||||
protected $newsCutoff = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $newsLimit = 1000;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$this->app = Factory::getApplication();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$document = $this->app->getDocument();
|
||||
if ($document->getType() != 'xml') {
|
||||
// There are ways to get here with a non-xml document, so we have to redirect
|
||||
$uri = Uri::getInstance();
|
||||
$uri->setVar('format', 'xml');
|
||||
|
||||
$this->app->redirect($uri);
|
||||
|
||||
// Not strictly necessary, but makes the point :)
|
||||
return;
|
||||
}
|
||||
|
||||
$this->type = General::getSitemapTypeFromInput();
|
||||
$this->sitemap = Factory::getSitemap($this->app->input->getInt('id'), $this->type);
|
||||
if (!$this->sitemap->isPublished) {
|
||||
throw new Exception(Text::_('COM_OSMAP_MSG_SITEMAP_IS_UNPUBLISHED'), 404);
|
||||
}
|
||||
|
||||
$this->params = $this->app->getParams();
|
||||
$this->osmapParams = ComponentHelper::getParams('com_osmap');
|
||||
$this->language = $document->getLanguage();
|
||||
$this->newsCutoff = new DateTime('-' . $this->sitemap->newsDateLimit . ' days');
|
||||
|
||||
if ($this->params->get('debug', 0)) {
|
||||
$document->setMimeEncoding('text/plain');
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function addStylesheet(): string
|
||||
{
|
||||
if ($this->params->get('add_styling', 1)) {
|
||||
$query = [
|
||||
'option' => 'com_osmap',
|
||||
'view' => 'xsl',
|
||||
'format' => 'xsl',
|
||||
'layout' => $this->type,
|
||||
'id' => $this->sitemap->id,
|
||||
];
|
||||
if ($itemId = $this->app->input->getInt('Itemid')) {
|
||||
$query['Itemid'] = $itemId;
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<?xml-stylesheet type="text/xsl" href="%s"?>',
|
||||
Route::_('index.php?' . http_build_query($query))
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Item $node
|
||||
*
|
||||
* @return ?DateTime
|
||||
*/
|
||||
protected function isNewsPublication(Item $node): ?DateTime
|
||||
{
|
||||
try {
|
||||
$publicationDate = (
|
||||
!empty($node->publishUp)
|
||||
&& $node->publishUp != Factory::getDbo()->getNullDate()
|
||||
&& $node->publishUp != -1
|
||||
) ? $node->publishUp : null;
|
||||
|
||||
if ($publicationDate) {
|
||||
$publicationDate = new DateTime($publicationDate);
|
||||
|
||||
if ($this->newsCutoff <= $publicationDate) {
|
||||
$this->newsLimit--;
|
||||
if ($this->newsLimit >= 0) {
|
||||
return $publicationDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Throwable $error) {
|
||||
// Don't care
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
174
components/com_osmap/views/xsl/tmpl/images.php
Normal file
174
components/com_osmap/views/xsl/tmpl/images.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Language\Language;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/**
|
||||
* @var OSMapViewXsl $this
|
||||
* @var string $template
|
||||
* @var string $layout
|
||||
* @var string $layoutTemplate
|
||||
* @var Language $lang
|
||||
* @var string $filetofind
|
||||
*/
|
||||
|
||||
?>
|
||||
<xsl:stylesheet
|
||||
version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xna="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
||||
exclude-result-prefixes="xna">
|
||||
|
||||
<xsl:output indent="yes" method="html" omit-xml-declaration="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html lang="<?php echo $this->language; ?>">
|
||||
<head>
|
||||
<title><?php echo $this->pageTitle; ?></title>
|
||||
<style>
|
||||
<![CDATA[
|
||||
body {
|
||||
font-family: tahoma, sans-serif;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
table {
|
||||
font-size: 11px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #9f8Fbf;
|
||||
color: #fff;
|
||||
text-align: left;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background: #eeF8ff;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.data a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.icon-new-tab {
|
||||
font-size: 10px;
|
||||
margin-left: 4px;
|
||||
color: #b5b5b5;
|
||||
}
|
||||
|
||||
.count {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
tr.sitemap-url td {
|
||||
background: #e6e3ec;
|
||||
padding: 1px 2px;
|
||||
color: #b3b3b3;
|
||||
}
|
||||
|
||||
tr.sitemap-url td a.url {
|
||||
color: #b3b3b3;
|
||||
}
|
||||
|
||||
.image-url td {
|
||||
padding-left: 12px;
|
||||
position: relative;
|
||||
}
|
||||
]]>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<?php if ($this->pageHeading) : ?>
|
||||
<h1><?php echo Text::_($this->pageHeading); ?></h1>
|
||||
<?php endif; ?>
|
||||
<div class="count">
|
||||
<?php echo Text::_('COM_OSMAP_NUMBER_OF_URLS'); ?>:
|
||||
<xsl:value-of select="count(xna:urlset/xna:url)"/>
|
||||
(<xsl:value-of select="count(xna:urlset/xna:url/image:image/image:loc)"/>
|
||||
<?php echo Text::_('COM_OSMAP_IMAGES'); ?>)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo Text::_('COM_OSMAP_HEADING_URL'); ?></th>
|
||||
<th><?php echo Text::_('COM_OSMAP_HEADING_TITLE'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:for-each select="xna:urlset/xna:url">
|
||||
<xsl:variable name="sitemapURL">
|
||||
<xsl:value-of select="xna:loc"/>
|
||||
</xsl:variable>
|
||||
<tr class="sitemap-url">
|
||||
<td>
|
||||
<a href="{$sitemapURL}" target="_blank" class="url">
|
||||
<xsl:value-of select="$sitemapURL"/>
|
||||
</a>
|
||||
<span class="icon-new-tab"></span>
|
||||
(<xsl:value-of select="count(./image:image/image:loc)"/>
|
||||
<?php echo Text::_('COM_OSMAP_IMAGES'); ?>)
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="./title"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<xsl:for-each select="image:image">
|
||||
<xsl:variable name="imageURL"><xsl:value-of select="image:loc"/></xsl:variable>
|
||||
<tr class="image-url">
|
||||
<td>
|
||||
<a href="{$imageURL}"
|
||||
target="_blank"
|
||||
class="image-url">
|
||||
<xsl:value-of select="$imageURL"/>
|
||||
</a>
|
||||
<span class="icon-new-tab"></span>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="image:title"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
157
components/com_osmap/views/xsl/tmpl/news.php
Normal file
157
components/com_osmap/views/xsl/tmpl/news.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Language\Language;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/**
|
||||
* @var OSMapViewXsl $this
|
||||
* @var string $template
|
||||
* @var string $layout
|
||||
* @var string $layoutTemplate
|
||||
* @var Language $lang
|
||||
* @var string $filetofind
|
||||
*/
|
||||
|
||||
?>
|
||||
<xsl:stylesheet
|
||||
version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xna="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
|
||||
exclude-result-prefixes="xna">
|
||||
|
||||
<xsl:output indent="yes" method="html" omit-xml-declaration="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html lang="<?php echo $this->language; ?>">
|
||||
<head>
|
||||
<title><?php echo $this->pageTitle; ?></title>
|
||||
<style>
|
||||
<![CDATA[
|
||||
body {
|
||||
font-family: tahoma, sans-serif;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
table {
|
||||
font-size: 11px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #9f8Fbf;
|
||||
color: #fff;
|
||||
text-align: left;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background: #eeF8ff;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.data a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.icon-new-tab {
|
||||
font-size: 10px;
|
||||
margin-left: 4px;
|
||||
color: #b5b5b5;
|
||||
}
|
||||
|
||||
.count {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
tr.sitemap-url td {
|
||||
background: #e6e3ec;
|
||||
padding: 1px 2px;
|
||||
color: #b3b3b3;
|
||||
}
|
||||
|
||||
tr.sitemap-url td a.url {
|
||||
color: #b3b3b3;
|
||||
}
|
||||
|
||||
.image-url td {
|
||||
padding-left: 12px;
|
||||
position: relative;
|
||||
}
|
||||
]]>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<?php if ($this->pageHeading) : ?>
|
||||
<h1><?php echo Text::_($this->pageHeading); ?></h1>
|
||||
<?php endif; ?>
|
||||
<div class="count">
|
||||
<?php echo Text::_('COM_OSMAP_NUMBER_OF_URLS'); ?>:
|
||||
<xsl:value-of select="count(xna:urlset/xna:url)"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo Text::_('COM_OSMAP_HEADING_URL'); ?></th>
|
||||
<th><?php echo Text::_('COM_OSMAP_HEADING_TITLE'); ?></th>
|
||||
<th><?php echo Text::_('COM_OSMAP_HEADING_PUBLICATION_DATE'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:for-each select="xna:urlset/xna:url">
|
||||
<xsl:variable name="sitemapURL">
|
||||
<xsl:value-of select="xna:loc"/>
|
||||
</xsl:variable>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{$sitemapURL}" target="_blank" class="url">
|
||||
<xsl:value-of select="$sitemapURL"/>
|
||||
</a>
|
||||
<span class="icon-new-tab"></span>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="news:news/news:title" />
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="news:news/news:publication_date" />
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
146
components/com_osmap/views/xsl/tmpl/standard.php
Normal file
146
components/com_osmap/views/xsl/tmpl/standard.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Language\Language;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
/**
|
||||
* @var OSMapViewXsl $this
|
||||
* @var string $template
|
||||
* @var string $layout
|
||||
* @var string $layoutTemplate
|
||||
* @var Language $lang
|
||||
* @var string $filetofind
|
||||
*/
|
||||
|
||||
?>
|
||||
<xsl:stylesheet
|
||||
version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xna="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
||||
exclude-result-prefixes="xna">
|
||||
<xsl:output indent="yes" method="html" omit-xml-declaration="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html lang="<?php echo $this->language; ?>">
|
||||
<head>
|
||||
<title><?php echo $this->pageTitle; ?></title>
|
||||
<style>
|
||||
<![CDATA[
|
||||
body {
|
||||
font-family: tahoma, sans-serif;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
table {
|
||||
font-size: 11px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #9f8Fbf;
|
||||
color: #fff;
|
||||
text-align: left;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background: #eeF8ff;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.data a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.icon-new-tab {
|
||||
font-size: 10px;
|
||||
margin-left: 4px;
|
||||
color: #b5b5b5;
|
||||
}
|
||||
|
||||
.count {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
]]>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="title">
|
||||
<?php if ($this->pageHeading) : ?>
|
||||
<h1><?php echo Text::_($this->pageHeading); ?></h1>
|
||||
<?php endif; ?>
|
||||
<div class="count">
|
||||
<?php echo Text::_('COM_OSMAP_NUMBER_OF_URLS'); ?>:
|
||||
<xsl:value-of select="count(xna:urlset/xna:url)"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo Text::_('COM_OSMAP_URL'); ?></th>
|
||||
<th><?php echo Text::_('COM_OSMAP_MODIFICATION_DATE'); ?></th>
|
||||
<th><?php echo Text::_('COM_OSMAP_CHANGE_FREQ'); ?></th>
|
||||
<th><?php echo Text::_('COM_OSMAP_PRIORITY_LABEL'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:for-each select="xna:urlset/xna:url">
|
||||
<xsl:variable name="sitemapURL">
|
||||
<xsl:value-of select="xna:loc"/>
|
||||
</xsl:variable>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{$sitemapURL}"
|
||||
target="_blank">
|
||||
<xsl:value-of select="$sitemapURL"/>
|
||||
</a>
|
||||
<span class="icon-new-tab"></span>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="xna:lastmod"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="xna:changefreq"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="xna:priority"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
111
components/com_osmap/views/xsl/view.xsl.php
Normal file
111
components/com_osmap/views/xsl/view.xsl.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* @package OSMap
|
||||
* @contact www.joomlashack.com, help@joomlashack.com
|
||||
* @copyright 2007-2014 XMap - Joomla! Vargas - Guillermo Vargas. All rights reserved.
|
||||
* @copyright 2016-2024 Joomlashack.com. All rights reserved.
|
||||
* @license https://www.gnu.org/licenses/gpl.html GNU/GPL
|
||||
*
|
||||
* This file is part of OSMap.
|
||||
*
|
||||
* OSMap is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSMap is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OSMap. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user