@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function parseHy2 ($config_str) {
|
|
| 3 | +function parseHy2($config_str) {
|
|
| 4 | 4 | $parsedUrl = parse_url($config_str); |
| 5 | 5 | |
| 6 | 6 | // Extract the parameters from the query string |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | return $length % 2 == 0; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -function process_jsons($input, $locationNames){ |
|
| 17 | +function process_jsons($input, $locationNames) { |
|
| 18 | 18 | $input[0]['outbounds'] = array_merge($input[0]['outbounds'], array_filter($locationNames)); |
| 19 | 19 | return $input; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -function extract_names($input){ |
|
| 23 | - foreach($input as $config){ |
|
| 24 | - if ($config['tag'] !== ""){ |
|
| 22 | +function extract_names($input) { |
|
| 23 | + foreach ($input as $config) { |
|
| 24 | + if ($config['tag'] !== "") { |
|
| 25 | 25 | $locationNames[] = $config['tag']; |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | function ShadowsocksSingbox($ShadowsocksUrl) { |
| 276 | 276 | $decoded_shadowsocks = ParseShadowsocks($ShadowsocksUrl); |
| 277 | - if (is_null($decoded_shadowsocks['name']) || $decoded_shadowsocks['name'] === ""){ |
|
| 277 | + if (is_null($decoded_shadowsocks['name']) || $decoded_shadowsocks['name'] === "") { |
|
| 278 | 278 | return null; |
| 279 | 279 | } |
| 280 | 280 | if ($decoded_shadowsocks['encryption_method'] === "chacha20-poly1305") { |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | return $configResult; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | -function GenerateConfig($input, $output, $theType){ |
|
| 377 | +function GenerateConfig($input, $output, $theType) { |
|
| 378 | 378 | $outbound = []; |
| 379 | 379 | $v2ray_subscription = str_replace(" ", "%20", $input); |
| 380 | 380 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | foreach ($configArray as $config) { |
| 383 | 383 | $configType = detect_type($config); |
| 384 | 384 | $config = str_replace("%20", " ", $config); |
| 385 | - switch($configType) { |
|
| 385 | + switch ($configType) { |
|
| 386 | 386 | case "vmess": |
| 387 | 387 | $configSingbox = VmessSingbox($config); |
| 388 | 388 | break; |
@@ -402,9 +402,9 @@ discard block |
||
| 402 | 402 | $configSingbox = ShadowsocksSingbox($config); |
| 403 | 403 | break; |
| 404 | 404 | } |
| 405 | - if (!is_null($configSingbox)){ |
|
| 405 | + if (!is_null($configSingbox)) { |
|
| 406 | 406 | $configName = $configSingbox['tag']; |
| 407 | - if (stripos($configName, "RELAY |
|
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | include "modules/ranking.php"; // Include the ranking module |
| 7 | 7 | include "modules/singbox.php"; // Include the singbox module |
| 8 | 8 | |
| 9 | -function addHeader ($subscription, $subscriptionName) { |
|
| 9 | +function addHeader($subscription, $subscriptionName) { |
|
| 10 | 10 | $headerText = "#profile-title: base64:" . base64_encode($subscriptionName) . " |
| 11 | 11 | #profile-update-interval: 1 |
| 12 | 12 | #subscription-userinfo: upload=0; download=0; total=10737418240000000; expire=2546249531 |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | rmdir($folder); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -function seprate_by_country($configs){ |
|
| 32 | +function seprate_by_country($configs) { |
|
| 33 | 33 | $configsArray = explode("\n", $configs); |
| 34 | 34 | $configLocation = ""; |
| 35 | 35 | $output = []; |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | if ($configType === "vmess") { |
| 40 | 40 | $configName = parse_config($config, "vmess", true)['ps']; |
| 41 | - } elseif ($configType === "vless" || $configType === "trojan" ){ |
|
| 41 | + } elseif ($configType === "vless" || $configType === "trojan") { |
|
| 42 | 42 | $configName = parse_config($config, $configType)['hash']; |
| 43 | - } elseif ($configType === "ss"){ |
|
| 43 | + } elseif ($configType === "ss") { |
|
| 44 | 44 | $configName = parse_config($config, "ss")['name']; |
| 45 | - } elseif ($configType === "tuic"){ |
|
| 45 | + } elseif ($configType === "tuic") { |
|
| 46 | 46 | $configName = parse_config($config, "tuic")['hash']; |
| 47 | - } elseif ($configType === "hy2"){ |
|
| 47 | + } elseif ($configType === "hy2") { |
|
| 48 | 48 | $configName = parse_config($config, "hy2")['hash']; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if (stripos($configName, "RELAY |
|