Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
oauth.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * @package Joomla.Platform
4  * @subpackage Facebook
5  *
6  * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
7  * @license GNU General Public License version 2 or later; see LICENSE
8  */
9 
10 defined('JPATH_PLATFORM') or die();
11 
12 
13 /**
14  * Joomla Platform class for generating Facebook API access token.
15  *
16  * @package Joomla.Platform
17  * @subpackage Facebook
18  *
19  * @since 13.1
20  */
22 {
23  /**
24  * @var JRegistry Options for the JFacebookOAuth object.
25  * @since 13.1
26  */
27  protected $options;
28 
29  /**
30  * Constructor.
31  *
32  * @param JRegistry $options JFacebookOauth options object.
33  * @param JHttp $client The HTTP client object.
34  * @param JInput $input The input object.
35  *
36  * @since 13.1
37  */
38  public function __construct(JRegistry $options = null, JHttp $client = null, JInput $input = null)
39  {
40  $this->options = isset($options) ? $options : new JRegistry;
41 
42  // Setup the authentication and token urls if not already set.
43  $this->options->def('authurl', 'http://www.facebook.com/dialog/oauth');
44  $this->options->def('tokenurl', 'https://graph.facebook.com/oauth/access_token');
45 
46  // Call the JOauthOauth2client constructor to setup the object.
47  parent::__construct($this->options, $client, $input);
48  }
49 
50  /**
51  * Method used to set permissions.
52  *
53  * @param string $scope Comma separated list of permissions.
54  *
55  * @return JFacebookOauth This object for method chaining
56  *
57  * @since 13.1
58  */
59  public function setScope($scope)
60  {
61  $this->setOption('scope', $scope);
62 
63  return $this;
64  }
65 
66  /**
67  * Method to get the current scope
68  *
69  * @return string Comma separated list of permissions.
70  *
71  * @since 13.1
72  */
73  public function getScope()
74  {
75  return $this->getOption('scope');
76  }
77 }