Overview

Packages

  • Oauth

Classes

  • Horde_Oauth_Consumer
  • Horde_Oauth_Exception
  • Horde_Oauth_Request
  • Horde_Oauth_SignatureMethod
  • Horde_Oauth_SignatureMethod_HmacSha1
  • Horde_Oauth_SignatureMethod_Plaintext
  • Horde_Oauth_SignatureMethod_RsaSha1
  • Horde_Oauth_Token
  • Horde_Oauth_Utils
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 4:  *
 5:  * @author   Chuck Hagenbuch <chuck@horde.org>
 6:  * @license  http://www.horde.org/licenses/bsd BSD
 7:  * @category Horde
 8:  * @package  Oauth
 9:  */
10: 
11: /**
12:  * OAuth access tokens and request tokens
13:  *
14:  * @author   Chuck Hagenbuch <chuck@horde.org>
15:  * @license  http://www.horde.org/licenses/bsd BSD
16:  * @category Horde
17:  * @package  Oauth
18:  */
19: class Horde_Oauth_Token
20: {
21:     public $key;
22:     public $secret;
23: 
24:     /**
25:      * key = the token
26:      * secret = the token secret
27:      */
28:     function __construct($key, $secret)
29:     {
30:         $this->key = $key;
31:         $this->secret = $secret;
32:     }
33: 
34:     /**
35:      * Generate the basic string serialization of a token that a server would
36:      * respond to request_token and access_token calls with.
37:      */
38:     public function __toString()
39:     {
40:         return
41:             'oauth_token='.Horde_Oauth_Utils::urlencodeRfc3986($this->key).
42:             '&oauth_token_secret='.Horde_Oauth_Utils::urlencodeRfc3986($this->secret);
43:     }
44: 
45:     public static function fromString($string)
46:     {
47:         parse_str($string, $parts);
48:         return new self($parts['oauth_token'], $parts['oauth_token_secret']);
49:     }
50: }
51: 
API documentation generated by ApiGen