class-wpml-st-pb-plugin.php
1.39 KB
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
38
39
40
41
42
43
44
45
46
47
<?php
class WPML_ST_PB_Plugin {
function check_requirements() {
if ( defined( 'WPML_PAGE_BUILDERS_VERSION' ) ) {
add_action( 'admin_notices', array( $this, 'disable_old_pb_notice' ) );
}
}
function is_active() {
return defined( 'WPML_PAGE_BUILDERS_VERSION' );
}
function ask_to_deactivate() {
add_action( 'admin_notices', array( $this, 'disable_old_pb_notice' ) );
}
function disable_old_pb_notice() {
$plugin_name = plugin_basename( WPML_PAGE_BUILDERS_PATH . '/plugin.php' );
$plugins_url = admin_url( '/plugins.php' );
$plugins_url = add_query_arg(
array(
'action' => 'deactivate',
'plugin_status' => 'inactive',
'_wpnonce' => urlencode( wp_create_nonce( 'deactivate-plugin_' . $plugin_name ) ),
'plugin' => urlencode( $plugin_name ),
),
$plugins_url
);
?>
<div class="message error">
<p>
<?php esc_html_e( "The WPML Page Builders plugin that you're using is now part of WPML.", 'sitepress' ); ?>
</p>
<p>
<?php esc_html_e( 'You need to deactivate the separate plugin.', 'sitepress' ); ?>
</p>
<p>
<?php esc_html_e( 'No worries, the full functionality is preserved in WPML String Translation.', 'sitepress' ); ?>
</p>
<p>
<a class="button-primary" href="<?php echo esc_url( $plugins_url ); ?>"><?php esc_html_e( 'Deactivate WPML Page Builders', 'sitepress' ); ?></a>
</p>
</div>
<?php
}
}