@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public static int $log_size = 10; |
23 | 23 | |
24 | - public static string|CURLFile|null $certificate = null; |
|
24 | + public static string | CURLFile | null $certificate = null; |
|
25 | 25 | |
26 | 26 | public static bool $handler = true; |
27 | 27 | |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | |
52 | 52 | public static array $allowed_updates = ['message', 'edited_channel_post', 'callback_query', 'inline_query']; |
53 | 53 | |
54 | - public static array|mysqli|null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json']; |
|
54 | + public static array | mysqli | null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json']; |
|
55 | 55 | |
56 | 56 | |
57 | - public static function init (array|stdClass $settings) { |
|
57 | + public static function init(array | stdClass $settings) { |
|
58 | 58 | $settings = (array) $settings; |
59 | 59 | |
60 | 60 | if (!(isset($settings['logger']) && $settings['logger'] == false)) { |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | foreach ($settings as $setting => $value) { |
65 | - try{ |
|
65 | + try { |
|
66 | 66 | self::$$setting = $value; |
67 | 67 | } |
68 | - catch (TypeError){ |
|
69 | - logger::write("$setting setting has wrong type , its set to default value",'warning'); |
|
68 | + catch (TypeError) { |
|
69 | + logger::write("$setting setting has wrong type , its set to default value", 'warning'); |
|
70 | 70 | } |
71 | - catch (Error){ |
|
72 | - logger::write("$setting setting is not one of library settings",'warning'); |
|
71 | + catch (Error) { |
|
72 | + logger::write("$setting setting is not one of library settings", 'warning'); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
82 | 82 | } |
83 | 83 | else { |
84 | - logger::write('token format is not right, check it and try again','error'); |
|
84 | + logger::write('token format is not right, check it and try again', 'error'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | else { |
88 | - logger::write('You must specify token parameter in settings','error'); |
|
88 | + logger::write('You must specify token parameter in settings', 'error'); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | if (self::$secure_folder) { |
109 | 109 | $address = explode('/', $_SERVER['REQUEST_URI']); |
110 | 110 | unset($address[count($address) - 1]); |
111 | - $address = implode('/', $address) . '/BPT.php'; |
|
111 | + $address = implode('/', $address).'/BPT.php'; |
|
112 | 112 | $text = "ErrorDocument 404 $address\nErrorDocument 403 $address\n Options -Indexes\n Order Deny,Allow\nDeny from all\nAllow from 127.0.0.1\n<Files *.php>\n Order Allow,Deny\n Allow from all\n</Files>"; |
113 | 113 | if (!file_exists('.htaccess') || filesize('.htaccess') != strlen($text)) { |
114 | 114 | file_put_contents('.htaccess', $text); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | getUpdates::init(); |
128 | 128 | } |
129 | 129 | else { |
130 | - logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler','error'); |
|
130 | + logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler', 'error'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 |
@@ -64,11 +64,9 @@ discard block |
||
64 | 64 | foreach ($settings as $setting => $value) { |
65 | 65 | try{ |
66 | 66 | self::$$setting = $value; |
67 | - } |
|
68 | - catch (TypeError){ |
|
67 | + } catch (TypeError){ |
|
69 | 68 | logger::write("$setting setting has wrong type , its set to default value",'warning'); |
70 | - } |
|
71 | - catch (Error){ |
|
69 | + } catch (Error){ |
|
72 | 70 | logger::write("$setting setting is not one of library settings",'warning'); |
73 | 71 | } |
74 | 72 | } |
@@ -79,12 +77,10 @@ discard block |
||
79 | 77 | self::secureFolder(); |
80 | 78 | self::db(); |
81 | 79 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
82 | - } |
|
83 | - else { |
|
80 | + } else { |
|
84 | 81 | logger::write('token format is not right, check it and try again','error'); |
85 | 82 | } |
86 | - } |
|
87 | - else { |
|
83 | + } else { |
|
88 | 84 | logger::write('You must specify token parameter in settings','error'); |
89 | 85 | } |
90 | 86 | } |
@@ -125,8 +121,7 @@ discard block |
||
125 | 121 | private static function getUpdates() { |
126 | 122 | if (self::$handler) { |
127 | 123 | getUpdates::init(); |
128 | - } |
|
129 | - else { |
|
124 | + } else { |
|
130 | 125 | logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler','error'); |
131 | 126 | } |
132 | 127 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | namespace BPT\receiver; |
4 | 4 | |
5 | 5 | class getUpdates { |
6 | - public static function init () { |
|
6 | + public static function init() { |
|
7 | 7 | |
8 | 8 | } |
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -3,7 +3,7 @@ |
||
3 | 3 | namespace BPT\receiver; |
4 | 4 | |
5 | 5 | class webhook { |
6 | - public static function init () { |
|
6 | + public static function init() { |
|
7 | 7 | |
8 | 8 | } |
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -6,17 +6,17 @@ |
||
6 | 6 | * Different type of passport |
7 | 7 | */ |
8 | 8 | class passportTypes { |
9 | - public const PERSONAL_DETAILS = 'personal_details'; |
|
10 | - public const PASSPORT = 'passport'; |
|
11 | - public const DRIVER_LICENSE = 'driver_license'; |
|
12 | - public const IDENTITY_CARD = 'identity_card'; |
|
13 | - public const INTERNAL_PASSPORT = 'internal_passport'; |
|
14 | - public const ADDRESS = 'address'; |
|
15 | - public const UTILITY_BILL = 'utility_bill'; |
|
16 | - public const BANK_STATEMENT = 'bank_statement'; |
|
17 | - public const RENTAL_AGREEMENT = 'rental_agreement'; |
|
18 | - public const PASSPORT_REGISTRATION = 'passport_registration'; |
|
19 | - public const TEMPORARY_REGISTRATION = 'temporary_registration'; |
|
20 | - public const PHONE_NUMBER = 'phone_number'; |
|
21 | - public const EMAIL = 'email'; |
|
9 | + public const PERSONAL_DETAILS = 'personal_details'; |
|
10 | + public const PASSPORT = 'passport'; |
|
11 | + public const DRIVER_LICENSE = 'driver_license'; |
|
12 | + public const IDENTITY_CARD = 'identity_card'; |
|
13 | + public const INTERNAL_PASSPORT = 'internal_passport'; |
|
14 | + public const ADDRESS = 'address'; |
|
15 | + public const UTILITY_BILL = 'utility_bill'; |
|
16 | + public const BANK_STATEMENT = 'bank_statement'; |
|
17 | + public const RENTAL_AGREEMENT = 'rental_agreement'; |
|
18 | + public const PASSPORT_REGISTRATION = 'passport_registration'; |
|
19 | + public const TEMPORARY_REGISTRATION = 'temporary_registration'; |
|
20 | + public const PHONE_NUMBER = 'phone_number'; |
|
21 | + public const EMAIL = 'email'; |
|
22 | 22 | } |
@@ -6,18 +6,18 @@ |
||
6 | 6 | * Different type of updates |
7 | 7 | */ |
8 | 8 | class updateTypes { |
9 | - public const MESSAGE = 'message'; |
|
10 | - public const EDITED_MESSAGE = 'edited_message'; |
|
11 | - public const CHANNEL_POST = 'channel_post'; |
|
12 | - public const EDITED_CHANNEL_POST = 'edited_channel_post'; |
|
13 | - public const INLINE_QUERY = 'inline_query'; |
|
14 | - public const CHOSEN_INLINE_RESULT = 'chosen_inline_result'; |
|
15 | - public const CALLBACK_QUERY = 'callback_query'; |
|
16 | - public const SHIPPING_QUERY = 'shipping_query'; |
|
17 | - public const PRE_CHECKOUT_QUERY = 'pre_checkout_query'; |
|
18 | - public const POLL = 'poll'; |
|
19 | - public const POLL_ANSWER = 'poll_answer'; |
|
20 | - public const MY_CHAT_MEMBER = 'my_chat_member'; |
|
21 | - public const CHAT_MEMBER = 'chat_member'; |
|
22 | - public const CHAT_JOIN_REQUEST = 'chat_join_request'; |
|
9 | + public const MESSAGE = 'message'; |
|
10 | + public const EDITED_MESSAGE = 'edited_message'; |
|
11 | + public const CHANNEL_POST = 'channel_post'; |
|
12 | + public const EDITED_CHANNEL_POST = 'edited_channel_post'; |
|
13 | + public const INLINE_QUERY = 'inline_query'; |
|
14 | + public const CHOSEN_INLINE_RESULT = 'chosen_inline_result'; |
|
15 | + public const CALLBACK_QUERY = 'callback_query'; |
|
16 | + public const SHIPPING_QUERY = 'shipping_query'; |
|
17 | + public const PRE_CHECKOUT_QUERY = 'pre_checkout_query'; |
|
18 | + public const POLL = 'poll'; |
|
19 | + public const POLL_ANSWER = 'poll_answer'; |
|
20 | + public const MY_CHAT_MEMBER = 'my_chat_member'; |
|
21 | + public const CHAT_MEMBER = 'chat_member'; |
|
22 | + public const CHAT_JOIN_REQUEST = 'chat_join_request'; |
|
23 | 23 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | * Type of the chat |
7 | 7 | */ |
8 | 8 | class chatType { |
9 | - /** Chat type is personal */ |
|
10 | - public const PRIVATE = 'private'; |
|
9 | + /** Chat type is personal */ |
|
10 | + public const PRIVATE = 'private'; |
|
11 | 11 | |
12 | - /** Chat type is normal group */ |
|
13 | - public const GROUP = 'group'; |
|
12 | + /** Chat type is normal group */ |
|
13 | + public const GROUP = 'group'; |
|
14 | 14 | |
15 | - /** Chat type is supergroup */ |
|
16 | - public const SUPERGROUP = 'supergroup'; |
|
15 | + /** Chat type is supergroup */ |
|
16 | + public const SUPERGROUP = 'supergroup'; |
|
17 | 17 | |
18 | - /** Chat type is channel */ |
|
19 | - public const CHANNEL = 'channel'; |
|
18 | + /** Chat type is channel */ |
|
19 | + public const CHANNEL = 'channel'; |
|
20 | 20 | } |
@@ -7,33 +7,33 @@ |
||
7 | 7 | * set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its status) |
8 | 8 | */ |
9 | 9 | class chatActions { |
10 | - /** Sets chat status as Typing */ |
|
11 | - public const TYPING = 'typing'; |
|
10 | + /** Sets chat status as Typing */ |
|
11 | + public const TYPING = 'typing'; |
|
12 | 12 | |
13 | - /** Sets chat status as Sending Photo */ |
|
14 | - public const UPLOAD_PHOTO = 'upload_photo'; |
|
13 | + /** Sets chat status as Sending Photo */ |
|
14 | + public const UPLOAD_PHOTO = 'upload_photo'; |
|
15 | 15 | |
16 | - /** Sets chat status as Recording Video */ |
|
17 | - public const RECORD_VIDEO = 'record_video'; |
|
16 | + /** Sets chat status as Recording Video */ |
|
17 | + public const RECORD_VIDEO = 'record_video'; |
|
18 | 18 | |
19 | - /** Sets chat status as Sending Video */ |
|
20 | - public const UPLOAD_VIDEO = 'upload_video'; |
|
19 | + /** Sets chat status as Sending Video */ |
|
20 | + public const UPLOAD_VIDEO = 'upload_video'; |
|
21 | 21 | |
22 | - /** Sets chat status as Recording Audio */ |
|
23 | - public const RECORD_AUDIO = 'record_audio'; |
|
22 | + /** Sets chat status as Recording Audio */ |
|
23 | + public const RECORD_AUDIO = 'record_audio'; |
|
24 | 24 | |
25 | - /** Sets chat status as Sending Audio */ |
|
26 | - public const UPLOAD_AUDIO = 'upload_audio'; |
|
25 | + /** Sets chat status as Sending Audio */ |
|
26 | + public const UPLOAD_AUDIO = 'upload_audio'; |
|
27 | 27 | |
28 | - /** Sets chat status as Sending Document */ |
|
29 | - public const UPLOAD_DOCUMENT = 'upload_document'; |
|
28 | + /** Sets chat status as Sending Document */ |
|
29 | + public const UPLOAD_DOCUMENT = 'upload_document'; |
|
30 | 30 | |
31 | - /** Sets chat status as Choosing Geo */ |
|
32 | - public const FIND_LOCATION = 'find_location'; |
|
31 | + /** Sets chat status as Choosing Geo */ |
|
32 | + public const FIND_LOCATION = 'find_location'; |
|
33 | 33 | |
34 | - /** Sets chat status as Recording Video Note */ |
|
35 | - public const RECORD_VIDEO_NOTE = 'record_video_note'; |
|
34 | + /** Sets chat status as Recording Video Note */ |
|
35 | + public const RECORD_VIDEO_NOTE = 'record_video_note'; |
|
36 | 36 | |
37 | - /** Sets chat status as Sending Video Note */ |
|
38 | - public const UPLOAD_VIDEO_NOTE = 'upload_video_note'; |
|
37 | + /** Sets chat status as Sending Video Note */ |
|
38 | + public const UPLOAD_VIDEO_NOTE = 'upload_video_note'; |
|
39 | 39 | } |
@@ -6,6 +6,6 @@ |
||
6 | 6 | * Different type of polls |
7 | 7 | */ |
8 | 8 | class pollType { |
9 | - public const REGULAR = 'regular'; |
|
10 | - public const QUIZ = 'quiz'; |
|
9 | + public const REGULAR = 'regular'; |
|
10 | + public const QUIZ = 'quiz'; |
|
11 | 11 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * Different types of parse modes |
7 | 7 | */ |
8 | 8 | class parseMode { |
9 | - public const MARKDOWNV2 = 'MarkdownV2'; |
|
10 | - public const MARKDOWN = 'Markdown'; |
|
11 | - public const HTML = 'HTML'; |
|
9 | + public const MARKDOWNV2 = 'MarkdownV2'; |
|
10 | + public const MARKDOWN = 'Markdown'; |
|
11 | + public const HTML = 'HTML'; |
|
12 | 12 | } |