$credentials = $key . ':' . $secret;
        $to_send = base64_encode($credentials);
        $args = array('method' => 'POST', 'httpversion' => '1.1', 'blocking' => true, 'sslverify' => false, 'headers' => array('Authorization' => 'Basic ' . $to_send, 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'), 'body' => array('grant_type' => 'client_credentials'));
        $response = wp_remote_post('https://api.twitter.com/oauth2/token', $args);
        if (is_wp_error($response)) {
            return false;
        }
        // Something went wrong
        $keys = json_decode(wp_remote_retrieve_body($response));
        if ($keys) {
            $option_value = array('token' => $keys->access_token, 'key' => $key, 'secret' => $secret);
            update_option($option, $option_value);
            return $keys->access_token;
        }
        return false;
    }
    protected static function get_url_last_part($url)
    {
        $keys = parse_url($url);
        // parse the url
        return end(explode("/", $keys['path']));
        // splitting the path
    }
}
Upfront_SocialMedia_Setting::serve();
function upfront_social($data)
{
    $data['social'] = array("settings" => get_option('upfront_social_media_global_settings'));
    return $data;
}
add_filter('upfront_data', 'upfront_social');