當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。