Add space between if and ‘(‘
[MAILPOET-1791]
This commit is contained in:
@ -5,7 +5,7 @@ use pQuery;
|
||||
use pQuery\DomNode;
|
||||
use MailPoet\Util\DOM as DOMUtil;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class StructureTransformer {
|
||||
|
||||
@ -27,7 +27,7 @@ class StructureTransformer {
|
||||
$top_ancestor = DOMUtil::findTopAncestor($item);
|
||||
$offset = $top_ancestor->index();
|
||||
|
||||
if($item->hasParent('a') || $item->hasParent('figure')) {
|
||||
if ($item->hasParent('a') || $item->hasParent('figure')) {
|
||||
$item = $item->parent;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ class StructureTransformer {
|
||||
private function transformTagsToBlocks(DomNode $root, $image_full_width) {
|
||||
$children = $this->filterOutFiguresWithoutImages($root->children);
|
||||
return array_map(function($item) use ($image_full_width) {
|
||||
if($this->isImageElement($item)) {
|
||||
if ($this->isImageElement($item)) {
|
||||
$image = $item->tag === 'img' ? $item : $item->query('img')[0];
|
||||
$width = $image->getAttribute('width');
|
||||
$height = $image->getAttribute('height');
|
||||
@ -72,7 +72,7 @@ class StructureTransformer {
|
||||
|
||||
private function filterOutFiguresWithoutImages(array $items) {
|
||||
$items = array_filter($items, function (DomNode $item) {
|
||||
if($item->tag === 'figure' && $item->query('img')->count() === 0) {
|
||||
if ($item->tag === 'figure' && $item->query('img')->count() === 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -86,7 +86,7 @@ class StructureTransformer {
|
||||
|
||||
private function getImageAlignment(DomNode $image) {
|
||||
$alignItem = $image->hasParent('figure') ? $image->parent : $image;
|
||||
if($alignItem->hasClass('aligncenter')) {
|
||||
if ($alignItem->hasClass('aligncenter')) {
|
||||
$align = 'center';
|
||||
} elseif ($alignItem->hasClass('alignleft')) {
|
||||
$align = 'left';
|
||||
@ -106,11 +106,11 @@ class StructureTransformer {
|
||||
$updated_structure = array();
|
||||
$text_accumulator = '';
|
||||
foreach ($structure as $item) {
|
||||
if($item['type'] === 'text') {
|
||||
if ($item['type'] === 'text') {
|
||||
$text_accumulator .= $item['text'];
|
||||
}
|
||||
if($item['type'] !== 'text') {
|
||||
if(!empty($text_accumulator)) {
|
||||
if ($item['type'] !== 'text') {
|
||||
if (!empty($text_accumulator)) {
|
||||
$updated_structure[] = array(
|
||||
'type' => 'text',
|
||||
'text' => trim($text_accumulator),
|
||||
@ -121,7 +121,7 @@ class StructureTransformer {
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($text_accumulator)) {
|
||||
if (!empty($text_accumulator)) {
|
||||
$updated_structure[] = array(
|
||||
'type' => 'text',
|
||||
'text' => trim($text_accumulator),
|
||||
|
Reference in New Issue
Block a user