Fix code style by updated ruleset
[MAILPOET-3912]
This commit is contained in:
@@ -119,8 +119,10 @@ class BlockRendererHelper {
|
||||
if (in_array($block['id'], ['email', 'last_name', 'first_name'], true)) {
|
||||
$automationId = 'data-automation-id="form_' . $block['id'] . '_label" ';
|
||||
}
|
||||
if (isset($block['params']['label'])
|
||||
&& strlen(trim($block['params']['label'])) > 0) {
|
||||
if (
|
||||
isset($block['params']['label'])
|
||||
&& strlen(trim($block['params']['label'])) > 0
|
||||
) {
|
||||
$html .= '<label '
|
||||
. 'class="mailpoet_' . $block['type'] . '_label" '
|
||||
. $this->renderFontStyle($formSettings, $block['styles'] ?? [])
|
||||
|
@@ -51,8 +51,10 @@ class Date {
|
||||
$dateFormat = $dateFormats[$block['params']['date_type']][0];
|
||||
|
||||
// set date format if specified
|
||||
if (isset($block['params']['date_format'])
|
||||
&& strlen(trim($block['params']['date_format'])) > 0) {
|
||||
if (
|
||||
isset($block['params']['date_format'])
|
||||
&& strlen(trim($block['params']['date_format'])) > 0
|
||||
) {
|
||||
$dateFormat = $block['params']['date_format'];
|
||||
}
|
||||
|
||||
|
@@ -179,7 +179,8 @@ class DisplayFormInWPContent {
|
||||
$settings = $form->getSettings();
|
||||
// check the structure just to be sure
|
||||
|
||||
if (!is_array($settings)
|
||||
if (
|
||||
!is_array($settings)
|
||||
|| !isset($settings['form_placement'][$formType])
|
||||
|| !is_array($settings['form_placement'][$formType])
|
||||
) return false;
|
||||
|
@@ -67,7 +67,8 @@ class Renderer {
|
||||
// add honeypot for spambots
|
||||
$html = ($honeypotEnabled) ? $this->renderHoneypot() : '';
|
||||
foreach ($blocks as $key => $block) {
|
||||
if ($captchaEnabled
|
||||
if (
|
||||
$captchaEnabled
|
||||
&& $block['type'] === FormEntity::SUBMIT_BLOCK_TYPE
|
||||
&& $this->settings->get('captcha.type') === Captcha::TYPE_RECAPTCHA
|
||||
) {
|
||||
|
@@ -62,7 +62,7 @@ class Styles {
|
||||
$mobileBackgrounds[] = trim($formSettings['gradient']);
|
||||
}
|
||||
|
||||
if (!empty($formSettings['backgroundColor']) ) {
|
||||
if (!empty($formSettings['backgroundColor'])) {
|
||||
$backgrounds[] = trim($formSettings['backgroundColor']);
|
||||
$mobileBackgrounds[] = trim($formSettings['backgroundColor']);
|
||||
}
|
||||
@@ -86,10 +86,12 @@ class Styles {
|
||||
// Form element styles
|
||||
$formStyles = [];
|
||||
if (isset($formSettings['form_padding'])) {
|
||||
if (in_array(
|
||||
$displayType,
|
||||
[FormEntity::DISPLAY_TYPE_POPUP, FormEntity::DISPLAY_TYPE_FIXED_BAR, FormEntity::DISPLAY_TYPE_SLIDE_IN]
|
||||
)) {
|
||||
if (
|
||||
in_array(
|
||||
$displayType,
|
||||
[FormEntity::DISPLAY_TYPE_POPUP, FormEntity::DISPLAY_TYPE_FIXED_BAR, FormEntity::DISPLAY_TYPE_SLIDE_IN]
|
||||
)
|
||||
) {
|
||||
$padding = $formSettings['form_padding'];
|
||||
$media .= " @media (min-width: 500px) {{$selector} {padding: {$padding}px;}} ";
|
||||
} else {
|
||||
@@ -217,10 +219,12 @@ class Styles {
|
||||
} else {
|
||||
$wrapperStyles[] = 'background-image: none;';
|
||||
}
|
||||
if (in_array(
|
||||
$displayType,
|
||||
[FormEntity::DISPLAY_TYPE_POPUP, FormEntity::DISPLAY_TYPE_FIXED_BAR, FormEntity::DISPLAY_TYPE_SLIDE_IN]
|
||||
)) {
|
||||
if (
|
||||
in_array(
|
||||
$displayType,
|
||||
[FormEntity::DISPLAY_TYPE_POPUP, FormEntity::DISPLAY_TYPE_FIXED_BAR, FormEntity::DISPLAY_TYPE_SLIDE_IN]
|
||||
)
|
||||
) {
|
||||
$wrapperStyles = array_merge($wrapperStyles, [
|
||||
'animation: none;',
|
||||
'border: none;',
|
||||
|
@@ -153,7 +153,7 @@ class Widget extends \WP_Widget {
|
||||
$formName .= $form->getStatus() === FormEntity::STATUS_DISABLED ? ' (' . __('inactive', 'mailpoet') . ')' : '';
|
||||
?>
|
||||
<option value="<?php echo $form->getId(); ?>" <?php echo $isSelected; ?>><?php echo $formName; ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
@@ -201,7 +201,8 @@ class Widget extends \WP_Widget {
|
||||
if ($form->getStatus() !== FormEntity::STATUS_ENABLED) return '';
|
||||
|
||||
$formType = 'widget';
|
||||
if (isset($instance['form_type']) && in_array(
|
||||
if (
|
||||
isset($instance['form_type']) && in_array(
|
||||
$instance['form_type'],
|
||||
[
|
||||
'html',
|
||||
@@ -209,7 +210,8 @@ class Widget extends \WP_Widget {
|
||||
'iframe',
|
||||
'shortcode',
|
||||
]
|
||||
)) {
|
||||
)
|
||||
) {
|
||||
$formType = $instance['form_type'];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user