Add space between if and ‘(‘
[MAILPOET-1791]
This commit is contained in:
@ -9,27 +9,27 @@ abstract class Base {
|
||||
protected static function getInputValidation($block, $extra_rules = array()) {
|
||||
$rules = array();
|
||||
|
||||
if($block['id'] === 'email') {
|
||||
if ($block['id'] === 'email') {
|
||||
$rules['required'] = true;
|
||||
$rules['minlength'] = ModelValidator::EMAIL_MIN_LENGTH;
|
||||
$rules['maxlength'] = ModelValidator::EMAIL_MAX_LENGTH;
|
||||
$rules['error-message'] = __('Please specify a valid email address.', 'mailpoet');
|
||||
}
|
||||
|
||||
if($block['id'] === 'segments') {
|
||||
if ($block['id'] === 'segments') {
|
||||
$rules['required'] = true;
|
||||
$rules['mincheck'] = 1;
|
||||
$rules['group'] = $block['id'];
|
||||
$rules['required-message'] = __('Please select a list', 'mailpoet');
|
||||
}
|
||||
|
||||
if(!empty($block['params']['required'])) {
|
||||
if (!empty($block['params']['required'])) {
|
||||
$rules['required'] = true;
|
||||
$rules['required-message'] = __('This field is required.', 'mailpoet');
|
||||
}
|
||||
|
||||
if(!empty($block['params']['validate'])) {
|
||||
if($block['params']['validate'] === 'phone') {
|
||||
if (!empty($block['params']['validate'])) {
|
||||
if ($block['params']['validate'] === 'phone') {
|
||||
$rules['pattern'] = "^[\d\+\-\.\(\)\/\s]*$";
|
||||
$rules['error-message'] = __('Please specify a valid phone number', 'mailpoet');
|
||||
} else {
|
||||
@ -37,13 +37,13 @@ abstract class Base {
|
||||
}
|
||||
}
|
||||
|
||||
if(in_array($block['type'], array('radio', 'checkbox'))) {
|
||||
if (in_array($block['type'], array('radio', 'checkbox'))) {
|
||||
$rules['group'] = 'custom_field_'.$block['id'];
|
||||
$rules['errors-container'] = '.mailpoet_error_'.$block['id'];
|
||||
$rules['required-message'] = __('Please select at least one option', 'mailpoet');
|
||||
}
|
||||
|
||||
if($block['type'] === 'date') {
|
||||
if ($block['type'] === 'date') {
|
||||
$rules['group'] = 'custom_field_'.$block['id'];
|
||||
$rules['errors-container'] = '.mailpoet_error_'.$block['id'];
|
||||
}
|
||||
@ -52,10 +52,10 @@ abstract class Base {
|
||||
|
||||
$rules = array_merge($rules, $extra_rules);
|
||||
|
||||
if(!empty($rules)) {
|
||||
if (!empty($rules)) {
|
||||
$rules = array_unique($rules);
|
||||
foreach ($rules as $rule => $value) {
|
||||
if(is_bool($value)) {
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? 'true' : 'false';
|
||||
}
|
||||
$validation[] = 'data-parsley-'.$rule.'="'.$value.'"';
|
||||
@ -66,18 +66,18 @@ abstract class Base {
|
||||
|
||||
protected static function renderLabel($block) {
|
||||
$html = '';
|
||||
if(
|
||||
if (
|
||||
isset($block['params']['label_within'])
|
||||
&& $block['params']['label_within']
|
||||
) {
|
||||
return $html;
|
||||
}
|
||||
if(isset($block['params']['label'])
|
||||
if (isset($block['params']['label'])
|
||||
&& strlen(trim($block['params']['label'])) > 0) {
|
||||
$html .= '<label class="mailpoet_'.$block['type'].'_label">';
|
||||
$html .= $block['params']['label'];
|
||||
|
||||
if(isset($block['params']['required']) && $block['params']['required']) {
|
||||
if (isset($block['params']['required']) && $block['params']['required']) {
|
||||
$html .= ' <span class="mailpoet_required">*</span>';
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ abstract class Base {
|
||||
protected static function renderInputPlaceholder($block) {
|
||||
$html = '';
|
||||
// if the label is displayed as a placeholder,
|
||||
if(
|
||||
if (
|
||||
isset($block['params']['label_within'])
|
||||
&& $block['params']['label_within']
|
||||
) {
|
||||
@ -97,7 +97,7 @@ abstract class Base {
|
||||
$html .= ' placeholder="';
|
||||
$html .= static::getFieldLabel($block);
|
||||
// add an asterisk if it's a required field
|
||||
if(isset($block['params']['required']) && $block['params']['required']) {
|
||||
if (isset($block['params']['required']) && $block['params']['required']) {
|
||||
$html .= ' *';
|
||||
}
|
||||
$html .= '" ';
|
||||
@ -107,7 +107,7 @@ abstract class Base {
|
||||
|
||||
// return field name depending on block data
|
||||
protected static function getFieldName($block = array()) {
|
||||
if((int)$block['id'] > 0) {
|
||||
if ((int)$block['id'] > 0) {
|
||||
return 'cf_'.$block['id'];
|
||||
} else {
|
||||
$obfuscator = new FieldNameObfuscator();
|
||||
@ -130,11 +130,11 @@ abstract class Base {
|
||||
protected static function getInputModifiers($block = array()) {
|
||||
$modifiers = array();
|
||||
|
||||
if(isset($block['params']['readonly']) && $block['params']['readonly']) {
|
||||
if (isset($block['params']['readonly']) && $block['params']['readonly']) {
|
||||
$modifiers[] = 'readonly';
|
||||
}
|
||||
|
||||
if(isset($block['params']['disabled']) && $block['params']['disabled']) {
|
||||
if (isset($block['params']['disabled']) && $block['params']['disabled']) {
|
||||
$modifiers[] = 'disabled';
|
||||
}
|
||||
return join(' ', $modifiers);
|
||||
|
Reference in New Issue
Block a user