- md5
- 748b6207823f6e86f21afc843cb836ff
- sha1
- c9bc904bcd885553f20094394fb42b9daed8533f
- sha256
- f987ed99e58910ef99d7f38a06aac4a9235b580b0616fff1dfcde9c230dea28d
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
<?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Pathway;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Multilanguage;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Class to manage the site application pathway.
*
* @since 1.5
*/
class SitePathway extends Pathway
{
/**
* Class constructor.
*
* @param ?SiteApplication $app Application Object
*
* @since 1.5
*/
public function __construct(?SiteApplication $app = null)
{
$this->pathway = [];
$app = $app ?: Factory::getContainer()->get(SiteApplication::class);
$menu = $app->getMenu();
$lang = Factory::getLanguage();
if ($item = $menu->getActive()) {
$menus = $menu->getMenu();
// Look for the home menu
if (Multilanguage::isEnabled()) {
$home = $menu->getDefault($lang->getTag());
} else {
$home = $menu->getDefault();
}
if (\is_object($home) && ($item->id != $home->id)) {
foreach ($item->tree as $menupath) {
$link = $menu->getItem($menupath);
switch ($link->type) {
case 'separator':
case 'heading':
$url = null;
break;
case 'url':
if ((strpos($link->link, 'index.php?') === 0) && (strpos($link->link, 'Itemid=') === false)) {
// If this is an internal Joomla link, ensure the Itemid is set.
$url = $link->link . '&Itemid=' . $link->id;
} else {
$url = $link->link;
}
break;
case 'alias':
// If this is an alias use the item id stored in the parameters to make the link.
$url = 'index.php?Itemid=' . $link->getParams()->get('aliasoptions');
break;
default:
$url = $link->link . '&Itemid=' . $link->id;
break;
}
$this->addItem($menus[$menupath]->title, $url);
}
}
}
}
}
The same content is in 21 releases, Joomla 5.2.0-beta1 to 5.3.0-beta1. See them all, or every version of this file.