current_plugin_name = $current_plugin_name; $this->plugins = $plugins; add_action( 'admin_notices', array( $this, 'admin_notices' ) ); } /** * Add admin notice. * * @return void */ public function admin_notices() { $screen = get_current_screen(); if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) { return; } foreach ( $this->plugins as $plugin ) { if ( ! isset( $plugin['slug'], $plugin['name'] ) ) { continue; } $plugin = Plugin::get_instance( $plugin['slug'], $plugin['name'] ); $notice = $this->add_notice( $plugin ); /** * If notice is added then return. * This will prevent multiple notices for same plugin. */ if ( $notice ) { return; } } } /** * Add notice. * * @param Plugin $plugin Plugin. * * @return bool */ private function add_notice( Plugin $plugin ) { if ( $plugin->is_plugin_activated() ) { return false; } if ( $plugin->is_plugin_installed() ) { if ( ! current_user_can( 'activate_plugins' ) ) { return false; } ?>

get_plugin_name() ) ); ?> current_plugin_name ), esc_html( $plugin->get_plugin_name() ) ); ?>

get_plugin_name() ) ); ?> current_plugin_name ), esc_html( $plugin->get_plugin_name() ) ); ?>