3
1

Plugin.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php namespace Kanboard\Plugin\OMITemplateModder;
  2. use Kanboard\Core\Plugin\Base;
  3. use Kanboard\Core\Security\Role;
  4. use Kanboard\Core\Translator;
  5. // Define a local constant for the plugin root directory.
  6. define("ETM_PLUGIN_ROOT_DIR", __DIR__);
  7. // Define a constant for the core Kanboard application directory.
  8. // This is a robust alternative to KANBOARD_APP_DIR if it's not available.
  9. define("KB_APP_DIR", dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . "app");
  10. /**
  11. * Plugin Initialisation
  12. *
  13. * @package Kanboard\Plugin\OMITemplateModder
  14. * @author Dwayne @ OMI NZ
  15. */
  16. class Plugin extends Base {
  17. /**
  18. * Initialise the plugin
  19. */
  20. public function initialize() {
  21. // Add a new sub-menu item under Application settings
  22. $this->hook->on('template:config:sidebar', ['template' => 'OMITemplateModder:config/sidebar']);
  23. // Register the new route for the plugin configuration page
  24. $this->route->addRoute("/settings/template_modder", "TemplateController", "show", "OMITemplateModder");
  25. $this->route->addRoute("/settings/template_modder/edit/:template_index", "TemplateController", "edit", "OMITemplateModder");
  26. $this->route->addRoute("/settings/template_modder/save/:template_index", "TemplateController", "save", "OMITemplateModder");
  27. // loop through all notification templates and registers them (that exist in this plugin dir!)
  28. $templateDir = ETM_PLUGIN_ROOT_DIR . "/Template/notification";
  29. foreach (glob($templateDir . "/*.php") as $filename) {
  30. $templateName = basename($filename, ".php");
  31. $this->template->setTemplateOverride("notification/" . $templateName, "EmailTemplateModder:notification/" . $templateName);
  32. }
  33. }
  34. public function getPluginName() {
  35. return "OMI Notification Template Modder";
  36. }
  37. public function getPluginDescription() {
  38. return t("View and modify Kanboard notification templates which include email templates. Built by dwayne Pivac @ OMI Ltd.");
  39. }
  40. public function getPluginAuthor() {
  41. return "OMI";
  42. }
  43. public function getPluginVersion() {
  44. return "1.0.2";
  45. }
  46. public function getPluginHomepage() {
  47. return "https://vcs.nz/ominz/OMITemplateModder";
  48. }
  49. public function getCompatibleVersion() {
  50. return ">=1.2";
  51. }
  52. }
  53. #-
  54. #plugins/OMITemplateModder/Plugin.php