1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Facebook
5 *
6 * @copyright Copyright (C) 2005 - 2017 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 use Joomla\Registry\Registry;
13
14 /**
15 * Joomla Platform class for generating Facebook API access token.
16 *
17 * @since 13.1
18 * @deprecated 4.0 Use the `joomla/facebook` package via Composer instead
19 */
20 class JFacebookOAuth extends JOAuth2Client
21 {
22 /**
23 * @var Registry Options for the JFacebookOAuth object.
24 * @since 13.1
25 */
26 protected $options;
27
28 /**
29 * Constructor.
30 *
31 * @param Registry $options JFacebookOauth options object.
32 * @param JHttp $client The HTTP client object.
33 * @param JInput $input The input object.
34 *
35 * @since 13.1
36 */
37 public function __construct(Registry $options = null, JHttp $client = null, JInput $input = null)
38 {
39 $this->options = isset($options) ? $options : new Registry;
40
41 // Setup the authentication and token urls if not already set.
42 $this->options->def('authurl', 'http://www.facebook.com/dialog/oauth');
43 $this->options->def('tokenurl', 'https://graph.facebook.com/oauth/access_token');
44
45 // Call the JOAuth2Client constructor to setup the object.
46 parent::__construct($this->options, $client, $input);
47 }
48
49 /**
50 * Method used to set permissions.
51 *
52 * @param string $scope Comma separated list of permissions.
53 *
54 * @return JFacebookOauth This object for method chaining
55 *
56 * @since 13.1
57 */
58 public function setScope($scope)
59 {
60 $this->setOption('scope', $scope);
61
62 return $this;
63 }
64
65 /**
66 * Method to get the current scope
67 *
68 * @return string Comma separated list of permissions.
69 *
70 * @since 13.1
71 */
72 public function getScope()
73 {
74 return $this->getOption('scope');
75 }
76 }
77