You are here

public function MostPopularAddThis::fetchJson in Drupal Most Popular 7

Makes a call to the AddThis.com server and parses the JSON response.

Parameters

string $dimension: The dimension we're interested in. It must be null or one of:

  • url
  • continent
  • country
  • domain
  • service

string $params: Additional parameters to send. The following are allowed:

  • period: 'day', 'week' or 'month'
  • domain: any URL domain
  • service: 'email'

Return value

array An array of associative arrays, each containing:

  • shares: The number of times the page was shared.
  • url: The URL of the page.

File

modules/mostpopular_addthis/mostpopular_addthis.classes.inc, line 134
Provides a connector to the AddThis.com API.

Class

MostPopularAddThis
@file Provides a connector to the AddThis.com API.

Code

public function fetchJson($dimension = '', $params = array()) {
  $data = $this
    ->fetch($dimension, 'json', $params);
  if ($data !== FALSE) {
    return drupal_json_decode($data);
  }
  return FALSE;
}