From 02e3ce779c1909d79a4ecbdb5a110608420b921e Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Fri, 13 May 2022 20:25:52 +0200 Subject: [PATCH] Move TestSuggestions to Example plugin --- plugins/example/ContactSuggestions.php | 14 ++++++++ plugins/example/index.php | 33 +++++++++++++++++-- .../Providers/Suggestions/TestSuggestions.php | 16 --------- 3 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 plugins/example/ContactSuggestions.php delete mode 100644 snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/TestSuggestions.php diff --git a/plugins/example/ContactSuggestions.php b/plugins/example/ContactSuggestions.php new file mode 100644 index 000000000..078b87ea2 --- /dev/null +++ b/plugins/example/ContactSuggestions.php @@ -0,0 +1,14 @@ +Email(), ''), + array('email@domain.com', 'name') + ); + } +} diff --git a/plugins/example/index.php b/plugins/example/index.php index 207e39949..40741b9cc 100644 --- a/plugins/example/index.php +++ b/plugins/example/index.php @@ -13,9 +13,10 @@ class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin LICENSE = 'MIT', DESCRIPTION = ''; -/* public function Init() : void { + $this->addHook('main.fabrica', 'MainFabrica'); +/* $this->addCss(string $sFile, bool $bAdminScope = false); $this->addJs(string $sFile, bool $bAdminScope = false); $this->addHook(string $sHookName, string $sFunctionName); @@ -29,8 +30,36 @@ class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin $this->addTemplate(string $sFile, bool $bAdminScope = false); $this->addTemplateHook(string $sName, string $sPlace, string $sLocalTemplateName, bool $bPrepend = false); - } */ + } + + /** + * @param mixed $mResult + */ + public function MainFabrica(string $sName, &$mResult) + { + switch ($sName) { + case 'files': + case 'storage': + case 'storage-local': + case 'settings': + case 'settings-local': + case 'login': + case 'domain': + case 'filters': + case 'address-book': + case 'identities': + break; + + case 'suggestions': + if (!\is_array($mResult)) { + $mResult = array(); + } + require_once __DIR__ . '/ContactsSuggestions.php'; + $mResult[] = new \Plugins\Example\ContactSuggestions(); + break; + } + } /* public function Config() : \RainLoop\Config\Plugin diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/TestSuggestions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/TestSuggestions.php deleted file mode 100644 index 51490bc54..000000000 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/TestSuggestions.php +++ /dev/null @@ -1,16 +0,0 @@ -Email(), ''), - array('email@domain.com', 'name') - ); - } -}