当前位置: 首页>>代码示例>>PHP>>正文


PHP tmhOAuth::extract_params方法代码示例

本文整理汇总了PHP中tmhOAuth::extract_params方法的典型用法代码示例。如果您正苦于以下问题:PHP tmhOAuth::extract_params方法的具体用法?PHP tmhOAuth::extract_params怎么用?PHP tmhOAuth::extract_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tmhOAuth的用法示例。


在下文中一共展示了tmhOAuth::extract_params方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 /**
  * Login to facebook and get the associated contrexx user.
  */
 public function login()
 {
     // fixing timestamp issue with twitter
     // it is necessary that the twitter server has the same time as our system
     date_default_timezone_set('UTC');
     $tmhOAuth = new \tmhOAuth(array('consumer_key' => $this->applicationData[0], 'consumer_secret' => $this->applicationData[1]));
     // set the timestamp
     $tmhOAuth->config['force_timestamp'] = true;
     $tmhOAuth->config['timestamp'] = time();
     if (isset($_GET['oauth_verifier'])) {
         $tmhOAuth->config['user_token'] = $_SESSION['oauth']['oauth_token'];
         $tmhOAuth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];
         $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array('oauth_verifier' => $_GET['oauth_verifier'], 'x_auth_access_type' => 'read'));
         $access_token = $tmhOAuth->extract_params($tmhOAuth->response['response']);
         $tmhOAuth->config['user_token'] = $access_token['oauth_token'];
         $tmhOAuth->config['user_secret'] = $access_token['oauth_token_secret'];
         $tmhOAuth->request('GET', $tmhOAuth->url('1.1/account/verify_credentials'));
         $resp = json_decode($tmhOAuth->response['response']);
         unset($_SESSION['oauth']);
         $name = explode(' ', $resp->name);
         self::$userdata = array('first_name' => $name[0], 'last_name' => $name[1], 'email' => $resp->screen_name . '@twitter.com');
         $this->getContrexxUser($resp->id);
     } else {
         $tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ""), array('oauth_callback' => \Cx\Lib\SocialLogin::getLoginUrl(self::OAUTH_PROVIDER)));
         $_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
         $url = 'https://api.twitter.com/oauth/authenticate?oauth_token=' . $_SESSION['oauth']['oauth_token'];
         \Cx\Core\Csrf\Controller\Csrf::header("Location: " . $url);
         exit;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:33,代码来源:Twitter.class.php

示例2: nextend_api_auth_flow

function nextend_api_auth_flow()
{
    $api_key = NextendRequest::getVar('api_key');
    $api_secret = NextendRequest::getVar('api_secret');
    $redirect_uri = NextendRequest::getVar('redirect_uri');
    if (session_id() == "") {
        @session_start();
    }
    if (!$api_key || !$api_secret || !$redirect_uri) {
        $api_key = isset($_SESSION['api_key']) ? $_SESSION['api_key'] : null;
        $api_secret = isset($_SESSION['api_secret']) ? $_SESSION['api_secret'] : null;
        $redirect_uri = isset($_SESSION['redirect_uri']) ? $_SESSION['redirect_uri'] : null;
    } else {
        $_SESSION['api_key'] = $api_key;
        $_SESSION['api_secret'] = $api_secret;
        $_SESSION['redirect_uri'] = $redirect_uri;
    }
    if ($api_key && $api_secret) {
        require_once dirname(__FILE__) . "/api/tmhOAuth.php";
        $tmhOAuth = new tmhOAuth(array('consumer_key' => $api_key, 'consumer_secret' => $api_secret));
        if (isset($_REQUEST['oauth_verifier'])) {
            $tmhOAuth->config['user_token'] = $_SESSION['t_oauth']['oauth_token'];
            $tmhOAuth->config['user_secret'] = $_SESSION['t_oauth']['oauth_token_secret'];
            $code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array('oauth_verifier' => $_REQUEST['oauth_verifier']));
            if ($code == 200) {
                $access_token = $tmhOAuth->extract_params($tmhOAuth->response['response']);
                unset($_SESSION['api_key']);
                unset($_SESSION['api_secret']);
                unset($_SESSION['redirect_uri']);
                unset($_SESSION['t_oauth']);
                echo '<script type="text/javascript">';
                echo 'window.opener.setToken("' . $access_token['oauth_token'] . '", "' . $access_token['oauth_token_secret'] . '");';
                echo '</script>';
            } else {
                echo '<h3>Error</h3><br />';
                echo $tmhOAuth->response['response'];
                exit;
            }
        } else {
            $code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ''), array('oauth_callback' => $redirect_uri));
            if ($code == 200) {
                $oauth = $tmhOAuth->extract_params($tmhOAuth->response['response']);
                $_SESSION['t_oauth'] = $oauth;
                $authurl = $tmhOAuth->url("oauth/authenticate", '') . "?oauth_token=" . $oauth['oauth_token'] . "&force_login=1";
                header('Location: ' . $authurl);
                exit;
            } else {
                echo '<h3>Error</h3><br />';
                echo $tmhOAuth->response['response'];
                exit;
            }
        }
    }
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:54,代码来源:auth.php

