- md5
- 132d6c7403b386f5c187d879279cf424
- sha1
- 752ec06c9245e0c5d70b00992537f8ea13edbf8b
- sha256
- 8440c3c3fe3a712c96cd5899485331233ff8797a7b19f2e9941e4a8ae7646533
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
<?php
/**
* @package Joomla.Site
* @subpackage mod_finder
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\Finder\Site\Helper;
use Joomla\CMS\Factory;
use Joomla\CMS\Filter\InputFilter;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\Finder\Administrator\Indexer\Query;
use Joomla\Database\DatabaseInterface;
use Joomla\Utilities\ArrayHelper;
/**
* Finder module helper.
*
* @since 2.5
*/
class FinderHelper
{
/**
* Method to get hidden input fields for a get form so that control variables
* are not lost upon form submission.
*
* @param string $route The route to the page. [optional]
* @param integer $paramItem The menu item ID. (@since 3.1) [optional]
*
* @return string A string of hidden input form fields
*
* @since 2.5
*/
public static function getGetFields($route = null, $paramItem = 0)
{
$fields = array();
$uri = Uri::getInstance(Route::_($route));
$uri->delVar('q');
// Create hidden input elements for each part of the URI.
foreach ($uri->getQuery(true) as $n => $v) {
$fields[] = '<input type="hidden" name="' . $n . '" value="' . $v . '">';
}
return implode('', $fields);
}
/**
* Get Smart Search query object.
*
* @param \Joomla\Registry\Registry $params Module parameters.
*
* @return Query object
*
* @since 2.5
*/
public static function getQuery($params)
{
$request = Factory::getApplication()->input->request;
$filter = InputFilter::getInstance();
// Get the static taxonomy filters.
$options = array();
$options['filter'] = ($request->get('f', 0, 'int') !== 0) ? $request->get('f', '', 'int') : $params->get('searchfilter');
$options['filter'] = $filter->clean($options['filter'], 'int');
// Get the dynamic taxonomy filters.
$options['filters'] = $request->get('t', '', 'array');
$options['filters'] = $filter->clean($options['filters'], 'array');
$options['filters'] = ArrayHelper::toInteger($options['filters']);
// Instantiate a query object.
return new Query($options, Factory::getContainer()->get(DatabaseInterface::class));
}
}
The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.