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