本文整理汇总了PHP中Xoops::getinstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Xoops::getinstance方法的具体用法?PHP Xoops::getinstance怎么用?PHP Xoops::getinstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xoops
的用法示例。
在下文中一共展示了Xoops::getinstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$xoops = Xoops::getinstance();
$tpl = $xoops->tpl();
if (empty($tpl)) {
$xoops->setTpl(new XoopsTpl());
}
}
示例2: retrieveBlocks
/**
* XoopsThemeBlocksPlugin::retrieveBlocks()
*
* @return void
*/
public function retrieveBlocks()
{
$xoops = Xoops::getinstance();
if ($xoops->isModule()) {
$mid = $xoops->module->getVar('mid');
$isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $xoops->getConfig('startpage') == $xoops->module->getVar('dirname') && empty($_SERVER['QUERY_STRING']);
} else {
$mid = 0;
$isStart = $xoops->getOption('show_cblock');
}
$groups = $xoops->getUserGroups();
$oldzones = array(XOOPS_SIDEBLOCK_LEFT => 'canvas_left', XOOPS_SIDEBLOCK_RIGHT => 'canvas_right', XOOPS_CENTERBLOCK_LEFT => 'page_topleft', XOOPS_CENTERBLOCK_CENTER => 'page_topcenter', XOOPS_CENTERBLOCK_RIGHT => 'page_topright', XOOPS_CENTERBLOCK_BOTTOMLEFT => 'page_bottomleft', XOOPS_CENTERBLOCK_BOTTOM => 'page_bottomcenter', XOOPS_CENTERBLOCK_BOTTOMRIGHT => 'page_bottomright');
foreach ($oldzones as $zone) {
$this->blocks[$zone] = array();
}
$backup = array();
if ($this->theme) {
$template = $this->theme->template;
$backup = array($template->caching, $template->cache_lifetime);
} else {
$template = null;
$template = new XoopsTpl();
}
$block_handler = $xoops->getHandlerBlock();
$block_arr = $block_handler->getAllByGroupModule($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE);
$xoops->preload()->triggerEvent('core.class.theme_blocks.retrieveBlocks', array(&$this, &$template, &$block_arr));
foreach ($block_arr as $block) {
/* @var $block XoopsBlock */
$side = $oldzones[$block->getVar('side')];
if ($var = $this->buildBlock($block, $template)) {
$this->blocks[$side][$var["id"]] = $var;
}
}
if ($this->theme) {
list($template->caching, $template->cache_lifetime) = $backup;
}
}