public static function instance() { if (self::$instance == null) { self::$instance = new ModuleManager(); } return self::$instance; }
/** * Initialising the ModuleManger * * The ModuleManager reads the possible Modules from the ModulesDirectory * @return ModuleManager */ public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new ModuleManager(); } return self::$instance; }
/** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { $moduleName = $options['moduleName']; $siteName = $GLOBALS['site']->getUnixName(); // check if the site is allowed to use this module $mm = ModuleManager::instance(); if ($mm->canWikiUseModule($siteName, $moduleName) == false) { return $this->renderError(sprintf(_("Module <em>%s</em> does not exist or can not be used within this site."), $moduleName)); } $attr = $options['attr']; if ($options['module_body']) { $attr .= ' module_body="' . urlencode($options['module_body']) . '"'; } $templateName = $mm->resolveWikiModuleName($moduleName); $d = utf8_encode("þ"); $out = $d . "module \"" . $templateName . "\""; if ($attr !== null && $attr !== '') { $out .= " " . urlencode($attr) . " "; } $out .= $d; return $out; }