Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
helper.php000064400000004550151160337600006542 0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_finder
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Finder module helper.
*
* @since 2.5
*/
class ModFinderHelper
{
/**
* 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)
{
// Determine if there is an item id before routing.
$needId = !JUri::getInstance($route)->getVar('Itemid');
$fields = array();
$uri = JUri::getInstance(JRoute::_($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 . '" />';
}
// Add a field for Itemid if we need one.
if ($needId)
{
$id = $paramItem ?:
JFactory::getApplication()->input->get('Itemid',
'0', 'int');
$fields[] = '<input type="hidden"
name="Itemid" value="' . $id . '"
/>';
}
return implode('', $fields);
}
/**
* Get Smart Search query object.
*
* @param \Joomla\Registry\Registry $params Module parameters.
*
* @return FinderIndexerQuery object
*
* @since 2.5
*/
public static function getQuery($params)
{
$app = JFactory::getApplication();
$input = $app->input;
$request = $input->request;
$filter = JFilterInput::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 FinderIndexerQuery($options);
}
}
mod_finder.php000064400000003430151160337600007365 0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_finder
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('FinderHelperRoute', JPATH_SITE .
'/components/com_finder/helpers/route.php');
JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/language.php');
// Include the helper.
JLoader::register('ModFinderHelper', __DIR__ .
'/helper.php');
if (!defined('FINDER_PATH_INDEXER'))
{
define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR .
'/components/com_finder/helpers/indexer');
}
JLoader::register('FinderIndexerQuery', FINDER_PATH_INDEXER .
'/query.php');
// Check for OpenSearch
if ($params->get('opensearch', 1))
{
/*
This code intentionally commented
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$ostitle = $params->get('opensearch_title',
JText::_('MOD_FINDER_SEARCHBUTTON_TEXT') . ' ' .
$app->get('sitename'));
$doc->addHeadLink(
JUri::getInstance()->toString(array('scheme',
'host', 'port')) .
JRoute::_('&option=com_finder&format=opensearch'),
'search', 'rel', array('title' =>
$ostitle, 'type' =>
'application/opensearchdescription+xml')
);
*/
}
// Initialize module parameters.
$params->def('field_size', 20);
// Get the route.
$route =
FinderHelperRoute::getSearchRoute($params->get('searchfilter',
null));
// Load component language file.
FinderHelperLanguage::loadComponentLanguage();
// Load plugin language files.
FinderHelperLanguage::loadPluginLanguage();
// Get Smart Search query object.
$query = ModFinderHelper::getQuery($params);
require JModuleHelper::getLayoutPath('mod_finder',
$params->get('layout', 'default'));
mod_finder.xml000064400000012271151160337600007401 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1"
client="site" method="upgrade">
<name>mod_finder</name>
<author>Joomla! Project</author>
<creationDate>August 2011</creationDate>
<copyright>(C) 2005 - 2020 Open Source Matters. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_FINDER_XML_DESCRIPTION</description>
<files>
<filename
module="mod_finder">mod_finder.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
</files>
<languages>
<language
tag="en-GB">language/en-GB/en-GB.mod_finder.ini</language>
<language
tag="en-GB">language/en-GB/en-GB.mod_finder.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_SMART_SEARCH"
/>
<config>
<fields name="params"
addfieldpath="/administrator/components/com_finder/models/fields">
<fieldset name="basic">
<field
name="searchfilter"
type="searchfilter"
label="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_LABEL"
description="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_DESCRIPTION"
default=""
/>
<field
name="show_autosuggest"
type="radio"
label="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_LABEL"
description="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_DESCRIPTION"
default="1"
filter="integer"
class="btn-group btn-group-yesno"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_advanced"
type="list"
label="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_LABEL"
description="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_DESCRIPTION"
default="0"
filter="integer"
>
<option
value="2">MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_OPTION_LINK</option>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="field_size"
type="number"
label="MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_DESCRIPTION"
default="25"
filter="integer"
/>
<field
name="show_label"
type="radio"
label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="label_pos"
type="list"
label="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_DESCRIPTION"
default="left"
>
<option value="right">JGLOBAL_RIGHT</option>
<option value="left">JGLOBAL_LEFT</option>
<option
value="top">MOD_FINDER_CONFIG_OPTION_TOP</option>
<option
value="bottom">MOD_FINDER_CONFIG_OPTION_BOTTOM</option>
</field>
<field
name="alt_label"
type="text"
label="MOD_FINDER_FIELDSET_ADVANCED_ALT_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_ALT_DESCRIPTION"
/>
<field
name="show_button"
type="radio"
label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="button_pos"
type="list"
label="MOD_FINDER_FIELDSET_ADVANCED_BUTTON_POS_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_BUTTON_POS_DESCRIPTION"
default="left"
>
<option value="right">JGLOBAL_RIGHT</option>
<option value="left">JGLOBAL_LEFT</option>
<option
value="top">MOD_FINDER_CONFIG_OPTION_TOP</option>
<option
value="bottom">MOD_FINDER_CONFIG_OPTION_BOTTOM</option>
</field>
<field
name="opensearch"
type="radio"
label="MOD_FINDER_FIELD_OPENSEARCH_LABEL"
description="MOD_FINDER_FIELD_OPENSEARCH_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="opensearch_title"
type="text"
label="MOD_FINDER_FIELD_OPENSEARCH_TEXT_LABEL"
description="MOD_FINDER_FIELD_OPENSEARCH_TEXT_DESCRIPTION"
/>
<field
name="set_itemid"
type="menuitem"
label="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_DESCRIPTION"
default="0"
filter="integer"
>
<option
value="0">MOD_FINDER_SELECT_MENU_ITEMID</option>
</field>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
default=""
/>
</fieldset>
</fields>
</config>
</extension>
tmpl/default.php000064400000011055151160337600007661 0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_finder
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_SITE .
'/components/com_finder/helpers/html');
JHtml::_('jquery.framework');
JHtml::_('formbehavior.chosen');
JHtml::_('bootstrap.tooltip');
// Load the smart search component language file.
$lang = JFactory::getLanguage();
$lang->load('com_finder', JPATH_SITE);
$suffix = $params->get('moduleclass_sfx');
$output = '<input type="text" name="q"
id="mod-finder-searchword' . $module->id . '"
class="search-query input-medium" size="'
. $params->get('field_size', 20) . '"
value="' .
htmlspecialchars(JFactory::getApplication()->input->get('q',
'', 'string'), ENT_COMPAT, 'UTF-8') .
'"'
. ' placeholder="' .
JText::_('MOD_FINDER_SEARCH_VALUE') . '"/>';
$showLabel = $params->get('show_label', 1);
$labelClass = (!$showLabel ? 'element-invisible ' : '')
. 'finder' . $suffix;
$label = '<label for="mod-finder-searchword' .
$module->id . '" class="' . $labelClass .
'">' . $params->get('alt_label',
JText::_('JSEARCH_FILTER_SUBMIT')) . '</label>';
switch ($params->get('label_pos', 'left'))
{
case 'top' :
$output = $label . '<br />' . $output;
break;
case 'bottom' :
$output .= '<br />' . $label;
break;
case 'right' :
$output .= $label;
break;
case 'left' :
default :
$output = $label . $output;
break;
}
if ($params->get('show_button', 0))
{
$button = '<button class="btn btn-primary hasTooltip ' .
$suffix . ' finder' . $suffix . '"
type="submit" title="' .
JText::_('MOD_FINDER_SEARCH_BUTTON') . '"><span
class="icon-search icon-white"></span>' .
JText::_('JSEARCH_FILTER_SUBMIT') . '</button>';
switch ($params->get('button_pos', 'left'))
{
case 'top' :
$output = $button . '<br />' . $output;
break;
case 'bottom' :
$output .= '<br />' . $button;
break;
case 'right' :
$output .= $button;
break;
case 'left' :
default :
$output = $button . $output;
break;
}
}
JHtml::_('stylesheet', 'com_finder/finder.css',
array('version' => 'auto', 'relative'
=> true));
$script = "
jQuery(document).ready(function() {
var value, searchword = jQuery('#mod-finder-searchword" .
$module->id . "');
// Get the current value.
value = searchword.val();
// If the current value equals the default value, clear it.
searchword.on('focus', function ()
{
var el = jQuery(this);
if (el.val() === '" .
JText::_('MOD_FINDER_SEARCH_VALUE', true) . "')
{
el.val('');
}
});
// If the current value is empty, set the previous value.
searchword.on('blur', function ()
{
var el = jQuery(this);
if (!el.val())
{
el.val(value);
}
});
jQuery('#mod-finder-searchform" . $module->id .
"').on('submit', function (e)
{
e.stopPropagation();
var advanced = jQuery('#mod-finder-advanced" . $module->id
. "');
// Disable select boxes with no value selected.
if (advanced.length)
{
advanced.find('select').each(function (index, el)
{
var el = jQuery(el);
if (!el.val())
{
el.attr('disabled', 'disabled');
}
});
}
});";
/*
* This segment of code sets up the autocompleter.
*/
if ($params->get('show_autosuggest', 1))
{
JHtml::_('script', 'jui/jquery.autocomplete.min.js',
array('version' => 'auto', 'relative'
=> true));
$script .= "
var suggest = jQuery('#mod-finder-searchword" . $module->id .
"').autocomplete({
serviceUrl: '" .
JRoute::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component')
. "',
paramName: 'q',
minChars: 1,
maxHeight: 400,
width: 300,
zIndex: 9999,
deferRequestBy: 500
});";
}
$script .= '});';
JFactory::getDocument()->addScriptDeclaration($script);
?>
<div class="finder<?php echo $suffix; ?>">
<form id="mod-finder-searchform<?php echo $module->id;
?>" action="<?php echo JRoute::_($route); ?>"
method="get" class="form-search"
role="search">
<?php
// Show the form fields.
echo $output;
?>
<?php $show_advanced = $params->get('show_advanced', 0);
?>
<?php if ($show_advanced == 2) : ?>
<br />
<a href="<?php echo JRoute::_($route);
?>"><?php echo
JText::_('COM_FINDER_ADVANCED_SEARCH'); ?></a>
<?php elseif ($show_advanced == 1) : ?>
<div id="mod-finder-advanced<?php echo $module->id;
?>">
<?php echo JHtml::_('filter.select', $query, $params);
?>
</div>
<?php endif; ?>
<?php echo modFinderHelper::getGetFields($route, (int)
$params->get('set_itemid', 0)); ?>
</form>
</div>