You are here

public static function MatomoData::getSites in Matomo Reports 8

Return a list of sites where statistics are accessible on matomo server.

Parameters

string $token_auth: Matomo server token auth.

Return value

array|string|bool Array of sites returned from Matomo reports API.

2 calls to MatomoData::getSites()
MatomoReportsController::reports in src/Controller/MatomoReportsController.php
Reports.
MatomoReportsSettings::buildForm in src/Form/MatomoReportsSettings.php
Form constructor.

File

src/MatomoData.php, line 63

Class

MatomoData
Utility class for data retrieved by reports.

Namespace

Drupal\matomo_reports

Code

public static function getSites($token_auth) {
  $matomo_url = static::getUrl();
  if ($matomo_url) {
    return static::getResponse($matomo_url . 'index.php?module=API&method=SitesManager.getSitesWithAtLeastViewAccess&format=JSON&token_auth=' . $token_auth);
  }
  else {
    return FALSE;
  }
}