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


PHP XoopsBlock类代码示例

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


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

示例1: getBlock

 /**
  * get block.
  * 
  * @param Legacy_AbstractBlockProcedure &$obj
  * @param XoopsBlock                    $block
  */
 public static function getBlock(&$obj, $block)
 {
     $moduleHandler =& xoops_gethandler('module');
     $module =& $moduleHandler->get($block->get('mid'));
     if (is_object($module) && $module->getInfo('trust_dirname') == COSMOAPI_TRUST_DIRNAME) {
         require_once XOOPS_TRUST_PATH . '/modules/' . COSMOAPI_TRUST_DIRNAME . '/blocks/' . $block->get('func_file');
         $className = ucfirst(COSMOAPI_TRUST_DIRNAME) . '_' . substr($block->get('show_func'), 4);
         $obj = new $className($block);
     }
 }
开发者ID:neuroinformatics,项目名称:xcl-module-cosmoapi,代码行数:16,代码来源:AssetPreload.class.php

示例2: test_insertBlock

 public function test_insertBlock()
 {
     $block = new XoopsBlock();
     $block->setNew();
     $instance = new XoopsBlockHandler($this->conn);
     $value = $instance->insertBlock($block);
     $bid = $block->bid();
     $this->assertEquals($bid, $value);
     $value = $instance->get($bid);
     $this->assertEquals($bid, $value->bid());
     $value = $instance->deleteBlock($block);
     $this->assertSame(true, $value);
     $value = $instance->get($bid);
     $this->assertSame(null, $value);
 }
开发者ID:RanLee,项目名称:XoopsCore,代码行数:15,代码来源:blockHandlerTest.php

示例3: xoops_module_install_sysutil

