本文整理匯總了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;
}
示例2: delete
function delete()
{
if (D('Operate')->deleteMini(intval($_POST['id']), $this->mid)) {
X('Credit')->setUserCredit($this->mid, 'delete_weibo');
echo '1';
}
}
示例3: U
static function U(E $c) : array
{
if (N($c) === 1) {
return [];
}
return X('Y', $c);
}
示例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> <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';
}
}
示例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']);
}
示例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');
}
}
示例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';
}
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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']}”已存在");
}
}
}
示例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';
//不能關注自己
}
}