detailmobile.php
6.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php $this->_extends('layout/default_layout_mobile');?>
<?php $this->_block('main');?>
<div class="detail-title">
<h2 class="title"><?php echo $this->view->info['title']?></h2>
<h3 class="subtitle"><?php echo date('m月d日 H:i', $this->view->info['create_time'])?></h3>
</div>
<?php if(!empty($this->view->info['pics'])):?>
<div class="slide-main detail-slide">
<div class="slide-box">
<div class="slide-wrap clearfix">
<?php foreach($this->view->info['pics'] as $pic):?>
<div class="box">
<a href="javascript:;">
<img src="<?php echo Lib_Images::getImageUrl($pic, 'source','fragmentimg');?>" alt=""/>
</a>
</div>
<?php endforeach;?>
</div>
</div>
<div class="slide-navigator">
<div class="dib clearfix">
<?php echo '<a href="javascript:;" class="on"></a>'.str_repeat('<a href="javascript:;"></a>', count($this->view->info['pics']) - 1);?>
</div>
</div>
</div>
<?php endif;?>
<div class="detail-article">
<?php
$temps = $videoMatches = array();
@preg_match_all("@<embed([^>]*)\s*src=\"http:\/\/res\.yoho\.cn\/res\/yohood\/swf\/YohoodPlayer\.swf\?url=(.+\.mp4|.+)\"@iU", $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'],'0300x0300','fragmentimg','autoCrop').'" width="300" height="300" style="width:300px;height:300px;display:block;margin:auto;"><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">
<h2>相关推荐</h2>
<ul>
<?php foreach($this->view->news as $news):?>
<li>
<a class="clearfix" href="<?php echo url('news/detail' ,array('id' => $news['id']))?>">
<div class="image-box">
<img src="<?php echo Lib_Images::getImageUrl($news['thumb'], 'source','fragmentimg');?>" alt="">
</div>
<div class="content"><?php echo $news['title'];?></div>
</a>
</li>
<?php endforeach;?>
</ul>
</div>
<br/>
<br/>
<div id="share" class="share" cover-url="<?php
$thumb = empty($this->view->info['client_thumb']) ? $this->view->info['thumb'] : $this->view->info['client_thumb'];
echo Lib_Images::getImageUrl($thumb, 'source','fragmentimg');?>"
desc="<?php echo Lib_Utils_StringHelper::substr_full_en(Lib_Utils_StringHelper::stripTags($this->view->info['content']), 200);?>"
data-link="<?php echo SITE_MAIN.'/news/detail/id/'.$this->view->info['id'];?>">
<ul class="clearfix">
<li class="yohoo-share-button-sina"><a href="javascript:;"></a></li>
<li class="yohoo-share-button-qq"><a href="javascript:;"></a></li>
<li class="yohoo-share-button-facebook"><a href="javascript:;"></a></li>
</ul>
</div>
<script type="text/javascript" charset="utf-8" src="http://staticzine.myoho.net/download/jquery.min.js?v=20150429"></script>
<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<script type="text/javascript">
//初始化config信息
var _weChatInterface = '<?php echo SITE_MAIN;?>/news/getwechatsignpackage';//签名等相关配置,yoho公众号
$.getJSON(_weChatInterface + "?pageurl=" + encodeURIComponent(location.href.split('#')[0]) + "&callback=?", function (json) {
if (json !== undefined && json !== '') {
var _appId = json.appId.toString();
var _timestamp = json.timestamp;
var _nonceStr = json.nonceStr.toString();
var _signature = json.signature.toString();
wx.config({
debug: false,
appId: _appId,
timestamp: _timestamp,
nonceStr: _nonceStr,
signature: _signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
else {
}
});
//构造分享信息
var shareTitle = $('.title').text();
var shareImg = $(".share").attr("cover-url");
var shareDesc = $(".share").attr("desc");
var shareLink = $(".share").attr("data-link");
/*
* 微信分享
*/
wx.ready(function () {
var shareData = {
title: shareTitle,
desc: shareDesc,
imgUrl: shareImg,
link: shareLink
};
// 2.1 “分享给朋友”
wx.onMenuShareAppMessage(shareData);
// 2.2 “分享到朋友圈”
wx.onMenuShareTimeline(shareData);
// 2.3 “分享到QQ”
wx.onMenuShareQQ(shareData);
// 2.4 “分享到微博”
wx.onMenuShareWeibo(shareData);
});
// wx.error(function (res) {
// alert(res.errMsg);
// });
seajs.use('mobile',function(mobile) {
mobile.detail();
});
</script>
<?php $this->_endblock();?>