@@ -21,7 +21,7 @@ |
||
21 | 21 | public int $score; |
22 | 22 | |
23 | 23 | |
24 | - public function __construct(stdClass|null $object = null) { |
|
24 | + public function __construct(stdClass | null $object = null) { |
|
25 | 25 | if ($object != null) { |
26 | 26 | parent::__construct($object, self::subs); |
27 | 27 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the |
53 | 53 | * thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
54 | 54 | */ |
55 | - public CURLFile|string $thumb; |
|
55 | + public CURLFile | string $thumb; |
|
56 | 56 | |
57 | 57 | /** `video` and `animation` only. width */ |
58 | 58 | public int $width; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public bool $disable_content_type_detection; |
80 | 80 | |
81 | 81 | |
82 | - public function __construct(stdClass|null $object = null) { |
|
82 | + public function __construct(stdClass | null $object = null) { |
|
83 | 83 | if ($object != null) { |
84 | 84 | parent::__construct($object, self::subs); |
85 | 85 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | public string $custom_emoji_id; |
50 | 50 | |
51 | 51 | |
52 | - public function __construct(stdClass|null $object = null) { |
|
52 | + public function __construct(stdClass | null $object = null) { |
|
53 | 53 | if ($object != null) { |
54 | 54 | parent::__construct($object, self::subs); |
55 | 55 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @internal Only for BPT self usage , Don't use it in your source! |
19 | 19 | */ |
20 | - public static function init (int $log_size = 10): void { |
|
20 | + public static function init(int $log_size = 10): void { |
|
21 | 21 | self::$log_size = $log_size; |
22 | 22 | if (file_exists(settings::$name.'BPT.log') && !(filesize(settings::$name.'BPT.log') > self::$log_size * 1024 * 1024)) { |
23 | 23 | $mode = 'a'; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | self::$handler = fopen(settings::$name.'BPT.log', $mode); |
31 | 31 | |
32 | 32 | if ($write) { |
33 | - fwrite(self::$handler,"♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n"); |
|
33 | + fwrite(self::$handler, "♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n"); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | if (self::$waited_logs != []) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | public static function write(string $data, string $type = loggerTypes::NONE): void { |
54 | - $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" ); |
|
54 | + $text = date('Y/m/d H:i:s').($type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n"); |
|
55 | 55 | if (!is_null(self::$handler)) { |
56 | 56 | fwrite(self::$handler, $text); |
57 | 57 | } |
@@ -9,4 +9,4 @@ |
||
9 | 9 | * |
10 | 10 | * @todo make it usefully (it's not called at all) |
11 | 11 | */ |
12 | -class telegramException extends Exception{} |
|
13 | 12 | \ No newline at end of file |
13 | +class telegramException extends Exception {} |
|
14 | 14 | \ No newline at end of file |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!tools::isTelegram($ip ?? '')) { |
44 | - logger::write('not authorized access denied. IP : '. $ip ?? 'unknown',loggerTypes::WARNING); |
|
44 | + logger::write('not authorized access denied. IP : '.$ip ?? 'unknown', loggerTypes::WARNING); |
|
45 | 45 | BPT::exit(); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - protected static function processUpdate(string|stdClass|update $update = null): void { |
|
50 | + protected static function processUpdate(string | stdClass | update $update = null): void { |
|
51 | 51 | if (!is_object($update)) { |
52 | 52 | $update = json_decode($update ?? file_get_contents("php://input")); |
53 | 53 | if (!$update) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - if (!is_a($update,'update')) { |
|
58 | + if (!is_a($update, 'update')) { |
|
59 | 59 | $update = new update($update); |
60 | 60 | } |
61 | 61 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | db::save(); |
67 | 67 | } |
68 | 68 | |
69 | - protected static function setMessageExtra (update &$update): void { |
|
69 | + protected static function setMessageExtra(update & $update): void { |
|
70 | 70 | if ((isset($update->message) && isset($update->message->text)) || (isset($update->edited_message) && isset($update->edited_message->text))) { |
71 | 71 | $type = isset($update->message) ? 'message' : 'edited_message'; |
72 | 72 | $text = &$update->$type->text; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | BPT::$handler->something_else(BPT::$update); |
140 | 140 | } |
141 | 141 | else { |
142 | - logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
|
142 | + logger::write('Update received but handlers does not set', loggerTypes::WARNING); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|int |
37 | 37 | */ |
38 | - public static function save(string $name, string $data): bool|int { |
|
39 | - return file_put_contents(settings::$name."$name.lock", $data) && chmod(settings::$name."$name.lock",0640); |
|
38 | + public static function save(string $name, string $data): bool | int { |
|
39 | + return file_put_contents(settings::$name."$name.lock", $data) && chmod(settings::$name."$name.lock", 0640); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return bool|string |
48 | 48 | */ |
49 | - public static function read(string $name): bool|string { |
|
49 | + public static function read(string $name): bool | string { |
|
50 | 50 | return file_get_contents(settings::$name."$name.lock"); |
51 | 51 | } |
52 | 52 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return bool|int |
59 | 59 | */ |
60 | - public static function mtime(string $name): bool|int { |
|
60 | + public static function mtime(string $name): bool | int { |
|
61 | 61 | return filemtime(settings::$name."$name.lock"); |
62 | 62 | } |
63 | 63 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @internal Only for BPT self usage , Don't use it in your source! |
19 | 19 | */ |
20 | - public static function init (): void { |
|
20 | + public static function init(): void { |
|
21 | 21 | if (!empty(settings::$db)) { |
22 | 22 | if (!isset(settings::$db['type'])) { |
23 | 23 | settings::$db['type'] = dbTypes::JSON; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public string $big_file_unique_id; |
38 | 38 | |
39 | 39 | |
40 | - public function __construct(stdClass|null $object = null) { |
|
40 | + public function __construct(stdClass | null $object = null) { |
|
41 | 41 | if ($object != null) { |
42 | 42 | parent::__construct($object, self::subs); |
43 | 43 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool|string string will be returned when destination doesn't set |
61 | 61 | */ |
62 | - public function download(string|null $destination = null,bool $big = true): bool|string { |
|
63 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4',$big ? $this->big_file_id : $this->small_file_id); |
|
62 | + public function download(string | null $destination = null, bool $big = true): bool | string { |
|
63 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4', $big ? $this->big_file_id : $this->small_file_id); |
|
64 | 64 | } |
65 | 65 | } |