: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (!defined('ABSPATH')) {
class Poptin_affiliate_program {
public $plugin_name = "Poptin";
public $plugin_slug = "poptin";
public function __construct() {
add_action("wp_ajax_".$this->plugin_slug."_affiliate_program", array($this, "affiliate_program"));
add_action('admin_notices', array($this, 'admin_notices'));
public function affiliate_program() {
if(current_user_can('manage_options')) {
$nonce = filter_input(INPUT_POST, 'nonce');
$days = filter_input(INPUT_POST, 'days');
if (!empty($nonce) && wp_verify_nonce($nonce, $this->plugin_slug . "_affiliate_program")) {
add_option($this->plugin_slug . "_hide_affiliate_box", "1");
$date = date("Y-m-d", strtotime("+" . $days . " days"));
update_option($this->plugin_slug . "_show_affiliate_box_after", $date);
public function admin_notices() {
if(current_user_can('manage_options')) {
$is_hidden = get_option($this->plugin_slug."_hide_affiliate_box");
if($is_hidden !== false) {
$date_to_show = get_option($this->plugin_slug."_show_affiliate_box_after");
if($date_to_show === false || empty($date_to_show)) {
$date = date("Y-m-d", strtotime("+5 days"));
update_option($this->plugin_slug."_show_affiliate_box_after", $date);
$current_date = date("Y-m-d");
if($current_date < $date_to_show) {
.<?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate p a {
.<?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate p a:hover, .<?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate p a:focus {
.<?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate .button span {
.<?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate {
padding: 1px 100px 12px 12px;
.<?php echo esc_attr($this->plugin_slug) ?>-affiliate-popup {
background: rgba(0,0,0,0.65);
.<?php echo esc_attr($this->plugin_slug) ?>-affiliate-popup-content {
-webkit-border-radius: 5px;
.<?php echo esc_attr($this->plugin_slug) ?>-affiliate-title {
.<?php echo esc_attr($this->plugin_slug) ?>-affiliate-options a {
.<?php echo esc_attr($this->plugin_slug) ?>-affiliate-options a.dismiss {
.<?php echo esc_attr($this->plugin_slug) ?>-affiliate-options a:hover, .affiliate-options a:focus {
button.<?php echo esc_attr($this->plugin_slug) ?>-close-affiliate-popup {
a.button.button-primary.<?php echo esc_attr($this->plugin_slug) ?>-affiliate-btn {
border: solid 1px #F51366;
-webkit-box-shadow: 0 3px 5px -3px #333333;
-moz-box-shadow: 0 3px 5px -3px #333333;
box-shadow: 0 3px 5px -3px #333333;
<div class="notice admin-poptin-box notice-info <?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate <?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate">
<p>Hi there, you've been using <?php echo esc_attr($this->plugin_name) ?> for a while now. Do you know that <b><?php echo esc_attr($this->plugin_name) ?></b> has an affiliate program? Join now and get <b>25% lifetime commission</b> <a href="javascript:" class="dismiss-btn"><span class="dashicons dashicons-no-alt"></span> Dismiss</a></p>
<div class="clear clearfix"></div>
<a class="button button-primary <?php echo esc_attr($this->plugin_slug) ?>-affiliate-btn" target="_blank" href="https://www.poptin.com/affiliate/?utm_source=wordpressplugin&domain=<?php echo esc_url($_SERVER['HTTP_HOST']) ?>">Tell me more <span class="dashicons dashicons-arrow-right-alt"></span></a>
<div class="<?php echo esc_attr($this->plugin_slug) ?>-affiliate-popup">
<div class="<?php echo esc_attr($this->plugin_slug) ?>-affiliate-popup-content">
<button class="<?php echo esc_attr($this->plugin_slug) ?>-close-affiliate-popup"><span class="dashicons dashicons-no-alt"></span></button>
<div class="<?php echo esc_attr($this->plugin_slug) ?>-affiliate-title">Would you like us to remind you about this later?</div>
<div class="<?php echo esc_attr($this->plugin_slug) ?>-affiliate-options">
<a href="javascript:" data-days="3">Remind me in 3 days</a>
<a href="javascript:" data-days="10">Remind me in 10 days</a>
<a href="javascript:" data-days="-1" class="dismiss">Don't remind me about this</a>
jQuery(document).ready(function(){
jQuery(document).on("click", ".<?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate p a.dismiss-btn", function(){
jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-affiliate-popup").show();
jQuery(document).on("click", ".<?php echo esc_attr($this->plugin_slug) ?>-close-affiliate-popup", function(){
jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-affiliate-popup").hide();
jQuery(document).on("click", ".<?php echo esc_attr($this->plugin_slug) ?>-affiliate-options a", function(){
var dataDays = jQuery(this).attr("data-days");
jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-affiliate-popup").hide();
jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate").hide();
url: "<?php echo admin_url("admin-ajax.php") ?>",
data: "action=<?php echo esc_attr($this->plugin_slug) ?>_affiliate_program&days="+dataDays+"&nonce=<?php echo esc_attr(wp_create_nonce($this->plugin_slug."_affiliate_program")) ?>",
jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-affiliate-popup").remove();
jQuery(".<?php echo esc_attr($this->plugin_slug) ?>-premio-affiliate").remove();
$Poptin_affiliate_program = new Poptin_affiliate_program();