Authored by 2586703@qq.com

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohood into develop

... ... @@ -132,7 +132,7 @@ define('mobile', function(require, exports) {
$('.search-wrap input').focus().addClass('hasVal');
});
//获取所有品牌
$(".all_brand").live("tap", function() {
$(".all_brand").live("click", function() {
$("input[type='text']").val("");
getBrand();
});
... ... @@ -198,17 +198,17 @@ define('mobile', function(require, exports) {
share.init({
shareUrl: shareUrl,
img: shareCover,
sinaText: '【YOHOOD 2015】' + detailTitle.text() + '\r\n' + detailSubtitle.text() + '@YOHO潮流志',
sinaText: '【YOHOOD 2015】' + detailTitle.text() + '@YOHO潮流志',
fbTextFunction: function() {
return {
des: '【YOHOOD 2015】' + detailTitle.text() + '\r\n' + detailSubtitle.text(),
name: '【YOHOOD 2015】' + detailTitle.text() + '\r\n' + detailSubtitle.text(),
caption: '【YOHOOD 2015】' + detailTitle.text() + '\r\n' + detailSubtitle.text(),
des: '【YOHOOD 2015】' + detailTitle.text(),
name: '【YOHOOD 2015】' + detailTitle.text(),
caption: '【YOHOOD 2015】' + detailTitle.text(),
url: location.href
}
},
tweetText: '【YOHOOD 2015】' + detailTitle.text() + '\r\n' + detailSubtitle.text(),
qqText: '【YOHOOD 2015】' + detailTitle.text() + ' ' + detailSubtitle.text() + '#YOHOOD 2015'
tweetText: '【YOHOOD 2015】' + detailTitle.text(),
qqText: '【YOHOOD 2015】' + detailTitle.text() + '#YOHOOD 2015'
});
};
... ...
... ... @@ -111,7 +111,7 @@ class Config_Defines
// 静态资源目录
define('SITE_RES', 'http://res.test.yohood.yoho.cn');
// 主站
define('SITE_MAIN', 'http://yohobuy.yohobuy.com');
define('SITE_MAIN', 'http://yohood.yohobuy.com');
define('QINIU_UPLOAD_STATE', true);
define('QINIU_UPLOAD_CLASS', 'Lib_Utils_QiniuUpload');
define('QINIU_UPLOAD_ACCESSKEY', 'cY9B5ZgON_7McTS5zV5nTeRyQ98MOcVD7W4eGVbE');
... ...
... ... @@ -719,7 +719,45 @@ class Lib_Utils_StringHelper
$ar [$k] = iconv ( "UCS-2", "UTF-8", pack ( "H4", substr ( $v, - 4 ) ) );
return join ( "", $ar );
}
/**
* 截取完整英文
*
* @param string $string
* @param int $length
* @param $etc
* @return string
*/
public static function substr_full_en($string, $length = 280, $etc = '...')
{
$chars = $string;
$tmp = $i = $n = $m = $l = 0;
$length /= 2;
if (mb_strwidth ( $string , 'UTF-8' ) <= $length)
return $string;
do
{
if (preg_match ("/[0-9a-zA-Z]/", @$chars[$i])) //纯英文
{
$m++;
$tmp++;
}
else //非英文字节
{
$n++;
$tmp = 0;
}
$k = $n/3 + $m/2;
$l = $n/3 + $m;//最终截取长度;$l = $n/3+$m
$i++;
} while($k < $length);
if(preg_match ("/[0-9a-zA-Z]/", @$chars[$i-1]))//英文是不是完整的
{
$l = $l- $tmp;
}
return mb_substr($string, 0, $l,'utf-8').$etc;//保证不会出现乱码
}
/**
* 获取货币
*
... ...
... ... @@ -16,8 +16,11 @@
</ul>
</div>
<div class="scene-content">
<div class="main-layout current clearfix">
<?php foreach($this->view->topics as $topic):?>
<?php if($this->view->currentday>time()):?>
<img src="<?php echo SITE_RES.'/images/yohood/comingsoon.jpg';?>" style="width:100%;"/>
<?php else:?>
<div class="main-layout current clearfix">
<?php foreach($this->view->topics as $topic):?>
<div class="layout-section current">
<div class="scene-title">
<h4 class="scene-intro"><span></span><?php echo $topic['title'];?></h4>
... ... @@ -42,9 +45,12 @@
</div>
<?php endforeach;?>
</div>
<?php endforeach;?>
</div>
<?php endforeach;?>
</div>
<?php endif;?>
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<script type="text/javascript">
... ...
... ... @@ -19,7 +19,7 @@
<div class="post-list main-layout">
<div class="layout-item tiled">
<div class="image-box">
<a href="<?php echo url('news/detail',array('id' => $val['id']))?>" title="<?php echo $val['title']?>">
<a href="<?php echo url('news/detail',array('id' => $val['id']))?>" title="<?php echo $val['title']?>" target="_blank">
<img src="<?php echo Lib_Images::getImageUrl($val['thumb'],'0230x0230','fragmentimg');?>" alt="" style="height:230px;width:230px;">
<?php if(trim($val['tag']) == '视频'):?>
<i class="play-icon"></i>
... ... @@ -28,7 +28,7 @@
</div>
<div class="content">
<h2 <?php echo $val['main_title_type'] == 1 ? 'class="volupia"':'';?>>
<a href="<?php echo url('news/detail',array('id' => $val['id']))?>">
<a href="<?php echo url('news/detail',array('id' => $val['id']))?>" target="_blank">
<?php echo Util_StringHelper::substr_cn($val['title'], 46);?>
</a>
</h2>
... ...
... ... @@ -43,7 +43,33 @@
</div>
<?php endif;?>
<div class="text-body">
<?php echo $this->view->info['content']?>
<?php
if(preg_match('/ipad/i', $_SERVER['HTTP_USER_AGENT']))
{
$temps = $videoMatches = array();
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yoho\.cn\/res\/yohood\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4)\"@", $this->view->info['content'], $videoMatches1);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.test\.yoho\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $this->view->info['content'], $videoMatches2);
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yohood\.cn\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $this->view->info['content'], $videoMatches3);
$temps[] = $videoMatches1;
$temps[] = $videoMatches2;
$temps[] = $videoMatches3;
foreach($temps as $temp)
{
if(!empty($temp[2]))
{
$videoMatches = $temp;
}
}
if(!empty($videoMatches[2]))
{
$video = current($videoMatches[2]);
$videoHtml = '<video controls="controls" preload="auto" poster="'.Lib_Images::getImageUrl($this->view->info['thumb'],'0650x0390','fragmentimg','autoCrop').'" width="660" height="390"><source src="'.$video.'" type="video/mp4" /></video>';
$this->view->info['content'] = preg_replace('@<(object.*?)>(.*?)<(\/object.*?)>@si',$videoHtml, $this->view->info['content']);
$this->view->info['content'] = preg_replace('@<(embed.*?)>@si', $videoHtml, $this->view->info['content']);
}
}
echo $this->view->info['content'];
?>
</div>
<div class="related-post detail-related-post">
<h3>相关推荐</h3>
... ...
<?php foreach($list as $news):
$title = Util_StringHelper::substr_cn($news['title'], 90);
$description = Lib_Utils_StringHelper::substr_cn(Lib_Utils_StringHelper::stripTags($news['content']), 68);
$description = Lib_Utils_StringHelper::substr_full_en(Lib_Utils_StringHelper::stripTags($news['content']), 80);
$height = $width = 0;
$thumb_size = json_decode($news['thumb_size'], true);
if ($news['thumb'])
... ...
<?php foreach($list as $news):
$title = Util_StringHelper::substr_cn($news['title'], 90);
$description = Lib_Utils_StringHelper::substr_cn(Lib_Utils_StringHelper::stripTags($news['content']), 68);
$height = $width = 0;
$description = Lib_Utils_StringHelper::substr_full_en(Lib_Utils_StringHelper::stripTags($news['content']), 72);
$thumb_size = json_decode($news['thumb_size'], true);
if(empty($news['client_thumb']))
{
... ...