Skip to content

Commit 373c813

Browse files
committedNov 8, 2018
Added Translation System
You can change your language in "lang.conf.php" and you can add/edit translations in "lang/lang.LANG.php".
1 parent 4e12fb8 commit 373c813

15 files changed

+920
-463
lines changed
 

‎ajax/ajax.php

+116-113
Large diffs are not rendered by default.

‎ajax/autocomplete.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
2+
require_once "../lang.conf.php";
3+
24
if(is_array($_GET)&&count($_GET)>0&&isset($_GET["q"])){
35
$q=$_SERVER["QUERY_STRING"];
46
}else{
57
exit();
68
}
79

8-
$url='https://suggestqueries.google.com/complete/search?hl=zh-CN&ds=yt&client=youtube&hjson=t&cp=1&'.$q;
10+
$url='https://suggestqueries.google.com/complete/search?hl='.$lang['YT_LANG'].'&ds=yt&client=youtube&hjson=t&cp=1&'.$q;
911
if (!function_exists("curl_init")) {
1012
$f = file_get_contents($url);
1113
} else {
@@ -19,4 +21,4 @@
1921
curl_close($ch);
2022
}
2123
echo $f;
22-
?>
24+
?>

‎channel.php

+32-29
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<?php
2+
3+
require_once "lang.conf.php";
4+
25
if(!is_array($_GET)&&count($_GET)<=0){
36
exit();
47
}
58
include("./lib.php");
69
$channel=get_channel_info($_GET['channelid'],APIKEY);
710
$headtitle=$channel['items'][0]['snippet']['title'].'-'.SITE_NAME;
8-
include("./header.php");
11+
include("./header.php");
912
if(isset($_GET['pageToken'])){$ptk=$_GET["pageToken"];} else {$ptk='';}
1013
?>
1114
<div class="bg1" style="background: url(./thumbnail.php?type=banner&vid=<?php echo $channel['items'][0]['id'] ?>);background-repeat: no-repeat;background-position: center center;background-size: cover;" >
12-
<div class="touxiang">
15+
<div class="touxiang">
1316
<div id="bg2">
1417
<div id="bg3" style="border-radius: 100%;background: url(./thumbnail.php?type=photo&vid=<?php echo $channel['items'][0]['id'] ?>) center no-repeat;background-size: cover;"> </div></div>
1518
<div class="container pt-2">
16-
19+
1720
<div id="bg4" class="txt2"><?php echo $channel['items'][0]['snippet']['title'] ?></div>
18-
21+
1922
<p class="kkkkkk pb-1 text-center" style="color: white;">
2023
<?php
2124
if(!empty($channel['items'][0]['snippet']['description'])){echo $channel['items'][0]['snippet']['description'];}else{echo '这个家伙很懒,什么也没留下...';}?>
@@ -27,67 +30,67 @@
2730
truncate: 1,
2831
showText: '<i class="fa d-inline fa-2x fa-angle-down shangico"></i>',
2932
hideText: '<i class="fa d-inline fa-2x fa-angle-up shangico"></i>',
30-
});
33+
});
3134
});
3235
</script>
33-
34-
</div>
36+
37+
</div>
3538
</div>
3639
<div class="bg10"></div>
3740
</div>
38-
41+
3942
<div class="container pt-2">
4043
<div class="py-2">
4144
<div class="row">
4245
<div class="container">
43-
44-
45-
46+
47+
48+
4649
<div class="row equipo-item">
4750
<div class="col-md-4 col-sm-12 col-xs-12 col-lg-4 equipodiv order-md-1 order-lg-1 order-xs-2 order-sm-2">
4851
<div class="related">
49-
<p class="font-weight-bold h6 pb-1">频道信息</p>
50-
<span class="d-block py-3 fa fa-calendar"> 注册于<?php echo date("Y-m-d", strtotime($channel['items'][0]['snippet']['publishedAt']));?></span>
51-
<span class="d-block py-3 fa fa-play"> <?php echo $channel['items'][0]['statistics']['viewCount']?>次观看</span>
52-
<span class="d-block py-3 fa fa-user-circle-o"> <?php echo $channel['items'][0]['statistics']['subscriberCount']?>位订阅者</span>
53-
<span class="d-block py-3 fa fa-globe"> 来自<?php if (array_key_exists('country',$channel['items'][0]['snippet'])) {echo get_country($channel['items'][0]['snippet']['country']);} else {echo '火星';}?></span>
52+
<p class="font-weight-bold h6 pb-1"><?php echo $lang['CHANEL_M2']?></p>
53+
<span class="d-block py-3 fa fa-calendar"> <?php echo $lang['CHANEL_M3']?><?php echo date("Y-m-d", strtotime($channel['items'][0]['snippet']['publishedAt']));?></span>
54+
<span class="d-block py-3 fa fa-play"> <?php echo $channel['items'][0]['statistics']['viewCount']?><?php echo $lang['CHANEL_M4']?></span>
55+
<span class="d-block py-3 fa fa-user-circle-o"> <?php echo $channel['items'][0]['statistics']['subscriberCount']?><?php echo $lang['CHANEL_M5']?></span>
56+
<span class="d-block py-3 fa fa-globe"> <?php echo $lang['CHANEL_M6']?><?php if (array_key_exists('country',$channel['items'][0]['snippet'])) {echo get_country($channel['items'][0]['snippet']['country']);} else {echo $lang['CHANEL_M6B'];}?></span>
5457

