Add space between if and ‘(‘
[MAILPOET-1791]
This commit is contained in:
@@ -62,7 +62,7 @@ class StylesHelper {
|
||||
static $padding_width = 20;
|
||||
|
||||
static function getBlockStyles($element, $ignore_specific_styles = false) {
|
||||
if(!isset($element['styles']['block'])) {
|
||||
if (!isset($element['styles']['block'])) {
|
||||
return;
|
||||
}
|
||||
return self::getStyles($element['styles'], 'block', $ignore_specific_styles);
|
||||
@@ -70,7 +70,7 @@ class StylesHelper {
|
||||
|
||||
static function getStyles($data, $type, $ignore_specific_styles = false) {
|
||||
$styles = array_map(function($attribute, $style) use ($ignore_specific_styles) {
|
||||
if(!$ignore_specific_styles || !in_array($attribute, $ignore_specific_styles)) {
|
||||
if (!$ignore_specific_styles || !in_array($attribute, $ignore_specific_styles)) {
|
||||
$style = StylesHelper::applyFontFamily($attribute, $style);
|
||||
return StylesHelper::translateCSSAttribute($attribute) . ': ' . $style . ' !important;';
|
||||
}
|
||||
@@ -97,11 +97,11 @@ class StylesHelper {
|
||||
}
|
||||
|
||||
static function applyTextAlignment($block) {
|
||||
if(is_array($block)) {
|
||||
if (is_array($block)) {
|
||||
$text_alignment = isset($block['styles']['block']['textAlign']) ?
|
||||
strtolower($block['styles']['block']['textAlign']) :
|
||||
false;
|
||||
if(preg_match('/center|right|justify/i', $text_alignment)) {
|
||||
if (preg_match('/center|right|justify/i', $text_alignment)) {
|
||||
return $block;
|
||||
}
|
||||
$block['styles']['block']['textAlign'] = 'left';
|
||||
@@ -113,21 +113,21 @@ class StylesHelper {
|
||||
}
|
||||
|
||||
static function applyFontFamily($attribute, $style) {
|
||||
if($attribute !== 'fontFamily') return $style;
|
||||
if ($attribute !== 'fontFamily') return $style;
|
||||
return (isset(self::$font[$style])) ?
|
||||
self::$font[$style] :
|
||||
self::$font['Arial'];
|
||||
}
|
||||
|
||||
static function applyHeadingMargin($style, $selector) {
|
||||
if(!preg_match('/h[1-4]/i', $selector)) return $style;
|
||||
if (!preg_match('/h[1-4]/i', $selector)) return $style;
|
||||
$font_size = (int)$style['fontSize'];
|
||||
$style['margin'] = sprintf('0 0 %spx 0', self::$heading_margin_multiplier * $font_size);
|
||||
return $style;
|
||||
}
|
||||
|
||||
static function applyLineHeight($style, $selector) {
|
||||
if(!preg_match('/mailpoet_paragraph|h[1-4]/i', $selector)) return $style;
|
||||
if (!preg_match('/mailpoet_paragraph|h[1-4]/i', $selector)) return $style;
|
||||
$font_size = (int)$style['fontSize'];
|
||||
$style['lineHeight'] = sprintf('%spx', self::$line_height_multiplier * $font_size);
|
||||
return $style;
|
||||
@@ -136,7 +136,7 @@ class StylesHelper {
|
||||
private static function getCustomFontsNames($styles) {
|
||||
$font_names = [];
|
||||
foreach ($styles as $style) {
|
||||
if(isset($style['fontFamily']) && in_array($style['fontFamily'], self::$custom_fonts)) {
|
||||
if (isset($style['fontFamily']) && in_array($style['fontFamily'], self::$custom_fonts)) {
|
||||
$font_names[$style['fontFamily']] = true;
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ class StylesHelper {
|
||||
foreach (self::getCustomFontsNames($styles) as $name) {
|
||||
$links[] = urlencode($name) . ':400,400i,700,700i';
|
||||
}
|
||||
if(!count($links)) {
|
||||
if (!count($links)) {
|
||||
return '';
|
||||
}
|
||||
return '<!--[if !mso]><link href="https://fonts.googleapis.com/css?family='
|
||||
|
Reference in New Issue
Block a user