get_admin()->is_admin_page() ) {
return;
}
$dismissed = get_user_meta( get_current_user_id(), self::DISMISS_NOTICE_BAR_KEY, true );
if ( ! empty( $dismissed ) ) {
return;
}
printf(
'
',
wp_kses(
sprintf( /* translators: %s - WPMailSMTP.com Upgrade page URL. */
__( 'You’re using WP Mail SMTP Lite. To unlock more features consider upgrading to Pro.', 'wp-mail-smtp' ),
wp_mail_smtp()->get_upgrade_link( [ 'medium' => 'notice-bar' ] )
),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
esc_attr__( 'Dismiss this message.', 'wp-mail-smtp' )
);
}
/**
* Ajax handler for dismissing notices.
*
* @since 2.3.0
*/
public function notice_bar_ajax_dismiss() {
// Run a security check.
check_ajax_referer( 'wp-mail-smtp-admin', 'nonce' );
// Check for permissions.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error();
}
update_user_meta( get_current_user_id(), self::DISMISS_NOTICE_BAR_KEY, time() );
wp_send_json_success();
}
}