BP_Reply_By_Email_IMAP::init PHP Метод

init() публичный статический Метод

Creates a singleton instance of the BP_Reply_By_Email_IMAP class
public static init ( ) : BP_Reply_By_Email_IMAP
Результат BP_Reply_By_Email_IMAP object
    public static function &init()
    {
        if (self::$instance === false) {
            self::$instance = new self();
        }
        return self::$instance;
    }

Usage Example

Пример #1
0
/**
 * Listens to requests to check the IMAP inbox.
 *
 * If a POST request is made to check the IMAP inbox, RBE will actually
 * process this request in this function.  We also make sure that WP-cron is
 * running before pinging the IMAP inbox.
 *
 * @since 1.0-RC3
 *
 * @see bp_rbe_spawn_inbox_check()
 */
function bp_rbe_run_inbox_listener()
{
    if (empty($_POST['_bp_rbe_check'])) {
        return;
    }
    // make sure WP-cron isn't running
    if (defined('DOING_CRON') || isset($_GET['doing_wp_cron'])) {
        return;
    }
    if (bp_rbe_is_connecting(array('clearcache' => true))) {
        return;
    }
    if (bp_rbe_is_connected()) {
        return;
    }
    bp_rbe_add_imap_lock();
    // run our inbox check
    $imap = BP_Reply_By_Email_IMAP::init();
    $imap = $imap->run();
    // Do not run the inbox check again on failure.
    if (false === $imap) {
        remove_action('shutdown', 'bp_rbe_spawn_inbox_check');
    }
    // kill the rest of this page
    die;
}