本文整理汇总了PHP中PluginRegistry::activate_plugin_from_dirname方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginRegistry::activate_plugin_from_dirname方法的具体用法?PHP PluginRegistry::activate_plugin_from_dirname怎么用?PHP PluginRegistry::activate_plugin_from_dirname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginRegistry
的用法示例。
在下文中一共展示了PluginRegistry::activate_plugin_from_dirname方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
trace('Enter');
// Select a supported language.
if ($_SERVER['HTTP_ACCEPT_LANGUAGE']) {
$langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach ($langs as $current) {
if (strstr($current, '-')) {
$both = explode('-', $current);
$current = $both[0] . '_' . strtoupper($both[1]);
}
$best = $this->_get_language($current);
if ($best) {
$lang = $best;
break;
}
}
}
// Fallback to the default language.
if (!$lang || !preg_match('/^[a-z_]*$/i', $lang)) {
$lang = cfg('default_language');
}
// Init gettext.
if (!function_exists('gettext')) {
die('This webserver does not have gettext installed.<br/>' . 'Please contact your webspace provider.');
}
$locale_dir = './language/';
$domain = 'freech';
putenv("LANG={$lang}.UTF-8");
@setlocale(LC_ALL, '');
bindtextdomain($domain, $locale_dir);
textdomain($domain);
bind_textdomain_codeset($domain, 'UTF-8');
trace('Gettext initialized');
// Start the PHP session.
session_set_cookie_params(time() + cfg('login_time'));
if ($_COOKIE['permanent_session']) {
session_id($_COOKIE['permanent_session']);
session_start();
} else {
session_start();
if (strtoupper($_POST['permanent']) === 'ON') {
setcookie('permanent_session', session_id(), time() + cfg('login_time'));
}
}
trace('Session started');
// Only now start the timer, as cookie handling may scew the result.
$this->start_time = microtime(TRUE);
// (Ab)use a Trackable as an eventbus.
$this->eventbus = new Trackable();
$this->actions = array();
$this->views = array();
$this->current_user = NULL;
$this->current_forum = NULL;
$this->links = array('forum' => new Menu(), 'page' => new Menu(), 'search' => new Menu(), 'view' => new Menu(), 'footer' => new Menu(), 'account' => new Menu(), 'breadcrumbs' => new Menu());
trace('Eventbus created');
// Connect to the DB.
$dbn = cfg('db_dbn');
if (cfg('persistent_db_connection')) {
$dbn .= '?persist';
}
$this->db = ADONewConnection($dbn) or die('FreechForum::FreechForum(): Error: Can\'t connect.' . ' Please check username, password and hostname.');
if (cfg('db_debug', FALSE)) {
// enable AdoDB debug mode
$this->db->debug = true;
}
global $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
trace('DB connection opened');
$this->forumdb = new ForumDB($this->api);
trace('ForumDB set up');
$registry = new PluginRegistry();
trace('Plugin registry initialized');
foreach (cfg('plugins') as $plugin => $active) {
if ($active) {
$registry->activate_plugin_from_dirname('plugins/' . $plugin, $this->api);
}
}
trace('Plugins activated');
$this->_handle_cookies();
trace('Cookies initialized');
// Initialize the visitordb after cookie handling to prevent useless
// updates.
if (!cfg('disable_visitor_counter')) {
require 'services/visitordb.class.php';
$this->visitordb = new VisitorDB($this->db);
trace('VisitorDB initialized');
$this->visitordb->count();
}
trace('Visitor counted');
/* Plugin hook: on_construct
* Called from within the FreechForum() constructor before any
* other output is produced.
* The return value of the callback is ignored.
* Args: None.
*/
$this->eventbus->emit('on_construct', $this->api);
trace('on_construct calls completed.');
// Attempt to login, if requested.
$this->login_error = 0;
//.........这里部分代码省略.........