本文整理汇总了PHP中modules::load_module方法的典型用法代码示例。如果您正苦于以下问题:PHP modules::load_module方法的具体用法?PHP modules::load_module怎么用?PHP modules::load_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modules
的用法示例。
在下文中一共展示了modules::load_module方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rehash_command
public static function rehash_command($nick, $ircdata = array())
{
$parser = new parser(CONFPATH . 'services.conf');
// load the parser
$total_modules_exceptions = array();
$mod_info = array('cs' => 'chanserv', 'ns' => 'nickserv', 'os' => 'operserv', 'core' => 'core');
foreach ($mod_info as $short => $full) {
$category_name = $full . '_modules';
foreach (core::$config->{$category_name} as $id => $module) {
$total_modules[$short . '_' . $module] = array('type' => $short, 'file' => $module . '.' . $short . '.php');
}
}
// merge all the arrays to check that the loaded and excluded modules are all correct
foreach (modules::$list as $name => $details) {
if (!isset($total_modules[$name]) && $details['extra'] != 'static') {
if (is_callable(array($name, 'modunload'), true) && method_exists($name, 'modunload')) {
modules::$list[$name]['class']->modunload();
}
// if the module has an unload method, call it now before we destroy the class.
unset(modules::$list[$name]);
modules::_unset_docs($name);
// destory relevant data to the module
core::alog(core::$config->operserv->nick . ': unloaded module ' . $name);
ircd::globops(core::$config->operserv->nick, 'unloaded module ' . $name);
// unset the module
core::alog('rehash_command(): ' . $name . ' unloaded from rehash', 'BASIC');
// log what we need to log.
}
// the module is loaded and should be unloaded
}
// go through each set module and unset the now exempt modules
foreach ($total_modules as $name => $details) {
if (!isset(modules::$list[$name])) {
if (!class_exists($name)) {
modules::load_module($name, $details['file']);
// load the module
} else {
if (!(modules::$list[$name]['class'] = new $name())) {
core::alog('load_module(): unable to start: ' . $name . ' (boot error)', 'BASIC');
return false;
}
}
core::alog(core::$config->operserv->nick . ': loaded module ' . $name);
ircd::globops(core::$config->operserv->nick, 'loaded module ' . $name);
// load it up
core::alog('rehash_command(): ' . $name . ' loaded from rehash', 'BASIC');
// log what we need to log.
modules::$list[$name]['class']->modload();
// onload handler.
}
}
// go through every module
// load the ones that are new.
core::alog(core::$config->operserv->nick . ': Successfully reloaded configuration.');
ircd::globops(core::$config->operserv->nick, $nick . ' performed a REHASH');
core::alog('rehash_command(): sucessful rehash', 'BASIC');
// log what we need to log.
}
示例2: __construct
public function __construct()
{
require BASEPATH . '/lang/' . core::$config->server->lang . '/nickserv.php';
self::$help =& $help;
if (isset(core::$config->nickserv)) {
ircd::introduce_client(core::$config->nickserv->nick, core::$config->nickserv->user, core::$config->nickserv->host, core::$config->nickserv->real);
} else {
return;
}
// connect the bot
foreach (core::$config->nickserv_modules as $id => $module) {
modules::load_module('ns_' . $module, $module . '.ns.php');
}
// load the nickserv modules
timer::add(array('nickserv', 'check_expire', array()), 300, 0);
// set a timer!
}
示例3: __construct
public function __construct()
{
require BASEPATH . '/lang/' . core::$config->server->lang . '/operserv.php';
self::$help =& $help;
// load the help file
if (isset(core::$config->operserv)) {
ircd::introduce_client(core::$config->operserv->nick, core::$config->operserv->user, core::$config->operserv->host, core::$config->operserv->real);
} else {
return;
}
// connect the bot
foreach (core::$config->operserv_modules as $id => $module) {
modules::load_module('os_' . $module, $module . '.os.php');
}
// load the operserv modules
if (core::$config->operserv->override) {
self::add_help('operserv', 'help', &self::$help->OS_HELP_OVERRIDE_1);
self::add_help('operserv', 'help override', &self::$help->OS_HELP_OVERRIDE_ALL);
// add the help
self::add_command('override', 'operserv', 'override_command');
// add the override command
}
// if override is set to true
}
示例4: boot_server
public function boot_server()
{
if (!self::$booted) {
self::$booted = true;
ircd::init_server(self::$config->server->name, self::$config->conn->password, self::$config->server->desc, self::$config->server->numeric);
// init the server
foreach (self::$service_bots as $bot) {
require BASEPATH . '/core/services/' . $bot . '.php';
$this->{$bot} = new $bot();
}
// start our bots up.
foreach (self::$config->core_modules as $id => $module) {
modules::load_module('core_' . $module, $module . '.core.php');
}
// we load core modules before the bots, incase there
// is a module that changes an existing function w/e
timer::init();
// setup the timer, socket_blocking to 0 is required.
}
}
示例5: modload_command
public function modload_command($nick, $ircdata = array())
{
$module = $ircdata[0];
// get the module thats been requested.
if (services::is_root($nick)) {
if (trim($module) == '') {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX_RE, array('help' => 'MODLOAD'));
// wrong syntax
return false;
}
if (isset(modules::$list[$module])) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_MODLOAD_3, array('name' => $module));
return false;
}
if (!class_exists($module)) {
modules::load_module($name, $details['file']);
// load the module
} else {
if (!(modules::$list[$module]['class'] = new $module())) {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_MODLOAD_1, array('name' => $module));
core::alog(core::$config->operserv->nick . ': unable to load module ' . $module);
core::alog('modload_command(): unable to load module ' . $module . ' (boot error)', 'BASIC');
// log what we need to log.
return false;
}
// module failed to start
}
// load the module, if the class don't exist, include it
modules::$list[$module]['class']->modload();
// onload handler.
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_MODLOAD_2, array('name' => $module));
core::alog(core::$config->operserv->nick . ': loaded module ' . $module);
ircd::globops(core::$config->operserv->nick, $nick . ' loaded module ' . $module);
// let everyone know
} else {
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_ACCESS_DENIED);
}
}