You are here

public function AddThis::getServices in AddThis 7.4

File

classes/AddThis.php, line 200
An AddThis-class.

Class

AddThis
@file An AddThis-class.

Code

public function getServices() {
  $rows = array();
  $services = $this->json
    ->decode($this
    ->getServicesJsonUrl());
  if (empty($services)) {
    drupal_set_message(t('AddThis services could not be loaded from @service_url', array(
      '@service_url',
      $this
        ->getServicesJsonUrl(),
    )), 'warning');
  }
  else {
    foreach ($services['data'] as $service) {
      $serviceCode = check_plain($service['code']);
      $serviceName = check_plain($service['name']);
      $rows[$serviceCode] = '<span class="addthis_service_icon icon_' . $serviceCode . '"></span> ' . $serviceName;
    }
  }
  return $rows;
}