Current Path : /storage/v11800/sahityaonline/public_html/wp-content/plugins/template-kit-import/inc/utils/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/sahityaonline/public_html/wp-content/plugins/template-kit-import/inc/utils/class-base.php |
<?php
/**
* Template Kit Import:
*
* Base class for extending our other classes upon.
*
* @package Envato/Template_Kit_Import
* @since 0.0.2
*/
namespace Template_Kit_Import\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Envato Elements plugin.
*
* The main plugin handler class is responsible for initializing Envato Elements. The
* class registers and all the components required to run the plugin.
*
* @since 0.0.2
*/
abstract class Base {
const PAGE_SLUG = ENVATO_TEMPLATE_KIT_IMPORT_SLUG;
/**
* Holds the plugin instance.
*
* @since 0.0.2
* @access protected
* @static
*
* @var Base
*/
private static $instances = array();
/**
* Disable class cloning and throw an error on object clone.
*
* The whole idea of the singleton design pattern is that there is a single
* object. Therefore, we don't want the object to be cloned.
*
* @access public
* @since 0.0.2
*/
public function __clone() {
// Cloning instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'template-kit-import' ), '1.0.0' );
}
/**
* Disable unserializing of the class.
*
* @access public
* @since 0.0.2
*/
public function __wakeup() {
// Unserializing instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'template-kit-import' ), '1.0.0' );
}
/**
* Sets up a single instance of the plugin.
*
* @since 0.0.2
* @access public
* @static
*
* @return static An instance of the class.
*/
public static function get_instance() {
$module = get_called_class();
if ( ! isset( self::$instances[ $module ] ) ) {
self::$instances[ $module ] = new $module();
}
return self::$instances[ $module ];
}
}