Add public keyword to methods
[MAILPOET-2413]
This commit is contained in:
@ -62,14 +62,14 @@ class StylesHelper {
|
||||
static $heading_margin_multiplier = 0.3;
|
||||
static $padding_width = 20;
|
||||
|
||||
static function getBlockStyles($element, $ignore_specific_styles = false) {
|
||||
public static function getBlockStyles($element, $ignore_specific_styles = false) {
|
||||
if (!isset($element['styles']['block'])) {
|
||||
return;
|
||||
}
|
||||
return self::getStyles($element['styles'], 'block', $ignore_specific_styles);
|
||||
}
|
||||
|
||||
static function getStyles($data, $type, $ignore_specific_styles = false) {
|
||||
public 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)) {
|
||||
$style = StylesHelper::applyFontFamily($attribute, $style);
|
||||
@ -79,13 +79,13 @@ class StylesHelper {
|
||||
return implode('', $styles);
|
||||
}
|
||||
|
||||
static function translateCSSAttribute($attribute) {
|
||||
public static function translateCSSAttribute($attribute) {
|
||||
return (array_key_exists($attribute, self::$css_attributes)) ?
|
||||
self::$css_attributes[$attribute] :
|
||||
$attribute;
|
||||
}
|
||||
|
||||
static function setStyle($style, $selector) {
|
||||
public static function setStyle($style, $selector) {
|
||||
$css = $selector . '{' . PHP_EOL;
|
||||
$style = self::applyHeadingMargin($style, $selector);
|
||||
$style = self::applyLineHeight($style, $selector);
|
||||
@ -97,7 +97,7 @@ class StylesHelper {
|
||||
return $css;
|
||||
}
|
||||
|
||||
static function applyTextAlignment($block) {
|
||||
public static function applyTextAlignment($block) {
|
||||
if (is_array($block)) {
|
||||
$text_alignment = isset($block['styles']['block']['textAlign']) ?
|
||||
strtolower($block['styles']['block']['textAlign']) :
|
||||
@ -113,21 +113,21 @@ class StylesHelper {
|
||||
$block . 'text-align:left;';
|
||||
}
|
||||
|
||||
static function applyFontFamily($attribute, $style) {
|
||||
public static function applyFontFamily($attribute, $style) {
|
||||
if ($attribute !== 'fontFamily') return $style;
|
||||
return (isset(self::$font[$style])) ?
|
||||
self::$font[$style] :
|
||||
self::$font['Arial'];
|
||||
}
|
||||
|
||||
static function applyHeadingMargin($style, $selector) {
|
||||
public static function applyHeadingMargin($style, $selector) {
|
||||
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) {
|
||||
public static function applyLineHeight($style, $selector) {
|
||||
if (!preg_match('/mailpoet_paragraph|h[1-4]/i', $selector)) return $style;
|
||||
$line_height = isset($style['lineHeight']) ? (float)$style['lineHeight'] : self::$default_line_height;
|
||||
$font_size = (int)$style['fontSize'];
|
||||
@ -145,7 +145,7 @@ class StylesHelper {
|
||||
return array_keys($font_names);
|
||||
}
|
||||
|
||||
static function getCustomFontsLinks($styles) {
|
||||
public static function getCustomFontsLinks($styles) {
|
||||
$links = [];
|
||||
foreach (self::getCustomFontsNames($styles) as $name) {
|
||||
$links[] = urlencode($name) . ':400,400i,700,700i';
|
||||
|
Reference in New Issue
Block a user