Move field obfuscation into own class

[MAILPOET-1014]
This commit is contained in:
Pavel Dohnal
2017-08-16 14:58:31 +02:00
parent 18f208cf47
commit 364dd1b2a3
4 changed files with 76 additions and 10 deletions

View File

@@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
use MailPoet\Form\Util\FieldNameObfuscator;
abstract class Base {
protected static function getInputValidation($block, $extra_rules = array()) {
$rules = array();
@@ -104,7 +106,8 @@ abstract class Base {
if((int)$block['id'] > 0) {
return 'cf_'.$block['id'];
} else {
return 'form_field_'.base64_encode($block['id']);//obfuscate field name for spambots
$obfuscator = new FieldNameObfuscator();
return $obfuscator->obfuscate($block['id']);//obfuscate field name for spambots
}
}