Add rule for concatenation operator spacing

[MAILPOET-2090]
This commit is contained in:
Pavel Dohnal
2019-05-20 14:12:31 +02:00
committed by M. Shull
parent 12ff88ee21
commit 5d64ec168d
61 changed files with 273 additions and 267 deletions

View File

@ -33,7 +33,7 @@ abstract class Response {
}
if (!empty($response)) {
@header('Content-Type: application/json; charset='.get_option('blog_charset'));
@header('Content-Type: application/json; charset=' . get_option('blog_charset'));
echo WPFunctions::get()->wpJsonEncode($response);
}
die();

View File

@ -55,7 +55,7 @@ class Segments extends APIEndpoint {
$data = [];
foreach ($listing_data['items'] as $segment) {
$segment->subscribers_url = WPFunctions::get()->adminUrl(
'admin.php?page=mailpoet-subscribers#/filter[segment='.$segment->id.']'
'admin.php?page=mailpoet-subscribers#/filter[segment=' . $segment->id . ']'
);
$data[] = $segment

View File

@ -251,7 +251,7 @@ class MP2Migrator {
global $wpdb;
$table = MP_SEGMENTS_TABLE;
$wpdb->query("DELETE FROM {$table} WHERE type != '" . Segment::TYPE_WP_USERS . "' AND type != '" . Segment::TYPE_WC_USERS ."'");
$wpdb->query("DELETE FROM {$table} WHERE type != '" . Segment::TYPE_WP_USERS . "' AND type != '" . Segment::TYPE_WC_USERS . "'");
}
/**

View File

@ -263,7 +263,7 @@ class Migrator {
'type varchar(20) NOT NULL DEFAULT "standard",',
'sender_address varchar(150) NOT NULL DEFAULT "",',
'sender_name varchar(150) NOT NULL DEFAULT "",',
'status varchar(20) NOT NULL DEFAULT "'.Newsletter::STATUS_DRAFT.'",',
'status varchar(20) NOT NULL DEFAULT "' . Newsletter::STATUS_DRAFT . '",',
'reply_to_address varchar(150) NOT NULL DEFAULT "",',
'reply_to_name varchar(150) NOT NULL DEFAULT "",',
'preheader varchar(250) NOT NULL DEFAULT "",',

View File

@ -599,7 +599,7 @@ class BookStoreWithCoupon {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Facebook.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -638,7 +638,7 @@ class BookStoreWithCoupon {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Twitter.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -677,7 +677,7 @@ class BookStoreWithCoupon {
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Instagram.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',

View File

@ -1463,7 +1463,7 @@ class ClearNews {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/03-circles/Facebook.png',
'image' => $this->social_icon_url . '/03-circles/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -1473,7 +1473,7 @@ class ClearNews {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/03-circles/Twitter.png',
'image' => $this->social_icon_url . '/03-circles/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -1483,7 +1483,7 @@ class ClearNews {
'type' => 'socialIcon',
'iconType' => 'youtube',
'link' => 'http://www.youtube.com',
'image' => $this->social_icon_url.'/03-circles/Youtube.png',
'image' => $this->social_icon_url . '/03-circles/Youtube.png',
'height' => '32px',
'width' => '32px',
'text' => 'Youtube',

View File

@ -972,7 +972,7 @@ class FashionBlogA {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Facebook.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -982,7 +982,7 @@ class FashionBlogA {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Twitter.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -992,7 +992,7 @@ class FashionBlogA {
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Instagram.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',

View File

@ -556,7 +556,7 @@ class FashionShop {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/06-full-symbol-color/Facebook.png',
'image' => $this->social_icon_url . '/06-full-symbol-color/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -566,7 +566,7 @@ class FashionShop {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/06-full-symbol-color/Twitter.png',
'image' => $this->social_icon_url . '/06-full-symbol-color/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -576,7 +576,7 @@ class FashionShop {
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url.'/06-full-symbol-color/Instagram.png',
'image' => $this->social_icon_url . '/06-full-symbol-color/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
@ -586,7 +586,7 @@ class FashionShop {
'type' => 'socialIcon',
'iconType' => 'youtube',
'link' => 'http://www.youtube.com',
'image' => $this->social_icon_url.'/06-full-symbol-color/Youtube.png',
'image' => $this->social_icon_url . '/06-full-symbol-color/Youtube.png',
'height' => '32px',
'width' => '32px',
'text' => 'Youtube',

View File

@ -228,7 +228,7 @@ class FlowersWithCoupon {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Facebook.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -238,7 +238,7 @@ class FlowersWithCoupon {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Twitter.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -248,7 +248,7 @@ class FlowersWithCoupon {
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Instagram.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
@ -1090,7 +1090,7 @@ class FlowersWithCoupon {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/02-grey/Facebook.png',
'image' => $this->social_icon_url . '/02-grey/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -1100,7 +1100,7 @@ class FlowersWithCoupon {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/02-grey/Twitter.png',
'image' => $this->social_icon_url . '/02-grey/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -1110,7 +1110,7 @@ class FlowersWithCoupon {
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url.'/02-grey/Instagram.png',
'image' => $this->social_icon_url . '/02-grey/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',

View File

@ -1001,7 +1001,7 @@ class IndustryConference {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/08-full-symbol-grey/Facebook.png',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -1011,7 +1011,7 @@ class IndustryConference {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/08-full-symbol-grey/Twitter.png',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -1021,7 +1021,7 @@ class IndustryConference {
'type' => 'socialIcon',
'iconType' => 'email',
'link' => '',
'image' => $this->social_icon_url.'/08-full-symbol-grey/Email.png',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Email.png',
'height' => '32px',
'width' => '32px',
'text' => 'Email',
@ -1031,7 +1031,7 @@ class IndustryConference {
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url.'/08-full-symbol-grey/Instagram.png',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',

View File

@ -860,7 +860,7 @@ class LifestyleBlogA {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Facebook.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -870,7 +870,7 @@ class LifestyleBlogA {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Twitter.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -880,7 +880,7 @@ class LifestyleBlogA {
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Instagram.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',

View File

@ -1069,7 +1069,7 @@ class LifestyleBlogB {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/03-circles/Facebook.png',
'image' => $this->social_icon_url . '/03-circles/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -1079,7 +1079,7 @@ class LifestyleBlogB {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/03-circles/Twitter.png',
'image' => $this->social_icon_url . '/03-circles/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -1089,7 +1089,7 @@ class LifestyleBlogB {
'type' => 'socialIcon',
'iconType' => 'website',
'link' => '',
'image' => $this->social_icon_url.'/03-circles/Website.png',
'image' => $this->social_icon_url . '/03-circles/Website.png',
'height' => '32px',
'width' => '32px',
'text' => 'Website',
@ -1099,7 +1099,7 @@ class LifestyleBlogB {
'type' => 'socialIcon',
'iconType' => 'pinterest',
'link' => 'http://www.pinterest.com',
'image' => $this->social_icon_url.'/03-circles/Pinterest.png',
'image' => $this->social_icon_url . '/03-circles/Pinterest.png',
'height' => '32px',
'width' => '32px',
'text' => 'Pinterest',

View File

@ -753,7 +753,7 @@ class NewspaperTraditional {
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Facebook.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
@ -763,7 +763,7 @@ class NewspaperTraditional {
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Twitter.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
@ -773,7 +773,7 @@ class NewspaperTraditional {
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url.'/07-full-symbol-black/Instagram.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
@ -783,7 +783,7 @@ class NewspaperTraditional {
'type' => 'socialIcon',
'iconType' => 'email',
'link' => '',
'image' => $this->social_icon_url.'/07-full-symbol-black/Email.png',
'image' => $this->social_icon_url . '/07-full-symbol-black/Email.png',
'height' => '32px',
'width' => '32px',
'text' => 'Email',

View File

@ -92,7 +92,7 @@ class RequirementsChecker {
function checkMbstringExtension() {
if (!extension_loaded('mbstring')) {
require_once Env::$util_path .'/Polyfills.php';
require_once Env::$util_path . '/Polyfills.php';
}
return true;
}

View File

@ -99,17 +99,17 @@ class Shortcodes {
} else {
$title = $this->wp->applyFilters('mailpoet_archive_title', '');
if (!empty($title)) {
$html .= '<h3 class="mailpoet_archive_title">'.$title.'</h3>';
$html .= '<h3 class="mailpoet_archive_title">' . $title . '</h3>';
}
$html .= '<ul class="mailpoet_archive">';
foreach ($newsletters as $newsletter) {
$queue = $newsletter->queue()->findOne();
$html .= '<li>'.
'<span class="mailpoet_archive_date">'.
$this->wp->applyFilters('mailpoet_archive_date', $newsletter).
$html .= '<li>' .
'<span class="mailpoet_archive_date">' .
$this->wp->applyFilters('mailpoet_archive_date', $newsletter) .
'</span>
<span class="mailpoet_archive_subject">'.
$this->wp->applyFilters('mailpoet_archive_subject', $newsletter, $subscriber, $queue).
<span class="mailpoet_archive_subject">' .
$this->wp->applyFilters('mailpoet_archive_subject', $newsletter, $subscriber, $queue) .
'</span>
</li>';
}
@ -132,9 +132,9 @@ class Shortcodes {
$subscriber,
$queue
);
return '<a href="'.esc_attr($preview_url).'" target="_blank" title="'
.esc_attr(__('Preview in a new tab', 'mailpoet')).'">'
.esc_attr($newsletter->newsletter_rendered_subject).
return '<a href="' . esc_attr($preview_url) . '" target="_blank" title="'
. esc_attr(__('Preview in a new tab', 'mailpoet')) . '">'
. esc_attr($newsletter->newsletter_rendered_subject) .
'</a>';
}
}

View File

@ -26,7 +26,7 @@ class ContainerFactory {
* @return Container
*/
function getContainer() {
$dump_class = '\\'. $this->configurator->getDumpNamespace() . '\\' . $this->configurator->getDumpClassname();
$dump_class = '\\' . $this->configurator->getDumpNamespace() . '\\' . $this->configurator->getDumpClassname();
if (!$this->debug && class_exists($dump_class)) {
$container = new $dump_class();
} else {

View File

@ -39,14 +39,14 @@ abstract class Base {
}
if (in_array($block['type'], ['radio', 'checkbox'])) {
$rules['group'] = 'custom_field_'.$block['id'];
$rules['errors-container'] = '.mailpoet_error_'.$block['id'];
$rules['group'] = 'custom_field_' . $block['id'];
$rules['errors-container'] = '.mailpoet_error_' . $block['id'];
$rules['required-message'] = WPFunctions::get()->__('Please select at least one option', 'mailpoet');
}
if ($block['type'] === 'date') {
$rules['group'] = 'custom_field_'.$block['id'];
$rules['errors-container'] = '.mailpoet_error_'.$block['id'];
$rules['group'] = 'custom_field_' . $block['id'];
$rules['errors-container'] = '.mailpoet_error_' . $block['id'];
}
$validation = [];
@ -59,7 +59,7 @@ abstract class Base {
if (is_bool($value)) {
$value = ($value) ? 'true' : 'false';
}
$validation[] = 'data-parsley-'.$rule.'="'.$value.'"';
$validation[] = 'data-parsley-' . $rule . '="' . $value . '"';
}
}
return join(' ', $validation);
@ -75,7 +75,7 @@ abstract class Base {
}
if (isset($block['params']['label'])
&& strlen(trim($block['params']['label'])) > 0) {
$html .= '<label class="mailpoet_'.$block['type'].'_label">';
$html .= '<label class="mailpoet_' . $block['type'] . '_label">';
$html .= htmlspecialchars($block['params']['label']);
if (isset($block['params']['required']) && $block['params']['required']) {
@ -109,7 +109,7 @@ abstract class Base {
// return field name depending on block data
protected static function getFieldName($block = []) {
if ((int)$block['id'] > 0) {
return 'cf_'.$block['id'];
return 'cf_' . $block['id'];
} else {
$obfuscator = new FieldNameObfuscator();
return $obfuscator->obfuscate($block['id']);//obfuscate field name for spambots

View File

@ -26,7 +26,7 @@ class Checkbox extends Base {
$html .= '<label class="mailpoet_checkbox_label">';
$html .= '<input type="checkbox" class="mailpoet_checkbox" ';
$html .= 'name="'.$field_name.'" ';
$html .= 'name="' . $field_name . '" ';
$html .= 'value="1" ';
@ -40,12 +40,12 @@ class Checkbox extends Base {
$html .= $field_validation;
$html .= ' /> '.esc_attr($option['value']);
$html .= ' /> ' . esc_attr($option['value']);
$html .= '</label>';
}
$html .= '<span class="mailpoet_error_'.$block['id'].'"></span>';
$html .= '<span class="mailpoet_error_' . $block['id'] . '"></span>';
$html .= '</p>';

View File

@ -73,7 +73,7 @@ class Date extends Base {
$html .= static::getInputValidation($block, [
'required-message' => WPFunctions::get()->__('Please select a day', 'mailpoet'),
]);
$html .= 'name="'.$field_name.'[day]" placeholder="'.__('Day', 'mailpoet').'">';
$html .= 'name="' . $field_name . '[day]" placeholder="' . __('Day', 'mailpoet') . '">';
$html .= static::getDays($block);
$html .= '</select>';
} else if ($date_selector === 'MM') {
@ -82,7 +82,7 @@ class Date extends Base {
$html .= static::getInputValidation($block, [
'required-message' => WPFunctions::get()->__('Please select a month', 'mailpoet'),
]);
$html .= 'name="'.$field_name.'[month]" placeholder="'.__('Month', 'mailpoet').'">';
$html .= 'name="' . $field_name . '[month]" placeholder="' . __('Month', 'mailpoet') . '">';
$html .= static::getMonths($block);
$html .= '</select>';
} else if ($date_selector === 'YYYY') {
@ -91,13 +91,13 @@ class Date extends Base {
$html .= static::getInputValidation($block, [
'required-message' => WPFunctions::get()->__('Please select a year', 'mailpoet'),
]);
$html .= 'name="'.$field_name.'[year]" placeholder="'.__('Year', 'mailpoet').'">';
$html .= 'name="' . $field_name . '[year]" placeholder="' . __('Year', 'mailpoet') . '">';
$html .= static::getYears($block);
$html .= '</select>';
}
}
$html .= '<span class="mailpoet_error_'.$block['id'].'"></span>';
$html .= '<span class="mailpoet_error_' . $block['id'] . '"></span>';
return $html;
}
@ -139,11 +139,11 @@ class Date extends Base {
$html = '';
// empty value label
$html .= '<option value="">'.__('Month', 'mailpoet').'</option>';
$html .= '<option value="">' . __('Month', 'mailpoet') . '</option>';
for ($i = 1; $i < 13; $i++) {
$is_selected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '<option value="'.$i.'" '.$is_selected.'>';
$html .= '<option value="' . $i . '" ' . $is_selected . '>';
$html .= $month_names[$i - 1];
$html .= '</option>';
}
@ -169,12 +169,12 @@ class Date extends Base {
$html = '';
// empty value label
$html .= '<option value="">'.__('Year', 'mailpoet').'</option>';
$html .= '<option value="">' . __('Year', 'mailpoet') . '</option>';
// return years as an array
for ($i = (int)$block['to']; $i > (int)($block['from'] - 1); $i--) {
$is_selected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '<option value="'.$i.'" '.$is_selected.'>'.$i.'</option>';
$html .= '<option value="' . $i . '" ' . $is_selected . '>' . $i . '</option>';
}
return $html;
@ -195,12 +195,12 @@ class Date extends Base {
$html = '';
// empty value label
$html .= '<option value="">'.__('Day', 'mailpoet').'</option>';
$html .= '<option value="">' . __('Day', 'mailpoet') . '</option>';
// return days as an array
for ($i = 1; $i < 32; $i++) {
$is_selected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '<option value="'.$i.'" '.$is_selected.'>'.$i.'</option>';
$html .= '<option value="' . $i . '" ' . $is_selected . '>' . $i . '</option>';
}
return $html;

View File

@ -27,7 +27,7 @@ class Radio extends Base {
$html .= '<input type="radio" class="mailpoet_radio" ';
$html .= 'name="'.$field_name.'" ';
$html .= 'name="' . $field_name . '" ';
if (is_array($option['value'])) {
$value = key($option['value']);
@ -37,7 +37,7 @@ class Radio extends Base {
$label = $option['value'];
}
$html .= 'value="'.esc_attr($value).'" ';
$html .= 'value="' . esc_attr($value) . '" ';
$html .= (
(
@ -48,11 +48,11 @@ class Radio extends Base {
) ? 'checked="checked"' : '';
$html .= $field_validation;
$html .= ' /> '.esc_attr($label);
$html .= ' /> ' . esc_attr($label);
$html .= '</label>';
}
$html .= '<span class="mailpoet_error_'.$block['id'].'"></span>';
$html .= '<span class="mailpoet_error_' . $block['id'] . '"></span>';
$html .= '</p>';

View File

@ -27,14 +27,14 @@ class Segment extends Base {
$html .= '<label class="mailpoet_checkbox_label">';
$html .= '<input type="checkbox" class="mailpoet_checkbox" ';
$html .= 'name="'.$field_name.'[]" ';
$html .= 'value="'.$option['id'].'" '.$is_checked.' ';
$html .= 'name="' . $field_name . '[]" ';
$html .= 'value="' . $option['id'] . '" ' . $is_checked . ' ';
$html .= $field_validation;
$html .= ' /> '.esc_attr($option['name']);
$html .= ' /> ' . esc_attr($option['name']);
$html .= '</label>';
}
$html .= '<span class="mailpoet_error_'.$block['id'].'"></span>';
$html .= '<span class="mailpoet_error_' . $block['id'] . '"></span>';
$html .= '</p>';

View File

@ -16,10 +16,10 @@ class Select extends Base {
$automation_id = ($block['id'] == 'status') ? 'data-automation-id="form_status"' : '';
$html .= '<p class="mailpoet_paragraph">';
$html .= static::renderLabel($block);
$html .= '<select class="mailpoet_select" name="'.$field_name.'" ' . $automation_id . '>';
$html .= '<select class="mailpoet_select" name="' . $field_name . '" ' . $automation_id . '>';
if (isset($block['params']['label_within']) && $block['params']['label_within']) {
$html .= '<option value="">'.static::getFieldLabel($block).'</option>';
$html .= '<option value="">' . static::getFieldLabel($block) . '</option>';
} else {
if (empty($block['params']['required']) || !$block['params']['required']) {
$html .= '<option value="">-</option>';
@ -52,7 +52,7 @@ class Select extends Base {
$label = $option['value'];
}
$html .= '<option value="'.$value.'"' . $is_selected . $is_disabled . '>';
$html .= '<option value="' . $value . '"' . $is_selected . $is_disabled . '>';
$html .= WPFunctions::get()->escAttr($label);
$html .= '</option>';
}

View File

@ -10,7 +10,7 @@ class Submit extends Base {
$html .= '<p class="mailpoet_paragraph"><input type="submit" class="mailpoet_submit" ';
$html .= 'value="'.static::getFieldLabel($block).'" ';
$html .= 'value="' . static::getFieldLabel($block) . '" ';
$html .= 'data-automation-id="subscribe-submit-button" ';

View File

@ -13,9 +13,9 @@ class Textarea extends Base {
$lines = (isset($block['params']['lines']) ? (int)$block['params']['lines'] : 1);
$html .= '<textarea class="mailpoet_textarea" rows="'.$lines.'" ';
$html .= '<textarea class="mailpoet_textarea" rows="' . $lines . '" ';
$html .= 'name="data['.static::getFieldName($block).']"';
$html .= 'name="data[' . static::getFieldName($block) . ']"';
$html .= static::renderInputPlaceholder($block);
@ -23,7 +23,7 @@ class Textarea extends Base {
$html .= static::getInputModifiers($block);
$html .= '>'.static::getFieldValue($block).'</textarea>';
$html .= '>' . static::getFieldValue($block) . '</textarea>';
$html .= '</p>';

View File

@ -52,13 +52,13 @@ class Renderer {
foreach ($blocks as $key => $block) {
if ($block['type'] == 'submit' && $settings->get('re_captcha.enabled')) {
$site_key = $settings->get('re_captcha.site_token');
$html .= '<div class="mailpoet_recaptcha" data-sitekey="'. $site_key .'">
$html .= '<div class="mailpoet_recaptcha" data-sitekey="' . $site_key . '">
<div class="mailpoet_recaptcha_container"></div>
<noscript>
<div>
<div style="width: 302px; height: 422px; position: relative;">
<div style="width: 302px; height: 422px; position: absolute;">
<iframe src="https://www.google.com/recaptcha/api/fallback?k='. $site_key .'" frameborder="0" scrolling="no" style="width: 302px; height:422px; border-style: none;">
<iframe src="https://www.google.com/recaptcha/api/fallback?k=' . $site_key . '" frameborder="0" scrolling="no" style="width: 302px; height:422px; border-style: none;">
</iframe>
</div>
</div>

View File

@ -29,7 +29,7 @@ class Export {
'height="100%"',
'scrolling="no"',
'frameborder="0"',
'src="'.$iframe_url.'"',
'src="' . $iframe_url . '"',
'class="mailpoet_form_iframe"',
'id="mailpoet_form_iframe"',
'vspace="0"',
@ -44,8 +44,8 @@ class Export {
case 'php':
$output = [
'$form_widget = new \MailPoet\Form\Widget();',
'echo $form_widget->widget(array(\'form\' => '.
(int)$form['id'].
'echo $form_widget->widget(array(\'form\' => ' .
(int)$form['id'] .
', \'form_type\' => \'php\'));',
];
return join("\n", $output);
@ -53,40 +53,40 @@ class Export {
case 'html':
$output = [];
$output[] = '<!-- '.
$output[] = '<!-- ' .
WPFunctions::get()->__(
'BEGIN Scripts: you should place them in the header of your theme',
'mailpoet'
).
) .
' -->';
// CSS
$output[] = '<link rel="stylesheet" type="text/css" href="'.
Env::$assets_url.'/dist/css/public.css?mp_ver='.MAILPOET_VERSION.
$output[] = '<link rel="stylesheet" type="text/css" href="' .
Env::$assets_url . '/dist/css/public.css?mp_ver=' . MAILPOET_VERSION .
'" />';
// jQuery
$output[] = '<script type="text/javascript" src="'.
WPFunctions::get()->includesUrl().'js/jquery/jquery.js?mp_ver'.MAILPOET_VERSION.
$output[] = '<script type="text/javascript" src="' .
WPFunctions::get()->includesUrl() . 'js/jquery/jquery.js?mp_ver' . MAILPOET_VERSION .
'"></script>';
// JS
$output[] = '<script type="text/javascript" src="'.
Env::$assets_url.'/dist/js/vendor.js?mp_ver='.MAILPOET_VERSION.
$output[] = '<script type="text/javascript" src="' .
Env::$assets_url . '/dist/js/vendor.js?mp_ver=' . MAILPOET_VERSION .
'"></script>';
$output[] = '<script type="text/javascript" src="'.
Env::$assets_url.'/dist/js/public.js?mp_ver='.MAILPOET_VERSION.
$output[] = '<script type="text/javascript" src="' .
Env::$assets_url . '/dist/js/public.js?mp_ver=' . MAILPOET_VERSION .
'"></script>';
// (JS) variables...
$output[] = '<script type="text/javascript">';
$output[] = ' var MailPoetForm = MailPoetForm || {';
$output[] = ' is_rtl: '.((int)is_rtl()).",";
$output[] = ' ajax_url: "'.admin_url('admin-ajax.php').'"';
$output[] = ' is_rtl: ' . ((int)is_rtl()) . ",";
$output[] = ' ajax_url: "' . admin_url('admin-ajax.php') . '"';
$output[] = ' };';
$output[] = '</script>';
$output[] = '<!-- '.
WPFunctions::get()->__('END Scripts', 'mailpoet').
$output[] = '<!-- ' .
WPFunctions::get()->__('END Scripts', 'mailpoet') .
'-->';
$form_widget = new Widget();
@ -97,7 +97,7 @@ class Export {
return join("\n", $output);
case 'shortcode':
return '[mailpoet_form id="'.(int)$form['id'].'"]';
return '[mailpoet_form id="' . (int)$form['id'] . '"]';
}
}
}

View File

@ -11,7 +11,7 @@ class FieldNameObfuscator {
public function obfuscate($name) {
$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
$hash = substr(md5($auth_key . WPFunctions::get()->homeUrl() . $name), 0, self::HASH_LENGTH);
$hash = substr(md5($auth_key . WPFunctions::get()->homeUrl() . $name), 0, self::HASH_LENGTH);
return self::OBFUSCATED_FIELD_PREFIX . base64_encode($hash . '_' . $name);
}

View File

@ -56,7 +56,7 @@ class Widget extends \WP_Widget {
WPFunctions::get()->wpPrintScripts('jquery');
WPFunctions::get()->wpPrintScripts('mailpoet_vendor');
WPFunctions::get()->wpPrintScripts('mailpoet_public');
echo '<script src="'.self::RECAPTCHA_API_URL.'" async defer></script>';
echo '<script src="' . self::RECAPTCHA_API_URL . '" async defer></script>';
$scripts = ob_get_contents();
ob_end_clean();

View File

@ -42,8 +42,8 @@ class Beacon {
'PHP post_max_size' => ini_get('post_max_size'),
'WordPress language' => WPFunctions::get()->getLocale(),
'Multisite environment?' => (is_multisite() ? 'Yes' : 'No'),
'Current Theme' => $current_theme->get('Name').
' (version '.$current_theme->get('Version').')',
'Current Theme' => $current_theme->get('Name') .
' (version ' . $current_theme->get('Version') . ')',
'Active Plugin names' => join(", ", WPFunctions::get()->getOption('active_plugins')),
'Sending Method' => $mta['method'],
'Sending Frequency' => sprintf('%d emails every %d minutes',

View File

@ -16,7 +16,7 @@ class BulkActionController {
}
function apply($model_class, array $data) {
$bulk_action_method = 'bulk'.ucfirst($data['action']);
$bulk_action_method = 'bulk' . ucfirst($data['action']);
unset($data['action']);
$action_class = $this->factory->getActionClass($model_class, $bulk_action_method);

View File

@ -24,7 +24,7 @@ class BulkActionFactory {
private function ensureMethodExists($action_class, $bulk_action_method) {
if (!method_exists($action_class, $bulk_action_method)) {
throw new \Exception(
(is_object($action_class) ? get_class($action_class) : $action_class).' has no method "'.$bulk_action_method.'"'
(is_object($action_class) ? get_class($action_class) : $action_class) . ' has no method "' . $bulk_action_method . '"'
);
}
}

View File

@ -17,7 +17,7 @@ class Handler {
[$data]
);
if (!empty($data['selection'])) {
$custom_query->whereIn($table_name.'.id', $data['selection']);
$custom_query->whereIn($table_name . '.id', $data['selection']);
}
return $custom_query;
} else {
@ -26,7 +26,7 @@ class Handler {
$this->setSearch($model, $data);
if (!empty($data['selection'])) {
$model->whereIn($table_name.'.id', $data['selection']);
$model->whereIn($table_name . '.id', $data['selection']);
}
return $model;
}
@ -66,8 +66,8 @@ class Handler {
$items = $custom_query
->offset($data['offset'])
->limit($data['limit'])
->{'order_by_'.$data['sort_order']}(
$table_name.'.'.$data['sort_by']
->{'order_by_' . $data['sort_order']}(
$table_name . '.' . $data['sort_by']
)
->findMany();
} else {
@ -101,8 +101,8 @@ class Handler {
private function setOrder(\ORMWrapper $model, array $data, $table_name) {
return $model
->{'order_by_'.$data['sort_order']}(
$table_name.'.'.$data['sort_by']);
->{'order_by_' . $data['sort_order']}(
$table_name . '.' . $data['sort_by']);
}
private function setGroup(\ORMWrapper $model, array $data) {

View File

@ -99,7 +99,7 @@ class Form extends Model {
}
static function search($orm, $search = '') {
return $orm->whereLike('name', '%'.$search.'%');
return $orm->whereLike('name', '%' . $search . '%');
}
static function groups() {

View File

@ -66,7 +66,7 @@ class Newsletter extends Model {
function children() {
return $this->hasMany(
__NAMESPACE__.'\Newsletter',
__NAMESPACE__ . '\Newsletter',
'parent_id',
'id'
);
@ -74,7 +74,7 @@ class Newsletter extends Model {
function parent() {
return $this->hasOne(
__NAMESPACE__.'\Newsletter',
__NAMESPACE__ . '\Newsletter',
'id',
'parent_id'
);
@ -82,8 +82,8 @@ class Newsletter extends Model {
function segments() {
return $this->hasManyThrough(
__NAMESPACE__.'\Segment',
__NAMESPACE__.'\NewsletterSegment',
__NAMESPACE__ . '\Segment',
__NAMESPACE__ . '\NewsletterSegment',
'newsletter_id',
'segment_id'
);
@ -91,7 +91,7 @@ class Newsletter extends Model {
function segmentRelations() {
return $this->hasMany(
__NAMESPACE__.'\NewsletterSegment',
__NAMESPACE__ . '\NewsletterSegment',
'newsletter_id',
'id'
);
@ -99,11 +99,11 @@ class Newsletter extends Model {
function options() {
return $this->hasManyThrough(
__NAMESPACE__.'\NewsletterOptionField',
__NAMESPACE__.'\NewsletterOption',
__NAMESPACE__ . '\NewsletterOptionField',
__NAMESPACE__ . '\NewsletterOption',
'newsletter_id',
'option_field_id'
)->select_expr(MP_NEWSLETTER_OPTION_TABLE.'.value');
)->select_expr(MP_NEWSLETTER_OPTION_TABLE . '.value');
}
function save() {
@ -787,7 +787,7 @@ class Newsletter extends Model {
}
static function filterWithOptions($orm, $type) {
$orm = $orm->select(MP_NEWSLETTERS_TABLE.'.*');
$orm = $orm->select(MP_NEWSLETTERS_TABLE . '.*');
$optionFields = NewsletterOptionField::findArray();
foreach ($optionFields as $optionField) {
if ($optionField['newsletter_type'] !== $type) {
@ -796,26 +796,26 @@ class Newsletter extends Model {
$orm = $orm->select_expr(
'IFNULL(GROUP_CONCAT(CASE WHEN ' .
MP_NEWSLETTER_OPTION_FIELDS_TABLE . '.id=' . $optionField['id'] . ' THEN ' .
MP_NEWSLETTER_OPTION_TABLE . '.value END), NULL) as "' . $optionField['name'].'"');
MP_NEWSLETTER_OPTION_TABLE . '.value END), NULL) as "' . $optionField['name'] . '"');
}
$orm = $orm
->left_outer_join(
MP_NEWSLETTER_OPTION_TABLE,
[
MP_NEWSLETTERS_TABLE.'.id',
MP_NEWSLETTERS_TABLE . '.id',
'=',
MP_NEWSLETTER_OPTION_TABLE.'.newsletter_id',
MP_NEWSLETTER_OPTION_TABLE . '.newsletter_id',
]
)
->left_outer_join(
MP_NEWSLETTER_OPTION_FIELDS_TABLE,
[
MP_NEWSLETTER_OPTION_FIELDS_TABLE.'.id',
MP_NEWSLETTER_OPTION_FIELDS_TABLE . '.id',
'=',
MP_NEWSLETTER_OPTION_TABLE.'.option_field_id',
MP_NEWSLETTER_OPTION_TABLE . '.option_field_id',
]
)
->group_by(MP_NEWSLETTERS_TABLE.'.id');
->group_by(MP_NEWSLETTERS_TABLE . '.id');
return $orm;
}

View File

@ -23,6 +23,6 @@ class NewsletterOptionField extends Model {
__NAMESPACE__ . '\NewsletterOption',
'option_field_id',
'newsletter_id'
)->select_expr(MP_NEWSLETTER_OPTION_TABLE.'.value');
)->select_expr(MP_NEWSLETTER_OPTION_TABLE . '.value');
}
}

View File

@ -35,8 +35,8 @@ class ScheduledTask extends Model {
function subscribers() {
return $this->hasManyThrough(
__NAMESPACE__.'\Subscriber',
__NAMESPACE__.'\ScheduledTaskSubscriber',
__NAMESPACE__ . '\Subscriber',
__NAMESPACE__ . '\ScheduledTaskSubscriber',
'task_id',
'subscriber_id'
);

View File

@ -34,8 +34,8 @@ class Segment extends Model {
function newsletters() {
return $this->has_many_through(
__NAMESPACE__.'\Newsletter',
__NAMESPACE__.'\NewsletterSegment',
__NAMESPACE__ . '\Newsletter',
__NAMESPACE__ . '\NewsletterSegment',
'segment_id',
'newsletter_id'
);
@ -43,8 +43,8 @@ class Segment extends Model {
function subscribers() {
return $this->has_many_through(
__NAMESPACE__.'\Subscriber',
__NAMESPACE__.'\SubscriberSegment',
__NAMESPACE__ . '\Subscriber',
__NAMESPACE__ . '\SubscriberSegment',
'segment_id',
'subscriber_id'
);
@ -156,7 +156,7 @@ class Segment extends Model {
}
static function search($orm, $search = '') {
return $orm->whereLike('name', '%'.$search.'%');
return $orm->whereLike('name', '%' . $search . '%');
}
static function groups() {
@ -184,31 +184,31 @@ class Segment extends Model {
}
static function getSegmentsWithSubscriberCount($type = self::TYPE_DEFAULT) {
$query = self::selectMany([self::$_table.'.id', self::$_table.'.name'])
$query = self::selectMany([self::$_table . '.id', self::$_table . '.name'])
->whereIn('type', [Segment::TYPE_DEFAULT, Segment::TYPE_WP_USERS, Segment::TYPE_WC_USERS])
->selectExpr(
self::$_table.'.*, ' .
'COUNT(IF('.
MP_SUBSCRIBER_SEGMENT_TABLE.'.status="'.Subscriber::STATUS_SUBSCRIBED.'"'
.' AND '.
MP_SUBSCRIBERS_TABLE.'.deleted_at IS NULL'
.' AND '.
MP_SUBSCRIBERS_TABLE.'.status="'.Subscriber::STATUS_SUBSCRIBED.'"'
.', 1, NULL)) `subscribers`'
self::$_table . '.*, ' .
'COUNT(IF(' .
MP_SUBSCRIBER_SEGMENT_TABLE . '.status="' . Subscriber::STATUS_SUBSCRIBED . '"'
. ' AND ' .
MP_SUBSCRIBERS_TABLE . '.deleted_at IS NULL'
. ' AND ' .
MP_SUBSCRIBERS_TABLE . '.status="' . Subscriber::STATUS_SUBSCRIBED . '"'
. ', 1, NULL)) `subscribers`'
)
->leftOuterJoin(
MP_SUBSCRIBER_SEGMENT_TABLE,
[self::$_table.'.id', '=', MP_SUBSCRIBER_SEGMENT_TABLE.'.segment_id'])
[self::$_table . '.id', '=', MP_SUBSCRIBER_SEGMENT_TABLE . '.segment_id'])
->leftOuterJoin(
MP_SUBSCRIBERS_TABLE,
[MP_SUBSCRIBER_SEGMENT_TABLE.'.subscriber_id', '=', MP_SUBSCRIBERS_TABLE.'.id'])
->groupBy(self::$_table.'.id')
->groupBy(self::$_table.'.name')
->orderByAsc(self::$_table.'.name')
->whereNull(self::$_table.'.deleted_at');
[MP_SUBSCRIBER_SEGMENT_TABLE . '.subscriber_id', '=', MP_SUBSCRIBERS_TABLE . '.id'])
->groupBy(self::$_table . '.id')
->groupBy(self::$_table . '.name')
->orderByAsc(self::$_table . '.name')
->whereNull(self::$_table . '.deleted_at');
if (!empty($type)) {
$query->where(self::$_table.'.type', $type);
$query->where(self::$_table . '.type', $type);
}
return $query->findArray();
@ -259,7 +259,7 @@ class Segment extends Model {
Segment::rawExecute(join(' ', [
'UPDATE `' . Segment::$_table . '`',
'SET `deleted_at` = NOW()',
'WHERE `id` IN ('.rtrim(str_repeat('?,', count($ids)), ',').')',
'WHERE `id` IN (' . rtrim(str_repeat('?,', count($ids)), ',') . ')',
'AND `type` = "' . Segment::TYPE_DEFAULT . '"',
]), $ids);
});

View File

@ -60,12 +60,12 @@ class Subscriber extends Model {
function segments() {
return $this->has_many_through(
__NAMESPACE__.'\Segment',
__NAMESPACE__.'\SubscriberSegment',
__NAMESPACE__ . '\Segment',
__NAMESPACE__ . '\SubscriberSegment',
'subscriber_id',
'segment_id'
)
->where(MP_SUBSCRIBER_SEGMENT_TABLE.'.status', self::STATUS_SUBSCRIBED);
->where(MP_SUBSCRIBER_SEGMENT_TABLE . '.status', self::STATUS_SUBSCRIBED);
}
function save() {
@ -157,7 +157,7 @@ class Subscriber extends Model {
return $orm->where_raw(
'(`email` LIKE ? OR `first_name` LIKE ? OR `last_name` LIKE ?)',
['%'.$search.'%', '%'.$search.'%', '%'.$search.'%']
['%' . $search . '%', '%' . $search . '%', '%' . $search . '%']
);
}
@ -281,58 +281,58 @@ class Subscriber extends Model {
}
static function filterWithCustomFields($orm) {
$orm = $orm->select(MP_SUBSCRIBERS_TABLE.'.*');
$orm = $orm->select(MP_SUBSCRIBERS_TABLE . '.*');
$customFields = CustomField::findArray();
foreach ($customFields as $customField) {
$orm = $orm->select_expr(
'IFNULL(GROUP_CONCAT(CASE WHEN ' .
MP_CUSTOM_FIELDS_TABLE . '.id=' . $customField['id'] . ' THEN ' .
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.value END), NULL) as "' . $customField['name'].'"');
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.value END), NULL) as "' . $customField['name'] . '"');
}
$orm = $orm
->leftOuterJoin(
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE,
[
MP_SUBSCRIBERS_TABLE.'.id',
MP_SUBSCRIBERS_TABLE . '.id',
'=',
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE.'.subscriber_id',
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.subscriber_id',
]
)
->leftOuterJoin(
MP_CUSTOM_FIELDS_TABLE,
[
MP_CUSTOM_FIELDS_TABLE.'.id',
MP_CUSTOM_FIELDS_TABLE . '.id',
'=',
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE.'.custom_field_id',
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.custom_field_id',
]
)
->groupBy(MP_SUBSCRIBERS_TABLE.'.id');
->groupBy(MP_SUBSCRIBERS_TABLE . '.id');
return $orm;
}
static function filterWithCustomFieldsForExport($orm) {
$orm = $orm->select(MP_SUBSCRIBERS_TABLE.'.*');
$orm = $orm->select(MP_SUBSCRIBERS_TABLE . '.*');
$customFields = CustomField::findArray();
foreach ($customFields as $customField) {
$orm = $orm->selectExpr(
'MAX(CASE WHEN ' .
MP_CUSTOM_FIELDS_TABLE . '.id=' . $customField['id'] . ' THEN ' .
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.value END) as "' . $customField['id'].'"'
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.value END) as "' . $customField['id'] . '"'
);
}
$orm = $orm
->leftOuterJoin(
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE,
[
MP_SUBSCRIBERS_TABLE.'.id', '=',
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE.'.subscriber_id',
MP_SUBSCRIBERS_TABLE . '.id', '=',
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.subscriber_id',
]
)
->leftOuterJoin(
MP_CUSTOM_FIELDS_TABLE,
[
MP_CUSTOM_FIELDS_TABLE.'.id','=',
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE.'.custom_field_id',
MP_CUSTOM_FIELDS_TABLE . '.id','=',
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.custom_field_id',
]
);
return $orm;
@ -356,11 +356,11 @@ class Subscriber extends Model {
function customFields() {
return $this->hasManyThrough(
__NAMESPACE__.'\CustomField',
__NAMESPACE__.'\SubscriberCustomField',
__NAMESPACE__ . '\CustomField',
__NAMESPACE__ . '\SubscriberCustomField',
'subscriber_id',
'custom_field_id'
)->select_expr(MP_SUBSCRIBER_CUSTOM_FIELD_TABLE.'.value');
)->select_expr(MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.value');
}
static function createOrUpdate($data = []) {
@ -444,7 +444,7 @@ class Subscriber extends Model {
->where('subscriber_id', $this->id())
->findMany();
foreach ($relations as $relation) {
$this->{'cf_'.$relation->custom_field_id} = $relation->value;
$this->{'cf_' . $relation->custom_field_id} = $relation->value;
}
return $this;
@ -606,9 +606,9 @@ class Subscriber extends Model {
Subscriber::rawExecute(join(' ', [
'UPDATE `' . Subscriber::$_table . '`',
'SET `deleted_at` = NOW()',
'WHERE `id` IN ('.
'WHERE `id` IN (' .
rtrim(str_repeat('?,', count($subscriber_ids)), ',')
.')',
. ')',
'AND `wp_user_id` IS NULL',
'AND `is_woocommerce_user` = 0',
]),
@ -666,13 +666,13 @@ class Subscriber extends Model {
}
static function withoutSegments($orm) {
return $orm->select(MP_SUBSCRIBERS_TABLE.'.*')
return $orm->select(MP_SUBSCRIBERS_TABLE . '.*')
->whereRaw(
MP_SUBSCRIBERS_TABLE . '.id NOT IN (
SELECT `subscriber_id`
FROM '.MP_SUBSCRIBER_SEGMENT_TABLE.'
WHERE `status` = "'.self::STATUS_SUBSCRIBED.'" AND `segment_id` IN (
SELECT `id` FROM '.MP_SEGMENTS_TABLE.' WHERE `deleted_at` IS NULL
FROM ' . MP_SUBSCRIBER_SEGMENT_TABLE . '
WHERE `status` = "' . self::STATUS_SUBSCRIBED . '" AND `segment_id` IN (
SELECT `id` FROM ' . MP_SEGMENTS_TABLE . ' WHERE `deleted_at` IS NULL
)
)'
);

View File

@ -15,7 +15,7 @@ class SubscriberSegment extends Model {
public static $_table = MP_SUBSCRIBER_SEGMENT_TABLE;
function subscriber() {
return $this->has_one(__NAMESPACE__.'\Subscriber', 'id', 'subscriber_id');
return $this->has_one(__NAMESPACE__ . '\Subscriber', 'id', 'subscriber_id');
}
static function unsubscribeFromSegments($subscriber, $segment_ids = []) {
@ -112,9 +112,9 @@ class SubscriberSegment extends Model {
}
$query = [
'INSERT IGNORE INTO `'.self::$_table.'`',
'INSERT IGNORE INTO `' . self::$_table . '`',
'(`subscriber_id`, `segment_id`, `created_at`)',
'VALUES '.rtrim(str_repeat('(?, ?, NOW()),', $row_count), ','),
'VALUES ' . rtrim(str_repeat('(?, ?, NOW()),', $row_count), ','),
];
self::rawExecute(join(' ', $query), $values);

View File

@ -61,7 +61,7 @@ class PostContentManager {
$content = strip_tags($content, implode('', $tags_not_being_stripped));
if ($with_post_class) {
$content = str_replace('<p', '<p class="' . self::WP_POST_CLASS .'"', WPFunctions::get()->wpautop($content));
$content = str_replace('<p', '<p class="' . self::WP_POST_CLASS . '"', WPFunctions::get()->wpautop($content));
} else {
$content = WPFunctions::get()->wpautop($content);
}
@ -107,7 +107,7 @@ class PostContentManager {
// remove embedded video and replace with links
$content = preg_replace(
'#<iframe.*?src=\"(.+?)\".*><\/iframe>#',
'<a href="$1">'.__('Click here to view media.', 'mailpoet').'</a>',
'<a href="$1">' . __('Click here to view media.', 'mailpoet') . '</a>',
$content
);

View File

@ -30,7 +30,7 @@ class Footer {
'bgcolor="' . $background_color . '"' :
false;
if (!$background_color) unset($element['styles']['block']['backgroundColor']);
$style = 'line-height: ' . $line_height . ';' . StylesHelper::getBlockStyles($element) . StylesHelper::getStyles($element['styles'], 'text');
$style = 'line-height: ' . $line_height . ';' . StylesHelper::getBlockStyles($element) . StylesHelper::getStyles($element['styles'], 'text');
$style = EHelper::escapeHtmlStyleAttr($style);
$template = '
<tr>

View File

@ -30,7 +30,7 @@ class Header {
'bgcolor="' . $background_color . '"' :
false;
if (!$background_color) unset($element['styles']['block']['backgroundColor']);
$style = 'line-height: ' . $line_height . ';' . StylesHelper::getBlockStyles($element) . StylesHelper::getStyles($element['styles'], 'text');
$style = 'line-height: ' . $line_height . ';' . StylesHelper::getBlockStyles($element) . StylesHelper::getStyles($element['styles'], 'text');
$style = EHelper::escapeHtmlStyleAttr($style);
$template = '
<tr>

View File

@ -28,7 +28,7 @@ class Social {
if (!empty($icons_block)) {
$template = '
<tr>
<td class="mailpoet_padded_side mailpoet_padded_vertical" valign="top" align="'. EHelper::escapeHtmlAttr($alignment) . '">
<td class="mailpoet_padded_side mailpoet_padded_vertical" valign="top" align="' . EHelper::escapeHtmlAttr($alignment) . '">
' . $icons_block . '
</td>
</tr>';

View File

@ -27,7 +27,7 @@ class Renderer {
$background_css = $this->getBackgroundCss($styles, $image);
$template['content_start'] = '
<tr>
<td class="mailpoet_content" align="center" style="border-collapse:collapse;' . $background_css . '" ' . $this->getBgColorAttribute($styles, $image) .'>
<td class="mailpoet_content" align="center" style="border-collapse:collapse;' . $background_css . '" ' . $this->getBgColorAttribute($styles, $image) . '>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
<tbody>
<tr>
@ -67,7 +67,7 @@ class Renderer {
private function getMultipleColumnsContainerStart($class, $styles, $image) {
return '
<tr>
<td class="mailpoet_content-' . $class . '" align="left" style="border-collapse:collapse;' . $this->getBackgroundCss($styles, $image) . '" ' . $this->getBgColorAttribute($styles, $image) .'>
<td class="mailpoet_content-' . $class . '" align="left" style="border-collapse:collapse;' . $this->getBackgroundCss($styles, $image) . '" ' . $this->getBgColorAttribute($styles, $image) . '>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
<tbody>
<tr>

View File

@ -61,7 +61,7 @@ class ConfirmationEmailMailer {
// replace list of segments shortcode
$body = str_replace(
'[lists_to_confirm]',
'<strong>'.join(', ', $segment_names).'</strong>',
'<strong>' . join(', ', $segment_names) . '</strong>',
$body
);

View File

@ -50,7 +50,7 @@ class DynamicSubscribersGetter extends SubscribersGetter {
->selectMany([
'list_status' => Subscriber::$_table . '.status',
])
->selectExpr("'". $name . "' AS segment_name")
->selectExpr("'" . $name . "' AS segment_name")
->offset($this->offset)
->limit($this->batch_size)
->findArray();

View File

@ -47,7 +47,7 @@ class Comment {
id="mailpoet_subscribe_on_comment"
value="1"
name="mailpoet[subscribe_on_comment]"
/>&nbsp;'.esc_attr($label).'
/>&nbsp;' . esc_attr($label) . '
</label>
</p>';
}

View File

@ -259,7 +259,7 @@ class Pages {
}
$custom_fields = array_map(function($custom_field) use($subscriber) {
$custom_field->id = 'cf_'.$custom_field->id;
$custom_field->id = 'cf_' . $custom_field->id;
$custom_field = $custom_field->asArray();
$custom_field['params']['value'] = $subscriber->{$custom_field['id']};
@ -392,23 +392,23 @@ class Pages {
]
);
$form_html = '<form method="POST" '.
'action="'.admin_url('admin-post.php').'" '.
$form_html = '<form method="POST" ' .
'action="' . admin_url('admin-post.php') . '" ' .
'novalidate>';
$form_html .= '<input type="hidden" name="action"'.
$form_html .= '<input type="hidden" name="action"' .
' value="mailpoet_subscription_update" />';
$form_html .= '<input type="hidden" name="data[segments]" value="" />';
$form_html .= '<input type="hidden" name="mailpoet_redirect" '.
$form_html .= '<input type="hidden" name="mailpoet_redirect" ' .
'value="' . htmlspecialchars($this->url_helper->getCurrentUrl(), ENT_QUOTES) . '" />';
$form_html .= '<input type="hidden" name="data[email]" value="'.
$subscriber->email.
$form_html .= '<input type="hidden" name="data[email]" value="' .
$subscriber->email .
'" />';
$form_html .= '<input type="hidden" name="token" value="'.
Subscriber::generateToken($subscriber->email).
$form_html .= '<input type="hidden" name="token" value="' .
Subscriber::generateToken($subscriber->email) .
'" />';
$form_html .= '<p class="mailpoet_paragraph">';
$form_html .= '<label>'.__('Email', 'mailpoet').' *<br /><strong>' . htmlspecialchars($subscriber->email) . '</strong></label>';
$form_html .= '<label>' . __('Email', 'mailpoet') . ' *<br /><strong>' . htmlspecialchars($subscriber->email) . '</strong></label>';
$form_html .= '<br /><span style="font-size:85%;">';
// special case for WP users as they cannot edit their subscriber's email
if ($subscriber->isWPUser() || $subscriber->isWooCommerceUser()) {
@ -442,7 +442,7 @@ class Pages {
private function getUnsubscribeContent() {
$content = '';
if ($this->isPreview() || $this->subscriber !== false) {
$content .= '<p>'.__('Accidentally unsubscribed?', 'mailpoet').' <strong>';
$content .= '<p>' . __('Accidentally unsubscribed?', 'mailpoet') . ' <strong>';
$content .= '[mailpoet_manage]';
$content .= '</strong></p>';
}
@ -459,8 +459,8 @@ class Pages {
: WPFunctions::get()->__('Manage your subscription', 'mailpoet')
);
return '<a href="'.Url::getManageUrl(
return '<a href="' . Url::getManageUrl(
$this->subscriber ?: null
).'">'.$text.'</a>';
) . '">' . $text . '</a>';
}
}

View File

@ -33,7 +33,7 @@ class Registration {
id="mailpoet_subscribe_on_register"
value="1"
name="mailpoet[subscribe_on_register]"
/>&nbsp;'.esc_attr($label).'
/>&nbsp;' . esc_attr($label) . '
</label>
</p>';
}

View File

@ -43,17 +43,17 @@ class Url {
$params = [
Router::NAME,
'endpoint='.SubscriptionEndpoint::ENDPOINT,
'action='.$action,
'data='.Router::encodeRequestData($data),
'endpoint=' . SubscriptionEndpoint::ENDPOINT,
'action=' . $action,
'data=' . Router::encodeRequestData($data),
];
// add parameters
$url .= (parse_url($url, PHP_URL_QUERY) ? '&' : '?').join('&', $params);
$url .= (parse_url($url, PHP_URL_QUERY) ? '&' : '?') . join('&', $params);
$url_params = parse_url($url);
if (empty($url_params['scheme'])) {
$url = WPFunctions::get()->getBloginfo('url').$url;
$url = WPFunctions::get()->getBloginfo('url') . $url;
}
return $url;

View File

@ -49,7 +49,7 @@ class I18n extends AbstractExtension {
$output[] = '<script type="text/javascript">';
foreach ($translations as $key => $translation) {
$output[] =
'MailPoet.I18n.add("'.$key.'", "'. str_replace('"', '\"', $translation) . '");';
'MailPoet.I18n.add("' . $key . '", "' . str_replace('"', '\"', $translation) . '");';
}
$output[] = '</script>';
return join("\n", $output);

View File

@ -34,7 +34,7 @@ class Engine
}
public function executeOne($check, $val, $params=[]) {
$callback = __NAMESPACE__ .'\Engine::'.$check;
$callback = __NAMESPACE__ . '\Engine::' . $check;
if (is_callable($callback)) {
return call_user_func($callback, $val, $params);
}

View File

@ -70,10 +70,10 @@ class XLSXWriter
@unlink($filename);//if the zip already exists, overwrite it
$zip = new \ZipArchive();
if (empty($this->sheets)) { self::log("Error in ".__CLASS__."::".__FUNCTION__.", no worksheets defined.");
if (empty($this->sheets)) { self::log("Error in " . __CLASS__ . "::" . __FUNCTION__ . ", no worksheets defined.");
return;
}
if (!$zip->open($filename, \ZipArchive::CREATE)) { self::log("Error in ".__CLASS__."::".__FUNCTION__.", unable to create zip.");
if (!$zip->open($filename, \ZipArchive::CREATE)) { self::log("Error in " . __CLASS__ . "::" . __FUNCTION__ . ", unable to create zip.");
return;
}
@ -86,7 +86,7 @@ class XLSXWriter
$zip->addEmptyDir("xl/worksheets/");
foreach ($this->sheets as $sheet) {
$zip->addFile($sheet->filename, "xl/worksheets/".$sheet->xmlname );
$zip->addFile($sheet->filename, "xl/worksheets/" . $sheet->xmlname );
}
if (!empty($this->shared_strings)) {
$zip->addFile($this->writeSharedStringsXML(), "xl/sharedStrings.xml" ); //$zip->addFromString("xl/sharedStrings.xml", self::buildSharedStringsXML() );
@ -106,7 +106,7 @@ class XLSXWriter
return;
$sheet_filename = $this->tempFilename();
$sheet_xmlname = 'sheet' . (count($this->sheets) + 1).".xml";
$sheet_xmlname = 'sheet' . (count($this->sheets) + 1) . ".xml";
$this->sheets[$sheet_name] = (object)[
'filename' => $sheet_filename,
'sheetname' => $sheet_name,
@ -223,26 +223,26 @@ class XLSXWriter
$s = isset($styles[$cell_format]) ? $styles[$cell_format] : '0';
if (!is_scalar($value) || $value == '') { //objects, array, empty
$file->write('<c r="'.$cell.'" s="'.$s.'"/>');
$file->write('<c r="' . $cell . '" s="' . $s . '"/>');
} elseif ($cell_format == 'date') {
$file->write('<c r="'.$cell.'" s="'.$s.'" t="n"><v>'.intval(self::convert_date_time($value)).'</v></c>');
$file->write('<c r="' . $cell . '" s="' . $s . '" t="n"><v>' . intval(self::convert_date_time($value)) . '</v></c>');
} elseif ($cell_format == 'datetime') {
$file->write('<c r="'.$cell.'" s="'.$s.'" t="n"><v>'.self::convert_date_time($value).'</v></c>');
$file->write('<c r="' . $cell . '" s="' . $s . '" t="n"><v>' . self::convert_date_time($value) . '</v></c>');
} elseif (!is_string($value)) {
$file->write('<c r="'.$cell.'" s="'.$s.'" t="n"><v>'.($value * 1).'</v></c>');//int,float, etc
$file->write('<c r="' . $cell . '" s="' . $s . '" t="n"><v>' . ($value * 1) . '</v></c>');//int,float, etc
} elseif ($value{0} != '0' && filter_var($value, FILTER_VALIDATE_INT)){ //excel wants to trim leading zeros
$file->write('<c r="'.$cell.'" s="'.$s.'" t="n"><v>'.($value).'</v></c>');//numeric string
$file->write('<c r="' . $cell . '" s="' . $s . '" t="n"><v>' . ($value) . '</v></c>');//numeric string
} elseif ($value{0} == '='){
$file->write('<c r="'.$cell.'" s="'.$s.'" t="s"><f>'.self::xmlspecialchars($value).'</f></c>');
$file->write('<c r="' . $cell . '" s="' . $s . '" t="s"><f>' . self::xmlspecialchars($value) . '</f></c>');
} elseif ($value !== ''){
$file->write('<c r="'.$cell.'" s="'.$s.'" t="s"><v>'.self::xmlspecialchars($this->setSharedString($value)).'</v></c>');
$file->write('<c r="' . $cell . '" s="' . $s . '" t="s"><v>' . self::xmlspecialchars($this->setSharedString($value)) . '</v></c>');
}
}
protected function writeStylesXML() {
$temporary_filename = $this->tempFilename();
$file = new XLSXWriter_BuffererWriter($temporary_filename);
$file->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n");
$file->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n");
$file->write('<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">');
$file->write('<numFmts count="4">');
$file->write( '<numFmt formatCode="GENERAL" numFmtId="164"/>');
@ -319,11 +319,11 @@ class XLSXWriter
protected function writeSharedStringsXML() {
$temporary_filename = $this->tempFilename();
$file = new XLSXWriter_BuffererWriter($temporary_filename, $fd_flags = 'w', $check_utf8 = true);
$file->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n");
$file->write('<sst count="'.($this->shared_string_count).'" uniqueCount="'.count($this->shared_strings).'" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">');
$file->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n");
$file->write('<sst count="' . ($this->shared_string_count) . '" uniqueCount="' . count($this->shared_strings) . '" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">');
foreach ($this->shared_strings as $s => $c)
{
$file->write('<si><t>'.self::xmlspecialchars($s).'</t></si>');
$file->write('<si><t>' . self::xmlspecialchars($s) . '</t></si>');
}
$file->write('</sst>');
$file->close();
@ -333,17 +333,17 @@ class XLSXWriter
protected function buildAppXML() {
$app_xml = "";
$app_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n";
$app_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
$app_xml .= '<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><TotalTime>0</TotalTime></Properties>';
return $app_xml;
}
protected function buildCoreXML() {
$core_xml = "";
$core_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n";
$core_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
$core_xml .= '<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
$core_xml .= '<dcterms:created xsi:type="dcterms:W3CDTF">'.date("Y-m-d\TH:i:s.00\Z").'</dcterms:created>';//$date_time = '2014-10-25T15:54:37.00Z';
$core_xml .= '<dc:creator>'.self::xmlspecialchars($this->author).'</dc:creator>';
$core_xml .= '<dcterms:created xsi:type="dcterms:W3CDTF">' . date("Y-m-d\TH:i:s.00\Z") . '</dcterms:created>';//$date_time = '2014-10-25T15:54:37.00Z';
$core_xml .= '<dc:creator>' . self::xmlspecialchars($this->author) . '</dc:creator>';
$core_xml .= '<cp:revision>0</cp:revision>';
$core_xml .= '</cp:coreProperties>';
return $core_xml;
@ -351,7 +351,7 @@ class XLSXWriter
protected function buildRelationshipsXML() {
$rels_xml = "";
$rels_xml .= '<?xml version="1.0" encoding="UTF-8"?>'."\n";
$rels_xml .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$rels_xml .= '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">';
$rels_xml .= '<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>';
$rels_xml .= '<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>';
@ -364,13 +364,13 @@ class XLSXWriter
protected function buildWorkbookXML() {
$i = 0;
$workbook_xml = "";
$workbook_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n";
$workbook_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
$workbook_xml .= '<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">';
$workbook_xml .= '<fileVersion appName="Calc"/><workbookPr backupFile="false" showObjects="all" date1904="false"/><workbookProtection/>';
$workbook_xml .= '<bookViews><workbookView activeTab="0" firstSheet="0" showHorizontalScroll="true" showSheetTabs="true" showVerticalScroll="true" tabRatio="212" windowHeight="8192" windowWidth="16384" xWindow="0" yWindow="0"/></bookViews>';
$workbook_xml .= '<sheets>';
foreach ($this->sheets as $sheet_name => $sheet) {
$workbook_xml .= '<sheet name="'.self::xmlspecialchars($sheet->sheetname).'" sheetId="'.($i + 1).'" state="visible" r:id="rId'.($i + 2).'"/>';
$workbook_xml .= '<sheet name="' . self::xmlspecialchars($sheet->sheetname) . '" sheetId="' . ($i + 1) . '" state="visible" r:id="rId' . ($i + 2) . '"/>';
$i++;
}
$workbook_xml .= '</sheets>';
@ -381,15 +381,15 @@ class XLSXWriter
protected function buildWorkbookRelsXML() {
$i = 0;
$wkbkrels_xml = "";
$wkbkrels_xml .= '<?xml version="1.0" encoding="UTF-8"?>'."\n";
$wkbkrels_xml .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$wkbkrels_xml .= '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">';
$wkbkrels_xml .= '<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>';
foreach ($this->sheets as $sheet_name => $sheet) {
$wkbkrels_xml .= '<Relationship Id="rId'.($i + 2).'" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/'.($sheet->xmlname).'"/>';
$wkbkrels_xml .= '<Relationship Id="rId' . ($i + 2) . '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/' . ($sheet->xmlname) . '"/>';
$i++;
}
if (!empty($this->shared_strings)) {
$wkbkrels_xml .= '<Relationship Id="rId'.(count($this->sheets) + 2).'" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>';
$wkbkrels_xml .= '<Relationship Id="rId' . (count($this->sheets) + 2) . '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>';
}
$wkbkrels_xml .= "\n";
$wkbkrels_xml .= '</Relationships>';
@ -398,12 +398,12 @@ class XLSXWriter
protected function buildContentTypesXML() {
$content_types_xml = "";
$content_types_xml .= '<?xml version="1.0" encoding="UTF-8"?>'."\n";
$content_types_xml .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$content_types_xml .= '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">';
$content_types_xml .= '<Override PartName="/_rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>';
$content_types_xml .= '<Override PartName="/xl/_rels/workbook.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>';
foreach ($this->sheets as $sheet_name => $sheet) {
$content_types_xml .= '<Override PartName="/xl/worksheets/'.($sheet->xmlname).'" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>';
$content_types_xml .= '<Override PartName="/xl/worksheets/' . ($sheet->xmlname) . '" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>';
}
if (!empty($this->shared_strings)) {
$content_types_xml .= '<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>';
@ -432,7 +432,7 @@ class XLSXWriter
}
//------------------------------------------------------------------
public static function log($string) {
file_put_contents("php://stderr", date("Y-m-d H:i:s:").rtrim(is_array($string) ? json_encode($string) : $string)."\n");
file_put_contents("php://stderr", date("Y-m-d H:i:s:") . rtrim(is_array($string) ? json_encode($string) : $string) . "\n");
}
//------------------------------------------------------------------
public static function sanitize_filename($filename) {

View File

@ -28,6 +28,12 @@
<!-- Only short array syntax is allowed -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
<property name="spacing" value="1" />
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true" />

View File

@ -787,9 +787,9 @@ class NewslettersTest extends \MailPoetTest {
expect($subscriber)->equals($subscriber);
expect($extra_params['unsubscribe_url'])->equals(home_url());
// system links are replaced with hashes
expect($newsletter['body']['html'])->contains('href="'.$viewInBrowserLink.'">View in browser');
expect($newsletter['body']['html'])->contains('href="'.$unsubscribeLink.'">Unsubscribe');
expect($newsletter['body']['html'])->contains('href="'.$manageLink.'">Manage subscription');
expect($newsletter['body']['html'])->contains('href="' . $viewInBrowserLink . '">View in browser');
expect($newsletter['body']['html'])->contains('href="' . $unsubscribeLink . '">Unsubscribe');
expect($newsletter['body']['html'])->contains('href="' . $manageLink . '">Manage subscription');
return ['response' => true];
},
]

View File

@ -26,31 +26,31 @@ class EnvTest extends \MailPoetTest {
Env::init('file', '1.0.0', 'localhost', 'db_user', 'pass123', 'db_name');
expect(Env::$db_host)->equals('localhost');
expect(Env::$db_port)->equals('3306');
expect(Env::$db_source_name)->equals('mysql:host=localhost;port=3306;dbname=db_name;charset='. ENV::$db_charset);
expect(Env::$db_source_name)->equals('mysql:host=localhost;port=3306;dbname=db_name;charset=' . ENV::$db_charset);
Env::init('file', '1.0.0', 'localhost:3307', 'db_user', 'pass123', 'db_name');
expect(Env::$db_host)->equals('localhost');
expect(Env::$db_port)->equals('3307');
expect(Env::$db_source_name)->equals('mysql:host=localhost;port=3307;dbname=db_name;charset='. ENV::$db_charset);
expect(Env::$db_source_name)->equals('mysql:host=localhost;port=3307;dbname=db_name;charset=' . ENV::$db_charset);
}
function testItProcessDBHostWithSocket() {
Env::init('file', '1.0.0', 'localhost:/var/lib/mysql/mysql55.sock', 'db_user', 'pass123', 'db_name');
expect(Env::$db_host)->equals('localhost');
expect(Env::$db_socket)->equals('/var/lib/mysql/mysql55.sock');
expect(Env::$db_source_name)->equals('mysql:host=localhost;port=3306;dbname=db_name;unix_socket=/var/lib/mysql/mysql55.sock;charset='. ENV::$db_charset);
expect(Env::$db_source_name)->equals('mysql:host=localhost;port=3306;dbname=db_name;unix_socket=/var/lib/mysql/mysql55.sock;charset=' . ENV::$db_charset);
}
function testItProcessDBHostWithIpV6Address() {
Env::init('file', '1.0.0', '::1', 'db_user', 'pass123', 'db_name');
expect(Env::$db_host)->equals('::1');
expect(Env::$db_socket)->equals(null);
expect(Env::$db_source_name)->equals('mysql:host=[::1];port=3306;dbname=db_name;charset='. ENV::$db_charset);
expect(Env::$db_source_name)->equals('mysql:host=[::1];port=3306;dbname=db_name;charset=' . ENV::$db_charset);
Env::init('file', '1.0.0', 'b57e:9b70:ab96:6a0b:5ba2:49e3:ebba:a036', 'db_user', 'pass123', 'db_name');
expect(Env::$db_host)->equals('b57e:9b70:ab96:6a0b:5ba2:49e3:ebba:a036');
expect(Env::$db_socket)->equals(null);
expect(Env::$db_source_name)->equals('mysql:host=[b57e:9b70:ab96:6a0b:5ba2:49e3:ebba:a036];port=3306;dbname=db_name;charset='. ENV::$db_charset);
expect(Env::$db_source_name)->equals('mysql:host=[b57e:9b70:ab96:6a0b:5ba2:49e3:ebba:a036];port=3306;dbname=db_name;charset=' . ENV::$db_charset);
}
function testItCanReturnDbName() {

View File

@ -99,8 +99,8 @@ class BeaconTest extends \MailPoetTest {
function testItReturnsSendingMethodDetails() {
$mta = $this->settings->get('mta');
expect($this->beacon_data['Sending Method'])->equals($mta['method']);
expect($this->beacon_data['Sending Frequency'])->contains($mta['frequency']['emails'].' emails');
expect($this->beacon_data['Sending Frequency'])->contains($mta['frequency']['interval'].' minutes');
expect($this->beacon_data['Sending Frequency'])->contains($mta['frequency']['emails'] . ' emails');
expect($this->beacon_data['Sending Frequency'])->contains($mta['frequency']['interval'] . ' minutes');
}
function testItReturnsSomeSettings() {

View File

@ -315,13 +315,13 @@ class SubscriberTest extends \MailPoetTest {
$subscriber_with_custom_field = Subscriber::createOrUpdate([
'email' => 'user.with.cf@mailpoet.com',
'cf_'.$custom_field->id => 'Paris',
'cf_'.$custom_field_2->id => [
'cf_' . $custom_field->id => 'Paris',
'cf_' . $custom_field_2->id => [
'day' => 9,
'month' => 3,
'year' => 1984,
], // date as array value
'cf_'.$custom_field_3->id => '2013-07', // date as string value
'cf_' . $custom_field_3->id => '2013-07', // date as string value
]);
$subscriber = Subscriber::findOne($subscriber_with_custom_field->id)
@ -329,11 +329,11 @@ class SubscriberTest extends \MailPoetTest {
expect($subscriber->id)->equals($subscriber_with_custom_field->id);
expect($subscriber->email)->equals('user.with.cf@mailpoet.com');
expect($subscriber->{'cf_'.$custom_field->id})->equals('Paris');
expect($subscriber->{'cf_' . $custom_field->id})->equals('Paris');
// date specified as array gets converted to string
expect($subscriber->{'cf_'.$custom_field_2->id})->equals('1984-03-09 00:00:00');
expect($subscriber->{'cf_' . $custom_field_2->id})->equals('1984-03-09 00:00:00');
// date specified as string is stored as is
expect($subscriber->{'cf_'.$custom_field_3->id})->equals('2013-07');
expect($subscriber->{'cf_' . $custom_field_3->id})->equals('2013-07');
}
function testItShouldUnsubscribeFromAllSegments() {
@ -459,7 +459,7 @@ class SubscriberTest extends \MailPoetTest {
$subscriber = $subscriber->withCustomFields()->asArray();
expect($subscriber['cf_'.$custom_field->id()])->equals(
expect($subscriber['cf_' . $custom_field->id()])->equals(
mktime(0, 0, 0, $value['month'], $value['day'], $value['year'])
);
}

View File

@ -283,7 +283,7 @@ class RendererTest extends \MailPoetTest {
];
$rendered_image = Image::render($image, self::COLUMN_BASE_WIDTH);
$site_url = get_option('siteurl');
expect($rendered_image)->contains('src="'.$site_url.'/relative-path"');
expect($rendered_image)->contains('src="' . $site_url . '/relative-path"');
$image = [
'src' => '//path-without-protocol',

View File

@ -14,8 +14,8 @@ class DOMTest extends \MailPoetUnitTest {
DOMUtil::splitOn($this->root, $this->root->query('a')->offsetGet(0));
expect($this->root->html())->equals(
'<p><i>italic</i><em>previous text</em></p>'.
'<a href="#mylink"><img src="#myimage" /></a>'.
'<p><i>italic</i><em>previous text</em></p>' .
'<a href="#mylink"><img src="#myimage" /></a>' .
'<p><em>next text</em><b>bolded</b></p>'
);
}

View File

@ -32,7 +32,7 @@ class PQueryTest extends \MailPoetUnitTest {
$html_numbers = array_merge(range(40, 126), range(160, 255), [32, 33, 35, 36, 37, 38, 338, 339, 352, 353, 376, 402, 8211, 8212, 8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8364, 8482]);
foreach ($html_numbers as $char) {
$this->parseTest('&#'.$char.';', $equals = false);
$this->parseTest('&#' . $char . ';', $equals = false);
}
}