Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JGoogleDataAdsense
+ Graphe d'héritage de JGoogleDataAdsense:
+ Graphe de collaboration de JGoogleDataAdsense:

Liste de tous les membres

Fonctions membres publiques

 __construct (JRegistry $options=null, JGoogleAuth $auth=null)
 getAccount ($accountID, $subaccounts=true)
 listAccounts ($options=array(), $maxpages=1)
 listClients ($accountID, $options=array(), $maxpages=1)
 getUnit ($accountID, $adclientID, $adunitID)
 listUnitChannels ($accountID, $adclientID, $adunitID, $options=array(), $maxpages=1)
 getChannel ($accountID, $adclientID, $channelID)
 listChannels ($accountID, $adclientID, $options=array(), $maxpages=1)
 listChannelUnits ($accountID, $adclientID, $channelID, $options=array(), $maxpages=1)
 listUrlChannels ($accountID, $adclientID, $options=array(), $maxpages=1)
 generateReport ($accountID, $start, $end=false, $options=array(), $maxpages=1)
- Fonctions membres publiques inherited from JGoogleData
 authenticate ()
 isAuthenticated ()
 getOption ($key)
 setOption ($key, $value)

Additional Inherited Members

- Fonctions membres protégées inherited from JGoogleData
 listGetData ($url, $maxpages=1, $token=null)
 query ($url, $data=null, $headers=null, $method= 'get')
- Fonctions membres protégées statiques inherited from JGoogleData
static safeXML ($data)
- Attributs protégés inherited from JGoogleData
 $options
 $auth

Description détaillée

Définition à la ligne 19 du fichier adsense.php.


Documentation des constructeurs et destructeur

JGoogleDataAdsense::__construct ( JRegistry  $options = null,
JGoogleAuth  $auth = null 
)

Constructor.

Paramètres:
JRegistry$optionsGoogle options object
JGoogleAuth$authGoogle data http client object
Depuis:
12.3

Réimplémentée à partir de JGoogleData.

Définition à la ligne 29 du fichier adsense.php.

{
parent::__construct($options, $auth);
if (isset($this->auth) && !$this->auth->getOption('scope'))
{
$this->auth->setOption('scope', 'https://www.googleapis.com/auth/adsense');
}
}

Documentation des fonctions membres

JGoogleDataAdsense::generateReport (   $accountID,
  $start,
  $end = false,
  $options = array(),
  $maxpages = 1 
)

Method to retrieve a list of AdSense Channel URLs

Paramètres:
string$accountIDID of account
mixed$startStart day
mixed$endEnd day
array$optionsSearch settings
int$maxpagesMaximum number of pages of accounts to return
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 330 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
if (is_int($start))
{
$startobj = new DateTime;
$startobj->setTimestamp($start);
}
elseif (is_string($start))
{
$startobj = new DateTime($start);
}
elseif (is_a($start, 'DateTime'))
{
$startobj = $start;
}
else
{
throw new InvalidArgumentException('Invalid start time.');
}
if (!$end)
{
$endobj = new DateTime;
}
elseif (is_int($end))
{
$endobj = new DateTime;
$endobj->setTimestamp($end);
}
elseif (is_string($end))
{
$endobj = new DateTime($end);
}
elseif (is_a($end, 'DateTime'))
{
$endobj = $end;
}
else
{
throw new InvalidArgumentException('Invalid end time.');
}
$options['startDate'] = $startobj->format('Y-m-d');
$options['endDate'] = $endobj->format('Y-m-d');
unset($options['startIndex']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID) . '/reports?' . http_build_query($options);
if (strpos($url, '&'))
{
$url .= '&';
}
$i = 0;
$data['rows'] = array();
do
{
$jdata = $this->query($url . 'startIndex=' . count($data['rows']));
$newdata = json_decode($jdata->body, true);
if ($newdata && array_key_exists('rows', $newdata))
{
$newdata['rows'] = array_merge($data['rows'], $newdata['rows']);
$data = $newdata;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
$i++;
}
while (count($data['rows']) < $data['totalMatchedRows'] && $i < $maxpages);
return $data;
}
else
{
return false;
}
}
JGoogleDataAdsense::getAccount (   $accountID,
  $subaccounts = true 
)

