HEX
Server: nginx/1.24.0
System: Linux iZm5eic9piryinoecjybjoZ 3.10.0-1160.114.2.el7.x86_64 #1 SMP Wed Mar 20 15:54:52 UTC 2024 x86_64
User: www (1000)
PHP: 8.2.28
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/h3.iyingtaos.cn/wp-content/plugins/bulk-delete/include/Core/Addon/BaseAddon.php
<?php

namespace BulkWP\BulkDelete\Core\Addon;

use BD_License_Handler;
use BulkWP\BulkDelete\Core\BulkDelete;

defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

/**
 * Encapsulates the logic for a add-on.
 *
 * @since 6.0.0
 */
abstract class BaseAddon {
	/**
	 * Details of the Add-on.
	 *
	 * @var \BulkWP\BulkDelete\Core\Addon\AddonInfo
	 */
	protected $addon_info;

	/**
	 * Handler for license.
	 *
	 * @var \BD_License_Handler
	 */
	protected $license_handler;

	/**
	 * Initialize and setup variables.
	 *
	 * @return void
	 */
	abstract protected function initialize();

	/**
	 * Register the add-on.
	 *
	 * This method will be called in the `bd_loaded` hook.
	 *
	 * @return void
	 */
	abstract public function register();

	/**
	 * Create a new instance of the add-on.
	 *
	 * @param \BulkWP\BulkDelete\Core\Addon\AddonInfo $addon_info Add-on Details.
	 */
	public function __construct( $addon_info ) {
		$this->addon_info = $addon_info;

		$this->initialize();
		$this->setup_license_handler();
	}

	/**
	 * Get details about the add-on.
	 *
	 * @return \BulkWP\BulkDelete\Core\Addon\AddonInfo Add-on Info.
	 */
	public function get_info() {
		return $this->addon_info;
	}

	/**
	 * Get reference to the main Bulk Delete object.
	 *
	 * @return \BulkWP\BulkDelete\Core\BulkDelete BulkDelete object.
	 */
	public function get_bd() {
		return BulkDelete::get_instance();
	}

	/**
	 * Setup License Handler.
	 *
	 * TODO: Need this to be refactored.
	 */
	protected function setup_license_handler() {
		$this->license_handler = new BD_License_Handler(
			$this->addon_info->get_name(),
			$this->addon_info->get_code(),
			$this->addon_info->get_version(),
			$this->addon_info->get_root_file(),
			$this->addon_info->get_author()
		);
	}
}