You are here

function _text_captcha_ordinal in CAPTCHA 6

Same name and namespace in other branches
  1. 5.3 text_captcha/text_captcha.module \_text_captcha_ordinal()

function that returns a textual represention of an ordinal

1 call to _text_captcha_ordinal()
text_captcha_captcha in text_captcha/text_captcha.module
Implementation of hook_captcha

File

text_captcha/text_captcha.user.inc, line 49

Code

function _text_captcha_ordinal($n) {
  $ordinalmap = array(
    1 => t('first'),
    2 => t('second'),
    3 => t('third'),
    4 => t('fourth'),
    5 => t('fifth'),
    6 => t('sixth'),
    7 => t('seventh'),
    8 => t('eighth'),
    9 => t('ninth'),
    10 => t('tenth'),
  );
  if (array_key_exists($n, $ordinalmap)) {
    return $ordinalmap[$n];
  }
  else {
    return "{$n}th";
  }
}