Searchbox plugin searches fulltext by default - thanks Lubomir :)

This commit is contained in:
azett 2019-02-02 14:07:40 +01:00
parent bd796129f2
commit e1b646e87e

View File

@ -1,48 +1,40 @@
<?php <?php
/* /*
Plugin Name: SearchBox * Plugin Name: SearchBox
Version: 1.0 * Version: 1.0
Plugin URI: http://flatpress.sf.net * Plugin URI: http://flatpress.sf.net
Description: SearchBox which interfaces with standard search function * Description: SearchBox which interfaces with standard search function
Author: NoWhereMan * Author: NoWhereMan
Author URI: http://flatpress.sf.net * Author URI: http://flatpress.sf.net
*/ */
define('SEARCHBOX_BIG', false); define('SEARCHBOX_BIG', false);
function plugin_searchbox_widget() { function plugin_searchbox_widget() {
global $lang; global $lang;
$url = BLOG_BASEURL . 'search.php'; $url = BLOG_BASEURL . 'search.php';
$content = '<ul><li> $content = '<ul><li>
<form method="get" action="'.$url.'">'; <form method="get" action="' . $url . '">
<input type="hidden" name="stype" value="full" />';
if (SEARCHBOX_BIG)
$content .= "<p><a href=\"{$url}\">{$lang['search']['moreopts']}</a></p>"; if (SEARCHBOX_BIG)
$content .= "<p><a href=\"{$url}\">{$lang['search']['moreopts']}</a></p>";
$content .= '<p><input type="text" name="q" /></p>';
$content .= '<p><input type="text" name="q" /></p>';
if (SEARCHBOX_BIG)
$content .= if (SEARCHBOX_BIG)
'<p><label><input type="radio" $content .= '<p><label><input type="radio"
name="stype" value="titles" checked="checked" />'. name="stype" value="titles" checked="checked" />' . $lang ['search'] ['onlytitles'] . '</label><br />' . '<label><input type="radio" name="stype" value="full" />' . $lang ['search'] ['fulltext'] . '</label></p>';
$lang['search']['onlytitles'] .
'</label><br />'. $content .= '<p><input name="search" type="submit" value="' . $lang ['search'] ['submit'] . '" /> </p>
'<label><input type="radio" name="stype" value="full" />'.
$lang['search']['fulltext'] .
'</label></p>';
$content.= '<p><input name="search" type="submit" value="'.
$lang['search']['submit']. '" /> </p>
</form> </form>
</li></ul>'; </li></ul>';
return array( return array(
'subject' => $lang['search']['head'], 'subject' => $lang ['search'] ['head'],
'content' => $content 'content' => $content
); );
} }
register_widget('searchbox', 'SearchBox', 'plugin_searchbox_widget'); register_widget('searchbox', 'SearchBox', 'plugin_searchbox_widget');