正在显示
5 个修改的文件
包含
172 行增加
和
133 行删除
app/Fun.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +declare(strict_types=1); | ||
4 | + | ||
5 | +namespace App; | ||
6 | + | ||
7 | + | ||
8 | +use Illuminate\Support\Facades\Http; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author:dc | ||
12 | + * @time 2022/11/16 17:48 | ||
13 | + * Class Fun | ||
14 | + * @package App | ||
15 | + */ | ||
16 | +class Fun { | ||
17 | + | ||
18 | + | ||
19 | + /** | ||
20 | + * lang | ||
21 | + * @return string[] | ||
22 | + * @author:dc | ||
23 | + * @time 2022/11/16 14:35 | ||
24 | + */ | ||
25 | + public static function lang() | ||
26 | + { | ||
27 | + return [ | ||
28 | + 'en' => 'English', | ||
29 | + 'fr' => 'French', | ||
30 | + 'de' => 'German', | ||
31 | + 'pt' => 'Portuguese', | ||
32 | + 'es' => 'Spanish', | ||
33 | + 'ru' => 'Russian', | ||
34 | + 'ja' => 'Japanese', | ||
35 | + 'ko' => 'Korean', | ||
36 | + 'ar' => 'Arabic', | ||
37 | + 'ga' => 'Irish', | ||
38 | + 'el' => 'Greek', | ||
39 | + 'tr' => 'Turkish', | ||
40 | + 'it' => 'Italian', | ||
41 | + 'da' => 'Danish', | ||
42 | + 'ro' => 'Romanian', | ||
43 | + 'id' => 'Indonesian', | ||
44 | + 'cs' => 'Czech', | ||
45 | + 'af' => 'Afrikaans', | ||
46 | + 'sv' => 'Swedish', | ||
47 | + 'pl' => 'Polish', | ||
48 | + 'eu' => 'Basque', | ||
49 | + 'ca' => 'Catalan', | ||
50 | + 'eo' => 'Esperanto', | ||
51 | + 'hi' => 'Hindi', | ||
52 | + 'lo' => 'Lao', | ||
53 | + 'sq' => 'Albanian', | ||
54 | + 'am' => 'Amharic', | ||
55 | + 'hy' => 'Armenian', | ||
56 | + 'az' => 'Azerbaijani', | ||
57 | + 'be' => 'Belarusian', | ||
58 | + 'bn' => 'Bengali', | ||
59 | + 'bs' => 'Bosnian', | ||
60 | + 'bg' => 'Bulgarian', | ||
61 | + 'ceb' => 'Cebuano', | ||
62 | + 'ny' => 'Chichewa', | ||
63 | + 'co' => 'Corsican', | ||
64 | + 'hr' => 'Croatian', | ||
65 | + 'nl' => 'Dutch', | ||
66 | + 'et' => 'Estonian', | ||
67 | + 'tl' => 'Filipino', | ||
68 | + 'fi' => 'Finnish', | ||
69 | + 'fy' => 'Frisian', | ||
70 | + 'gl' => 'Galician', | ||
71 | + 'ka' => 'Georgian', | ||
72 | + 'gu' => 'Gujarati', | ||
73 | + 'ht' => 'Haitian', | ||
74 | + 'ha' => 'Hausa', | ||
75 | + 'haw' => 'Hawaiian', | ||
76 | + 'iw' => 'Hebrew', | ||
77 | + 'hmn' => 'Hmong', | ||
78 | + 'hu' => 'Hungarian', | ||
79 | + 'is' => 'Icelandic', | ||
80 | + 'ig' => 'Igbo', | ||
81 | + 'jw' => 'Javanese', | ||
82 | + 'kn' => 'Kannada', | ||
83 | + 'kk' => 'Kazakh', | ||
84 | + 'km' => 'Khmer', | ||
85 | + 'ku' => 'Kurdish', | ||
86 | + 'ky' => 'Kyrgyz', | ||
87 | + 'la' => 'Latin', | ||
88 | + 'lv' => 'Latvian', | ||
89 | + 'lt' => 'Lithuanian', | ||
90 | + 'lb' => 'Luxembou..', | ||
91 | + 'mk' => 'Macedonian', | ||
92 | + 'mg' => 'Malagasy', | ||
93 | + 'ms' => 'Malay', | ||
94 | + 'ml' => 'Malayalam', | ||
95 | + 'mt' => 'Maltese', | ||
96 | + 'mi' => 'Maori', | ||
97 | + 'mr' => 'Marathi', | ||
98 | + 'mn' => 'Mongolian', | ||
99 | + 'my' => 'Burmese', | ||
100 | + 'ne' => 'Nepali', | ||
101 | + 'no' => 'Norwegian', | ||
102 | + 'ps' => 'Pashto', | ||
103 | + 'fa' => 'Persian', | ||
104 | + 'pa' => 'Punjabi', | ||
105 | + 'sr' => 'Serbian', | ||
106 | + 'st' => 'Sesotho', | ||
107 | + 'si' => 'Sinhala', | ||
108 | + 'sk' => 'Slovak', | ||
109 | + 'sl' => 'Slovenian', | ||
110 | + 'so' => 'Somali', | ||
111 | + 'sm' => 'Samoan', | ||
112 | + 'gd' => 'Scots Gaelic', | ||
113 | + 'sn' => 'Shona', | ||
114 | + 'sd' => 'Sindhi', | ||
115 | + 'su' => 'Sundanese', | ||
116 | + 'sw' => 'Swahili', | ||
117 | + 'tg' => 'Tajik', | ||
118 | + 'ta' => 'Tamil', | ||
119 | + 'te' => 'Telugu', | ||
120 | + 'th' => 'Thai', | ||
121 | + 'uk' => 'Ukrainian', | ||
122 | + 'ur' => 'Urdu', | ||
123 | + 'uz' => 'Uzbek', | ||
124 | + 'vi' => 'Vietnamese', | ||
125 | + 'cy' => 'Welsh', | ||
126 | + 'xh' => 'Xhosa', | ||
127 | + 'yi' => 'Yiddish', | ||
128 | + 'yo' => 'Yoruba', | ||
129 | + 'zu' => 'Zulu', | ||
130 | + 'rw' => 'Kinyarwanda', | ||
131 | + 'tt' => 'Tatar', | ||
132 | + 'or' => 'Oriya', | ||
133 | + 'tk' => 'Turkmen', | ||
134 | + 'ug' => 'Uyghur' | ||
135 | + ]; | ||
136 | + } | ||
137 | + | ||
138 | + | ||
139 | + | ||
140 | + /** | ||
141 | + * 翻译 | ||
142 | + * @param $texts | ||
143 | + * @param $tls | ||
144 | + * @return array|mixed | ||
145 | + * @author:dc | ||
146 | + * @time 2022/11/16 17:43 | ||
147 | + */ | ||
148 | + private function translate($texts, $tls){ | ||
149 | + if (is_string($texts)) { | ||
150 | + $texts = [$texts]; | ||
151 | + } | ||
152 | + if (is_string($tls)) { | ||
153 | + $tls = [$tls]; | ||
154 | + } | ||
155 | + $data = [ | ||
156 | + 'texts' => $texts, | ||
157 | + 'sl' => 'en', | ||
158 | + 'tls' => $tls, | ||
159 | + ]; | ||
160 | + $response = Http::post('https://translate.hbb618.cn/translates', $data); | ||
161 | + | ||
162 | + return $response->json(); | ||
163 | + } | ||
164 | + | ||
165 | +} |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | -use Illuminate\Http\Request; | 5 | +use App\Fun; |
6 | use Illuminate\Support\Facades\View; | 6 | use Illuminate\Support\Facades\View; |
7 | 7 | ||
8 | class Index extends Controller | 8 | class Index extends Controller |
@@ -11,7 +11,7 @@ class Index extends Controller | @@ -11,7 +11,7 @@ class Index extends Controller | ||
11 | 11 | ||
12 | public function __construct() | 12 | public function __construct() |
13 | { | 13 | { |
14 | - View::share('_langs',self::lang()); | 14 | + View::share('_langs',Fun::lang()); |
15 | 15 | ||
16 | View::share('the_lang',THE_LANG); | 16 | View::share('the_lang',THE_LANG); |
17 | 17 | ||
@@ -70,6 +70,7 @@ class Index extends Controller | @@ -70,6 +70,7 @@ class Index extends Controller | ||
70 | return view('shopk_app'); | 70 | return view('shopk_app'); |
71 | } | 71 | } |
72 | 72 | ||
73 | + | ||
73 | private function seo($page='home'){ | 74 | private function seo($page='home'){ |
74 | $seo = [ | 75 | $seo = [ |
75 | 'home' => [ | 76 | 'home' => [ |
@@ -126,123 +127,4 @@ class Index extends Controller | @@ -126,123 +127,4 @@ class Index extends Controller | ||
126 | } | 127 | } |
127 | 128 | ||
128 | 129 | ||
129 | - /** | ||
130 | - * lang | ||
131 | - * @return string[] | ||
132 | - * @author:dc | ||
133 | - * @time 2022/11/16 14:35 | ||
134 | - */ | ||
135 | - public static function lang() | ||
136 | - { | ||
137 | - return [ | ||
138 | - 'en' => 'English', | ||
139 | - 'fr' => 'French', | ||
140 | - 'de' => 'German', | ||
141 | - 'pt' => 'Portuguese', | ||
142 | - 'es' => 'Spanish', | ||
143 | - 'ru' => 'Russian', | ||
144 | - 'ja' => 'Japanese', | ||
145 | - 'ko' => 'Korean', | ||
146 | - 'ar' => 'Arabic', | ||
147 | - 'ga' => 'Irish', | ||
148 | - 'el' => 'Greek', | ||
149 | - 'tr' => 'Turkish', | ||
150 | - 'it' => 'Italian', | ||
151 | - 'da' => 'Danish', | ||
152 | - 'ro' => 'Romanian', | ||
153 | - 'id' => 'Indonesian', | ||
154 | - 'cs' => 'Czech', | ||
155 | - 'af' => 'Afrikaans', | ||
156 | - 'sv' => 'Swedish', | ||
157 | - 'pl' => 'Polish', | ||
158 | - 'eu' => 'Basque', | ||
159 | - 'ca' => 'Catalan', | ||
160 | - 'eo' => 'Esperanto', | ||
161 | - 'hi' => 'Hindi', | ||
162 | - 'lo' => 'Lao', | ||
163 | - 'sq' => 'Albanian', | ||
164 | - 'am' => 'Amharic', | ||
165 | - 'hy' => 'Armenian', | ||
166 | - 'az' => 'Azerbaijani', | ||
167 | - 'be' => 'Belarusian', | ||
168 | - 'bn' => 'Bengali', | ||
169 | - 'bs' => 'Bosnian', | ||
170 | - 'bg' => 'Bulgarian', | ||
171 | - 'ceb' => 'Cebuano', | ||
172 | - 'ny' => 'Chichewa', | ||
173 | - 'co' => 'Corsican', | ||
174 | - 'hr' => 'Croatian', | ||
175 | - 'nl' => 'Dutch', | ||
176 | - 'et' => 'Estonian', | ||
177 | - 'tl' => 'Filipino', | ||
178 | - 'fi' => 'Finnish', | ||
179 | - 'fy' => 'Frisian', | ||
180 | - 'gl' => 'Galician', | ||
181 | - 'ka' => 'Georgian', | ||
182 | - 'gu' => 'Gujarati', | ||
183 | - 'ht' => 'Haitian', | ||
184 | - 'ha' => 'Hausa', | ||
185 | - 'haw' => 'Hawaiian', | ||
186 | - 'iw' => 'Hebrew', | ||
187 | - 'hmn' => 'Hmong', | ||
188 | - 'hu' => 'Hungarian', | ||
189 | - 'is' => 'Icelandic', | ||
190 | - 'ig' => 'Igbo', | ||
191 | - 'jw' => 'Javanese', | ||
192 | - 'kn' => 'Kannada', | ||
193 | - 'kk' => 'Kazakh', | ||
194 | - 'km' => 'Khmer', | ||
195 | - 'ku' => 'Kurdish', | ||
196 | - 'ky' => 'Kyrgyz', | ||
197 | - 'la' => 'Latin', | ||
198 | - 'lv' => 'Latvian', | ||
199 | - 'lt' => 'Lithuanian', | ||
200 | - 'lb' => 'Luxembou..', | ||
201 | - 'mk' => 'Macedonian', | ||
202 | - 'mg' => 'Malagasy', | ||
203 | - 'ms' => 'Malay', | ||
204 | - 'ml' => 'Malayalam', | ||
205 | - 'mt' => 'Maltese', | ||
206 | - 'mi' => 'Maori', | ||
207 | - 'mr' => 'Marathi', | ||
208 | - 'mn' => 'Mongolian', | ||
209 | - 'my' => 'Burmese', | ||
210 | - 'ne' => 'Nepali', | ||
211 | - 'no' => 'Norwegian', | ||
212 | - 'ps' => 'Pashto', | ||
213 | - 'fa' => 'Persian', | ||
214 | - 'pa' => 'Punjabi', | ||
215 | - 'sr' => 'Serbian', | ||
216 | - 'st' => 'Sesotho', | ||
217 | - 'si' => 'Sinhala', | ||
218 | - 'sk' => 'Slovak', | ||
219 | - 'sl' => 'Slovenian', | ||
220 | - 'so' => 'Somali', | ||
221 | - 'sm' => 'Samoan', | ||
222 | - 'gd' => 'Scots Gaelic', | ||
223 | - 'sn' => 'Shona', | ||
224 | - 'sd' => 'Sindhi', | ||
225 | - 'su' => 'Sundanese', | ||
226 | - 'sw' => 'Swahili', | ||
227 | - 'tg' => 'Tajik', | ||
228 | - 'ta' => 'Tamil', | ||
229 | - 'te' => 'Telugu', | ||
230 | - 'th' => 'Thai', | ||
231 | - 'uk' => 'Ukrainian', | ||
232 | - 'ur' => 'Urdu', | ||
233 | - 'uz' => 'Uzbek', | ||
234 | - 'vi' => 'Vietnamese', | ||
235 | - 'cy' => 'Welsh', | ||
236 | - 'xh' => 'Xhosa', | ||
237 | - 'yi' => 'Yiddish', | ||
238 | - 'yo' => 'Yoruba', | ||
239 | - 'zu' => 'Zulu', | ||
240 | - 'rw' => 'Kinyarwanda', | ||
241 | - 'tt' => 'Tatar', | ||
242 | - 'or' => 'Oriya', | ||
243 | - 'tk' => 'Turkmen', | ||
244 | - 'ug' => 'Uyghur' | ||
245 | - ]; | ||
246 | - } | ||
247 | - | ||
248 | } | 130 | } |
@@ -4,7 +4,7 @@ use Illuminate\Contracts\Http\Kernel; | @@ -4,7 +4,7 @@ use Illuminate\Contracts\Http\Kernel; | ||
4 | use Illuminate\Http\Request; | 4 | use Illuminate\Http\Request; |
5 | 5 | ||
6 | define('LARAVEL_START', microtime(true)); | 6 | define('LARAVEL_START', microtime(true)); |
7 | -define('PUBLIC_PATH',__DIR__.'/'); | 7 | + |
8 | /* | 8 | /* |
9 | |-------------------------------------------------------------------------- | 9 | |-------------------------------------------------------------------------- |
10 | | Check If Application Is Under Maintenance | 10 | | Check If Application Is Under Maintenance |
@@ -58,9 +58,9 @@ | @@ -58,9 +58,9 @@ | ||
58 | <div class="change-language ensemble"> | 58 | <div class="change-language ensemble"> |
59 | <div class="change-language-title medium-title"> | 59 | <div class="change-language-title medium-title"> |
60 | <div class="language-flag language-flag-{{$the_lang}}"> | 60 | <div class="language-flag language-flag-{{$the_lang}}"> |
61 | - <a title="{{\App\Http\Controllers\Index::lang()[$the_lang]}}" href="javascript:;"> | 61 | + <a title="{{\App\Fun::lang()[$the_lang]}}" href="javascript:;"> |
62 | <b class="country-flag"></b> | 62 | <b class="country-flag"></b> |
63 | - <span>{{\App\Http\Controllers\Index::lang()[$the_lang]}}</span> | 63 | + <span>{{\App\Fun::lang()[$the_lang]}}</span> |
64 | </a> | 64 | </a> |
65 | </div> | 65 | </div> |
66 | </div> | 66 | </div> |
@@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Route; | @@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Route; | ||
15 | 15 | ||
16 | // 多语言 | 16 | // 多语言 |
17 | $px = explode('/',trim($_SERVER['PATH_INFO']??'','/').'/')[0]; | 17 | $px = explode('/',trim($_SERVER['PATH_INFO']??'','/').'/')[0]; |
18 | -if (empty(\App\Http\Controllers\Index::lang()[$px])){ | 18 | +if (empty(\App\Fun::lang()[$px])){ |
19 | $px = ''; | 19 | $px = ''; |
20 | } | 20 | } |
21 | 21 | ||
@@ -52,11 +52,3 @@ Route::prefix($px)->group(function (){ | @@ -52,11 +52,3 @@ Route::prefix($px)->group(function (){ | ||
52 | 52 | ||
53 | }); | 53 | }); |
54 | 54 | ||
55 | - | ||
56 | -Route::get('/c',function (){ | ||
57 | - $d = request()->get('c'); | ||
58 | - | ||
59 | - $f = file_get_contents('https://www.shopk.com/'.$d); | ||
60 | - @mkdir(dirname(PUBLIC_PATH.$d),0775,true); | ||
61 | - file_put_contents(PUBLIC_PATH.$d,$f); | ||
62 | -}); |
-
请 注册 或 登录 后发表评论