You are here

public function InstapageCmsPluginSubaccountModel::getAccountBoundTokens in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/models/InstapageCmsPluginSubaccountModel.php \InstapageCmsPluginSubaccountModel::getAccountBoundTokens()

Gets the list of tokens bound to subaccount. User has to be logged in via email and password.

Return value

array List of tokens bound to an account.

2 calls to InstapageCmsPluginSubaccountModel::getAccountBoundTokens()
InstapageCmsPluginSubaccountModel::getAccountBoundSubAccounts in core/models/InstapageCmsPluginSubaccountModel.php
Gets the list of subaccounts of currently logged in user.
InstapageCmsPluginSubaccountModel::getAllTokens in core/models/InstapageCmsPluginSubaccountModel.php
Gets all the tokens - stored in plugin's settings and bound to currently used app user account.

File

core/models/InstapageCmsPluginSubaccountModel.php, line 51

Class

InstapageCmsPluginSubaccountModel
Class responsible for managing the subaccounts in Instapage app.

Code

public function getAccountBoundTokens() {
  $api = InstapageCmsPluginAPIModel::getInstance();
  $userToken = InstapageCmsPluginHelper::getOption('plugin_hash');
  $accountKeys = array();
  if ($userToken) {
    $headers = array(
      'usertoken' => $userToken,
    );
    $responseJson = $api
      ->apiCall('page/get-account-keys', null, $headers);
    $response = json_decode($responseJson);
    if (!is_null($response) && $response->success) {
      $accountKeys = $response->data->accountkeys;
    }
  }
  return $accountKeys;
}