mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 03:34:42 +01:00
Cleanup
This commit is contained in:
parent
8f66319b66
commit
9d64ddb287
@ -755,7 +755,7 @@ Want to add your own open-source project to this list? [Click here!](https://doc
|
||||
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#broadcastmessages-array-messages-danog-madelineproto-broadcast-filter-filter-bool-pin-int" name="broadcastMessages">Sends a list of messages to all peers (users, chats, channels) of the bot: broadcastMessages</a>
|
||||
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendMessage.html" name="messages.sendMessage">Sends a message to a chat: messages.sendMessage</a>
|
||||
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendEncryptedFile.html" name="messages.sendEncryptedFile">Sends a message with a file attachment to a secret chat: messages.sendEncryptedFile</a>
|
||||
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#sendmessage-int-string-peer-string-message-html-markdown-null-parsemode-int-null-replytomsgid-int-null-topmsgid-array-null-replymarkup-int-null-sendas-int-null-scheduledate-bool-silent-bool-noforwards-bool-background-bool-cleardraft-bool-nowebpage-bool-updatestickersetsorder-message" name="sendMessage">Sends a message: sendMessage</a>
|
||||
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#sendmessage-int-string-peer-string-message-html-markdown-null-parsemode-int-null-replytomsgid-int-null-topmsgid-array-null-replymarkup-int-null-sendas-int-null-scheduledate-bool-silent-bool-noforwards-bool-background-bool-cleardraft-bool-nowebpage-bool-updatestickersetsorder-danog-madelineproto-eventhandler-message" name="sendMessage">Sends a message: sendMessage</a>
|
||||
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendEncryptedService.html" name="messages.sendEncryptedService">Sends a service message to a secret chat: messages.sendEncryptedService</a>
|
||||
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.sendEncrypted.html" name="messages.sendEncrypted">Sends a text message to a secret chat: messages.sendEncrypted</a>
|
||||
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#sendcustomevent-mixed-payload-void" name="sendCustomEvent">Sends an updateCustomEvent update to the event handler: sendCustomEvent</a>
|
||||
|
@ -303,7 +303,6 @@ abstract class EventHandler extends AbstractAPI
|
||||
return [];
|
||||
}
|
||||
|
||||
private static array $includedPaths = [];
|
||||
/**
|
||||
* Obtain a list of plugin event handlers.
|
||||
*
|
||||
@ -326,6 +325,7 @@ abstract class EventHandler extends AbstractAPI
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
private static array $checkedPaths = [];
|
||||
private function internalGetDirectoryPlugins(array &$plugins): void
|
||||
{
|
||||
if ($this instanceof PluginEventHandler) {
|
||||
@ -337,11 +337,15 @@ abstract class EventHandler extends AbstractAPI
|
||||
$paths = [$paths];
|
||||
} elseif ($paths === null) {
|
||||
$paths = [];
|
||||
} else {
|
||||
$paths = \array_values($paths);
|
||||
}
|
||||
$paths = \array_map(realpath(...), $paths);
|
||||
$paths = \array_diff($paths, self::$checkedPaths);
|
||||
|
||||
if (!$paths) {
|
||||
return;
|
||||
}
|
||||
$paths = \array_map(realpath(...), $paths);
|
||||
|
||||
$recurse = static function (string $path, string $namespace = 'MadelinePlugin') use (&$recurse, &$plugins): void {
|
||||
foreach (listFiles($path) as $file) {
|
||||
@ -349,10 +353,6 @@ abstract class EventHandler extends AbstractAPI
|
||||
$recurse($file, $namespace.'\\'.\basename($file));
|
||||
} elseif (isFile($file) && \str_ends_with($file, "Plugin.php")) {
|
||||
$file = \realpath($file);
|
||||
if (isset(self::$includedPaths[$file])) {
|
||||
continue;
|
||||
}
|
||||
self::$includedPaths[$file] = true;
|
||||
try {
|
||||
require $file;
|
||||
} catch (PluginRegistration $e) {
|
||||
@ -385,6 +385,8 @@ abstract class EventHandler extends AbstractAPI
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self::$checkedPaths = \array_merge(self::$checkedPaths, $paths);
|
||||
}
|
||||
|
||||
private const BANNED_FUNCTIONS = [
|
||||
|
Loading…
Reference in New Issue
Block a user