PUM_Site_Assets::init()

Initialize


Description Description


Source Source

File: classes/Site/Assets.php

	public static function init() {
		self::$cache_url = PUM_Helpers::get_cache_dir_url();
		self::$debug     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
		self::$suffix    = self::$debug ? '' : '.min';
		self::$js_url    = Popup_Maker::$URL . 'assets/js/';
		self::$css_url   = Popup_Maker::$URL . 'assets/css/';

		// Register assets early.
		add_action( 'wp_enqueue_scripts', array( __CLASS__, 'register_styles' ) );
		add_action( 'wp_enqueue_scripts', array( __CLASS__, 'register_scripts' ) );

		// Localize after popups rendered in PUM_Site_Popups
		add_action( 'wp_footer', array( __CLASS__, 'late_localize_scripts' ), 19 );

		// Checks preloaded popups in the head for which assets to enqueue.
		add_action( 'pum_preload_popup', array( __CLASS__, 'enqueue_popup_assets' ) );
		add_filter( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_page_assets' ) );

		add_action( 'wp_enqueue_scripts', array( __CLASS__, 'fix_broken_extension_scripts' ), 100 );

		// Allow forcing assets to load.
		add_action( 'wp_head', array( __CLASS__, 'check_force_script_loading' ) );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.