本文整理汇总了PHP中block_get_batch函数的典型用法代码示例。如果您正苦于以下问题:PHP block_get_batch函数的具体用法?PHP block_get_batch怎么用?PHP block_get_batch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了block_get_batch函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: javascript.php 7086 2010-03-29 02:06:27Z monkey $
*/
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60) . ' GMT');
if (!defined('IN_API')) {
exit('document.write(\'Access Denied\')');
}
loadcore();
include_once libfile('function/block');
loadcache('blockclass');
$bid = intval($_G['gp_bid']);
block_get_batch($bid);
$data = block_fetch_content($bid, true);
$search = array("/\\<(a href)\\=(\"|')(\\w+)/i", "/\\<(img src)\\=(\"|')(\\w+)/i");
$replace = "<\\1=\\2{$_G['siteurl']}\\3";
$data = preg_replace($search, $replace, $data);
echo 'document.write(\'' . preg_replace("/\r\n|\n|\r/", '\\n', addcslashes($data, "'\\")) . '\');';
示例2: block_get
function block_get($parameter)
{
include_once libfile('function/block');
block_get_batch($parameter);
}
示例3: import_diy
function import_diy($file)
{
global $_G;
$css = '';
$html = array();
$arr = array();
$content = file_get_contents($file);
require_once libfile('class/xml');
if (empty($content)) {
return $arr;
}
$content = preg_replace("/\\<\\!\\-\\-\\[name\\](.+?)\\[\\/name\\]\\-\\-\\>\\s+/i", '', $content);
$diycontent = xml2array($content);
if ($diycontent) {
foreach ($diycontent['layoutdata'] as $key => $value) {
if (!empty($value)) {
getframeblock($value);
}
}
$newframe = array();
foreach ($_G['curtplframe'] as $value) {
$newframe[] = $value['type'] . random(6);
}
$mapping = array();
if (!empty($diycontent['blockdata'])) {
$mapping = block_import($diycontent['blockdata']);
unset($diycontent['blockdata']);
}
$oldbids = $newbids = array();
if (!empty($mapping)) {
foreach ($mapping as $obid => $nbid) {
$oldbids[] = '#portal_block_' . $obid . ' ';
$newbids[] = '#portal_block_' . $nbid . ' ';
$oldbids[] = '[portal_block_' . $obid . ']';
$newbids[] = '[portal_block_' . $nbid . ']';
$oldbids[] = '~portal_block_' . $obid . '"';
$newbids[] = '~portal_block_' . $nbid . '"';
}
}
require_once libfile('class/xml');
$xml = array2xml($diycontent['layoutdata'], true);
$xml = str_replace($oldbids, $newbids, $xml);
$xml = str_replace((array) array_keys($_G['curtplframe']), $newframe, $xml);
$diycontent['layoutdata'] = xml2array($xml);
$css = str_replace($oldbids, $newbids, $diycontent['spacecss']);
$css = str_replace((array) array_keys($_G['curtplframe']), $newframe, $css);
foreach ($diycontent['layoutdata'] as $key => $value) {
$html[$key] = getframehtml($value);
}
}
if (!empty($html)) {
$xml = array2xml($html, true);
require_once libfile('function/block');
block_get_batch(implode(',', $mapping));
foreach ($mapping as $bid) {
$blocktag[] = '<!--{block/' . $bid . '}-->';
$blockcontent[] = block_fetch_content($bid);
}
$xml = str_replace($blocktag, $blockcontent, $xml);
$html = xml2array($xml);
$arr = array('html' => $html, 'css' => $css, 'mapping' => $mapping);
}
return $arr;
}
示例4: block_get
function block_get($parameter)
{
global $_G;
static $allowmem;
if ($allowmem === null) {
include_once libfile('function/block');
$allowmem = getglobal('setting/memory/diyblock/enable') && memory('check');
}
if (!$allowmem) {
block_get_batch($parameter);
return true;
}
$blockids = explode(',', $parameter);
$lostbids = array();
foreach ($blockids as $bid) {
$bid = intval($bid);
if ($bid) {
$_G['block'][$bid] = memory('get', 'blockcache_' . $bid);
if ($_G['block'][$bid] === null) {
$lostbids[] = $bid;
}
}
}
if ($lostbids) {
block_get_batch(implode(',', $lostbids));
foreach ($lostbids as $bid) {
if (isset($_G['block'][$bid])) {
memory('set', 'blockcache_' . $bid, $_G['block'][$bid], getglobal('setting/memory/diyblock/ttl'));
}
}
}
}