You are here

function currency_api_filter in Currency 6

Implementation of hook_filter().

File

currency_api/currency_api.module, line 407
This module provides an API for currency conversion.

Code

function currency_api_filter($op, $delta = 0, $format = -1, $text = '') {
  if ($op == 'list') {
    return array(
      0 => t('Currency exchange'),
    );
  }
  switch ($delta) {
    case 0:
      switch ($op) {
        case 'description':
          return t("Converts currency tokens ([currency:from:to:value:decimals]) to a currency exchange rate. The 'decimals' parameter is optional. Eg: [currency:EUR:USD:100:2].");
        case 'no cache':
          return TRUE;
        case 'prepare':
          return $text;
        case 'process':
          return preg_replace_callback('/\\[currency:(.*?)\\]/i', '_currency_api_filter_process', $text);
        default:
          return $text;
      }
      break;
  }
}