当前位置: 首页>>代码示例>>PHP>>正文


PHP X函数代码示例

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


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

示例1: createEvent

 public function createEvent()
 {
     $map['title'] = t($this->data['title']);
     $map['address'] = t($this->data['address']);
     $map['limitCount'] = intval(t($this->data['limitCount']));
     $map['type'] = intval($this->data['type']);
     $map['explain'] = h($this->data['explain']);
     $map['contact'] = t($this->data['contact']);
     $map['deadline'] = $this->_paramDate($this->data['deadline']);
     $map['sTime'] = $this->_paramDate($this->data['sTime']);
     $map['eTime'] = $this->_paramDate($this->data['eTime']);
     $map['uid'] = $this->mid;
     if (!$map['title'] || !$map['address'] || !$map['type'] || !$map['deadline'] || !$map['sTime'] || !$map['eTime']) {
         return -1;
         exit;
     }
     //处理省份,市,区
     list($opts['province'], $opts['city'], $opts['area']) = explode(" ", $this->data['city']);
     //得到上传的图片
     $config = $this->getConfig();
     $options['userId'] = $this->mid;
     $options['max_size'] = $config['photo_max_size'];
     $options['allow_exts'] = $config['photo_file_ext'];
     $cover = X('Xattach')->upload('event', $options);
     //处理选项
     $opts['cost'] = intval($this->data['cost']);
     $opts['costExplain'] = t($this->data['costExplain']);
     $friend = isset($this->data['friend']) ? 1 : 0;
     $allow = isset($this->data['allow']) ? 1 : 0;
     $opts['opts'] = array('friend' => $friend, 'allow' => $allow);
     $result = D('Event', 'event')->doAddEvent($map, $opts, $cover);
     return (int) $result;
 }
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:33,代码来源:EventApi.class.php

