Add rule for operator spacing
[MAILPOET-2090]
This commit is contained in:
@@ -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']))
|
||||||
|
@@ -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();
|
||||||
|
@@ -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,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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 = [];
|
||||||
|
|
||||||
|
@@ -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,13 +48,13 @@ 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;
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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 -->
|
||||||
|
@@ -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
|
||||||
|
@@ -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');
|
||||||
|
@@ -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]');
|
||||||
|
@@ -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');
|
||||||
|
@@ -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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -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');
|
||||||
|
@@ -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');
|
||||||
}
|
}
|
||||||
|
@@ -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');
|
||||||
|
@@ -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',
|
||||||
|
@@ -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;
|
||||||
|
@@ -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();
|
||||||
|
@@ -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]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user