示例3: call

 /**
  * Call API
  * 
  * @param  string $method
  * @param  string $uri
  * @param  array $params
  * @param  string $fmt
  * @return array
  * @throws \FuelException
  */
 protected function call($method, $uri, $params, $fmt)
 {
     $code = $this->tmhoauth->request($method, $this->tmhoauth->url($uri, $fmt), $params);
     if ($code != 200) {
         throw new \FuelException('Code:' . $code . ' Response:' . $this->tmhoauth->response['response']);
     }
     switch ($fmt) {
         case 'json':
             return json_decode($this->tmhoauth->response['response']);
         default:
             return $this->tmhoauth->extract_params($this->tmhoauth->response['response']);
     }
 }
开发者ID:mp-php,项目名称:fuel-packages-twitter,代码行数:23,代码来源:twitter.php

示例4: getAccessToken

 /**
  * Returns an array with the permanent access token and access secret
  *
  * @param  string $userSessionToken  the current users session token
  * @param  string $userSessionSecret the current users session secret
  * @param  string $oauthVerifier     verifier that was sent to the callback url
  * @return array                     the keys of the returned array are accessToken and accessTokenSecret
  */
 public function getAccessToken($userSessionToken, $userSessionSecret, $oauthVerifier)
 {
     // set the request token and secret we have stored
     $this->api->config['user_token'] = $userSessionToken;
     $this->api->config['user_secret'] = $userSessionSecret;
     // send request for an access token
     $status = $this->api->request('POST', $this->api->url('oauth/access_token', ''), array('oauth_verifier' => $oauthVerifier));
     if ($status == 200) {
         // get the access token and store it in a cookie
         $response = $this->api->extract_params($this->api->response['response']);
         $return = array('accessToken' => $response['oauth_token'], 'accessTokenSecret' => $response['oauth_token_secret']);
         return $return;
     }
     throw new ApiException('Obtaining the acecss token did not work! Status code: ' . $status . '. Last error message was: ' . $this->api->response['error']);
 }
开发者ID:beecms,项目名称:virtual-identity,代码行数:23,代码来源:TwitterService.php

示例5: api

 public function api($method, $url, $params = null)
 {
     $config = Configure::read('Opauth.Strategy.Twitter');
     $tmhOAuth = new tmhOAuth(array('consumer_key' => $config['key'], 'consumer_secret' => $config['secret'], 'user_token' => $this->Session->read('Auth.Twitter.access_token'), 'user_secret' => $this->Session->read('Auth.Twitter.secret'), 'curl_ssl_verifypeer' => false));
     $url = $tmhOAuth->url($url);
     $status = $tmhOAuth->request($method, $url, $params);
     if ($status != 200) {
         return false;
     }
     if (strpos($url, '.json') !== false) {
         $response = json_decode($tmhOAuth->response['response']);
     } else {
         $response = $tmhOAuth->extract_params($this->tmhOAuth->response['response']);
     }
     return $response;
 }
开发者ID:misfrog,项目名称:cake-social-twitter,代码行数:16,代码来源:TwitterComponent.php

