本文整理汇总了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;
}