本文整理汇总了PHP中op_t函数的典型用法代码示例。如果您正苦于以下问题:PHP op_t函数的具体用法?PHP op_t怎么用?PHP op_t使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了op_t函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($data)
{
$tpl_section = $data['tpl'];
$info = $data['info'];
$tpl_section = $this->handle($tpl_section, '{$[title]}', op_t($info['title']));
$tpl_section = $this->handle($tpl_section, '{$[cTime]}', friendlyDate($info['create_time']));
$tpl_section = $this->handle($tpl_section, '{$[cTimeD]}', date('n j', $info['create_time']));
$tpl_section = $this->handle($tpl_section, '{$[url]}', U('Cat/Index/info', array('info_id' => $info['id'])));
/*用户标签*/
$user = query_user(array('nickname', 'avatar32', 'avatar64', 'avatar128', 'avatar256', 'space_url'), $info['uid']);
$tpl_section = $this->handle($tpl_section, '{$[user_avatar32]}', $user['avatar32']);
$tpl_section = $this->handle($tpl_section, '{$[user_avatar64]}', $user['avatar64']);
$tpl_section = $this->handle($tpl_section, '{$[user_avatar128]}', $user['avatar128']);
$tpl_section = $this->handle($tpl_section, '{$[user_avatar256]}', $user['avatar256']);
$tpl_section = $this->handle($tpl_section, '{$[user_nickname]}', $user['nickname']);
$tpl_section = $this->handle($tpl_section, '{$[user_space_url]}', $user['space_url']);
$tpl_section = $this->handle($tpl_section, '{$[user_uid]}', $user['uid']);
/*用户标签end*/
$tpl_section = $this->handle($tpl_section, '{$[fav_btn]}', R('FavBtn/render', array(array('info' => $info)), 'Widget'));
$entity = D('cat_entity')->find($info['entity_id']);
if ($entity['can_over']) {
$tpl_section = $this->handle($tpl_section, '{$[over_time]}', date('Y-m-d', $info['over_time']));
} else {
$tpl_section = $this->handle($tpl_section, '{$[over_time]}', '');
}
return $tpl_section;
}
示例2: render
public function render($is_following = 0, $uid = 0)
{
$uid = op_t($uid);
$this->assign('is_following', $is_following);
$this->assign('uid', $uid);
$this->display(T('Application://Common@Widget/ufollow'));
}
示例3: addData
public function addData($name, $value, $info_id, $entity_id)
{
$map['name'] = $name;
$map['entity_id'] = $entity_id;
$profile = M('cat_field')->where($map)->find();
$content_data['id'] = $profile;
$content_data['field_id'] = $profile['id'];
if (!$this->validateField($profile, $value)) {
return false;
}
if (!is_array($value)) {
//如果值不是数组
if ($profile['input_type'] == IT_DATE) {
$content_data['value'] = strtotime($value);
} else {
$content_data['value'] = $value;
}
$content_data['info_id'] = $info_id;
return $this->add($content_data);
} else {
$rs = 1;
foreach ($value as $v) {
//如果是数组
$content_data['value'] = op_t($v);
$content_data['info_id'] = $info_id;
$rs = $rs && $this->add($content_data);
}
return $rs;
}
}
示例4: getLastMessage
public function getLastMessage($talk_id)
{
$last_message = D('TalkMessage')->where('talk_id=' . $talk_id)->order('create_time desc')->find();
$last_message['user'] = query_user(array('nickname', 'space_url', 'id'), $last_message['uid']);
$last_message['content'] = op_t($last_message['content']);
return $last_message;
}
示例5: getLinkContent
public function getLinkContent()
{
require_once './ThinkPHP/Library/Vendor/Collection/phpQuery.php';
$link = op_t(I('post.url'));
$content = get_content_by_url($link);
$charset = preg_match("/<meta.+?charset=[^\\w]?([-\\w]+)/i", $content, $temp) ? strtolower($temp[1]) : "utf-8";
\phpQuery::$defaultCharset = $charset;
\phpQuery::newDocument($content);
$title = pq("meta[name='title']")->attr('content');
if (empty($title)) {
$title = pq("title")->html();
}
$title = iconv($charset, "UTF-8", $title);
$keywords = pq("meta[name='keywords'],meta[name='Keywords']")->attr('content');
$description = pq("meta[name='description'],meta[name='Description']")->attr('content');
$url = parse_url($link);
$img = pq("img")->eq(0)->attr('src');
if (is_bool(strpos($img, 'http://'))) {
$img = 'http://' . $url['host'] . $img;
}
$title = text($title);
$description = text($description);
$keywords = text($keywords);
$return['title'] = $title;
$return['img'] = $img;
$return['description'] = empty($description) ? $title : $description;
$return['keywords'] = empty($keywords) ? $title : $keywords;
exit(json_encode($return));
}
示例6: search
public function search($uid = 0, $page = 1, $lastId = 0)
{
$keywords = op_t($_REQUEST['keywords']);
if (!isset($keywords)) {
$keywords = '';
}
//载入第一页微博
if ($uid != 0) {
$result = $this->weiboApi->listAllWeibo($page, null, array('uid' => $uid), 1, $lastId, $keywords);
} else {
$result = $this->weiboApi->listAllWeibo($page, 0, '', 1, $lastId, $keywords);
}
//显示页面
$this->assign('list', $result['list']);
$this->assign('lastId', $result['lastId']);
$this->assign('page', $page);
$this->assign('tab', 'all');
$this->assign('loadMoreUrl', U('loadWeibo', array('uid' => $uid, 'keywords' => $keywords)));
if (isset($keywords) && $keywords != '') {
$map['content'] = array('like', "%{$keywords}%");
}
$total_count = $this->weiboApi->listAllWeiboCount($map);
$this->assign('key_words', $keywords);
$this->assign('total_count', $total_count['total_count']);
$this->assign('tox_money_name', getToxMoneyName());
$this->assign('tox_money', getMyToxMoney());
$this->setTitle('全站搜索微博');
$this->assign('filter_tab', '全站动态');
$this->assignSelf();
$this->display();
}
示例7: user
public function user()
{
$Channel = D('UserNav');
if (IS_POST) {
$one = $_POST['nav'][1];
if (count($one) > 0) {
M()->execute('TRUNCATE TABLE ' . C('DB_PREFIX') . 'user_nav');
for ($i = 0; $i < count(reset($one)); $i++) {
$data[$i] = array('title' => op_t($one['title'][$i]), 'url' => op_t($one['url'][$i]), 'sort' => intval($one['sort'][$i]), 'target' => intval($one['target'][$i]), 'color' => op_t($one['color'][$i]), 'band_text' => op_t($one['band_text'][$i]), 'band_color' => op_t($one['band_color'][$i]), 'icon' => op_t(str_replace('icon-', '', $one['icon'][$i])), 'status' => 1);
$pid[$i] = $Channel->add($data[$i]);
}
S('common_user_nav', null);
$this->success(L('_CHANGE_'));
}
$this->error(L('_NAVIGATION_AT_LEAST_ONE_'));
} else {
/* 获取频道列表 */
$map = array('status' => array('gt', -1));
$list = $Channel->where($map)->order('sort asc,id asc')->select();
foreach ($list as $k => &$v) {
$module = D('Module')->where(array('entry' => $v['url']))->find();
$v['module_name'] = $module['name'];
unset($key, $val);
}
unset($k, $v);
$this->assign('module', $this->getModules());
$this->assign('list', $list);
$this->meta_title = L('_NAVIGATION_MANAGEMENT_');
$this->display();
}
}
示例8: navigation
public function navigation()
{
if (IS_POST) {
$one = $_POST['nav'][1];
if (count($one) > 0) {
D()->execute('TRUNCATE TABLE ' . C('DB_PREFIX') . 'mob_channel');
for ($i = 0; $i < count(reset($one)); $i++) {
$data[$i] = array('pid' => 0, 'title' => op_t($one['title'][$i]), 'url' => op_t($one['url'][$i]), 'sort' => intval($one['sort'][$i]), 'target' => intval($one['target'][$i]), 'color' => op_t($one['color'][$i]), 'band_text' => op_t($one['band_text'][$i]), 'band_color' => op_t($one['band_color'][$i]), 'icon' => op_t($one['icon'][$i]), 'status' => 1);
$pid[$i] = M('MobChannel')->add($data[$i]);
}
$two = $_POST['nav'][2];
for ($j = 0; $j < count(reset($two)); $j++) {
$data_two[$j] = array('pid' => $pid[$two['pid'][$j]], 'title' => op_t($two['title'][$j]), 'url' => op_t($two['url'][$j]), 'sort' => intval($two['sort'][$j]), 'target' => intval($two['target'][$j]), 'color' => op_t($two['color'][$j]), 'band_text' => op_t($two['band_text'][$j]), 'band_color' => op_t($two['band_color'][$j]), 'icon' => op_t($two['icon'][$j]), 'status' => 1);
$res[$j] = M('MobChannel')->add($data_two[$j]);
}
S('common_nav', null);
$this->success('修改成功');
}
$this->error('导航至少存在一个。');
} else {
/* 获取频道列表 */
$map = array('status' => array('gt', -1), 'pid' => 0);
$list = M('MobChannel')->where($map)->order('sort asc,id asc')->select();
foreach ($list as $k => &$v) {
$v['module_name'] = explode('/', $v['url']);
$v['module_name'] = $v['module_name'][1];
}
unset($k, $v);
// dump($list);exit;
$this->assign('module', $this->getMobModules());
$this->assign('list', $list);
$this->meta_title = '导航管理';
$this->display(T('Application://Mob@Mob/navigation'));
}
}
示例9: parse_weibo_mob_content
function parse_weibo_mob_content($content)
{
$content = shorten_white_space($content);
$content = op_t($content, false);
$content = parse_url_link($content);
$content = parseWeiboContent($content);
return $content;
}
示例10: parseComment
public function parseComment($content)
{
$content = shorten_white_space($content);
$content = op_t($content, false);
$content = parse_url_link($content);
$content = parse_expression($content);
// $content = parseWeiboContent($content);
return $content;
}
示例11: text_part
function text_part($aContent)
{
$arr = array();
preg_match_all("/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png]))[\\'|\"].*?[\\/]?>/", $aContent, $arr);
//匹配所有的图片
$data['image'] = $arr[1];
$data['content'] = op_t($aContent);
return $data;
}
示例12: parse_weibo_content
function parse_weibo_content($content)
{
$content = shorten_white_space($content);
$content = op_t($content, false);
$content = parse_url_link($content);
$content = parse_expression($content);
$content = parse_at_users($content);
$content = parseWeiboContent($content);
return $content;
}
示例13: category
public function category($category_id = 0)
{
$map['category'] = $category_id;
$map['status'] = 1;
$questionModel = new QuestionModel();
$hot_list = $questionModel->getList($map, '*', 5, 'answer_num desc');
foreach ($hot_list as &$val) {
$val['info'] = msubstr(op_t($val['description']), 0, 50);
}
unset($val);
$this->assign('hot_list', $hot_list);
$this->display(T('Application://Question@Widget/category'));
}
示例14: register
public function register($username = '', $nickname = '', $password = '', $repassword = '', $email = '', $verify = '', $type = 'start')
{
$type = op_t($type);
if (!C('USER_ALLOW_REGISTER')) {
$this->error('注册已关闭');
}
$verifyarr = explode(',', C('VERIFY_OPEN'));
if (in_array('1', $verifyarr)) {
$this->assign('isverify', 1);
} else {
$this->assign('isverify', 0);
}
if (IS_POST) {
//注册用户
/* 检测验证码 TODO: */
if (in_array('1', $verifyarr)) {
if (!$this->check_verify($verify)) {
$this->error('验证码输入错误!');
}
}
if ($password != $repassword) {
$this->error('两次密码输入不一致');
}
/* 调用注册接口注册用户 */
$User = new UserApi();
$uid = $User->register($username, $nickname, $password, $email);
if (0 < $uid) {
//注册成功
sendMessage($uid, 0, '注册成功', '恭喜您!您已经注册成功,请尽快<a href="' . U('Ucenter/yzmail') . '">验证邮箱地址</a>,第一时间获取网站动态!', 0);
$uid = $User->login($username, $password);
//通过账号密码取到uid
D('Member')->login($uid, false);
//登陆
asyn_sendmail($email, 2);
setuserscore($uid, C('REGSCORE'));
$this->success('注册成功并登陆!', cookie('referurl'));
} else {
//注册失败,显示错误信息
$this->error($this->showRegError($uid));
}
} else {
//显示注册表单
if (is_login()) {
redirect(cookie('referurl'));
}
if (cookie('referurl') == '') {
cookie('referurl', $_SERVER['HTTP_REFERER']);
}
$this->display();
}
}
示例15: index
public function index($type = 'forum', $page = 1)
{
$this->requireLogin();
$type = op_t($type);
$totalCount = 0;
$list = $this->_getList($type, $totalCount, $page);
$this->assign('totalCount', $totalCount);
$this->assign('list', $list);
//设置Tab
$this->defaultTabHash('collection');
$this->assign('type', $type);
$this->setTitle(L('_MY_FAVORITES_'));
$this->display($type);
}