__init__.py 931 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from flask import flash
  2. from flaskbb.plugins import Plugin, hooks
  3. #: The name of your plugin class
  4. __version__ = "1.0.0"
  5. __plugin__ = "ExamplePlugin"
  6. def hello_world():
  7. flash("Hello World from {}".format(__plugin__), "success")
  8. def inject_hello_world():
  9. return "<b>Hello World</b>"
  10. class ExamplePlugin(Plugin):
  11. name = "Example Plugin"
  12. description = ("This plugin gives a quick insight on how you can write "
  13. "plugins in FlaskBB.")
  14. author = "sh4nks"
  15. license = "BSD License. See LICENSE file for more information."
  16. version = __version__
  17. def enable(self):
  18. hooks.add("beforeIndex", hello_world)
  19. hooks.add("beforeBreadcrumb", inject_hello_world)
  20. def disable(self):
  21. hooks.remove("beforeIndex", hello_world)
  22. hooks.remove("beforeBreadcrumb", inject_hello_world)
  23. def install(self):
  24. pass
  25. def uninstall(self):
  26. pass