: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
foreach ($rows as $value) {
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- No applicable variables for this query.
$subscribers = $wpdb->get_results($query, ARRAY_A);
$subscribers = apply_filters('sgpbSubscribersCsv', $subscribers);
foreach($subscribers as $values) {
foreach ($values as $key => $value) {
if ($key != 'subscriptionTitle') {
$content = apply_filters('sgpbSubscribersContent', $content);
header('Pragma: public');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=subscribersList.csv;');
header('Content-Transfer-Encoding: binary');
echo wp_kses($content, AdminHelper::allowed_html_tags());
public function getSystemInfoFile()
$allowToAction = AdminHelper::userCanAccessTo();
$content = AdminHelper::getSystemInfoText();
header('Pragma: public');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=popupBuilderSystemInfo.txt;');
header('Content-Transfer-Encoding: binary');
echo wp_kses($content, AdminHelper::allowed_html_tags());
public function saveSettings()
$allowToAction = AdminHelper::userCanAccessTo();
$nonce = isset($_POST['sgpb_saveSettings_nonce']) ? sanitize_text_field($_POST['sgpb_saveSettings_nonce']): '';
if (!$allowToAction || !wp_verify_nonce($nonce, 'sgpbSaveSettings')) {
wp_redirect(get_home_url());
if (isset($_POST['sgpb-dont-delete-data'])) {
if (isset($_POST['sgpb-enable-debug-mode'])) {
if (isset($_POST['sgpb-disable-custom-js'])) {
if (isset($_POST['sgpb-disable-analytics-general'])) {
if (!empty($_POST['sgpb-user-roles'])){
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$userRoles = $_POST['sgpb-user-roles'];
array_walk_recursive($userRoles, function(&$item){
$item = sanitize_text_field($item);
update_option('sgpb-user-roles', $userRoles);
update_option('sgpb-dont-delete-data', $deleteData);
update_option('sgpb-enable-debug-mode', $enableDebugMode);
update_option('sgpb-disable-analytics-general', $disableAnalytics);
update_option('sgpb-disable-custom-js', $disableCustomJs);
AdminHelper::filterUserCapabilitiesForTheUserRoles('save');
wp_redirect(admin_url().'edit.php?post_type='.SG_POPUP_POST_TYPE.'&page='.SG_POPUP_SETTINGS_PAGE);
* this method will add a filter to exclude the current post from popup list
* which have a post_type=popupbuilder and it is on post edit page
public function postExcludeFromPopupsList(){
if ( isset($pagenow) && $pagenow === 'post.php') {
if (get_post_type() === SG_POPUP_POST_TYPE){
add_filter('sgpb_exclude_from_popups_list', function($excludedPopups) {
array_push($excludedPopups, get_the_ID());