示例6: authenticate

 /**
  * @param array $params
  * @return string
  * @throws Exception
  */
 public function authenticate(array $params)
 {
     if (!isset($params['oauth_token']) || empty($params['oauth_token']) || !isset($params['oauth_verifier']) || empty($params['oauth_verifier'])) {
         throw new Exception('Authentication failed');
     }
     $oauth = Session::set('oauth');
     if ($params['oauth_token'] !== $oauth['oauth_token']) {
         throw new Exception('Invalid login session');
     }
     $twitterOAuthConf = Config::$a['oauth']['providers']['twitter'];
     $tmhOAuth = new \tmhOAuth(array('consumer_key' => $twitterOAuthConf['clientId'], 'consumer_secret' => $twitterOAuthConf['clientSecret'], 'token' => $oauth['oauth_token'], 'secret' => $oauth['oauth_token_secret'], 'curl_connecttimeout' => Config::$a['curl']['connecttimeout'], 'curl_timeout' => Config::$a['curl']['timeout'], 'curl_ssl_verifypeer' => Config::$a['curl']['verifypeer']));
     /** @noinspection PhpVoidFunctionResultUsedInspection */
     $code = $tmhOAuth->user_request(array('method' => 'POST', 'url' => $tmhOAuth->url('oauth/access_token', ''), 'params' => array('oauth_verifier' => trim($params['oauth_verifier']))));
     if ($code != 200) {
         throw new Exception('Failed to retrieve user data');
     }
     $data = $tmhOAuth->extract_params($tmhOAuth->response['response']);
     $authCreds = $this->getAuthCredentials($oauth['oauth_token'], $data);
     $authCredHandler = new AuthenticationRedirectionFilter();
     return $authCredHandler->execute($authCreds);
 }
开发者ID:TonyWoo,项目名称:website,代码行数:26,代码来源:TwitterAuthHandler.php

示例7: getAccessToken

 public function getAccessToken()
 {
     $pin = $_GET['pin'];
     session_start();
     $request_token = $_SESSION["authtoken"];
     $request_token_secret = $_SESSION["authsecret"];
     $tmhOAuth = new tmhOAuth(array('consumer_key' => CONSUMER_KEY, 'consumer_secret' => CONSUMER_SECRET));
     $tmhOAuth->config['user_token'] = $request_token;
     $tmhOAuth->config['user_secret'] = $request_token_secret;
     $code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array('oauth_verifier' => trim($pin)));
     if ($code == 200) {
         $oauth_creds = $tmhOAuth->extract_params($tmhOAuth->response['response']);
         $_SESSION['USER_TOKEN'] = $oauth_creds['oauth_token'];
         $_SESSION['USER_SECRET'] = $oauth_creds['oauth_token_secret'];
         define("USER_TOKEN", $_SESSION['USER_TOKEN']);
         define("USER_SECRET", $_SESSION['USER_SECRET']);
         $_SESSION["account"] = $oauth_creds['screen_name'];
         return $_SESSION["account"];
     } else {
         echo "There was an error communicating with Twitter. {$tmhOAuth->response['response']}" . PHP_EOL;
     }
 }
开发者ID:romandashko,项目名称:twitter_client,代码行数:22,代码来源:tweetsmodel.php

示例8: AuthCallback_twitter

/**
 * 此函数,供Callback处调用,如果返回false,认证失败,否则返回以下哈希表:
 *   last_key  ->  callback得到的last_key
 *   oauth_token ->  上述lastkey中的oauth_token
 *   oauth_token_secret -> 上述lastkey中的oauth_token_secret
 *   user_id -> 用户ID
 *   user_name ->  用户昵称
 *   user_email -> 暂不提供
 */
function AuthCallback_twitter()
{
    $tmhOAuth = new tmhOAuth(array('consumer_key' => TW_AKEY, 'consumer_secret' => TW_SKEY));
    $tmhOAuth->config['user_token'] = $_SESSION['tw_user_token'];
    $tmhOAuth->config['user_secret'] = $_SESSION['tw_user_secret'];
    unset($_SESSION['tw_user_token']);
    unset($_SESSION['tw_user_secret']);
    $pin = JRequest::getCmd('oobpin');
    $code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array('oauth_verifier' => trim($pin)));
    if ($code == 200) {
        $oauth_creds = $tmhOAuth->extract_params($tmhOAuth->response['response']);
        $tmhOAuth->config['user_token'] = $oauth_creds['oauth_token'];
        $tmhOAuth->config['user_secret'] = $oauth_creds['oauth_token_secret'];
        $rtn = array();
        $rtn['last_key'] = $oauth_creds;
        $rtn['oauth_token'] = $oauth_creds['oauth_token'];
        $rtn['oauth_token_secret'] = $oauth_creds['oauth_token_secret'];
        $rtn['user_id'] = $oauth_creds['screen_name'];
        $rtn['user_name'] = $oauth_creds['screen_name'];
        return $rtn;
    } else {
        return false;
    }
}
开发者ID:apachesep,项目名称:joomla-weibo,代码行数:33,代码来源:weibo.twitter.php

示例9: oauth_get_user_token

