Add rule for operator spacing

[MAILPOET-2090]
This commit is contained in:
Pavel Dohnal
2019-05-20 13:57:13 +02:00
committed by M. Shull
parent 5da7110eb6
commit 12ff88ee21
39 changed files with 167 additions and 162 deletions

View File

@ -95,7 +95,7 @@ class API {
} }
function setRequestData($data) { function setRequestData($data) {
$this->_request_api_version = !empty($data['api_version']) ? $data['api_version']: false; $this->_request_api_version = !empty($data['api_version']) ? $data['api_version'] : false;
$this->_request_endpoint = isset($data['endpoint']) $this->_request_endpoint = isset($data['endpoint'])
? Helpers::underscoreToCamelCase(trim($data['endpoint'])) ? Helpers::underscoreToCamelCase(trim($data['endpoint']))

View File

@ -50,7 +50,7 @@ class Reporter {
'users_can_register' => WPFunctions::get()->getOption('users_can_register') ? 'yes' : 'no', 'users_can_register' => WPFunctions::get()->getOption('users_can_register') ? 'yes' : 'no',
'MailPoet Free version' => MAILPOET_VERSION, 'MailPoet Free version' => MAILPOET_VERSION,
'MailPoet Premium version' => (defined('MAILPOET_PREMIUM_VERSION')) ? MAILPOET_PREMIUM_VERSION : 'N/A', 'MailPoet Premium version' => (defined('MAILPOET_PREMIUM_VERSION')) ? MAILPOET_PREMIUM_VERSION : 'N/A',
'Total number of subscribers' => Subscriber::getTotalSubscribers(), 'Total number of subscribers' => Subscriber::getTotalSubscribers(),
'Sending Method' => isset($mta['method']) ? $mta['method'] : null, 'Sending Method' => isset($mta['method']) ? $mta['method'] : null,
'Date of plugin installation' => $this->settings->get('installed_at'), 'Date of plugin installation' => $this->settings->get('installed_at'),
'Subscribe in comments' => (boolean)$this->settings->get('subscribe.on_comment.enabled', false), 'Subscribe in comments' => (boolean)$this->settings->get('subscribe.on_comment.enabled', false),

View File

@ -1077,7 +1077,7 @@ class MP2Migrator {
$sending_emails_number = isset($options['sending_emails_number']) ? $options['sending_emails_number'] : ''; $sending_emails_number = isset($options['sending_emails_number']) ? $options['sending_emails_number'] : '';
$sending_emails_each = isset($options['sending_emails_each']) ? $options['sending_emails_each'] : ''; $sending_emails_each = isset($options['sending_emails_each']) ? $options['sending_emails_each'] : '';
$mta['frequency']['emails'] = $this->mapFrequencyEmails($sending_emails_number, $sending_emails_each); $mta['frequency']['emails'] = $this->mapFrequencyEmails($sending_emails_number, $sending_emails_each);
$mta['frequency']['interval'] = $this->mapFrequencyInterval($sending_emails_each); $mta['frequency']['interval'] = $this->mapFrequencyInterval($sending_emails_each);
$mta['host'] = isset($options['smtp_host']) ? $options['smtp_host'] : ''; $mta['host'] = isset($options['smtp_host']) ? $options['smtp_host'] : '';
$mta['port'] = isset($options['smtp_port']) ? $options['smtp_port'] : ''; $mta['port'] = isset($options['smtp_port']) ? $options['smtp_port'] : '';
$mta['login'] = isset($options['smtp_login']) ? $options['smtp_login'] : ''; $mta['login'] = isset($options['smtp_login']) ? $options['smtp_login'] : '';

View File

@ -655,9 +655,9 @@ class Menu {
$data['segments'] = $segments; $data['segments'] = $segments;
$data['settings'] = $this->settings->getAll(); $data['settings'] = $this->settings->getAll();
$data['mss_active'] = Bridge::isMPSendingServiceEnabled(); $data['mss_active'] = Bridge::isMPSendingServiceEnabled();
$data['current_wp_user'] = $this->wp->wpGetCurrentUser()->to_array(); $data['current_wp_user'] = $this->wp->wpGetCurrentUser()->to_array();
$data['current_wp_user_firstname'] = $this->wp->wpGetCurrentUser()->user_firstname; $data['current_wp_user_firstname'] = $this->wp->wpGetCurrentUser()->user_firstname;
$data['site_url'] = $this->wp->siteUrl(); $data['site_url'] = $this->wp->siteUrl();
$data['roles'] = $wp_roles->get_names(); $data['roles'] = $wp_roles->get_names();
$data['roles']['mailpoet_all'] = $this->wp->__('In any WordPress role', 'mailpoet'); $data['roles']['mailpoet_all'] = $this->wp->__('In any WordPress role', 'mailpoet');
@ -673,7 +673,7 @@ class Menu {
24 24
); );
$data['mailpoet_main_page'] = $this->wp->adminUrl('admin.php?page=' . self::MAIN_PAGE_SLUG); $data['mailpoet_main_page'] = $this->wp->adminUrl('admin.php?page=' . self::MAIN_PAGE_SLUG);
$data['show_congratulate_after_first_newsletter'] = isset($data['settings']['show_congratulate_after_first_newsletter'])?$data['settings']['show_congratulate_after_first_newsletter']:'false'; $data['show_congratulate_after_first_newsletter'] = isset($data['settings']['show_congratulate_after_first_newsletter']) ? $data['settings']['show_congratulate_after_first_newsletter'] : 'false';
$data['tracking_enabled'] = $this->settings->get('tracking.enabled'); $data['tracking_enabled'] = $this->settings->get('tracking.enabled');
$data['premium_plugin_active'] = License::getLicense(); $data['premium_plugin_active'] = License::getLicense();

View File

@ -153,7 +153,7 @@ class Migrator {
} }
function scheduledTaskSubscribers() { function scheduledTaskSubscribers() {
$attributes = [ $attributes = [
'task_id int(11) unsigned NOT NULL,', 'task_id int(11) unsigned NOT NULL,',
'subscriber_id int(11) unsigned NOT NULL,', 'subscriber_id int(11) unsigned NOT NULL,',
'processed int(1) NOT NULL,', 'processed int(1) NOT NULL,',

View File

@ -226,7 +226,7 @@ class Populator {
$sender = $this->settings->fetch('sender', []); $sender = $this->settings->fetch('sender', []);
$this->settings->set('subscriber_email_notification', [ $this->settings->set('subscriber_email_notification', [
'enabled' => true, 'enabled' => true,
'address' => isset($sender['address'])? $sender['address'] : null, 'address' => isset($sender['address']) ? $sender['address'] : null,
]); ]);
} }
@ -235,7 +235,7 @@ class Populator {
$sender = $this->settings->fetch('sender', []); $sender = $this->settings->fetch('sender', []);
$this->settings->set('stats_notifications', [ $this->settings->set('stats_notifications', [
'enabled' => true, 'enabled' => true,
'address' => isset($sender['address'])? $sender['address'] : null, 'address' => isset($sender['address']) ? $sender['address'] : null,
]); ]);
} }

View File

@ -711,7 +711,7 @@ class Charity {
'type' => 'socialIcon', 'type' => 'socialIcon',
'iconType' => 'facebook', 'iconType' => 'facebook',
'link' => 'http://www.facebook.com', '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', 'height' => '32px',
'width' => '32px', 'width' => '32px',
'text' => 'Facebook', 'text' => 'Facebook',
@ -721,7 +721,7 @@ class Charity {
'type' => 'socialIcon', 'type' => 'socialIcon',
'iconType' => 'twitter', 'iconType' => 'twitter',
'link' => 'http://www.twitter.com', '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', 'height' => '32px',
'width' => '32px', 'width' => '32px',
'text' => 'Twitter', 'text' => 'Twitter',
@ -731,7 +731,7 @@ class Charity {
'type' => 'socialIcon', 'type' => 'socialIcon',
'iconType' => 'instagram', 'iconType' => 'instagram',
'link' => 'http://instagram.com', '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', 'height' => '32px',
'width' => '32px', 'width' => '32px',
'text' => 'Instagram', 'text' => 'Instagram',
@ -1080,7 +1080,7 @@ class Charity {
'type' => 'socialIcon', 'type' => 'socialIcon',
'iconType' => 'facebook', 'iconType' => 'facebook',
'link' => 'http://www.facebook.com', 'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/01-social/Facebook.png', 'image' => $this->social_icon_url . '/01-social/Facebook.png',
'height' => '32px', 'height' => '32px',
'width' => '32px', 'width' => '32px',
'text' => 'Facebook', 'text' => 'Facebook',
@ -1090,7 +1090,7 @@ class Charity {
'type' => 'socialIcon', 'type' => 'socialIcon',
'iconType' => 'twitter', 'iconType' => 'twitter',
'link' => 'http://www.twitter.com', 'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/01-social/Twitter.png', 'image' => $this->social_icon_url . '/01-social/Twitter.png',
'height' => '32px', 'height' => '32px',
'width' => '32px', 'width' => '32px',
'text' => 'Twitter', 'text' => 'Twitter',

View File

@ -86,7 +86,7 @@ class PieceOfCake {
2 => [ 2 => [
'type' => 'image', 'type' => 'image',
'link' => '', 'link' => '',
'src' => $this->template_image_url . '/Restaurant-Bakery-Logo-1.png', 'src' => $this->template_image_url . '/Restaurant-Bakery-Logo-1.png',
'alt' => 'Restaurant-Bakery-Logo-1', 'alt' => 'Restaurant-Bakery-Logo-1',
'fullWidth' => true, 'fullWidth' => true,
'width' => '1280px', 'width' => '1280px',
@ -109,7 +109,7 @@ class PieceOfCake {
4 => [ 4 => [
'type' => 'image', 'type' => 'image',
'link' => '', 'link' => '',
'src' => $this->template_image_url . '/Restaurant-Bakery-Header.jpg', 'src' => $this->template_image_url . '/Restaurant-Bakery-Header.jpg',
'alt' => 'Restaurant-Bakery-Header', 'alt' => 'Restaurant-Bakery-Header',
'fullWidth' => true, 'fullWidth' => true,
'width' => '1280px', 'width' => '1280px',

View File

@ -121,7 +121,7 @@ class Worker {
$clicked = ($newsletter->statistics['clicked'] * 100) / $newsletter->total_sent; $clicked = ($newsletter->statistics['clicked'] * 100) / $newsletter->total_sent;
$opened = ($newsletter->statistics['opened'] * 100) / $newsletter->total_sent; $opened = ($newsletter->statistics['opened'] * 100) / $newsletter->total_sent;
$unsubscribed = ($newsletter->statistics['unsubscribed'] * 100) / $newsletter->total_sent; $unsubscribed = ($newsletter->statistics['unsubscribed'] * 100) / $newsletter->total_sent;
$context = [ $context = [
'subject' => $newsletter->subject, 'subject' => $newsletter->subject,
'preheader' => sprintf(_x( 'preheader' => sprintf(_x(
'%1$s%% opens, %2$s%% clicks, %3$s%% unsubscribes in a nutshell.', 'newsletter open rate, click rate and unsubscribe rate', 'mailpoet'), '%1$s%% opens, %2$s%% clicks, %3$s%% unsubscribes in a nutshell.', 'newsletter open rate, click rate and unsubscribe rate', 'mailpoet'),

View File

@ -57,7 +57,7 @@ class Beacon {
'Default FROM address' => $settings->get('sender.address'), 'Default FROM address' => $settings->get('sender.address'),
'Default Reply-To address' => $settings->get('reply_to.address'), 'Default Reply-To address' => $settings->get('reply_to.address'),
'Bounce Email Address' => $settings->get('bounce.address'), 'Bounce Email Address' => $settings->get('bounce.address'),
'Total number of subscribers' => Subscriber::getTotalSubscribers(), 'Total number of subscribers' => Subscriber::getTotalSubscribers(),
'Plugin installed at' => $settings->get('installed_at'), 'Plugin installed at' => $settings->get('installed_at'),
]; ];
} }

View File

@ -93,9 +93,9 @@ class MailerError {
$message .= $this->message ? ' ' : ''; $message .= $this->message ? ' ' : '';
if (count($this->subscribers_errors) === 1) { if (count($this->subscribers_errors) === 1) {
$message .= WPFunctions::get()->__('Unprocessed subscriber:', 'mailpoet') . ' '; $message .= WPFunctions::get()->__('Unprocessed subscriber:', 'mailpoet') . ' ';
} else { } else {
$message .= WPFunctions::get()->__('Unprocessed subscribers:', 'mailpoet') . ' '; $message .= WPFunctions::get()->__('Unprocessed subscribers:', 'mailpoet') . ' ';
} }
$message .= implode( $message .= implode(

View File

@ -107,7 +107,7 @@ class AmazonSES {
]) ])
->setSender($this->sender['from_email']) ->setSender($this->sender['from_email'])
->setReplyTo([ ->setReplyTo([
$this->reply_to['reply_to_email'] => $this->reply_to['reply_to_name'], $this->reply_to['reply_to_email'] => $this->reply_to['reply_to_name'],
]) ])
->setReturnPath($this->return_path) ->setReturnPath($this->return_path)
->setSubject($newsletter['subject']); ->setSubject($newsletter['subject']);

View File

@ -48,7 +48,7 @@ class MailPoet {
} }
function processSendError($result, $subscriber, $newsletter) { function processSendError($result, $subscriber, $newsletter) {
if (!empty($result['code']) && $result['code'] === API::RESPONSE_CODE_KEY_INVALID) { if (!empty($result['code']) && $result['code'] === API::RESPONSE_CODE_KEY_INVALID) {
Bridge::invalidateKey(); Bridge::invalidateKey();
} }
return $this->error_mapper->getErrorForResult($result, $subscriber, $this->sender, $newsletter); return $this->error_mapper->getErrorForResult($result, $subscriber, $this->sender, $newsletter);

View File

@ -56,7 +56,7 @@ class PostContentManager {
'<a>', '<ul>', '<ol>', '<li>', '<br>', '<blockquote>', '<a>', '<ul>', '<ol>', '<li>', '<br>', '<blockquote>',
]; ];
if ($display_type === 'full') { if ($display_type === 'full') {
$tags_not_being_stripped = array_merge($tags_not_being_stripped, ['<figure>', '<img>', '<h1>', '<h2>', '<h3>']); $tags_not_being_stripped = array_merge($tags_not_being_stripped, ['<figure>', '<img>', '<h1>', '<h2>', '<h3>']);
} }
$content = strip_tags($content, implode('', $tags_not_being_stripped)); $content = strip_tags($content, implode('', $tags_not_being_stripped));

View File

@ -32,7 +32,7 @@ class Renderer {
function render($data) { function render($data) {
$column_count = count($data['blocks']); $column_count = count($data['blocks']);
$columns_layout = isset($data['columnLayout'])?$data['columnLayout']:null; $columns_layout = isset($data['columnLayout']) ? $data['columnLayout'] : null;
$column_widths = ColumnsHelper::columnWidth($column_count, $columns_layout); $column_widths = ColumnsHelper::columnWidth($column_count, $columns_layout);
$column_content = []; $column_content = [];

View File

@ -103,7 +103,7 @@ class Text {
if (!preg_match('/text-align/i', $style)) { if (!preg_match('/text-align/i', $style)) {
$style = 'text-align: left;' . $style; $style = 'text-align: left;' . $style;
} }
$contents = str_replace('&', '&amp;', $paragraph->html()); $contents = str_replace('&', '&amp;', $paragraph->html());
$paragraph->setTag('table'); $paragraph->setTag('table');
$paragraph->style = 'border-spacing:0;mso-table-lspace:0;mso-table-rspace:0;'; $paragraph->style = 'border-spacing:0;mso-table-lspace:0;mso-table-rspace:0;';
$paragraph->width = '100%'; $paragraph->width = '100%';

View File

@ -18,7 +18,7 @@ class Renderer {
private function renderOneColumn($content_block, $content) { private function renderOneColumn($content_block, $content) {
$template = $this->getOneColumnTemplate( $template = $this->getOneColumnTemplate(
$content_block['styles']['block'], $content_block['styles']['block'],
isset($content_block['image'])?$content_block['image']:null isset($content_block['image']) ? $content_block['image'] : null
); );
return $template['content_start'] . $content . $template['content_end']; return $template['content_start'] . $content . $template['content_end'];
} }
@ -48,19 +48,19 @@ class Renderer {
private function renderMultipleColumns($content_block, $columns_data) { private function renderMultipleColumns($content_block, $columns_data) {
$columns_count = count($content_block['blocks']); $columns_count = count($content_block['blocks']);
$columns_layout = isset($content_block['columnLayout'])?$content_block['columnLayout']:null; $columns_layout = isset($content_block['columnLayout']) ? $content_block['columnLayout'] : null;
$widths = ColumnsHelper::columnWidth($columns_count, $columns_layout); $widths = ColumnsHelper::columnWidth($columns_count, $columns_layout);
$class = ColumnsHelper::columnClass($columns_count); $class = ColumnsHelper::columnClass($columns_count);
$alignment = ColumnsHelper::columnAlignment($columns_count); $alignment = ColumnsHelper::columnAlignment($columns_count);
$index = 0; $index = 0;
$result = $this->getMultipleColumnsContainerStart($class, $content_block['styles']['block'], isset($content_block['image'])?$content_block['image']:null); $result = $this->getMultipleColumnsContainerStart($class, $content_block['styles']['block'], isset($content_block['image']) ? $content_block['image'] : null);
foreach ($columns_data as $content) { foreach ($columns_data as $content) {
$result .= $this->getMultipleColumnsContentStart($widths[$index++], $alignment, $class); $result .= $this->getMultipleColumnsContentStart($widths[$index++], $alignment, $class);
$result .= $content; $result .= $content;
$result .= $this->getMultipleColumnsContentEnd(); $result .= $this->getMultipleColumnsContentEnd();
} }
$result .= $this->getMultipleColumnsContainerEnd(); $result .= $this->getMultipleColumnsContainerEnd();
return $result; return $result;
} }

View File

@ -24,7 +24,7 @@ class DefaultSubscribersGetter extends SubscribersGetter {
} }
protected function filter($subscribers) { protected function filter($subscribers) {
$subscribers = $subscribers $subscribers = $subscribers
->selectMany( ->selectMany(
[ [
'list_status' => SubscriberSegment::$_table . '.status', 'list_status' => SubscriberSegment::$_table . '.status',

View File

@ -208,8 +208,8 @@ class CSS {
$i++; $i++;
} }
$queries .= substr($css, $start-1, $i+1-$start) . "\n"; $queries .= substr($css, $start - 1, $i + 1 - $start) . "\n";
$css = substr($css, 0, $start-1) . substr($css, $i); $css = substr($css, 0, $start - 1) . substr($css, $i);
$i = $start; $i = $start;
} }
} }

View File

@ -13,10 +13,10 @@ class XLSXWriter
{ {
//------------------------------------------------------------------ //------------------------------------------------------------------
//http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010073849.aspx //http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010073849.aspx
const EXCEL_2007_MAX_ROW=1048576; const EXCEL_2007_MAX_ROW = 1048576;
const EXCEL_2007_MAX_COL=16384; const EXCEL_2007_MAX_COL = 16384;
//------------------------------------------------------------------ //------------------------------------------------------------------
protected $author ='MailPoet'; protected $author = 'MailPoet';
protected $sheets = []; protected $sheets = [];
protected $shared_strings = [];//unique set protected $shared_strings = [];//unique set
protected $shared_string_count = 0;//count of non-unique references to the unique set protected $shared_string_count = 0;//count of non-unique references to the unique set
@ -33,7 +33,7 @@ class XLSXWriter
} }
public function setAuthor($author='') { public function setAuthor($author='') {
$this->author=$author; $this->author = $author;
} }
public function __destruct() { public function __destruct() {
@ -102,7 +102,7 @@ class XLSXWriter
protected function initializeSheet($sheet_name) { protected function initializeSheet($sheet_name) {
//if already initialized //if already initialized
if ($this->current_sheet==$sheet_name || isset($this->sheets[$sheet_name])) if ($this->current_sheet == $sheet_name || isset($this->sheets[$sheet_name]))
return; return;
$sheet_filename = $this->tempFilename(); $sheet_filename = $this->tempFilename();
@ -120,7 +120,7 @@ class XLSXWriter
]; ];
$sheet = &$this->sheets[$sheet_name]; $sheet = &$this->sheets[$sheet_name];
$tabselected = count($this->sheets) == 1 ? 'true' : 'false';//only first sheet is selected $tabselected = count($this->sheets) == 1 ? 'true' : 'false';//only first sheet is selected
$max_cell=XLSXWriter::xlsCell(self::EXCEL_2007_MAX_ROW, self::EXCEL_2007_MAX_COL);//XFE1048577 $max_cell = XLSXWriter::xlsCell(self::EXCEL_2007_MAX_ROW, self::EXCEL_2007_MAX_COL);//XFE1048577
$sheet->file_writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n"); $sheet->file_writer->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n");
$sheet->file_writer->write('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'); $sheet->file_writer->write('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">');
$sheet->file_writer->write( '<sheetPr filterMode="false">'); $sheet->file_writer->write( '<sheetPr filterMode="false">');
@ -200,7 +200,7 @@ class XLSXWriter
$sheet->file_writer->fseek($sheet->max_cell_tag_start); $sheet->file_writer->fseek($sheet->max_cell_tag_start);
$sheet->file_writer->write($max_cell_tag . str_repeat(" ", (int)$padding_length)); $sheet->file_writer->write($max_cell_tag . str_repeat(" ", (int)$padding_length));
$sheet->file_writer->close(); $sheet->file_writer->close();
$sheet->finalized=true; $sheet->finalized = true;
} }
public function writeSheet(array $data, $sheet_name='', array $header_types=[] ) { public function writeSheet(array $data, $sheet_name='', array $header_types=[] ) {
@ -218,23 +218,23 @@ class XLSXWriter
} }
protected function writeCell(XLSXWriter_BuffererWriter &$file, $row_number, $column_number, $value, $cell_format) { protected function writeCell(XLSXWriter_BuffererWriter &$file, $row_number, $column_number, $value, $cell_format) {
static $styles = ['money'=>1,'dollar'=>1,'datetime'=>2,'date'=>3,'string'=>0]; static $styles = ['money' => 1,'dollar' => 1,'datetime' => 2,'date' => 3,'string' => 0];
$cell = self::xlsCell($row_number, $column_number); $cell = self::xlsCell($row_number, $column_number);
$s = isset($styles[$cell_format]) ? $styles[$cell_format] : '0'; $s = isset($styles[$cell_format]) ? $styles[$cell_format] : '0';
if (!is_scalar($value) || $value=='') { //objects, array, empty 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') { } 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') { } 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)) { } 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 } 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}=='='){ } 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!==''){ } 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>');
} }
} }
@ -332,88 +332,88 @@ class XLSXWriter
} }
protected function buildAppXML() { protected function buildAppXML() {
$app_xml=""; $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>'; $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; return $app_xml;
} }
protected function buildCoreXML() { protected function buildCoreXML() {
$core_xml=""; $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 .= '<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 .= '<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 .= '<dc:creator>'.self::xmlspecialchars($this->author).'</dc:creator>';
$core_xml.='<cp:revision>0</cp:revision>'; $core_xml .= '<cp:revision>0</cp:revision>';
$core_xml.='</cp:coreProperties>'; $core_xml .= '</cp:coreProperties>';
return $core_xml; return $core_xml;
} }
protected function buildRelationshipsXML() { protected function buildRelationshipsXML() {
$rels_xml=""; $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 .= '<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="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"/>'; $rels_xml .= '<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>';
$rels_xml.='<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>'; $rels_xml .= '<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>';
$rels_xml.="\n"; $rels_xml .= "\n";
$rels_xml.='</Relationships>'; $rels_xml .= '</Relationships>';
return $rels_xml; return $rels_xml;
} }
protected function buildWorkbookXML() { protected function buildWorkbookXML() {
$i=0; $i = 0;
$workbook_xml=""; $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 .= '<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 .= '<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 .= '<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>'; $workbook_xml .= '<sheets>';
foreach ($this->sheets as $sheet_name => $sheet) { 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++; $i++;
} }
$workbook_xml.='</sheets>'; $workbook_xml .= '</sheets>';
$workbook_xml.='<calcPr iterateCount="100" refMode="A1" iterate="false" iterateDelta="0.001"/></workbook>'; $workbook_xml .= '<calcPr iterateCount="100" refMode="A1" iterate="false" iterateDelta="0.001"/></workbook>';
return $workbook_xml; return $workbook_xml;
} }
protected function buildWorkbookRelsXML() { protected function buildWorkbookRelsXML() {
$i=0; $i = 0;
$wkbkrels_xml=""; $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 .= '<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"/>'; $wkbkrels_xml .= '<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>';
foreach ($this->sheets as $sheet_name => $sheet) { 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++; $i++;
} }
if (!empty($this->shared_strings)) { 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 .= "\n";
$wkbkrels_xml.='</Relationships>'; $wkbkrels_xml .= '</Relationships>';
return $wkbkrels_xml; return $wkbkrels_xml;
} }
protected function buildContentTypesXML() { protected function buildContentTypesXML() {
$content_types_xml=""; $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 .= '<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="/_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"/>'; $content_types_xml .= '<Override PartName="/xl/_rels/workbook.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>';
foreach ($this->sheets as $sheet_name => $sheet) { 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)) { if (!empty($this->shared_strings)) {
$content_types_xml.='<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>'; $content_types_xml .= '<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>';
} }
$content_types_xml.='<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>'; $content_types_xml .= '<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>';
$content_types_xml.='<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>'; $content_types_xml .= '<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>';
$content_types_xml.='<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>'; $content_types_xml .= '<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>';
$content_types_xml.='<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>'; $content_types_xml .= '<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>';
$content_types_xml.="\n"; $content_types_xml .= "\n";
$content_types_xml.='</Types>'; $content_types_xml .= '</Types>';
return $content_types_xml; return $content_types_xml;
} }
@ -426,9 +426,9 @@ class XLSXWriter
public static function xlsCell($row_number, $column_number) { public static function xlsCell($row_number, $column_number) {
$n = $column_number; $n = $column_number;
for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) { for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) {
$r = chr($n%26 + 0x41) . $r; $r = chr($n % 26 + 0x41) . $r;
} }
return $r . ($row_number+1); return $r . ($row_number + 1);
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public static function log($string) { public static function log($string) {
@ -457,8 +457,8 @@ class XLSXWriter
//thanks to Excel::Writer::XLSX::Worksheet.pm (perl) //thanks to Excel::Writer::XLSX::Worksheet.pm (perl)
$days = 0; # Number of days since epoch $days = 0; # Number of days since epoch
$seconds = 0; # Time expressed as fraction of 24h hours in seconds $seconds = 0; # Time expressed as fraction of 24h hours in seconds
$year=$month=$day=0; $year = $month = $day = 0;
$hour=$min =$sec=0; $hour = $min = $sec = 0;
$date_time = $date_input; $date_time = $date_input;
if (preg_match("/(\d{4})\-(\d{2})\-(\d{2})/", $date_time, $matches)) if (preg_match("/(\d{4})\-(\d{2})\-(\d{2})/", $date_time, $matches))
@ -474,9 +474,9 @@ class XLSXWriter
//using 1900 as epoch, not 1904, ignoring 1904 special case //using 1900 as epoch, not 1904, ignoring 1904 special case
# Special cases for Excel. # Special cases for Excel.
if ("$year-$month-$day"=='1899-12-31') return $seconds ; # Excel 1900 epoch if ("$year-$month-$day" == '1899-12-31') return $seconds ; # Excel 1900 epoch
if ("$year-$month-$day"=='1900-01-00') return $seconds ; # Excel 1900 epoch if ("$year-$month-$day" == '1900-01-00') return $seconds ; # Excel 1900 epoch
if ("$year-$month-$day"=='1900-02-29') return 60 + $seconds ; # Excel false leapday if ("$year-$month-$day" == '1900-02-29') return 60 + $seconds ; # Excel false leapday
# We calculate the date by calculating the number of days since the epoch # We calculate the date by calculating the number of days since the epoch
# and adjust for the number of leap days. We calculate the number of leap # and adjust for the number of leap days. We calculate the number of leap
@ -498,7 +498,7 @@ class XLSXWriter
# Accumulate the number of days since the epoch. # Accumulate the number of days since the epoch.
$days = $day; # Add days for current month $days = $day; # Add days for current month
$days += array_sum( array_slice($mdays, 0, $month-1 ) ); # Add days for past months $days += array_sum( array_slice($mdays, 0, $month - 1 ) ); # Add days for past months
$days += $range * 365; # Add days for past years $days += $range * 365; # Add days for past years
$days += intval( ( $range ) / 4 ); # Add leapdays $days += intval( ( $range ) / 4 ); # Add leapdays
$days -= intval( ( $range + $offset ) / 100 ); # Subtract 100 year leapdays $days -= intval( ( $range + $offset ) / 100 ); # Subtract 100 year leapdays
@ -516,20 +516,20 @@ class XLSXWriter
class XLSXWriter_BuffererWriter class XLSXWriter_BuffererWriter
{ {
protected $fd=null; protected $fd = null;
protected $buffer=''; protected $buffer = '';
protected $check_utf8=false; protected $check_utf8 = false;
public function __construct($filename, $fd_fopen_flags='w', $check_utf8=false) { public function __construct($filename, $fd_fopen_flags='w', $check_utf8=false) {
$this->check_utf8 = $check_utf8; $this->check_utf8 = $check_utf8;
$this->fd = fopen($filename, $fd_fopen_flags); $this->fd = fopen($filename, $fd_fopen_flags);
if ($this->fd===false) { if ($this->fd === false) {
XLSXWriter::log("Unable to open $filename for writing."); XLSXWriter::log("Unable to open $filename for writing.");
} }
} }
public function write($string) { public function write($string) {
$this->buffer.=$string; $this->buffer .= $string;
if (isset($this->buffer[8191])) { if (isset($this->buffer[8191])) {
$this->purge(); $this->purge();
} }
@ -542,7 +542,7 @@ class XLSXWriter_BuffererWriter
$this->check_utf8 = false; $this->check_utf8 = false;
} }
fwrite($this->fd, $this->buffer); fwrite($this->fd, $this->buffer);
$this->buffer=''; $this->buffer = '';
} }
} }
@ -550,7 +550,7 @@ class XLSXWriter_BuffererWriter
$this->purge(); $this->purge();
if ($this->fd) { if ($this->fd) {
fclose($this->fd); fclose($this->fd);
$this->fd=null; $this->fd = null;
} }
} }

View File

@ -28,6 +28,11 @@
<!-- Only short array syntax is allowed --> <!-- Only short array syntax is allowed -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<!-- Disallow usage of BOMs --> <!-- Disallow usage of BOMs -->
<rule ref="Generic.Files.ByteOrderMark"/> <rule ref="Generic.Files.ByteOrderMark"/>
<!-- Lines can be 80 chars long, show errors at 120 chars --> <!-- Lines can be 80 chars long, show errors at 120 chars -->

View File

@ -21,7 +21,7 @@ class ExportSubscribersCest {
$I->login(); $I->login();
$I->amOnMailPoetPage('Subscribers'); $I->amOnMailPoetPage('Subscribers');
//export those users //export those users
$I->click(['xpath'=>'//*[@id="mailpoet_export_button"]']); $I->click(['xpath' => '//*[@id="mailpoet_export_button"]']);
//choose new list //choose new list
$I->selectOptionInSelect2($segment_name); $I->selectOptionInSelect2($segment_name);
//export //export

View File

@ -35,7 +35,7 @@ class ManageSubscriptionLinkCest {
$I->click($first_template_element); $I->click($first_template_element);
// step 3 - design newsletter (update subject) // step 3 - design newsletter (update subject)
$title_element ='[data-automation-id="newsletter_title"]'; $title_element = '[data-automation-id="newsletter_title"]';
$I->waitForElement($title_element); $I->waitForElement($title_element);
$I->fillField($title_element, $this->newsletter_title); $I->fillField($title_element, $this->newsletter_title);
$I->click('Next'); $I->click('Next');

View File

@ -60,7 +60,7 @@ class SettingsPageBasicsCest {
$I->waitForText($post_title); $I->waitForText($post_title);
$I->click($post_title); $I->click($post_title);
$I->scrollTo('.comment-form-mailpoet'); $I->scrollTo('.comment-form-mailpoet');
$I->waitForElement(['css'=>'.comment-form-mailpoet']); $I->waitForElement(['css' => '.comment-form-mailpoet']);
//clear checkbox to hide Select2 from next test //clear checkbox to hide Select2 from next test
$I->amOnMailPoetPage('Settings'); $I->amOnMailPoetPage('Settings');
$I->uncheckOption('#settings[subscribe_on_comment]'); $I->uncheckOption('#settings[subscribe_on_comment]');

View File

@ -12,12 +12,12 @@ class SettingsSubscriptionPageCest {
} }
function createNewSubscriptionPage(\AcceptanceTester $I) { function createNewSubscriptionPage(\AcceptanceTester $I) {
$I->wantTo('Make a custom subscription page'); $I->wantTo('Make a custom subscription page');
$page_title='CustomSubscriptionPage'; $page_title = 'CustomSubscriptionPage';
$page_content='[mailpoet_manage_subscription]'; $page_content = '[mailpoet_manage_subscription]';
$I->login(); $I->login();
$I->amOnMailPoetPage('Settings'); $I->amOnMailPoetPage('Settings');
$I->cli('post create --allow-root --post_type=page --post_title=' . $page_title . '--post_content=' . $page_content); $I->cli('post create --allow-root --post_type=page --post_title=' . $page_title . '--post_content=' . $page_content);
$I->click(['css'=>'#subscription_manage_page.mailpoet_page_selection']); $I->click(['css' => '#subscription_manage_page.mailpoet_page_selection']);
$I->checkOption('select#subscription_manage_page', $page_title); $I->checkOption('select#subscription_manage_page', $page_title);
$I->click('[data-automation-id="preview_manage_subscription_page_link"]'); $I->click('[data-automation-id="preview_manage_subscription_page_link"]');
$I->waitForText('Manage your subscription'); $I->waitForText('Manage your subscription');

View File

@ -9,7 +9,7 @@ class SettingsUnsubscribePageCest {
$I->amOnMailPoetPage('Settings'); $I->amOnMailPoetPage('Settings');
$I->click('[data-automation-id="unsubscribe_page_preview_link"]'); $I->click('[data-automation-id="unsubscribe_page_preview_link"]');
$I->switchToNextTab(); $I->switchToNextTab();
$I->waitForElement(['css'=>'.entry-title']); $I->waitForElement(['css' => '.entry-title']);
} }
} }

View File

@ -23,7 +23,7 @@ class SubscribeOnRegistrationPageCest {
$I->click('[data-automation-id="settings-submit-button"]'); $I->click('[data-automation-id="settings-submit-button"]');
$I->logOut(); $I->logOut();
$I->amOnPage('/wp-login.php?action=register'); $I->amOnPage('/wp-login.php?action=register');
$I->waitForElement(['css'=>'.registration-form-mailpoet']); $I->waitForElement(['css' => '.registration-form-mailpoet']);
if (!getenv('MULTISITE')) { if (!getenv('MULTISITE')) {
$I->fillField(['name' => 'user_login'], 'registerpagesignup'); $I->fillField(['name' => 'user_login'], 'registerpagesignup');
$I->fillField(['name' => 'user_email'], $regpageuseremail); $I->fillField(['name' => 'user_email'], $regpageuseremail);
@ -33,7 +33,7 @@ class SubscribeOnRegistrationPageCest {
} else { } else {
$I->fillField(['name' => 'user_name'], 'muregisterpagesignup'); $I->fillField(['name' => 'user_name'], 'muregisterpagesignup');
$I->fillField(['name' => 'user_email'], $regpageuseremail); $I->fillField(['name' => 'user_email'], $regpageuseremail);
$I->scrollTo(['css' =>'#mailpoet_subscribe_on_register']); $I->scrollTo(['css' => '#mailpoet_subscribe_on_register']);
$I->checkOption('#mailpoet_subscribe_on_register'); $I->checkOption('#mailpoet_subscribe_on_register');
$I->click('Next'); $I->click('Next');
$I->waitForText('muregisterpagesignup is your new username'); $I->waitForText('muregisterpagesignup is your new username');

View File

@ -54,7 +54,7 @@ class SubscriberManageImportExportCest {
// trigger dropdown to display selections // trigger dropdown to display selections
$I->click('input.select2-search__field'); $I->click('input.select2-search__field');
// choose first list // choose first list
$I->click(['xpath'=>'//*[@id="select2-mailpoet_segments_select-results"]/li[1]']); $I->click(['xpath' => '//*[@id="select2-mailpoet_segments_select-results"]/li[1]']);
$I->click('#step_data_manipulation [data-automation-id="import-next-step"]'); $I->click('#step_data_manipulation [data-automation-id="import-next-step"]');
$I->waitForText('Import again'); $I->waitForText('Import again');
} }

View File

@ -68,7 +68,7 @@ class SubscriberManagementCest {
$I->wantTo('Add a user to global subscribers list'); $I->wantTo('Add a user to global subscribers list');
$I->login(); $I->login();
$I->amOnMailPoetPage ('Subscribers'); $I->amOnMailPoetPage ('Subscribers');
$I->click(['xpath'=>'//*[@id="subscribers_container"]/div/h1/a[1]']); $I->click(['xpath' => '//*[@id="subscribers_container"]/div/h1/a[1]']);
$I->fillField(['name' => 'email'], 'newglobaluser99@fakemail.fake'); $I->fillField(['name' => 'email'], 'newglobaluser99@fakemail.fake');
$I->fillField(['name' => 'first_name'], 'New'); $I->fillField(['name' => 'first_name'], 'New');
$I->fillField(['name' => 'last_name'], 'GlobalUser'); $I->fillField(['name' => 'last_name'], 'GlobalUser');

View File

@ -248,7 +248,7 @@ class SubscribersTest extends \MailPoetTest {
} }
function testItCanSearchListing() { function testItCanSearchListing() {
$new_subscriber = Subscriber::createOrUpdate([ $new_subscriber = Subscriber::createOrUpdate([
'email' => 'search.me@find.me', 'email' => 'search.me@find.me',
'first_name' => 'Billy Bob', 'first_name' => 'Billy Bob',
'last_name' => 'Thornton', 'last_name' => 'Thornton',
@ -376,7 +376,7 @@ class SubscribersTest extends \MailPoetTest {
} }
function testItCanBulkDeleteSelectionOfSubscribers() { function testItCanBulkDeleteSelectionOfSubscribers() {
$deletable_subscriber = Subscriber::createOrUpdate([ $deletable_subscriber = Subscriber::createOrUpdate([
'email' => 'to.be.removed@mailpoet.com', 'email' => 'to.be.removed@mailpoet.com',
]); ]);

View File

@ -429,7 +429,7 @@ class APITest extends \MailPoetTest {
\MailPoet\API\MP\v1\API::class, \MailPoet\API\MP\v1\API::class,
'addSubscriber', 'addSubscriber',
[ [
'new_subscriber_notification_mailer'=> Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']), 'new_subscriber_notification_mailer' => Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']),
'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), 'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']),
'_scheduleWelcomeNotification' => Expected::once(), '_scheduleWelcomeNotification' => Expected::once(),
], $this); ], $this);
@ -471,7 +471,7 @@ class APITest extends \MailPoetTest {
'addSubscriber', 'addSubscriber',
[ [
'_scheduleWelcomeNotification' => Expected::never(), '_scheduleWelcomeNotification' => Expected::never(),
'new_subscriber_notification_mailer'=> Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']), 'new_subscriber_notification_mailer' => Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']),
'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), 'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']),
], $this); ], $this);
$subscriber = [ $subscriber = [
@ -487,7 +487,7 @@ class APITest extends \MailPoetTest {
'addSubscriber', 'addSubscriber',
[ [
'_scheduleWelcomeNotification' => Expected::never(), '_scheduleWelcomeNotification' => Expected::never(),
'new_subscriber_notification_mailer'=> Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']), 'new_subscriber_notification_mailer' => Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']),
'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), 'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']),
], $this); ], $this);
$subscriber = [ $subscriber = [
@ -509,7 +509,7 @@ class APITest extends \MailPoetTest {
expect($options['send_confirmation_email'])->equals(true); expect($options['send_confirmation_email'])->equals(true);
}), }),
'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), 'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']),
'new_subscriber_notification_mailer'=> Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']), 'new_subscriber_notification_mailer' => Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']),
] ]
); );
$subscriber = [ $subscriber = [
@ -551,7 +551,7 @@ class APITest extends \MailPoetTest {
[ [
'__sendConfirmationEmail' => Expected::never(), '__sendConfirmationEmail' => Expected::never(),
'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), 'required_custom_field_validator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']),
'new_subscriber_notification_mailer'=> Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']), 'new_subscriber_notification_mailer' => Stub::makeEmpty(NewSubscriberNotificationMailer::class, ['send']),
], $this); ], $this);
$subscriber = [ $subscriber = [
'email' => 'test@example.com', 'email' => 'test@example.com',

View File

@ -677,7 +677,7 @@ class MP2MigratorTest extends \MailPoetTest {
* *
*/ */
private function loadMP2OptionsFixtures() { private function loadMP2OptionsFixtures() {
$wysija_options = [ $wysija_options = [
'from_name' => 'Sender', 'from_name' => 'Sender',
'replyto_name' => 'Reply', 'replyto_name' => 'Reply',
'emails_notified' => 'notification@email.com', 'emails_notified' => 'notification@email.com',

View File

@ -10,7 +10,7 @@ class ExportFilesCleanupTest extends \MailPoetTest {
$wp_upload_dir = wp_upload_dir(); $wp_upload_dir = wp_upload_dir();
$old_file_path = $wp_upload_dir['basedir'] . '/mailpoet/MailPoet_export_old_file.csv'; $old_file_path = $wp_upload_dir['basedir'] . '/mailpoet/MailPoet_export_old_file.csv';
$new_file_path = $wp_upload_dir['basedir'] . '/mailpoet/MailPoet_export_new_file.csv'; $new_file_path = $wp_upload_dir['basedir'] . '/mailpoet/MailPoet_export_new_file.csv';
touch($old_file_path, time() - (60 * 60 * 24 * 7)); touch($old_file_path, time() - (60 * 60 * 24 * 7));
touch($new_file_path); touch($new_file_path);
$cleanup = new ExportFilesCleanup(); $cleanup = new ExportFilesCleanup();

View File

@ -304,7 +304,7 @@ class NewsletterTest extends \MailPoetTest {
} }
function testItGetsSegments() { function testItGetsSegments() {
for ($i = 1; $i<=3; $i++) { for ($i = 1; $i <= 3; $i++) {
$newsletter_segment = NewsletterSegment::create(); $newsletter_segment = NewsletterSegment::create();
$newsletter_segment->newsletter_id = $this->newsletter->id; $newsletter_segment->newsletter_id = $this->newsletter->id;
$newsletter_segment->segment_id = $i; $newsletter_segment->segment_id = $i;

View File

@ -31,7 +31,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldAddImageAboveTitleForExcerptWithoutLayout() { function testShouldAddImageAboveTitleForExcerptWithoutLayout() {
$args = [ $args = [
'withLayout' => false, 'withLayout' => false,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'aboveTitle', 'featuredImagePosition' => 'aboveTitle',
@ -43,7 +43,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldAddImageBelowTitleForExcerptWithoutLayout() { function testShouldAddImageBelowTitleForExcerptWithoutLayout() {
$args = [ $args = [
'withLayout' => false, 'withLayout' => false,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'belowTitle', 'featuredImagePosition' => 'belowTitle',
@ -55,7 +55,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldTransformContentWithoutLayoutWhenImageIsMissing() { function testShouldTransformContentWithoutLayoutWhenImageIsMissing() {
$args = [ $args = [
'withLayout' => false, 'withLayout' => false,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'belowTitle', 'featuredImagePosition' => 'belowTitle',
@ -67,7 +67,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldNotAddImageForTitleOnlyWhenImageIsPresentWithoutLayout() { function testShouldNotAddImageForTitleOnlyWhenImageIsPresentWithoutLayout() {
$args = [ $args = [
'withLayout' => false, 'withLayout' => false,
'displayType' => 'titleOnly', 'displayType' => 'titleOnly',
'featuredImagePosition' => 'aboveTitle', 'featuredImagePosition' => 'aboveTitle',
@ -79,7 +79,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldPrependTitleTextToContentTextIfFirstContentBlockIsTextual() { function testShouldPrependTitleTextToContentTextIfFirstContentBlockIsTextual() {
$args = [ $args = [
'withLayout' => false, 'withLayout' => false,
'displayType' => 'titleOnly', 'displayType' => 'titleOnly',
'featuredImagePosition' => 'aboveTitle', 'featuredImagePosition' => 'aboveTitle',
@ -95,7 +95,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldCreateLayoutStructureForCenteredImageWithLayout() { function testShouldCreateLayoutStructureForCenteredImageWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'centered', 'featuredImagePosition' => 'centered',
@ -116,7 +116,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldCreateLayoutStructureForCenteredImageWithLayoutWithTitleAboveExcerpt() { function testShouldCreateLayoutStructureForCenteredImageWithLayoutWithTitleAboveExcerpt() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'centered', 'featuredImagePosition' => 'centered',
@ -133,7 +133,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldCreateLayoutStructureForOtherThanCenteredPositionedImageWithLayout() { function testShouldCreateLayoutStructureForOtherThanCenteredPositionedImageWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'alternate', 'featuredImagePosition' => 'alternate',
@ -152,7 +152,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldAddCenteredImageForExcerptWithLayout() { function testShouldAddCenteredImageForExcerptWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'centered', 'featuredImagePosition' => 'centered',
@ -164,7 +164,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldHandleOldStructureImagePositionValueAndAddImageForExcerptWithLayout() { function testShouldHandleOldStructureImagePositionValueAndAddImageForExcerptWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'aboveTitle', 'featuredImagePosition' => 'aboveTitle',
@ -176,7 +176,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldAddLeftPositionedImageForExcerptWithLayout() { function testShouldAddLeftPositionedImageForExcerptWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'left', 'featuredImagePosition' => 'left',
@ -190,7 +190,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldAddLeftPositionedImageForExcerptWithTitleAboveExcerpt() { function testShouldAddLeftPositionedImageForExcerptWithTitleAboveExcerpt() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'left', 'featuredImagePosition' => 'left',
@ -205,7 +205,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldAddRightPositionedImageForExcerptWithLayout() { function testShouldAddRightPositionedImageForExcerptWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'right', 'featuredImagePosition' => 'right',
@ -219,7 +219,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldNotAddImageForTitleOnlyWithLayout() { function testShouldNotAddImageForTitleOnlyWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'titleOnly', 'displayType' => 'titleOnly',
'featuredImagePosition' => 'centered', 'featuredImagePosition' => 'centered',
@ -231,7 +231,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldAddClassToParagraphsInFullPostsWithLayout() { function testShouldAddClassToParagraphsInFullPostsWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'full', 'displayType' => 'full',
'featuredImagePosition' => 'right', 'featuredImagePosition' => 'right',
@ -249,7 +249,7 @@ class PostContentTransformerTest extends \MailPoetTest {
} }
function testShouldNotAddClassToParagraphsInExcerptWithLayout() { function testShouldNotAddClassToParagraphsInExcerptWithLayout() {
$args = [ $args = [
'withLayout' => true, 'withLayout' => true,
'displayType' => 'excerpt', 'displayType' => 'excerpt',
'featuredImagePosition' => 'right', 'featuredImagePosition' => 'right',

View File

@ -57,7 +57,7 @@ class BulkActionTest extends \MailPoetTest {
function testBulkActionForDefaultSegment() { function testBulkActionForDefaultSegment() {
$handler = new BulkAction([ $handler = new BulkAction([
'listing' => ['filter'=> ['segment' => $this->segment_1->id]], 'listing' => ['filter' => ['segment' => $this->segment_1->id]],
'action' => 'trash', 'action' => 'trash',
]); ]);
$result = $handler->apply(); $result = $handler->apply();
@ -66,7 +66,7 @@ class BulkActionTest extends \MailPoetTest {
function testBulkActionForUnknownSegment() { function testBulkActionForUnknownSegment() {
$handler = new BulkAction([ $handler = new BulkAction([
'listing' => ['filter'=> ['segment' => 'this-segment-doesnt-exist']], 'listing' => ['filter' => ['segment' => 'this-segment-doesnt-exist']],
'action' => 'trash', 'action' => 'trash',
]); ]);
$result = $handler->apply(); $result = $handler->apply();
@ -75,7 +75,7 @@ class BulkActionTest extends \MailPoetTest {
function testForUnknownSegmentTypeWithoutHandler() { function testForUnknownSegmentTypeWithoutHandler() {
$handler = new BulkAction([ $handler = new BulkAction([
'listing' => ['filter'=> ['segment' => $this->segment_2->id]], 'listing' => ['filter' => ['segment' => $this->segment_2->id]],
'action' => 'trash', 'action' => 'trash',
]); ]);
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
@ -96,7 +96,7 @@ class BulkActionTest extends \MailPoetTest {
}); });
$handler = new BulkAction([ $handler = new BulkAction([
'listing' => ['filter'=> ['segment' => $this->segment_2->id]], 'listing' => ['filter' => ['segment' => $this->segment_2->id]],
'action' => 'trash', 'action' => 'trash',
]); ]);
$result = $handler->apply(); $result = $handler->apply();

View File

@ -60,12 +60,12 @@ class SubscribersListingsTest extends \MailPoetTest {
} }
function testGetListingsForDefaultSegment() { function testGetListingsForDefaultSegment() {
$listings = $this->finder->getListingsInSegment(['filter'=> ['segment' => $this->segment_1->id]]); $listings = $this->finder->getListingsInSegment(['filter' => ['segment' => $this->segment_1->id]]);
expect($listings['items'])->count(1); expect($listings['items'])->count(1);
} }
function testGetListingsForNonExistingSegmen() { function testGetListingsForNonExistingSegmen() {
$listings = $this->finder->getListingsInSegment(['filter'=> ['segment' => 'non-existing-id']]); $listings = $this->finder->getListingsInSegment(['filter' => ['segment' => 'non-existing-id']]);
expect($listings['items'])->notEmpty(); expect($listings['items'])->notEmpty();
} }
@ -81,14 +81,14 @@ class SubscribersListingsTest extends \MailPoetTest {
return [$mock]; return [$mock];
}); });
$listings = $this->finder->getListingsInSegment(['filter'=> ['segment' => $this->segment_2->id]]); $listings = $this->finder->getListingsInSegment(['filter' => ['segment' => $this->segment_2->id]]);
expect($listings)->equals('dynamic listings'); expect($listings)->equals('dynamic listings');
} }
function testTryToGetListingsForSegmentWithoutHandler() { function testTryToGetListingsForSegmentWithoutHandler() {
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
remove_all_filters('mailpoet_get_subscribers_listings_in_segment_handlers'); remove_all_filters('mailpoet_get_subscribers_listings_in_segment_handlers');
$this->finder->getListingsInSegment(['filter'=> ['segment' => $this->segment_2->id]]); $this->finder->getListingsInSegment(['filter' => ['segment' => $this->segment_2->id]]);
} }
} }

View File

@ -59,12 +59,12 @@ class SegmentsExporterTest extends \MailPoetTest {
expect($result)->internalType('array'); expect($result)->internalType('array');
expect($result)->hasKey('data'); expect($result)->hasKey('data');
expect($result)->hasKey('done'); expect($result)->hasKey('done');
$expected = [ $expected = [
[ [
'group_id' => 'mailpoet-lists', 'group_id' => 'mailpoet-lists',
'group_label' => 'MailPoet Mailing Lists', 'group_label' => 'MailPoet Mailing Lists',
'item_id' => 'list-' . $segment1->id(), 'item_id' => 'list-' . $segment1->id(),
'data' => [ 'data' => [
['name' => 'List name', 'value' => 'List 1'], ['name' => 'List name', 'value' => 'List 1'],
['name' => 'Subscription status', 'value' => 'subscribed'], ['name' => 'Subscription status', 'value' => 'subscribed'],
['name' => 'Timestamp of the subscription (or last change of the subscription status)', 'value' => '2018-05-02 15:26:52'], ['name' => 'Timestamp of the subscription (or last change of the subscription status)', 'value' => '2018-05-02 15:26:52'],
@ -74,7 +74,7 @@ class SegmentsExporterTest extends \MailPoetTest {
'group_id' => 'mailpoet-lists', 'group_id' => 'mailpoet-lists',
'group_label' => 'MailPoet Mailing Lists', 'group_label' => 'MailPoet Mailing Lists',
'item_id' => 'list-' . $segment2->id(), 'item_id' => 'list-' . $segment2->id(),
'data' => [ 'data' => [
['name' => 'List name', 'value' => 'List 2'], ['name' => 'List name', 'value' => 'List 2'],
['name' => 'Subscription status', 'value' => 'unsubscribed'], ['name' => 'Subscription status', 'value' => 'unsubscribed'],
['name' => 'Timestamp of the subscription (or last change of the subscription status)', 'value' => '2018-05-02 15:26:00'], ['name' => 'Timestamp of the subscription (or last change of the subscription status)', 'value' => '2018-05-02 15:26:00'],

View File

@ -20,7 +20,7 @@ class SendingTest extends \MailPoetTest {
]); ]);
$this->sending = $this->createNewSendingTask([ $this->sending = $this->createNewSendingTask([
'status' => null, 'status' => null,
'task' => $this->task, 'task' => $this->task,
'queue' => $this->queue, 'queue' => $this->queue,
]); ]);
} }