示例#1
0
 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;
 }
示例#2
0
 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;
 }
示例#3
0
 /**
  * 生成sell标签内容
  *
  * @param int $cost 需要的积分
  * @param stirng $str 隐藏的内容
  * @param object $config ubb转换配置
  * @return string
  */
 public static function createSell($length, $cost, $str, $config)
 {
     self::$_hide = true;
     list($cost, $credit) = explode(',', $cost);
     $creditBo = PwCreditBo::getInstance();
     $cname = isset($creditBo->cType[$credit]) ? $creditBo->cType[$credit] : current($creditBo->cType);
     return array('<span>[以下帖子售价 ' . $cost . ' ' . $cname . ',购买后显示内容]</span>', 16);
 }
 protected function _bulidContent($content, $ubb, &$errcode)
 {
     $errcode = array();
     $content = str_replace(array("\r", "\n", "\t"), '', $content);
     $content = WindSecurity::escapeHTML($content);
     if ($ubb) {
         $content = PwSimpleUbbCode::convert($content, 140, new PwUbbCodeConvertThread());
         PwSimpleUbbCode::isSubstr() && ($errcode['is_read_all'] = true);
     } elseif (Pw::strlen($content) > 140) {
         $errcode['is_read_all'] = true;
         $content = Pw::substrs($content, 140);
     }
     //var_dump($content);
     //$content = WindSecurity::escapeHTML($content);
     //$content = preg_replace('/(?<!&|&amp;)#([^#]+?)#/ie', "self::_parseTopic('\\1')", $content);
     return $content;
 }
 private function _getNewReply($pid, $limit)
 {
     $reply = Wekit::load('forum.PwThread')->getPost($pid);
     $total = $reply['replies'];
     Wind::import('LIB:ubb.PwSimpleUbbCode');
     Wind::import('LIB:ubb.config.PwUbbCodeConvertThread');
     $replydb = Wekit::load('forum.PwPostsReply')->getPostByPid($pid, $limit);
     foreach ($replydb as $key => $value) {
         $value['content'] = WindSecurity::escapeHTML($value['content']);
         if ($value['useubb']) {
             $value['content'] = PwSimpleUbbCode::convert($value['content'], 140, new PwUbbCodeConvertThread());
         } else {
             $value['content'] = Pw::substrs($value['content'], 140);
         }
         $replydb[$key] = $value;
     }
     return $replydb;
 }