1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rainloop_ynh.git synced 2024-09-03 20:16:18 +02:00
rainloop_ynh/sources/rainloop/v/1.8.0.251/app/libraries/MailSo/Hooks.php
polytan02 bb2bdad8e0 Update to version 1.8.0.251
We keep previous version, just in case.
2015-02-06 19:51:46 +00:00

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;
}
}
}