function xoops_module_install_sysutil(&$module)
{
    $gperm_handler =& xoops_gethandler('groupperm');
    $mperm =& $gperm_handler->create();
    $mperm->setVar('gperm_groupid', XOOPS_GROUP_ANONYMOUS);
    $mperm->setVar('gperm_itemid', $module->getVar('mid'));
    $mperm->setVar('gperm_name', 'module_read');
    $mperm->setVar('gperm_modid', 1);
    $gperm_handler->insert($mperm);
    unset($mperm);
    $blocks =& XoopsBlock::getByModule($module->getVar('mid'), false);
    foreach ($blocks as $blc) {
        $bperm =& $gperm_handler->create();
        $bperm->setVar('gperm_groupid', XOOPS_GROUP_ANONYMOUS);
        $bperm->setVar('gperm_itemid', $blc);
        $bperm->setVar('gperm_name', 'block_read');
        $bperm->setVar('gperm_modid', 1);
        $gperm_handler->insert($bperm);
        unset($bperm);
    }
    unset($blocks);
    $module_handler =& xoops_gethandler('module');
    $module->setVar('weight', 0);
    $module->unsetNew();
    $module_handler->insert($module);
    return true;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:27,代码来源:on_install.php

示例4: update_block_permissions

function update_block_permissions($old_gid, $new_gid)
{
    // get handlers
    $gperm_handler =& xoops_gethandler('groupperm');
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->getByDirname('xoonips');
    $mid = $module->getVar('mid');
    $block_objs =& XoopsBlock::getByModule($mid);
    foreach ($block_objs as $block_obj) {
        // find moderator menu block
        if ($block_obj->getVar('show_func') == 'b_xoonips_moderator_show') {
            $bid = $block_obj->getVar('bid');
            // if old_gid don't have module admin right,
            // delete the right to access from old_gid.
            if (!$gperm_handler->checkRight('module_admin', $mid, $old_gid)) {
                $criteria = new CriteriaCompo();
                $criteria->add(new Criteria('gperm_groupid', $old_gid));
                $criteria->add(new Criteria('gperm_itemid', $bid));
                $criteria->add(new Criteria('gperm_name', 'block_read'));
                $gperm_handler->deleteAll($criteria);
            }
            // if there is no right to access moderator block in new_gid,
            // the right gives new_gid.
            if (!$gperm_handler->checkRight('block_read', $bid, $new_gid)) {
                $gperm_handler->addRight('block_read', $bid, $new_gid);
            }
            break;
        }
    }
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:30,代码来源:system_basic_update.php

示例5: retrieveBlocks

 function retrieveBlocks()
 {
     global $xoopsUser, $xoopsModule, $xoopsConfig;
     $startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage'];
     if (@is_object($xoopsModule)) {
         list($mid, $dirname) = array($xoopsModule->getVar('mid'), $xoopsModule->getVar('dirname'));
         $isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $xoopsConfig['startpage'] == $dirname;
     } else {
         list($mid, $dirname) = array(0, 'system');
         $isStart = !@empty($GLOBALS['xoopsOption']['show_cblock']);
     }
     $groups = @is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
     $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();
     }
     if ($this->theme) {
         $template =& $this->theme->template;
         $backup = array($template->caching, $template->cache_lifetime);
     } else {
         $template =& new XoopsTpl();
     }
     $xoopsblock = new XoopsBlock();
     $block_arr = array();
     $block_arr = $xoopsblock->getAllByGroupModule($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE);
     $template->assign('ezblocks', $block_arr);
     //ezsky hack
     foreach ($block_arr as $block) {
         // ezsky hack start
         if ($block->getVar('side') == XOOPS_BLOCK_CALLBACK) {
             continue;
         }
         // ezsky hack end
         $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;
     }
 }
开发者ID:yunsite,项目名称:xoopsdc,代码行数:42,代码来源:theme_blocks.php

示例6: retrieveBlocks

 function retrieveBlocks()
 {
     global $xoopsUser, $xoopsModule, $xoopsConfig;
     if (@is_object($xoopsModule)) {
         list($mid, $dirname) = array($xoopsModule->getVar('mid'), $xoopsModule->getVar('dirname'));
     } else {
         list($mid, $dirname) = array(0, 'system');
     }
     $startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage'];
     $isStart = substr($_SERVER['SCRIPT_NAME'], -9) == 'index.php' && $startMod == $dirname;
     $groups = @is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
     $oldzones = array(XOOPS_SIDEBLOCK_LEFT => 'canvas_left', XOOPS_SIDEBLOCK_RIGHT => 'canvas_right', XOOPS_CENTERBLOCK_CENTER => 'page_top', XOOPS_CENTERBLOCK_LEFT => 'page_topleft', XOOPS_CENTERBLOCK_RIGHT => 'page_topright');
     $xoopsblock = new XoopsBlock();
     $block_arr = array();
     $block_arr = $xoopsblock->getAllByGroupModule($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE);
     foreach ($block_arr as $block) {
         $side = $oldzones[$block->getVar('side')];
         if ($var = $this->buildBlock($block)) {
             $this->blocks[$side][] = $var;
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:22,代码来源:builder.php

示例7: hypconfGetBlocks

function hypconfGetBlocks()
{
    static $ret = null;
    if (!is_null($ret)) {
        return $ret;
    }
    include_once XOOPS_ROOT_PATH . "/class/xoopsblock.php";
    $bobj = new XoopsBlock();
    $blocks = $bobj->getAllBlocks('object', null, true);
    $ret = array();
    if ($blocks) {
        foreach ($blocks as $block) {
            $name = $block->getVar('title') ? $block->getVar('title') : $block->getVar('name');
            $bid = $block->getVar("bid");
            if ($module = hypconfGetModuleName($block->getVar("mid"))) {
                $ret[$module . ':' . $name] = array('confop_value' => $bid, 'confop_name' => $module . ':' . $name);
            }
        }
        ksort($ret);
    }
    return $ret;
}
开发者ID:nouphet,项目名称:rata,代码行数:22,代码来源:admin_func.php

示例8: get_block_title

function get_block_title($mid, $fname, $sfunc)
{
    $block_objs =& XoopsBlock::getByModule($mid);
    $block_title = '';
    foreach ($block_objs as $block_obj) {
        $func_file = $block_obj->getVar('func_file', 'n');
        $show_func = $block_obj->getVar('show_func', 'n');
        if ($func_file == $fname && $show_func == $sfunc) {
            // found
            $block_title = $block_obj->getVar('title', 's');
            break;
        }
    }
    return $block_title;
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:15,代码来源:policy_ranking_default.php

示例9: xoops_gethandler

 $myts =& MyTextsanitizer::getInstance();
 $html = $myts->stripSlashesGPC($html);
 $tpltpl_handler =& xoops_gethandler('tplfile');
 $tplfile =& $tpltpl_handler->get($id, true);
 $xoopsTpl = new XoopsTpl();
 if (is_object($tplfile)) {
     $dummylayout = '<html><head><meta http-equiv="content-type" content="text/html; charset=' . _CHARSET . '" /><meta http-equiv="content-language" content="' . _LANGCODE . '" /><title>' . $xoopsConfig['sitename'] . '</title><style type="text/css" media="all">';
     $css =& $tpltpl_handler->find($xoopsConfig['template_set'], 'css', 0, null, null, true);
     $csscount = count($css);
     for ($i = 0; $i < $csscount; $i++) {
         $dummylayout .= "\n" . $css[$i]->getVar('tpl_source');
     }
     $dummylayout .= "\n" . '</style></head><body><{$content}></body></html>';
     if ($tplfile->getVar('tpl_type') == 'block') {
         include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
         $block = new XoopsBlock($tplfile->getVar('tpl_refid'));
         $xoopsTpl->assign('block', $block->buildBlock());
     }
     $dummytpl = '_dummytpl_' . time() . '.html';
     $fp = fopen(XOOPS_CACHE_PATH . '/' . $dummytpl, 'w');
     fwrite($fp, $html);
     fclose($fp);
     $xoopsTpl->assign('content', $xoopsTpl->fetch('file:' . XOOPS_CACHE_PATH . '/' . $dummytpl));
     $xoopsTpl->clear_compiled_tpl('file:' . XOOPS_CACHE_PATH . '/' . $dummytpl);
     unlink(XOOPS_CACHE_PATH . '/' . $dummytpl);
     $dummyfile = '_dummy_' . time() . '.html';
     $fp = fopen(XOOPS_CACHE_PATH . '/' . $dummyfile, 'w');
     fwrite($fp, $dummylayout);
     fclose($fp);
     $tplset = $tplfile->getVar('tpl_tplset');
     $tform = array('tpl_tplset' => $tplset, 'tpl_id' => $id, 'tpl_file' => $tplfile->getVar('tpl_file'), 'tpl_desc' => $tplfile->getVar('tpl_desc'), 'tpl_lastmodified' => $tplfile->getVar('tpl_lastmodified'), 'tpl_source' => htmlspecialchars($html, ENT_QUOTES), 'tpl_module' => $moddir);
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:31,代码来源:main.php

示例10: clone_block_ok

 function clone_block_ok($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options)
 {
     global $xoopsUser;
     $block = new XoopsBlock($bid);
     $clone =& $block->xoopsClone();
     if (empty($bmodule)) {
         xoops_cp_header();
         xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
         xoops_cp_footer();
         exit;
     }
     $clone->setVar('side', $bside);
     $clone->setVar('weight', $bweight);
     $clone->setVar('visible', $bvisible);
     $clone->setVar('content', $bcontent);
     //$clone->setVar('title', $btitle);
     $clone->setVar('bcachetime', $bcachetime);
     if (isset($options) && count($options) > 0) {
         $options = implode('|', $options);
         $clone->setVar('options', $options);
     }
     $clone->setVar('bid', 0);
     if ($block->getVar('block_type') == 'C' || $block->getVar('block_type') == 'E') {
         $clone->setVar('block_type', 'E');
     } else {
         $clone->setVar('block_type', 'D');
     }
     $newid = $clone->store();
     if (!$newid) {
         xoops_cp_header();
         $clone->getHtmlErrors();
         xoops_cp_footer();
         exit;
     }
     if ($clone->getVar('template') != '') {
         $tplfile_handler =& xoops_gethandler('tplfile');
         $btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $bid);
         if (count($btemplate) > 0) {
             $tplclone =& $btemplate[0]->xoopsClone();
             $tplclone->setVar('tpl_id', 0);
             $tplclone->setVar('tpl_refid', $newid);
             $tplman->insert($tplclone);
         }
     }
     $db =& Database::getInstance();
     foreach ($bmodule as $bmid) {
         $sql = 'INSERT INTO ' . $db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')';
         $db->query($sql);
     }
     $groups =& $xoopsUser->getGroups();
     $count = count($groups);
     for ($i = 0; $i < $count; $i++) {
         $sql = "INSERT INTO " . $db->prefix('group_permission') . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (" . $groups[$i] . ", " . $newid . ", 1, 'block_read')";
         $db->query($sql);
     }
     redirect_header('admin.php?fct=blocksadmin&amp;t=' . time(), 1, _AM_DBUPDATED);
 }
开发者ID:hiro1173,项目名称:legacy,代码行数:57,代码来源:blocksadmin.php

示例11: time

                         $tplfile->setVar('tpl_lastimported', 0);
                         $tplfile->setVar('tpl_lastmodified', time());
                         $tplfile->setVar('tpl_desc', $blocks[$i]['description'], true);
                         if (!$tplfile_handler->insert($tplfile)) {
                             $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not insert template <b>' . $blocks[$i]['template'] . '</b> to the database.</span>';
                         } else {
                             $msgs[] = '&nbsp;&nbsp;Template <b>' . $blocks[$i]['template'] . '</b> inserted to the database.';
                         }
                     }
                     $msgs[] = '&nbsp;&nbsp;Block <b>' . $blocks[$i]['name'] . '</b> created. Block ID: <b>' . $newbid . '</b>';
                 }
             }
         }
     }
 }
 $block_arr = XoopsBlock::getByModule($mid);
 foreach ($block_arr as $block) {
     if (!in_array($block->getVar('show_func'), $showfuncs) || !in_array($block->getVar('func_file'), $funcfiles)) {
         $sql = sprintf("DELETE FROM %s WHERE bid = %u", $xoopsDB->prefix('newblocks'), $block->getVar('bid'));
         if (!$xoopsDB->query($sql)) {
             $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not delete block <b>' . $block->getVar('name') . '</b>. Block ID: <b>' . $block->getVar('bid') . '</b></span>';
         } else {
             $msgs[] = '&nbsp;&nbsp;Block <b>' . $block->getVar('name') . ' deleted. Block ID: <b>' . $block->getVar('bid') . '</b>';
         }
     }
 }
 $configs = $modules[$mid]->getInfo('config');
 if ($configs != false) {
     if ($modules[$mid]->getVar('hascomments') != 0) {
         include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
         array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)));
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:31,代码来源:index.php

