You are here

function lingotek_access_by_plan_type in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_access_by_plan_type()
  2. 7.4 lingotek.util.inc \lingotek_access_by_plan_type()
  3. 7.5 lingotek.util.inc \lingotek_access_by_plan_type()
  4. 7.6 lingotek.util.inc \lingotek_access_by_plan_type()

File

./lingotek.util.inc, line 387
Utility functions.

Code

function lingotek_access_by_plan_type($types, $permission = NULL) {
  $account = LingotekAccount::instance();
  $access = FALSE;
  if (is_string($types)) {
    $types = array(
      $types,
    );
  }
  if (!is_array($types)) {
    return $access;
  }
  foreach ($types as $type) {
    $access = TRUE;
    if (!$account
      ->isPlanType($type)) {
      return FALSE;
    }
  }
  return is_null($permission) ? $access : user_access($permission);
}