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


PHP Addons::hook方法代码示例

本文整理汇总了PHP中Addons::hook方法的典型用法代码示例。如果您正苦于以下问题:PHP Addons::hook方法的具体用法?PHP Addons::hook怎么用?PHP Addons::hook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Addons的用法示例。


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

示例1: __construct

 /**
  * 架构函数
  * @param boolean $location 是否本机调用,本机调用不需要认证
  * @return void
  */
 public function __construct($location = false)
 {
     //$this->mid = $_SESSION['mid'];
     //外部接口调用
     if ($location == false && !defined('DEBUG')) {
         $this->verifyUser();
         //本机调用
     } else {
         $this->mid = @intval($_SESSION['mid']);
     }
     $GLOBALS['ts']['mid'] = $this->mid;
     //默认参数处理
     $this->since_id = isset($_REQUEST['since_id']) ? intval($_REQUEST['since_id']) : '';
     $this->max_id = isset($_REQUEST['max_id']) ? intval($_REQUEST['max_id']) : '';
     $this->page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
     $this->count = isset($_REQUEST['count']) ? intval($_REQUEST['count']) : 20;
     $this->user_id = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0;
     $this->user_name = isset($_REQUEST['user_name']) ? h($_REQUEST['user_name']) : '';
     $this->uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0;
     $this->uname = isset($_REQUEST['uname']) ? h($_REQUEST['uname']) : '';
     $this->id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
     $this->data = $_REQUEST;
     // findPage
     $_REQUEST[C('VAR_PAGE')] = $this->page;
     //接口初始化钩子
     Addons::hook('core_filter_init_api');
     //控制器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
 }
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:36,代码来源:Api.class.php

