function onLoad() { require_once 'ChallengeStats/ChallengeStats.php'; $files = libFilesystem::getFiles('plugins/user/ChallengeStats/sites/', 'php'); foreach ($files as $file) { require_once 'ChallengeStats/sites/' . $file; $classname = substr($file, 0, -4); $Class = new $classname($this); $c = 0; foreach ($Class->triggers as $trigger) { if ($c++ == 0) { $this->helpTriggers[] = $trigger; } $this->triggers[] = $trigger; $this->links[$trigger] = $classname; } } }
private function initPlugins() { $userplugin_files = libFilesystem::getFiles('plugins/user/', 'php'); $coreplugin_files = libFilesystem::getFiles('plugins/core/', 'php'); $files = array(); foreach ($coreplugin_files as $file) { $files[] = array('filename' => $file, 'isCore' => true); } foreach ($userplugin_files as $file) { $files[] = array('filename' => $file, 'isCore' => false); } foreach ($files as $file) { $classname = substr($file['filename'], 0, -4); list($crap, $plugin_name) = explode('_', $classname, 2); echo 'Loading ' . ($file['isCore'] ? 'core' : 'user') . ' plugin ' . $plugin_name . '..' . "\n"; require_once 'plugins/' . ($file['isCore'] ? 'core/' : 'user/') . $file['filename']; $Plugin = new $classname($this, $this->MySQL); $Plugin->onLoad(); $this->plugins[$Plugin->id] = $Plugin; } }
private function updateGames() { $files = libFilesystem::getFiles(self::FILEDIR, 'conf'); $additions = array(); foreach ($files as $file) { $config = libFile::parseConfigFile(self::FILEDIR . $file); if (file_exists(self::FILEDIR . 'games/' . $config['gamefile'])) { if (!isset($this->games[$config['id']])) { $additions[] = $config['name']; } $this->games[$config['id']] = $config; } } return $additions; }