| Server IP : 109.234.162.214 / Your IP : 216.73.216.112 Web Server : Apache System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64 User : carpe ( 1178) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /var/softaculous/sitepad/editor/site-data/plugins/kkart-pro/includes/queue/ |
Upload File : |
<?php
/**
* KKART Queue
*
* @version 3.5.0
* @package Kkart\Interface
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* KKART Queue
*
* Singleton for managing the KKART queue instance.
*
* @version 3.5.0
*/
class KKART_Queue {
/**
* The single instance of the queue.
*
* @var KKART_Queue_Interface|null
*/
protected static $instance = null;
/**
* The default queue class to initialize
*
* @var string
*/
protected static $default_cass = 'KKART_Action_Queue';
/**
* Single instance of KKART_Queue_Interface
*
* @return KKART_Queue_Interface
*/
final public static function instance() {
if ( is_null( self::$instance ) ) {
$class = self::get_class();
self::$instance = new $class();
self::$instance = self::validate_instance( self::$instance );
}
return self::$instance;
}
/**
* Get class to instantiate
*
* And make sure 3rd party code has the chance to attach a custom queue class.
*
* @return string
*/
protected static function get_class() {
if ( ! did_action( 'plugins_loaded' ) ) {
kkart_doing_it_wrong( __FUNCTION__, __( 'This function should not be called before plugins_loaded.', 'kkart' ), '3.5.0' );
}
return apply_filters( 'kkart_queue_class', self::$default_cass );
}
/**
* Enforce a KKART_Queue_Interface
*
* @param KKART_Queue_Interface $instance Instance class.
* @return KKART_Queue_Interface
*/
protected static function validate_instance( $instance ) {
if ( false === ( $instance instanceof KKART_Queue_Interface ) ) {
$default_class = self::$default_cass;
/* translators: %s: Default class name */
kkart_doing_it_wrong( __FUNCTION__, sprintf( __( 'The class attached to the "kkart_queue_class" does not implement the KKART_Queue_Interface interface. The default %s class will be used instead.', 'kkart' ), $default_class ), '3.5.0' );
$instance = new $default_class();
}
return $instance;
}
}