is enough. * Fancier Inputforms can be made using WikiForm Rich, to support regex and case_exact args. * * If only one pages is found and auto_redirect is true, this page is displayed immediatly, * otherwise the found pagelist is displayed. * The workhorse TextSearchQuery converts the query string from google-style words * to the required DB backend expression. * (word and word) OR word, -word, "two words" * regex=auto tries to detect simple glob-style wildcards and expressions, * like xx*, *xx, ^xx, xx$, ^word$. */ class WikiPlugin_TitleSearch extends WikiPlugin { function getName () { return _("TitleSearch"); } function getDescription () { return _("Search the titles of all pages in this wiki."); } function getVersion() { return preg_replace("/[Revision: $]/", '', "\$Revision$"); } function getDefaultArguments() { return array_merge ( PageList::supportedArgs(), // paging and more. array('s' => false, 'auto_redirect' => false, 'noheader' => false, 'exclude' => false, 'info' => false, 'case_exact' => false, 'regex' => 'auto', 'format' => false, )); } // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor // exclude arg allows multiple pagenames exclude=Php*,RecentChanges function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); if (empty($args['s'])) { return HTML::div(array('class' => "error"), "Please provide 's' argument to the plugin."); } $query = new TextSearchQuery($args['s'], $args['case_exact'], $args['regex']); $pages = $dbi->titleSearch($query,$args['sortby'],$args['limit'],$args['exclude']); $pagelist = new PageList($args['info'], $args['exclude'], $args); $pagelist->addPages($pages); // this hack will go away if ($args['format'] == 'livesearch') { $request->discardOutput(); $request->buffer_output(false); echo '