public function oauth_get_user_token($request_token, $request_token_secret) {

	$tmhOAuth->config['user_token'] = $request_token;
  	$tmhOAuth->config['user_secret'] = $request_token_secret;

  	$tmhOAuth = new tmhOAuth(array(
		'consumer_key' => $this->consumer_key,
		'consumer_secret' => $this->consumer_secret,
	));

  	$tmhOAuth->request("POST", $tmhOAuth->url("oauth/access_token", ""), array( 
        'oauth_verifier' => $_GET["oauth_verifier"]  
    ));

    echo 'Resp: <pre>'; print_r($tmhOAuth->response); echo '</pre>';

  	if ($tmhOAuth->response["code"] == 200) {
  		$response = $tmhOAuth->extract_params($tmhOAuth->response['response']);
    	$_SESSION["authstate"] = 2;
    	$user_token = array(
    		"access_token" => $response["oauth_token"],
    		"access_token_secret" => $response["oauth_token_secret"]
    	);
		return $user_token;
  	}

}
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:27,代码来源:twitter_class.php

示例10: twitter_upload

 public function twitter_upload()
 {
     $this->autoRender = false;
     App::import('Vendor', 'tmhOAuth-master/tmhOAuth');
     App::import('Vendor', 'tmhOAuth-master/tmhUtilities');
     $token = $_COOKIE['Temp_Token'];
     $secret = $_COOKIE['Temp_Secret'];
     $Img_name = $_COOKIE['Img_name'];
     $img = $_COOKIE['Img_Url'];
     $redirect_Url = $_COOKIE['redirect_Url'];
     $price = $_COOKIE['price'];
     $pageLink = $_COOKIE['pageLink'];
     $name = basename($img);
     $txt = $Img_name . ' $' . $price . ' link:' . $pageLink;
     $tmhOAuth = new tmhOAuth(array('consumer_key' => 'wFSwIc9Mx5XJjDbAJN7iNHmGo', 'consumer_secret' => '0XcpY5qXZyOy6MU7AQ34Cj72aYVdp9uV2cg4tunbl6GqrUzMtQ', 'user_token' => $token, 'user_secret' => $secret, 'curl_ssl_verifypeer' => false));
     $tmhOAuth->request("POST", $tmhOAuth->url("oauth/access_token", ""), array('oauth_verifier' => $_GET["oauth_verifier"]));
     $response = $tmhOAuth->extract_params($tmhOAuth->response["response"]);
     $tmhOAuth->config["user_token"] = $response['oauth_token'];
     $tmhOAuth->config["user_secret"] = $response['oauth_token_secret'];
     $code = $tmhOAuth->request('POST', 'https://api.twitter.com/1.1/statuses/update_with_media.json', array('media[]' => file_get_contents($img), 'status' => "{$txt}"), true, true);
     if ($code == 200) {
         $this->Session->setFlash('Your image tweet has been sent successfully', 'default', array('class' => 'alert alert-success'));
         $this->redirect($redirect_Url);
         die;
     } else {
         tmhUtilities::pr($tmhOAuth->response['response']);
     }
 }
开发者ID:pravendrakumar,项目名称:yumplate,代码行数:28,代码来源:ProductsController.php

示例11: tmhOAuth

<?php

require './config.php';
require './tmhOAuth.php';
/////// upload the photo
$img = $_FILES["img"]["name"];
move_uploaded_file($_FILES["img"]["tmp_name"], $img);
////////// generate *temp* access token and save it in cookie for callback page
$tmhOAuth = new tmhOAuth(array('consumer_key' => API_KEY, 'consumer_secret' => API_SEC, 'curl_ssl_verifypeer' => false));
$tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ''));
$response = $tmhOAuth->extract_params($tmhOAuth->response["response"]);
$txt = $_POST['txt'];
$temp_token = $response['oauth_token'];
$temp_secret = $response['oauth_token_secret'];
$time = $_SERVER['REQUEST_TIME'];
setcookie("Temp_Token", $temp_token, $time + 3600 * 30, 'twitter_test');
// '/twitter_test/' is the cookie path on your server
setcookie("Temp_Secret", $temp_secret, $time + 3600 * 30, 'twitter_test');
setcookie("Img_Url", $img, $time + 3600 * 30, 'twitter_test');
setcookie("Tweet_Txt", $txt, $time + 3600 * 30, 'twitter_test');
///////// redirect to twitter page for user authincation
$url = $tmhOAuth->url("oauth/authorize", "") . '?oauth_token=' . $temp_token;
header("Location:" . $url);
// after user give the required authrization he will be redirect to callback.php on your server
exit;
开发者ID:namizich,项目名称:BirdMachine,代码行数:25,代码来源:start.php

