mirror of
https://github.com/YunoHost-Apps/rainloop_ynh.git
synced 2024-09-03 20:16:18 +02:00
bb2bdad8e0
We keep previous version, just in case.
55 lines
941 B
PHP
55 lines
941 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of MailSo.
|
|
*
|
|
* (c) 2014 Usenko Timur
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|