• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getShort函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAll

 public function getAll()
 {
     $typeId = intval($_GET['typeId']);
     empty($typeId) && ($typeId = 2);
     $db_prefix = C('DB_PREFIX');
     if ($typeId == 2) {
         $follow = M('')->field('follow.fid AS fuid,user.uname AS funame')->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid")->where("follow.uid={$this->mid}")->order('follow.follow_id DESC')->findPage(15);
     } else {
         if ($typeId == 3) {
             $follow = M('')->field('follow.uid AS fuid,user.uname AS funame')->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.uid=user.uid")->where("follow.fid={$this->mid}")->order('follow.follow_id DESC')->findPage(15);
         } else {
             //目前没有好的方案高效的显示互粉的列表人.
             //默认显示互粉
             // $follow = M('')->field('follow.fid AS fuid,user.uname AS funame')
             // 			   ->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid")
             // 			   ->where("follow.uid={$this->mid} AND follow.fid IN (SELECT uid FROM {$db_prefix}user_follow WHERE fid={$this->mid})")
             // 			   ->order('follow.follow_id DESC')
             // 			   ->findPage(15);
             //$follow = M('User')->field('uid AS fuid,uname AS funame')->where("uid IN (SELECT uid FROM {$db_prefix}user_follow WHERE fid={$this->mid}) AND uid IN (SELECT fid FROM {$db_prefix}user_follow WHERE uid={$this->mid})")->findPage(15);
             //$follow = M('')->query("SELECT follow.fid AS fuid,user.uname AS funame FROM {$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid WHERE follow.uid={$this->mid} AND follow.type={$typeId}");
         }
     }
     foreach ($follow['data'] as $k => $v) {
         $out[$k]['fUid'] = $v['fuid'];
         $out[$k]['friendUserName'] = getShort($v['funame'], '3', '…');
         $out[$k]['friendHeadPic'] = getUserFace($v['fuid']);
     }
     exit(json_encode($out));
 }
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:29,代码来源:SelectFriendsAction.class.php


示例2: getEventShort

/**
 * getEventShort 
 * 去除标签,截取blog的长度
 * @param mixed $content 
 * @param mixed $length 
 * @access public
 * @return void
 */
function getEventShort($content, $length = 40)
{
    $content = stripslashes($content);
    $content = strip_tags($content);
    $content = getShort($content, $length);
    return $content;
}
开发者ID:lyhiving,项目名称:icampus,代码行数:15,代码来源:common.php


示例3: getPosterShort

/**
 * getPosterShort 
 * 去除标签,截取blog的长度
 * @param mixed $content 
 * @param mixed $length 
 * @access public
 * @return void
 */
function getPosterShort($content, $length = 60)
{
    $content = stripslashes($content);
    $content = strip_tags($content);
    $content = getShort($content, $length);
    return $content;
}
开发者ID:lyhiving,项目名称:icampus,代码行数:15,代码来源:common.php


示例4: __construct

 public function __construct($hex)
 {
     $this->flightGroupCount = getShort($hex, self::HEADER_FG);
     $this->messageCount = getShort($hex, self::HEADER_MSG);
     $this->briefingOfficers = getByte($hex, self::HEADER_BRIEF);
     $this->capturedOnEject = getBool($hex, self::HEADER_CAPTURED);
 }
开发者ID:pmoitech,项目名称:pyrite,代码行数:7,代码来源:Header.php


示例5: syncToFeed

 /**
  * 发帖同步到分享
  * @param integer post_id 帖子ID
  * @param string title 帖子标题
  * @param string content 帖子内容
  * @param integer uid 发布者uid
  * @return integer feed_id 分享ID
  */
 public function syncToFeed($post_id, $title, $content, $uid)
 {
     $d['content'] = '';
     $d['body'] = '【' . $title . '】' . getShort($content, 100) . ' ';
     $feed = model('Feed')->put($uid, 'weiba', 'weiba_post', $d, $post_id, 'weiba_post');
     return $feed['feed_id'];
 }
开发者ID:weiphpdev,项目名称:xindongfang,代码行数:15,代码来源:WeibaPostModel.class.php


