HEX
Server: Apache/2
System: Linux ind.multivistaglobal.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: multivis (1002)
PHP: 8.1.32
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/multivis/public_html/wp-content/plugins/popup-maker/classes/Plugin/Extension.php
<?php
/**
 * Extension base class
 *
 * @package   PopupMaker\Plugin
 * @copyright Copyright (c) 2024, Code Atlantic LLC
 */

namespace PopupMaker\Plugin;

defined( 'ABSPATH' ) || exit;

/**
 * Abstract base class for all Popup Maker extensions.
 *
 * @since 1.21.0
 */
abstract class Extension extends Container {

	/**
	 * Core plugin instance.
	 *
	 * @var \PopupMaker\Plugin\Core
	 */
	protected $core;

	/**
	 * Extension constructor.
	 *
	 * @param array<string,string|bool> $config Configuration variables.
	 */
	public function __construct( $config ) {
		parent::__construct( $config );

		// Get core plugin instance.
		$this->core = \PopupMaker\plugin();
	}

	/**
	 * Register all controllers.
	 *
	 * @return array<string,\PopupMaker\Base\Controller>
	 */
	abstract protected function registered_controllers();

	/**
	 * Get core plugin instance.
	 *
	 * @return \PopupMaker\Plugin\Core
	 */
	public function core() {
		return $this->core;
	}

	/**
	 * Get a service or configuration variable.
	 *
	 * @param string $id Service or configuration variable ID.
	 * @return mixed
	 * @throws \PopupMaker\Vendor\Pimple\Exception\UnknownIdentifierException
	 */
	public function get( $id ) {
		try {
			return parent::get( $id );
		} catch ( \PopupMaker\Vendor\Pimple\Exception\UnknownIdentifierException $e ) {
			if ( $this->core()->offsetExists( $id ) ) {
				return $this->core()->get( $id );
			}

			// Re-throw the exception if we couldn't find the service.
			throw $e;
		}
	}
}