plugin_path = array_filter( explode( '/', $plugin_path ) ); $this->plugin_path = end( $this->plugin_path ); // Set plugin file. $this->plugin_file = $plugin_file; // Get the list of plugins. $plugins = get_plugins(); // Set the real plugin name if the plugin is in the given list. $this->plugin_name = isset( $plugins[ $this->plugin_path . '/' . $this->plugin_file ]['Name'] ) ? $plugins[ $this->plugin_path . '/' . $this->plugin_file ]['Name'] : __( 'This plugin', 'affiliatewp-affiliate-area-shortcodes' ); // Is AffiliateWP installed? $this->has_affiliatewp = ! empty( preg_grep('/\/affiliate-wp\.php$/', array_keys( $plugins ) ) ); } /** * Displays the missing AffiliateWP notice. * * @since 1.0.0 */ public function run() { // Display notice add_action( 'admin_notices', array( $this, 'missing_affiliatewp_notice' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_banner_styles' ) ); } /** * Renders the AffiliateWP banner. * * @since 1.3.1 */ public function render_banner() { global $current_screen; // Don't show the banner anywhere except the Dashboard and Plugins page. if ( 'plugins' !== $current_screen->base && 'dashboard' !== $current_screen->base ) { return; } ?>
has_affiliatewp ) { /* translators: 1: Plugin name, 2: link to the AffiliateWP pricing page. */ echo '' . wp_kses_post( sprintf( __( '%1$s requires %2$s. Please activate it to continue.', 'affiliatewp-affiliate-area-shortcodes' ), esc_html( $this->plugin_name ), 'AffiliateWP' ) ) . '