| @@ -1,18 +1,16 @@ | ||
| 1 | 1 | <?php |
| 2 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); | |
| 2 | +use Imagify\Notices\Notices; | |
| 3 | 3 | |
| 4 | +defined( 'ABSPATH' ) || exit; | |
| 5 | + | |
| 4 | 6 | if ( defined( 'RML_FILE' ) ) : |
| 5 | - | |
| 6 | 7 | /** |
| 8 | + * Dequeue all WP Real Media Library's styles and scripts where we use ours. | |
| 9 | + * | |
| 7 | 10 | * Prevent WP Real Media Library to use its outdated version of SweetAlert where we need ours, and to mess with our CSS styles. |
| 8 | - */ | |
| 9 | - add_action( 'current_screen', 'imagify_wprml_init' ); | |
| 10 | - /** | |
| 11 | - * Dequeue all WP Real Media Library's styles and scripts where we use ours. | |
| 12 | 11 | * |
| 13 | - * @since 1.6.13 | |
| 14 | - * @author Grégory Viguier | |
| 12 | + * @since 1.6.13 | |
| 15 | 13 | */ |
| 16 | 14 | function imagify_wprml_init() { |
| 17 | 15 | static $done = false; |
| 18 | 16 | |
| @@ -24,9 +22,9 @@ | ||
| 24 | 22 | if ( ! class_exists( '\\MatthiasWeb\\RealMediaLibrary\\general\\Backend' ) ) { |
| 25 | 23 | return; |
| 26 | 24 | } |
| 27 | 25 | |
| 28 | - $notices = Imagify_Notices::get_instance(); | |
| 26 | + $notices = Notices::get_instance(); | |
| 29 | 27 | |
| 30 | 28 | if ( $notices->has_notices() && ( $notices->display_welcome_steps() || $notices->display_wrong_api_key() ) ) { |
| 31 | 29 | // We display a notice that uses SweetAlert. |
| 32 | 30 | imagify_wprml_dequeue(); |
| @@ -43,25 +41,25 @@ | ||
| 43 | 41 | // We display the NGG Bulk Optimization page. |
| 44 | 42 | imagify_wprml_dequeue(); |
| 45 | 43 | } |
| 46 | 44 | } |
| 45 | + add_action( 'current_screen', 'imagify_wprml_init' ); | |
| 47 | 46 | |
| 48 | 47 | /** |
| 49 | 48 | * Prevent WP Real Media Library to enqueue its styles and scripts. |
| 50 | 49 | * |
| 51 | - * @since 1.6.13 | |
| 52 | - * @author Grégory Viguier | |
| 50 | + * @since 1.6.13 | |
| 53 | 51 | */ |
| 54 | 52 | function imagify_wprml_dequeue() { |
| 55 | 53 | $instance = \MatthiasWeb\RealMediaLibrary\general\Backend::getInstance(); |
| 56 | 54 | |
| 57 | 55 | remove_action( 'admin_enqueue_scripts', [ $instance, 'admin_enqueue_scripts' ], 0 ); |
| 58 | - remove_action( 'admin_footer', [ $instance, 'admin_footer' ] ); | |
| 56 | + remove_action( 'admin_footer', [ $instance, 'admin_footer' ] ); | |
| 59 | 57 | |
| 60 | 58 | if ( class_exists( '\\MatthiasWeb\\RealMediaLibrary\\general\\FolderShortcode' ) ) { |
| 61 | 59 | $instance = \MatthiasWeb\RealMediaLibrary\general\FolderShortcode::getInstance(); |
| 62 | 60 | |
| 63 | - remove_action( 'admin_head', [ $instance, 'admin_head' ] ); | |
| 61 | + remove_action( 'admin_head', [ $instance, 'admin_head' ] ); | |
| 64 | 62 | remove_action( 'admin_enqueue_scripts', [ $instance, 'admin_enqueue_scripts' ] ); |
| 65 | 63 | } |
| 66 | 64 | |
| 67 | 65 | if ( class_exists( '\\MatthiasWeb\\RealMediaLibrary\\comp\\PageBuilders' ) ) { |