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


PHP block_updatecache函数代码示例

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


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

示例1: block_fetch_content

function block_fetch_content($bid, $isjscall = false, $forceupdate = false)
{
    global $_G;
    static $allowmem = null, $cachettl = null;
    if ($allowmem === null) {
        $allowmem = ($cachettl = getglobal('setting/memory/diyblockoutput')) !== null && memory('check');
    }
    $str = '';
    $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid];
    if (!$block) {
        return;
    }
    if ($forceupdate) {
        block_updatecache($bid, true);
        $block = $_G['block'][$bid];
    } elseif ($block['cachetime'] > 0 && $_G['timestamp'] - $block['dateline'] > $block['cachetime']) {
        $block['cachetimerange'] = empty($block['cachetimerange']) ? isset($_G['setting']['blockcachetimerange']) ? $_G['setting']['blockcachetimerange'] : '' : $block['cachetimerange'];
        $inrange = empty($block['cachetimerange']) ? true : false;
        if (!$inrange) {
            $block['cachetimerange'] = explode(',', $block['cachetimerange']);
            $hour = date('G', TIMESTAMP);
            if ($block['cachetimerange'][0] <= $block['cachetimerange'][1]) {
                $inrange = $block['cachetimerange'][0] <= $hour && $block['cachetimerange'][1] >= $hour;
            } else {
                $inrange = !($block['cachetimerange'][1] < $hour && $block['cachetimerange'][0] > $hour);
            }
        }
        if ($isjscall || $block['punctualupdate']) {
            block_updatecache($bid, true);
            $block = $_G['block'][$bid];
        } elseif ((empty($_G['blockupdate']) || $block['dateline'] < $_G['blockupdate']['dateline']) && $inrange) {
            $_G['blockupdate'] = array('bid' => $bid, 'dateline' => $block['dateline']);
        }
    }
    $hidediv = $isjscall || $block['blocktype'];
    $_cache_key = 'blockcache_' . ($isjscall ? 'js' : 'htm') . '_' . $bid;
    if ($allowmem && empty($block['hidedisplay']) && empty($block['nocache']) && ($str = memory('get', $_cache_key)) !== false) {
    } else {
        if ($hidediv) {
            if ($block['summary']) {
                $str .= $block['summary'];
            }
            $str .= block_template($bid);
        } else {
            if ($block['title']) {
                $str .= $block['title'];
            }
            $str .= '<div id="portal_block_' . $bid . '_content" class="dxb_bc">';
            if ($block['summary']) {
                $str .= "<div class=\"portal_block_summary\">{$block['summary']}</div>";
            }
            $str .= block_template($bid);
            $str .= '</div>';
        }
        if ($allowmem && empty($block['hidedisplay']) && empty($block['nocache'])) {
            memory('set', $_cache_key, $str, C::t('common_block')->cache_ttl);
        }
    }
    if (!$hidediv) {
        $classname = !empty($block['classname']) ? $block['classname'] . ' ' : '';
        $div = "<div id=\"portal_block_{$bid}\" class=\"{$classname}block move-span\">";
        if (($_GET['diy'] === 'yes' || $_GET['inajax']) && check_diy_perm()) {
            $div .= "<div class='block-name'>{$block['name']} (ID:{$bid})</div>";
        }
        $str = $div . $str . "</div>";
    }
    if ($block['blockclass'] == 'html_html' && $block['script'] == 'search') {
        $str = strtr($str, array('{FORMHASH}' => FORMHASH));
    }
    return !empty($block['hidedisplay']) ? '' : $str;
}
开发者ID:vanloswang,项目名称:discuzx-1,代码行数:71,代码来源:function_block.php

示例2: output

