本文整理汇总了PHP中XoopsDatabaseFactory::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsDatabaseFactory::getConnection方法的具体用法?PHP XoopsDatabaseFactory::getConnection怎么用?PHP XoopsDatabaseFactory::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsDatabaseFactory
的用法示例。
在下文中一共展示了XoopsDatabaseFactory::getConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initialize parent::__constuct calls this after verifying module object.
*
* @return void
*/
public function init()
{
if (!class_exists('XoopsGroupPermHandler', true)) {
Loader::loadFile(\XoopsBaseConfig::get('root-path') . '/kernel/groupperm.php');
}
$this->mid = $this->module->getVar('mid');
$this->dirname = $this->module->getVar('dirname');
$this->db = \XoopsDatabaseFactory::getConnection();
$this->perm = new \XoopsGroupPermHandler($this->db);
if (class_exists('Xoops', false)) {
$this->xoops = \Xoops::getInstance();
}
}
示例2: _initHandler
/**
* get a handler instance and store in $this->_handlers
*
* @param string $name name of handler to load
*
* @return void
*/
private function _initHandler($name)
{
$this->addLog('INIT ' . $name . ' HANDLER');
if (!isset($this->_handlers[$name])) {
$hnd_file = \XoopsBaseConfig::get('root-path') . "/modules/{$this->dirname}/class/{$name}.php";
if (file_exists($hnd_file)) {
include_once $hnd_file;
}
$class = ucfirst(strtolower($this->dirname)) . ucfirst(strtolower($name)) . 'Handler';
if (class_exists($class)) {
$db = \XoopsDatabaseFactory::getConnection();
$this->_handlers[$name] = new $class($db);
$this->addLog("Loading class '{$class}'");
} else {
$this->addLog("ERROR :: Class '{$class}' could not be loaded");
}
}
}