@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $processed_subscription = []; |
| 76 | 76 | $usernames = []; |
| 77 | -foreach ($donated_subscription as $url){ |
|
| 77 | +foreach ($donated_subscription as $url) { |
|
| 78 | 78 | $usernames = json_decode(file_get_contents($url), true); |
| 79 | - foreach ($usernames as $username){ |
|
| 79 | + foreach ($usernames as $username) { |
|
| 80 | 80 | $subscription_data = file_get_contents($base_donated_url . $username); |
| 81 | 81 | $processed_subscription = process_subscription($subscription_data, $username); |
| 82 | - foreach ($processed_subscription as $donated_type => $donated_data){ |
|
| 83 | - switch ($donated_type){ |
|
| 82 | + foreach ($processed_subscription as $donated_type => $donated_data) { |
|
| 83 | + switch ($donated_type) { |
|
| 84 | 84 | case "vmess" : |
| 85 | 85 | $vmess_data = array_merge( |
| 86 | 86 | $vmess_data, |
@@ -107,22 +107,22 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // Extract the "config" value from each object in $vmess_data and store it in $vmess_array |
| 110 | -$vmess_array = array_map(function ($object) { |
|
| 110 | +$vmess_array = array_map(function($object) { |
|
| 111 | 111 | return $object["config"]; |
| 112 | 112 | }, $vmess_data); |
| 113 | 113 | |
| 114 | 114 | // Extract the "config" value from each object in $vless_data and store it in $vless_array |
| 115 | -$vless_array = array_map(function ($object) { |
|
| 115 | +$vless_array = array_map(function($object) { |
|
| 116 | 116 | return $object["config"]; |
| 117 | 117 | }, $vless_data); |
| 118 | 118 | |
| 119 | 119 | // Extract the "config" value from each object in $trojan_data and store it in $trojan_array |
| 120 | -$trojan_array = array_map(function ($object) { |
|
| 120 | +$trojan_array = array_map(function($object) { |
|
| 121 | 121 | return $object["config"]; |
| 122 | 122 | }, $trojan_data); |
| 123 | 123 | |
| 124 | 124 | // Extract the "config" value from each object in $shadowsocks_data and store it in $shadowsocks_array |
| 125 | -$shadowsocks_array = array_map(function ($object) { |
|
| 125 | +$shadowsocks_array = array_map(function($object) { |
|
| 126 | 126 | return $object["config"]; |
| 127 | 127 | }, $shadowsocks_data); |
| 128 | 128 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | return ($item['ping'] < $min) ? $item['ping'] : $min; |
| 40 | 40 | }, PHP_FLOAT_MAX); |
| 41 | 41 | |
| 42 | - foreach ($input as $key => $config){ |
|
| 42 | + foreach ($input as $key => $config) { |
|
| 43 | 43 | |
| 44 | 44 | $username_ch = $config['channel']['username']; |
| 45 | 45 | $time_diff = strtotime(tehran_time()) - strtotime($config['time']); |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | $ping_coefficient = 1 / ($ping_diff + 1); |
| 52 | 52 | $point_array[$username_ch] += $ping_coefficient; |
| 53 | 53 | |
| 54 | - switch ($config['type']){ |
|
| 54 | + switch ($config['type']) { |
|
| 55 | 55 | case "reality": |
| 56 | - $point_array[$username_ch] += 1 ; |
|
| 56 | + $point_array[$username_ch] += 1; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | true |
| 64 | 64 | ); |
| 65 | 65 | $last_rank_date = $last_point_array['date']; |
| 66 | - if (same_date($last_rank_date) === false){ |
|
| 66 | + if (same_date($last_rank_date) === false) { |
|
| 67 | 67 | unlink("ranking/channel_ranking_" . $type . ".json"); |
| 68 | 68 | $last_point_array['points'] = []; |
| 69 | 69 | } |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | @$ping_data = ping($ip, $port); |
| 323 | 323 | |
| 324 | 324 | // If ping data is available |
| 325 | - // if ($ping_data !== "unavailable") { |
|
| 325 | + // if ($ping_data !== "unavailable") { |
|
| 326 | 326 | // Get IP information (country) and flag |
| 327 | 327 | $ip_info = ip_info($ip); |
| 328 | 328 | if (isset($ip_info["country"])) { |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | "time" |
| 426 | 426 | ] = tehran_time(); |
| 427 | 427 | $array_helper_vless++; |
| 428 | - // } |
|
| 428 | + // } |
|
| 429 | 429 | } elseif (substr($config, 0, 5) === "ss://") { |
| 430 | 430 | // Parse the shadowsocks configuration |
| 431 | 431 | $the_config = ParseShadowsocks($config); |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | $final_data["ss"][$array_helper_ss]["ping"] = $ping_data; |
| 470 | 470 | $final_data["ss"][$array_helper_ss]["time"] = tehran_time(); |
| 471 | 471 | $array_helper_ss++; |
| 472 | - // } |
|
| 472 | + // } |
|
| 473 | 473 | } elseif (stripos($config, "trojan://")) { |
| 474 | 474 | // Parse the trojan configuration |
| 475 | 475 | $the_config = parseProxyUrl($config); |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | @$ping_data = ping($ip, $port); |
| 487 | 487 | |
| 488 | 488 | // If ping data is available |
| 489 | - // if ($ping_data !== "unavailable") { |
|
| 489 | + // if ($ping_data !== "unavailable") { |
|
| 490 | 490 | // Get IP information (country) and flag |
| 491 | 491 | $ip_info = ip_info($ip); |
| 492 | 492 | if (isset($ip_info["country"])) { |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | "time" |
| 522 | 522 | ] = tehran_time(); |
| 523 | 523 | $array_helper_trojan++; |
| 524 | - // } |
|
| 524 | + // } |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | } |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | // Extract the title and image URL using regular expressions |
| 11 | 11 | $title_pattern = '#<meta property="twitter:title" content="(.*?)">#'; |
| 12 | 12 | $image_pattern = '#<meta property="twitter:image" content="(.*?)">#'; |
| 13 | - preg_match($image_pattern, $html , $image_match); |
|
| 14 | - preg_match($title_pattern, $html , $title_match); |
|
| 13 | + preg_match($image_pattern, $html, $image_match); |
|
| 14 | + preg_match($title_pattern, $html, $title_match); |
|
| 15 | 15 | |
| 16 | 16 | // Save the image file to local storage |
| 17 | 17 | file_put_contents("modules/channels/" . $channel . ".jpg", file_get_contents($image_match[1])); |
@@ -23,5 +23,5 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // Save the channel data array as JSON |
| 26 | -file_put_contents("modules/channels/channels_assets.json", json_encode($channel_array , JSON_PRETTY_PRINT)); |
|
| 26 | +file_put_contents("modules/channels/channels_assets.json", json_encode($channel_array, JSON_PRETTY_PRINT)); |
|
| 27 | 27 | ?> |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | function getFlags($country_code) |
| 3 | 3 | { |
| 4 | 4 | $flag = ""; |
| 5 | - $flag = mb_convert_encoding( '&#' . ( 127397 + ord( $country_code[0] ) ) . ';', 'UTF-8', 'HTML-ENTITIES'); |
|
| 6 | - $flag .= mb_convert_encoding( '&#' . ( 127397 + ord( $country_code[1] ) ) . ';', 'UTF-8', 'HTML-ENTITIES'); |
|
| 5 | + $flag = mb_convert_encoding('&#' . (127397 + ord($country_code[0])) . ';', 'UTF-8', 'HTML-ENTITIES'); |
|
| 6 | + $flag .= mb_convert_encoding('&#' . (127397 + ord($country_code[1])) . ';', 'UTF-8', 'HTML-ENTITIES'); |
|
| 7 | 7 | return $flag; |
| 8 | 8 | } |
| 9 | 9 | ?> |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | "protocol" => $type, |
| 17 | 17 | "username" => isset($parsedUrl["user"]) ? $parsedUrl["user"] : "", |
| 18 | 18 | "hostname" => isset($parsedUrl["host"]) ? $parsedUrl["host"] : "", |
| 19 | - "port" => isset($parsedUrl["port"]) ? $parsedUrl["port"]: "", |
|
| 19 | + "port" => isset($parsedUrl["port"]) ? $parsedUrl["port"] : "", |
|
| 20 | 20 | "params" => $params, |
| 21 | 21 | "hash" => isset($parsedUrl["fragment"]) ? $parsedUrl["fragment"] : "", |
| 22 | 22 | ]; |