require_once "lang.conf.php";
include('./lib.php');
if(!is_array($_GET)&&count($_GET)>0){
exit();
}
$videodata=get_video_info($_GET['v'],APIKEY);
$headtitle=$videodata['items']['0']['snippet']['title'].' - '.SITE_NAME;
include("./header.php");
if($videodata['pageInfo']['totalResults'] == '0' && $videodata['pageInfo']['resultsPerPage']== '0'){
header("Location: ./error.php");
exit();
}
//记录历史浏览观看记录
$tt=time()+1814400;
if(!isset($_COOKIE['history'])){
setcookie("history",$videodata['items']['0']['id'], $tt);
}else{
$history=$_COOKIE['history'];
$histmp=explode('@',$history);
//重复的浏览历史只记录最新一次
if (in_array($videodata['items']['0']['id'] ,$histmp)){
$akey=array_search($videodata['items']['0']['id'],$histmp);
unset($histmp[$akey]);
array_unshift($histmp,$videodata['items']['0']['id']);
}else{
array_unshift($histmp,$videodata['items']['0']['id']);
}
//最大观看记录条数,超出的删除
if(count($histmp)==30){
array_pop($histmp);
}
//防止cookies字节溢出
if(count($histmp)==40){
$histmp=array_slice($histmp,20);
}
$histmp1=implode('@',$histmp);
setcookie('history',$histmp1, $tt);
}
?>
<?php echo $videodata['items']['0']['snippet']['title'] ?>
if(!empty($videodata['items']['0']['snippet']['description'])){
preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $videodata['items']['0']['snippet']['description'], $match);
$description=$videodata['items']['0']['snippet']['description'];
foreach ($match[0] as $v) {
$k=''. $v.'';
$description=str_replace($v,$k,$description);
}
echo $description;
} else {
echo $lang['WATCH_M1'];
};
?>
<?php echo $lang['WATCH_CAT']?><?php echo categorieslist($videodata['items']['0']['snippet']['categoryId'])?>
$(function(){
var slideHeight = 60; // px
var defHeight = $('#des').height();
if(defHeight >= slideHeight){
$('#des').css('height' , slideHeight + 'px');
$('#read-more').append('');
$('#read-more').click(function(){
var curHeight = $('#des').height();
if(curHeight == slideHeight){
$('#des').animate({
height: defHeight
}, "normal");
$('#read-more').html('');
$('#gradient').fadeOut();
}else{
$('#des').animate({
height: slideHeight
}, "normal");
$('#read-more').html('');
$('#gradient').fadeIn();
}
return false;
});
}
});
videojs('h5player').videoJsResolutionSwitcher();
$(function () {$('[data-toggle="popover"]').popover()});
include("./footer.php");
?>
一键复制
编辑
Web IDE
原始数据
按行查看
历史