first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,91 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_finder
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Finder module helper.
*
* @package Joomla.Site
* @subpackage mod_finder
* @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)
{
$fields = null;
$uri = JUri::getInstance(JRoute::_($route));
$uri->delVar('q');
$elements = $uri->getQuery(true);
// Create hidden input elements for each part of the URI.
// Add the current menu id if it doesn't have one
foreach ($elements as $n => $v)
{
if ($n == 'Itemid')
{
continue;
}
$fields .= '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
}
/*
* Figure out the Itemid value
* First, check if the param is set. If not, fall back to the Itemid from the JInput object
*/
$Itemid = $paramItem > 0 ? $paramItem : JFactory::getApplication()->input->getInt('Itemid');
$fields .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
return $fields;
}
/**
* Get Smart Search query object.
*
* @param JRegistry $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');
JArrayHelper::toInteger($options['filters']);
// Instantiate a query object.
$query = new FinderIndexerQuery($options);
return $query;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,56 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_finder
*
* @copyright Copyright (C) 2005 - 2013 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.
require_once __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->getCfg('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 plug-in language files.
FinderHelperLanguage::loadPluginLanguage();
// Get Smart Search query object.
$query = modFinderHelper::getQuery($params);
require JModuleHelper::getLayoutPath('mod_finder', $params->get('layout', 'default'));

View File

@ -0,0 +1,161 @@
<?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 - 2013 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>
<folder>tmpl</folder>
<filename module="mod_finder">mod_finder.php</filename>
<filename>helper.php</filename>
<filename>index.html</filename>
<filename>mod_finder.xml</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"
default=""
label="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_LABEL"
description="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_DESCRIPTION" />
<field
name="show_autosuggest"
type="list"
default="1"
label="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_LABEL"
description="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_DESCRIPTION">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="show_advanced"
type="list"
default="0"
label="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_LABEL"
description="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_DESCRIPTION">
<option
value="2">MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_OPTION_LINK</option>
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</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" rows="3"
default=""
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field
name="field_size"
type="text"
default="25"
filter="integer"
label="MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_DESCRIPTION" />
<field
name="alt_label"
type="text"
label="MOD_FINDER_FIELDSET_ADVANCED_ALT_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_ALT_DESCRIPTION" />
<field
name="show_label"
type="radio"
class="btn-group"
default="1"
label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_DESCRIPTION">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="label_pos"
type="list"
default="top"
label="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_DESCRIPTION">
<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="show_button"
type="radio"
class="btn-group"
default="0"
label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_DESCRIPTION">
<option
value="1">JSHOW</option>
<option
value="0">JHIDE</option>
</field>
<field
name="button_pos"
type="list"
default="right"
label="MOD_FINDER_FIELDSET_ADVANCED_BUTTON_POS_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_BUTTON_POS_DESCRIPTION">
<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"
class="btn-group"
label="MOD_FINDER_FIELD_OPENSEARCH_LABEL"
description="MOD_FINDER_FIELD_OPENSEARCH_DESCRIPTION"
default="1">
<option
value="0">JNO</option>
<option
value="1">JYES</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="text"
label="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_LABEL"
description="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_DESCRIPTION" />
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,163 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_finder
*
* @copyright Copyright (C) 2005 - 2013 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::_('behavior.framework');
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" class="search-query input-medium" size="' . $params->get('field_size', 20) . '" value="' . htmlspecialchars(JFactory::getApplication()->input->get('q', '', 'string')) . '" />';
$button = '';
$label = '';
if ($params->get('show_label', 1))
{
$label = '<label for="mod-finder-searchword" class="finder' . $suffix . '">' . $params->get('alt_label', JText::_('JSEARCH_FILTER_SUBMIT')) . '</label>';
switch ($params->get('label_pos', 'left')):
case 'top' :
$label = $label . '<br />';
$output = $label . $output;
break;
case 'bottom' :
$label = '<br />' . $label;
$output = $output . $label;
break;
case 'right' :
$output = $output . $label;
break;
case 'left' :
default :
$output = $label . $output;
break;
endswitch;
}
if ($params->get('show_button', 1))
{
$button = '<button class="btn btn-primary hasTooltip ' . $suffix . ' finder' . $suffix . '" type="submit" title="' . JText::_('MOD_FINDER_SEARCH_BUTTON') . '"><i class="icon-search icon-white"></i></button>';
switch ($params->get('button_pos', 'right')):
case 'top' :
$button = $button . '<br />';
$output = $button . $output;
break;
case 'bottom' :
$button = '<br />' . $button;
$output = $output . $button;
break;
case 'right' :
$output = $output . $button;
break;
case 'left' :
default :
$output = $button . $output;
break;
endswitch;
}
JHtml::stylesheet('com_finder/finder.css', false, true, false);
?>
<script type="text/javascript">
//<![CDATA[
window.addEvent('domready', function()
{
var value;
// Set the input value if not already set.
if (!document.id('mod-finder-searchword').getProperty('value'))
{
document.id('mod-finder-searchword').setProperty('value', '<?php echo JText::_('MOD_FINDER_SEARCH_VALUE', true); ?>');
}
// Get the current value.
value = document.id('mod-finder-searchword').getProperty('value');
// If the current value equals the default value, clear it.
document.id('mod-finder-searchword').addEvent('focus', function()
{
if (this.getProperty('value') == '<?php echo JText::_('MOD_FINDER_SEARCH_VALUE', true); ?>')
{
this.setProperty('value', '');
}
});
// If the current value is empty, set the previous value.
document.id('mod-finder-searchword').addEvent('blur', function()
{
if (!this.getProperty('value'))
{
this.setProperty('value', value);
}
});
document.id('mod-finder-searchform').addEvent('submit', function(e){
e = new Event(e);
e.stop();
// Disable select boxes with no value selected.
if (document.id('mod-finder-advanced') != null)
{
document.id('mod-finder-advanced').getElements('select').each(function(s){
if (!s.getProperty('value'))
{
s.setProperty('disabled', 'disabled');
}
});
}
document.id('mod-finder-searchform').submit();
});
/*
* This segment of code sets up the autocompleter.
*/
<?php if ($params->get('show_autosuggest', 1)) : ?>
<?php JHtml::_('script', 'com_finder/autocompleter.js', false, true); ?>
var url = '<?php echo JRoute::_('index.php?option=com_finder&task=suggestions.display&format=json&tmpl=component', false); ?>';
var ModCompleter = new Autocompleter.Request.JSON(document.id('mod-finder-searchword'), url, {'postVar': 'q'});
<?php endif; ?>
});
//]]>
</script>
<form id="mod-finder-searchform" action="<?php echo JRoute::_($route); ?>" method="get" class="form-search">
<div class="finder<?php echo $suffix; ?>">
<?php
// Show the form fields.
echo $output;
?>
<?php if ($params->get('show_advanced', 1)) : ?>
<?php if ($params->get('show_advanced', 1) == 2) : ?>
<br />
<a href="<?php echo JRoute::_($route); ?>"><?php echo JText::_('COM_FINDER_ADVANCED_SEARCH'); ?></a>
<?php elseif ($params->get('show_advanced', 1) == 1) : ?>
<div id="mod-finder-advanced">
<?php echo JHtml::_('filter.select', $query, $params); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php echo modFinderHelper::getGetFields($route, (int) $params->get('set_itemid')); ?>
</div>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>