示例12: twitter

function twitter() {
  require '../lib/tmhOAuth.php';

  $tmhOAuth = new tmhOAuth(array(
    'consumer_key'    => Config::$t_consumer_key,
    'consumer_secret' => Config::$t_consumer_secret,
  ));
 
  $myurl = Config::$site_url . "auth/?a=login&m=twitter";
  session_start();
 
  if(isset($_REQUEST['oauth_verifier'])) {
    $tmhOAuth->config['user_token']  = $_SESSION['oauth']['oauth_token'];
    $tmhOAuth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];

    $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array(
      'oauth_verifier' => $_REQUEST['oauth_verifier']
    ));

    $resp = $tmhOAuth->extract_params($tmhOAuth->response['response']);
    unset($_SESSION['oauth']);
    setcookie('PHPSESSID', '', time()-3600, '/');

    // Get stuff
    $tmhOAuth->config['user_token']  = $resp['oauth_token'];
    $tmhOAuth->config['user_secret'] = $resp['oauth_token_secret'];
    $tmhOAuth->request('GET', $tmh->url('1/account/verify_credentials'));
    $stuff = json_decode($tmhOAuth->response['response']);

    $uniqid = $stuff->id;
    $ident = $stuff->screen_name;

    auth_routine('t', $uniqid, $ident);

  } else {
    $code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ''), 
array('oauth_callback' => $myurl));

    if($code == 200) {
      $_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
      $method = isset($_REQUEST['signin']) ? 'authenticate' : 'authorize';
      header("Location: " . $tmhOAuth->url("oauth/{$method}", '')
        . "?oauth_token={$_SESSION['oauth']['oauth_token']}");

    } else {
      // error
      $tmhOAuth->pr(htmlentities($tmhOAuth->response['response']));
    }
  }
}
开发者ID:nham,项目名称:pungent,代码行数:50,代码来源:index.php

