Plugin() ; $this->name = "wiki" ; $this->text = "Wiki" ; // To show in the tabs, use... // $this->hooks[] = "user_personal_links"; //to make a link to the user's personal wiki // $this->hooks[] = "usermenu" ; $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[] = "userisactivecheckbox" ; // The "use ..." checkbox in user account // $this->hooks[] = "userisactivecheckboxpost" ; // $this->hooks[] = 'search_engines'; $this->hooks[] = 'full_search_engines'; $this->hooks[] = 'cssfile'; $this->hooks[] = 'activity'; } function CallHook ($hookname, & $params) { global $G_SESSION,$HTML; if (is_array($params) && isset($params['group'])) $group_id=$params['group']; $use_wikiplugin = getIntFromRequest('use_wikiplugin'); if ($hookname == "usermenu") { $text = $this->text; if ( ($G_SESSION) && ($G_SESSION->usesPlugin("wiki")) ) { $param = '?id=' . $G_SESSION->getId() . '&type=u'; echo ' | ' . $HTML->PrintSubMenu (array ($text), array ('/wiki/u/'. $user_name.'/HomePage' )); } else { $this->hooks["usermenu"] = "" ; //$param = "?off=true"; } } elseif ($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'][]='/plugins/wiki/index.php?off=true'; } (($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' ); } elseif ($hookname == "groupisactivecheckbox") { //Check if the group is active $group = &group_get_object($group_id); echo "
' . _("View Personal Wiki") .'
'; } } 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)) { 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 (strncmp(preg_replace('/^\/+/', '/', $_SERVER['REQUEST_URI']), '/wiki/', 6) == 0) { echo ''; echo ''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".''; echo "\n".'