mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-09 00:08:18 +08:00
1009398d0c
Cleanup removed features
50 lines
857 B
PHP
50 lines
857 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();
|
|
|
|
static public function Run(string $sName, array $aArg = array()) : void
|
|
{
|
|
if (isset(static::$aCallbacks[$sName]))
|
|
{
|
|
foreach (static::$aCallbacks[$sName] as $mCallback)
|
|
{
|
|
\call_user_func_array($mCallback, $aArg);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param mixed $mCallback
|
|
*/
|
|
static public function Add(string $sName, $mCallback) : void
|
|
{
|
|
if (\is_callable($mCallback))
|
|
{
|
|
if (!isset(static::$aCallbacks[$sName]))
|
|
{
|
|
static::$aCallbacks[$sName] = array();
|
|
}
|
|
|
|
static::$aCallbacks[$sName][] = $mCallback;
|
|
}
|
|
}
|
|
}
|