HEX
Server: Apache/2.4.65 (Debian)
System: Linux web6 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64
User: innocamp (1028)
PHP: 7.4.33
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/mklgolf/public_html/wp-content/plugins/jet-menu/integration/manager.php
<?php
namespace Jet_Menu;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}

/**
 * Class Integration
 * @package Jet_Menu
 */
class Integration {

	/**
	 * A reference to an instance of this class.
	 *
	 * @since 1.0.0
	 * @var   object
	 */
	private static $instance = null;

	/**
	 * Dirname holder for plugins integration loader
	 *
	 * @var string
	 */
	private $dir = null;

	/**
	 * Returns the instance.
	 *
	 * @since  1.0.0
	 * @return object
	 */
	public static function get_instance() {

		// If the single instance hasn't been set, set it now.
		if ( null == self::$instance ) {
			self::$instance = new self;
		}
		return self::$instance;
	}

	/**
	 * Settings constructor.
	 */
	public function __construct() {
		$this->include_integration_theme_file();
		$this->include_integration_plugin_file();
	}

	/**
	 * Include integration theme file
	 *
	 * @return void
	 */
	public function include_integration_theme_file() {

		$template = get_template();
		$disabled = jet_menu()->settings_manager->options_manager->get_option( 'jet-menu-disable-integration-' . $template, 'false' );

		if ( is_readable( jet_menu()->plugin_path( "integration/themes/{$template}/functions.php" ) ) && ! filter_var( $disabled, FILTER_VALIDATE_BOOLEAN ) ) {
			require jet_menu()->plugin_path( "integration/themes/{$template}/functions.php" );
		}

	}

	/**
	 * Include plugin integrations file
	 *
	 * @return [type] [description]
	 */
	public function include_integration_plugin_file() {

		$active_plugins = get_option( 'active_plugins' );

		foreach ( glob( jet_menu()->plugin_path( 'integration/plugins/*' ) ) as $path ) {

			if ( ! is_dir( $path ) ) {
				continue;
			}

			$this->dir = basename( $path );

			$matched_plugins = array_filter( $active_plugins, array( $this, 'is_plugin_active' ) );

			if ( ! empty( $matched_plugins ) ) {
				require "{$path}/functions.php";
			}
		}
	}

	/**
	 * Callback to check if plugin is active
	 * @param  [type]  $plugin [description]
	 * @return boolean         [description]
	 */
	public function is_plugin_active( $plugin ) {
		return ( false !== strpos( $plugin, $this->dir . '/' ) );
	}

	/**
	 * Returns URL for current theme in theme-integration directory
	 *
	 * @param  string $file Path to file inside theme folder
	 * @return [type]       [description]
	 */
	public function get_theme_url( $file ) {
		$template = get_template();

		return jet_menu()->plugin_url( "integration/themes/{$template}/{$file}" );
	}

}