| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' ); |
| 3 |
|
| 4 |
if ( defined( 'WP_ROCKET_VERSION' ) ) : |
| 5 |
|
| 6 |
add_action( 'imagify_assets_enqueued', 'imagify_dequeue_sweetalert_wprocket' ); |
| 7 |
/** |
| 8 |
* Don't load Imagify CSS & JS files on WP Rocket options screen to avoid conflict with older version of SweetAlert. |
| 9 |
* Since 1.6.10 they should be enqueued only if one of our notices displays here. |
| 10 |
* |
| 11 |
* @since 1.6.9.1 |
| 12 |
* @since 1.6.10 Use the new class Imagify_Assets. |
| 13 |
* @author Jonathan Buttigieg |
| 14 |
* @author Grégory Viguier |
| 15 |
*/ |
| 16 |
function imagify_dequeue_sweetalert_wprocket() { |
| 17 |
if ( ! defined( 'WP_ROCKET_PLUGIN_SLUG' ) ) { |
| 18 |
return; |
| 19 |
} |
| 20 |
|
| 21 |
if ( ! imagify_is_screen( 'settings_page_' . WP_ROCKET_PLUGIN_SLUG ) && ! imagify_is_screen( 'settings_page_' . WP_ROCKET_PLUGIN_SLUG . '-network' ) ) { |
| 22 |
return; |
| 23 |
} |
| 24 |
|
| 25 |
Imagify_Assets::get_instance()->dequeue_script( array( 'sweetalert-core', 'sweetalert', 'notices' ) ); |
| 26 |
} |
| 27 |
|
| 28 |
endif; |
| 29 |
|