EllisLab/CodeIgniter — pull request #2396 by abkr (2013-04-10 11:38:00+00:00)
Title: Add options in create_captcha() to specify the randomly generated captcha word length and character pool

Uses the same defaults as were hard coded in (8 chars in length,
0-9a-aA-Z). Small change in this file means less code elsewhere when
generating random character strings for the captcha word.

Can now do something along the lines of this to create a captcha of 5 characters, only with characters 0-9.

5,
'character_pool_for_generated_word' => implode(range(0,9)),
));
?>

Previously it would have needed a few more lines in the application to generate the randomly generated string, then feed it to create_captcha() with 'word' => $generated_string. With this change it is just a bit less code in the application (and the default of 8 characters, (a-z A-Z 0-9) is quite large and with characters like "l, I, 1, 0, O, o" it can be beneficial to be able to easily exclude certain characters like that.

character_pool_for_generated_word should be a string of all characters. The default is 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