function output()
{
    global $_G;
    if (defined('DISCUZ_OUTPUTED')) {
        return;
    } else {
        define('DISCUZ_OUTPUTED', 1);
    }
    if (!empty($_G['blockupdate'])) {
        block_updatecache($_G['blockupdate']['bid']);
    }
    if (defined('IN_MOBILE')) {
        mobileoutput();
    }
    if (!defined('IN_MOBILE') && !defined('IN_ARCHIVER')) {
        $tipsService = Cloud::loadClass('Service_DiscuzTips');
        $tipsService->show();
    }
    $havedomain = implode('', $_G['setting']['domain']['app']);
    if ($_G['setting']['rewritestatus'] || !empty($havedomain)) {
        $content = ob_get_contents();
        $content = output_replace($content);
        ob_end_clean();
        $_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
        echo $content;
    }
    if ($_G['setting']['ftp']['connid']) {
        @ftp_close($_G['setting']['ftp']['connid']);
    }
    $_G['setting']['ftp'] = array();
    if (defined('CACHE_FILE') && CACHE_FILE && !defined('CACHE_FORBIDDEN') && !defined('IN_MOBILE') && !checkmobile()) {
        if (diskfreespace(DISCUZ_ROOT . './' . $_G['setting']['cachethreaddir']) > 1000000) {
            if ($fp = @fopen(CACHE_FILE, 'w')) {
                flock($fp, LOCK_EX);
                fwrite($fp, empty($content) ? ob_get_contents() : $content);
            }
            @fclose($fp);
            chmod(CACHE_FILE, 0777);
        }
    }
    if (defined('DISCUZ_DEBUG') && DISCUZ_DEBUG && @(include libfile('function/debug'))) {
        function_exists('debugmessage') && debugmessage();
    }
}
开发者ID:dalinhuang,项目名称:healthshop,代码行数:44,代码来源:function_core.php

示例3: output

function output()
{
    global $_G;
    if (defined('DISCUZ_OUTPUTED')) {
        return;
    } else {
        define('DISCUZ_OUTPUTED', 1);
    }
    if (!empty($_G['blockupdate'])) {
        block_updatecache($_G['blockupdate']['bid']);
    }
    $_G['domain'] = array();
    foreach ($_G['config']['app']['domain'] as $app => $domain) {
        if ($domain || $_G['config']['app']['domain']['default']) {
            $domain = empty($domain) ? $_G['config']['app']['domain']['default'] : $domain;
            $_G['domain']['search'][$app] = "<a href=\"{$app}.php";
            $_G['domain']['replace'][$app] = '<a href="http://' . $domain . $_G['siteroot'] . $app . '.php';
            $_G['domain']['pregxp'][$app] = '<a href\\="http\\:\\/\\/(' . preg_quote($domain . $_G['siteroot'], '/') . ')' . preg_quote($app . '.php', '/');
        } else {
            $_G['domain']['pregxp'][$app] = "<a href\\=\"(){$app}.php";
        }
    }
    if ($_G['setting']['rewritestatus'] || $_G['domain']['search']) {
        $content = ob_get_contents();
        $_G['domain']['search'] && ($content = str_replace($_G['domain']['search'], $_G['domain']['replace'], $content));
        $_G['config']['app']['domain']['default'] && ($content = preg_replace("/<a href=\"([^\"]+)\"/e", "rewriteoutput('site_default', 0, '" . $_G['config']['app']['domain']['default'] . $_G['siteroot'] . "', '\\1')", $content));
        if ($_G['setting']['rewritestatus'] && !defined('IN_MODCP') && !defined('IN_ADMINCP')) {
            $searcharray = $replacearray = array();
            $array = rewritedata();
            $content = preg_replace($array['search'], $array['replace'], $content);
        }
        ob_end_clean();
        $_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
        echo $content;
    }
    if ($_G['setting']['ftp']['connid']) {
        @ftp_close($_G['setting']['ftp']['connid']);
    }
    $_G['setting']['ftp'] = array();
    if (defined('CACHE_FILE') && CACHE_FILE && !defined('CACHE_FORBIDDEN')) {
        global $_G;
        if (diskfreespace(DISCUZ_ROOT . './' . $_G['setting']['cachethreaddir']) > 1000000) {
            if ($fp = @fopen(CACHE_FILE, 'w')) {
                flock($fp, LOCK_EX);
                fwrite($fp, empty($content) ? ob_get_contents() : $content);
            }
            @fclose($fp);
            chmod(CACHE_FILE, 0777);
        }
    }
    if (defined('DISCUZ_DEBUG') && DISCUZ_DEBUG && @(include libfile('function/debug'))) {
        function_exists('debugmessage') && debugmessage();
    }
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:54,代码来源:function_core.php

示例4: array

    if (!block_check_favorite($_G['uid'], $bid)) {
        $setarr = array('uid' => $_G['uid'], 'bid' => $bid);
        block_add_favorite($setarr);
        $favoriteop = 'add';
    } else {
        block_delete_favorite($_G['uid'], $bid);
        $favoriteop = 'del';
    }
} elseif ($op == 'delrecommend') {
    $perm = getblockperm($bid);
    if (!$perm['allowmanage'] && !$perm['allowrecommend']) {
        showmessage('block_no_right_recommend');
    }
    if ($_GET['dataid'] = dintval($_GET['dataid'])) {
        C::t('common_block_item_data')->delete($_GET['dataid']);
        block_updatecache($bid, true);
    }
    showmessage('do_success');
} elseif ($op == 'moreurl') {
    if (!$bid || !$allowmanage) {
        showmessage('block_edit_nopermission');
    }
    if (submitcheck('moreurlsubmit')) {
        $arr = array('perpage' => max(1, intval($_POST['perpage'])), 'seotitle' => $_POST['seotitle'], 'seokeywords' => $_POST['seokeywords'], 'seodescription' => $_POST['seodescription']);
        $block['param']['moreurl'] = $arr;
        C::t('common_block')->update($bid, array('param' => serialize($block['param'])));
        showmessage('do_success', 'portal.php?mod=portalcp&ac=block&op=moreurl&bid=' . $bid, array('bid' => $bid));
    }
    $block['param']['moreurl'] = !empty($block['param']['moreurl']) ? $block['param']['moreurl'] : array('perpage' => 20, 'seotitle' => $block['name'], 'keywords' => '', 'description' => '');
}
include_once template("portal/portalcp_block");
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:31,代码来源:portalcp_block.php

