Edit File by line
/home/barbar84/www/wp-conte.../plugins/ninja-fo.../lib
File: NF_AddonChecker.php
<?php
[0] Fix | Delete
[1] Fix | Delete
final class NF_AddonChecker
[2] Fix | Delete
{
[3] Fix | Delete
public function __construct()
[4] Fix | Delete
{
[5] Fix | Delete
add_action( 'plugins_loaded', array( $this, 'check_plugins' ) );
[6] Fix | Delete
add_action( 'admin_notices', array( $this, 'deactivation_notice' ) );
[7] Fix | Delete
}
[8] Fix | Delete
[9] Fix | Delete
public function check_plugins()
[10] Fix | Delete
{
[11] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[12] Fix | Delete
[13] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[14] Fix | Delete
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
$plugins = get_plugins();
[18] Fix | Delete
[19] Fix | Delete
foreach( $plugins as $plugin => $data ){
[20] Fix | Delete
[21] Fix | Delete
if( 'ninja-forms/ninja-forms.php' != $plugin && 0 === strncmp( $plugin, 'ninja-forms-', 12 ) && version_compare( $data[ 'Version' ], '3', '<' ) ){
[22] Fix | Delete
[23] Fix | Delete
if( ! is_plugin_active( $plugin ) ) continue;
[24] Fix | Delete
[25] Fix | Delete
deactivate_plugins($plugin);
[26] Fix | Delete
[27] Fix | Delete
wp_redirect( admin_url( 'plugins.php?nf-deactivated=' . $plugin ) ); exit;
[28] Fix | Delete
}
[29] Fix | Delete
}
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
public function deactivation_notice()
[33] Fix | Delete
{
[34] Fix | Delete
if( ! isset( $_GET[ 'nf-deactivated' ] ) ) return;
[35] Fix | Delete
[36] Fix | Delete
$plugin = sanitize_text_field( $_GET[ 'nf-deactivated' ] );
[37] Fix | Delete
[38] Fix | Delete
?>
[39] Fix | Delete
<div class="notice notice-error is-dismissible">
[40] Fix | Delete
<p><?php echo sprintf( esc_html__( 'Oops! That addon is not yet compatible with Ninja Forms THREE. %sLearn More%s.', 'ninja-forms' ), '<a target="_blank" href="https://ninjaforms.com/ninja-forms-three-extension-development-master-list/">', '</a>' ); ?></p>
[41] Fix | Delete
<p><?php echo sprintf( esc_html__( '%s was deactivated.', 'ninja-forms' ), '<code>' . $plugin . '</code>'); ?></p>
[42] Fix | Delete
</div>
[43] Fix | Delete
<?php
[44] Fix | Delete
}
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
new NF_AddonChecker();
[48] Fix | Delete
[49] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function