5558
</div>
5659
<div class="related text-nowrap">
57-
<p class="font-weight-bold h6 pb-1">相关频道</p>
60+
<p class="font-weight-bold h6 pb-1"><?php echo $lang['CHANEL_M7']?></p>
5861
<?php
5962
$xg=get_related_channel($channel['items'][0]['id']);
6063
foreach ($xg as $v) {
6164
echo '<span class="d-block">
62-
65+
6366
<a href="./channel.php?channelid='.$v['id'].'" target="_blank"> <img src="./thumbnail.php?type=photo&amp;vid='.$v['id'].'" class="txlistimg"></a>
64-
65-
<a href="./channel.php?channelid='.$v['id'].'" target="_blank" title="'.$v['name'].'"class="text-dark txlist">
67+
68+
<a href="./channel.php?channelid='.$v['id'].'" target="_blank" title="'.$v['name'].'"class="text-dark txlist">
6669
'.$v['name'].'</a>
67-
70+
6871
</span>';
6972
}
7073
?>
7174

7275
</div>
7376
</div>
7477
<div class="col-md-8 col-sm-12 col-xs-12 col-lg-8 related order-md-2 order-lg-2 order-xs-1 order-sm-1">
75-
<div class="font-weight-bold h6 pb-1">全部视频(<?php echo $channel['items'][0]['statistics']['videoCount'] ?>个)</div>
78+
<div class="font-weight-bold h6 pb-1"><?php echo $lang['CHANEL_M8']?><?php echo $channel['items'][0]['statistics']['videoCount'] ?>个)</div>
7679
<div id="videocontent"></div>
7780
<script>$("#videocontent").load('<?php echo './ajax/ajax.php?channelid='.$_GET['channelid'].'&type=channels&ptk='.$_GET['pageToken']?>');</script>
7881
</div>
7982
</div>
8083

81-
82-
84+
85+
8386
</div>
8487
</div>
85-
88+
8689
</div>
8790
</div>
88-
89-
91+
92+
9093
</div>
9194
<?php
92-
include("./footer.php");
93-
?>
95+
include("./footer.php");
96+
?>

‎content.php

