本文整理汇总了PHP中XoopsBaseConfig::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsBaseConfig::getInstance方法的具体用法?PHP XoopsBaseConfig::getInstance怎么用?PHP XoopsBaseConfig::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsBaseConfig
的用法示例。
在下文中一共展示了XoopsBaseConfig::getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
use Xoops\Core\Request;
/**
* XOOPS admin file
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package core
* @version $Id$
*/
include __DIR__ . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->isAdminSide = true;
include_once $xoops->path('include/cp_functions.php');
$xbc = \XoopsBaseConfig::getInstance();
/**
* Admin Authentication
*/
if ($xoops->isUser()) {
if (!$xoops->user->isAdmin(-1)) {
$xoops->redirect('index.php', 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
exit;
}
} else {
$xoops->redirect('index.php', 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
exit;
}
$xoops->header();
// ###### Output warn messages for security ######
/**
示例2: execute
/**
* write a configuration file in the current directory, and write htdocs/mainfile.php
* that references that configuration relative to the console/Commands directory.
*
* @param InputInterface $input input handler
* @param OutputInterface $output output handler
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$XContainer = $this->getApplication()->XContainer;
$configFile = $XContainer->get('configfile');
$mainfile = $XContainer->get('mainfile');
$baseDir = dirname($mainfile);
if (!file_exists($configFile)) {
$baseDir = dirname($mainfile);
if (false === $this->createConfigFile($configFile, $baseDir)) {
$output->writeln(sprintf('<error>Could not write file %s!</error>', $configFile));
return;
}
$output->writeln(sprintf('<info>Created config file %s.</info>', $configFile));
} else {
$output->writeln(sprintf('<info>Using existing config file %s.</info>', $configFile));
}
if (!file_exists($mainfile)) {
if (false === $this->createMainfile($configFile, $mainfile)) {
$output->writeln(sprintf('<error>Could not write %s!</error>', $mainfile));
return;
}
$output->writeln(sprintf('<info>Wrote mainfile %s</info>', $mainfile));
} else {
$output->writeln(sprintf('<info>Using existing mainfile %s</info>', $mainfile));
}
if (!class_exists('\\XoopsBaseConfig', false)) {
include $baseDir . '/class/XoopsBaseConfig.php';
\XoopsBaseConfig::getInstance($configFile);
}
\Xoops\Core\Cache\CacheManager::createDefaultConfig();
}