Add space between if and ‘(‘

[MAILPOET-1791]
This commit is contained in:
Ján Mikláš
2019-02-13 13:08:49 +01:00
committed by M. Shull
parent a935b091d3
commit 3ee58aea10
333 changed files with 4001 additions and 4001 deletions

View File

@@ -7,17 +7,17 @@ use MailPoet\Newsletter\Renderer\StylesHelper;
class Image {
static function render($element, $column_base_width) {
if(empty($element['src'])) {
if (empty($element['src'])) {
return '';
}
if(substr($element['src'], 0, 1) == '/' && substr($element['src'], 1, 1) != '/') {
if (substr($element['src'], 0, 1) == '/' && substr($element['src'], 1, 1) != '/') {
$element['src'] = get_option('siteurl') . $element['src'];
}
$element['width'] = str_replace('px', '', $element['width']);
$element['height'] = str_replace('px', '', $element['height']);
$original_width = 0;
if(is_numeric($element['width']) && is_numeric($element['height'])) {
if (is_numeric($element['width']) && is_numeric($element['height'])) {
$element['width'] = (int)$element['width'];
$element['height'] = (int)$element['height'];
$original_width = $element['width'];
@@ -26,7 +26,7 @@ class Image {
// If image was downsized because of column width set width to aways fill full column (e.g. on mobile)
$style = '';
if($element['fullWidth'] === true && $original_width > $element['width']) {
if ($element['fullWidth'] === true && $original_width > $element['width']) {
$style = 'style="width:100%"';
}
@@ -34,11 +34,11 @@ class Image {
<img src="' . $element['src'] . '"
width="' . $element['width'] . '" alt="' . $element['alt'] . '"' . $style . '/>
';
if(!empty($element['link'])) {
if (!empty($element['link'])) {
$image_template = '<a href="' . $element['link'] . '">' . $image_template . '</a>';
}
$align = 'center';
if(!empty($element['styles']['block']['textAlign']) && in_array($element['styles']['block']['textAlign'], array('left', 'right'))) {
if (!empty($element['styles']['block']['textAlign']) && in_array($element['styles']['block']['textAlign'], array('left', 'right'))) {
$align = $element['styles']['block']['textAlign'];
}
@@ -54,13 +54,13 @@ class Image {
static function adjustImageDimensions($element, $column_base_width) {
$padded_width = StylesHelper::$padding_width * 2;
// scale image to fit column width
if($element['width'] > $column_base_width) {
if ($element['width'] > $column_base_width) {
$ratio = $element['width'] / $column_base_width;
$element['width'] = $column_base_width;
$element['height'] = (int)ceil($element['height'] / $ratio);
}
// resize image if the image is padded and wider than padded column width
if($element['fullWidth'] === false &&
if ($element['fullWidth'] === false &&
$element['width'] > ($column_base_width - $padded_width)
) {
$ratio = $element['width'] / ($column_base_width - $padded_width);