mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 06:57:03 +03:00
Added MailSo hooks
This commit is contained in:
parent
cfbda969d1
commit
e1d3010054
9 changed files with 79 additions and 31 deletions
46
rainloop/v/0.0.0/app/libraries/MailSo/Hooks.php
Normal file
46
rainloop/v/0.0.0/app/libraries/MailSo/Hooks.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace MailSo;
|
||||
|
||||
/**
|
||||
* @category MailSo
|
||||
*/
|
||||
class Hooks
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
static $aCallbacks = array();
|
||||
|
||||
/**
|
||||
* @param string $sName
|
||||
* @param array $aArg
|
||||
*/
|
||||
static public function Run($sName, $aArg = array())
|
||||
{
|
||||
if (isset(\MailSo\Hooks::$aCallbacks[$sName]))
|
||||
{
|
||||
foreach (\MailSo\Hooks::$aCallbacks[$sName] as $mCallback)
|
||||
{
|
||||
\call_user_func_array($mCallback, $aArg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sName
|
||||
* @param mixed $mCallback
|
||||
*/
|
||||
static public function Add($sName, $mCallback)
|
||||
{
|
||||
if (\is_callable($mCallback))
|
||||
{
|
||||
if (!isset(\MailSo\Hooks::$aCallbacks[$sName]))
|
||||
{
|
||||
\MailSo\Hooks::$aCallbacks[$sName] = array();
|
||||
}
|
||||
|
||||
\MailSo\Hooks::$aCallbacks[$sName][] = $mCallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue