diff --git image_captcha/image_captcha-rtl.css image_captcha/image_captcha-rtl.css new file mode 100644 index 0000000..e243e03 --- /dev/null +++ image_captcha/image_captcha-rtl.css @@ -0,0 +1,14 @@ +/* $Id$ */ + +/** + * Styling of the font selection list (with previews) + * on the Image CAPTCHA settings page. + */ + +/** + * Float the fonts with preview (with a fixed width) + * to create a multi-column layout. + */ +.image_captcha_admin_font_preview { + float: right; +} diff --git image_captcha/image_captcha.admin.inc image_captcha/image_captcha.admin.inc index d15714e..d746367 100644 --- image_captcha/image_captcha.admin.inc +++ image_captcha/image_captcha.admin.inc @@ -59,6 +59,15 @@ function image_captcha_settings_form() { '#default_value' => (int) variable_get('image_captcha_code_length', 5), '#description' => t('The code length influences the size of the image. Note that larger values make the image generation more CPU intensive.'), ); + $langs = language_list('direction'); + if ($langs[1]) { + $form['image_captcha_code_settings']['image_captcha_direction'] = array( + '#type' => 'checkbox', + '#title' => t('RTL direction for RTL languages'), + '#default_value' => variable_get('image_captcha_direction', 0), + '#description' => t('This option will cause characters in captcha image to start from the right if the current language is RTL.'), + ); + } // Font related stuff. $form['image_captcha_font_settings'] = _image_captcha_settings_form_font_section(); diff --git image_captcha/image_captcha.user.inc image_captcha/image_captcha.user.inc index 2a9a8e5..18f599e 100644 --- image_captcha/image_captcha.user.inc +++ image_captcha/image_captcha.user.inc @@ -254,6 +254,10 @@ function _image_captcha_image_generator_print_string(&$image, $width, $height, $ $ccage_width = $width / $character_quantity; $ccage_height = $height; + global $language; + if ($language->direction && ((bool) variable_get('image_captcha_direction', 0))) { + $characters = array_reverse($characters); + } foreach ($characters as $c => $character) { // initial position of character: in the center of its cage $center_x = ($c + 0.5) * $ccage_width;