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


PHP savecache函数代码示例

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


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

示例1: build_cache_fields_connect_register

function build_cache_fields_connect_register()
{
    global $_G;
    $data = array();
    $fields = array();
    if ($_G['setting']['connect']['register_gender']) {
        $fields[] = 'gender';
    }
    if ($_G['setting']['connect']['register_birthday']) {
        $fields[] = 'birthyear';
        $fields[] = 'birthmonth';
        $fields[] = 'birthday';
    }
    if ($fields) {
        foreach (C::t('common_member_profile_setting')->fetch_all($fields) as $field) {
            $choices = array();
            if ($field['selective']) {
                foreach (explode("\n", $field['choices']) as $item) {
                    list($index, $choice) = explode('=', $item);
                    $choices[trim($index)] = trim($choice);
                }
                $field['choices'] = $choices;
            } else {
                unset($field['choices']);
            }
            $field['showinregister'] = 1;
            $field['available'] = 1;
            $data['field_' . $field['fieldid']] = $field;
        }
    }
    savecache('fields_connect_register', $data);
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:32,代码来源:cache_fields_connect_register.php

示例2: build_cache_stamps

function build_cache_stamps()
{
    $data = array();
    $fillarray = range(0, 99);
    $count = 0;
    $repeats = $stampicon = array();
    foreach (C::t('common_smiley')->fetch_all_by_type(array('stamp', 'stamplist')) as $stamp) {
        if (isset($fillarray[$stamp['displayorder']])) {
            unset($fillarray[$stamp['displayorder']]);
        } else {
            $repeats[] = $stamp['id'];
        }
        $count++;
    }
    foreach ($repeats as $id) {
        reset($fillarray);
        $displayorder = current($fillarray);
        unset($fillarray[$displayorder]);
        C::t('common_smiley')->update($id, array('displayorder' => $displayorder));
    }
    foreach (C::t('common_smiley')->fetch_all_by_type('stamplist') as $stamp) {
        if ($stamp['typeid'] < 1) {
            continue;
        }
        $row = C::t('common_smiley')->fetch_by_id_type($stamp['typeid'], 'stamp');
        $stampicon[$row['displayorder']] = $stamp['displayorder'];
    }
    foreach (C::t('common_smiley')->fetch_all_by_type(array('stamp', 'stamplist')) as $stamp) {
        $icon = $stamp['type'] == 'stamp' ? isset($stampicon[$stamp['displayorder']]) ? $stampicon[$stamp['displayorder']] : 0 : ($stamp['type'] == 'stamplist' && !in_array($stamp['displayorder'], $stampicon) ? 1 : 0);
        $data[$stamp['displayorder']] = array('url' => $stamp['url'], 'text' => $stamp['code'], 'type' => $stamp['type'], 'icon' => $icon);
    }
    savecache('stamps', $data);
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:33,代码来源:cache_stamps.php

示例3: build_cache_advs

function build_cache_advs()
{
    $advlist = $data = array();
    $data['code'] = $data['parameters'] = $data['evalcode'] = array();
    foreach (C::t('common_advertisement')->fetch_all_old() as $adv) {
        foreach (explode("\t", $adv['targets']) as $target) {
            $data['code'][$target][$adv['type']][$adv['advid']] = $adv['code'];
        }
        $advtype_class = libfile('adv/' . $adv['type'], 'class');
        if (!file_exists($advtype_class)) {
            continue;
        }
        require_once $advtype_class;
        $advclass = 'adv_' . $adv['type'];
        $advclass = new $advclass();
        $adv['parameters'] = unserialize($adv['parameters']);
        unset($adv['parameters']['style'], $adv['parameters']['html'], $adv['parameters']['displayorder']);
        $data['parameters'][$adv['type']][$adv['advid']] = $adv['parameters'];
        if ($adv['parameters']['extra']) {
            $data['parameters'][$adv['type']][$adv['advid']] = array_merge($data['parameters'][$adv['type']][$adv['advid']], $adv['parameters']['extra']);
            unset($data['parameters'][$adv['type']][$adv['advid']]['extra']);
        }
        $advlist[] = $adv;
        $data['evalcode'][$adv['type']] = $advclass->evalcode($adv);
    }
    updateadvtype();
    savecache('advs', $data);
}
开发者ID:softhui,项目名称:discuz,代码行数:28,代码来源:cache_advs.php

示例4: build_cache_diytemplatename

function build_cache_diytemplatename()
{
    $data = array();
    $apps = array('portal', 'forum', 'group', 'home');
    $nullname = lang('portalcp', 'diytemplate_name_null');
    $scriptarr = $lostname = array();
    foreach (C::t('common_diy_data')->range() as $datarow) {
        $datarow['name'] = $datarow['name'] ? $datarow['name'] : lang('portalcp', $datarow['targettplname'], '', '');
        if (empty($datarow['name'])) {
            $lostname[$datarow['targettplname']] = $datarow['targettplname'];
            $datarow['name'] = $nullname;
        }
        $data[$datarow['targettplname']] = dhtmlspecialchars($datarow['name']);
        $curscript = substr($datarow['targettplname'], 0, strpos($datarow['targettplname'], '/'));
        if (in_array($curscript, $apps)) {
            $scriptarr[$curscript][$datarow['targettplname']] = true;
        }
    }
    if ($lostname) {
        require_once libfile('function/portalcp');
        foreach (getdiytplnames($lostname) as $pre => $datas) {
            foreach ($datas as $id => $name) {
                $data[$pre . $id] = $name;
            }
        }
    }
    savecache('diytemplatename', $data);
    foreach ($scriptarr as $curscript => $value) {
        savecache('diytemplatename' . $curscript, $value);
    }
}
开发者ID:softhui,项目名称:discuz,代码行数:31,代码来源:cache_diytemplatename.php

示例5: build_cache_heats

function build_cache_heats()
{
    global $_G;
    $addsql = '';
    $data = array();
    if (discuz_process::islocked('update_heats_list')) {
        return false;
    }
    if ($_G['setting']['indexhot']['status']) {
        require_once libfile('function/post');
        $_G['setting']['indexhot'] = array('status' => 1, 'limit' => intval($_G['setting']['indexhot']['limit'] ? $_G['setting']['indexhot']['limit'] : 10), 'days' => intval($_G['setting']['indexhot']['days'] ? $_G['setting']['indexhot']['days'] : 7), 'expiration' => intval($_G['setting']['indexhot']['expiration'] ? $_G['setting']['indexhot']['expiration'] : 900), 'messagecut' => intval($_G['setting']['indexhot']['messagecut'] ? $_G['setting']['indexhot']['messagecut'] : 200));
        $messageitems = 2;
        $limit = $_G['setting']['indexhot']['limit'];
        foreach (C::t('forum_thread')->fetch_all_heats() as $heat) {
            $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($heat['tid']);
            $heat = array_merge($heat, (array) $post);
            if ($limit == 0) {
                break;
            }
            if ($messageitems > 0) {
                $heat['message'] = !$heat['price'] ? messagecutstr($heat['message'], $_G['setting']['indexhot']['messagecut']) : '';
                $data['message'][$heat['tid']] = $heat;
            } else {
                unset($heat['message']);
                $data['subject'][$heat['tid']] = $heat;
            }
            $messageitems--;
            $limit--;
        }
        $data['expiration'] = TIMESTAMP + $_G['setting']['indexhot']['expiration'];
    }
    savecache('heats', $data);
    discuz_process::unlock('update_heats_list');
}
开发者ID:softhui,项目名称:discuz,代码行数:34,代码来源:cache_heats.php

示例6: build_cache_usergroups_single

function build_cache_usergroups_single()
{
    $pluginvalue = pluginsettingvalue('groups');
    $allowthreadplugin = C::t('common_setting')->fetch('allowthreadplugin', true);
    $data_uf = C::t('common_usergroup_field')->range();
    $data_ag = C::t('common_admingroup')->range();
    foreach (C::t('common_usergroup')->range() as $gid => $data) {
        $data = array_merge($data, (array) $data_uf[$gid], (array) $data_ag[$gid]);
        $ratearray = array();
        if ($data['raterange']) {
            foreach (explode("\n", $data['raterange']) as $rating) {
                $rating = explode("\t", $rating);
                $ratearray[$rating[0]] = array('isself' => $rating[1], 'min' => $rating[2], 'max' => $rating[3], 'mrpd' => $rating[4]);
            }
        }
        $data['raterange'] = $ratearray;
        $data['grouptitle'] = $data['color'] ? '<font color="' . $data['color'] . '">' . $data['grouptitle'] . '</font>' : $data['grouptitle'];
        $data['grouptype'] = $data['type'];
        $data['grouppublic'] = $data['system'] != 'private';
        $data['groupcreditshigher'] = $data['creditshigher'];
        $data['groupcreditslower'] = $data['creditslower'];
        $data['maxspacesize'] = intval($data['maxspacesize']) * 1024 * 1024;
        $data['allowthreadplugin'] = !empty($allowthreadplugin[$data['groupid']]) ? $allowthreadplugin[$data['groupid']] : array();
        $data['plugin'] = $pluginvalue[$data['groupid']];
        unset($data['type'], $data['system'], $data['creditshigher'], $data['creditslower'], $data['groupavatar'], $data['admingid']);
        savecache('usergroup_' . $data['groupid'], $data);
    }
}
开发者ID:lemonstory,项目名称:bbs,代码行数:28,代码来源:cache_usergroups.php

示例7: build_cache_app_setting

function build_cache_app_setting()
{
    global $_G;
    $data = array();
    $data = C::t('#corpus#corpus_setting')->fetch_all();
    savecache('corpus:setting', $data);
}
开发者ID:druphliu,项目名称:dzzoffice,代码行数:7,代码来源:cache_setting.php

示例8: build_cache_forumlinks

function build_cache_forumlinks()
{
    global $_G;
    $data = array();
    $query = C::t('common_friendlink')->fetch_all_by_displayorder();
    if ($_G['setting']['forumlinkstatus']) {
        $tightlink_content = $tightlink_text = $tightlink_logo = $comma = '';
        foreach ($query as $flink) {
            if ($flink['description']) {
                if ($flink['logo']) {
                    $tightlink_content .= '<li class="lk_logo mbm bbda cl"><img src="' . $flink['logo'] . '" border="0" alt="' . strip_tags($flink['name']) . '" /><div class="lk_content z"><h5><a href="' . $flink['url'] . '" target="_blank">' . $flink['name'] . '</a></h5><p>' . $flink['description'] . '</p></div></li>';
                } else {
                    $tightlink_content .= '<li class="mbm bbda"><div class="lk_content"><h5><a href="' . $flink['url'] . '" target="_blank">' . $flink['name'] . '</a></h5><p>' . $flink['description'] . '</p></div></li>';
                }
            } else {
                if ($flink['logo']) {
                    $tightlink_logo .= '<a href="' . $flink['url'] . '" target="_blank"><img src="' . $flink['logo'] . '" border="0" alt="' . strip_tags($flink['name']) . '" /></a> ';
                } else {
                    $tightlink_text .= '<li><a href="' . $flink['url'] . '" target="_blank" title="' . strip_tags($flink['name']) . '">' . $flink['name'] . '</a></li>';
                }
            }
        }
        $data = array($tightlink_content, $tightlink_logo, $tightlink_text);
    }
    savecache('forumlinks', $data);
}
开发者ID:tang86,项目名称:discuz-utf8,代码行数:26,代码来源:cache_forumlinks.php

示例9: build_cache_globalstick

function build_cache_globalstick()
{
    $data = array();
    $query = C::t('forum_forum')->fetch_all_valid_forum();
    $fuparray = $threadarray = array();
    foreach ($query as $forum) {
        switch ($forum['type']) {
            case 'forum':
                $fuparray[$forum['fid']] = $forum['fup'];
                break;
            case 'sub':
                $fuparray[$forum['fid']] = $fuparray[$forum['fup']];
                break;
        }
    }
    foreach (C::t('forum_thread')->fetch_all_by_displayorder(array(2, 3)) as $thread) {
        switch ($thread['displayorder']) {
            case 2:
                $threadarray[$fuparray[$thread['fid']]][] = $thread['tid'];
                break;
            case 3:
                $threadarray['global'][] = $thread['tid'];
                break;
        }
    }
    foreach (array_unique($fuparray) as $gid) {
        if (!empty($threadarray[$gid])) {
            $data['categories'][$gid] = array('tids' => dimplode($threadarray[$gid]), 'count' => intval(@count($threadarray[$gid])));
        }
    }
    $data['global'] = array('tids' => empty($threadarray['global']) ? '' : dimplode($threadarray['global']), 'count' => intval(@count($threadarray['global'])));
    savecache('globalstick', $data);
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:33,代码来源:cache_globalstick.php

示例10: build_cache_styles

function build_cache_styles()
{
    global $_G;
    $stylevars = $styledata = array();
    $defaultstyleid = $_G['setting']['styleid'];
    foreach (C::t('common_stylevar')->range() as $var) {
        $stylevars[$var['styleid']][$var['variable']] = $var['substitute'];
    }
    foreach (C::t('common_style')->fetch_all_data(true) as $data) {
        $data['tpldir'] = $data['directory'];
        $data = array_merge($data, (array) $stylevars[$data['styleid']]);
        $datanew = array();
        $data['imgdir'] = $data['imgdir'] ? $data['imgdir'] : STATICURL . 'image/common';
        $data['styleimgdir'] = $data['styleimgdir'] ? $data['styleimgdir'] : $data['imgdir'];
        foreach ($data as $k => $v) {
            if (substr($k, -7, 7) == 'bgcolor') {
                $newkey = substr($k, 0, -7) . 'bgcode';
                $datanew[$newkey] = setcssbackground($data, $k);
            }
        }
        $data = array_merge($data, $datanew);
        if (strstr($data['boardimg'], ',')) {
            $flash = explode(",", $data['boardimg']);
            $flash[0] = trim($flash[0]);
            $flash[0] = preg_match('/^http:\\/\\//i', $flash[0]) ? $flash[0] : $data['styleimgdir'] . '/' . $flash[0];
            $data['boardlogo'] = "<embed src=\"" . $flash[0] . "\" width=\"" . trim($flash[1]) . "\" height=\"" . trim($flash[2]) . "\" type=\"application/x-shockwave-flash\" wmode=\"transparent\"></embed>";
        } else {
            $data['boardimg'] = preg_match('/^http:\\/\\//i', $data['boardimg']) ? $data['boardimg'] : $data['styleimgdir'] . '/' . $data['boardimg'];
            $data['boardlogo'] = "<img src=\"{$data['boardimg']}\" alt=\"" . $_G['setting']['bbname'] . "\" border=\"0\" />";
        }
        $data['bold'] = $data['nobold'] ? 'normal' : 'bold';
        $contentwidthint = intval($data['contentwidth']);
        $contentwidthint = $contentwidthint ? $contentwidthint : 600;
        if ($data['extstyle']) {
            list($data['extstyle'], $data['defaultextstyle']) = explode('|', $data['extstyle']);
            $extstyle = explode("\t", $data['extstyle']);
            $data['extstyle'] = array();
            foreach ($extstyle as $dir) {
                if (file_exists($extstylefile = DISCUZ_ROOT . $data['tpldir'] . '/style/' . $dir . '/style.css')) {
                    if ($data['defaultextstyle'] == $dir) {
                        $data['defaultextstyle'] = $data['tpldir'] . '/style/' . $dir;
                    }
                    $content = file_get_contents($extstylefile);
                    if (preg_match('/\\[name\\](.+?)\\[\\/name\\]/i', $content, $r1) && preg_match('/\\[iconbgcolor](.+?)\\[\\/iconbgcolor]/i', $content, $r2)) {
                        $data['extstyle'][] = array($data['tpldir'] . '/style/' . $dir, $r1[1], $r2[1]);
                    }
                }
            }
        }
        $data['verhash'] = random(3);
        $styledata[] = $data;
    }
    foreach ($styledata as $data) {
        savecache('style_' . $data['styleid'], $data);
        if ($defaultstyleid == $data['styleid']) {
            savecache('style_default', $data);
        }
        writetocsscache($data);
    }
}
开发者ID:KKRainbow,项目名称:discuz-x32-php7,代码行数:60,代码来源:cache_styles.php

示例11: check

 public function check()
 {
     require_once libfile('function/admincp');
     require_once libfile('function/plugin');
     require_once libfile('function/cloudaddons');
     $pluginarray = C::t('common_plugin')->fetch_all_data();
     $addonids = array();
     foreach ($pluginarray as $row) {
         if (ispluginkey($row['identifier'])) {
             $addonids[] = $row['identifier'] . '.plugin';
         }
     }
     $checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
     savecache('addoncheck_plugin', $checkresult);
     $newversion = 0;
     foreach ($checkresult as $value) {
         list(, $newver) = explode(':', $value);
         if ($newver) {
             $newversion++;
         }
     }
     if ($newversion) {
         $return = array('status' => 1, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_plugin_new_plugin', array('newversion' => $newversion)));
     } else {
         $return = array('status' => 0, 'type' => 'none', 'lang' => lang('optimizer', 'optimizer_plugin_no_upgrade'));
     }
     return $return;
 }
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:28,代码来源:optimizer_plugin.php

示例12: build_cache_forumrecommend

function build_cache_forumrecommend()
{
    $data = array();
    $fids = C::t('forum_forum')->fetch_all_fids();
    foreach ($fids as $row) {
        require_once libfile('function/group');
        $recommendlist = C::t('forum_forum')->fetch_all_recommend_by_fid($row['fid']);
        foreach ($recommendlist as $info) {
            $group = array('fid' => $info['fid'], 'name' => $info['name'], 'threads' => $info['threads'], 'lastpost' => $info['lastpost'], 'icon' => $info['icon'], 'membernum' => $info['membernum'], 'description' => $info['description']);
            $group['icon'] = get_groupimg($group['icon'], 'icon');
            $lastpost = array(0, 0, '', '');
            $group['lastpost'] = is_string($group['lastpost']) ? explode("\t", $group['lastpost']) : $group['lastpost'];
            $group['lastpost'] = count($group['lastpost']) != 4 ? $lastpost : $group['lastpost'];
            list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost['author']) = $group['lastpost'];
            if ($lastpost['tid']) {
                $lastpost['dateline'] = dgmdate($lastpost['dateline'], 'Y-m-d H:i:s');
                if ($lastpost['author']) {
                    $lastpost['encode_author'] = rawurlencode($lastpost['author']);
                }
                $group['lastpost'] = $lastpost;
            } else {
                $group['lastpost'] = '';
            }
            $data[$row['fid']][] = $group;
        }
    }
    savecache('forumrecommend', $data);
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:28,代码来源:cache_forumrecommend.php

示例13: checkCloud

	function checkCloud() {
		global $_G;

		loadcache('mobileoem_data');
		if(!$_G['cache']['mobileoem_data'] || (TIMESTAMP - $_G['cache']['mobileoem_data']['timestamp']) > 86400) {
			try {
				$cloud = Cloud::loadClass('Service_Client_OEM');
				$clouddata = $cloud->checkApp();
			} catch (Exception $e) {
				$clouddata = array('errCode' => 1);
			}
			if(!$clouddata['errCode']) {
				if(!$clouddata['isDone']) {
					$_G['cache']['mobileoem_data'] = array();
				} else {
					$_G['cache']['mobileoem_data'] = $clouddata;
				}
			}
			$_G['cache']['mobileoem_data']['timestamp'] = TIMESTAMP;
			savecache('mobileoem_data', $_G['cache']['mobileoem_data']);
		}

		$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
		if(strpos($useragent, 'iphone') !== false || strpos($useragent, 'ios') !== false) {
			$this->platform = '&platform=ios';
		} elseif(strpos($useragent, 'android') !== false) {
			$this->platform = '&platform=android';
		} elseif(strpos($useragent, 'windows phone') !== false) {
			$this->platform = '&platform=windowsphone';
		} else {
			$this->platform = '';
		}
	}
开发者ID:hutao1004,项目名称:yintt,代码行数:33,代码来源:mobileoem.class.php

示例14: build_cache_postimg

function build_cache_postimg()
{
    $imgextarray = array('jpg', 'gif', 'png');
    $imgdir = array('hrline', 'postbg');
    $postimgjs = 'var postimg_type = new Array();';
    foreach ($imgdir as $perdir) {
        $count = 0;
        $pdir = DISCUZ_ROOT . './static/image/' . $perdir;
        $postimgdir = dir($pdir);
        $postimgjs .= 'postimg_type["' . $perdir . '"]=[';
        while ($entry = $postimgdir->read()) {
            if (in_array(strtolower(fileext($entry)), $imgextarray) && preg_match("/^[\\w\\-\\.\\[\\]\\(\\)\\<\\> &]+\$/", substr($entry, 0, strrpos($entry, '.'))) && strlen($entry) < 30 && is_file($pdir . '/' . $entry)) {
                $postimg[$perdir][] = array('url' => $entry);
                $postimgjs .= ($count ? ',' : '') . '"' . $entry . '"';
                $count++;
            }
        }
        $postimgjs .= '];';
        $postimgdir->close();
    }
    savecache('postimg', $postimg);
    $cachedir = 'saekv://data/cache/';
    if (@($fp = fopen($cachedir . 'common_postimg.js', 'w'))) {
        fwrite($fp, $postimgjs);
        fclose($fp);
    } else {
        exit('Can not write to cache files, please check directory ./data/ and ./data/cache/ .');
    }
}
开发者ID:wait121000,项目名称:discuz3.0forsae,代码行数:29,代码来源:cache_postimg.php

示例15: build_cache_setting

/**
 * 基本缓存设置
 * @author HumingXu E-mail:huming17@126.com
 */
function build_cache_setting()
{
    global $_G;
    $skipkeys = array('backupdir', 'custombackup');
    $serialized = array('seccodedata', 'secqaa', 'server_mail', 'server_upload');
    $data = array();
    foreach (C::t('common_setting')->fetch_all_not_key($skipkeys) as $setting) {
        if (in_array($setting['skey'], $serialized)) {
            $_G['setting'][$setting['skey']] = $data[$setting['skey']] = json_decode($setting['svalue'], 1);
        } else {
            $_G['setting'][$setting['skey']] = $data[$setting['skey']] = $setting['svalue'];
        }
    }
    list($data['user_role_menu']) = get_cachedata_user_role_menu();
    //TODO 数据文件缓存
    //$data['footernavs'] = get_cachedata_footernav();
    //$data['spacenavs'] = get_cachedata_spacenavs();
    //$data['mynavs'] = get_cachedata_mynavs();
    //$data['topnavs'] = get_cachedata_topnav();
    //	unset($data['allowthreadplugin']);
    //	if($data['jspath'] == 'data/cache/') {
    //		writetojscache();
    //	} elseif(!$data['jspath']) {
    //		$data['jspath'] = 'static/js/';
    //	}
    //
    //	if($data['cacheindexlife']) {
    //		$cachedir = SITE_ROOT.'./cache/';
    //		$tidmd5 = substr(md5(0), 3);
    //		@unlink($cachedir.'/'.$tidmd5[0].'/'.$tidmd5[1].'/'.$tidmd5[2].'/0.htm');
    //	}
    savecache('setting', $data);
    $_G['setting'] = $data;
}
开发者ID:huming17,项目名称:dzmvc,代码行数:38,代码来源:cache_setting.php


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