public static function processSettings()
 {
     if (empty($_POST)) {
         return;
     }
     // CSRF protection
     if (!empty($_POST) and (empty($_POST['nonce']) or !wp_verify_nonce($_POST['nonce'], self::ADMIN_SETTINGS))) {
         die('Invalid nonce');
     }
     CMA_Settings::processPostRequest();
     CMA_Thread::setDisclaimerEnabled(isset($_POST['disclaimer_approve']) && $_POST['disclaimer_approve'] == 1);
     CMA_Thread::setDisclaimerContent(stripslashes($_POST['disclaimer_content']));
     CMA_Thread::setDisclaimerContentAccept(stripslashes($_POST['disclaimer_content_accept']));
     CMA_Thread::setDisclaimerContentReject(stripslashes($_POST['disclaimer_content_reject']));
     CMA_Thread::setSidebarSettings('before_widget', stripslashes($_POST['sidebar_before_widget']));
     CMA_Thread::setSidebarSettings('after_widget', stripslashes($_POST['sidebar_after_widget']));
     CMA_Thread::setSidebarSettings('before_title', stripslashes($_POST['sidebar_before_title']));
     CMA_Thread::setSidebarSettings('after_title', stripslashes($_POST['sidebar_after_title']));
     CMA_Thread::setSidebarEnabled(isset($_POST['sidebar_enable']) && $_POST['sidebar_enable'] == 1);
     CMA_Thread::setSidebarMaxWidth((int) $_POST['sidebar_max_width']);
     CMA_Thread::setSidebarContributorEnabled(isset($_POST['sidebar_contributor_enable']) ? $_POST['sidebar_contributor_enable'] : '1');
     // Social login
     if (isset($_POST['fb_app_id']) && isset($_POST['fb_app_secret'])) {
         update_option('_cma_fb_app_id', trim($_POST['fb_app_id']));
         update_option('_cma_fb_app_secret', trim($_POST['fb_app_secret']));
     }
     if (isset($_POST['google_client_id']) && isset($_POST['google_client_secret'])) {
         update_option('_cma_google_client_id', trim($_POST['google_client_id']));
         update_option('_cma_google_client_secret', trim($_POST['google_client_secret']));
     }
     if (isset($_POST['linkedin_api_key']) && isset($_POST['linkedin_secret_key'])) {
         update_option('_cma_linkedin_api_key', trim($_POST['linkedin_api_key']));
         update_option('_cma_linkedin_secret_key', trim($_POST['linkedin_secret_key']));
     }
     if (isset($_POST['twitter_consumer_key']) && isset($_POST['twitter_consumer_secret'])) {
         update_option('_cma_twitter_consumer_key', trim($_POST['twitter_consumer_key']));
         update_option('_cma_twitter_consumer_secret', trim($_POST['twitter_consumer_secret']));
     }
     if (isset($_POST['live_client_id']) && isset($_POST['live_client_secret'])) {
         update_option('_cma_live_client_id', trim($_POST['live_client_id']));
         update_option('_cma_live_client_secret', trim($_POST['live_client_secret']));
     }
     // Labels
     $labels = CMA_Labels::getLabels();
     foreach ($labels as $labelKey => $label) {
         if (isset($_POST['label_' . $labelKey])) {
             CMA_Labels::setLabel($labelKey, stripslashes($_POST['label_' . $labelKey]));
         }
     }
     CMA_Thread::setSpamFilter(isset($_POST['spamFilter']) && $_POST['spamFilter'] == 1);
     CMA_Thread::setReferralEnabled(isset($_POST['referral_enable']) && $_POST['referral_enable'] == 1);
     if (!empty($_POST['affiliate_code'])) {
         CMA_Thread::setAffiliateCode(stripslashes($_POST['affiliate_code']));
     }
     if (isset($_POST['custom_css'])) {
         CMA_Thread::setCustomCss(stripslashes($_POST['custom_css']));
     }
     // Clear the permalinks
     flush_rewrite_rules(true);
     delete_option('rewrite_rules');
     wp_redirect($_SERVER['REQUEST_URI']);
     exit;
 }