Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
plus.php
Aller à la documentation de ce fichier.
1 <?php
2 /**
3  * @package Joomla.Platform
4  * @subpackage Google
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  * Google+ data class for the Joomla Platform.
14  *
15  * @package Joomla.Platform
16  * @subpackage Google
17  * @since 1234
18  */
20 {
21  /**
22  * @var JGoogleDataPlusPeople Google+ API object for people.
23  * @since 12.3
24  */
25  protected $people;
26 
27  /**
28  * @var JGoogleDataPlusActivities Google+ API object for people.
29  * @since 12.3
30  */
31  protected $activities;
32 
33  /**
34  * @var JGoogleDataPlusComments Google+ API object for people.
35  * @since 12.3
36  */
37  protected $comments;
38 
39  /**
40  * Constructor.
41  *
42  * @param JRegistry $options Google options object
43  * @param JGoogleAuth $auth Google data http client object
44  *
45  * @since 1234
46  */
47  public function __construct(JRegistry $options = null, JGoogleAuth $auth = null)
48  {
49  // Setup the default API url if not already set.
50  $options->def('api.url', 'https://www.googleapis.com/plus/v1/');
51 
52  parent::__construct($options, $auth);
53 
54  if (isset($this->auth) && !$this->auth->getOption('scope'))
55  {
56  $this->auth->setOption('scope', 'https://www.googleapis.com/auth/plus.me');
57  }
58  }
59 
60  /**
61  * Magic method to lazily create API objects
62  *
63  * @param string $name Name of property to retrieve
64  *
65  * @return JGoogleDataPlus Google+ API object (people, activities, comments).
66  *
67  * @since 12.3
68  */
69  public function __get($name)
70  {
71  switch ($name)
72  {
73  case 'people':
74  if ($this->people == null)
75  {
76  $this->people = new JGoogleDataPlusPeople($this->options, $this->auth);
77  }
78  return $this->people;
79 
80  case 'activities':
81  if ($this->activities == null)
82  {
83  $this->activities = new JGoogleDataPlusActivities($this->options, $this->auth);
84  }
85  return $this->activities;
86 
87  case 'comments':
88  if ($this->comments == null)
89  {
90  $this->comments = new JGoogleDataPlusComments($this->options, $this->auth);
91  }
92  return $this->comments;
93  }
94  }
95 }