示例12: clone_block_ok

function clone_block_ok($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bcachetime, $bmodule, $options = array(), $bgroups = array())
{
    global $xoopsUser;
    /*
    if (empty($bmodule)) {
        xoops_cp_header();
        xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
        xoops_cp_footer();
        exit();
    }
    */
    $block = new XoopsBlock($bid);
    $clone =& $block->xoopsClone();
    $clone->setVar('side', $bside);
    $clone->setVar('weight', $bweight);
    $clone->setVar('visible', $bvisible);
    $clone->setVar('content', $bcontent);
    $clone->setVar('title', $btitle);
    $clone->setVar('bcachetime', $bcachetime);
    if (isset($options) && count($options) > 0) {
        $options = implode('|', $options);
        $clone->setVar('options', $options);
    }
    $clone->setVar('bid', 0);
    // Custom block
    if ($block->isCustom()) {
        $clone->setVar('block_type', 'C');
        // Clone of system or module block
    } else {
        $clone->setVar('block_type', 'D');
    }
    $newid = $clone->store();
    if (!$newid) {
        xoops_cp_header();
        $clone->getHtmlErrors();
        xoops_cp_footer();
        exit;
    }
    if ($clone->getVar('template') != '') {
        $tplfile_handler =& xoops_gethandler('tplfile');
        $btemplate = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $bid);
        if (count($btemplate) > 0) {
            $tplclone =& $btemplate[0]->xoopsClone();
            $tplclone->setVar('tpl_id', 0);
            $tplclone->setVar('tpl_refid', $newid);
            $tplfile_handler->insert($tplclone);
        }
    }
    $db =& Database::getInstance();
    foreach (@$bmodule as $bmid) {
        $sql = 'INSERT INTO ' . $db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')';
        $db->query($sql);
    }
    $groupperm_handler =& xoops_gethandler('groupperm');
    foreach ($bgroups as $groupid) {
        $groupperm_handler->addRight("block_read", $newid, $groupid);
    }
    redirect_header('admin.php?fct=blocksadmin&amp;t=' . time(), 1, _AM_DBUPDATED);
}
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:59,代码来源:blocksadmin.php

