Plugin() ; $this->name = "wiki" ; $this->text = "Wiki" ; // To show in the tabs, use... $this->hooks[] = "groupmenu"; $this->hooks[] = "groupisactivecheckbox" ; // The "use ..." checkbox in editgroupinfo $this->hooks[] = "groupisactivecheckboxpost" ; // $this->hooks[] = "project_admin_plugins"; // to show up in the project admin page $this->hooks[] = 'search_engines'; $this->hooks[] = 'full_search_engines'; $this->hooks[] = 'cssfile'; $this->hooks[] = 'project_public_area'; $this->hooks[] = 'activity'; } function CallHook ($hookname, & $params) { global $G_SESSION,$HTML; if (is_array($params) && isset($params['group'])) $group_id=$params['group']; if ($hookname == "groupmenu") { $project = group_get_object($group_id); if (!$project || !is_object($project)) return; if ($project->isError()) return; if (!$project->isProject()) return; if ( $project->usesPlugin ( $this->name ) ) { $params['TITLES'][]=$this->text; $params['DIRS'][]='/wiki/g/'.$project->getUnixName().'/HomePage'; } else { $this->hooks["groupmenu"] = ""; //$params['TITLES'][]=$this->text." [Off]"; //$params['DIRS'][]='/wiki/index.php?off=true'; } if (isset($params['toptab'])) { (($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' ); } } elseif ($hookname == "project_admin_plugins") { // this displays the link in the project admin options page to its administration page. $group_id = $params['group_id']; $group = group_get_object($group_id); if ( $group->usesPlugin ( $this->name ) ) { echo '
'; } } elseif ($hookname == 'search_engines') { // FIXME: when the hook is called, the group_id is not set. // So I use the global variable instead. $group_id = $GLOBALS['group_id']; if ($group_id) { $group = group_get_object($group_id); if (!$group || !is_object($group)) { return; } if ($group->usesPlugin('wiki')) { $searchManager = $params['object']; $searchManager->addSearchEngine( SEARCH__TYPE_IS_WIKI, new WikiSearchEngine(SEARCH__TYPE_IS_WIKI, 'WikiHtmlSearchRenderer', _("This projects's wiki"), $group_id) ); } } } elseif ($hookname == 'full_search_engines') { // FIXME: when the hook is called, the group_id is not set. // So I use the global variable instead. $group_id = $GLOBALS['group_id']; $group = group_get_object($group_id); if ($group->usesPlugin ( $this->name)) { global $gfwww, $gfcommon, $gfplugins; require_once('plugins/wiki/common/WikiHtmlSearchRenderer.class.php'); $wikiRenderer = new WikiHtmlSearchRenderer($params->words, $params->offset, $params->isExact, $params->groupId); $validLength = (strlen($params->words) >= 3); if ($validLength || (is_numeric($params->words) && $wikiRenderer->searchQuery->implementsSearchById())) { $html = $params->getPartResult($wikiRenderer, 'short_wiki', 'Wiki'); return $html; } } } elseif ($hookname == 'cssfile') { if (defined('PHPWIKI_BASE_URL')) { echo ''; echo "\n".' '; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".'