本文整理汇总了PHP中getShort函数的典型用法代码示例。如果您正苦于以下问题:PHP getShort函数的具体用法?PHP getShort怎么用?PHP getShort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getShort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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;
}
示例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;
}
示例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);
}
示例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'];
}
示例6: getShortSp
function getShortSp($str, $num)
{
if (utf8_strlen($str) > $num) {
$tag = '...';
}
$str = getShort($str, $num) . $tag;
return $str;
}
示例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'];
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
}
示例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);
}