Method to get an Adsense account's settings from Google

Paramètres:
string$accountIDID of account to get
boolean$subaccountsInclude list of subaccounts
Renvoie:
mixed Data from Google
Depuis:
12.3

Définition à la ligne 49 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID) . ($subaccounts ? '?tree=true' : '');
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataAdsense::getChannel (   $accountID,
  $adclientID,
  $channelID 
)

Method to get an Adsense Channel

Paramètres:
string$accountIDID of account to get
string$adclientIDID of client to get
string$channelIDID of channel to get
Renvoie:
mixed Data from Google
Depuis:
12.3

Définition à la ligne 202 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID) . '/adclients/';
$url .= urlencode($adclientID) . '/customchannels/' . urlencode($channelID);
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataAdsense::getUnit (   $accountID,
  $adclientID,
  $adunitID 
)

Method to get an AdSense AdUnit

Paramètres:
string$accountIDID of account to get
string$adclientIDID of client to get
string$adunitIDID of adunit to get
Renvoie:
mixed Data from Google
Depuis:
12.3

Définition à la ligne 137 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID);
$url .= '/adclients/' . urlencode($adclientID) . '/adunits/' . urlencode($adunitID);
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataAdsense::listAccounts (   $options = array(),
  $maxpages = 1 
)

Method to retrieve a list of AdSense accounts from Google

Paramètres:
array$optionsSearch settings
int$maxpagesMaximum number of pages of accounts to return
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 82 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
JGoogleDataAdsense::listChannels (   $accountID,
  $adclientID,
  $options = array(),
  $maxpages = 1 
)

Method to retrieve a list of AdSense Custom Channels

Paramètres:
string$accountIDID of account
string$adclientIDID of client to list channels from
array$optionsSearch settings
int$maxpagesMaximum number of pages of accounts to return
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 238 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID) . '/adclients/' . urlencode($adclientID);
$url .= '/customchannels?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
JGoogleDataAdsense::listChannelUnits (   $accountID,
  $adclientID,
  $channelID,
  $options = array(),
  $maxpages = 1 
)

Method to retrieve a list of AdSense Adunits for a specific Custom Channel

Paramètres:
string$accountIDID of account
string$adclientIDID of client
string$channelIDID of channel to list units from
array$optionsSearch settings
int$maxpagesMaximum number of pages of accounts to return
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 269 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID) . '/adclients/' . urlencode($adclientID);
$url .= '/customchannels/' . urlencode($channelID) . '/adunits?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
JGoogleDataAdsense::listClients (   $accountID,
  $options = array(),
  $maxpages = 1 
)

Method to retrieve a list of AdSense clients from Google

Paramètres:
string$accountIDID of account to list the clients from
array$optionsSearch settings
int$maxpagesMaximum number of pages of accounts to return
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 110 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID) . '/adclients?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
JGoogleDataAdsense::listUnitChannels (   $accountID,
  $adclientID,
  $adunitID,
  $options = array(),
  $maxpages = 1 
)

Method to retrieve a list of AdSense Custom Channels for a specific Adunit

Paramètres:
string$accountIDID of account
string$adclientIDID of client
string$adunitIDID of adunit to list channels from
array$optionsSearch settings
int$maxpagesMaximum number of pages of accounts to return
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 174 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID);
$url .= '/adclients/' . urlencode($adclientID) . '/adunits/' . urlencode($adunitID) . '/customchannels?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
JGoogleDataAdsense::listUrlChannels (   $accountID,
  $adclientID,
  $options = array(),
  $maxpages = 1 
)

Method to generate a report from Google AdSense

Paramètres:
string$accountIDID of account
string$adclientIDID of client
array$optionsSearch settings
int$maxpagesMaximum number of pages of accounts to return
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 299 du fichier adsense.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode($accountID);
$url .= '/adclients/' . urlencode($adclientID) . '/urlchannels?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}

La documentation de cette classe a été générée à partir du fichier suivant :