diff --git a/src/compatibility/ewww.php b/src/compatibility/ewww.php index e536a16077..d045d98064 100644 --- a/src/compatibility/ewww.php +++ b/src/compatibility/ewww.php @@ -6,7 +6,7 @@ } if ( ! function_exists( 'stackable_load_image_optimizer_polyfill_frontend_script' ) ) { - function stackable_load_image_optimizer_polyfill_frontend_script( $block_content, $block ) { + function stackable_load_image_optimizer_polyfill_frontend_script( $block_content ) { // If Easy IO setting is activated for EWWW Image Optimizer, dynamic images becomes blurry. // Load the script to fix the issue. if ( ! is_admin() ) { @@ -26,7 +26,7 @@ function stackable_load_image_optimizer_polyfill_frontend_script( $block_content function stackable_ewww_image_optimzer_plugin_checker() { if ( ! is_admin() && defined( 'EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE' ) ) { // Load the script in the frontend if EWWW Image Optimizer is active. - add_action( 'stackable/enqueue_scripts', 'stackable_load_image_optimizer_polyfill_frontend_script', 10, 2 ); + add_action( 'stackable/enqueue_scripts', 'stackable_load_image_optimizer_polyfill_frontend_script' ); } } diff --git a/src/init.php b/src/init.php index ab886cb39e..47af91431d 100644 --- a/src/init.php +++ b/src/init.php @@ -20,14 +20,14 @@ class Stackable_Init { * Holds the scripts which are already enqueued, to ensure we only do it once per script. * @var Array */ - public $scripts_loaded = array(); + public static $scripts_loaded = array(); /** * Enqueue the frontend scripts, ensures we only do it once. * * @var boolean */ - public $is_main_script_loaded = false; + public static $is_main_script_loaded = false; /** * Add our hooks. @@ -81,9 +81,9 @@ function __construct() { * @return void */ public function maybe_force_css_load() { - if ( ! $this->is_main_script_loaded && apply_filters( 'stackable_force_css_load', false ) ) { - $this->block_enqueue_frontend_assets(); - $this->is_main_script_loaded = true; + if ( ! self::$is_main_script_loaded && apply_filters( 'stackable_force_css_load', false ) ) { + self::block_enqueue_frontend_assets(); + self::$is_main_script_loaded = true; } } @@ -92,7 +92,7 @@ public function maybe_force_css_load() { * * @since 0.1 */ - public function register_frontend_assets() { + public static function register_frontend_assets() { // Frontend block styles. wp_register_style( 'ugb-style-css', @@ -171,7 +171,7 @@ public function register_frontend_assets() { */ public function load_frontend_scripts_conditionally_head() { // Only do this in the frontend. - if ( $this->is_main_script_loaded ) { + if ( self::$is_main_script_loaded ) { return; } @@ -186,8 +186,8 @@ public function load_frontend_scripts_conditionally_head() { stripos( $post->post_content, 'stk-highlight' ) !== false ) { // Enqueue our main scripts and styles. - $this->block_enqueue_frontend_assets(); - $this->is_main_script_loaded = true; + self::block_enqueue_frontend_assets(); + self::$is_main_script_loaded = true; } } } @@ -216,12 +216,12 @@ public function load_frontend_scripts_conditionally( $block_content, $block ) { // Load our main frontend scripts if there's a Stackable block // loaded in the frontend. - if ( ! $this->is_main_script_loaded && ! is_admin() ) { + if ( ! self::$is_main_script_loaded && ! is_admin() ) { if ( strpos( $block_content, '