Hi, I want to use reCAPTCHA as my CAPTCHA. I already have ported a Prado 2 component to a Yii widget for the thing which renders the code (attached, BTW does magic setters and getters work with widgets?), which is the very basic renderer (I don't use the API for customization). This widget (reCAPTCHA, actually) generates the next HTML code:
My question is just this next: will be possible to use magic setters and getters in widgets? It seems that they’re not working (or am I doing something wrong )
Yes, you can use magic getter/setter anywhere. What problem did you encounter?
One suggestion: Please use a different prefix other than 'C'. Otherwise, you may encounter naming conflict if in future Yii includes the same class in the core release. You should also not use the alias 'system.validators.CReCaptchaValidator'.
Using 'application.extensions.recaptcha.ReCaptchaValidator' is more appropriate, assuming you are releasing it as an extension.
Yes, you can use magic getter/setter anywhere. What problem did you encounter?
Well, in [tt]CReCaptcha[/tt] I have a [tt]public $language[/tt] property, and this method:
public function setLanguage($value)
{
$suffix = empty($value) ? 'en' : (($p=strpos($value,'_'))!==false) ? strtolower(substr($value,0,$p)) : strtolower($value);
if (in_array($suffix, $this->validLanguages)) $this->language = $suffix;
}
which is never executed. I assume then that I'm doing something wrong… but can't find out what…
Quote
One suggestion: Please use a different prefix other than 'C'. Otherwise, you may encounter naming conflict if in future Yii includes the same class in the core release. You should also not use the alias 'system.validators.CReCaptchaValidator'.
Using 'application.extensions.recaptcha.ReCaptchaValidator' is more appropriate, assuming you are releasing it as an extension.
Well, it depends: if you decide to include it in the core, go ahead. If you prefer to accept it as an extension, I can do the changes and resubmit it
You should not define a public member variable while defining a getter/setter for it because the getter/setter won't get chance to be invoked. In your case, define language as a private member, and define a getter function for it.
Yes, please rename the classes. We can always rename them back to "C" when we decide to include them into core release.
You should not define a public member variable while defining a getter/setter for it because the getter/setter won't get chance to be invoked. In your case, define language as a private member, and define a getter function for it.
I was missing that. Thanks.
Quote
Yes, please rename the classes. We can always rename them back to "C" when we decide to include them into core release.