summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2013-07-18 15:02:47 +0200
committerAndrey Andreev <narf@devilix.net>2013-07-18 15:02:47 +0200
commit8963f4010174ad9edf75fb60c7f44f4464680e29 (patch)
treec1bed1012fb46508b88da1f53360daafbafd2892 /user_guide_src
parent1f061c24ef6788ccfea4182e43f9d3076714940d (diff)
Add color customization to the CAPTCHA helper
Ref: Issue #867 & PRs #1405, #2485
Diffstat (limited to 'user_guide_src')
-rw-r--r--user_guide_src/source/changelog.rst6
-rw-r--r--user_guide_src/source/helpers/captcha_helper.rst11
2 files changed, 15 insertions, 2 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 6f08dcb92..4cbbda70e 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -123,10 +123,14 @@ Release Date: Not Released
- Deprecated function ``trim_slashes()`` - it's just an alias for PHP's native ``trim()`` (with a slash as its second argument).
- Deprecated randomization type options **unique** and **encrypt** for funcion :php:func:`random_string()` (they are only aliases for **md5** and **sha1** respectively).
+ - :doc:`CAPTCHA Helper <helpers/captcha_helper>` changes include:
+
+ - Added *word_length* and *pool* options to allow customization of the generated word.
+ - Added *colors* configuration to allow customization for the *background*, *border*, *text* and *grid* colors.
+
- :doc:`Directory Helper <helpers/directory_helper>` :php:func:`directory_map()` will now append ``DIRECTORY_SEPARATOR`` to directory names in the returned array.
- :doc:`Language Helper <helpers/language_helper>` :php:func:`lang()` now accepts an optional list of additional HTML attributes.
- Deprecated the :doc:`Email Helper <helpers/email_helper>` as its ``valid_email()``, ``send_email()`` functions are now only aliases for PHP native functions ``filter_var()`` and ``mail()`` respectively.
- - :doc:`CAPTCHA Helper <helpers/captcha_helper>` :php:func:`create_captcha` added word_length and pool options for setting length of randomly generated captcha word, and what characters to select from.
- Database
diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst
index ca24e011f..27e11e6f8 100644
--- a/user_guide_src/source/helpers/captcha_helper.rst
+++ b/user_guide_src/source/helpers/captcha_helper.rst
@@ -64,7 +64,15 @@ Once loaded you can generate a captcha like this::
'img_height' => 30,
'expiration' => 7200,
'word_length' => 8,
- 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
+
+ // White background and border, black text and shadow, red grid
+ 'colors' => array(
+ 'background' => array(255, 255, 255),
+ 'border' => array(255, 255, 255),
+ 'text' => array(0, 0, 0),
+ 'grid' => array(255, 40, 40)
+ )
);
$cap = create_captcha($vals);
@@ -82,6 +90,7 @@ Once loaded you can generate a captcha like this::
in the captcha folder before it will be deleted. The default is two
hours.
- **word_length** defaults to 8, **pool** defaults to '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+- If any of the **colors** values is missing, it will be replaced by the default.
Adding a Database
-----------------