: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
<?php if ( ! defined( 'ABSPATH' ) ) exit;
class NF_Admin_SurveyPromo
public $isDashboard = false;
public function __construct()
if ( ! $this->isTargetPage() ) {
if ( array_key_exists( 'nf-dismiss-survey-notice', $_REQUEST ) ) {
if ( ! $this->isTargetPage() ) {
if ( ! $this->shouldShow() ) {
public function isTargetPage()
if( 'edit.php' == $pagenow && \array_key_exists( 'post_type', $_REQUEST ) && 'nf_sub' == $_REQUEST[ 'post_type' ] ) {
if( \array_key_exists( 'page', $_REQUEST ) ) {
$targets = ['nf-import-export', 'nf-submissions', 'nf-settings'];
if( in_array( $_REQUEST['page'], $targets ) ) {
} elseif( $_REQUEST['page'] == 'ninja-forms' && ! \array_key_exists('form_id', $_REQUEST) ) {
$this->isDashboard = true;
* Check if we should show the survey promo
public function shouldShow()
$nf_settings = get_option( 'ninja_forms_settings' );
isset( $nf_settings[ 'disable_admin_notices' ] ) &&
$nf_settings[ 'disable_admin_notices' ] == 1
if ( get_option('ninja_forms_disable_survey_promo') ) {
if ( get_transient('ninja_forms_disable_survey_promo') ) {
public function isDashboard()
return $this->isDashboard;
* Set the ninja_forms_disable_survey_promo transient
public function dismiss()
if( $_REQUEST['nf-dismiss-survey-notice'] == 'now' ) {
set_transient('ninja_forms_disable_survey_promo', 1, DAY_IN_SECONDS * 14);
} elseif( $_REQUEST['nf-dismiss-survey-notice'] == 'always' ) {
add_option('ninja_forms_disable_survey_promo', 1, '', false);
* Echo the html for the notice
public function getNoticeHtml()
$html = '<div id="nf-top-notice">
<div class="nf-top-inner">
<div class="nf-survey-actions"><a class="nf-survey-btn" href="https://ninjaforms.com/core-plugin-survey/?utm_source=Ninja+Forms+Plugin&utm_medium=Admin+Banner&utm_campaign=Core+Plugin+Survey" target="_blank">Win a $100 Amazon gift card!</a>
<p class="nf-survey-alt-actions"><a class="nf-survey-remind" href="' . add_query_arg('nf-dismiss-survey-notice', 'now') . '">' . esc_html__('Remind me later', 'ninja-forms') . '</a><span><a class="nf-survey-hide" href="' . add_query_arg('nf-dismiss-survey-notice', 'always') . '">' . esc_html__('Dismiss forever', 'ninja-forms') . '</a></span></p>
<div class="nf-survey-content">
<p>' . esc_html__("Learning more about why you're using Ninja Forms helps us shape the future of the plugin to best match your needs. That's really important to us, and why we're offering a chance to win prizes like a $100 Amazon gift card for just a few minutes of your time.", 'ninja-forms') . '</p>
<p><strong>' . esc_html__("If you have five minutes to spare, we'd love your feedback on this brief, multiple-choice survey.", 'ninja-forms') . '</strong></p>
border-bottom: 2px solid #97C9ED;
if( ! $this->isDashboard() ) {
$html .= 'margin-left: -20px;
$html .= 'background: #DBF2FD url("https://ninjaforms.com/wp-content/uploads/2024/06/nf-plugin-asset-survey-bg.png") no-repeat 100%/50%;
background-size: contain;
#nf-top-notice .nf-top-inner {
padding: 8px 16vw 8px 16px;
#nf-top-notice .nf-top-inner > div {
#nf-top-notice :last-child {
#nf-top-notice .nf-survey-actions {
#nf-top-notice .nf-survey-alt-actions a {
#nf-top-notice .nf-survey-alt-actions span {
#nf-top-notice .nf-survey-remind {
#nf-top-notice .nf-survey-content {
#nf-top-notice .nf-survey-btn {
text-transform: uppercase;