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/addons/base/class-bd-addon.php
<?php
/**
 * Base class for all BD Addons.
 *
 * @since   5.5
 *
 * @author  Sudar
 *
 * @package BulkDelete\Addons\Base
 */
defined( 'ABSPATH' ) || exit; // Exit if accessed directly

/**
 * Base class for BD Addons.
 *
 * @abstract
 *
 * @since 5.5
 */
abstract class BD_Addon {
	/**
	 * @var string Addon Name.
	 */
	protected $addon_name;

	/**
	 * @var string Addon Code.
	 */
	protected $addon_code;

	/**
	 * @var string Addon File.
	 */
	protected $addon_file;

	/**
	 * @var string Addon Version.
	 */
	protected $addon_version;

	/**
	 * @var string Addon Author.
	 */
	protected $addon_author = 'Sudar Muthu';

	/**
	 * @var Module Name.
	 */
	protected $module;

	/**
	 * @var object License Handler.
	 */
	protected $license_handler;

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

	/**
	 * Use `factory()` method to create instance of this class.
	 * Don't create instances directly.
	 *
	 * @since 5.5
	 * @see factory()
	 */
	public function __construct() {
		$this->setup();
	}

	/**
	 * Setup the module.
	 *
	 * @access protected
	 *
	 * @since 5.5
	 */
	protected function setup() {
		$this->initialize();
		$this->setup_translation();
		if ( $this->dependencies_met() ) {
			$this->setup_hooks();
		}
	}

	/**
	 * Check if all dependencies are met.
	 * To check for dependencies overload this method in the child class.
	 *
	 * @return bool True if dependencies met, False otherwise.
	 */
	protected function dependencies_met() {
		return true;
	}

	/**
	 * Setup translation.
	 *
	 * @access protected
	 *
	 * @since 5.5
	 */
	protected function setup_translation() {
		$bd = BULK_DELETE();

		// Load translation files from Bulk Delete language folder
		load_plugin_textdomain( 'bulk-delete', false, $bd->translations );
	}

	/**
	 * Setup license handler.
	 *
	 * @since 5.5
	 *
	 * @param string $plugin_file Addon file name relative to plugin directory.
	 */
	public function setup_license_handler( $plugin_file ) {
		$this->addon_file      = $plugin_file;
		$this->license_handler = new BD_License_Handler(
			$this->addon_name,
			$this->addon_code,
			$this->addon_version,
			$this->addon_file,
			$this->addon_author
		);
	}

	/**
	 * Get addon class name.
	 *
	 * @since 5.5
	 *
	 * @return string Addon class name
	 */
	protected function get_addon_class_name() {
		return bd_get_addon_class_name( $this->addon_name );
	}
}