示例13: xoops_template_clear_module_cache

/**
 * Clear the module cache
 * 
 * @deprecated
 *
 * @param   int $mid    Module ID
 * @return 
 **/
function xoops_template_clear_module_cache($mid)
{
    $block_arr =& XoopsBlock::getByModule($mid);
    $count = count($block_arr);
    if ($count > 0) {
        $xoopsTpl = new XoopsTpl();
        $xoopsTpl->xoops_setCaching(2);
        for ($i = 0; $i < $count; $i++) {
            if ($block_arr[$i]->getVar('template') != '') {
                $xoopsTpl->clear_cache('db:' . $block_arr[$i]->getVar('template'), 'blk_' . $block_arr[$i]->getVar('bid'));
            }
        }
    }
}
开发者ID:nouphet,项目名称:rata,代码行数:22,代码来源:template.php

示例14: foreach

 $config =& $config_handler->getConfigs($criteria, true);
 foreach (array_keys($config) as $i) {
     // prefix each tag with 'xoops_'
     $xoopsTpl->assign('xoops_' . $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput());
 }
 //unset($config);
 // show banner?
 if ($xoopsConfig['banners'] == 1) {
     $xoopsTpl->assign('xoops_banner', xoops_getbanner());
 } else {
     $xoopsTpl->assign('xoops_banner', '&nbsp;');
 }
 // Weird, but need extra <script> tags for 2.0.x themes
 $xoopsTpl->assign('xoops_js', '//--></script><script type="text/javascript" src="' . XOOPS_URL . '/include/xoops.js"></script><script type="text/javascript"><!--');
 // get all blocks and assign to smarty
 $xoopsblock = new XoopsBlock();
 $block_arr = array();
 if ($xoopsUser != '') {
     $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin));
     $groups = $xoopsUser->getGroups();
 } else {
     $xoopsTpl->assign(array('xoops_isuser' => false, 'xoops_isadmin' => false));
     $groups = XOOPS_GROUP_ANONYMOUS;
 }
 $toppage = false;
 if (isset($xoopsModule) && is_object($xoopsModule)) {
     // set page title
     $xoopsTpl->assign('xoops_pagetitle', $xoopsModule->getVar('name'));
     $xoopsTpl->assign('xoops_dirname', $xoopsModule->getVar('dirname'));
     $moduleid = $xoopsModule->getVar('mid');
     if (preg_match("/index\\.php\$/i", xoops_getenv('PHP_SELF')) && $xoopsConfig['startpage'] == $xoopsModule->getVar('dirname')) {
开发者ID:BackupTheBerlios,项目名称:xoops4-svn,代码行数:31,代码来源:header.php

示例15: buildBlock

 /**
  * XoopsThemeBlocksPlugin::buildBlock()
  *
  * @param XoopsBlock $xobject
  * @param XoopsTpl $template
  * @return array|bool
  */
 public function buildBlock($xobject, &$template)
 {
     $xoops = Xoops::getInstance();
     // The lame type workaround will change
     // bid is added temporarily as workaround for specific block manipulation
     $dirname = $xobject->getVar('dirname');
     $block = array('id' => $xobject->getVar('bid'), 'module' => $dirname, 'title' => $xobject->getVar('title'), 'weight' => $xobject->getVar('weight'), 'lastmod' => $xobject->getVar('last_modified'));
     $bcachetime = (int) $xobject->getVar('bcachetime');
     if (empty($bcachetime)) {
         $template->caching = 0;
     } else {
         $template->caching = 2;
         $template->cache_lifetime = $bcachetime;
     }
     $template->setCompileId($dirname);
     $tplName = ($tplName = $xobject->getVar('template')) ? "block:{$dirname}/{$tplName}" : "module:system/system_block_dummy.tpl";
     //$tplName = str_replace('.html', '.tpl', $tplName);
     $cacheid = $this->generateCacheId('blk_' . $xobject->getVar('bid'));
     $xoops->preload()->triggerEvent('core.themeblocks.buildblock.start', array($xobject, $template->isCached($tplName, $cacheid)));
     if (!$bcachetime || !$template->isCached($tplName, $cacheid)) {
         //Get theme metas
         $old = array();
         if ($this->theme && $bcachetime) {
             foreach ($this->theme->metas as $type => $value) {
                 $old[$type] = $this->theme->metas[$type];
             }
         }
         //build block
         if ($bresult = $xobject->buildBlock()) {
             $template->assign('block', $bresult);
             $block['content'] = $template->fetch($tplName, $cacheid);
         } else {
             $block = false;
         }
         //check if theme added new metas
         if ($this->theme && $bcachetime) {
             $metas = array();
             foreach ($this->theme->metas as $type => $value) {
                 $dif = Xoops_Utils::arrayRecursiveDiff($this->theme->metas[$type], $old[$type]);
                 if (count($dif)) {
                     $metas[$type] = $dif;
                 }
             }
             if (count($metas)) {
                 Xoops_Cache::write($cacheid, $metas);
             }
         }
     } else {
         $block['content'] = $template->fetch($tplName, $cacheid);
     }
     //add block cached metas
     if ($this->theme && $bcachetime) {
         if ($metas = Xoops_Cache::read($cacheid)) {
             foreach ($metas as $type => $value) {
                 $this->theme->metas[$type] = array_merge($this->theme->metas[$type], $metas[$type]);
             }
         }
     }
     $template->setCompileId();
     return $block;
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:68,代码来源:theme_blocks.php


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