/** * 获取文章摘要(内容摘要以及图片) * * @param int $aid 文章id * @param bool $transBr 是否要转换换行 * @param array $options 参数选项, 可选值: array('imageList' => 1, 'imageListLen' => 9, 'imageListThumb' => 1) * @return array array('msg' => '', 'image' => '', 'imageList' => array()) */ public static function getArticleSummary($aid, $transBr = true, $options = array()) { $summary = array('msg' => '', 'image' => '', 'imageList' => array()); $summaryLength = WebUtils::getDzPluginAppbymeAppConfig('portal_summary_length'); $allowImage = WebUtils::getDzPluginAppbymeAppConfig('portal_allow_image'); $allowImage = !($allowImage === '0'); if ($summaryLength === '0' && !$allowImage) { return $summary; } require_once DISCUZ_ROOT . './source/function/function_home.php'; $article = DzPortalArticle::getArticleByAid($aid); if (!empty($article)) { $getImageList = isset($options['imageList']) ? $options['imageList'] : 0; $imageListLen = isset($options['imageListLen']) ? $options['imageListLen'] : 9; $imageListThumb = isset($options['imageListThumb']) ? $options['imageListThumb'] : 1; $msg = $article['summary']; if ($article['pic']) { // $article['pic'] = pic_get($article['pic'], '', $article['thumb'], $article['remote'], 1, 1); $article['pic'] = pic_get($article['pic'], '', $article['thumb'], $article['remote'], 0, 1); if ($allowImage) { $summary['image'] = WebUtils::getHttpFileName($article['pic']); if ($getImageList) { $tempImage = $summary['image']; $imageListThumb && ($tempImage = ImageUtils::getThumbImage($tempImage)); $summary['imageList'][] = $tempImage; } } } $transBr && ($msg = WebUtils::emptyReturnLine($msg, ' ')); $msg = trim($msg); $summaryLength === false && ($summaryLength = 40); $summary['msg'] = (string) WebUtils::subString($msg, 0, $summaryLength); } return $summary; }
public function actionSiteInfo() { $res = array(); global $_G; $setting = $_G['setting']; $tmpPassword = trim($_REQUEST['install_password']); $password = WebUtils::subString(WebUtils::getDzPluginAppbymeAppConfig('install_password'), 0, 10); if (!empty($password) && $password == $tmpPassword) { $res['info'] = array('setting_basic_bbname' => $setting['bbname'], 'setting_basic_sitename' => $setting['sitename'], 'setting_basic_siteurl' => $setting['siteurl'], 'setting_basic_adminemail' => $setting['adminemail'], 'setting_basic_icp' => $setting['icp'], 'setting_basic_boardlicensed' => $setting['boardlicensed'], 'onlineinfo' => 0, 'thread_num' => 0, 'post_num' => 0, 'person_num' => 0, 'setting_basic_stat' => ''); $res['rs'] = 1; } else { $res = array('rs' => 0, 'errcode' => '01010000'); } echo WebUtils::jsonEncode($res); }
<div class="col-xs-9 double-div"> <div class="row"> <?php if ($vv['board_img']) { ?> <div class="col-xs-2"> <div class="board-img"> <img src="<?php echo $vv['board_img']; ?> " class="board-img-set"> </div> </div> <div class="col-xs-10 one-div"> <p><?php echo WebUtils::subString($vv['board_name'], 0, 7, 'utf-8'); ?> </p> <p><?php echo '最近更新:' . date("m-d", $vv['last_posts_date'] ? str_replace('000', '', $vv['last_posts_date']) : time()); ?> </p> </div> <?php } else { ?> <div class="col-xs-12 one-div"> <p><?php echo $vv['board_name']; ?> </p>
/** * 获取主题摘要(内容摘要以及图片) * * @param int $tid 帖子id * @param string $type forum为论坛模块,portal为门户模块 * @param bool $transBr 是否要转换换行 * @param array $options 参数选项, 可选值: array('imageList' => 1, 'imageListLen' => 9, 'imageListThumb' => 1) * @return array array('msg' => '', 'image' => '', 'imageList' => array()) */ public static function getTopicSummary($tid, $type = 'forum', $transBr = true, $options = array()) { $summary = array('msg' => '', 'image' => '', 'imageList' => array()); $summaryLength = WebUtils::getDzPluginAppbymeAppConfig($type == 'forum' ? 'forum_summary_length' : 'portal_summary_length'); $allowImage = WebUtils::getDzPluginAppbymeAppConfig($type == 'forum' ? 'forum_allow_image' : 'portal_allow_image'); $allowImage = !($allowImage === '0'); if ($summaryLength === '0' && !$allowImage) { return $summary; } $content = self::getTopicContent($tid); if (!empty($content['main'])) { $msg = ''; $isFindImage = false; $isFindImageList = false; $getImageList = isset($options['imageList']) ? $options['imageList'] : 0; $imageListLen = isset($options['imageListLen']) ? $options['imageListLen'] : 9; $imageListThumb = isset($options['imageListThumb']) ? $options['imageListThumb'] : 1; $imageListCount = 0; foreach ($content['main'] as $line) { if ($line['type'] == 'image' && !$isFindImageList) { $imageListCount++; if ($allowImage) { !$isFindImage && ($summary['image'] = $line['content']); if ($getImageList && !$isFindImageList) { $imageListThumb && ($line['content'] = ImageUtils::getThumbImage($line['content'])); $summary['imageList'][] = $line['content']; } } $isFindImage = true; !$getImageList && ($isFindImageList = true); $imageListCount == $imageListLen && ($isFindImageList = true); } if ($line['type'] == 'text') { $msg .= $line['content'] . "\r\n"; } } $msg = preg_replace('/\\[mobcent_phiz=.+?\\]/', '', $msg); $msg = preg_replace(WebUtils::t('/本帖最后由 .*? 于 .*? 编辑/'), '', $msg); $transBr && ($msg = WebUtils::emptyReturnLine($msg, ' ')); $msg = trim($msg); $summaryLength === false && ($summaryLength = 40); $summary['msg'] = (string) WebUtils::subString($msg, 0, $summaryLength); } return $summary; }
$component['type'] = 'postlist'; ?> <div class="content-list-ui content-list-add"> <div class="list-group"> <?php foreach ($info['list'] as $k => $v) { ?> <div class="uidiy-mobileui-component" data-component-data="<?php echo rawurlencode(WebUtils::jsonEncode($component, 'utf-8')); ?> " style="height:95px;padding-left: 10px;border-bottom: 1px solid #C9C9C9;margin-top:8px;"> <h5 class="list-group-item-heading text-left"> <?php echo WebUtils::subString($v['title'], 0, 22, 'utf-8'); ?> </h5> <div> <?php if ($v['pic_path']) { ?> <img src="<?php echo str_replace('xgsize', 'mobcentSmallPreview', $v['pic_path']); ?> " class="pull-right img-rounded img-set"> <p class="list-group-item-text pull-left text-left" style="width:260px;"><?php echo $v['subject']; ?> </p> <?php
foreach ($newInfo as $key => $component) { $icon = $component['icon']; ?> <div class="news-component-item list-group-item uidiy-mobileui-component" data-component-data="<?php echo rawurlencode(WebUtils::jsonEncode($component, 'utf-8')); ?> "> <div class="pull-left"><img src="<?php echo $icon; ?> " style="width:50px;height:50px" class="img-rounded"></div> <div class="pull-left text-left page-main"> <div class="page-title"><strong><?php echo $component['title']; ?> </strong></div> <div class="page-content"><?php echo WebUtils::subString($component['desc'], 0, 26, 'utf-8'); ?> </div> </div> <div class="pull-right"> <span class="pull-right glyphicon glyphicon-chevron-right"></span> </div> </div> <?php } ?> </div> </div>
?> </div> </div> <?php } else { ?> <div class="uidiy-mobileui-component" data-component-data="<?php echo rawurlencode(WebUtils::jsonEncode($component, 'utf-8')); ?> " style="width:40%;height:110px;float: left;padding-left:50px;"> <div> <img style="width:70px;height: 70px;" src="<?php echo $this->getComponentIconUrl($icon); ?> "> </div> <div style="height: 30px;padding-top:5px;"><?php echo WebUtils::subString($component['title'], 0, 6, 'utf-8'); ?> </div> </div> <?php } } } } } ?> </div> </div>
<?php } ?> <?php } ?> <?php } ?> <?php if ($customStyle['extParams']['styleHeader']['isShow'] == 1 && $customStyle['extParams']['styleHeader']['position'] == 0) { ?> <div class="custom-style-title"> <p class="pull-left"><?php echo WebUtils::subString($customStyle['extParams']['styleHeader']['title'], 0, 15, 'UTF-8'); ?> </p> <?php if ($customStyle['extParams']['styleHeader']['isShowMore'] == 1) { ?> <p class="pull-right moreComponent uidiy-mobileui-component" data-component-data="<?php echo rawurlencode(WebUtils::jsonEncode($customStyle['extParams']['styleHeader']['moreComponent'], 'utf-8')); ?> ">更多</p> <?php } ?> </div> <?php }
<img class="pull-left select-topbar-btn uidiy-mobileui-component" data-component-data="<?php echo rawurlencode(WebUtils::jsonEncode($leftTopbars, 'utf-8')); ?> " src="<?php echo $this->getComponentIconUrl($leftTopbars['icon']); ?> "> <?php } ?> <?php } ?> <span><?php echo WebUtils::subString($module['title'], 0, 10); ?> </span> <?php foreach ($module['rightTopbars'] as $rightTopbars) { ?> <?php if ($rightTopbars['type'] == AppbymeUIDiyModel::COMPONENT_TYPE_WEATHER) { ?> <img class="pull-right select-topbar-btn uidiy-mobileui-component" data-component-data="<?php echo rawurlencode(WebUtils::jsonEncode($rightTopbars, 'utf-8')); ?> " src="<?php echo $this->rootUrl; ?>
private function _transContent($content) { $msg = ''; if (!empty($content)) { foreach ($content as $line) { if ($line['type'] == 'text') { $msg .= $line['content'] . "\r\n"; } } $msg = preg_replace('/\\[mobcent_phiz=.+?\\]/', '', $msg); $length = Yii::app()->params['mobcent']['forum']['post']['summaryLength']; $msg = WebUtils::subString($msg, 0, $length); } return $msg; }