Server IP : 172.24.0.40 / Your IP : 216.73.216.10 Web Server : Apache System : Linux dbweb26.ust.edu.ph 4.18.0-513.5.1.el8_9.x86_64 #1 SMP Fri Sep 29 05:21:10 EDT 2023 x86_64 User : apache ( 48) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/tomas/public_html/wp-content/plugins/ninja-forms/lib/ |
Upload File : |
<?php final class NF_AddonChecker { public function __construct() { add_action( 'plugins_loaded', array( $this, 'check_plugins' ) ); add_action( 'admin_notices', array( $this, 'deactivation_notice' ) ); } public function check_plugins() { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugins = get_plugins(); foreach( $plugins as $plugin => $data ){ if( 'ninja-forms/ninja-forms.php' != $plugin && 0 === strncmp( $plugin, 'ninja-forms-', 12 ) && version_compare( $data[ 'Version' ], '3', '<' ) ){ if( ! is_plugin_active( $plugin ) ) continue; deactivate_plugins($plugin); wp_redirect( admin_url( 'plugins.php?nf-deactivated=' . $plugin ) ); exit; } } } public function deactivation_notice() { if( ! isset( $_GET[ 'nf-deactivated' ] ) ) return; $plugin = sanitize_text_field( $_GET[ 'nf-deactivated' ] ); ?> <div class="notice notice-error is-dismissible"> <p><?php esc_html_e( 'Oops! That addon is no longer compatible with Ninja Forms.', 'ninja-forms' ); ?></p> <p><?php echo sprintf( esc_html__( '%s was deactivated.', 'ninja-forms' ), '<code>' . $plugin . '</code>'); ?></p> </div> <?php } } new NF_AddonChecker();