HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/delstar/wp-content/plugins/essential-grid/includes/addons/addon.class.php
<?php
/**
 * @package   Essential_Grid
 * @author    ThemePunch <info@themepunch.com>
 * @link      https://www.essential-grid.com/
 * @copyright 2024 ThemePunch
 */

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

abstract class Essential_Grid_Abstract_Addon
{
	protected string $_handle;
	
	protected string $_import_keys;
	
	public function __construct()
	{
	}

	/**
	 * @return string
	 */
	public function get_handle(): string {
		return $this->_handle;
	}

	/**
	 * @return array
	 */
	public function get_options(): array {
		return get_option($this->_handle . '_options', []);
	}
	
	/**
	 * is addon installed and activated
	 *
	 * @return bool
	 */
	public function is_installed_active(): bool {
		$esg_addons = Essential_Grid_Addons::instance();
		$addons = $esg_addons->get_addons_list();
		return !empty($addons[$this->_handle]) && $addons[$this->_handle]->installed && $addons[$this->_handle]->active;
	}

	/**
	 * is addon used by any grid
	 * 
	 * @return bool
	 */
	public function is_used_in_grids(): bool {
		$arrGrids = Essential_Grid_Db::get_essential_grids(false, false);
		foreach ($arrGrids as $grid) {
			if (isset($grid->params['addons'][$this->_handle])) return true;
		}
		return false;
	}

	/**
	 * @return string
	 */
	public function get_import_keys(): string {
		return $this->_import_keys;
	}

	/**
	 * check if import key can be processed by addon
	 *
	 * @param array $keys
	 *
	 * @return bool
	 */
	public function check_import_keys( array $keys): bool {
		return false;
	}

	/**
	 * is addon missing
	 *
	 * @return bool
	 */
	public function is_missing(): bool {
		if ($this->is_installed_active()) return false;
		return $this->is_used_in_grids();
	}
}