wpml-media-dependencies.class.php
811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
class WPML_Media_Dependencies {
function check() {
$all_ok = true;
// Check if WPML is active. If not display warning message and don't load WPML-media
if ( ! defined( 'ICL_SITEPRESS_VERSION' ) || ICL_PLUGIN_INACTIVE ) {
add_action( 'admin_notices', array( $this, '_no_wpml_warning' ) );
$all_ok = false;
}
if ( ! WPML_Core_Version_Check::is_ok( WPML_MEDIA_PATH . '/wpml-dependencies.json' ) ) {
$all_ok = false;
}
if ( ! $all_ok ) {
return false;
}
return true;
}
function _no_wpml_warning() { ?>
<div class="message error wpml-media-inactive"><p>
<?php
printf(
__( 'WPML Media is enabled but not effective. It requires <a href="%s">WPML</a> in order to work.', 'wpml-media' ),
'https://wpml.org/'
);
?>
</p></div>
<?php
}
}