本文整理匯總了PHP中modC函數的典型用法代碼示例。如果您正苦於以下問題:PHP modC函數的具體用法?PHP modC怎麽用?PHP modC使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了modC函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tpls
/**
* 模版列表頁
* @author 鄭鍾良<zzl@ourstu.com>
*/
public function tpls()
{
$aCleanCookie = I('get.cleanCookie', 0, 'intval');
if ($aCleanCookie) {
cookie('TO_LOOK_THEME', null, array('prefix' => 'OSV2'));
}
// 根據應用目錄取全部APP信息
$dir = OS_THEME_PATH;
$tplList = null;
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
//去掉"“.”、“..”以及帶“.xxx”後綴的文件
if ($file != "." && $file != ".." && !strpos($file, ".")) {
if (is_file(OS_THEME_PATH . $file . '/info.php')) {
$tpl = (require_once OS_THEME_PATH . $file . '/info.php');
$tpl['path'] = OS_THEME_PATH . $file;
$tpl['file_name'] = $file;
$tplList[] = $tpl;
}
}
}
closedir($dh);
}
}
$now_theme = modC('NOW_THEME', 'default', 'Theme');
$this->assign('now_theme', $now_theme);
$this->assign('tplList', $tplList);
$this->display();
}
示例2: nicknameLength
public function nicknameLength($nickname)
{
if (mb_strlen($nickname, 'utf-8') < modC('NICKNAME_MIN_LENGTH', 2, 'USERCONFIG') || mb_strlen($nickname, 'utf-8') < modC('NICKNAME_MAX_LENGTH', 32, 'USERCONFIG')) {
$this->error = L('_NICKNAME_LENGTH_MUST_BE_IN_') . modC('NICKNAME_MIN_LENGTH', 2, 'USERCONFIG') . '-' . modC('NICKNAME_MAX_LENGTH', 32, 'USERCONFIG') . L('_POSITION_WITH_EXCLAMATION_');
}
return true;
}
示例3: nicknameLength
public function nicknameLength($nickname)
{
if (mb_strlen($nickname, 'utf-8') < modC('NICKNAME_MIN_LENGTH', 2, 'USERCONFIG') || mb_strlen($nickname, 'utf-8') < modC('NICKNAME_MAX_LENGTH', 32, 'USERCONFIG')) {
$this->error = '昵稱長度必須在' . modC('NICKNAME_MIN_LENGTH', 2, 'USERCONFIG') . '-' . modC('NICKNAME_MAX_LENGTH', 32, 'USERCONFIG') . '位之間!';
}
return true;
}
示例4: assignQuestion
private function assignQuestion()
{
$num = modC('QUESTION_SHOW_COUNT', 4, 'Question');
$type = modC('QUESTION_SHOW_TYPE', 0, 'Question');
$field = modC('QUESTION_SHOW_ORDER_FIELD', 'answer_num', 'Question');
$order = modC('QUESTION_SHOW_ORDER_TYPE', 'desc', 'Question');
$cache = modC('QUESTION_SHOW_CACHE_TIME', 600, 'Question');
$list = S('question_home_data');
if (!$list) {
if ($type) {
$map['is_recommend'] = 1;
}
$map['status'] = 1;
$list = $this->_getList($map, $num, $field . ' ' . $order);
if (!$list) {
$list = 1;
}
S('question_home_data', $list, $cache);
}
unset($v);
if ($list == 1) {
$list = null;
}
$this->assign('question_lists', $list);
}
示例5: get_withdraw_type
function get_withdraw_type($field)
{
$fields_config = modC('WITHDRAW_FIELD', "", 'recharge');
$fields = json_decode($fields_config, true);
$res = array_search_key($fields, 'FIELD', $field);
return $res;
}
示例6: getForumList
public function getForumList($map_type = array('status' => 1))
{
$tag = 'forum_list_' . serialize($map_type);
$forum_list = S($tag);
$cache_time = modC('CACHE_TIME', 300, 'Forum');
if (empty($forum_list)) {
//讀取板塊列表
$forum_list = D('Forum/Forum')->where($map_type)->order('sort asc')->select();
$forumPostModel = D('ForumPost');
$forumPostReplyModel = D('ForumPostReply');
$forumLzlReplyModel = D('ForumLzlReply');
foreach ($forum_list as &$f) {
$map['status'] = 1;
$map['forum_id'] = $f['id'];
$f['background'] = $f['background'] ? getThumbImageById($f['background'], 800, 'auto') : C('TMPL_PARSE_STRING.__IMG__') . '/default_bg.jpg';
$f['logo'] = $f['logo'] ? getThumbImageById($f['logo'], 128, 128) : C('TMPL_PARSE_STRING.__IMG__') . '/default_logo.png';
$f['topic_count'] = $forumPostModel->where($map)->count();
$post_id = $forumPostModel->where(array('forum_id' => $f['id']))->field('id')->select();
$p_id = getSubByKey($post_id, 'id');
$map['post_id'] = array('in', implode(',', $p_id));
$f['total_count'] = $f['topic_count'] + $forumPostReplyModel->where($map)->count();
// + $forumLzlReplyModel->where($map)->count();
}
unset($f);
S($tag, $forum_list, $cache_time);
}
return $forum_list;
}
示例7: getCurrency_info
/**
* 獲取微店交易積分類型
* @return mixed
* @author 鄭鍾良<zzl@ourstu.com>
*/
public function getCurrency_info()
{
$score_id = modC('CURRENCY_TYPE', 4, 'Store');
$scoreModel = D('Ucenter/Score');
$currency = $scoreModel->getType($score_id);
return $currency;
}
示例8: getAdvList
public function getAdvList($name, $path)
{
$list = S('adv_list_' . $name . $path);
if ($list === false) {
$now_theme = modC('NOW_THEME', 'default', 'Theme');
$advPos = D('Common/AdvPos')->getInfo($name, $path);
//找到當前調用的廣告位
if ($advPos['theme'] != 'all' && !in_array($now_theme, explode(',', $advPos['theme']))) {
return null;
}
$advMap['pos_id'] = $advPos['id'];
$advMap['status'] = 1;
$advMap['start_time'] = array('lt', time());
$advMap['end_time'] = array('gt', time());
$data = $this->where($advMap)->order('sort asc')->select();
foreach ($data as &$v) {
$d = json_decode($v['data'], true);
if (!empty($d)) {
$v = array_merge($d, $v);
}
}
unset($v);
S('adv_list_' . $name . $path, $list);
}
return $data;
}
示例9: checkUsernameLength
/**
* 驗證用戶名長度
* @param $username
* @return bool
* @author 鄭鍾良<zzl@ourstu.com>
*/
protected function checkUsernameLength($username)
{
$length = mb_strlen($username, 'utf-8');
// 當前數據長度
if ($length < modC('USERNAME_MIN_LENGTH', 2, 'USERCONFIG') || $length > modC('USERNAME_MAX_LENGTH', 32, 'USERCONFIG')) {
return false;
}
return true;
}
示例10: _initialize
function _initialize()
{
$this->paperModel = D('Paper/Paper');
$this->paperCategoryModel = D('Paper/PaperCategory');
$catTitle = modC('PAPER_CATEGORY_TITLE', '網站介紹', 'Paper');
$sub_menu['left'][] = array('tab' => 'home', 'title' => $catTitle, 'href' => U('index'));
$this->assign('sub_menu', $sub_menu);
$this->assign('current', 'home');
}
示例11: getAmount
private function getAmount($order)
{
$finally = $order['total_cny'] + $order['adj_cny'];
$score_id = modC('CURRENCY_TYPE', 4, 'Store');
$fields_config = modC('RE_FIELD', "", 'recharge');
$fields = json_decode($fields_config, true);
$type = array_search_key($fields, 'FIELD', $score_id);
!$type && ($type['UNIT'] = 1);
return number_format($finally / $type['UNIT'], 2, ".", "");
}
示例12: seo_replace_variables
function seo_replace_variables($string, $vars)
{
//如果輸入的文字是空的,那就直接返回空的字符串好了。
if (!$string) {
return '';
}
//調用ThinkPHP中的解析引擎解析變量
$view = new Think\View();
$view->assign('website_name', modC('WEB_SITE_NAME'));
$view->assign($vars);
$result = $view->fetch('', $string);
//返回替換變量後的結果
return $result;
}
示例13: AdvsList
public function AdvsList($param)
{
$now_theme = modC('NOW_THEME', 'default', 'Theme');
if (isset($param)) {
//TODO 插入廣告位標識符判斷
$advPos = M('Addons://Advertising/Advertising')->getInfo($param);
//找到當前調用的廣告位
if ($advPos['theme'] != 'all' && !in_array($now_theme, explode(',', $advPos['theme']))) {
return null;
}
$advMap['position'] = $advPos['id'];
}
$advMap['status'] = 1;
if ($advPos['type'] == 2) {
$advs = $this->where($advMap)->order('level asc,id asc')->select();
foreach ($advs as $key => $val) {
if (intval($val['create_time']) != 0) {
if ($val['create_time'] > time()) {
unset($advs[$key]);
continue;
}
}
if (intval($val['end_time']) != 0) {
if ($val['end_time'] < time()) {
unset($advs[$key]);
continue;
}
}
$data[$key] = $val;
$cover = D('picture')->find($val['advspic']);
$data[$key]['path'] = $cover['path'];
}
} else {
$data = $this->where($advMap)->order('level asc,id asc')->find();
if (intval($data['create_time']) != 0) {
if ($data['create_time'] > time()) {
return null;
}
}
if (intval($data['end_time']) != 0) {
if ($data['end_time'] < time()) {
return null;
}
}
}
$result['data'] = $data;
$result['pos'] = $advPos;
return $result;
}
示例14: parse_weibo_content
function parse_weibo_content($content)
{
$content = shorten_white_space($content);
if (modC('WEIBO_BR', 0, 'Weibo')) {
$content = str_replace('/br', '<br/>', $content);
$content = str_replace('/nb', ' ', $content);
} else {
$content = str_replace('/br', '', $content);
$content = str_replace('/nb', '', $content);
}
$content = parse_url_link($content);
$content = parse_expression($content);
$content = parseWeiboContent($content);
return $content;
}
示例15: filterWeibo
private function filterWeibo($aType, $param)
{
if ($aType == 'concerned') {
$followList = D('Follow')->getFollowList();
$param['where']['uid'] = array('in', $followList);
}
if ($aType == 'hot') {
$hot_left = modC('HOT_LEFT', 3);
$time_left = get_some_day($hot_left);
$param['where']['create_time'] = array('gt', $time_left);
$param['order'] = 'comment_count desc';
$this->assign('tab', 'hot');
}
return $param;
}