HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot//crm.jmfdbn.com/addons/baidupush/library/Push.php
<?php

namespace addons\baidupush\library;

use addons\baidupush\library\push\Driver;

/**
 * Push操作类
 */
class Push
{
    /**
     * @var array Push的实例
     */
    public static $instance = [];

    /**
     * @var object 操作句柄
     */
    public static $handler;

    /**
     * 连接Push驱动
     * @access public
     * @param array       $options 配置数组
     * @param bool|string $name    Push连接标识 true 强制重新初始化
     * @return Driver
     */
    public static function connect(array $options = [], $name = false)
    {
        $type = !empty($options['type']) ? $options['type'] : 'zhanzhang';
        $config = get_addon_config('baidupush');
        $type = strtolower($type);
        $options = array_merge($options, $config);
        if (false === $name) {
            $name = md5(serialize($options));
        }
        if (true === $name || !isset(self::$instance[$name])) {
            $class = false === strpos($type, '\\') ?
            '\\addons\\baidupush\\library\\push\\driver\\' . ucwords($type) :
            $type;
            if (true === $name) {
                return new $class($options);
            }
            self::$instance[$name] = new $class($options);
        }
        return self::$instance[$name];
    }

    /**
     * 自动初始化Push
     * @access public
     * @param array $options 配置数组
     * @return Driver
     */
    public static function init(array $options = [])
    {
        if (is_null(self::$handler)) {
            self::$handler = self::connect($options);
        }

        return self::$handler;
    }

    /**
     * 推送实时链接
     * @access public
     * @param array $urls URL数组
     * @return bool
     */
    public static function realtime($urls)
    {
        return self::init()->realtime($urls);
    }

    /**
     * 推送历史链接
     * @access public
     * @param array $urls URL数组
     * @return bool
     */
    public static function history($urls)
    {
        return self::init()->history($urls);
    }

    /**
     * 删除链接
     * @access public
     * @param array $urls URL数组
     * @return mixed
     */
    public static function delete($urls)
    {
        return self::init()->delete($urls);
    }

}