本文整理汇总了PHP中XoopsBlock类的典型用法代码示例。如果您正苦于以下问题:PHP XoopsBlock类的具体用法?PHP XoopsBlock怎么用?PHP XoopsBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XoopsBlock类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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&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[] = ' <span style="color:#ff0000;">ERROR: Could not insert template <b>' . $blocks[$i]['template'] . '</b> to the database.</span>';
} else {
$msgs[] = ' Template <b>' . $blocks[$i]['template'] . '</b> inserted to the database.';
}
}
$msgs[] = ' 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[] = ' <span style="color:#ff0000;">ERROR: Could not delete block <b>' . $block->getVar('name') . '</b>. Block ID: <b>' . $block->getVar('bid') . '</b></span>';
} else {
$msgs[] = ' 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&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', ' ');
}
// 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
示例16: previewContent
function previewContent($block_data)
{
$bid = intval($block_data['bid']);
if (!$block_data['is_custom']) {
return '';
}
if (empty($this->preview_request)) {
return '';
}
//HACK by domifara
//TODO : need no hook block at this
$block = new XoopsBlock($bid);
if ($block->getVar('mid')) {
return '';
}
$block->setVar('title', $block_data['title']);
$block->setVar('content', $block_data['content']);
restore_error_handler();
$original_level = error_reporting(E_ALL);
// $ret = $block->getContent( 'S' , $block_data['ctype'] ) ;
$c_type = $block_data['ctype'];
if ($c_type == 'H') {
$ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N'));
} else {
if ($c_type == 'P') {
ob_start();
echo eval($block->getVar('content', 'N'));
$content = ob_get_contents();
ob_end_clean();
$ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $content);
} else {
if ($c_type == 'S') {
$myts =& MyTextSanitizer::getInstance();
$content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N'));
$ret = $myts->displayTarea($content, 1, 1);
} else {
$myts =& MyTextSanitizer::getInstance();
$content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N'));
$ret = $myts->displayTarea($content, 1, 0);
}
}
}
error_reporting($original_level);
return $ret;
}
开发者ID:hiro1173,项目名称:legacy,代码行数:45,代码来源:MyBlocksAdminForX25.class.php
示例17: plugin_xoopsblock_convert
function plugin_xoopsblock_convert()
{
if ($this->root->module['platform'] !== "xoops") {
return '';
}
static $css_show = FALSE;
list($tgt, $option1, $option2) = array_pad(func_get_args(), 3, "");
$tgt_bids = array();
if (!$tgt || $tgt === "?") {
$tgt = "?";
} else {
foreach (explode(",", $tgt) as $_bid) {
if (preg_match("/^\\d+\$/", $_bid) && $_bid > 0) {
$tgt_bids[] = $_bid;
}
}
}
$align = "left";
$around = false;
$width = "";
$arg = array();
if (preg_match("/^(left|center|right)\$/i", $option2, $arg)) {
$align = $arg[1];
}
if (preg_match("/^(left|center|right)\$/i", $option1, $arg)) {
$align = $arg[1];
}
if (preg_match("/^(around|float|width)(:?w?([\\d]+%?)(?:px)?)?\$/i", $option2, $arg)) {
if ($arg[1]) {
$around = true;
}
$width = !strstr($arg[3], "%") ? $arg[3] . "px" : $arg[3];
$width = "width:" . $width . ";";
}
if (preg_match("/^(around|float|width)(:?w?([\\d]+%?)(?:px)?)?\$/i", $option1, $arg)) {
if ($arg[1]) {
$around = true;
}
$width = !strstr($arg[3], "%") ? $arg[3] . "px" : $arg[3];
$width = "width:" . $width . ";";
}
if ($align === 'center') {
if (!$width) {
$width = 'width:auto;';
}
$style = ' style="margin-left:auto;margin-right:auto;' . $width . '"';
$around = false;
} else {
$style = ' style="float:' . $align . ';' . $width . '"';
}
$clear = $around ? '' : '<div style="clear:both;"></div>';
global $xoopsUser;
$xoopsblock = new XoopsBlock();
$xoopsgroup = new XoopsGroup();
$arr = array();
$side = null;
if ($this->root->userinfo['admin']) {
$arr = $xoopsblock->getAllBlocks();
} else {
if ($xoopsUser) {
$arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->groups());
} else {
$arr = $xoopsblock->getAllBlocksByGroup($this->plugin_xoopsblock_getByType("Anonymous"));
}
}
$ret = "";
if ($tgt == "?") {
foreach ($arr as $myblock) {
$block = array();
$block_type = @$myblock->getVar("type") ? $myblock->getVar("type") : $myblock->getVar("block_type");
$name = @$myblock->getVar("title") ? $myblock->getVar("title") : $myblock->getVar("name");
$bid = $myblock->getVar('bid');
$ret .= "<li>(" . $bid . ")" . $name . "</li>";
}
} else {
global $xoopsTpl;
require_once XOOPS_ROOT_PATH . '/class/template.php';
$xoopsTpl = new XoopsTpl();
if (is_object($xoopsUser)) {
$xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUser->isAdmin()));
}
$xoopsTpl->assign('xoops_requesturi', htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES));
foreach ($tgt_bids as $bid) {
$myblock = new XoopsBlock($bid);
$_bid = $myblock->getVar('bid');
if (!empty($_bid)) {
$bcachetime = $myblock->getVar('bcachetime');
// Only a guest enable cache. by nao-pon
//if (empty($bcachetime)) {
if ($bcachetime % 10 == 1) {
$bcachetime_guest = TRUE;
$bcachetime = $bcachetime - 1;
} else {
$bcachetime_guest = FALSE;
}
if (empty($bcachetime) || is_object($xoopsUser) && $bcachetime_guest) {
//if (empty($bcachetime)) {
$xoopsTpl->xoops_setCaching(0);
} else {
$xoopsTpl->xoops_setCaching(2);
//.........这里部分代码省略.........
开发者ID:nouphet,项目名称:rata,代码行数:101,代码来源:xoopsblock.inc.php
示例18: 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 XOOPS_ROOT_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::instance();
for ($i = 0; $i < $block_count; $i++) {
$bcachetime = intval($block_arr[$i]->getVar('bcachetime'));
if (empty($bcachetime)) {
$xoopsTpl->xoops_setCaching(0);
} else {
$xoopsTpl->xoops_setCaching(2);
$xoopsTpl->xoops_setCacheTime($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.html', '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.html', 'blk_' . $bid);
$xoopsTpl->clear_assign('block');
} else {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
$bcontent =& $xoopsTpl->fetch('db:system_dummy.html', '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:yunsite,项目名称:xoopsdc,代码行数:90,代码来源:old_functions.php
示例19: xoops_gethandler
function &_get_block_object_bymodule_id($mid, $asobject = true)
{
if (defined('ICMS_VERSION_BUILD') && ICMS_VERSION_BUILD > 27) {
/* ImpressCMS 1.2+ */
$block_handler =& xoops_gethandler('block');
$objs =& $block_handler->getByModule($mid, $asobject);
} else {
/* legacy support */
$objs =& XoopsBlock::getByModule($mid, $asobject);
/* from class/xoopsblock.php */
}
return $objs;
}
开发者ID:nouphet,项目名称:rata,代码行数:13,代码来源:check_blocks_class.php
示例20: retrieveBlocks
/**
* xos_logos_PageBuilder::retrieveBlocks()
*
* @return
*/
function retrieveBlocks()
{
global $xoopsConfig;
$xoopsPreload =& XoopsPreload::getInstance();
$startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage'];
if (isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule'])) {
list($mid, $dirname) = array($GLOBALS['xoopsModule']->getVar('mid'), $GLOBALS['xoopsModule']->getVar('dirname'));
$isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $xoopsConfig['startpage'] == $dirname && empty($_SERVER['QUERY_STRING']);
} else {
list($mid, $dirname) = array(0, 'system');
$isStart = !empty($GLOBALS['xoopsOption']['show_cblock']);
}
$groups = isset($GLOBALS['xoopsUser']) && is_object($GLOBALS['xoopsUser']) ? $GLOBALS['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 = null;
$template = new XoopsTpl();
}
$xoopsblock = new XoopsBlock();
$block_arr = array();
$block_arr = $xoopsblock->getAllByGroupModule($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE);
$xoopsPreload->triggerEvent('core.class.theme_blocks.retrieveBlocks', array(&$this, &$template, &$block_arr));
foreach ($block_arr as $block) {
$side = $oldzones[$block->getVar('side')];
if ($var = $this->buildBlock($block, $template)) {
$this->blocks[$side][$var[&qu
|
请发表评论