: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @package PUM\SDK\ActivationHandler
* @copyright Copyright (c) 2023, Code Atlantic LLC
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
* Popup Maker Extension Activation Handler Class
class PUM_Extension_Activation {
* Setup the activation class
* @param string $plugin_path Path.
* @param string $plugin_file File.
public function __construct( $plugin_path, $plugin_file ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$plugins = get_plugins();
$plugin_path = array_filter( explode( '/', $plugin_path ) );
$this->plugin_path = end( $plugin_path );
$this->plugin_file = $plugin_file;
if ( isset( $plugins[ $this->plugin_path . '/' . $this->plugin_file ]['Name'] ) ) {
$this->plugin_name = str_replace( 'Popup Maker - ', '', $plugins[ $this->plugin_path . '/' . $this->plugin_file ]['Name'] );
$this->plugin_name = __( 'This plugin', 'popup-maker' );
// Is Popup Maker installed.
foreach ( $plugins as $plugin_path => $plugin ) {
if ( 'Popup Maker' === $plugin['Name'] ) {
$this->has_popmake = true;
$this->popmake_base = $plugin_path;
* Process plugin deactivation
add_action( 'admin_notices', [ $this, 'missing_popmake_notice' ] );
* Display notice if Popup Maker isn't installed
public function missing_popmake_notice() {
if ( $this->has_popmake ) {
$url = esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $this->popmake_base ), 'activate-plugin_' . $this->popmake_base ) );
$link = '<a href="' . $url . '">' . __( 'activate it', 'popup-maker' ) . '</a>';
$url = esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=popup-maker' ), 'install-plugin_popup-maker' ) );
$link = '<a href="' . $url . '">' . __( 'install it', 'popup-maker' ) . '</a>';
// translators: 1. plugin name.
echo '<div class="error"><p>' . esc_html( $this->plugin_name . sprintf( __( ' requires Popup Maker! Please %s to continue!', 'popup-maker' ), $link ) ) . '</p></div>';