+22-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
<?php
1+
<?php
2+
require_once "lang.conf.php";
23
include "./lib.php";
34
$cont = $_GET['cont'];
45
$ptk = $_GET['pageToken'];
56
$sortid = $_GET['sortid'];
67
$order = isset($_GET['order']) ? $_GET['order'] : 'relevance';
78
switch ($cont) {
89
case 'history':
9-
$headtitle='历史记录-油桶';
10+
$headtitle=$lang['CONTENT_T_HIST'];
1011
break;
1112
case 'category':
1213
$headtitle=categorieslist($sortid).'-'.SITE_NAME;
1314
break;
1415
case 'trending':
15-
$headtitle='时下流行'.'-'.SITE_NAME;
16+
$headtitle=$lang['CONTENT_T_TREND'].'-'.SITE_NAME;
1617
break;
1718
case 'DMCA':
18-
$headtitle='DMCA'.'-'.SITE_NAME;
19+
$headtitle=$lang['CONTENT_T_DMCA'].'-'.SITE_NAME;
1920
break;
2021
case 'video':
21-
$headtitle='视频下载工具'.'-'.SITE_NAME;
22+
$headtitle=$lang['CONTENT_T_VID'].'-'.SITE_NAME;
2223
break;
2324
case 'api':
24-
$headtitle='API油桶'.'-'.SITE_NAME;
25+
$headtitle=$lang['CONTENT_T_API'].'-'.SITE_NAME;
2526
break;
2627

2728
}
@@ -35,7 +36,7 @@
3536
<div class="col-4"><a class="navbar-brand topbara" href="./"><i class="fa d-inline fa-lg fa-home txt-topbar"></i></a></div>
3637
<div class="col-4"><a class="navbar-brand topbara" href="./content.php?cont=trending"><i class="fa d-inline fa-lg fa-fire text-white"></i></a></div>
3738
<div class="col-4"><a class="navbar-brand topbara" href="./content.php?cont=history"><i class="fa d-inline fa-lg fa-history txt-topbar"></i></a></div>
38-
</div>
39+
</div>
3940
</div>
4041
</div>';
4142
}elseif ($cont=="history") {
@@ -45,7 +46,7 @@
4546
<div class="col-4"><a class="navbar-brand topbara" href="./"><i class="fa d-inline fa-lg fa-home txt-topbar"></i></a></div>
4647
<div class="col-4"><a class="navbar-brand topbara" href="./content.php?cont=trending"><i class="fa d-inline fa-lg fa-fire txt-topbar"></i></a></div>
4748
<div class="col-4"><a class="navbar-brand topbara" href="./content.php?cont=history"><i class="fa d-inline fa-lg fa-history text-white"></i></a></div>
48-
</div>
49+
</div>
4950
</div>
5051
</div>';
5152
}
@@ -59,22 +60,22 @@
5960
<script>$("#menu").load('<?php echo './ajax/ajax.php?type=menu' ?>');</script>
6061
</div>
6162
<div class="col-md-9 relatedlist">
62-
<?php
63+
<?php
6364
switch ($cont) {
6465
case 'history':
6566
echo '<div id="history"></div>
6667
<script>
6768
$("#history").load(\'./ajax/ajax.php?type=history\');
6869
</script>';
6970
break;
70-
71+
7172
case 'DMCA':
7273
echo '<div id="DMCA"></div>
7374
<script>
7475
$("#DMCA").load(\'./ajax/ajax.php?type=DMCA\');
7576
</script>';
7677
break;
77-
78+
7879
case 'api':
7980
echo '<div id="api"></div>
8081
<script>
@@ -88,14 +89,14 @@
8889
echo '$("#videos").load(\'./ajax/ajax.php?type=videos'.$g.'\');
8990
</script>';
9091
break;
91-
92+
9293
case 'trending':
9394
echo '<div id="videocont"></div>
9495
<script>
9596
$("#videocont").load(\'./ajax/ajax.php?type=trendinglist&ptk=' . $ptk . '\');
9697
</script>';
9798
break;
98-
99+
99100
case 'category':
100101
switch ($order) {
101102
case 'date':
@@ -107,21 +108,21 @@
107108
default:
108109
$relevance = 'selected';
109110
}
110-
111+
111112
if(isset($_GET['sortid'])){echo '<div class="font-weight-bold h6 pb-1">'.categorieslist($sortid).'</div> ';}
112113
echo '<div class="row"> <div class="col-md-12 selectalign pb-3"><select class="custom-select" id="paixu">';
113-
echo '<option '. $relevance .' data-url="./ajax/ajax.php?type=category&sortid='.$sortid.'&ptk='.$ptk.'">热门视频</option>';
114-
echo '<option ' . $date1 .' data-url="./ajax/ajax.php?type=category&sortid='.$sortid.'&order=date&ptk='.$ptk.'">最新发布</option>';
115-
echo '<option ' . $viewCount .' data-url="./ajax/ajax.php?type=category&sortid='.$sortid.'&order=viewCount&ptk='.$ptk.'">最多点击</option>';
114+
echo '<option '. $relevance .' data-url="./ajax/ajax.php?type=category&sortid='.$sortid.'&ptk='.$ptk.'">'.$lang['CONTENT_OPT1'].'</option>';
115+
echo '<option ' . $date1 .' data-url="./ajax/ajax.php?type=category&sortid='.$sortid.'&order=date&ptk='.$ptk.'">'.$lang['CONTENT_OPT2'].'</option>';
116+
echo '<option ' . $viewCount .' data-url="./ajax/ajax.php?type=category&sortid='.$sortid.'&order=viewCount&ptk='.$ptk.'">'.$lang['CONTENT_OPT3'].'</option>';
116117
echo '</select></div></div>';
117118
echo '<div id="videocont"></div><script>$("#videocont").load(\'./ajax/ajax.php?type=category&sortid='. $sortid .'&order='.$order.'&ptk='.$ptk.'\');$(\'#paixu\').on(\'change\', function() {loadPage($(this).find(\':selected\').data(\'url\'));});function loadPage(url) {$("#videocont").load(url);}</script>';
118119
break;
119-
120+
120121
}?>
121-
122+
122123
</div>
123-
124+
124125
</div>
125126
</div>
126127

127-
<?php include "./footer.php";?>
128+
<?php include "./footer.php";?>

‎embed/upgrade.php

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
<?php
2+
require_once "../lang.conf.php";
3+
?>
4+
15
<!DOCTYPE html>
26
<html>
37
<head>
48
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
5-
<title>检查更新</title>
9+
<?php
10+
echo '<title>'.$lang['UPGRADE_TITLE'].'</title>';
11+
?>
612
</head>
713
<body>
814
<?php
@@ -18,15 +24,15 @@
1824
curl_close($ch);
1925
$up=json_decode($f,true);
2026
if ( (int)$up['time'] > (int)$Posttime ) {
21-
22-
echo '本程序已经有最新版本,请升级!</br>';
23-
echo '当前版本:v'.$version.'</br>';
24-
echo '最新版本:v'.$up['version'].'</br>';
25-
echo '请从本地址下载最新版:<a href="'.$up['links'].'" target="_blank">'.$up['links'].'</a></br>';
26-
echo '更新内容:'.$up['des'];
27+
28+
echo $lang['UPGRADE_M1'].'</br>';
29+
echo $lang['UPGRADE_M2'].$version.'</br>';
30+
echo $lang['UPGRADE_M3'].$up['version'].'</br>';
31+
echo $lang['UPGRADE_M4'].'<a href="'.$up['links'].'" target="_blank">'.$up['links'].'</a></br>';
32+
echo $lang['UPGRADE_M5'].$up['des'];
2733
} else{
28-
echo '本程序已经是最新版,无需升级!';
34+
echo $lang['UPGRADE_OK'];
2935
}
30-
?>
36+
?>
3137
</body>
32-
</html>
38+
</html>

‎error.php

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
2+
3+
require_once "lang.conf.php";
4+
25
header("HTTP/1.0 404 Not Found");
3-
$headtitle='错误提示!';
6+
$headtitle=$lang['ERROR_HTITLE'];
47
include("./header.php");?>
58

69
<div class="container-fluid" style="height: 480px;
@@ -9,21 +12,21 @@
912
<div class="row" style="height: 100%">
1013
<div class="col-12 justify-content-center align-self-center text-center">
1114
<img src="//wx3.sinaimg.cn/large/b0738b0agy1fm04l0cw4ej203w02s0sl.jpg" class="p-2" >
12-
<h2>请求的内容不存在!</h2>
13-
<p>非常抱歉,您请求的内容未能呈现!</p>
14-
<p>可能原因:</p>
15-
<p>1.你输入的链接地址有误!</p>
16-
<p>2.视频为版权内容(本站无法解析版权内容!)</p>
17-
<p>3.该视频不存在。</p>
18-
<p>4.网站服务器错误。</p>
15+
<h2><?php echo $lang['ERROR_T']?></h2>
16+
<p><?php echo $lang['ERROR_M1']?></p>
17+
<p><?php echo $lang['ERROR_M2']?></p>
18+
<p><?php echo $lang['ERROR_M3']?></p>
19+
<p><?php echo $lang['ERROR_M4']?></p>
20+
<p><?php echo $lang['ERROR_M5']?></p>
21+
<p><?php echo $lang['ERROR_M6']?></p>
1922
</div>
2023

2124
</div>
2225
</div>
23-
26+
2427
</div>
2528

2629

2730
<?php
28-
include("./footer.php");
29-
?>
31+
include("./footer.php");
32+
?>

0 commit comments

Comments
 (0)
Please sign in to comment.