示例2: delete

 function delete()
 {
     if (D('Operate')->deleteMini(intval($_POST['id']), $this->mid)) {
         X('Credit')->setUserCredit($this->mid, 'delete_weibo');
         echo '1';
     }
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:7,代码来源:OperateAction.class.php

示例3: U

 static function U(E $c) : array
 {
     if (N($c) === 1) {
         return [];
     }
     return X('Y', $c);
 }
开发者ID:exakat,项目名称:exakat,代码行数:7,代码来源:_Function.59.php

示例4: doaddcomment

 function doaddcomment($uid, $post, $api = false)
 {
     $data['uid'] = $uid;
     $data['reply_comment_id'] = intval($post['reply_comment_id']);
     $data['weibo_id'] = intval($post['weibo_id']);
     $data['content'] = $post['content'];
     $data['ctime'] = time();
     $miniInfo = D('Weibo')->where('weibo_id=' . $data['weibo_id'])->find();
     if ($data['reply_comment_id']) {
         $replyInfo = $this->where('comment_id=' . $data['reply_comment_id'])->find();
         $data['reply_uid'] = $replyInfo['uid'];
     } else {
         $data['reply_uid'] = $miniInfo['uid'];
         $notify['reply_type'] = 'weibo';
     }
     if ($comment_id = $this->addcomment($data)) {
         //微博回复积分操作
         if ($data['uid'] != $data['reply_uid']) {
             X('Credit')->setUserCredit($data['uid'], 'reply_weibo')->setUserCredit($data['reply_uid'], 'replied_weibo');
         }
         $data['comment'] = $miniInfo['comment'] + 1;
         $return['data'] = $data;
         $return['html'] = '<div class="position_list" id="comment_list_c_' . $comment_id . '"> <a href="' . U('home/space/index', array('uid' => $this->mid)) . '" class="pic">
         		<img class="pic30" src="' . getUserFace($uid, 's') . '" /></a>
                   <p class="list_c"><a href="#">' . getUserName($uid) . '</a> ' . getUserGroupIcon($uid) . ' : ' . formatComment($data['content'], true) . ' (刚刚)</p>
                   <div class="alR clear"><a href="javascript:void(0)" onclick="ui.confirm(this,\'确认要删除此评论?\')" callback="delComment(' . $comment_id . ')">删除</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="reply(\'' . getUserName($uid) . '\',' . $data['weibo_id'] . ')">回复</a></div>
                 </div>';
         if ($post['transpond'] != 0) {
             if ($miniInfo['transpond_id'] != 0) {
                 $transpondData['content'] = $data['content'] . " //@" . getUserName($miniInfo['uid']) . ":" . $miniInfo['content'];
                 $transpondData['transpond_id'] = $miniInfo['transpond_id'];
                 $transpondInfo = M('weibo')->where('weibo_id=' . $miniInfo['transpond_id'])->find();
                 $transpondData['transpond_uid'] = $transpondInfo['uid'];
             } else {
                 $transpondData['content'] = $data['content'];
                 $transpondData['transpond_id'] = $miniInfo['weibo_id'];
                 $transpondData['transpond_uid'] = $miniInfo['uid'];
             }
             $id = D('Weibo', 'weibo')->doSaveWeibo($uid, $transpondData, $post['from']);
             if ($id) {
                 //当转发的微博uid 与 回复人的uid不一致时发布@到我
                 if ($transpondData['transpond_uid'] != $data['reply_uid']) {
                     D('Weibo', 'weibo')->notifyToAtme($id, $transpondData['content'], $transpondData['transpond_uid']);
                 } else {
                     D('Weibo', 'weibo')->notifyToAtme($id, $transpondData['content'], $transpondData['transpond_uid'], false);
                 }
             }
         }
         //添加统计
         Model('UserCount')->addCount($data['reply_uid'], 'comment');
         if ($api) {
             return true;
         } else {
             return json_encode($return);
         }
     } else {
         return '0';
     }
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:59,代码来源:CommentModel.class.php

示例5: init

 /**
  * 加载phpmailer, 初始化默认参数
  */
 public function init()
 {
     include_once SITE_PATH . '/addons/libs/phpmailer/class.phpmailer.php';
     include_once SITE_PATH . '/addons/libs/phpmailer/class.pop3.php';
     include_once SITE_PATH . '/addons/libs/phpmailer/class.smtp.php';
     $emailset = X('Xdata')->lget('email');
     $this->option = array('email_sendtype' => $emailset['email_sendtype'], 'email_host' => $emailset['email_host'], 'email_port' => $emailset['email_port'], 'email_ssl' => $emailset['email_ssl'], 'email_account' => $emailset['email_account'], 'email_password' => $emailset['email_password'], 'email_sender_name' => $emailset['email_sender_name'], 'email_sender_email' => $emailset['email_sender_email'], 'email_reply_account' => $emailset['email_sender_email']);
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:11,代码来源:MailService.class.php

示例6: home_space_middle

 public function home_space_middle($param)
 {
     $uid = $param['uid'];
     if ($this->mid > 0 && $uid != $this->mid) {
         // 记录访问时间
         M()->execute("replace into " . C('DB_PREFIX') . "user_visited (`uid`,`fid`,`ctime`) VALUES ('" . $this->mid . "','" . $uid . "'," . time() . ")");
         // 空间被访问积分
         X('Credit')->setUserCredit($uid, 'space_visited');
     }
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:10,代码来源:VisitorAddons.class.php

示例7: doPostWeibo

 public function doPostWeibo()
 {
     $data['content'] = $_POST['content'];
     $_POST['type'] && ($type = intval($_POST['type']));
     $_POST['typedata'] && ($type_data = $_POST['typedata']);
     $id = D('Weibo', 'weibo')->publish($this->mid, $data, $this->__type_website, $type, $type_data);
     if ($id) {
         X('Credit')->setUserCredit($this->mid, 'share_to_weibo');
         echo '1';
     } else {
         echo '0';
     }
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:13,代码来源:WidgetAction.class.php

示例8: index

 function index()
 {
     $strType = h($_GET['type']);
     $data['list'] = D('Operate', 'weibo')->getSpaceList($this->uid, $strType);
     $data['user'] = M('User')->where('uid=' . $this->uid)->find();
     $data['type'] = $strType;
     //被浏览积分
     if ($this->uid != $this->mid) {
         X('Credit')->setUserCredit($this->uid, 'space_visited');
     }
     $this->assign($data);
     $this->display();
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:13,代码来源:SpaceAction.class.php

示例9: render

 public function render($data)
 {
     //默认参数
     $var['callback'] = 'attach_upload_success';
     $var['l_button'] = '浏 览';
     $var['l_loading'] = '正在上传...';
     $var['l_succes'] = '上传完成.';
     //上传类型,默认为附件
     if (!isset($data['type'])) {
         $var['type'] = 'attach';
     } else {
         $var['type'] = $data['type'];
     }
     //上传个数限制.默认10个
     if (!isset($data['limit'])) {
         $var['limit'] = 10;
     } else {
         $var['limit'] = $data['limit'];
     }
     //获取后台配置,设置的大小不能大于后台配置的上传大小,也不能大于系统支持的大小
     if (!isset($data['allow_size']) || empty($data['allow_size'])) {
         $attachopt = model('Xdata')->get('admin_Config:attach');
         $attachopt['allow_size'] = $attachopt['attach_max_size'] <= ini_get("upload_max_filesize") ? $attachopt['attach_max_size'] : intval(ini_get("upload_max_filesize"));
     }
     $data['allow_size'] = isset($data['allow_size']) && $data['allow_size'] <= $attachopt['allow_size'] ? $data['allow_size'] . "MB" : $attachopt['allow_size'] . 'MB';
     //获取后台配置,设置的类型必须是后台配置的类型中的
     if (!isset($data['allow_exts']) || empty($data['allow_exts'])) {
         $data['allow_exts'] = $attachopt['attach_allow_extension'];
     }
     //编辑时.带入已有附件的参数 以逗号分割的附件IDs或数组
     $aids = $data['edit'];
     if (is_array($aids)) {
         $var['editdata'] = X('Xattach')->getAttach($aids);
     }
     //合并参数
     !isset($data['end']) && ($data['end'] = '');
     //模版赋值
     $var = array_merge($var, $data);
     $var['rand'] = self::$rand;
     if ($data['tpl'] == 'flash') {
         //渲染模版
         $content = $this->renderFile(dirname(__FILE__) . "/FlashUploadAttach.html", $var);
     } else {
         //渲染模版
         $content = $this->renderFile(dirname(__FILE__) . "/UploadAttach.html", $var);
     }
     self::$rand++;
     unset($var, $data);
     //输出数据
     return $content;
 }
开发者ID:yang7hua,项目名称:hunshe,代码行数:51,代码来源:UploadAttachWidget.class.php

示例10: notify

 public function notify()
 {
     $list = X('Notify')->get('receive=' . $this->mid, 10);
     // 解析表情
     foreach ($list['data'] as $k => $v) {
         $list['data'][$k]['title'] = preg_replace_callback("/\\[(.+?)\\]/is", replaceEmot, $v['title']);
         $list['data'][$k]['body'] = preg_replace_callback("/\\[(.+?)\\]/is", replaceEmot, $v['body']);
         $list['data'][$k]['other'] = preg_replace_callback("/\\[(.+?)\\]/is", replaceEmot, $v['other']);
     }
     $this->assign('userCount', X('Notify')->getCount($this->mid));
     $this->assign($list);
     $this->setTitle(L('notifications'));
     $this->display();
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:14,代码来源:_MessageAction.class.php

示例11: remove

 function remove($id)
 {
     $id = is_array($id) ? '(' . implode(',', $id) . ')' : '(' . $id . ')';
     //判读是不是数组回收
     $uids = D('Post')->field('uid')->where('id IN' . $id)->findAll();
     $res = D('Post')->setField('is_del', 1, 'id IN' . $id);
     //回复
     if ($res) {
         // 积分
         foreach ($uids as $vo) {
             X('Credit')->setUserCredit($vo['uid'], 'group_reply_topic', -1);
         }
     }
     return $res;
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:15,代码来源:PostModel.class.php

示例12: create

 public function create()
 {
     $from = isset($_GET['from']) ? t($_GET['from']) : '';
     if ($_POST['sendsubmit']) {
         $toUserIds = explode(",", $_POST["fri_ids"]);
         if (!$_POST["fri_ids"]) {
             $this->error('请选择您的好友!');
             exit;
         }
         foreach ($toUserIds as $k => $v) {
             if (!$v) {
                 continue;
             }
             if (D('Member')->where("gid={$this->gid} AND uid={$v}")->count() > 0) {
                 unset($toUserIds[$k]);
                 continue;
             }
             if ($this->isadmin) {
                 $invite_verify_data['gid'] = $this->gid;
                 $invite_verify_data['uid'] = $v;
                 M('group_invite_verify')->add($invite_verify_data);
             }
         }
         $message_data['title'] = "邀您加入圈子 {$this->groupinfo['name']}";
         $url = '<a href="' . U('group/Group/index', array('gid' => $this->gid)) . '" target="_blank">去看看</a>';
         $message_data['content'] = "你好,诚邀您加入“{$this->groupinfo['name']}” 圈子,点击   " . $url . '进入。';
         foreach ($toUserIds as $t_u_k => $t_u_v) {
             $message_data['to'] = $t_u_v;
             $res = model('Message')->postMessage($message_data, $this->mid);
             if (!$res) {
                 unset($toUserIds[$t_u_k]);
             }
         }
         if (count($toUserIds) > 0) {
             $this->assign('成功发送' + count($toUserIds) + '份邀请');
             X('Credit')->setUserCredit($this->mid, 'invite_friend');
             $this->display('success');
             //echo count($toUserIds);
         } else {
             $this->assign('jumpUrl', U('group/Invite/create', array('gid' => $this->gid)));
             $this->error('邀请失败,您的好友可能已经加入了该圈子!');
             //echo -1;
         }
         exit;
     }
     $this->assign('from', $from);
     $this->display();
 }
开发者ID:yang7hua,项目名称:hunshe,代码行数:48,代码来源:InviteAction.class.php

示例13: index

 /**
  * basic 
  * 基础设置管理
  * @access public
  * @return void
  */
 public function index()
 {
     if (isset($_POST['editSubmit']) == 'do') {
         array_map('h', $_POST);
         $res = model('Xdata')->lput('group', $_POST);
         if ($res) {
             $this->success('保存成功');
         } else {
             $this->error('保存失败');
         }
     }
     //model('Xdata')->lput('group', $this->GroupSetting->getGroupSetting());
     $setting = model('Xdata')->lget('group');
     $this->assign('credit_types', X('Credit')->getCreditType());
     $this->assign('setting', $setting);
     $this->display();
 }
开发者ID:yang7hua,项目名称:hunshe,代码行数:23,代码来源:AdminAction.class.php

示例14: doEditTopics

 public function doEditTopics()
 {
     $data['topic_id'] = D('Topic', 'weibo')->getTopicId($_POST['name']);
     if ($data['topic_id'] <= 0) {
         $this->error('话题错误');
     }
     $options['allow_exts'] = 'jpg,jpeg,png,gif';
     if (!$_POST['nopic']) {
         $info = X('Xattach')->upload('topics', $options);
         if ($info['status']) {
             $data['pic'] = $info['info'][0]['savepath'] . $info['info'][0]['savename'];
         }
     } else {
         $data['pic'] = '';
     }
     $data['domain'] = $_POST['domain'] ? h(t($_POST['domain'])) : md5($_POST['name']);
     //$data['domain'] = h(t($_POST['domain']));
     $data['note'] = h(t($_POST['note']));
     $data['content'] = h(t($_POST['content']));
     $data['link'] = h(t($_POST['link']));
     $data['recommend'] = (string) intval($_POST['recommend']);
     $data['ctime'] = time();
     if (intval($_POST['topics_id'])) {
         $data['topics_id'] = intval($_POST['topics_id']);
         $res = D('Topics', 'weibo')->save($data);
         if (false !== $res) {
             $this->assign('jumpUrl', U('weibo/Admin/topics'));
             $this->success('Lưu lại thành công');
         } else {
             $this->error('Có lỗi phát sinh khi lưu');
         }
     } else {
         if (!D('Topics', 'weibo')->getField('topics_id', "topic_id='{$data['topic_id']}' AND isdel=0")) {
             $res = D('Topics', 'weibo')->add($data);
             if (false !== $res) {
                 $this->success('添加成功');
             } else {
                 $this->error('添加失败');
             }
         } else {
             $this->error("专题“{$data['name']}”已存在");
         }
     }
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:44,代码来源:AdminAction.class.php

示例15: dofollow

 function dofollow($mid, $fid, $type = 0)
 {
     if ($mid <= 0 || $fid <= 0) {
         return;
     }
     $privacy = D('UserPrivacy', 'home')->getPrivacy($mid, $fid);
     if (!$privacy['follow']) {
         return '00';
     }
     if ($mid != $fid) {
         $map['uid'] = $mid;
         $map['fid'] = $fid;
         $map['type'] = $type;
         if (0 == $this->where($map)->count()) {
             $this->add($map);
             unset($map);
             //关注记录 - 漫游使用
             if ($type == 0) {
                 $map['uid'] = $mid;
                 $map['fuid'] = $fid;
                 $map['action'] = 'add';
                 $map['dateline'] = time();
                 M('myop_friendlog')->add($map);
                 // 通知和动态
                 X('Notify')->send($fid, 'weibo_follow', '', $mid);
                 X('Feed')->put('weibo_follow', array('fid' => $fid), $mid);
             }
             if (0 == $this->where("uid={$fid} AND fid={$mid} AND type={$type}")->count()) {
                 return '12';
                 //我已关注
             } else {
                 return '13';
                 //双方已关注
             }
         } else {
             return '11';
             //已关注过
         }
     } else {
         return '10';
         //不能关注自己
     }
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:43,代码来源:FollowModel.class.php


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