示例13: tmhOAuth

    exit;
}
$callback_url = get_self_url_prefix() . "/twitter.php?op=callback";
$tmhOAuth = new tmhOAuth(array('consumer_key' => CONSUMER_KEY, 'consumer_secret' => CONSUMER_SECRET));
if ($op == 'clear') {
    unset($_SESSION['oauth']);
    header("Location: twitter.php");
    return;
}
if (isset($_REQUEST['oauth_verifier'])) {
    $op = 'callback';
    $tmhOAuth->config['user_token'] = $_SESSION['oauth']['oauth_token'];
    $tmhOAuth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];
    $code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/access_token', ''), array('oauth_verifier' => $_REQUEST['oauth_verifier']));
    if ($code == 200) {
        $access_token = json_encode($tmhOAuth->extract_params($tmhOAuth->response['response']));
        unset($_SESSION['oauth']);
        db_query($link, "UPDATE ttrss_users SET twitter_oauth = '{$access_token}'\n\t\t\t\tWHERE id = " . $_SESSION['uid']);
    } else {
        header('Location: twitter.php?op=clear');
        return;
    }
}
if ($op == 'register') {
    $code = $tmhOAuth->request('POST', $tmhOAuth->url('oauth/request_token', ''), array('oauth_callback' => $callback));
    if ($code == 200) {
        $_SESSION['oauth'] = $tmhOAuth->extract_params($tmhOAuth->response['response']);
        $method = isset($_REQUEST['signin']) ? 'authenticate' : 'authorize';
        $force = isset($_REQUEST['force']) ? '&force_login=1' : '';
        $forcewrite = isset($_REQUEST['force_write']) ? '&oauth_access_type=write' : '';
        $forceread = isset($_REQUEST['force_read']) ? '&oauth_access_type=read' : '';
开发者ID:nougad,项目名称:Tiny-Tiny-RSS,代码行数:31,代码来源:twitter.php

示例14: ajax_twitter_account

 /**
  * Handle dynamic Twitter authorization updates.
  * 
  * @param string $consumer_key Twitter application consumer key.
  * @param string $consumer_secret Twitter application consumer secret.
  * @param string $collection Collection the Twitter credentials belong to.
  */
 public static function ajax_twitter_account($consumer_key, $consumer_secret, $collection)
 {
     if (!class_exists('tmhOAuth')) {
         require_once self::$dir . '-/lib/twitter.php';
     }
     $oauth = new tmhOAuth(array_merge(array('consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret), ($consumer_key and $consumer_secret) ? array('user_token' => self::$config['collections'][$collection]['twitter']['oauth_token'], 'user_secret' => self::$config['collections'][$collection]['twitter']['oauth_secret']) : array()));
     if ($consumer_key and $consumer_secret) {
         self::$config['collections'][$collection]['twitter']['consumer_key'] = $consumer_key;
         self::$config['collections'][$collection]['twitter']['consumer_secret'] = $consumer_secret;
         update_option('webcomic_options', self::$config);
         $code = $oauth->request('GET', $oauth->url('1.1/account/verify_credentials'));
         if (200 === intval($code)) {
             $response = json_decode($oauth->response['response']);
             echo '<a href="http://twitter.com/', $response->screen_name, '" target="_blank"><b>@', $response->screen_name, '</b></a> <a href="http://twitter.com/settings/applications" target="_blank" class="button">', __('Revoke Access', 'webcomic'), '</a>';
         } else {
             $code = $oauth->request('POST', $oauth->url('oauth/request_token', ''), array('oauth_callback' => add_query_arg(array('webcomic_twitter_oauth' => true, 'webcomic_collection' => $collection), get_site_url())));
             if (200 === intval($code)) {
                 $response = $oauth->extract_params($oauth->response['response']);
                 self::$config['collections'][$collection]['twitter']['request_token'] = isset($response['oauth_token']) ? $response['oauth_token'] : '';
                 self::$config['collections'][$collection]['twitter']['request_secret'] = isset($response['oauth_token_secret']) ? $response['oauth_token_secret'] : '';
                 update_option('webcomic_options', self::$config);
                 echo (self::$config['collections'][$collection]['twitter']['oauth_token'] and self::$config['collections'][$collection]['twitter']['oauth_secret']) ? __('<p class="description">Your credentials could not be verified.</p>', 'webcomic') : '', '<a href="', add_query_arg(array('oauth_token' => $response['oauth_token']), $oauth->url('oauth/authorize', '')), '"><img src="', self::$url, '-/img/twitter.png" alt="', __('Sign in with Twitter', 'webcomic'), '"></a>';
             } else {
                 _e('Validation error. Please ensure your <a href="http://dev.twitter.com/apps/new" target="_blank">Twitter Application</a> <b>consumer key</b> and <b>consumer secret</b> are entered correctly.', 'webcomic');
             }
         }
     } else {
         echo '<span class="description">', __('Please enter your <a href="http://dev.twitter.com/apps/new" target="_blank">Twitter Application</a> <b>consumer key</b> and <b>consumer secret</b> below.', 'webcomic'), '</span>';
     }
 }
开发者ID:ecerta,项目名称:webcomic,代码行数:37,代码来源:config.php

示例15: elseif

            echo $this->run('user/login/newuser');
            return;
        }
    } else {
        // error
        @error_log('3. ' . $twauth->response['response']);
        $this->redirect($_GET['redirect']);
    }
} elseif (isset($_REQUEST['oauth_verifier'])) {
    // we're being called back by Twitter
    $twauth->config['user_token'] = $_SESSION['oauth']['oauth_token'];
    $twauth->config['user_secret'] = $_SESSION['oauth']['oauth_token_secret'];
    $params = array('oauth_verifier' => $_REQUEST['oauth_verifier']);
    $code = $twauth->request('POST', $twauth->url('oauth/access_token', ''), $params);
    if ($code == 200) {
        $_SESSION['access_token'] = $twauth->extract_params($twauth->response['response']);
        unset($_SESSION['oauth']);
        $this->redirect($here);
    } else {
        // error
        @error_log('2. ' . $twauth->response['response']);
        $this->redirect($_GET['redirect']);
    }
} else {
    // start oauth dance
    $params = array('oauth_callback' => $here, 'x_auth_access_type' => 'read');
    $code = $twauth->request('POST', $twauth->url('oauth/request_token', ''), $params);
    if ($code == 200) {
        $_SESSION['oauth'] = $twauth->extract_params($twauth->response['response']);
        $authurl = $twauth->url('oauth/authenticate', '') . '?oauth_token=' . $_SESSION['oauth']['oauth_token'] . '&force_login=1';
        $this->redirect($authurl);
开发者ID:Selwyn-b,项目名称:elefant,代码行数:31,代码来源:twitter.php


注:本文中的tmhOAuth::extract_params方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。