You are here

function _phrase_captcha_ordinal in CAPTCHA Pack 8

Same name and namespace in other branches
  1. 5 text_captcha/phrase_captcha/phrase_captcha.module \_phrase_captcha_ordinal()
  2. 6 text_captcha/phrase_captcha/phrase_captcha.inc \_phrase_captcha_ordinal()
  3. 7 text_captcha/phrase_captcha/phrase_captcha.module \_phrase_captcha_ordinal()

Function that returns a textual representation of an ordinal.

1 call to _phrase_captcha_ordinal()
_phrase_captcha_word_question_word_index in text_captcha/modules/phrase_captcha/phrase_captcha.module
Return details of 'word index' challenge.

File

text_captcha/modules/phrase_captcha/phrase_captcha.module, line 141
Implementation of a phrase based CAPTCHA, for use with the CAPTCHA module.

Code

function _phrase_captcha_ordinal($n) {
  $ordinalmap = [
    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";
  }
}