示例5: block_fetch_content

function block_fetch_content($bid, $isjscall = false, $forceupdate = false)
{
    global $_G;
    static $allowmem = null;
    if ($allowmem === null) {
        $allowmem = getglobal('setting/memory/diyblockoutput/enable') && memory('check');
    }
    $str = '';
    $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid];
    if (!$block) {
        return;
    }
    if ($forceupdate) {
        block_updatecache($bid, true);
        $block = $_G['block'][$bid];
    } elseif ($block['cachetime'] > 0 && $_G['timestamp'] - $block['dateline'] > $block['cachetime']) {
        if ($isjscall || $block['punctualupdate']) {
            block_updatecache($bid, true);
            $block = $_G['block'][$bid];
        } elseif (empty($_G['blockupdate']) || $block['dateline'] < $_G['blockupdate']['dateline']) {
            $_G['blockupdate'] = array('bid' => $bid, 'dateline' => $block['dateline']);
        }
    }
    if ($allowmem && empty($block['hidedisplay']) && empty($block['nocache'])) {
        $str = memory('get', 'blockcache_' . $bid . '_' . ($isjscall ? 'js' : 'htm'));
        if ($str !== null) {
            if ($block['blockclass'] == 'html_html' && $block['script'] == 'search') {
                $str = strtr($str, array('{FORMHASH}' => FORMHASH));
            }
            return $str;
        }
    }
    if ($isjscall || $block['blocktype']) {
        if ($block['summary']) {
            $str .= $block['summary'];
        }
        $str .= block_template($bid);
    } else {
        $classname = !empty($block['classname']) ? $block['classname'] . ' ' : '';
        $str .= "<div id=\"portal_block_{$bid}\" class=\"{$classname}block move-span\">";
        if ($block['title']) {
            $str .= $block['title'];
        }
        $str .= '<div id="portal_block_' . $bid . '_content" class="dxb_bc">';
        if ($block['summary']) {
            $block['summary'] = stripslashes($block['summary']);
            $str .= "<div class=\"portal_block_summary\">{$block['summary']}</div>";
        }
        $str .= block_template($bid);
        $str .= '</div>';
        $str .= "</div>";
    }
    if ($allowmem && empty($block['hidedisplay']) && empty($block['nocache'])) {
        memory('set', 'blockcache_' . $bid . '_' . ($isjscall ? 'js' : 'htm'), $str, getglobal('setting/memory/diyblockoutput/ttl'));
    }
    if ($block['blockclass'] == 'html_html' && $block['script'] == 'search') {
        $str = strtr($str, array('{FORMHASH}' => FORMHASH));
    }
    return !empty($block['hidedisplay']) ? '' : $str;
}
开发者ID:v998,项目名称:discuzx-en,代码行数:60,代码来源:function_block.php

