You are here

function _math_captcha_repr_op in CAPTCHA Pack 7

Same name and namespace in other branches
  1. 8 math_captcha/math_captcha.challenge.inc \_math_captcha_repr_op()
  2. 5 math_captcha/math_captcha.module \_math_captcha_repr_op()
  3. 6 math_captcha/math_captcha.challenge.inc \_math_captcha_repr_op()

Helper function for transforming a operator to a textual representation

1 call to _math_captcha_repr_op()
_math_captcha_build_captcha in math_captcha/math_captcha.challenge.inc
Helper function to build a math CAPTCHA form item

File

math_captcha/math_captcha.challenge.inc, line 121
Provides challenge functions for MATH CAPTCHA administration.

Code

function _math_captcha_repr_op($op) {

  // Start with no textual representation
  $t = "{$op}";

  // If enabled and available: do textual representation
  if (variable_get('math_captcha_textual_operators', FALSE)) {
    $repr_map = array(
      '+' => t('plus'),
      '-' => t('minus'),
      '*' => t('times'),
      '=' => t('equals'),
    );
    if (array_key_exists($op, $repr_map)) {
      $t = $repr_map[$op];
    }
  }
  return $t;
}