当前位置: 首页>>代码示例>>PHP>>正文


PHP XoopsLogger::getInstance方法代码示例

本文整理汇总了PHP中XoopsLogger::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLogger::getInstance方法的具体用法?PHP XoopsLogger::getInstance怎么用?PHP XoopsLogger::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XoopsLogger的用法示例。


在下文中一共展示了XoopsLogger::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test___class

 public function test___class()
 {
     $instance = XoopsLogger::getInstance();
     $this->assertInstanceOf($this->myclass, $instance);
     $value = $instance->tutu('tutu');
     $this->assertSame(null, $value);
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:7,代码来源:xoopsloggerTest.php

示例2: ucfirst

 /**
  * Get a reference to the only instance of database class and connects to DB
  *
  * if the class has not been instantiated yet, this will also take
  * care of that
  *
  * @static
  * @staticvar object  The only instance of database class
  * @return object Reference to the only instance of database class
  */
 static function &getDatabaseConnection()
 {
     static $instance;
     if (!isset($instance)) {
         if (file_exists($file = XOOPS_ROOT_PATH . '/class/database/' . XOOPS_DB_TYPE . 'database.php')) {
             require_once $file;
             if (!defined('XOOPS_DB_PROXY')) {
                 $class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseSafe';
             } else {
                 $class = 'Xoops' . ucfirst(XOOPS_DB_TYPE) . 'DatabaseProxy';
             }
             $xoopsPreload =& XoopsPreload::getInstance();
             $xoopsPreload->triggerEvent('core.class.database.databasefactory.connection', array(&$class));
             $instance = new $class();
             $instance->setLogger(XoopsLogger::getInstance());
             $instance->setPrefix(XOOPS_DB_PREFIX);
             if (!$instance->connect()) {
                 trigger_error('notrace:Unable to connect to database', E_USER_ERROR);
             }
         } else {
             trigger_error('notrace:Failed to load database of type: ' . XOOPS_DB_TYPE . ' in file: ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
         }
     }
     return $instance;
 }
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:35,代码来源:databasefactory.php

示例3: get_modules_ajax

function get_modules_ajax()
{
    XoopsLogger::getInstance()->activated = false;
    XoopsLogger::getInstance()->renderingEnabled = false;
    $db = Database::getInstance();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("modules");
    $page = rmc_server_var($_POST, 'page', 1);
    $limit = RMFunctions::configs('mods_number');
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('javascript:;" onclick="get_mods_page({PAGE_NUM})');
    $sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $installed_mods = array();
    while ($row = $db->fetchArray($result)) {
        $mod = new XoopsModule();
        $mod->assignVars($row);
        $installed_mods[] = $mod;
    }
    include RMTemplate::get()->get_template('rmc_mods_installed.php', 'module', 'rmcommon');
    die;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:25,代码来源:index.php

示例4: footer

 public function footer()
 {
     global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoTheme, $rmc_config, $xoopsModule;
     $xoopsLogger =& XoopsLogger::getInstance();
     $xoopsLogger->stopTime('Module display');
     if (!headers_sent()) {
         header('Content-Type:text/html; charset=' . _CHARSET);
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header('Cache-Control: private, no-cache');
         header("Cache-Control: post-check=0, pre-check=0", false);
         header('Pragma: no-cache');
     }
     //@internal: using global $xoTheme dereferences the variable in old versions, this does not
     //if (!isset($xoTheme)) $xoTheme =& $GLOBALS['xoTheme'];
     if (!isset($xoTheme)) {
         $xoTheme =& $GLOBALS['xoTheme'];
     }
     if (isset($xoopsOption['template_main']) && $xoopsOption['template_main'] != $xoTheme->contentTemplate) {
         trigger_error("xoopsOption[template_main] should be defined before call xoops_cp_header function", E_USER_WARNING);
         if (false === strpos($xoopsOption['template_main'], ':')) {
             $xoTheme->contentTemplate = 'db:' . $xoopsOption['template_main'];
         } else {
             $xoTheme->contentTemplate = $xoopsOption['template_main'];
         }
     }
     $metas = $xoTheme->metas['script'];
     $xoTheme->metas['script'] = array();
     foreach ($metas as $id => $meta) {
         if (strpos($id, 'jquery/jquery.js') === FALSE && strpos($id, 'jquery/plugins/jquery.ui.js') === FALSE) {
             $xoTheme->metas['script'][$id] = $meta;
         }
     }
     // Check if current theme have a replacement for template
     if (preg_match("/^db:(.*)/i", $xoTheme->contentTemplate, $match)) {
         $file = RMCPATH . '/themes/' . $rmc_config['theme'] . '/modules/' . $xoopsModule->dirname() . '/' . $match[1];
         if (is_file($file)) {
             $xoTheme->contentTemplate = $file;
         }
     }
     $xoTheme->render();
     $xoopsLogger->stopTime();
     // RMCommon Templates
     RMTemplate::get()->footer();
     die;
 }
开发者ID:txmodxoops,项目名称:rmcommon,代码行数:45,代码来源:redmexico.php

示例5: footer

 function footer()
 {
     global $xoopsConfig, $xoopsOption, $xoopsTpl, $xoTheme;
     $xoopsLogger =& XoopsLogger::getInstance();
     $xoopsLogger->stopTime('Module display');
     if (!headers_sent()) {
         header('Content-Type:text/html; charset=' . _CHARSET);
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header('Cache-Control: private, no-cache');
         header('Pragma: no-cache');
     }
     //@internal: using global $xoTheme dereferences the variable in old versions, this does not
     if (!isset($xoTheme)) {
         $xoTheme =& $GLOBALS['xoTheme'];
     }
     $xoTheme->render();
     $xoopsLogger->stopTime();
     ob_end_flush();
 }
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:19,代码来源:gui.php

示例6: error

<?php

// $Id: upload.php 825 2011-12-09 00:06:11Z i.bitcero $
// --------------------------------------------------------------
// Red México Common Utilities
// A framework for Red México Modules
// Author: Eduardo Cortés <i.bitcero@gmail.com>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
include '../../../mainfile.php';
XoopsLogger::getInstance()->activated = false;
XoopsLogger::getInstance()->renderingEnabled = false;
function error($message)
{
    $data['error'] = 1;
    $data['message'] = $message;
    echo json_encode($data);
    die;
}
/**
* Handle uploaded image files only.
*/
$security = TextCleaner::getInstance()->decrypt(rmc_server_var($_POST, 'rmsecurity', 0), true);
$category = rmc_server_var($_POST, 'category', 0);
$data = $security;
//base64_decode($security);
$data = explode("|", $data);
// [0] = referer, [1] = session_id(), [2] = user, [3] = token
$xoopsUser = new XoopsUser($data[0]);
if (!isset($data[1]) || $data[1] != RMCURL . '/images.php') {
开发者ID:laiello,项目名称:bitcero-modules,代码行数:31,代码来源:upload.php

示例7: __construct

 public function __construct()
 {
     $this->db = XoopsDatabaseFactory::getDatabase();
     $this->db->setPrefix(XOOPS_DB_PREFIX);
     $this->db->setLogger(XoopsLogger::getInstance());
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:6,代码来源:dbmanager.php

示例8: xos_kernel_Xoops2

$xoops = new xos_kernel_Xoops2();
$xoops->pathTranslation();
$xoopsRequestUri =& $_SERVER['REQUEST_URI'];
// Deprecated (use the corrected $_SERVER variable now)
/**
 * Create Instance of xoopsSecurity Object and check Supergolbals
 */
XoopsLoad::load('xoopssecurity');
$xoopsSecurity = new XoopsSecurity();
$xoopsSecurity->checkSuperglobals();
/**
 * Create Instantance XoopsLogger Object
 */
XoopsLoad::load('xoopslogger');
$xoopsLogger =& XoopsLogger::getInstance();
$xoopsErrorHandler =& XoopsLogger::getInstance();
$xoopsLogger->startTime();
$xoopsLogger->startTime('XOOPS Boot');
/**
 * Include Required Files
 */
include_once $xoops->path('kernel/object.php');
include_once $xoops->path('class/criteria.php');
include_once $xoops->path('class/module.textsanitizer.php');
include_once $xoops->path('include/functions.php');
/**
 * YOU SHOULD NEVER USE THE FOLLOWING CONSTANT, IT WILL BE REMOVED
 */
/**
 * Set cookie dope for multiple subdomains remove the '.'. to use top level dope for session cookie;
 * Requires functions
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:common.php

示例9: db_manager

 function db_manager()
 {
     $this->db = XoopsDatabaseFactory::getDatabase();
     $this->db->setPrefix(XOOPS_DB_PREFIX);
     $this->db->setLogger(XoopsLogger::getInstance());
 }
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:6,代码来源:dbmanager.php

示例10: make_cblock

function make_cblock()
{
    global $xoopsUser, $xoopsOption;
    $xoopsblock = new XoopsBlock();
    $cc_block = $cl_block = $cr_block = '';
    $arr = array();
    if ($xoopsOption['theme_use_smarty'] == 0) {
        if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {
            include_once $GLOBALS['xoops']->path('class/template.php');
            $xoopsTpl = new XoopsTpl();
        } else {
            $xoopsTpl =& $GLOBALS['xoopsTpl'];
        }
        if (is_object($xoopsUser)) {
            $block_arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
        } else {
            $block_arr = $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
        }
        $block_count = count($block_arr);
        $xoopsLogger = XoopsLogger::getInstance();
        for ($i = 0; $i < $block_count; ++$i) {
            $bcachetime = (int) $block_arr[$i]->getVar('bcachetime');
            if (empty($bcachetime)) {
                $xoopsTpl->caching = 0;
            } else {
                $xoopsTpl->caching = 2;
                $xoopsTpl->cache_lifetime = $bcachetime;
            }
            $btpl = $block_arr[$i]->getVar('template');
            if ($btpl != '') {
                if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl)) {
                    $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
                    $bresult =& $block_arr[$i]->buildBlock();
                    if (!$bresult) {
                        continue;
                    }
                    $xoopsTpl->assign_by_ref('block', $bresult);
                    $bcontent =& $xoopsTpl->fetch('db:' . $btpl);
                    $xoopsTpl->clear_assign('block');
                } else {
                    $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
                    $bcontent =& $xoopsTpl->fetch('db:' . $btpl);
                }
            } else {
                $bid = $block_arr[$i]->getVar('bid');
                if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.tpl', 'blk_' . $bid)) {
                    $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
                    $bresult =& $block_arr[$i]->buildBlock();
                    if (!$bresult) {
                        continue;
                    }
                    $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);
                    $bcontent =& $xoopsTpl->fetch('db:system_dummy.tpl', 'blk_' . $bid);
                    $xoopsTpl->clear_assign('block');
                } else {
                    $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
                    $bcontent =& $xoopsTpl->fetch('db:system_dummy.tpl', 'blk_' . $bid);
                }
            }
            $title = $block_arr[$i]->getVar('title');
            switch ($block_arr[$i]->getVar('side')) {
                case XOOPS_CENTERBLOCK_CENTER:
                    if ($title != '') {
                        $cc_block .= '<tr valign="top"><td colspan="2"><strong>' . $title . '</strong><hr />' . $bcontent . '<br><br></td></tr>' . "\n";
                    } else {
                        $cc_block .= '<tr><td colspan="2">' . $bcontent . '<br><br></td></tr>' . "\n";
                    }
                    break;
                case XOOPS_CENTERBLOCK_LEFT:
                    if ($title != '') {
                        $cl_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
                    } else {
                        $cl_block .= '<p>' . $bcontent . '</p>' . "\n";
                    }
                    break;
                case XOOPS_CENTERBLOCK_RIGHT:
                    if ($title != '') {
                        $cr_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
                    } else {
                        $cr_block .= '<p>' . $bcontent . '</p>' . "\n";
                    }
                    break;
                default:
                    break;
            }
            unset($bcontent, $title);
        }
        echo '<table width="100%">' . $cc_block . '<tr valign="top"><td width="50%">' . $cl_block . '</td><td width="50%">' . $cr_block . '</td></tr></table>' . "\n";
    }
}
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:90,代码来源:old_functions.php

示例11: defined

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @package         kernel
 * @since           2.0.0
 * @version         $Id: footer.php 12537 2014-05-19 14:19:33Z beckmi $
 */
defined('XOOPS_ROOT_PATH') || die('Restricted access');
$xoopsPreload =& XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.footer.start');
if (!defined("XOOPS_FOOTER_INCLUDED")) {
    define("XOOPS_FOOTER_INCLUDED", 1);
    $xoopsLogger =& XoopsLogger::getInstance();
    $xoopsLogger->stopTime('Module display');
    if ($xoopsOption['theme_use_smarty'] == 0) {
        // the old way
        $footer = htmlspecialchars($xoopsConfigMetaFooter['footer']) . '<br /><div class="txtcenter small">Powered by XOOPS &copy; <a href="http://xoops.sourceforge.net" rel="external" title="The XOOPS Project">The XOOPS Project</a></div>';
        if (isset($xoopsOption['template_main'])) {
            $xoopsTpl->caching = 0;
            $xoopsTpl->display('db:' . $xoopsOption['template_main']);
        }
        if (!isset($xoopsOption['show_rblock'])) {
            $xoopsOption['show_rblock'] = 0;
        }
        themefooter($xoopsOption['show_rblock'], $footer);
        xoops_footer();
    } else {
        // RMV-NOTIFY
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:31,代码来源:footer.php

示例12: instance

 /**
  * Deprecated, use getInstance() instead
  */
 public function instance()
 {
     return XoopsLogger::getInstance();
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:7,代码来源:xoopslogger.php

示例13: eventCoreClassTheme_blocksRetrieveBlocks

 function eventCoreClassTheme_blocksRetrieveBlocks($args)
 {
     if (DefacerCorePreload::isActive()) {
         //$args[2] = array();
         $class =& $args[0];
         $template =& $args[1];
         $block_arr =& $args[2];
         foreach ($block_arr as $key => $xobject) {
             if (strpos($xobject->getVar('title'), '_') !== 0) {
                 continue;
             }
             $block = array('id' => $xobject->getVar('bid'), 'module' => $xobject->getVar('dirname'), 'title' => ltrim($xobject->getVar('title'), '_'), 'weight' => $xobject->getVar('weight'), 'lastmod' => $xobject->getVar('last_modified'));
             $bcachetime = intval($xobject->getVar('bcachetime'));
             if (empty($bcachetime)) {
                 $template->caching = 0;
             } else {
                 $template->caching = 2;
                 $template->cache_lifetime = $bcachetime;
             }
             $template->setCompileId($xobject->getVar('dirname', 'n'));
             $tplName = ($tplName = $xobject->getVar('template')) ? "db:{$tplName}" : 'db:system_block_dummy.html';
             $cacheid = $class->generateCacheId('blk_' . $xobject->getVar('bid'));
             $xoopsLogger =& XoopsLogger::getInstance();
             if (!$bcachetime || !$template->is_cached($tplName, $cacheid)) {
                 $xoopsLogger->addBlock($xobject->getVar('name'));
                 if ($bresult = $xobject->buildBlock()) {
                     $template->assign('block', $bresult);
                     $block['content'] = $template->fetch($tplName, $cacheid);
                 } else {
                     $block = false;
                 }
             } else {
                 $xoopsLogger->addBlock($xobject->getVar('name'), true, $bcachetime);
                 $block['content'] = $template->fetch($tplName, $cacheid);
             }
             $template->setCompileId();
             $template->assign("xoops_block_{$block['id']}", $block);
             unset($block_arr[$key]);
         }
     }
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:41,代码来源:core.php

示例14: render

 /**
  * Render the page
  *
  * The theme engine builds pages from 2 templates: canvas and content.
  *
  * A module can call this method directly and specify what templates the theme engine must use.
  * If render() hasn't been called before, the theme defaults will be used for the canvas and
  * page template (and xoopsOption['template_main'] for the content).
  *
  * @param string $canvasTpl  The canvas template, if different from the theme default
  * @param string $pageTpl    The page template, if different from the theme default (unsupported, 2.3+ only)
  * @param string $contentTpl The content template
  * @param array  $vars       Template variables to send to the template engine
  *
  * @return bool
  */
 public function render($canvasTpl = null, $pageTpl = null, $contentTpl = null, $vars = array())
 {
     if ($this->renderCount) {
         return false;
     }
     $xoopsLogger = XoopsLogger::getInstance();
     $xoopsLogger->startTime('Page rendering');
     xoops_load('xoopscache');
     $cache = XoopsCache::getInstance();
     //Get meta information for cached pages
     if ($this->contentCacheLifetime && $this->contentCacheId && ($content = $cache->read($this->contentCacheId))) {
         //we need to merge metas set by blocks ) with the module cached meta
         $this->htmlHeadStrings = array_merge($this->htmlHeadStrings, $content['htmlHeadStrings']);
         foreach ($content['metas'] as $type => $value) {
             $this->metas[$type] = array_merge($this->metas[$type], $content['metas'][$type]);
         }
         $GLOBALS['xoopsOption']['xoops_pagetitle'] = $content['xoops_pagetitle'];
         $GLOBALS['xoopsOption']['xoops_module_header'] = $content['header'];
     }
     if (!empty($GLOBALS['xoopsOption']['xoops_pagetitle'])) {
         $this->template->assign('xoops_pagetitle', $GLOBALS['xoopsOption']['xoops_pagetitle']);
     }
     $header = empty($GLOBALS['xoopsOption']['xoops_module_header']) ? $this->template->get_template_vars('xoops_module_header') : $GLOBALS['xoopsOption']['xoops_module_header'];
     //save meta information of cached pages
     if ($this->contentCacheLifetime && $this->contentCacheId && !$contentTpl) {
         $content['htmlHeadStrings'] = $this->htmlHeadStrings;
         $content['metas'] = $this->metas;
         $content['xoops_pagetitle'] =& $this->template->get_template_vars('xoops_pagetitle');
         $content['header'] = $header;
         $cache->write($this->contentCacheId, $content);
     }
     //  @internal : Lame fix to ensure the metas specified in the xoops config page don't appear twice
     $old = array('robots', 'keywords', 'description', 'rating', 'author', 'copyright');
     foreach ($this->metas['meta'] as $name => $value) {
         if (in_array($name, $old)) {
             $this->template->assign("xoops_meta_{$name}", htmlspecialchars($value, ENT_QUOTES));
             unset($this->metas['meta'][$name]);
         }
     }
     // We assume no overlap between $GLOBALS['xoopsOption']['xoops_module_header'] and $this->template->get_template_vars( 'xoops_module_header' ) ?
     $this->template->assign('xoops_module_header', $this->renderMetas(null, true) . "\n" . $header);
     if ($canvasTpl) {
         $this->canvasTemplate = $canvasTpl;
     }
     if ($contentTpl) {
         $this->contentTemplate = $contentTpl;
     }
     if (!empty($vars)) {
         $this->template->assign($vars);
     }
     if ($this->contentTemplate) {
         $this->content = $this->template->fetch($this->contentTemplate, $this->contentCacheId);
     }
     if ($this->bufferOutput) {
         $this->content .= ob_get_contents();
         ob_end_clean();
     }
     $this->template->assign_by_ref('xoops_contents', $this->content);
     // Do not cache the main (theme.html) template output
     $this->template->caching = 0;
     //mb -------------------------
     //        $this->template->display($this->path . '/' . $this->canvasTemplate);
     if (file_exists($this->path . '/' . $this->canvasTemplate)) {
         $this->template->display($this->path . '/' . $this->canvasTemplate);
     } else {
         $this->template->display($this->path . '/theme.tpl');
     }
     //mb -------------------------
     $this->renderCount++;
     $xoopsLogger->stopTime('Page rendering');
     return true;
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:88,代码来源:theme.php

示例15: smarty_function_block

/**
 * @param $params
 * @param $smarty
 *
 * @return mixed
 */
function smarty_function_block($params, &$smarty)
{
    if (!isset($params['id'])) {
        return null;
    }
    $display_title = isset($params['display']) && $params['display'] === 'title';
    $display_none = isset($params['display']) && $params['display'] === 'none';
    $options = isset($params['options']) ? $params['options'] : false;
    $groups = isset($params['groups']) ? explode('|', $params['groups']) : false;
    $cache = isset($params['cache']) ? (int) $params['cache'] : false;
    $block_id = (int) $params['id'];
    static $block_objs;
    if (!isset($block_objs[$block_id])) {
        include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
        $blockObj = new XoopsBlock($block_id);
        if (!is_object($blockObj)) {
            return null;
        }
        $block_objs[$block_id] = $blockObj;
    } else {
        $blockObj = $block_objs[$block_id];
    }
    $user_groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
    static $allowed_blocks;
    if (count($allowed_blocks) == 0) {
        $allowed_blocks = XoopsBlock::getAllBlocksByGroup($user_groups, false);
    }
    if ($groups) {
        if (!array_intersect($user_groups, $groups)) {
            return null;
        }
    } else {
        if (!in_array($block_id, $allowed_blocks)) {
            return null;
        }
    }
    if ($options) {
        $blockObj->setVar('options', $options);
    }
    if ($cache) {
        $blockObj->setVar('bcachetime', $cache);
    }
    if ($display_title) {
        return $blockObj->getVar('title');
    }
    $xoopsLogger = XoopsLogger::getInstance();
    $template =& $GLOBALS['xoopsTpl'];
    $bcachetime = (int) $blockObj->getVar('bcachetime');
    if (empty($bcachetime)) {
        $template->caching = 0;
    } else {
        $template->caching = 2;
        $template->cache_lifetime = $bcachetime;
    }
    $template->setCompileId($blockObj->getVar('dirname', 'n'));
    $tplName = ($tplName = $blockObj->getVar('template')) ? "db:{$tplName}" : 'db:system_block_dummy.tpl';
    $cacheid = 'blk_' . $block_id;
    if (!$bcachetime || !$template->is_cached($tplName, $cacheid)) {
        $xoopsLogger->addBlock($blockObj->getVar('name'));
        if (!($bresult = $blockObj->buildBlock())) {
            return null;
        }
        if (!$display_none) {
            $template->assign('block', $bresult);
            $template->display($tplName, $cacheid);
        }
    } else {
        $xoopsLogger->addBlock($blockObj->getVar('name'), true, $bcachetime);
        if (!$display_none) {
            $template->display($tplName, $cacheid);
        }
    }
    $template->setCompileId($blockObj->getVar('dirname', 'n'));
    return null;
}
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:81,代码来源:function.block.php


注:本文中的XoopsLogger::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。