function sfsi_options_updater4()
{
    if (!wp_verify_nonce($_POST['nonce'], "update_step4")) {
        echo json_encode(array("wrong_nonce"));
        exit;
    }
    $sfsi_display_counts = isset($_POST["sfsi_display_counts"]) ? $_POST["sfsi_display_counts"] : 'no';
    $sfsi_email_countsDisplay = isset($_POST["sfsi_email_countsDisplay"]) ? $_POST["sfsi_email_countsDisplay"] : 'no';
    $sfsi_email_countsFrom = isset($_POST["sfsi_email_countsFrom"]) ? $_POST["sfsi_email_countsFrom"] : 'manual';
    $sfsi_email_manualCounts = isset($_POST["sfsi_email_manualCounts"]) ? trim($_POST["sfsi_email_manualCounts"]) : '';
    $sfsi_rss_countsDisplay = isset($_POST["sfsi_rss_countsDisplay"]) ? $_POST["sfsi_rss_countsDisplay"] : 'no';
    $sfsi_rss_manualCounts = isset($_POST["sfsi_rss_manualCounts"]) ? trim($_POST["sfsi_rss_manualCounts"]) : '';
    $sfsi_facebook_countsDisplay = isset($_POST["sfsi_facebook_countsDisplay"]) ? $_POST["sfsi_facebook_countsDisplay"] : 'no';
    $sfsi_facebook_countsFrom = isset($_POST["sfsi_facebook_countsFrom"]) ? $_POST["sfsi_facebook_countsFrom"] : 'manual';
    $sfsi_facebook_mypageCounts = isset($_POST["sfsi_facebook_mypageCounts"]) ? trim($_POST["sfsi_facebook_mypageCounts"]) : '';
    $sfsi_facebook_manualCounts = isset($_POST["sfsi_facebook_manualCounts"]) ? trim($_POST["sfsi_facebook_manualCounts"]) : '';
    $sfsi_facebook_PageLink = isset($_POST["sfsi_facebook_PageLink"]) ? trim($_POST["sfsi_facebook_PageLink"]) : '';
    $sfsi_twitter_countsDisplay = isset($_POST["sfsi_twitter_countsDisplay"]) ? $_POST["sfsi_twitter_countsDisplay"] : 'no';
    $sfsi_twitter_countsFrom = isset($_POST["sfsi_twitter_countsFrom"]) ? $_POST["sfsi_twitter_countsFrom"] : 'manual';
    $sfsi_twitter_manualCounts = isset($_POST["sfsi_twitter_manualCounts"]) ? trim($_POST["sfsi_twitter_manualCounts"]) : '';
    $tw_consumer_key = isset($_POST["tw_consumer_key"]) ? trim($_POST["tw_consumer_key"]) : '';
    $tw_consumer_secret = isset($_POST["tw_consumer_secret"]) ? trim($_POST["tw_consumer_secret"]) : '';
    $tw_oauth_access_token = isset($_POST["tw_oauth_access_token"]) ? trim($_POST["tw_oauth_access_token"]) : '';
    $tw_oauth_access_token_secret = isset($_POST["tw_oauth_access_token_secret"]) ? trim($_POST["tw_oauth_access_token_secret"]) : '';
    $sfsi_google_countsDisplay = isset($_POST["sfsi_google_countsDisplay"]) ? $_POST["sfsi_google_countsDisplay"] : 'no';
    $sfsi_google_countsFrom = isset($_POST["sfsi_google_countsFrom"]) ? $_POST["sfsi_google_countsFrom"] : 'manual';
    $sfsi_google_manualCounts = isset($_POST["sfsi_google_manualCounts"]) ? trim($_POST["sfsi_google_manualCounts"]) : '';
    $sfsi_google_api_key = isset($_POST["sfsi_google_api_key"]) ? trim($_POST["sfsi_google_api_key"]) : '';
    $sfsi_linkedIn_countsDisplay = isset($_POST["sfsi_linkedIn_countsDisplay"]) ? $_POST["sfsi_linkedIn_countsDisplay"] : 'no';
    $sfsi_linkedIn_countsFrom = isset($_POST["sfsi_linkedIn_countsFrom"]) ? $_POST["sfsi_linkedIn_countsFrom"] : 'manual';
    $sfsi_linkedIn_manualCounts = isset($_POST["sfsi_linkedIn_manualCounts"]) ? trim($_POST["sfsi_linkedIn_manualCounts"]) : '';
    $ln_company = isset($_POST["ln_company"]) ? trim($_POST["ln_company"]) : '';
    $ln_api_key = isset($_POST["ln_api_key"]) ? trim($_POST["ln_api_key"]) : '';
    $ln_secret_key = isset($_POST["ln_secret_key"]) ? trim($_POST["ln_secret_key"]) : '';
    $ln_oAuth_user_token = isset($_POST["ln_oAuth_user_token"]) ? trim($_POST["ln_oAuth_user_token"]) : '';
    $sfsi_youtube_countsDisplay = isset($_POST["sfsi_youtube_countsDisplay"]) ? $_POST["sfsi_youtube_countsDisplay"] : 'no';
    $sfsi_youtube_countsFrom = isset($_POST["sfsi_youtube_countsFrom"]) ? $_POST["sfsi_youtube_countsFrom"] : 'manual';
    $sfsi_youtube_manualCounts = isset($_POST["sfsi_youtube_manualCounts"]) ? $_POST["sfsi_youtube_manualCounts"] : '';
    $sfsi_youtube_user = isset($_POST["sfsi_youtube_user"]) ? trim($_POST["sfsi_youtube_user"]) : '';
    $sfsi_youtube_channelId = isset($_POST["sfsi_youtube_channelId"]) ? trim($_POST["sfsi_youtube_channelId"]) : '';
    $sfsi_pinterest_countsDisplay = isset($_POST["sfsi_pinterest_countsDisplay"]) ? $_POST["sfsi_pinterest_countsDisplay"] : 'no';
    $sfsi_pinterest_countsFrom = isset($_POST["sfsi_pinterest_countsFrom"]) ? $_POST["sfsi_pinterest_countsFrom"] : 'manual';
    $sfsi_pinterest_manualCounts = isset($_POST["sfsi_pinterest_manualCounts"]) ? trim($_POST["sfsi_pinterest_manualCounts"]) : '';
    $sfsi_pinterest_user = isset($_POST["sfsi_pinterest_user"]) ? trim($_POST["sfsi_pinterest_user"]) : '';
    $sfsi_pinterest_board = isset($_POST["sfsi_pinterest_board"]) ? trim($_POST["sfsi_pinterest_board"]) : '';
    $sfsi_instagram_countsDisplay = isset($_POST["sfsi_instagram_countsDisplay"]) ? $_POST["sfsi_instagram_countsDisplay"] : 'no';
    $sfsi_instagram_countsFrom = isset($_POST["sfsi_instagram_countsFrom"]) ? $_POST["sfsi_instagram_countsFrom"] : 'manual';
    $sfsi_instagram_manualCounts = isset($_POST["sfsi_instagram_manualCounts"]) ? trim($_POST["sfsi_instagram_manualCounts"]) : '';
    $sfsi_instagram_User = isset($_POST["sfsi_instagram_User"]) ? $_POST["sfsi_instagram_User"] : '';
    $sfsi_shares_countsDisplay = isset($_POST["sfsi_shares_countsDisplay"]) ? $_POST["sfsi_shares_countsDisplay"] : 'no';
    $sfsi_shares_countsFrom = isset($_POST["sfsi_shares_countsFrom"]) ? $_POST["sfsi_shares_countsFrom"] : 'manual';
    $sfsi_shares_manualCounts = isset($_POST["sfsi_shares_manualCounts"]) ? trim($_POST["sfsi_shares_manualCounts"]) : '';
    $sfsi_facebookPage_url = isset($_POST["sfsi_facebookPage_url"]) ? trim($_POST["sfsi_facebookPage_url"]) : '';
    $up_option4 = array('sfsi_display_counts' => sanitize_text_field($sfsi_display_counts), 'sfsi_email_countsDisplay' => sanitize_text_field($sfsi_email_countsDisplay), 'sfsi_email_countsFrom' => sanitize_text_field($sfsi_email_countsFrom), 'sfsi_email_manualCounts' => intval($sfsi_email_manualCounts), 'sfsi_rss_countsDisplay' => sanitize_text_field($sfsi_rss_countsDisplay), 'sfsi_rss_manualCounts' => intval($sfsi_rss_manualCounts), 'sfsi_facebook_countsDisplay' => sanitize_text_field($sfsi_facebook_countsDisplay), 'sfsi_facebook_countsFrom' => sanitize_text_field($sfsi_facebook_countsFrom), 'sfsi_facebook_mypageCounts' => sfsi_sanitize_field($sfsi_facebook_mypageCounts), 'sfsi_facebook_manualCounts' => intval($sfsi_facebook_manualCounts), 'sfsi_twitter_countsDisplay' => sanitize_text_field($sfsi_twitter_countsDisplay), 'sfsi_twitter_countsFrom' => sanitize_text_field($sfsi_twitter_countsFrom), 'sfsi_twitter_manualCounts' => intval($sfsi_twitter_manualCounts), 'tw_consumer_key' => sfsi_sanitize_field($tw_consumer_key), 'tw_consumer_secret' => sfsi_sanitize_field($tw_consumer_secret), 'tw_oauth_access_token' => sfsi_sanitize_field($tw_oauth_access_token), 'tw_oauth_access_token_secret' => sfsi_sanitize_field($tw_oauth_access_token_secret), 'sfsi_google_countsDisplay' => sanitize_text_field($sfsi_google_countsDisplay), 'sfsi_google_countsFrom' => sanitize_text_field($sfsi_google_countsFrom), 'sfsi_google_manualCounts' => intval($sfsi_google_manualCounts), 'sfsi_google_api_key' => sfsi_sanitize_field($sfsi_google_api_key), 'sfsi_linkedIn_countsDisplay' => sanitize_text_field($sfsi_linkedIn_countsDisplay), 'sfsi_linkedIn_countsFrom' => sanitize_text_field($sfsi_linkedIn_countsFrom), 'sfsi_linkedIn_manualCounts' => intval($sfsi_linkedIn_manualCounts), 'sfsi_youtube_countsDisplay' => sanitize_text_field($sfsi_youtube_countsDisplay), 'sfsi_youtube_countsFrom' => sanitize_text_field($sfsi_youtube_countsFrom), 'sfsi_youtube_manualCounts' => intval($sfsi_youtube_manualCounts), 'sfsi_youtube_user' => sfsi_sanitize_field($sfsi_youtube_user), 'sfsi_youtube_channelId' => sfsi_sanitize_field($sfsi_youtube_channelId), 'sfsi_pinterest_countsDisplay' => sanitize_text_field($sfsi_pinterest_countsDisplay), 'sfsi_pinterest_countsFrom' => sanitize_text_field($sfsi_pinterest_countsFrom), 'sfsi_pinterest_manualCounts' => intval($sfsi_pinterest_manualCounts), 'sfsi_instagram_countsFrom' => sanitize_text_field($sfsi_instagram_countsFrom), 'sfsi_instagram_countsDisplay' => sanitize_text_field($sfsi_instagram_countsDisplay), 'sfsi_instagram_manualCounts' => intval($sfsi_instagram_manualCounts), 'sfsi_instagram_User' => sanitize_text_field($sfsi_instagram_User), 'sfsi_shares_countsDisplay' => sanitize_text_field($sfsi_shares_countsDisplay), 'sfsi_shares_countsFrom' => sanitize_text_field($sfsi_shares_countsFrom), 'sfsi_shares_manualCounts' => intval($sfsi_shares_manualCounts));
    update_option('sfsi_section4_options', serialize($up_option4));
    $new_counts = sfsi_getCounts();
    header('Content-Type: application/json');
    echo json_encode(array("res" => "success", 'counts' => $new_counts));
    exit;
}
$option4['tw_consumer_key'] = isset($option4['tw_consumer_key']) ? sfsi_sanitize_field($option4['tw_consumer_key']) : '';
$option4['tw_consumer_secret'] = isset($option4['tw_consumer_secret']) ? sfsi_sanitize_field($option4['tw_consumer_secret']) : '';
$option4['tw_oauth_access_token'] = isset($option4['tw_oauth_access_token']) ? sfsi_sanitize_field($option4['tw_oauth_access_token']) : '';
$option4['tw_oauth_access_token_secret'] = isset($option4['tw_oauth_access_token_secret']) ? sfsi_sanitize_field($option4['tw_oauth_access_token_secret']) : '';
$option4['sfsi_google_countsFrom'] = isset($option4['sfsi_google_countsFrom']) ? sanitize_text_field($option4['sfsi_google_countsFrom']) : '';
$option4['sfsi_google_manualCounts'] = isset($option4['sfsi_google_manualCounts']) ? intval($option4['sfsi_google_manualCounts']) : '';
$option4['sfsi_google_api_key'] = isset($option4['sfsi_google_api_key']) ? sfsi_sanitize_field($option4['sfsi_google_api_key']) : '';
$option4['sfsi_google_countsDisplay'] = isset($option4['sfsi_google_countsDisplay']) ? sanitize_text_field($option4['sfsi_google_countsDisplay']) : '';
$option4['sfsi_youtube_countsDisplay'] = isset($option4['sfsi_youtube_countsDisplay']) ? sanitize_text_field($option4['sfsi_youtube_countsDisplay']) : '';
$option4['sfsi_youtube_countsFrom'] = isset($option4['sfsi_youtube_countsFrom']) ? sanitize_text_field($option4['sfsi_youtube_countsFrom']) : '';
$option4['sfsi_youtubeusernameorid'] = isset($option4['sfsi_youtubeusernameorid']) ? sanitize_text_field($option4['sfsi_youtubeusernameorid']) : '';
$option4['sfsi_youtube_manualCounts'] = isset($option4['sfsi_youtube_manualCounts']) ? intval($option4['sfsi_youtube_manualCounts']) : '';
$option4['sfsi_youtube_user'] = isset($option4['sfsi_youtube_user']) ? sfsi_sanitize_field($option4['sfsi_youtube_user']) : '';
$option4['sfsi_youtube_channelId'] = isset($option4['sfsi_youtube_channelId']) ? sfsi_sanitize_field($option4['sfsi_youtube_channelId']) : '';
$option4['sfsi_instagram_manualCounts'] = isset($option4['sfsi_instagram_manualCounts']) ? intval($option4['sfsi_instagram_manualCounts']) : '';
$option4['sfsi_instagram_User'] = isset($option4['sfsi_instagram_User']) ? sfsi_sanitize_field($option4['sfsi_instagram_User']) : '';
$option4['sfsi_instagram_countsFrom'] = isset($option4['sfsi_instagram_countsFrom']) ? sanitize_text_field($option4['sfsi_instagram_countsFrom']) : '';
$option4['sfsi_instagram_countsDisplay'] = isset($option4['sfsi_instagram_countsDisplay']) ? sanitize_text_field($option4['sfsi_instagram_countsDisplay']) : '';
$option4['sfsi_pinterest_manualCounts'] = isset($option4['sfsi_pinterest_manualCounts']) ? intval($option4['sfsi_pinterest_manualCounts']) : '';
$option4['sfsi_shares_manualCounts'] = isset($option4['sfsi_shares_manualCounts']) ? intval($option4['sfsi_shares_manualCounts']) : '';
$option4['sfsi_linkedIn_manualCounts'] = isset($option4['sfsi_linkedIn_manualCounts']) ? intval($option4['sfsi_linkedIn_manualCounts']) : '';
/* fetch counts for admin sections */
$counts = sfsi_getCounts();
/* check for email icon display */
$email_image = "email.png";
if ($option2['sfsi_rss_icons'] == "sfsi") {
    $email_image = "sf_arow_icn.png";
}
$hide = "display:none;";
?>