_position = $old_meta_info['position']; $wc_position = $old_meta_info['wo_position']; } $old_button_styles = get_post_meta($old_post->ID, 'nta_wabutton_style', true); if ($old_button_styles === false) { $new_meta_styles = array( 'type' => "round", 'backgroundColor' => "#2DB742", 'textColor' => "#fff", 'label' => __("Need Help? Chat with us", "ninjateam-whatsapp"), 'width' => 300, 'height' => 64, ); } else { $new_meta_styles = array( 'type' => empty($old_button_styles['button_style']) ? "round" : $old_button_styles['button_style'], 'backgroundColor' => empty($old_button_styles['button_back_color']) ? "#2DB742" : $old_button_styles['button_back_color'], 'textColor' => empty($old_button_styles['button_text_color']) ? "#fff" : $old_button_styles['button_text_color'], 'label' => empty($old_button_styles['button-text']) ? 'Need Help? Chat with us' : $old_button_styles['button-text'], 'width' => 300, 'height' => 64, ); } update_post_meta($old_post->ID, 'nta_wa_account_info', $new_meta_info); update_post_meta($old_post->ID, 'nta_wa_button_styles', $new_meta_styles); update_post_meta($old_post->ID, 'nta_wa_widget_show', $widget_show); update_post_meta($old_post->ID, 'nta_wa_widget_position', $widget_position); update_post_meta($old_post->ID, 'nta_wa_wc_show', $wc_show); update_post_meta($old_post->ID, 'nta_wa_wc_position', $wc_position); } } } public static function restoreOption(){ $old_option = get_option('nta_whatsapp_setting', false); if ($old_option !== false) { $new_option_styles = array( 'title' => $old_option['widget_name'], 'responseText' => $old_option['widget_responseText'], 'description' => $old_option['widget_description'], 'backgroundColor' => $old_option['back_color'], 'textColor' => $old_option['text_color'], 'scrollHeight' => 500, 'isShowScroll' => 'OFF', 'isShowResponseText' => 'ON', 'isShowPoweredBy' => 'ON', 'btnLabel' => $old_option['widget_label'], 'btnLabelWidth' => 156, 'btnPosition' => $old_option['widget_position'], 'btnLeftDistance' => 30, 'btnRightDistance' => 30, 'btnBottomDistance' => 30, 'isShowBtnLabel' => 'ON', 'isShowGDPR' => (isset($old_option['show_gdpr']) && $old_option['show_gdpr'] == 'ON') ? 'ON' : 'OFF', 'gdprContent' => $old_option['widget_gdpr'], 'widgetType' => 'expandable' ); $new_option_display = array( 'displayCondition' => $old_option['display-pages'] == 'show' ? 'includePages' : 'excludePages', 'includePages' => !empty($old_option['nta-wa-show-pages']) ? $old_option['nta-wa-show-pages'] : [], 'excludePages' => !empty($old_option['nta-wa-hide-pages']) ? $old_option['nta-wa-hide-pages'] : [], 'showOnDesktop' => (isset($old_option['show_on_desktop']) && $old_option['show_on_desktop'] == 'ON') ? 'ON' : 'OFF', 'showOnMobile' => (isset($old_option['show_on_mobile']) && $old_option['show_on_mobile'] == 'ON') ? 'ON' : 'OFF', 'time_symbols' => 'h:m' ); } else { $new_option_styles = Fields::getWidgetStyles(); $new_option_display = Fields::getWidgetDisplay(); } update_option('nta_wa_widget_styles', $new_option_styles); update_option('nta_wa_widget_display', $new_option_display); $old_option = get_option('nta_wa_woobutton_setting', false); if ($old_option !== false) { $new_option = array( 'position' => $old_option['nta_woo_button_position'], 'isShow' => !empty($old_option['nta_woo_button_status']) ? 'ON' : 'OFF' ); } else { $new_option = Fields::getWoocommerceSetting(); } update_option('nta_wa_woocommerce', $new_option); $old_option = get_option('nta_wa_ga_setting', false); if ($old_option !== false) { $new_option = array( 'enabledGoogle' => 'ON', 'enabledFacebook' => 'OFF' ); } update_option('nta_wa_analytics', $new_option); } }