public function BotchaRecipeHoneypot::getJsValue in BOTCHA Spam Prevention 7.3
Same name and namespace in other branches
- 6.2 controller/botcha_recipe.controller.inc \BotchaRecipeHoneypot::getJsValue()
- 6.3 controller/recipe/botcha.recipe.controller.inc \BotchaRecipeHoneypot::getJsValue()
- 7.2 controller/botcha_recipe.controller.inc \BotchaRecipeHoneypot::getJsValue()
1 method overrides BotchaRecipeHoneypot::getJsValue()
- BotchaRecipeHoneypot2::getJsValue in controller/
recipe/ botcha.recipe.controller.inc
File
- controller/
recipe/ botcha.recipe.controller.inc, line 675 - Controller layer of the BotchaRecipe objects.
Class
Code
public function getJsValue() {
// Just ensure that parameters are set.
$fields = $this
->getProperty($this->settings['fields'], 'getFields');
$js = $this
->getProperty($this->settings['js'], 'getJs');
$js_tok1 = reset($js['chops']);
$js_tok2 = next($js['chops']);
// @todo Abstract it.
return <<<END
(function (\$) {
Drupal.behaviors.{<span class="php-variable">$js</span>[<span class="php-string">'name'</span>]} = {
attach: function (context, settings) {
\$("input.{<span class="php-variable">$fields</span>[<span class="php-constant">0</span>][<span class="php-string">'class'</span>]}").each(function() {
f=\$(this)[0];
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>]})+"{<span class="php-variable">$js_tok2</span>}";}
});
}
};
})(jQuery);
END;
}