Skip to content

Commit

Permalink
added lang option
Browse files Browse the repository at this point in the history
  • Loading branch information
dalpo committed Oct 6, 2010
1 parent 5897ee7 commit 122c812
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions views/helpers/recaptcha.php
@@ -1,5 +1,7 @@
<?php
/**
* Bitly plugin for CakePHP
*
* Copyright 2009-2010, Cake Development Corporation (http://cakedc.com)
*
* Licensed under The MIT License
Expand Down Expand Up @@ -31,21 +33,27 @@ class RecaptchaHelper extends AppHelper {
*/
public $apiUrl = 'http://api.recaptcha.net';



/**
* Displays the Recaptcha input
*
* @param
* @param boolean
* @return string
*/
function display($options = array()) {
public function display($options = array()) {
$defaults = array(
'element' => null,
'publicKey' => Configure::read('Recaptcha.publicKey'),
'error' => null,
'ssl' => true,
'theme' => 'white'
);
'theme' => "white",
'lang' => 'en'
);
if(Configure::read("Config.language")) {
$defaults['lang'] = Configure::read("Config.language");
}
$options = array_merge($defaults, $options);
extract($options);

Expand Down Expand Up @@ -73,7 +81,8 @@ function display($options = array()) {
return '
<script type="text/javascript">
var RecaptchaOptions = {
theme : "'. $theme .'"
theme : "'. $theme .'",
lang : "'. $lang .'"
};
</script>
<script type="text/javascript" src="'. $server . '/challenge?k=' . $publicKey . '"></script>
Expand All @@ -82,15 +91,14 @@ function display($options = array()) {
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>';

}

/**
* Recaptcha signup URL
*
* @return string
*/
function signupUrl($appname = null) {
public function signupUrl($appname = null) {
return "http://recaptcha.net/api/getkey?domain=" . WWW_ROOT . '&amp;app=' . urlencode($appName);
}

Expand All @@ -111,7 +119,7 @@ private function __AesPad($val) {
*
* @return string
*/
function __AesEncrypt($value, $key) {
public function __AesEncrypt($value, $key) {
if (!function_exists('mcrypt_encrypt')) {
throw new Exception(__d('recaptcha', 'To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.', true));
}
Expand Down Expand Up @@ -202,3 +210,4 @@ private function __view() {
}

}

0 comments on commit 122c812

Please sign in to comment.