widthStyles = $this->renderWidthStyles($formSettings, $selector, $displayType); $typeSpecificStyles = $this->getFormTypeSpecificStyles($selector, $displayType); $messagesStyles = $this->renderFormMessageStyles($form, $selector); $additionalStyles = $selector . ' .mailpoet_paragraph.last {margin-bottom: 0} '; $media .= " @media (min-width: 500px) {{$selector} .last .mailpoet_paragraph:last-child {margin-bottom: 0}} "; $media .= " @media (max-width: 500px) {{$selector} .mailpoet_form_column:last-child .mailpoet_paragraph:last-child {margin-bottom: 0}} "; return $formWrapperStyles . $formElementStyles . $widthStyles . $messagesStyles . $typeSpecificStyles . $additionalStyles . $media; } private function renderWidthStyles(array $formSettings, string $selector, string $displayType): string { $styles = []; if (isset($formSettings['form_placement'][$displayType]['styles']['width'])) { $width = $this->getWidthValue($formSettings['form_placement'][$displayType]['styles']['width']); } if ($displayType === FormEntity::DISPLAY_TYPE_POPUP) { if (isset($width)) { $styles[] = "width: $width"; $styles[] = "max-width: 100vw"; } else { // BC compatibilty $styles[] = 'width: 560px'; $styles[] = 'max-width: 560px'; } } elseif ($displayType === FormEntity::DISPLAY_TYPE_SLIDE_IN) { if (isset($width)) { $styles[] = "width: $width"; $styles[] = "max-width: 100vw"; } else { // BC compatibilty $styles[] = 'max-width: 600px'; $styles[] = 'min-width: 350px'; } } elseif ($displayType === FormEntity::DISPLAY_TYPE_FIXED_BAR) { if (isset($width)) { $styles[] = "width: $width"; $styles[] = "max-width: 100%"; } else { // BC compatibilty $styles[] = 'max-width: 960px'; } } elseif ($displayType === FormEntity::DISPLAY_TYPE_BELOW_POST) { if (isset($width)) { $styles[] = "width: $width"; } } elseif ($displayType === FormEntity::DISPLAY_TYPE_OTHERS) { if (isset($width)) { $styles[] = "width: $width"; } } $widthSelector = $selector; $widthSelector .= $displayType === FormEntity::DISPLAY_TYPE_FIXED_BAR ? ' form.mailpoet_form' : ''; if (!$styles) { return ''; } return $widthSelector . '{' . join(';', $styles) . ';}'; } private function getWidthValue(array $width) { return $width['value'] . ($width['unit'] === 'percent' ? '%' : 'px'); } public function renderFormMessageStyles(FormEntity $form, string $selector): string { $formSettings = $form->getSettings(); if (!is_array($formSettings)) { return ''; } return $this->renderMessagesStyles($formSettings, $selector); } private function renderMessagesStyles(array $formSettings, string $selector): string { $styles = "$selector .mailpoet_message {margin: 0; padding: 0 20px;}"; if (isset($formSettings['success_validation_color']) && $formSettings['success_validation_color']) { $success = $formSettings['success_validation_color']; $styles .= " $selector .mailpoet_validate_success {color: $success} $selector input.parsley-success {color: $success} $selector select.parsley-success {color: $success} $selector textarea.parsley-success {color: $success} "; } if (isset($formSettings['error_validation_color']) && $formSettings['error_validation_color']) { $error = $formSettings['error_validation_color']; $styles .= " $selector .mailpoet_validate_error {color: $error} $selector input.parsley-error {color: $error} $selector select.parsley-error {color: $error} $selector textarea.textarea.parsley-error {color: $error} $selector .parsley-errors-list {color: $error} $selector .parsley-required {color: $error} $selector .parsley-custom-error-message {color: $error} "; } return $styles; } private function getFormTypeSpecificStyles(string $selector, string $displayType): string { $styles = []; if ($displayType === FormEntity::DISPLAY_TYPE_SLIDE_IN) { $styles[] = $selector . '.mailpoet_form_slide_in { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }'; $styles[] = $selector . '.mailpoet_form_position_right { border-top-right-radius: 0; }'; $styles[] = $selector . '.mailpoet_form_position_left { border-top-left-radius: 0; }'; } return join('', $styles); } private function getMobileStyles(string $selector, string $displayType, array $mobileBackgrounds): string { $wrapperStyles = []; if ($mobileBackgrounds) { $wrapperStyles[] = 'background: ' . join(', ', $mobileBackgrounds) . ';'; } else { $wrapperStyles[] = 'background-image: none;'; } 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;', 'border-radius: 0;', 'bottom: 0;', 'left: 0;', 'max-height: 40%;', 'padding: 20px;', 'right: 0;', 'top: auto;', 'transform: none;', 'width: 100%;', 'min-width: 100%;', ]); } return "@media (max-width: 500px) {{$selector} {" . join('', $wrapperStyles) . "}}"; } }
Fatal error: Uncaught Error: Class "MailPoet\Form\Util\Styles" not found in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php:3641 Stack trace: #0 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2612): MailPoetGenerated\FreeCachedContainer->getRenderer3Service() #1 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2640): MailPoetGenerated\FreeCachedContainer->getHooks2Service() #2 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(122): MailPoetGenerated\FreeCachedContainer->getInitializerService() #3 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(110): MailPoetVendor\Symfony\Component\DependencyInjection\Container->make('MailPoet\\Config...', 1) #4 /htdocs/wp-content/plugins/mailpoet/lib/DI/ContainerWrapper.php(39): MailPoetVendor\Symfony\Component\DependencyInjection\Container->get('MailPoet\\Config...') #5 /htdocs/wp-content/plugins/mailpoet/mailpoet_initializer.php(89): MailPoet\DI\ContainerWrapper->get('MailPoet\\Config...') #6 /htdocs/wp-content/plugins/mailpoet/mailpoet.php(194): require_once('/htdocs/wp-cont...') #7 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...') #8 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #9 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #10 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #11 /htdocs/index.php(17): require('/htdocs/wp-blog...') #12 {main} thrown in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php on line 3641