目前仅支持youku、tudou、ku6网站的缩略图,具体修改步骤如下:
1 修改source/cp_share.php
1.1 修改408行起以下内容
if(preg_match("/(youku.com|youtube.com|5show.com|ku6.com|sohu.com|mofile.com|sina.com.cn)$/i", $parseLink['host'], $hosts)) {
$flashvar = getflash($link, $hosts[1]);
if(!empty($flashvar)) {
$arr['title_template'] = cplang('share_video');
$type = 'video';
$arr['body_data']['flashvar'] = $flashvar;
$arr['body_data']['host'] = $hosts[1];
}
}
修改为:
if(preg_match("/(youku.com|youtube.com|5show.com|ku6.com|sohu.com|mofile.com|sina.com.cn|tudou.com)$/i", $parseLink['host'], $hosts)) {
$flashvar = getflash($link, $hosts[1]);
$flashimg = getflashimg($link, $hosts[1]);
if(!empty($flashvar)) {
$arr['title_template'] = cplang('share_video');
$type = 'video';
$arr['body_data']['flashvar'] = $flashvar;
$arr['body_data']['host'] = $hosts[1];
if(!empty($flashimg)){
$arr['image'] = $flashimg;
}
}
}
1.2 找到这个函数:
function getflash($link, $host) {
$return = '';
if('youku.com' == $host) {
preg_match_all("/id\_(\w+)[=.]/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('ku6.com' == $host) {
preg_match_all("/\/([\w\-]+)\.html/", $link, $matches);
if(1 > preg_match("/\/index_([\w\-]+)\.html/", $link) && !empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('youtube.com' == $host) {
preg_match_all("/v\=([\w\-]+)/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('5show.com' == $host) {
preg_match_all("/\/(\d+)\.shtml/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('mofile.com' == $host) {
preg_match_all("/\/(\w+)\/*$/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('sina.com.cn' == $host) {
preg_match_all("/\/(\d+)-(\d+)\.html/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('sohu.com' == $host) {
preg_match_all("/\/(\d+)\/*$/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
}
return $return;
}
修改为:
function getflash($link, $host) {
$return = '';
if('youku.com' == $host) {
preg_match_all("/id\_(\w+)[=.]/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('ku6.com' == $host) {
preg_match_all("/\/([\w\-]+)\.html/", $link, $matches);
if(1 > preg_match("/\/index_([\w\-]+)\.html/", $link) && !empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('youtube.com' == $host) {
preg_match_all("/v\=([\w\-]+)/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('5show.com' == $host) {
preg_match_all("/\/(\d+)\.shtml/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('mofile.com' == $host) {
preg_match_all("/\/([\w\-]+)\.shtml/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('sina.com.cn' == $host) {
preg_match_all("/\/(\d+)-(\d+)\.html/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('sohu.com' == $host) {
preg_match_all("/\/(\d+)\/*$/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
} elseif('tudou.com' == $host) {
preg_match_all("/\/([\w\-]+)\/*$/", $link, $matches);
if(!empty($matches[1][0])) {
$return = $matches[1][0];
}
}
return $return;
}
function getflashimg($link, $host) {
$return='';
$content = file_get_contents($link);
if('tudou.com' == $host){
preg_match_all("/<span class=\"s_pic\">(.*?)<\/span>/i",$content,$img);
} elseif('youku.com' == $host){
preg_match_all("/\+0800\|(.*?)\|\">/i",$content,$img);
}elseif('ku6.com' == $host){
preg_match_all("/<span class=\"s_pic\">(.*?)<\/span>/i",$content,$img);
}elseif('mofile.com' == $host){
preg_match_all("/thumbpath=\"(.*?)\";/i",$content,$img);
}
$img = $img[1][0];
if($img){
$return = $img;
}
return $return;
}
上面同时修改了mofile视频的bug,增加了支持土豆视频。
2. 修改模板文件space_share_li.htm
2.1 找到(大约15行):
<!--{if $value['image']}-->
<a href="$value[image_link]"><img src="$value[image]" class="summaryimg image" alt="" width="70" /></a>
<!--{/if}-->
修改为:
<!--{if $value['image'] && 'video'!=$value['type']}-->
<a href="$value[image_link]"><img src="$value[image]" class="summaryimg image" alt="" width="70" /></a>
<!--{/if}-->
2.2 找到(22行左右):
<div class="media">
<img src="image/vd.gif" alt="点击播放" onclick="javascript:showFlash('{$value['body_data']['host']}', '{$value['body_data']['flashvar']}', this, '{$value['sid']}');" style="cursor:pointer;" />
</div>
修改为:
<div class="media">
<img src="<!--{if !empty($value['image'])}-->$value[image]<!--{else}-->/image/vd.gif<!--{/if}-->" alt="点击播放" style="cursor:pointer;" onclick="javascript:showFlash('{$value['body_data']['host']}', '{$value['body_data']['flashvar']}', this, '{$value['sid']}');" />
</div>
以上借用了feed表中的image字段,免得修改表结构了
3 修改space_feed_li.htm
3.1 找到大约27行:
<!--{if $value['image_1']}-->
<a href="$value[image_1_link]"{$value[target]}><img src="$value[image_1]" class="summaryimg" /></a>
<!--{/if}-->
修改为:
<!--{if $value['image_1'] && empty($value['body_data']['flashvar'])}-->
<a href="$value[image_1_link]"{$value[target]}><img src="$value[image_1]" class="summaryimg" /></a>
<!--{/if}-->
3.2 feed页显示缩略图在大约48行找到
<div class="media">
<img src="image/vd.gif" alt="点击播放" onclick="javascript:showFlash('{$value['body_data']['host']}', '{$value['body_data']['flashvar']}', this, '{$value['feedid']}');" style="cursor:pointer;" />
</div>
修改为
<div class="media">
<img src="<!--{if !empty($value['image_1'])}-->$value[image_1]<!--{else}-->/image/vd.gif<!--{/if}-->" alt="点击播放" onclick="javascript:showFlash('{$value['body_data']['host']}', '{$value['body_data']['flashvar']}', this, '{$value['feedid']}');" style="cursor:pointer;" />
</div>
4. 最后修改source/script_common.js,否则点击视频缩略图的时候无法播放
找到334行
在var flashAddr = {}中添加:
'tudou.com' : 'http://www.tudou.com/v/FLASHVAR/',

清风闲客
- 粉丝: 118
最新资源
- 软件项目上线发布流程.doc
- 网络安全公司排名2022-2023-2022-2023年全国大学生网络安全知识竞赛单选题试题有答案.docx
- 2023年语言程序设计知识点总结.doc
- 太原理工大学软件学院算法设计与分析复习题目及答案(最新整理).pdf
- 整个项目管理表格大全.doc
- 工程施工项目管理考核质量管理及工程质量过程考核表.doc
- 项目管理(20211102050346)[最终版].pdf
- 宏基(台湾)计算机公司案例(1).pptx
- 任务二-S7-200-PLC编程实训.doc
- 网络对知识产权的影响和对策.doc
- (源码)基于LoRaWAN网关的公共照明监测管理系统.zip
- 通信工程高风险作业施工安全操作指引设备类.doc
- 智慧城市智慧应用系列方案-33页.pdf
- 网络视频监控关键技术的发展探讨.docx
- 西安航天基地云计算产业发展规划.doc
- 周苗网络营销学习总结.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


