: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$names['showAllPages'] = 'allPages';
$names['allSelectedPages'] = 'allSelectedPages';
$names['allPostsStatus'] = 'allPostsStatus';
$names['showAllPosts'] = 'allPosts';
$names['allSelectedPosts'] = 'allSelectedPosts';
$names['posts-all-categories'] = 'posts-all-categories';
$names['allCustomPostsStatus'] = 'allCustomPostsStatus';
$names['all-custom-posts'] = 'all-custom-posts';
$names['showAllCustomPosts'] = 'showAllCustomPosts';
$names['allSelectedCustomPosts'] = 'allSelectedCustomPosts';
// countdown pro popup type
$names['countdownNumbersBgColor'] = 'sgpb-counter-background-color';
$names['countdownNumbersTextColor'] = 'sgpb-counter-text-color';
$names['sg-due-date'] = 'sgpb-countdown-due-date';
$names['sg-countdown-type'] = 'sgpb-countdown-type';
$names['sg-time-zone'] = 'sgpb-countdown-timezone';
$names['counts-language'] = 'sgpb-countdown-language';
$names['pushToBottom'] = 'sgpb-countdown-show-on-top';
$names['countdown-autoclose'] = 'sgpb-countdown-close-timeout';
// contact form pro popup type
$names['show-form-to-top'] = 'sgpb-contact-show-form-to-top';
$names['contact-name-status'] = 'sgpb-contact-field-name';
$names['contact-name'] = 'sgpb-contact-name-placeholder';
$names['contact-name-required'] = 'sgpb-contact-name-required';
$names['contact-subject-status'] = 'sgpb-contact-field-subject';
$names['contact-subject'] = 'sgpb-contact-subject-placeholder';
$names['contact-subject-required'] = 'sgpb-contact-subject-required';
$names['contact-email'] = 'sgpb-contact-email-placeholder';
$names['contact-message'] = 'sgpb-contact-message-placeholder';
$names['contact-fail-message'] = 'sgpb-contact-error-message';
$names['contact-receive-email'] = 'sgpb-contact-to-email';
$names['contact-validation-message'] = 'sgpb-contact-required-message';
$names['contact-validate-email'] = 'sgpb-contact-invalid-email-message';
$names['contact-inputs-width'] = 'sgpb-contact-inputs-width';
$names['contact-inputs-height'] = 'sgpb-contact-inputs-height';
$names['contact-inputs-border-width'] = 'sgpb-contact-inputs-border-width';
$names['contact-text-input-bgcolor'] = 'sgpb-contact-inputs-bg-color';
$names['contact-text-bordercolor'] = 'sgpb-contact-inputs-border-color';
$names['contact-inputs-color'] = 'sgpb-contact-inputs-text-color';
$names['contact-placeholder-color'] = 'sgpb-contact-inputs-placeholder-color';
$names['contact-area-width'] = 'sgpb-contact-message-width';
$names['contact-area-height'] = 'sgpb-contact-message-height';
$names['sg-contact-resize'] = 'sgpb-contact-message-resize';
$names['contact-btn-width'] = 'sgpb-contact-submit-width';
$names['contact-btn-height'] = 'sgpb-contact-submit-height';
$names['contact-btn-title'] = 'sgpb-contact-submit-title';
$names['contact-btn-progress-title'] = 'sgpb-contact-submit-title-progress';
$names['contact-button-bgcolor'] = 'sgpb-contact-submit-bg-color';
$names['contact-button-color'] = 'sgpb-contact-submit-text-color';
$names['dont-show-content-to-contacted-user'] = 'sgpb-contact-hide-for-contacted-users';
$names['contact-success-behavior'] = 'sgpb-contact-success-behavior';
$names['contact-success-message'] = 'sgpb-contact-success-message';
$names['contact-success-redirect-url'] = 'sgpb-contact-success-redirect-URL';
$names['contact-success-redirect-new-tab'] = 'sgpb-contact-success-redirect-new-tab';
$names['contact-success-popups-list'] = 'sgpb-contact-success-popup';
$names['contact-gdpr'] = 'sgpb-contact-gdpr-status';
$names['contact-gdpr-label'] = 'sgpb-contact-gdpr-label';
$names['contact-gdpr-text'] = 'sgpb-contact-gdpr-text';
$names['sgpb-contact-message-bg-color'] = 'sgpb-contact-message-bg-color';
$names['sgpb-contact-message-border-color'] = 'sgpb-contact-message-border-color';
$names['sgpb-contact-message-text-color'] = 'sgpb-contact-message-text-color';
$names['sgpb-contact-message-placeholder-color'] = 'sgpb-contact-message-placeholder-color';
$names['sgpb-contact-message-border-width'] = 'sgpb-contact-message-border-width';
$names['shareUrlType'] = 'sgpb-social-share-url-type';
$names['sgShareUrl'] = 'sgpb-social-share-url';
$names['sgSocialTheme'] = 'sgpb-social-share-theme';
$names['sgSocialButtonsSize'] = 'sgpb-social-theme-size';
$names['sgSocialLabel'] = 'sgpb-social-show-labels';
$names['sgSocialShareCount'] = 'sgpb-social-share-count';
$names['sgRoundButton'] = 'sgpb-social-round-buttons';
$names['sgEmailStatus'] = 'sgpb-social-status-email';
$names['sgMailLable'] = 'sgpb-social-label-email';
$names['sgFbStatus'] = 'sgpb-social-status-facebook';
$names['fbShareLabel'] = 'sgpb-social-label-facebook';
$names['sgLinkedinStatus'] = 'sgpb-social-status-linkedin';
$names['lindkinLabel'] = 'sgpb-social-label-linkedin';
$names['sgGoogleStatus'] = 'sgpb-social-status-googleplus';
$names['googLelabel'] = 'sgpb-social-label-googleplus';
$names['sgTwitterStatus'] = 'sgpb-social-status-twitter';
$names['twitterLabel'] = 'sgpb-social-label-twitter';
$names['sgPinterestStatus'] = 'sgpb-social-status-pinterest';
$names['pinterestLabel'] = 'sgpb-social-label-pinterest';
$names['subscription-email'] = 'sgpb-subs-email-placeholder';
$names['subs-gdpr'] = 'sgpb-subs-gdpr-status';
$names['subs-gdpr-label'] = 'sgpb-subs-gdpr-label';
$names['subs-gdpr-text'] = 'sgpb-subs-gdpr-text';
$names['subs-first-name-status'] = 'sgpb-subs-first-name-status';
$names['subs-first-name'] = 'sgpb-subs-first-placeholder';
$names['subs-first-name-required'] = 'sgpb-subs-first-name-required';
$names['subs-last-name-status'] = 'sgpb-subs-last-name-status';
$names['subs-last-name'] = 'sgpb-subs-last-placeholder';
$names['subs-last-name-required'] = 'sgpb-subs-last-name-required';
$names['subs-validation-message'] = 'sgpb-subs-validation-message';
$names['subs-text-width'] = 'sgpb-subs-text-width';
$names['subs-text-height'] = 'sgpb-subs-text-height';
$names['subs-text-border-width'] = 'sgpb-subs-text-border-width';
$names['subs-text-input-bgColor'] = 'sgpb-subs-text-bg-color';
$names['subs-text-borderColor'] = 'sgpb-subs-text-border-color';
$names['subs-inputs-color'] = 'sgpb-subs-text-color';
$names['subs-placeholder-color'] = 'sgpb-subs-text-placeholder-color';
$names['subs-btn-width'] = 'sgpb-subs-btn-width';
$names['subs-btn-height'] = 'sgpb-subs-btn-height';
$names['subs-btn-title'] = 'sgpb-subs-btn-title';
$names['subs-btn-progress-title'] = 'sgpb-subs-btn-progress-title';
$names['subs-button-bgColor'] = 'sgpb-subs-btn-bg-color';
$names['subs-button-color'] = 'sgpb-subs-btn-text-color';
$names['subs-success-behavior'] = 'sgpb-subs-success-behavior';
$names['subs-success-message'] = 'sgpb-subs-success-message';
$names['subs-success-redirect-url'] = 'sgpb-subs-success-redirect-URL';
$names['subs-success-redirect-new-tab'] = 'sgpb-subs-success-redirect-new-tab';
$names['subs-success-popups-list'] = 'sgpb-subs-success-popup';
// Subscription new option
$names['sgpb-subs-form-bg-color'] = 'sgpb-subs-form-bg-color';
// Exit Intent extension names
$names['option-exit-intent-enable'] = 'sgpb-option-exit-intent-enable';
$names['option-exit-intent-type'] = 'sgpb-option-exit-intent-type';
$names['option-exit-intent-expire-time'] = 'sgpb-exit-intent-expire-time';
$names['option-exit-intent-cookie-level'] = 'sgpb-exit-intent-cookie-level';
$names['option-exit-intent-soft-from-top'] = 'sgpb-exit-intent-soft-from-top';
// Adblock extension names
$names['option-enable-ad-block'] = 'sgpb-option-enable-ad-block';
// MailChimp extension names
$names['mailchimp-list-id'] = 'sgpb-mailchimp-lists';
$names['mailchimp-double-optin'] = 'sgpb-enable-double-optin';
$names['mailchimp-only-required'] = 'sgpb-show-required-fields';
$names['mailchimp-form-aligment'] = 'sgpb-mailchimp-form-align';
$names['mailchimp-label-aligment'] = 'sgpb-mailchimp-label-alignment';
$names['mailchimp-indicates-required-fields'] = 'sgpb-enable-asterisk-label';
$names['mailchimp-asterisk-label'] = 'sgpb-mailchimp-asterisk-label';
$names['mailchimp-required-error-message'] = 'sgpb-mailchimp-required-message';
$names['mailchimp-email-validate-message'] = 'sgpb-mailchimp-email-message';
$names['mailchimp-email-label'] = 'sgpb-mailchimp-email-label';
$names['mailchimp-error-message'] = 'sgpb-mailchimp-error-message';
$names['mailchimp-show-form-to-top'] = 'sgpb-mailchimp-show-form-to-top';
$names['mailchimp-label-color'] = 'sgpb-mailchimp-label-color';
$names['mailchimp-input-width'] = 'sgpb-mailchimp-input-width';
$names['mailchimp-input-height'] = 'sgpb-mailchimp-input-height';
$names['mailchimp-input-border-radius'] = 'sgpb-mailchimp-border-radius';
$names['mailchimp-input-border-width'] = 'sgpb-mailchimp-border-width';
$names['mailchimp-input-border-color'] = 'sgpb-mailchimp-border-color';
$names['mailchimp-input-bg-color'] = 'sgpb-mailchimp-background-color';
$names['sgpb-mailchimp-input-color'] = 'sgpb-mailchimp-input-color';
$names['mailchimp-submit-title'] = 'sgpb-mailchimp-submit-title';
$names['mailchimp-submit-width'] = 'sgpb-mailchimp-submit-width';
$names['mailchimp-submit-height'] = 'sgpb-mailchimp-submit-height';
$names['mailchimp-submit-border-width'] = 'sgpb-mailchimp-submit-border-width';
$names['mailchimp-submit-border-radius'] = 'sgpb-mailchimp-submit-border-radius';
$names['mailchimp-submit-border-color'] = 'sgpb-mailchimp-submit-border-color';
$names['mailchimp-submit-button-bgcolor'] = 'sgpb-mailchimp-submit-background-color';
$names['mailchimp-submit-color'] = 'sgpb-mailchimp-submit-color';
$names['mailchimp-success-behavior'] = 'sgpb-mailchimp-success-behavior';
$names['mailchimp-success-message'] = 'sgpb-mailchimp-success-message';
$names['mailchimp-success-redirect-url'] = 'sgpb-mailchimp-success-redirect-URL';
$names['mailchimp-success-redirect-new-tab'] = 'sgpb-mailchimp-success-redirect-new-tab';
$names['mailchimp-success-popups-list'] = 'sgpb-mailchimp-success-popup';
$names['mailchimp-close-popup-already-subscribed'] = 'sgpb-mailchimp-close-popup-already-subscribed';
$names['sg-aweber-list'] = 'sgpb-aweber-list';
$names['sg-aweber-webform'] = 'sgpb-aweber-signup-form';
$names['aweber-custom-invalid-email-message'] = 'sgpb-aweber-invalid-email';
$names['aweber-invalid-email'] = 'sgpb-aweber-invalid-email-message';
$names['aweber-already-subscribed-message'] = 'sgpb-aweber-custom-subscribed-message';
$names['aweber-required-message'] = 'sgpb-aweber-required-message';
$names['aweber-validate-email-message'] = 'sgpb-aweber-validate-email-message';
$names['aweber-success-behavior'] = 'sgpb-aweber-success-behavior';
$names['aweber-success-message'] = 'sgpb-aweber-success-message';
$names['aweber-success-redirect-url'] = 'sgpb-aweber-success-redirect-URL';
$names['aweber-success-redirect-new-tab'] = 'sgpb-aweber-success-redirect-new-tab';
$names['aweber-success-popups-list'] = 'sgpb-aweber-success-popup';
public static function saveCustomInserted()
if (get_option('sgpbSaveOldData'.$postId)) {
update_option('sgpbSaveOldData'.$postId, 1);
add_filter('sgpbConvertedPopupId', 'sgpb\sgpGetCorrectPopupId', 10, 1);
self::saveMetaboxPopup($postId);
$content = get_post_field('post_content', $postId);
SGPopup::deletePostCustomInsertedData($postId);
SGPopup::deletePostCustomInsertedEvents($postId);
// We detect all the popups that were inserted as a custom ones, in the content.
SGPopup::savePopupsFromContentClasses($content, $post);
public static function saveMetaboxPopup($postId)
$selectedPost = get_post_meta($postId, 'sg_promotional_popup', true);
if (empty($selectedPost)) {
global $SGPB_DATA_CONFIG_ARRAY;
$postType = get_post_type($postId);
$postTitle = get_the_title($postId);
$popupId = sgpGetCorrectPopupId($selectedPost);
$popupTargetParam = $postType.'_selected';
if (!get_post_meta($popupId, 'sg_popup_events')) {
update_post_meta($popupId, 'sg_popup_events', array($SGPB_DATA_CONFIG_ARRAY['events']['initialData']));
$savedTarget = get_post_meta($popupId, 'sg_popup_target');
if (empty($savedTarget[0]['sgpb-target'][0])) {
$savedTarget['sgpb-target'][] = array(array('param' => $popupTargetParam, 'operator' => '==', 'value' => array($postId => $postTitle)));
$savedTarget['sgpb-conditions'][] = $SGPB_DATA_CONFIG_ARRAY['conditions']['initialData'];
update_post_meta($popupId, 'sg_popup_target', $savedTarget, true);
$targets = $savedTarget[0]['sgpb-target'][0];
foreach ($targets as $key => $target) {
if ($key == 0 && $target['param'] == 'not_rule') {
$target['param'] = $popupTargetParam;
$savedTarget[0]['sgpb-target'][0][$key]['param'] = $popupTargetParam;
if ($target['param'] == $popupTargetParam) {
if (!empty($target['value'])) {
$targetValue = $target['value'];
$targetValue[$postId] = $postTitle;
$savedTarget[0]['sgpb-target'][0][$key]['value'] = $targetValue;
$savedTargetsLength = count($savedTarget[0]['sgpb-target'][0]);
$savedTarget[0]['sgpb-target'][0][$savedTargetsLength] = array('param' => $popupTargetParam, 'operator' => '==', 'value' => array($postId => $postTitle));
delete_post_meta($postId, 'sg_promotional_popup');
delete_post_meta($popupId, 'sg_popup_target');
update_post_meta($popupId, 'sg_popup_target', $savedTarget[0], true);
function sgpGetCorrectPopupId($popupId)
$convertedIds = get_option('sgpbConvertedIds');
if (empty($convertedIds) || empty($convertedIds[$popupId])) {
return $convertedIds[$popupId];