You are here

function i18nstrings_allowed_format in Internationalization 6

Check if input format is allowed for translation or whether a textgroup is 'safe'.

Parameters

$format: Input format key or NULL if not format (will be allowed)

$textgroup: Check whether strings for this textgroup are allowed when no format information

3 calls to i18nstrings_allowed_format()
i18nstrings_add_l10n_client in i18nstrings/i18nstrings.module
Add string to l10n strings if enabled and allowed for this string
i18nstrings_add_string in i18nstrings/i18nstrings.module
Add source string to the locale tables for translation.
i18nstrings_update in i18nstrings/i18nstrings.module
Update / create translation source for user defined strings.

File

i18nstrings/i18nstrings.module, line 480
Internationalization (i18n) package - translatable strings.

Code

function i18nstrings_allowed_format($format = NULL, $textgroup = NULL) {
  $allowed_formats = variable_get('i18nstrings_allowed_formats', array(
    variable_get('filter_default_format', 1),
  ));
  if (isset($format)) {
    return in_array(filter_resolve_format($format), $allowed_formats);
  }
  elseif ($textgroup) {
    $allowed_groups = variable_get('i18nstrings_allowed_textgroups', array());
    return i18nstrings_group_info($textgroup, 'format') === FALSE || in_array($textgroup, $allowed_groups);
  }
  else {

    // No format, no textgroup, this is OK
    return TRUE;
  }
}