示例6: getShortSp

function getShortSp($str, $num)
{
    if (utf8_strlen($str) > $num) {
        $tag = '...';
    }
    $str = getShort($str, $num) . $tag;
    return $str;
}
开发者ID:lyhiving,项目名称:icampus,代码行数:8,代码来源:common.php


示例7: syncToFeed

 public function syncToFeed($info_id, $title, $content, $uid)
 {
     $d['content'] = '';
     $d['body'] = getShort($content, 100) . '【' . $title . '】' . ' ' . U('cat/Index/info', array('info_id' => $info_id));
     $feed = M('Feed')->syncToFeed($d['body'], $uid, '0');
     // $feed = model('Feed')->put($uid, 'weiba', 'weiba_post', $d, $post_id, 'weiba_post');
     return $feed['feed_id'];
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:8,代码来源:InfoModel.class.php


示例8: IsHotList

function IsHotList()
{
    //读取推荐列表
    $votes = M('vote')->where(' isHot="1" ')->order('rTime DESC')->limit(20)->findAll();
    foreach ($votes as &$value) {
        $value['username'] = getUserName($value['uid']);
        $value['title'] = getShort($value['title'], 12 - strlen($value['username']) / 2);
    }
    return $votes;
}
开发者ID:lyhiving,项目名称:icampus,代码行数:10,代码来源:common.php


示例9: renderFile

 protected function renderFile($data)
 {
     $out = '<select name="' . $data['form_name'] . '" id="' . $data['form_id'] . '">';
     foreach ($data['data'] as $vo) {
         if ($vo['id'] == intval($data['selected'])) {
             $out .= '<option value="' . $vo['id'] . '" selected="selected">' . getShort($vo['name'], 13) . '</option>';
         } else {
             $out .= '<option value="' . $vo['id'] . '">' . getShort($vo['name'], 13) . '</option>';
         }
     }
     $out .= '</select>';
     return $out;
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:13,代码来源:AlbumSelectWidget.class.php


示例10: __construct

 function __construct($hex)
 {
     $this->time = getShort($hex, 0);
     $type = getShort($hex, 2);
     if (isset($this->EventTypes[$type])) {
         $this->type = $this->EventTypes[$type];
     } else {
         $this->type = array('Name' => 'Unknown' . $type, 'Variables' => array());
     }
     for ($i = 0; $i < count($this->type['Variables']); $i++) {
         $this->variables[] = getShort($hex, 2 + $i * 2);
     }
     $this->length = count($this->variables) * 2 + 4;
     //a short for each variable plus time and type;
 }
开发者ID:pmoitech,项目名称:pyrite,代码行数:15,代码来源:BriefingEvent.php


示例11: render

 /**
  * 选择好友Widget
  * 
  * $data的参数:
  * array(
  * 	'name'(可选)	=> '表单的name', // 默认为"fri_ids"
  * )
  * 
  * @see Widget::render()
  */
 public function render($data)
 {
     $follow_group_status = D('FollowGroup', 'weibo')->getGroupStatus($data['uid'], $data['fid']);
     foreach ($follow_group_status as $k => $v) {
         $v['title'] = (strlen($v['title']) + mb_strlen($v['title'], 'UTF8')) / 2 > 6 ? getShort($v['title'], 3) . '...' : $v['title'];
         $data['status'] .= $v['title'] . ',';
         if (!empty($follow_group_status[$k + 1]) && (strlen($data['status']) + mb_strlen($data['status'], 'UTF8')) / 2 >= 13) {
             $data['status'] .= '···,';
             break;
         }
     }
     $data['status'] = substr($data['status'], 0, -1);
     $content = $this->renderFile(ADDON_PATH . '/widgets/FollowGroup.html', $data);
     return $content;
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:25,代码来源:FollowGroupWidget.class.php


示例12: doAddChannel

 /**
  * 添加微博进入频道
  * @return json 操作后的相关信息数据
  */
 public function doAddChannel()
 {
     // 微博ID
     $feedId = intval($_POST['feedId']);
     // 判断资源是否删除
     $fmap['feed_id'] = $feedId;
     $fmap['is_del'] = 0;
     $isExist = model('Feed')->where($fmap)->count();
     if ($isExist == 0) {
         $return['status'] = 0;
         $return['info'] = '内容已被删除,推荐失败';
         exit(json_encode($return));
     }
     // 频道ID数组
     $channelIds = t($_POST['data']);
     $channelIds = explode(',', $channelIds);
     $channelIds = array_filter($channelIds);
     $channelIds = array_unique($channelIds);
     if (empty($feedId)) {
         $res['status'] = 0;
         $res['info'] = '推荐失败';
         exit(json_encode($res));
     }
     // 添加微博进入频道
     $result = D('Channel', 'channel')->setChannel($feedId, $channelIds);
     if ($result) {
         if (!empty($channelIds)) {
             $config['feed_content'] = getShort(D('feed_data')->where('feed_id=' . $feedId)->getField('feed_content'), 10);
             $map['channel_category_id'] = array('in', $channelIds);
             $config['channel_name'] = implode(',', getSubByKey(D('channel_category')->where($map)->field('title')->findAll(), 'title'));
             $uid = D('feed')->where('feed_id=' . $feedId)->getField('uid');
             $config['feed_url'] = '<a target="_blank" href="' . U('channel/Index/index', array('cid' => $channelIds[0])) . '">点此查看</a>';
             model('Notify')->sendNotify($uid, 'channel_add_feed', $config);
             //添加积分
             model('Credit')->setUserCredit($uid, 'recommend_to_channel');
         }
         if (empty($channelIds)) {
             //添加积分
             model('Credit')->setUserCredit($uid, 'unrecommend_to_channel');
         }
         $res['status'] = 1;
         $res['info'] = '推荐成功';
     } else {
         $res['status'] = 0;
         $res['info'] = '推荐失败';
     }
     exit(json_encode($res));
 }
开发者ID:naliduo,项目名称:ThinkSNS,代码行数:52,代码来源:ManageAction.class.php


示例13: setFollowGroup

 public function setFollowGroup()
 {
     $gid = intval($_REQUEST['gid']);
     $fid = intval($_REQUEST['fid']);
     $followGroupDao = D('FollowGroup');
     $followGroupDao->setGroupStatus($this->mid, $fid, $gid);
     $follow_group_status = $followGroupDao->getGroupStatus($this->mid, $fid);
     foreach ($follow_group_status as $k => $v) {
         $v['title'] = (strlen($v['title']) + mb_strlen($v['title'], 'UTF8')) / 2 > 6 ? getShort($v['title'], 3) . '...' : $v['title'];
         $_follow_group_status .= $v['title'] . ',';
         if (!empty($follow_group_status[$k + 1]) && (strlen($_follow_group_status) + mb_strlen($_follow_group_status, 'UTF8')) / 2 >= 13) {
             $_follow_group_status .= '···,';
             break;
         }
     }
     $_follow_group_status = substr($_follow_group_status, 0, -1);
     exit($_follow_group_status);
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:18,代码来源:FollowGroupAction.class.php


示例14: createNewData

 /**
  * 为新用户创建默认数据
  * @param integer $uid 用户UID
  * @return void
  */
 public function createNewData($uid = 0)
 {
     // 创建默认相册
     if (intval($uid) <= 0) {
         $uid = $GLOBALS['ts']['mid'];
     }
     $count = $this->where("userId='{$uid}' AND isDel=0")->count();
     if ($count == 0) {
         $name = getShort(getUserName($uid), 5) . '的相册';
         // 默认的相册名
         $album['cTime'] = time();
         $album['mTime'] = time();
         $album['userId'] = $uid;
         $album['name'] = $name;
         $album['privacy'] = 1;
         $this->add($album);
     }
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:23,代码来源:AlbumModel.class.php


示例15: _indexRight

 /**
  * 首页右侧数据查询
  */
 private function _indexRight()
 {
     $list = D('Category')->order('pid')->findAll();
     $catelist = array();
     foreach ($list as $v) {
         if ($v['pid'] && $catelist[$v['pid']]) {
             $catelist[$v['pid']]['child'][] = $v;
         } else {
             $catelist[$v['id']] = $v;
         }
     }
     $hotlist = D('Group', 'group')->getHotList();
     foreach ($hotlist as &$hv) {
         $hv['short_name'] = getShort($hv['name'], 10);
         $hv['logo'] = logo_path_to_url($hv['logo']);
     }
     $this->assign('hotlist', $hotlist);
     $this->assign('catelist', $catelist);
 }
开发者ID:yang7hua,项目名称:hunshe,代码行数:22,代码来源:IndexAction.class.php


示例16: commentVote

 public function commentVote()
 {
     $this->data['with_new_weibo'] = intval($this->data['with_new_weibo']);
     //$this->data['type']					= t($this->data['type']);
     $this->data['type'] = 'vote';
     $this->data['appid'] = intval($this->data['appid']);
     $this->data['comment'] = $this->data['comment'];
     $this->data['to_id'] = intval($this->data['to_id']);
     $this->data['author_uid'] = intval($this->data['author_uid']);
     $this->data['title'] = t(html_entity_decode($this->data['title'], ENT_QUOTES, 'UTF-8'));
     $this->data['url'] = urldecode($this->data['url']);
     $this->data['table'] = t($this->data['table']);
     $this->data['id_field'] = t($this->data['id_field']);
     $this->data['comment_count_field'] = t($this->data['comment_count_field']);
     $app_alias = getAppAlias($this->data['type']);
     // 被回复内容
     $former_comment = array();
     if ($this->data['to_id'] > 0) {
         $former_comment = M('comment')->where("`id`='{$this->data['to_id']}'")->find();
     }
     // 插入新数据
     $map['type'] = $this->data['type'];
     // 应用名
     $map['appid'] = $this->data['appid'];
     $map['appuid'] = $this->data['author_uid'];
     $map['uid'] = $this->mid;
     $map['comment'] = t(getShort($this->data['comment'], $GLOBALS['ts']['site']['length']));
     $map['cTime'] = time();
     $map['toId'] = $this->data['to_id'];
     $map['status'] = 0;
     // 0: 未读 1:已读
     $map['quietly'] = 0;
     $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $this->data['author_uid'];
     $map['data'] = serialize(array('title' => $this->data['title'], 'url' => $this->data['url'], 'table' => $this->data['table'], 'id_field' => $this->data['id_field'], 'comment_count_field' => $this->data['comment_count_field']));
     if (empty($map['type']) && empty($map['appid']) && empty($map['appuid']) && empty($map['comment'])) {
         return 0;
     }
     $res = M('comment')->add($map);
     return $res;
 }
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:40,代码来源:VoteApi.class.php


示例17: render

 /**
  * 渲染关注用户分组调整模板
  * @example
  * $data['uid'] integer 用户ID
  * $data['fid'] integer 关注用户ID
  * $data['follow_group_status'] array 指定关注用户的分组信息
  * @data['tpl'] string 模板字段
  * @param array $data 配置的相关信息
  * @return string 渲染后的模板数据
  */
 public function render($data)
 {
     // 选择模板
     $template = empty($data['tpl']) ? 'FollowGroup' : t($data['tpl']);
     // 关注用户分类信息
     $followGroupStatus = $data['follow_group_status'];
     // 组装数据
     foreach ($followGroupStatus as $key => $value) {
         $value['gid'] != 0 && ($value['title'] = (strlen($value['title']) + mb_strlen($value['title'], 'UTF8')) / 2 > 4 ? getShort($value['title'], 2) : $value['title']);
         $data['status'] .= $value['title'] . ',';
         if (!empty($followGroupStatus[$key + 1]) && (strlen($data['status']) + mb_strlen($data['status'], 'UTF8')) / 2 >= 6) {
             $data['status'] .= '...,';
             break;
         }
     }
     $data['status'] = substr($data['status'], 0, -1);
     $title = getSubByKey($followGroupStatus, 'title');
     // 用于存储原始数据
     $data['title'] = implode(',', $title);
     $content = $this->renderFile(dirname(__FILE__) . '/' . $template . '.html', $data);
     return $content;
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:32,代码来源:FollowGroupWidget.class.php


示例18: report_list

 function report_list()
 {
     $dao = D("Report");
     $data = $dao->order("cTime desc")->findPage(10);
     //dump($data["data"]);
     echo "<table>";
     echo "<tr>";
     echo "<td>举报人</td>";
     echo "<td>链接</td>";
     echo "<td>原因</td>";
     echo "<td>举报时间</td>";
     echo "</tr>";
     foreach ($data["data"] as $key => $v) {
         echo "<tr>";
         echo "<td>" . getUserName($v["uid"]) . "</td>";
         echo "<td><a href='" . $v["url"] . "'>" . getShort($v["info"], 30) . "</a></td>";
         echo "<td>" . $v["reason"] . "</td>";
         echo "<td>" . friendlyDate($v["cTime"]) . "</td>";
         echo "</tr>";
     }
     echo "</table>";
 }
开发者ID:wangping1987,项目名称:dhfriendluck,代码行数:22,代码来源:PublicAction.class.php


示例19: commentBlog

 public function commentBlog()
 {
     $map['type'] = $this->data['type'];
     // 应用名
     $map['type'] = 'blog';
     $map['appid'] = $this->data['appid'];
     //知识id
     $map['appuid'] = $this->data['author_uid'];
     //作者uid
     $map['uid'] = $this->mid;
     $map['comment'] = t(getShort($this->data['comment'], $GLOBALS['ts']['site']['length']));
     $map['cTime'] = time();
     //$map['toId']	= $this->data['to_id'];//废弃
     $map['status'] = 0;
     // 0: 未读 1:已读
     $map['quietly'] = 0;
     $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $this->data['author_uid'];
     $map['data'] = serialize(array('title' => $this->data['title'], 'url' => $this->data['url'], 'table' => $this->data['table'], 'id_field' => $this->data['id_field'], 'comment_count_field' => $this->data['comment_count_field']));
     if (empty($map['type']) || empty($map['comment']) || empty($map['appid']) || empty($map['appuid'])) {
         return 0;
     }
     $res = M('comment')->add($map);
     return $res;
 }
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:24,代码来源:BlogApi.class.php


示例20: addTopic

 function addTopic()
 {
     $this->need_login();
     if (IS_POST) {
         $title = getShort($_POST['title'], 30);
         if (empty($title)) {
             $this->ajaxReturn(false, '标题不能为空', false);
         }
         $this->__checkContent($_POST['content'], 10, 5000);
         $topic['gid'] = $this->gid;
         $topic['uid'] = $this->mid;
         $topic['name'] = getUserName($this->mid);
         $topic['title'] = h(t($title));
         $topic['cid'] = intval($_POST['cid']);
         $topic['addtime'] = time();
         $topic['replytime'] = time();
         $topic['image_ids'] = implode(',', array_filter(explode('|', $_POST['image_ids'])));
         $tid = D('Topic', 'group')->add($topic);
         if ($tid) {
             $post['gid'] = $this->gid;
             $post['uid'] = $this->mid;
             $post['tid'] = $tid;
             $post['content'] = h($_POST['content']);
             $post['istopic'] = 1;
             $post['ctime'] = time();
             $post['ip'] = get_client_ip();
             $post['image_ids'] = $topic['image_ids'];
             $post_id = $this->post->add($post);
             D('GroupFeed', 'group')->syncToFeed('我发布了一个微吧帖子“' . t($_POST['title']) . '”,详情请点击' . U('group/Topic/topic', array('tid' => $tid, 'gid' => $this->gid)), $this->mid, 0, 0, $this->gid);
             $res['tid'] = $tid;
             $res['gid'] = $this->gid;
             return $this->ajaxReturn($res, '发布成功', 1);
         } else {
             $this->ajaxReturn(false, '发帖失败', false);
         }
     } else {
         $category_list = $this->topic->categoryList($this->gid);
         $this->assign('category_list', $category_list);
         $this->display();
     }
 }
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:41,代码来源:GroupAction.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getShortString函数代码示例发布时间:2022-05-15
下一篇:
PHP getShopBasePath函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap