Exemplo n.º 1
0
function stc_oauth_start()
{
    $options = get_option('stc_options');
    if (empty($options['consumer_key']) || empty($options['consumer_secret'])) {
        return false;
    }
    include_once "twitterOAuth.php";
    $to = new TwitterOAuth($options['consumer_key'], $options['consumer_secret']);
    $tok = $to->getRequestToken();
    $token = $tok['oauth_token'];
    $_SESSION['stc_req_token'] = $token;
    $_SESSION['stc_req_secret'] = $tok['oauth_token_secret'];
    $_SESSION['stc_callback'] = $_GET['loc'];
    $_SESSION['stc_callback_action'] = $_GET['stcaction'];
    if ($_GET['type'] == 'authorize') {
        $url = $to->getAuthorizeURL($token);
    } else {
        $url = $to->getAuthenticateURL($token);
    }
    wp_redirect($url);
    exit;
}