示例6: showmessage

            }
            showmessage('do_success', dreferer('portal.php?mod=portalcp&ac=blockdata&op=manage&bid=' . $bid));
        } elseif (submitcheck('managedatasubmit')) {
            unset($item['thumbpath']);
            $item['stickgrade'] = intval($_POST['stickgrade']);
            DB::update('common_block_item_data', $item, array('dataid' => $dataid));
            showmessage('do_success', dreferer('portal.php?mod=portalcp&ac=block&op=itemdata&bid=' . $bid));
        }
    }
} elseif ($op == 'getblock') {
    if (!$bid || !$allowmanage) {
        showmessage('block_edit_nopermission');
    }
    block_get_batch($bid);
    if (!empty($_GET['forceupdate'])) {
        block_updatecache($bid, !empty($_GET['forceupdate']));
    }
    if (strexists($block['summary'], '<script')) {
        $block['summary'] = lang('portalcp', 'block_diy_nopreview');
        $_G['block'][$bid] = $block;
        $_G['block'][$bid]['cachetime'] = 0;
        $_G['block'][$bid]['nocache'] = true;
    }
    $html = block_fetch_content($bid, $block['blocktype']);
} elseif ($op == 'saveblockclassname') {
    if (!$bid || !$allowmanage) {
        showmessage('block_edit_nopermission');
    }
    if (submitcheck('saveclassnamesubmit')) {
        $setarr = array('classname' => getstr($_POST['classname'], 100, 0, 0, 0, -1));
        DB::update('common_block', $setarr, array('bid' => $bid));
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:31,代码来源:portalcp_block.php

示例7: output

function output()
{
    global $_G;
    if (defined('DISCUZ_OUTPUTED')) {
        return;
    } else {
        define('DISCUZ_OUTPUTED', 1);
    }
    if (!empty($_G['blockupdate'])) {
        block_updatecache($_G['blockupdate']['bid']);
    }
    $_G['domain'] = array();
    $port = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
    foreach ($_G['config']['app']['domain'] as $app => $domain) {
        if ($domain || $_G['config']['app']['domain']['default']) {
            $domain = empty($domain) ? $_G['config']['app']['domain']['default'] : $domain;
            $_G['domain']['search'][$app] = "<a href=\"{$app}.php";
            $_G['domain']['replace'][$app] = '<a href="http://' . $domain . $port . $_G['siteroot'];
            $_G['domain']['pregxprw'][$app] = '<a href\\="http\\:\\/\\/(' . preg_quote($domain . $port . $_G['siteroot'], '/') . ')';
        } else {
            $_G['domain']['pregxprw'][$app] = "<a href\\=\"(){$app}.php";
        }
    }
    if (defined('DISCUZ_DEBUG') && DISCUZ_DEBUG && @(include libfile('function/debug'))) {
        function_exists('debugmessage') && debugmessage();
    }
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:27,代码来源:function_core.php


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