Add public keyword to methods

[MAILPOET-2413]
This commit is contained in:
Amine Ben hammou
2019-12-26 12:56:49 +01:00
committed by wxa
parent ec409042d5
commit 43df66d162
823 changed files with 4440 additions and 4440 deletions

View File

@ -6,7 +6,7 @@ use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper;
use MailPoet\Newsletter\Renderer\StylesHelper;
class Button {
static function render($element, $column_base_width) {
public static function render($element, $column_base_width) {
$element['styles']['block']['width'] = self::calculateWidth($element, $column_base_width);
$styles = 'display:inline-block;-webkit-text-size-adjust:none;mso-hide:all;text-decoration:none !important;text-align:center;' . StylesHelper::getBlockStyles($element, $exclude = ['textAlign']);
$styles = EHelper::escapeHtmlStyleAttr($styles);
@ -43,7 +43,7 @@ class Button {
return $template;
}
static function calculateWidth($element, $column_base_width) {
public static function calculateWidth($element, $column_base_width) {
$column_width = $column_base_width - (StylesHelper::$padding_width * 2);
$border_width = (int)$element['styles']['block']['borderWidth'];
$button_width = (int)$element['styles']['block']['width'];

View File

@ -6,7 +6,7 @@ use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper;
use MailPoet\Newsletter\Renderer\StylesHelper;
class Divider {
static function render($element) {
public static function render($element) {
$background_color = $element['styles']['block']['backgroundColor'];
$divider_cell_style = "border-top-width: {$element['styles']['block']['borderWidth']};";
$divider_cell_style .= "border-top-style: {$element['styles']['block']['borderStyle']};";

View File

@ -8,7 +8,7 @@ use MailPoet\Util\pQuery\pQuery;
use MailPoetVendor\CSS;
class Footer {
static function render($element) {
public static function render($element) {
$element['text'] = preg_replace('/\n/', '<br />', $element['text']);
$element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']);
$line_height = sprintf(

View File

@ -8,7 +8,7 @@ use MailPoet\Util\pQuery\pQuery;
use MailPoetVendor\CSS;
class Header {
static function render($element) {
public static function render($element) {
$element['text'] = preg_replace('/\n/', '<br />', $element['text']);
$element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']);
$line_height = sprintf(

View File

@ -7,7 +7,7 @@ use MailPoet\Newsletter\Renderer\StylesHelper;
use MailPoet\WP\Functions as WPFunctions;
class Image {
static function render($element, $column_base_width) {
public static function render($element, $column_base_width) {
if (empty($element['src'])) {
return '';
}
@ -51,7 +51,7 @@ class Image {
return $template;
}
static function adjustImageDimensions($element, $column_base_width) {
public 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) {

View File

@ -12,7 +12,7 @@ class Renderer {
public $posts;
public $ALC;
function __construct(array $newsletter) {
public function __construct(array $newsletter) {
$this->newsletter = $newsletter;
$this->posts = [];
$newer_than_timestamp = false;
@ -31,7 +31,7 @@ class Renderer {
);
}
function render($data) {
public function render($data) {
$column_count = count($data['blocks']);
$columns_layout = isset($data['columnLayout']) ? $data['columnLayout'] : null;
$column_widths = ColumnsHelper::columnWidth($column_count, $columns_layout);
@ -63,7 +63,7 @@ class Renderer {
return $block_content;
}
function createElementFromBlockType($block, $column_base_width) {
public function createElementFromBlockType($block, $column_base_width) {
if ($block['type'] === 'automatedLatestContent') {
$content = $this->processAutomatedLatestContent($block, $column_base_width);
return $content;
@ -76,7 +76,7 @@ class Renderer {
return $block_class::render($block, $column_base_width);
}
function automatedLatestContentTransformedPosts($args) {
public function automatedLatestContentTransformedPosts($args) {
$posts_to_exclude = $this->getPosts();
$ALC_posts = $this->ALC->getPosts($args, $posts_to_exclude);
foreach ($ALC_posts as $post) {
@ -86,7 +86,7 @@ class Renderer {
return $this->ALC->transformPosts($args, $ALC_posts);
}
function processAutomatedLatestContent($args, $column_base_width) {
public function processAutomatedLatestContent($args, $column_base_width) {
$transformed_posts = [
'blocks' => $this->automatedLatestContentTransformedPosts($args),
];
@ -95,11 +95,11 @@ class Renderer {
return $rendered_posts;
}
function getPosts() {
public function getPosts() {
return $this->posts;
}
function setPosts($posts) {
public function setPosts($posts) {
return $this->posts = $posts;
}
}

View File

@ -5,7 +5,7 @@ namespace MailPoet\Newsletter\Renderer\Blocks;
use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper;
class Social {
static function render($element) {
public static function render($element) {
$icons_block = '';
if (is_array($element['icons'])) {
foreach ($element['icons'] as $index => $icon) {
@ -15,10 +15,10 @@ class Social {
$style = 'width:' . $icon['width'] . ';height:' . $icon['width'] . ';-ms-interpolation-mode:bicubic;border:0;display:inline;outline:none;';
$icons_block .= '<a href="' . EHelper::escapeHtmlLinkAttr($icon['link']) . '" style="text-decoration:none!important;"
><img
><img
src="' . EHelper::escapeHtmlLinkAttr($icon['image']) . '"
width="' . (int)$icon['width'] . '"
height="' . (int)$icon['height'] . '"
width="' . (int)$icon['width'] . '"
height="' . (int)$icon['height'] . '"
style="' . EHelper::escapeHtmlStyleAttr($style) . '"
alt="' . EHelper::escapeHtmlAttr($icon['iconType']) . '"
></a>&nbsp;';

View File

@ -5,7 +5,7 @@ namespace MailPoet\Newsletter\Renderer\Blocks;
use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper;
class Spacer {
static function render($element) {
public static function render($element) {
$height = (int)$element['styles']['block']['height'];
$background_color = EHelper::escapeHtmlAttr($element['styles']['block']['backgroundColor']);
$template = '

View File

@ -8,7 +8,7 @@ use MailPoet\Newsletter\Renderer\StylesHelper;
use MailPoet\Util\pQuery\pQuery;
class Text {
static function render($element) {
public static function render($element) {
$html = $element['text'];
// replace &nbsp; with spaces
$html = str_replace('&nbsp;', ' ', $html);
@ -27,7 +27,7 @@ class Text {
return $template;
}
static function convertBlockquotesToTables($html) {
public static function convertBlockquotesToTables($html) {
$DOM_parser = new pQuery();
$DOM = $DOM_parser->parseStr($html);
$blockquotes = $DOM->query('blockquote');
@ -72,7 +72,7 @@ class Text {
return $DOM->__toString();
}
static function convertParagraphsToTables($html) {
public static function convertParagraphsToTables($html) {
$DOM_parser = new pQuery();
$DOM = $DOM_parser->parseStr($html);
$paragraphs = $DOM->query('p');
@ -136,7 +136,7 @@ class Text {
return $DOM->__toString();
}
static function styleLists($html) {
public static function styleLists($html) {
$DOM_parser = new pQuery();
$DOM = $DOM_parser->parseStr($html);
$lists = $DOM->query('ol, ul, li');
@ -156,7 +156,7 @@ class Text {
return $DOM->__toString();
}
static function styleHeadings($html) {
public static function styleHeadings($html) {
$DOM_parser = new pQuery();
$DOM = $DOM_parser->parseStr($html);
$headings = $DOM->query('h1, h2, h3, h4');
@ -169,11 +169,11 @@ class Text {
return $DOM->__toString();
}
static function removeLastLineBreak($html) {
public static function removeLastLineBreak($html) {
return preg_replace('/(^)?(<br[^>]*?\/?>)+$/i', '', $html);
}
static function insertLineBreak($element) {
public static function insertLineBreak($element) {
$element->parent->insertChild(
[
'tag_name' => 'br',