false, 'auto_redirect' => false, 'noheader' => false, 'exclude' => false, 'info' => false, 'case_exact' => false, 'regex' => 'auto', )); } // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); if (empty($args['s'])) return ''; //extract($args); $query = new TextSearchQuery($args['s'], $args['case_exact'], $args['regex']); $pages = $dbi->titleSearch($query); $pagelist = new PageList($args['info'], $args['exclude'], $args); while ($page = $pages->next()) { $pagelist->addPage($page); $last_name = $page->getName(); } // Provide an unknown WikiWord link to allow for page creation // when a search returns no results if (!$args['noheader']) $pagelist->setCaption(fmt("Title search results for '%s'", $pagelist->getTotal() == 0 ? WikiLink($args['s'], 'auto') : $args['s'])); if ($args['auto_redirect'] && ($pagelist->getTotal() == 1)) { return HTML($request->redirect(WikiURL($last_name, false, 'absurl'), false), $pagelist); } return $pagelist; } }; // $Log: not supported by cvs2svn $ // Revision 1.24 2004/11/25 08:30:58 rurban // dont extract args // // Revision 1.23 2004/11/23 15:17:19 rurban // better support for case_exact search (not caseexact for consistency), // plugin args simplification: // handle and explode exclude and pages argument in WikiPlugin::getArgs // and exclude in advance (at the sql level if possible) // handle sortby and limit from request override in WikiPlugin::getArgs // ListSubpages: renamed pages to maxpages // // Revision 1.22 2004/11/23 13:35:49 rurban // add case_exact search // // Revision 1.21 2004/02/17 12:11:36 rurban // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) // // Revision 1.20 2003/11/02 20:42:35 carstenklapp // Allow for easy page creation when search returns no matches. // Based on cuthbertcat's patch, SF#655090 2002-12-17. // // Revision 1.19 2003/03/07 02:50:16 dairiki // Fixes for new javascript redirect. // // Revision 1.18 2003/02/21 04:16:51 dairiki // Don't NORETURN from redirect. // // Revision 1.17 2003/01/18 22:08:01 carstenklapp // Code cleanup: // Reformatting & tabs to spaces; // Added copyleft, getVersion, getDescription, rcs_id. // // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>