Файловый менеджер - Редактировать - /var/www/consult-e-syn/public_html/components/com_ats/Helper/Router.php
Назад
<?php /** * @package ats * @copyright Copyright (c)2011-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ namespace Akeeba\TicketSystem\Site\Helper; defined('_JEXEC') or die; use FOF40\Container\Container; use Joomla\CMS\Factory as JFactory; use Joomla\CMS\Menu\AbstractMenu as JMenu; use Joomla\Registry\Registry as JRegistry; class Router { public static function getAndPop(&$query, $key, $default = null) { if (array_key_exists($key, $query)) { $value = $query[$key]; unset($query[$key]); return $value; } else { return $default; } } /** * Finds a menu whose query parameters match those in $qoptions * * @param array $qoptions The query parameters to look for * @param array $params The menu parameters to look for * * @return null|object Null if not found, or the menu item if we did find it */ public static function findMenu($qoptions = [], $params = null) { // Convert $qoptions to an object if (empty($qoptions) || !is_array($qoptions)) { $qoptions = []; } $menus = JMenu::getInstance('site'); $menuitem = $menus->getActive(); // First check the current menu item (fastest shortcut!) if (is_object($menuitem)) { if (self::checkMenu($menuitem, $qoptions, $params)) { return $menuitem; } } foreach ($menus->getMenu() as $item) { if (self::checkMenu($item, $qoptions, $params)) { return $item; } } return null; } /** * Checks if a menu item conforms to the query options and parameters specified * * @param object $menu A menu item * @param array $qoptions The query options to look for * @param array $params The menu parameters to look for * * @return bool */ public static function checkMenu($menu, $qoptions, $params = null) { static $languages = []; $container = Container::getInstance('com_ats'); if (empty($languages)) { $languages = ['*']; $multiLingual = true; if (!$container->platform->isCli() && !$container->platform->isBackend()) { /** @var \JApplicationSite $app */ $app = JFactory::getApplication(); $multiLingual = false; if ($app->getLanguageFilter()) { $multiLingual = true; } } if ($multiLingual) { // Get default site language $lg = JFactory::getLanguage(); $languages = [ $lg->getTag(), '*', ]; $languages = array_unique($languages); } } if (isset($qoptions['lang'])) { if (!empty($qoptions['lang'])) { $languages = [$qoptions['lang']]; } unset($qoptions['lang']); } if (!empty($menu->language)) { if (!in_array($menu->language, $languages)) { return false; } } $query = is_object($menu) ? $menu->query : []; foreach ($qoptions as $key => $value) { // A null value was requested. Huh. if (is_null($value)) { // If the key is set and is not empty it's not the menu item you're looking for if (isset($query[$key]) && !empty($query[$key])) { return false; } continue; } if (!isset($query[$key])) { return false; } if ($key == 'view') { // Treat views case-insensitive if (strtolower($query[$key]) != strtolower($value)) { return false; } } elseif ($query[$key] != $value) { return false; } } if (!is_null($params)) { $menus = JMenu::getInstance('site'); if (!method_exists($menu, 'getParams')) { // Joomla 3, Joomla 4.0 Alpha to Beta 3 $check = $menu->params instanceof JRegistry ? $menu->params : $menus->getParams($menu->id); } else { // Joomla 4.0.0 Beta 4 and later $check = $menu->getParams(); } foreach ($params as $key => $value) { if (is_null($value)) { continue; } if ($check->get($key) != $value) { return false; } } } return true; } public static function preconditionSegments($segments) { $newSegments = []; if (!empty($segments)) { foreach ($segments as $segment) { if (strstr($segment, ':')) { $segment = str_replace(':', '-', $segment); } if (is_array($segment)) { $newSegments[] = implode('-', $segment); } else { $newSegments[] = $segment; } } } return $newSegments; } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.16 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка