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


PHP Pw::substrs方法代码示例

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


在下文中一共展示了Pw::substrs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:31,代码来源:PwReplyDoWord.php

示例2: setRandCode

 /**
  * 设置验证码
  * 
  * @return void
  */
 protected static function setRandCode()
 {
     switch (self::$verifyType) {
         case '1':
             $str = '1234567890';
             break;
         case '2':
             $str = 'abcdefghjkmnpqrstuvwxyABCDEFGHJKLMNPQRSTUVWXY';
             break;
         case '3':
         default:
             $str = '3456789bcefghjkmpqrtvwxyzBCEFGHJKMPQRTVWXYZ';
             break;
         case '5':
             $str = '人之初性本善性相近习相远苟不教性乃迁教之道贵以专昔孟母择邻处子不学断机杼窦燕山有义方教五子名俱扬养段算适讲按值美态黄易彪服早班麦削信排台声该击素张密害侯草何树肥继右属市严径螺检左页抗苏显苦英快称坏移约巴材省黑武培著河帝仅针怎植京助升王眼她抓含苗副杂普谈围食射源例致酸旧却充足短划剂宣环落首尺波承粉践府鱼随考刻靠够满夫失包住促枝局菌杆周护岩师举曲春元超负砂封换太模贫减阳扬江析亩木言球朝医校古呢稻宋听唯输滑站另卫字鼓刚写刘微略范供阿块某功套友限项余倒卷创律雨让骨远帮初皮播优占死毒圈伟季训控激找叫云互跟裂粮粒母练塞钢顶策双留误础吸阻故寸盾晚丝女散焊功株亲院冷彻弹错散商视艺灭版烈零室轻血倍缺厘泵察绝富城冲喷壤简否柱李望盘磁雄似困巩益洲脱投送奴侧润盖挥距触星松送获兴独官混纪依未突架宽冬章湿偏纹吃执阀矿寨责熟稳夺硬价努翻奇甲预职评读背协损棉侵灰虽矛厚罗泥辟告卵箱掌氧恩爱停曾溶营终纲孟钱待尽俄缩沙退陈讨奋械载胞幼哪剥迫旋征槽倒握担仍呀鲜吧卡粗介钻逐弱脚怕盐末阴丰编印蜂急拿扩伤飞露核缘游振操央伍域甚迅辉异序免纸夜乡久隶缸夹念兰映沟乙吗儒杀汽磷艰晶插埃燃欢铁补咱芽永瓦倾阵碳演威附牙芽永瓦斜灌欧献顺猪洋腐请透司危括脉宜笑若尾束壮暴企菜穗楚汉愈绿拖牛份染既秋遍锻玉夏疗尖殖井费州访吹荣铜沿替滚客召旱悟刺脑';
             break;
         case '4':
         case '6':
             self::$verifyCode = self::_convert(self::$askCode);
             return true;
         case '7':
             //目前只有这些声音文件
             $str = '123456789BCEFGHJKMPQRTVWXYZ';
             break;
     }
     $_tmp = Pw::strlen($str) - 1;
     $_num = 0;
     for ($i = 0; $i < self::$verifyLength; $i++) {
         $_num = mt_rand(0, $_tmp);
         $_code = Pw::substrs($str, 1, $_num, false);
         self::$verifyCode .= self::_convert($_code);
     }
 }
开发者ID:mm999,项目名称:EduSoho,代码行数:38,代码来源:PwBaseCode.php

