| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - # ../_core/command.py | ||
| 1 | + # ../core/command.py | ||
| 2 | 2 | ||
| 3 | 3 | """Registers the "sp" command and all of its sub-commands.""" | |
| 4 | 4 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -251,6 +251,16 @@ def print_help(self, message=''): | |||
| 251 | 251 | ||
| 252 | 252 | def load_plugin(self, plugin_name): | |
| 253 | 253 | """Load a plugin by name.""" | |
| 254 | + # Is the given plugin name a proper name? | ||
| 255 | + if not plugin_name.isalnum(): | ||
| 256 | + | ||
| 257 | + # Send a message that the given name is invalid | ||
| 258 | + self.logger.log_message(self.prefix + self.translations[ | ||
| 259 | + 'Invalid Name'].get_string(plugin=plugin_name)) | ||
| 260 | + | ||
| 261 | + # No need to go further | ||
| 262 | + return | ||
| 263 | + | ||
| 254 | 264 | # Is the plugin already loaded? | |
| 255 | 265 | if plugin_name in self.manager: | |
| 256 | 266 | ||
@@ -283,6 +293,16 @@ def load_plugin(self, plugin_name): | |||
| 283 | 293 | ||
| 284 | 294 | def unload_plugin(self, plugin_name): | |
| 285 | 295 | """Unload a plugin by name.""" | |
| 296 | + # Is the given plugin name a proper name? | ||
| 297 | + if not plugin_name.isalnum(): | ||
| 298 | + | ||
| 299 | + # Send a message that the given name is invalid | ||
| 300 | + self.logger.log_message(self.prefix + self.translations[ | ||
| 301 | + 'Invalid Name'].get_string(plugin=plugin_name)) | ||
| 302 | + | ||
| 303 | + # No need to go further | ||
| 304 | + return | ||
| 305 | + | ||
| 286 | 306 | # Is the plugin loaded? | |
| 287 | 307 | if plugin_name not in self.manager: | |
| 288 | 308 | ||
@@ -305,6 +325,16 @@ def unload_plugin(self, plugin_name): | |||
| 305 | 325 | ||
| 306 | 326 | def reload_plugin(self, plugin_name): | |
| 307 | 327 | """Reload a plugin by name.""" | |
| 328 | + # Is the given plugin name a proper name? | ||
| 329 | + if not plugin_name.isalnum(): | ||
| 330 | + | ||
| 331 | + # Send a message that the given name is invalid | ||
| 332 | + self.logger.log_message(self.prefix + self.translations[ | ||
| 333 | + 'Invalid Name'].get_string(plugin=plugin_name)) | ||
| 334 | + | ||
| 335 | + # No need to go further | ||
| 336 | + return | ||
| 337 | + | ||
| 308 | 338 | # Unload the plugin | |
| 309 | 339 | self.unload_plugin(plugin_name) | |
| 310 | 340 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,6 @@ | |||
| 1 | + [Invalid Name] | ||
| 2 | + en = "Given plugin name '$plugin' is invalid. Plugin names must be alphanumeric." | ||
| 3 | + | ||
| 1 | 4 | [Loading] | |
| 2 | 5 | en = "Loading plugin '$plugin'..." | |
| 3 | 6 | de = "Lade Plugin '$plugin'..." | |
| Back | FazBrowse Home | New Git URL |
0 commit comments