Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/hessa.corals.io/wp-content/plugins/trx_addons/includes/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/hessa.corals.io/wp-content/plugins/trx_addons/includes/classes/Singleton.php
<?php
namespace TrxAddons\Core;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Base class for the singleton pattern
 * 
 * @abstract
 */
if ( ! class_exists( 'Singleton' ) ) {
	abstract class Singleton {

		/**
		 * Holds instances of all classes, based on Singleton pattern
		 *
		 * @access private
		 * @static
		 *
		 * @var instances
		 */
		private static $instances = [];

		/**
		 * Plugin constructor.
		 * 
		 * It is protected to prevent creating a new instance of the class via the `new` operator from outside of this class.
		 * But it is not private to allow extending the class.
		 *
		 * @access protected
		 */
		protected function __construct() {
		}

		/**
		 * Ensures only one instance of the plugin class is loaded or can be loaded.
		 *
		 * @access public
		 * @static
		 *
		 * @return object  An instance of the class.
		 */
		public static function instance() {
			$subclass = static::class;
			if ( ! isset( self::$instances[ $subclass ] ) ) {
				// A "static" keyword in PHP is used instead of the class name.
				// When the method is called in a subclass, we want to create an
				// instance of the subclass here.
				self::$instances[ $subclass ] = new static();
			}
			return self::$instances[ $subclass ];
		}

		/**
		 * 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
		 */
		public function __clone() {
			// Cloning instances of the class is forbidden.
			_doing_it_wrong( __FUNCTION__, esc_html__( 'Clone a singleton is prohibited.', 'trx_addons' ), '1.0.0' );
		}

		/**
		 * Disable unserializing of the class.
		 *
		 * @access public
		 */
		public function __wakeup() {
			// Unserializing instances of the class is forbidden.
			_doing_it_wrong( __FUNCTION__, esc_html__( 'Serialize a singleton is prohibited.', 'trx_addons' ), '1.0.0' );
		}
	}
}

Spamworldpro Mini