PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.3.0
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.3.0
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / inc / 3rd-party / wp-real-media-library.php

wp-real-media-library.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.3.0, at inc/3rd-party/wp-real-media-library.php

73 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 use Imagify\Notices\Notices;
3
4 defined( 'ABSPATH' ) || exit;
5
6 if ( defined( 'RML_FILE' ) ) :
7 /**
8 * Dequeue all WP Real Media Library's styles and scripts where we use ours.
9 *
10 * Prevent WP Real Media Library to use its outdated version of SweetAlert where we need ours, and to mess with our CSS styles.
11 *
12 * @since 1.6.13
13 */
14 function imagify_wprml_init() {
15 static $done = false;
16
17 if ( $done ) {
18 return;
19 }
20 $done = true;
21
22 if ( ! class_exists( '\\MatthiasWeb\\RealMediaLibrary\\general\\Backend' ) ) {
23 return;
24 }
25
26 $notices = Notices::get_instance();
27
28 if ( $notices->has_notices() && ( $notices->display_welcome_steps() || $notices->display_wrong_api_key() ) ) {
29 // We display a notice that uses SweetAlert.
30 imagify_wprml_dequeue();
31 return;
32 }
33
34 if ( imagify_is_screen( 'bulk' ) || imagify_is_screen( 'imagify-settings' ) ) {
35 // We display a page that uses SweetAlert.
36 imagify_wprml_dequeue();
37 return;
38 }
39
40 if ( function_exists( 'imagify_get_ngg_bulk_screen_id' ) && imagify_is_screen( imagify_get_ngg_bulk_screen_id() ) ) {
41 // We display the NGG Bulk Optimization page.
42 imagify_wprml_dequeue();
43 }
44 }
45 add_action( 'current_screen', 'imagify_wprml_init' );
46
47 /**
48 * Prevent WP Real Media Library to enqueue its styles and scripts.
49 *
50 * @since 1.6.13
51 */
52 function imagify_wprml_dequeue() {
53 $instance = \MatthiasWeb\RealMediaLibrary\general\Backend::getInstance();
54
55 remove_action( 'admin_enqueue_scripts', [ $instance, 'admin_enqueue_scripts' ], 0 );
56 remove_action( 'admin_footer', [ $instance, 'admin_footer' ] );
57
58 if ( class_exists( '\\MatthiasWeb\\RealMediaLibrary\\general\\FolderShortcode' ) ) {
59 $instance = \MatthiasWeb\RealMediaLibrary\general\FolderShortcode::getInstance();
60
61 remove_action( 'admin_head', [ $instance, 'admin_head' ] );
62 remove_action( 'admin_enqueue_scripts', [ $instance, 'admin_enqueue_scripts' ] );
63 }
64
65 if ( class_exists( '\\MatthiasWeb\\RealMediaLibrary\\comp\\PageBuilders' ) ) {
66 $instance = \MatthiasWeb\RealMediaLibrary\comp\PageBuilders::getInstance();
67
68 remove_action( 'init', [ $instance, 'init' ] );
69 }
70 }
71
72 endif;
73