示例2: __construct

 /**
  * 架构函数,处理核心变量
  * 使用字符串返回 不能有任何输出
  */
 public function __construct()
 {
     //当前登录者uid
     $GLOBALS['ts']['mid'] = $this->mid = intval($_SESSION['mid']);
     //当前访问对象的uid
     $GLOBALS['ts']['uid'] = $this->uid = intval($_REQUEST['uid'] == 0 ? $this->mid : $_REQUEST['uid']);
     // 赋值当前访问者用户
     $GLOBALS['ts']['user'] = $this->user = model('User')->getUserInfo($this->mid);
     if ($this->mid != $this->uid) {
         $GLOBALS['ts']['_user'] = model('User')->getUserInfo($this->uid);
     } else {
         $GLOBALS['ts']['_user'] = $GLOBALS['ts']['user'];
     }
     //当前用户的所有已添加的应用
     $GLOBALS['ts']['_userApp'] = $userApp = model('UserApp')->getUserApp($this->uid);
     //当前用户的统计数据
     $GLOBALS['ts']['_userData'] = $userData = model('UserData')->getUserData($this->uid);
     $this->site = D('Xdata')->get('admin_Config:site');
     $this->site['logo'] = getSiteLogo($this->site['site_logo']);
     $GLOBALS['ts']['site'] = $this->site;
     //语言包判断
     if (TRUE_APPNAME != 'public' && APP_NAME != TRUE_APPNAME) {
         addLang(TRUE_APPNAME);
     }
     Addons::hook('core_filter_init_widget');
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:30,代码来源:Widget.class.php

示例3: home_account_page

 public function home_account_page($param)
 {
     if ($param['extend'] == 'bind') {
         $bindData = array();
         Addons::hook('account_bind_after', array('bindInfo' => &$bindData));
         $this->assign('bind', $bindData);
         $param['data'] = $this->fetch('account_bind');
     }
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:9,代码来源:LoginHooks.class.php

示例4: profile

 public function profile()
 {
     $pUserProfile = D('UserProfile');
     $pUserProfile->uid = $this->uid;
     $data['userInfo'] = $pUserProfile->getUserInfo(true);
     // 个人情况-钩子
     Addons::hook('home_space_profile_intro', array('uid' => $this->uid, 'intro' => &$data['userInfo']['intro']['list']));
     // 联系方式-钩子
     Addons::hook('home_space_profile_contact', array('uid' => $this->uid, 'contact' => &$data['userInfo']['contact']['list']));
     $this->assign($data);
     $this->setTitle('Thông tin chi tiết của ' . getUserName($this->uid));
     $this->display();
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:13,代码来源:SpaceAction.class.php

示例5: bind

 function bind()
 {
     $user = M('user')->where('uid=' . $this->mid)->field('email')->find();
     $replace = substr($user['email'], 2, -3);
     for ($i = 1; $i <= strlen($replace); $i++) {
         $replacestring .= '*';
     }
     $data['email'] = str_replace($replace, $replacestring, $user['email']);
     $bindData = array();
     Addons::hook('account_bind_after', array('bindInfo' => &$bindData));
     $data['bind'] = $bindData;
     $this->assign($data);
     $this->setTitle(L('setting') . ' - ' . L('outer_bind'));
     $this->display();
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:15,代码来源:AccountAction.class.php

示例6: getUserSpace

function getUserSpace($uid, $class, $target, $text, $icon = true)
{
    static $_userinfo = array();
    if (!isset($_userinfo[$uid])) {
        $_userinfo[$uid] = D('User', 'home')->getUserByIdentifier($uid, 'uid');
    }
    $target = $target ? $target : '_self';
    $text = $text ? $text : $_userinfo[$uid]['uname'];
    preg_match('|{(.*?)}|isU', $text, $t);
    if ($t) {
        if ($t['1'] == 'uname') {
            $text = str_replace("{uname}", $_userinfo[$uid]['uname'], $text);
            $class = $class ? $class : 'username';
        } else {
            $face = preg_replace("/{uavatar}|{uavatar\\=(.*?)}/e", "getUserFace(\$uid, '\\1')", $text);
            $text = "<img src=" . $face . ">";
            $class = $class ? $class : 'userface';
            $icon = false;
        }
    }
    if ($icon) {
        $user_name_end = null;
        Addons::hook('user_name_end', array('uid' => $uid, 'html' => &$user_name_end));
    }
    if ($_userinfo[$uid]['domain']) {
        $url = U('home/Space/index', array('uid' => $_userinfo[$uid]['domain']));
    } else {
        $url = U('home/Space/index', array('uid' => $uid));
    }
    $user_space_info = "<a href='{$url}' class='{$class}' target='{$target}'>{$text}" . $user_name_end . "</a>";
    Addons::hook('get_user_space_output', array('uid' => $uid, 'space_info' => &$user_space_info));
    return $user_space_info;
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:33,代码来源:extend.php

示例7: __getWeiboList

 private function __getWeiboList($install_app, $type)
 {
     global $ts;
     // 关注的分组列表
     $myFollowData = $this->__paramUserFollowGroup($type);
     $data = $myFollowData;
     $data['indexType'] = $indexType = intval($_GET['type']);
     $temp = $ts['my_group_list'];
     $group_list = array();
     foreach ($temp as $value) {
         if ($value['openWeibo']) {
             $group_list[] = $value;
         }
     }
     $data['group_list'] = $group_list;
     $data['gid'] = intval($_GET['gid']);
     $data['hasGroupWeibo'] = $this->__hasGroupWeibo($group_list);
     if ($indexType == self::INDEX_TYPE_WEIBO) {
         $data['weibo_menu'] = array('' => L('all'), 'original' => L('original'));
         Addons::hook('home_index_weibo_tab', array(&$data['weibo_menu']));
     }
     switch ($indexType) {
         case self::INDEX_TYPE_WEIBO:
             $data['list'] = D('Operate', 'weibo')->getHomeList($this->mid, $type, '', '', $data['follow_gid']);
             break;
         case self::INDEX_TYPE_GROUP:
             $data['list'] = D('WeiboOperate', 'group')->getHomeList($this->mid, $data['gid'], '', '');
             break;
         case self::INDEX_TYPE_ALL:
             $order = 'weibo_id DESC';
             $data['list'] = D('Operate', 'weibo')->doSearchTopic("", $order, $this->mid);
             break;
         default:
             $data['list'] = D('Operate', 'weibo')->getHomeList($this->mid, $type, '', '', $data['follow_gid']);
     }
     if ($data['list']['data']) {
         // 最新一条微博的Id (countNew时使用)
         $data['lastId'] = $data['list']['data'][0]['weibo_id'];
         $_since_weibo = end($data['list']['data']);
         $data['sinceId'] = $_since_weibo['weibo_id'];
     }
     return $data;
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:43,代码来源:UserAction.class.php

示例8: U

            <input type="password" name="login_password" class="text" style=" position:absolute; z-index:100;" onfocus="$('.login_password').hide()" onblur="if(this.value=='') $('.login_password').show()" value=""/>
          </div>
          <div class="mb20"><a class="act-but submit" href="javascript:;" onclick="$('#ajax_login_form').submit();" >登录</a></div>
          <div class="clearfix mb20"> <a class="login-rm" event-node="login_remember" href="javascript:;"> <span class="check-ok">
            <input type="hidden" name="login_remember" value="0" id="check-box" class="checkbox"/>
            <!-- JS选择记住密码时要JS将login_remember值变为1 --></span>记住用户名</a> <a href="<?php 
echo U('public/Passport/findPassword');
?>
" class="login-fgetpwd">忘记密码?</a></div>
          <?php 
if (Addons::requireHooks('login_input_footer') && Addons::hook('login_input_footer')) {
    ?>
              <div class="login-ft">
                  <div class="login-ft-head">使用第三方账号登录</div>
                  <?php 
    echo Addons::hook('login_input_footer');
    ?>
              </div>
         	<?php 
}
?>
          <div class="hasno-account">
            <p>还没有帐号?</p>
            <div class="other-but"> <a  onclick="javascript:window.open('<?php 
echo U('public/Register');
?>
','_self')" class="white-but fl"><i class="arow-left"></i>去注册</a> <a href="<?php 
echo U('public/Index/index');
?>
" class="white-but fr">先看看<i class="arow-right"></i></a> </div>
          </div>
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:31,代码来源:public_986338868d793c13.php

示例9: render

 public function render($data)
 {
     if (empty($data['feed_id']) || empty($data['feed_uid'])) {
         return '';
     }
     // 获取分享ID
     $feedId = intval($data['feed_id']);
     // 获取分享发布者UID
     $feedUid = intval($data['feed_uid']);
     // 管理员删除分享权限
     $adminfeeddel = CheckPermission('core_admin', 'feed_del');
     // 推荐到频道权限
     $feed = model('Feed')->get($data['feed_id']);
     if ($feed['is_repost'] == 1) {
         $adminchannelrecom = false;
     } else {
         $adminchannelrecom = CheckPermission('channel_admin', 'channel_recommend');
     }
     // 推荐到事务权限
     $admintaskrecom = CheckPermission('vtask_admin', 'vtask_recommend');
     // 插件显示 - 个人空间分享置顶权限
     Addons::hook('check_feed_manage', array('feed_id' => $data['feed_id'], 'uid' => $data['feed_uid'], 'plugin_list' => &$pluginList));
     $checkShowBtn = array();
     $checkShowBtn[] = $adminfeeddel;
     $checkShowBtn[] = $adminchannelrecom;
     $checkShowBtn[] = $admintaskrecom;
     !empty($pluginList) && ($checkShowBtn = array_merge($checkShowBtn, getSubByKey($pluginList, 'status')));
     // 判断是否显示管理权限
     $showBtn = true;
     if (!in_array(true, $checkShowBtn)) {
         $showBtn = false;
     }
     if (!$showBtn) {
         return '';
     }
     // 管理参数组合
     $args = array();
     $args['feed_id'] = $feedId;
     $args['uid'] = $feedUid;
     $args['is_recommend'] = $data['is_recommend'];
     $args['feed_del'] = $adminfeeddel;
     $args['feed_recommend'] = CheckPermission('core_admin', 'feed_recommend');
     $args['channel_recommend'] = $adminchannelrecom;
     $args['vtask_recommend'] = $admintaskrecom;
     foreach ($pluginList as $value) {
         $args[$value['plugin']] = $value['status'];
     }
     isset($data['channel_id']) && ($args['channel_id'] = intval($data['channel_id']));
     isset($data['clear']) && ($args['clear'] = intval($data['clear']));
     isset($data['isrefresh']) && ($args['isrefresh'] = intval($data['isrefresh']));
     $var['feed_id'] = $feedId;
     // 获取列表页面HTML
     $var['listHtml'] = $this->renderFile(dirname(__FILE__) . '/list.html', $args);
     $tmp = array();
     foreach ($args as $key => $val) {
         $tmp[] = $key . '=' . intval($val);
     }
     $eventArgs = implode('&', $tmp);
     $var['eventArgs'] = $eventArgs;
     $manageClass = isset($data['manage_class']) ? $data['manage_class'] : 'right hover dp-cs';
     $var['manageClass'] = $manageClass;
     $content = $this->renderFile(dirname(__FILE__) . '/manage.html', $var);
     return $content;
 }
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:64,代码来源:FeedManageWidget.class.php

示例10: success

 /**
  * 操作成功跳转的快捷方
  * @param  string  $message 提示信息
  * @param  Boolean $ajax    是否为Ajax方
  * @return voi
  */
 protected function success($message = '', $ajax = false)
 {
     Addons::hook('core_filter_success_message', $message);
     $this->_dispatch_jump($message, 1, $ajax);
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:11,代码来源:Action.class.php

示例11: doaddcomment

 public 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'] = t(getShort($post['content'], $GLOBALS['ts']['site']['length']));
     $data['ctime'] = time();
     $miniInfo = D('Weibo', 'weibo')->where('weibo_id=' . $data['weibo_id'] . ' AND isdel=0')->find();
     if ($data['reply_comment_id']) {
         $replyInfo = $this->where('comment_id=' . $data['reply_comment_id'] . ' AND isdel=0')->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">' . getUserSpace($uid, 'fn', '', '{uname}') . getUserGroupIcon($uid) . ' : ' . formatComment($data['content'], true) . ' (刚刚)</p>
                   <div class="alR clear"><a href="javascript:void(0)" onclick="ui.confirm(this,\'确认要删除此评论?\')" callback="delComment(' . $comment_id . ')">Xóa</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="reply(\'' . getUserName($uid) . '\',' . $data['weibo_id'] . ')">Trả lời</a></div>
                 </div>';
         if ($post['transpond'] != 0) {
             if ($miniInfo['transpond_id'] != 0) {
                 $transpondData['content'] = $data['content'] . ($data['reply_comment_id'] ? " //@" . getUserName($replyInfo['uid']) . " :" . $replyInfo['content'] : '') . " //@" . getUserName($miniInfo['uid']) . ":" . $miniInfo['content'];
                 $transpondData['transpond_id'] = $miniInfo['transpond_id'];
                 $transpondInfo = M('weibo')->where('weibo_id=' . $miniInfo['transpond_id'] . ' AND isdel=0')->find();
                 $transpondData['transpond_uid'] = $transpondInfo['uid'];
             } else {
                 $transpondData['content'] = $data['content'] . ($data['reply_comment_id'] ? " //@" . getUserName($replyInfo['uid']) . " :" . $replyInfo['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($uid, $id, $transpondData['content'], $transpondData['transpond_uid']);
                 } else {
                     D('Weibo', 'weibo')->notifyToAtme($uid, $id, $transpondData['content'], $transpondData['transpond_uid'], false);
                 }
             }
         }
         //添加统计
         if ($api) {
             if ($data['reply_uid'] != $miniInfo['uid']) {
                 Model('UserCount')->addCount($miniInfo['uid'], 'comment');
             }
         } else {
             Model('UserCount')->addCount($data['reply_uid'], 'comment');
             if ($data['reply_uid'] != $miniInfo['uid']) {
                 Model('UserCount')->addCount($miniInfo['uid'], 'comment');
             }
         }
         Addons::hook('weibo_comment_publish', array($comment_id, $data));
         if ($api) {
             return true;
         } else {
             return json_encode($return);
         }
     } else {
         return '0';
     }
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:69,代码来源:CommentModel.class.php

示例12: array

              </a>
              <?php 
            }
        }
        ?>
            <?php 
        if ($actions["at"] == "true") {
            if (in_array('at', $weibo_type)) {
                ?>
              <a event-node="insert_at" class="at-block" href="javascript:;" title="@某人"> <i class="at"></i>@某人</a>
              <?php 
            }
        }
        ?>
            <?php 
        echo Addons::hook('home_index_middle_publish_type', array('position' => 'index'));
        ?>
 </div>
          <div class="clear"></div>
          <div model-node ='faceDiv'></div>
        </div>
      </div>
    </div>
  </div>
</div>
<?php 
    } elseif ($GLOBALS['ts']['mid']) {
        ?>
<div class="send_weibo">
  <div class="box-purview"><div class="nologin"><i class="ico-error"></i>您没有权限发布分享</div></div>
</div>
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:31,代码来源:public_f481f4e0e2474c24.php

示例13: put

 /**
  * 添加分享
  * @param integer $uid 操作用户ID
  * @param string $app 分享应用类型,默认为public
  * @param string $type 分享类型,
  * @param array $data 分享相关数据
  * @param integer $app_id 应用资源ID,默认为0
  * @param string $app_table 应用资源表名,默认为feed
  * @param array  $extUid 额外用户ID,默认为null
  * @param array $lessUids 去除的用户ID,默认为null
  * @param boolean $isAtMe 是否为进行发送,默认为true
  * @return mix 添加失败返回false,成功返回新的分享ID
  */
 public function put($uid, $app = 'public', $type = '', $data = array(), $app_id = 0, $app_table = 'feed', $extUid = null, $lessUids = null, $isAtMe = true, $is_repost = 0)
 {
     if (isSubmitLocked()) {
         $this->error = '发布内容过于频繁,请稍后再试';
         return false;
     }
     // 判断数据的正确性
     if (!$uid || $type == '') {
         $this->error = L('PUBLIC_ADMIN_OPRETING_ERROR');
         return false;
     }
     if (strpos($type, 'postvideo') !== false) {
         $type = 'postvideo';
     }
     //分享类型合法性验证 - 临时解决方案
     $checkType = array('post', 'repost', 'postvideo', 'postfile', 'postimage', 'weiba_post', 'weiba_repost', 'long_post', 'photo_post', 'photo_repost', 'vote_post', 'vote_repost', 'event_post', 'event_repost', 'blog_post', 'blog_repost', 'poster_post', 'poster_repost');
     if (!in_array($type, $checkType)) {
         $type = 'post';
     }
     //应用类型验证 用于分享框 - 临时解决方案
     $checkApp = array('w3g', 'public', 'weiba', 'tipoff', 'photo', 'vote', 'event', 'blog', 'poster');
     if (!in_array($app, $checkApp)) {
         $app = 'public';
         $type = 'post';
         $app_table = 'feed';
     }
     $app_table = strtolower($app_table);
     // 添加feed表记录
     $data['uid'] = $uid;
     $data['app'] = $app;
     $data['type'] = $type;
     $data['app_row_id'] = $app_id;
     $data['app_row_table'] = $app_table;
     $data['publish_time'] = time();
     $data['from'] = isset($data['from']) ? intval($data['from']) : getVisitorClient();
     $data['is_del'] = $data['comment_count'] = $data['repost_count'] = 0;
     $data['is_repost'] = $is_repost;
     //判断是否先审后发
     $filterStatus = filter_words($data['body']);
     $weiboSet = model('Xdata')->get('admin_Config:feed');
     $weibo_premission = $weiboSet['weibo_premission'];
     if (in_array('audit', $weibo_premission) || CheckPermission('core_normal', 'feed_audit') || $filterStatus['type'] == 2) {
         $data['is_audit'] = 0;
     } else {
         $data['is_audit'] = 1;
     }
     // 分享内容处理
     if (Addons::requireHooks('weibo_publish_content')) {
         Addons::hook("weibo_publish_content", array(&$data));
     } else {
         // 截取内容信息为分享内容字数 - 长分享
         //$feedConf = model('Xdata')->get('admin_Config:feed');
         //$feedNums = $feedConf['weibo_nums'];
         //if(Addons::requireHooks('show_longtext_button')){
         //	$feedNums = 20000;
         //	$data['body'] = str_replace(SITE_URL, '[SITE_URL]', $data['body']);
         //}else{
         //	$data['body'] = str_replace(SITE_URL, '[SITE_URL]', preg_html($data['body']));
         //}
         $content = $this->formatFeedContent($data['body']);
         $data['body'] = $content['body'];
         $data['content'] = $content['content'];
     }
     //分享到分享的应用资源,加入原资源链接
     $data['body'] .= $data['source_url'];
     $data['content'] .= $data['source_url'];
     // 分享类型插件钩子
     // if($type){
     // 	$addonsData = array();
     // 	Addons::hook("weibo_type",array("typeId"=>$type,"typeData"=>$type_data,"result"=>&$addonsData));
     // 	$data = array_merge($data,$addonsData);
     // }
     if ($type == 'postvideo') {
         if ($_POST['video_id']) {
             $video_info = D('video')->where('video_id=' . $data['video_id'])->find();
             $data['transfer_id'] = $video_info['transfer_id'];
             $data['video_path'] = $video_info['video_path'];
             $data['video_mobile_path'] = $video_info['video_mobile_path'];
             $data['video_part_path'] = $video_info['video_part_path'];
             $data['image_path'] = $video_info['image_path'];
             $data['image_width'] = $video_info['image_width'];
             $data['image_height'] = $video_info['image_height'];
         } else {
             $typedata = model('Video')->_weiboTypePublish($_POST['videourl']);
             if ($typedata && $typedata['flashvar'] && $typedata['flashimg']) {
                 $data = array_merge($data, $typedata);
             } else {
//.........这里部分代码省略.........
开发者ID:nanhuacrab,项目名称:ThinkSNS4,代码行数:101,代码来源:FeedModel.class.php

示例14: put

 /**
  * 添加分享
  * @param integer $uid 操作用户ID
  * @param string $app 分享应用类型,默认为public
  * @param string $type 分享类型,
  * @param array $data 分享相关数据
  * @param integer $app_id 应用资源ID,默认为0
  * @param string $app_table 应用资源表名,默认为feed
  * @param array  $extUid 额外用户ID,默认为null
  * @param array $lessUids 去除的用户ID,默认为null
  * @param boolean $isAtMe 是否为进行发送,默认为true
  * @return mix 添加失败返回false,成功返回新的分享ID
  */
 public function put($uid, $app = 'group', $type = '', $data = array(), $app_id = 0, $app_table = 'group_feed', $extUid = null, $lessUids = null, $isAtMe = true, $is_repost = 0)
 {
     // 判断数据的正确性
     if (!$uid || $type == '') {
         return false;
     }
     if (strpos($type, 'postvideo') !== false) {
         $type = 'postvideo';
     }
     //分享类型合法性验证 - 临时解决方案
     if (!in_array($type, array('post', 'repost', 'postvideo', 'postfile', 'postimage'))) {
         $type = 'post';
     }
     // //应用类型验证 用于分享框 - 临时解决方案
     // if ( !in_array( $app , array('public','weiba','tipoff') ) ){
     //     $app = 'public';
     //     $type = 'post';
     //     $app_table = 'feed';
     // }
     $app_table = strtolower($app_table);
     // 添加feed表记录
     $data['gid'] = $data['gid'];
     $data['uid'] = $uid;
     $data['app'] = $app;
     $data['type'] = $type;
     $data['app_row_id'] = $app_id;
     $data['app_row_table'] = $app_table;
     $data['publish_time'] = time();
     $data['from'] = isset($data['from']) ? intval($data['from']) : getVisitorClient();
     $data['is_del'] = $data['comment_count'] = $data['repost_count'] = 0;
     $data['is_repost'] = $is_repost;
     //判断是否先审后发
     //         $weiboSet = model('Xdata')->get('admin_Config:feed');
     //         $weibo_premission = $weiboSet['weibo_premission'];
     //         if(in_array('audit',$weibo_premission) || CheckPermission('core_normal','feed_audit')){
     //             $data['is_audit'] = 0;
     //         }else{
     $data['is_audit'] = 1;
     //         }
     // 分享内容处理
     if (Addons::requireHooks('weibo_publish_content')) {
         Addons::hook("weibo_publish_content", array(&$data));
     } else {
         // 拼装数据,如果是评论再转发、回复评论等情况,需要额外叠加对话数据
         $data['body'] = str_replace(SITE_URL, '[SITE_URL]', preg_html($data['body']));
         // 获取用户发送的内容,仅仅以//进行分割
         $scream = explode('//', $data['body']);
         // 截取内容信息为分享内容字数 - 重点
         $feedConf = model('Xdata')->get('admin_Config:feed');
         $feedNums = $feedConf['weibo_nums'];
         $body = array();
         foreach ($scream as $value) {
             $tbody[] = $value;
             $bodyStr = implode('//', $tbody);
             if (get_str_length($bodyStr) > $feedNums) {
                 break;
             }
             $body[] = $value;
             unset($bodyStr);
         }
         $data['body'] = implode('//', $body);
         // 获取用户发布内容
         $data['content'] = trim($scream[0]);
     }
     //分享到分享的应用资源,加入原资源链接
     $data['body'] .= $data['source_url'];
     $data['content'] .= $data['source_url'];
     // 分享类型插件钩子
     // if($type){
     //  $addonsData = array();
     //  Addons::hook("weibo_type",array("typeId"=>$type,"typeData"=>$type_data,"result"=>&$addonsData));
     //  $data = array_merge($data,$addonsData);
     // }
     if ($type == 'postvideo') {
         $typedata = model('Video')->_weiboTypePublish($_POST['videourl']);
         if ($typedata && $typedata['flashvar'] && $typedata['flashimg']) {
             $data = array_merge($data, $typedata);
         } else {
             $data['type'] = 'post';
         }
     }
     // 添加分享信息
     $feed_id = $this->data($data)->add();
     if (!$feed_id) {
         return false;
     }
     //         if(!$data['is_audit']){
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:101,代码来源:GroupFeedModel.class.php

示例15: array

', '<?php 
    echo $channel_id;
    ?>
', '<?php 
    echo $clear;
    ?>
');">推荐到频道</a></li>
		<?php 
}
?>
		<?php 
if ($vtask_recommend == 1) {
    ?>
		<li><a href="javascript:;" onclick="addToVtask('<?php 
    echo $feed_id;
    ?>
');">添加到事务</a></li>
		<?php 
}
?>
		<?php 
if ($feed_del == 1) {
    ?>
		<?php 
}
?>
		<?php 
echo Addons::hook('feed_manage_li', array('feed_id' => $feed_id, 'uid' => $uid));
?>
	</ul>
</div>
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:31,代码来源:public_b81a59f33f86461a.php


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