You've already forked joomla_test
first commit
This commit is contained in:
34
modules/mod_search/helper.php
Normal file
34
modules/mod_search/helper.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_search
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Helper for mod_search
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_search
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModSearchHelper
|
||||
{
|
||||
/**
|
||||
* Display the search button as an image.
|
||||
*
|
||||
* @param string $button_text The alt text for the button.
|
||||
*
|
||||
* @return string The HTML for the image.
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getSearchImage($button_text)
|
||||
{
|
||||
$img = JHtml::_('image', 'searchButton.gif', $button_text, null, true, true);
|
||||
return $img;
|
||||
}
|
||||
}
|
1
modules/mod_search/index.html
Normal file
1
modules/mod_search/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
44
modules/mod_search/mod_search.php
Normal file
44
modules/mod_search/mod_search.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_search
|
||||
*
|
||||
* @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;
|
||||
|
||||
// Include the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$lang = JFactory::getLanguage();
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
if ($params->get('opensearch', 1))
|
||||
{
|
||||
$doc = JFactory::getDocument();
|
||||
|
||||
$ostitle = $params->get('opensearch_title', JText::_('MOD_SEARCH_SEARCHBUTTON_TEXT').' '.$app->getCfg('sitename'));
|
||||
$doc->addHeadLink(JUri::getInstance()->toString(array('scheme', 'host', 'port')).JRoute::_('&option=com_search&format=opensearch'), 'search', 'rel', array('title' => htmlspecialchars($ostitle), 'type' => 'application/opensearchdescription+xml'));
|
||||
}
|
||||
|
||||
$upper_limit = $lang->getUpperLimitSearchWord();
|
||||
|
||||
$button = $params->get('button', '');
|
||||
$imagebutton = $params->get('imagebutton', '');
|
||||
$button_pos = $params->get('button_pos', 'left');
|
||||
$button_text = htmlspecialchars($params->get('button_text', JText::_('MOD_SEARCH_SEARCHBUTTON_TEXT')));
|
||||
$width = (int) $params->get('width', 20);
|
||||
$maxlength = $upper_limit;
|
||||
$text = htmlspecialchars($params->get('text', JText::_('MOD_SEARCH_SEARCHBOX_TEXT')));
|
||||
$label = htmlspecialchars($params->get('label', JText::_('MOD_SEARCH_LABEL_TEXT')));
|
||||
$set_Itemid = (int) $params->get('set_itemid', 0);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
if ($imagebutton)
|
||||
{
|
||||
$img = ModSearchHelper::getSearchImage($button_text);
|
||||
}
|
||||
$mitemid = $set_Itemid > 0 ? $set_Itemid : $app->input->get('Itemid');
|
||||
require JModuleHelper::getLayoutPath('mod_search', $params->get('layout', 'default'));
|
150
modules/mod_search/mod_search.xml
Normal file
150
modules/mod_search/mod_search.xml
Normal file
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_search</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2004</creationDate>
|
||||
<copyright>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_SEARCH_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_search">mod_search.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename> <filename>mod_search.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_search.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_search.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_SEARCH" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="label"
|
||||
type="label"
|
||||
label="MOD_SEARCH_FIELD_LABEL_TEXT_LABEL"
|
||||
description="MOD_SEARCH_FIELD_LABEL_TEXT_DESC" />
|
||||
<field
|
||||
name="width"
|
||||
type="text"
|
||||
default="20"
|
||||
label="MOD_SEARCH_FIELD_BOXWIDTH_LABEL"
|
||||
description="MOD_SEARCH_FIELD_BOXWIDTH_DESC" />
|
||||
<field
|
||||
name="text"
|
||||
type="text"
|
||||
label="MOD_SEARCH_FIELD_TEXT_LABEL"
|
||||
description="MOD_SEARCH_FIELD_TEXT_DESC" />
|
||||
<field
|
||||
name="button"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="MOD_SEARCH_FIELD_BUTTON_LABEL"
|
||||
description="MOD_SEARCH_FIELD_BUTTON_DESC">
|
||||
<option
|
||||
value="">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="button_pos"
|
||||
type="list"
|
||||
default="right"
|
||||
label="MOD_SEARCH_FIELD_BUTTONPOS_LABEL"
|
||||
description="MOD_SEARCH_FIELD_BUTTONPOS_DESC">
|
||||
<option
|
||||
value="right">MOD_SEARCH_FIELD_VALUE_RIGHT</option>
|
||||
<option
|
||||
value="left">MOD_SEARCH_FIELD_VALUE_LEFT</option>
|
||||
<option
|
||||
value="top">MOD_SEARCH_FIELD_VALUE_TOP</option>
|
||||
<option
|
||||
value="bottom">MOD_SEARCH_FIELD_VALUE_BOTTOM</option>
|
||||
</field>
|
||||
<field
|
||||
name="imagebutton"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="MOD_SEARCH_FIELD_IMAGEBUTTON_LABEL"
|
||||
description="MOD_SEARCH_FIELD_IMAGEBUTTON_DESC">
|
||||
<option
|
||||
value="">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="button_text"
|
||||
type="text"
|
||||
label="MOD_SEARCH_FIELD_BUTTONTEXT_LABEL"
|
||||
description="MOD_SEARCH_FIELD_BUTTONTEXT_DESC" />
|
||||
<field
|
||||
name="opensearch"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="MOD_SEARCH_FIELD_OPENSEARCH_LABEL"
|
||||
description="MOD_SEARCH_FIELD_OPENSEARCH_DESC"
|
||||
default="1">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="opensearch_title"
|
||||
type="text"
|
||||
label="MOD_SEARCH_FIELD_OPENSEARCH_TEXT_LABEL"
|
||||
description="MOD_SEARCH_FIELD_OPENSEARCH_TEXT_DESC" />
|
||||
<field
|
||||
name="set_itemid"
|
||||
type="text"
|
||||
label="MOD_SEARCH_FIELD_SETITEMID_LABEL"
|
||||
description="MOD_SEARCH_FIELD_SETITEMID_DESC" />
|
||||
</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"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="itemid">
|
||||
<option
|
||||
value="itemid"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
52
modules/mod_search/tmpl/default.php
Normal file
52
modules/mod_search/tmpl/default.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_search
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
<div class="search<?php echo $moduleclass_sfx ?>">
|
||||
<form action="<?php echo JRoute::_('index.php');?>" method="post" class="form-inline">
|
||||
<?php
|
||||
$output = '<label for="mod-search-searchword" class="element-invisible">' . $label . '</label> <input name="searchword" id="mod-search-searchword" maxlength="' . $maxlength . '" class="inputbox search-query" type="text" size="' . $width . '" value="' . $text . '" onblur="if (this.value==\'\') this.value=\'' . $text . '\';" onfocus="if (this.value==\'' . $text . '\') this.value=\'\';" />';
|
||||
|
||||
if ($button) :
|
||||
if ($imagebutton) :
|
||||
$button = ' <input type="image" value="' . $button_text . '" class="button" src="' . $img . '" onclick="this.form.searchword.focus();"/>';
|
||||
else :
|
||||
$button = ' <button class="button btn btn-primary" onclick="this.form.searchword.focus();">' . $button_text . '</button>';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
switch ($button_pos) :
|
||||
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;
|
||||
|
||||
echo $output;
|
||||
?>
|
||||
<input type="hidden" name="task" value="search" />
|
||||
<input type="hidden" name="option" value="com_search" />
|
||||
<input type="hidden" name="Itemid" value="<?php echo $mitemid; ?>" />
|
||||
</form>
|
||||
</div>
|
1
modules/mod_search/tmpl/index.html
Normal file
1
modules/mod_search/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user