本文整理汇总了PHP中Pw::stripWindCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::stripWindCode方法的具体用法?PHP Pw::stripWindCode怎么用?PHP Pw::stripWindCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pw
的用法示例。
在下文中一共展示了Pw::stripWindCode方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
public function check($postDm)
{
$data = $postDm->getData();
$content = Pw::substrs(Pw::stripWindCode($data['content']), 30) == $data['subject'] ? $data['content'] : $data['subject'] . $data['content'];
$banedStrLen = strlen($data['subject']);
$wordFilter = Wekit::load('SRV:word.srv.PwWordFilter');
list($type, $words, $isTip) = $wordFilter->filterWord($content);
if (!$type) {
return true;
}
$words = array_unique($words);
foreach ($words as $k => $v) {
if ($k < $banedStrLen) {
return new PwError('WORD:content.error.tip', array('{wordstr}' => implode(',', $words)));
}
}
switch ($type) {
case 1:
return new PwError('WORD:content.error.tip', array('{wordstr}' => implode(',', $words)));
case 2:
$this->_isVerified = 1;
if ($this->_confirm) {
return true;
}
case 3:
$this->_word = 1;
default:
return true;
}
return true;
}
示例2: getFromData
/**
* 格式化原始推送数据
* Enter description here ...
* @param int $fromid
*/
public function getFromData($fromid)
{
$data = Wekit::load('forum.PwThread')->getThread($fromid, PwThread::FETCH_ALL);
$data['title'] = $data['subject'];
$data['descrip'] = Pw::stripWindCode($data['content']);
$data['descrip'] = Pw::substrs($data['descrip'], 144);
$data['model'] = 'thread';
$data['fromid'] = $fromid;
$data['uid'] = $data['created_userid'];
return $data;
}
示例3: dataProcessing
public function dataProcessing($postDm)
{
if ($this->_check() !== true) {
return $postDm;
}
$atc_content = $postDm->getField('content');
$atc_content = preg_replace('/\\[quote(=.+?\\,\\d+)?\\].*?\\[\\/quote\\]/is', '', $atc_content);
$this->_atc_title = Pw::substrs(trim(Pw::stripWindCode($atc_content, true)), 20);
$reminds = $this->_getRemindService()->bulidRemind($atc_content);
$this->_reminds = $this->_getRemindService()->buildUsers($this->loginUser->uid, $reminds, $this->_maxNum);
$reminds = $this->_getRemindService()->formatReminds($this->_reminds);
$postDm->setReminds($reminds);
return $postDm;
}
示例4: parsePicHtml
public function parsePicHtml($att)
{
$html = "<span id=\"td_att_{$att['aid']}\" class=\"J_attach_img_wrap single_img\">";
$html .= '<div class="img_info J_img_info">';
if ($att['descrip']) {
$html .= '<p>描述:' . Pw::stripWindCode($att['descrip'], true) . '</p>';
}
$html .= '<p>图片:' . $att['name'];
if ($this->isAdmin) {
$html .= '<a class="J_read_img_del" href="' . WindUrlHelper::createUrl('bbs/attach/delete', array('aid' => $att['aid'])) . '">[删除]</a>';
}
$html .= '</p></div>';
$html .= $att['img'];
$html .= '</span>';
return $html;
}
示例5: run
public function run($id)
{
if ($this->tag) {
$data = Wekit::load('weibo.PwWeibo')->getWeibo($id);
if (!$data) {
return false;
}
$tag = $this->tag;
/* @var $logSrv PwLogService */
$logSrv = Wekit::load('log.srv.PwLogService');
$langArgs = array();
$langArgs['tag_url'] = WindUrlHelper::createUrl('tag/index/view', array('name' => $tag['tag_name']));
$langArgs['tag'] = $tag['tag_name'];
$langArgs['content_url'] = '';
$langArgs['content'] = Pw::substrs(strip_tags(Pw::stripWindCode($data['content'])), 20, 0, true);
$langArgs['type'] = '微博';
$dm = new PwLogDm();
$dm->setOperatedUser($data['created_userid'], $data['created_username']);
//从话题中屏蔽帖子。管理日志添加
$logSrv->addShieldTagLog($this->srv->user, $dm, $langArgs, $this->srv->ifShield);
}
}
示例6: _sendReplyNotice
private function _sendReplyNotice($pid, $tid)
{
$info = Wekit::load('thread.PwThread')->getPost($this->_rpid);
$param = $info['pid'];
$params = array();
$params['replyUserid'] = $this->user->uid;
$params['replyUsername'] = $this->user->username;
$info['content'] = preg_replace('/\\[quote(=.+?\\,\\d+)?\\].*?\\[\\/quote\\]/is', '', $info['content']);
$params['postTitle'] = Pw::stripWindCode($info['content']);
$params['postTitle'] = $params['postTitle'] ? $params['postTitle'] : 'Re:' . $this->info['subject'];
$params['postTitle'] = Pw::substrs($params['postTitle'], 30);
$params['threadId'] = $info['tid'];
$params['pid'] = $pid;
$params['postUserid'] = $info['created_userid'];
$type = 'postreply';
if (!$info['reply_notice'] || $this->user->uid == $info['created_userid']) {
return false;
}
$blackUid = Wekit::load('user.PwUserBlack')->checkUserBlack($this->user->uid, $info['created_userid']);
if ($blackUid) {
return false;
}
return $this->_getNoticeService()->sendNotice($info['created_userid'], $type, $param, $params);
}
示例7: _formatDes
/**
* 格式化简介
* @param string $time
*/
protected final function _formatDes($string)
{
$string = Pw::stripWindCode($string);
$string = preg_replace("/\r\n|\n|\r/", '', $string);
$string = str_replace(' ', '', $string);
return $this->_viewSet['desnum'] > 0 ? Pw::substrs($string, $this->_viewSet['desnum']) : $string;
}
示例8: _buildContent
public function _buildContent($content)
{
$content = strip_tags($content);
$content = str_replace(array("\r", "\n", "\t"), '', $content);
return Pw::substrs(Pw::stripWindCode($content), 128);
}
示例9: addDeleteFreshLog
/**
* 添加删除新鲜事时的管理日志
*
* @param PwUserBo $user
* @param array $data
* @return boolean
*/
public function addDeleteFreshLog(PwUserBo $user, $data)
{
if (!$data) {
return false;
}
$typeid = $this->getOperatTypeid('delfresh');
$typeTitle = $this->getOperatTypeTitle('delfresh');
$_logDms = array();
foreach ($data as $_item) {
$title = Pw::substrs(strip_tags(Pw::stripWindCode($_item['content'])), 20, 0, true);
$_dm = new PwLogDm();
$_dm->setCreatedTime(Pw::getTime())->setCreatedUser($user->uid, $user->username)->setOperatedUser($_item['created_userid'], $_item['created_username'])->setIp(Wind::getComponent('request')->getClientIp())->setExtends($_item['weibo_id'])->setTypeid($typeid)->setContent($this->getLogMsg('LOG:delete.fresh.message', array('{title}' => "'" . $title . "'")));
$_logDms[] = $_dm;
}
$this->_getLogDs()->batchAddLog($_logDms);
return true;
}
示例10: substr
/**
* 截取字符串
* Enter description here ...
* @param string $string
* @param int $length
*/
protected function substr($string, $length = 0)
{
if (!$length) {
return $string;
}
if (!$string) {
return '';
}
$string = Pw::stripWindCode($string);
$string = preg_replace("/\r\n|\n|\r/", '', $string);
$string = str_replace(' ', '', $string);
return Pw::substrs($string, $length);
}
示例11: doreplyAction
/**
* 回复
*/
public function doreplyAction()
{
$tid = $this->getInput('tid');
list($title, $content, $hide, $rpid) = $this->getInput(array('atc_title', 'atc_content', 'hide', 'pid'), 'post');
$_getHtml = $this->getInput('_getHtml', 'get');
$pwPost = $this->post;
$this->runHook('c_post_doreply', $pwPost);
$info = $pwPost->getInfo();
$title == 'Re:' . $info['subject'] && ($title = '');
if ($rpid) {
$post = Wekit::load('thread.PwThread')->getPost($rpid);
if ($post && $post['tid'] == $tid && $post['ischeck']) {
$post['content'] = $post['ifshield'] ? '此帖已被屏蔽' : trim(Pw::stripWindCode(preg_replace('/\\[quote(=.+?\\,\\d+)?\\].*?\\[\\/quote\\]/is', '', $post['content'])));
$post['content'] && ($content = '[quote=' . $post['created_username'] . ',' . $rpid . ']' . Pw::substrs($post['content'], 120) . '[/quote] ' . $content);
} else {
$rpid = 0;
}
}
$postDm = $pwPost->getDm();
$postDm->setTitle($title)->setContent($content)->setHide($hide)->setReplyPid($rpid);
if (($result = $pwPost->execute($postDm)) !== true) {
$data = $result->getData();
$data && $this->addMessage($data, 'data');
$this->showError($result->getError());
}
$pid = $pwPost->getNewId();
if ($_getHtml == 1) {
Wind::import('SRV:forum.srv.threadDisplay.PwReplyRead');
Wind::import('SRV:forum.srv.PwThreadDisplay');
$threadDisplay = new PwThreadDisplay($tid, $this->loginUser);
$this->runHook('c_post_replyread', $threadDisplay);
$dataSource = new PwReplyRead($tid, $pid);
$threadDisplay->execute($dataSource);
$_cache = Wekit::cache()->fetch(array('level', 'group_right'));
$this->setOutput($threadDisplay, 'threadDisplay');
$this->setOutput($tid, 'tid');
$this->setOutput($threadDisplay->fid, 'fid');
$this->setOutput($threadDisplay->getThreadInfo(), 'threadInfo');
$this->setOutput(current($threadDisplay->getList()), 'read');
$this->setOutput($threadDisplay->getUsers(), 'users');
$this->setOutput($threadDisplay->getArea(), 'area');
$this->setOutput($threadDisplay->getForum(), 'pwforum');
$this->setOutput(PwCreditBo::getInstance(), 'creditBo');
$this->setOutput(Wekit::C('bbs', 'read.display_member_info'), 'displayMemberInfo');
$this->setOutput(Wekit::C('bbs', 'read.display_info'), 'displayInfo');
$this->setOutput($_cache['level']['ltitle'], 'ltitle');
$this->setOutput($_cache['level']['lpic'], 'lpic');
$this->setOutput($_cache['level']['lneed'], 'lneed');
$this->setOutput($_cache['group_right'], 'groupRight');
$this->setTemplate('read_floor');
} elseif ($_getHtml == 2) {
$content = Wekit::load('forum.srv.PwThreadService')->displayContent($content, $postDm->getField('useubb'), $postDm->getField('reminds'));
$this->setOutput($postDm->getField('ischeck'), 'ischeck');
$this->setOutput($content, 'content');
$this->setOutput($this->loginUser->uid, 'uid');
$this->setOutput($this->loginUser->username, 'username');
$this->setOutput($pid, 'pid');
$this->setOutput(Pw::getTime() - 1, 'time');
$this->setTemplate('read_reply_floor');
} else {
$this->showMessage('success', 'bbs/read/run/?tid=' . $tid . '&fid=' . $pwPost->forum->fid . '&page=e#' . $pid, true);
}
}
示例12: buildTitle
public function buildTitle($param = 0, $extendParams = null, $aggregatedNotice = null)
{
return Pw::substrs(Pw::stripWindCode($extendParams['content'], true), 40);
}
示例13: postAction
public function postAction()
{
$fid = $this->getInput('fid');
$_getHtml = $this->getInput('_getHtml', 'get');
list($content, $topictype, $subtopictype) = $this->getInput(array('content', 'topictype', 'sub_topictype'), 'post');
Wind::import('SRV:forum.srv.post.PwTopicPost');
Wind::import('SRV:forum.srv.PwPost');
$postAction = new PwTopicPost($fid);
$pwpost = new PwPost($postAction);
$this->runHook('c_fresh_post', $pwpost);
if (($result = $pwpost->check()) !== true) {
$this->showError($result->getError());
}
$postDm = $pwpost->getDm();
$postDm->setTitle(Pw::substrs(Pw::stripWindCode($content), 30))->setContent($content);
$topictype_id = $subtopictype ? $subtopictype : $topictype;
$topictype_id && $postDm->setTopictype($topictype_id);
if (($result = $pwpost->execute($postDm)) !== true) {
$data = $result->getData();
$data && $this->addMessage($data, 'data');
$this->showError($result->getError());
}
if (!$postDm->getField('ischeck')) {
$this->showMessage('BBS:post.topic.ischeck');
} elseif ($_getHtml == 1) {
Wind::import('SRV:attention.srv.dataSource.PwFetchFreshByTypeAndSrcId');
$freshDisplay = new PwFreshDisplay(new PwFetchFreshByTypeAndSrcId(1, array($pwpost->getNewId())));
$fresh = $freshDisplay->gather();
$fresh = current($fresh);
$this->setOutput($fresh, 'fresh');
} else {
$this->showMessage('success');
}
}
示例14: post
/**
* 回复帖子;回复回帖;回复回复
* @access public
* @return string
* @example
<pre>
直接回复时参数状态:/index.php?m=native&c=post&a=doreply&_getHtml=1
点击喜欢后顺便回复时参数状态:/index.php?m=native&c=post&a=doreply&fid=分类id
( _getHtml: 1表示回复帖子;2表示回复回帖 | )
post(回复帖子): tid&atc_content&created_address&area_code
post(回复回帖、回复回复->相当于在本楼层回帖): tid&pid&atc_content&created_address&area_code
post(在点喜欢的时候顺便回复内容):tid&pid&atc_content&created_address&area_code&from_type=like
cookie:usersession
response: {err:"",data:""}
</pre>
*/
public function doreplyAction()
{
$tid = $this->getInput('tid');
list($title, $content, $hide, $rpid, $created_address, $area_code) = $this->getInput(array('atc_title', 'atc_content', 'hide', 'pid', 'created_address', 'area_code'), 'post');
$_getHtml = $this->getInput('_getHtml', 'get');
$this->runHook('c_post_run', $this->post);
$this->runHook('c_post_doreply', $this->post);
$info = $this->post->getInfo();
$title == 'Re:' . $info['subject'] && ($title = '');
if ($rpid) {
//回复一个回帖
$post = Wekit::load('thread.PwThread')->getPost($rpid);
if ($post && $post['tid'] == $tid && $post['ischeck']) {
$post['content'] = $post['ifshield'] ? '此帖已被屏蔽' : trim(Pw::stripWindCode(preg_replace('/\\[quote(=.+?\\,\\d+)?\\].*?\\[\\/quote\\]/is', '', $post['content'])));
$post['content'] && ($content = '[quote=' . $post['created_username'] . ',' . $rpid . ']' . Pw::substrs($post['content'], 120) . '[/quote] ' . $content);
} else {
//回复主贴
$rpid = 0;
}
}
$postDm = $this->post->getDm();
$postDm->setTitle($title)->setContent($content)->setHide($hide)->setReplyPid($rpid);
if (($result = $this->post->execute($postDm)) !== true) {
$data = $result->getData();
$data && $this->addMessage($data, 'data');
$this->showError($result->getError());
}
$pid = $this->post->getNewId();
//记录回帖位置信息
$data = array('pid' => $pid, 'created_address' => $created_address, 'area_code' => $area_code);
$res = Wekit::loadDao('native.dao.PwPostsPlaceDao')->insertValue($data);
// 发送通知
// 关于type请查看sendNotification的注释
// 如果自己回复了自己的帖子,则不发送通知
if ($info['created_userid'] != $this->uid) {
PwLaiWangSerivce::sendNotification($info['created_userid'], array('type' => $rpid > 0 ? 3 : 2, 'message' => $rpid > 0 ? $this->loginUser->info['username'] . " 评论了您的回帖:\n" . $content : $this->loginUser->info['username'] . ' 评论了您的帖子《' . $info['subject'] . "》:\n" . $content, 'url' => $rpid > 0 ? 'read' : 'read', 'arg' => $rpid > 0 ? array((string) $tid) : array((string) $tid)));
}
//
$this->showMessage('success');
}