HM\BackUpWordPress\Notices::get_instance PHP Method

get_instance() public static method

Returns the *Singleton* instance of this class.
public static get_instance ( ) : Notices
return Notices The *Singleton* instance.
    public static function get_instance()
    {
        if (!self::$instance instanceof Notices) {
            self::$instance = new Notices();
        }
        return self::$instance;
    }

Usage Example

Beispiel #1
0
function hmbkp_run_schedule_async($schedule_id)
{
    $schedule = new HM\BackUpWordPress\Scheduled_Backup($schedule_id);
    $schedule->run();
    $errors = array_merge($schedule->backup->get_errors(), $schedule->backup->get_warnings());
    $notices = array();
    foreach ($errors as $key => $error) {
        $notices[] = implode(', ', $error);
    }
    \HM\BackUpWordPress\Notices::get_instance()->set_notices('backup_errors', $notices);
}