public function BotchaRecipeHoneypot2::getJsValue in BOTCHA Spam Prevention 7.3
Same name and namespace in other branches
- 6.2 controller/botcha_recipe.controller.inc \BotchaRecipeHoneypot2::getJsValue()
- 6.3 controller/recipe/botcha.recipe.controller.inc \BotchaRecipeHoneypot2::getJsValue()
- 7.2 controller/botcha_recipe.controller.inc \BotchaRecipeHoneypot2::getJsValue()
Overrides BotchaRecipeHoneypot::getJsValue
File
- controller/
recipe/ botcha.recipe.controller.inc, line 748 - Controller layer of the BotchaRecipe objects.
Class
Code
public function getJsValue() {
$fields = $this
->getProperty($this->settings['fields'], 'getFields');
$js = $this
->getProperty($this->settings['js'], 'getJs');
$js_tok1 = reset($js['chops']);
$selector = "input.{$fields[0]['class']}";
// @todo Abstract it.
return <<<END
(function (\$) {
Drupal.behaviors.{<span class="php-variable">$js</span>[<span class="php-string">'name'</span>]} = {
attach: function (context, settings) {
\$("{<span class="php-variable">$selector</span>}").each(function() {
f=\$(this)[0];
tok2 = f.style.fontFamily;
if(tok2.charAt(0) == "'" || tok2.charAt(0) == '"') tok2=tok2.substring(1, tok2.length-1);
tok2=tok2.substring(1, tok2.length);
if (f.value.indexOf("{<span class="php-variable">$js</span>[<span class="php-string">'match'</span>]}")==0){f.value="{<span class="php-variable">$js_tok1</span>}"+f.value.substring({<span class="php-variable">$js</span>[<span class="php-string">'pos'</span>]})+tok2;}
});
}
};
}(jQuery));
END;
}