示例3: replyAction

 /**
  * 回复列表
  */
 public function replyAction()
 {
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $count = $this->_getThreadExpandDs()->countDisabledPostByUid($this->loginUser->uid);
     if ($count) {
         $tmpPosts = $this->_getThreadExpandDs()->getDisabledPostByUid($this->loginUser->uid, $limit, $start);
         $posts = $tids = array();
         foreach ($tmpPosts as $v) {
             $tids[] = $v['tid'];
         }
         $threads = $this->_getThreadDs()->fetchThread($tids);
         foreach ($tmpPosts as $v) {
             $v['threadSubject'] = Pw::substrs($threads[$v['tid']]['subject'], 30);
             $v['content'] = Pw::substrs($v['content'], 30);
             $v['created_time'] = PW::time2str($v['created_time'], 'auto');
             $posts[] = $v;
         }
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($posts, 'posts');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.article.reply.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:35,代码来源:ArticleController.php

示例4: buildTitle

 public function buildTitle($param = 0, $extendParams = null, $aggregatedNotice = null)
 {
     if ($extendParams['title']) {
         $title = $extendParams['title'];
     } else {
         $title = Pw::substrs($extendParams['content'], 60);
     }
     return $title;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:9,代码来源:PwNoticeDefault.php

示例5: dorunAction

 /**
  * 后台设置-email设置
  */
 public function dorunAction()
 {
     $password = $this->getInput('mailPassword', 'post');
     $config = $this->_getConfig();
     $t = Pw::strlen($config['mail.password']);
     $passwordO = Pw::substrs($config['mail.password'], 1, 0, false) . '********' . Pw::substrs($config['mail.password'], 1, $t - 1, false);
     $password = $password == $passwordO ? $config['mail.password'] : $password;
     $config = new PwConfigSet('email');
     $config->set('mailOpen', $this->getInput('mailOpen', 'post'))->set('mailMethod', 'smtp')->set('mail.host', $this->getInput('mailHost', 'post'))->set('mail.port', $this->getInput('mailPort', 'post'))->set('mail.from', $this->getInput('mailFrom', 'post'))->set('mail.auth', $this->getInput('mailAuth', 'post'))->set('mail.user', $this->getInput('mailUser', 'post'))->set('mail.password', $password)->flush();
     $this->showMessage('ADMIN:success');
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:14,代码来源:EmailController.php

示例6: addPost

 public function addPost($pid, $tid)
 {
     $params = array();
     $params['replyContent'] = $this->content;
     $params['replyUserid'] = $this->user->uid;
     $params['replyUsername'] = $this->user->username;
     $params['postTitle'] = Pw::substrs($this->postInfo['content'], 30);
     $params['postId'] = $this->postInfo['pid'];
     $params['postUserid'] = $this->postInfo['created_userid'];
     $params['replies'] = $this->postInfo['replies'];
     return $this->_getNoticeService()->sendNotice($this->postInfo['created_userid'], 'postreply', $this->postInfo['pid'], $params);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:12,代码来源:PwNoticeDoReply.php

示例7: displayContent

 public function displayContent($content, $useubb, $remindUser = array(), $contentLength = 140)
 {
     $content = WindSecurity::escapeHTML($content);
     if ($useubb) {
         $ubb = new PwUbbCodeConvertThread();
         $ubb->setRemindUser($remindUser);
         $content = PwSimpleUbbCode::convert($content, $contentLength, $ubb);
     } else {
         $content = Pw::substrs($content, $contentLength);
     }
     return $content;
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:12,代码来源:PwThreadService.php

示例8: getAnnounceForBbsScroll

 /**
  * 通过公告记录组装前台显示效果
  * 帖子列表滚动展示标题用
  *
  * @return array
  */
 public function getAnnounceForBbsScroll()
 {
     $announces = array();
     $announceInfos = $this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), 9, 0);
     foreach ($announceInfos as $value) {
         $announces[$value['aid']] = $value;
         $announces[$value['aid']]['start_date'] = Pw::time2str($value['start_date'], 'Y-m-d');
         if (Pw::strlen($value['subject']) > 18) {
             $announces[$value['aid']]['subject'] = Pw::substrs($value['subject'], 18);
         }
     }
     return $announces;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:19,代码来源:PwAnnounceService.php

示例9: buildDm

 public function buildDm($type_id)
 {
     $threadDs = Wekit::load('forum.PwThread');
     $result = $threadDs->getThread($type_id);
     if (!$result) {
         return false;
     }
     $content = Pw::substrs($result['subject'], 20);
     $hrefUrl = WindUrlHelper::createUrl('bbs/read/run', array('tid' => $result['tid'], 'fid' => $result['fid']));
     $this->fid = $result['fid'];
     $dm = new PwReportDm();
     $dm->setContent($content)->setContentUrl($hrefUrl)->setAuthorUserid($result['created_userid']);
     return $dm;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:14,代码来源:PwReportThread.php

示例10: 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;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:14,代码来源:PwReplyDoRemind.php

示例11: getAttachesForStorage

 /**
  * 
  * 云存储api(同步附件)
  *
  * @param string $dir
  */
 public function getAttachesForStorage($dir)
 {
     $attachDir = Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH;
     $dir = trim($dir);
     if (!$dir) {
         return array();
     }
     $result = array();
     $baseUrl = Pw::substrs(PUBLIC_URL, strrpos(PUBLIC_URL, 'aCloud'), 0, false);
     foreach (glob($attachDir . $dir . '/*') as $fileName) {
         if ($fileName == '.' || $fileName == '..' || preg_match('/\\.(htm|html|db)$/i', $fileName)) {
             continue;
         }
         $result[] = array('attachurl' => str_replace(Wind::getRealDir('PUBLIC:'), $baseUrl, $fileName), 'dir' => str_replace(Wind::getRealDir('PUBLIC:'), '', $fileName));
     }
     return $result;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:23,代码来源:ACloudVerCommonAttach.php

示例12: run

 /**
  * (non-PHPdoc)
  * @see wekit/wind/web/WindController::run()
  */
 public function run()
 {
     $page = (int) $this->getInput('page', 'get');
     if ($page < 1) {
         $page = 1;
     }
     $this->setOutput('index', 'src');
     $this->setOutput($page, 'page');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     $des = Pw::substrs($this->space->space['space_descrip'], 100, 0, false);
     if ($page == 1) {
         PwSeoBo::setCustomSeo($lang->getMessage('SEO:space.index.run.title', array($this->space->space['space_name'])), '', $des);
     } else {
         PwSeoBo::setCustomSeo($lang->getMessage('SEO:space.index.run.page.title', array($page, $this->space->space['space_name'])), '', $des);
     }
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:22,代码来源:IndexController.php

示例13: __construct

 public function __construct($fresh, PwUserBo $user)
 {
     if ($fresh['type'] == 2) {
         $post = $this->_getThread()->getPost($fresh['src_id']);
         $tid = $post['tid'];
         $rpid = $post['pid'];
         $post = $this->_getThread()->getPost($rpid);
         if ($post && $post['tid'] == $tid && $post['ischeck']) {
             $content = preg_replace('/\\[quote(=.+?\\,\\d+)?\\].*?\\[\\/quote\\]/is', '', $post['content']);
             $this->quote = '[quote=' . $post['created_username'] . ',' . $rpid . ']' . Pw::substrs($content, 120) . '[/quote]';
         }
     } else {
         $tid = $fresh['src_id'];
         $rpid = 0;
     }
     $this->post = new PwPost(new PwReplyPost($tid, $user));
     $this->dm = $this->post->getDm();
     $this->dm->setReplyPid($rpid);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:19,代码来源:PwFreshReplyByPost.php

示例14: _bulidContent

 protected function _bulidContent($array, &$errcode)
 {
     $errcode = array();
     $array['content'] = str_replace(array("\r", "\n", "\t"), '', $array['content']);
     $array['content'] = WindSecurity::escapeHTML($array['content']);
     if ($array['ifshield']) {
         $array['subject'] = '';
         $array['content'] = '<span style="text-decoration: line-through">此帖已被屏蔽</span>';
     } elseif ($array['useubb']) {
         $ubb = new PwUbbCodeConvertThread();
         $array['reminds'] && $ubb->setRemindUser($array['reminds']);
         $array['pic'] && $ubb->setAttachParser(new PwFreshAttachDisplay($array['pic']));
         $array['content'] = PwSimpleUbbCode::convert($array['content'], 140, $ubb);
         PwSimpleUbbCode::isSubstr() && ($errcode['is_read_all'] = true);
     } elseif (Pw::strlen($array['content']) > 140) {
         $errcode['is_read_all'] = true;
         $array['content'] = Pw::substrs($array['content'], 140);
     }
     return $array;
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:20,代码来源:PwFreshDisplay.php

示例15: _addRemind

 private function _addRemind($tid)
 {
     if ($this->_check() !== true) {
         return false;
     }
     if (!$this->_reminds) {
         return false;
     }
     $reminds = $this->_maxNum && count($this->_reminds) > $this->_maxNum ? array_slice($this->_reminds, 0, $this->_maxNum) : $this->_reminds;
     $remindUids = array_keys($reminds);
     $this->_getRemindService()->addRemind($this->loginUser->uid, $remindUids);
     //发送通知
     $title = Pw::substrs(trim($this->_atc_title), 20);
     $extendParams = array('remindUid' => $this->loginUser->uid, 'remindUsername' => $this->loginUser->username, 'title' => $title, 'notice' => '在帖子 <a href="' . WindUrlHelper::createUrl('bbs/read/run', array('tid' => $tid)) . '" target="_blank">' . $title . '</a> @了您');
     // 是否黑名单
     $remindUids = $this->_checkBlack($remindUids);
     foreach ($remindUids as $uid) {
         $this->_getPwNoticeService()->sendNotice($uid, 'remind', $tid, $extendParams);
     }
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:20,代码来源:PwPostDoRemind.php


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