Compare commits

...

15 Commits

Author SHA1 Message Date
f7b1016e63 Release 3.0.0-rc.1.0.3 2017-08-15 11:35:44 +02:00
223fedba72 Update vendor dependencies
Bump down codeception version to 2.2.11 for code coverage compatibility
with php 5.6

[MAILPOET-1049]
2017-08-15 10:12:48 +02:00
bf7e7e414f Adds hook to modify rendered form widget 2017-08-15 09:49:38 +02:00
618d0c0c9d Explicitly sets form target to _self as default 2017-08-15 09:49:38 +02:00
70860a676c Merge pull request #1036 from mailpoet/date_shortcode_update
Translates and updates date shortcode to display WP time [MAILPOET-1046]
2017-08-14 13:09:08 +03:00
469e9fd8e1 Update poll to "how would you rate MailPoet's reliability?"
[MAILPOET-1043]
2017-08-14 08:49:44 +02:00
715b48df8d Merge pull request #1040 from mailpoet/preview-popup
Fit newsletter browser preview modal popup to screen [MAILPOET-975]
2017-08-13 11:31:05 -04:00
27ae0a9f16 Merge pull request #1039 from mailpoet/set_time_limit_update
Conditionally uses set_time_limit() when function is not disabled [MAILPOET-1054]
2017-08-11 19:52:15 +02:00
b92329a6b5 Fix popup dimensions to the viewport and show the close button 2017-08-11 17:30:13 +00:00
6fe5b7e0c5 Conditionally uses set_time_limit() when function is not disabled 2017-08-11 12:16:31 -04:00
7e0c500e4f Uses WP's date_i18n() to localize date shortcode 2017-08-10 12:46:27 -04:00
eec35c8ab6 Merge pull request #1037 from mailpoet/build-failures
Break the build when errors happen during build steps [MAILPOET-1052]
2017-08-10 16:35:55 +02:00
4096c4b31b Break the build when errors happen during build steps [MAILPOET-1052] 2017-08-10 14:51:37 +03:00
40cbefd1f4 Uses WP time vs. system time 2017-08-09 18:59:55 -04:00
fb5d43e975 Adds helper method to translate shortcodes
Adds translations to Date shortcode
2017-08-09 18:56:33 -04:00
21 changed files with 1343 additions and 994 deletions

View File

@ -45,7 +45,6 @@ body.mailpoet_modal_opened
position: absolute
z-index: 25
top: 48px
padding-bottom: 48px
margin: 0
.mailpoet_popup_wrapper
@ -54,6 +53,7 @@ body.mailpoet_modal_opened
position: relative
width: 100%
z-index: 0
height: 96%
.mailpoet_overlay_hidden .mailpoet_popup_wrapper
border: 1px solid #333
@ -75,6 +75,7 @@ body.mailpoet_modal_opened
.mailpoet_popup_body
padding: 10px 10px 10px 10px
height: 92%
// modal panel
#mailpoet_modal_overlay.mailpoet_panel_overlay

View File

@ -127,9 +127,6 @@ body
background-color: $primary-background-color
border: 1px solid $content-border-color
#mailpoet_modal_close
display: none
.wrap > .mailpoet_notice,
.notice
.update-nag

File diff suppressed because it is too large Load Diff

View File

@ -272,10 +272,13 @@ define([
});
var view = this.previewView.render();
this.previewView.$el.css('height', '100%');
MailPoet.Modal.popup({
template: '',
element: this.previewView.$el,
width: '95%',
height: '94%',
title: MailPoet.I18n.t('newsletterPreview'),
onCancel: function() {
this.previewView.destroy();
@ -340,8 +343,10 @@ define([
getTemplate: function() { return templates.newsletterPreview; },
initialize: function(options) {
this.previewUrl = options.previewUrl;
this.width = App.getConfig().get('newsletterPreview.width');
this.height = App.getConfig().get('newsletterPreview.height')
this.width = '100%';
this.height = '100%';
// this.width = App.getConfig().get('newsletterPreview.width');
// this.height = App.getConfig().get('newsletterPreview.height')
},
templateContext: function() {
return {

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -e
# Translations (npm install & composer install need to be run before)
echo '[BUILD] Generating translations'
@ -9,21 +9,22 @@ plugin_name='mailpoet'
# Remove previous build.
echo '[BUILD] Removing previous build'
rm $plugin_name.zip
test -e $plugin_name.zip && rm $plugin_name.zip
# Create temp dir.
echo '[BUILD] Creating temporary directory'
test -d $plugin_name && rm -rf $plugin_name
mkdir $plugin_name
# Production assets.
echo '[BUILD] Generating production CSS and JS assets'
rm -rf node_modules
test -d node_modules && rm -rf node_modules
npm install
./do compile:all --env production
# Production libraries.
echo '[BUILD] Fetching production libraries'
rm -rf vendor
test -d vendor && rm -rf vendor
./composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-scripts
# Copy release folders.

View File

@ -20,7 +20,7 @@
},
"require-dev": {
"codeception/aspect-mock": "^2.0",
"codeception/codeception": "^2.2.9",
"codeception/codeception": "2.2.11",
"codeception/verify": "^0.3.3",
"consolidation/robo": "^1.0.5",
"henrikbjorn/lurker": "^1.2",

838
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,21 +2,19 @@
namespace MailPoet\Config;
use MailPoet\Util\ProgressBar;
use MailPoet\Models\Form;
use MailPoet\Models\Setting;
use MailPoet\Models\Segment;
use MailPoet\Models\Subscriber;
use MailPoet\Models\CustomField;
use MailPoet\Models\SubscriberSegment;
use MailPoet\Models\SubscriberCustomField;
use MailPoet\Models\Form;
use MailPoet\Models\MappingToExternalEntities;
use MailPoet\Config\Activator;
use MailPoet\Models\Segment;
use MailPoet\Models\Setting;
use MailPoet\Models\Subscriber;
use MailPoet\Models\SubscriberCustomField;
use MailPoet\Models\SubscriberSegment;
use MailPoet\Util\ProgressBar;
if(!defined('ABSPATH')) exit;
class MP2Migrator {
const IMPORT_TIMEOUT_IN_SECONDS = 7200; // Timeout = 2 hours
const CHUNK_SIZE = 10; // To import the data by batch
@ -145,7 +143,9 @@ class MP2Migrator {
* @return string Result
*/
public function import() {
set_time_limit(self::IMPORT_TIMEOUT_IN_SECONDS);
if(strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
@set_time_limit(3600);
}
ob_start();
$datetime = new \MailPoet\WP\DateTime();
$this->log(sprintf('=== ' . __('START IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
@ -867,10 +867,10 @@ class MP2Migrator {
'type' => $type,
'name' => $field['name'],
'id' => $field_id,
'unique' => !in_array($field['type'], array('html', 'divider', 'email', 'submit'))? "1" : "0",
'static' => in_array($field_id, array('email', 'submit'))? "1" : "0",
'unique' => !in_array($field['type'], array('html', 'divider', 'email', 'submit')) ? "1" : "0",
'static' => in_array($field_id, array('email', 'submit')) ? "1" : "0",
'params' => $params,
'position' => isset($field['position'])? $field['position'] : '',
'position' => isset($field['position']) ? $field['position'] : '',
);
}
@ -956,7 +956,7 @@ class MP2Migrator {
/**
* Import the settings
*
*
*/
private function importSettings() {
$encoded_options = get_option('wysija');
@ -988,10 +988,10 @@ class MP2Migrator {
$subscribe = Setting::getValue('subscribe');
$subscribe['on_comment']['enabled'] = isset($options['commentform']) ? $options['commentform'] : '0';
$subscribe['on_comment']['label'] = isset($options['commentform_linkname']) ? $options['commentform_linkname'] : '';
$subscribe['on_comment']['segments'] = isset($options['commentform_lists'])? $this->getMappedSegmentIds($options['commentform_lists']) : array();
$subscribe['on_comment']['segments'] = isset($options['commentform_lists']) ? $this->getMappedSegmentIds($options['commentform_lists']) : array();
$subscribe['on_register']['enabled'] = isset($options['registerform']) ? $options['registerform'] : '0';
$subscribe['on_register']['label'] = isset($options['registerform_linkname']) ? $options['registerform_linkname'] : '';
$subscribe['on_register']['segments'] = isset($options['registerform_lists'])? $this->getMappedSegmentIds($options['registerform_lists']) : array();
$subscribe['on_register']['segments'] = isset($options['registerform_lists']) ? $this->getMappedSegmentIds($options['registerform_lists']) : array();
Setting::setValue('subscribe', $subscribe);
// Subscription
@ -999,7 +999,7 @@ class MP2Migrator {
$subscription['pages']['unsubscribe'] = isset($options['unsubscribe_page']) ? $options['unsubscribe_page'] : '';
$subscription['pages']['confirmation'] = isset($options['confirmation_page']) ? $options['confirmation_page'] : '';
$subscription['pages']['manage'] = isset($options['subscriptions_page']) ? $options['subscriptions_page'] : '';
$subscription['segments'] = isset($options['manage_subscriptions_lists'])? $this->getMappedSegmentIds($options['manage_subscriptions_lists']) : array();
$subscription['segments'] = isset($options['manage_subscriptions_lists']) ? $this->getMappedSegmentIds($options['manage_subscriptions_lists']) : array();
Setting::setValue('subscription', $subscription);
// Confirmation email
@ -1047,7 +1047,7 @@ class MP2Migrator {
if($mta['method'] == 'SendGrid') {
Setting::setValue('smtp_provider', 'SendGrid');
}
// Installation date
if(isset($options['installed_time'])) {
$datetime = new \MailPoet\WP\DateTime();
@ -1139,5 +1139,4 @@ class MP2Migrator {
}
return $emails_number;
}
}
}

View File

@ -1,10 +1,13 @@
<?php
namespace MailPoet\Form;
use MailPoet\API\JSON\API;
use MailPoet\Config\Renderer;
use MailPoet\Models\Form;
use MailPoet\Form\Renderer as FormRenderer;
use MailPoet\Models\Form;
use MailPoet\Util\Security;
use MailPoet\WP\Hooks;
if(!defined('ABSPATH')) exit;
@ -37,7 +40,7 @@ class Widget extends \WP_Widget {
$instance = wp_parse_args(
(array)$instance,
array(
'title' => __("Subscribe to Our Newsletter", 'mailpoet')
'title' => __('Subscribe to Our Newsletter', 'mailpoet')
)
);
@ -109,7 +112,7 @@ class Widget extends \WP_Widget {
$instance = $args;
}
$title = apply_filters(
$title = Hooks::applyFilters(
'widget_title',
!empty($instance['title']) ? $instance['title'] : '',
$instance,
@ -119,7 +122,7 @@ class Widget extends \WP_Widget {
// get form
$form = Form::getPublished()->findOne($instance['form']);
// if the form was not found, return nothing.
// if the form was not found, return nothing
if($form === false) {
return '';
} else {
@ -175,6 +178,7 @@ class Widget extends \WP_Widget {
try {
$output = $renderer->render('form/widget.html', $data);
$output = do_shortcode($output);
$output = Hooks::applyFilters('mailpoet_form_widget_post_process', $output);
} catch(\Exception $e) {
$output = $e->getMessage();
}

View File

@ -1,4 +1,5 @@
<?php
namespace MailPoet\Newsletter\Shortcodes\Categories;
class Date {
@ -7,20 +8,19 @@ class Date {
$action_argument = false,
$action_argument_value = false
) {
$date = new \DateTime('now');
$action_formats = array(
'd' => $date->format('d'),
'dordinal' => $date->format('dS'),
'dtext' => $date->format('l'),
'm' => $date->format('m'),
'mtext' => $date->format('F'),
'y' => $date->format('Y')
$action_mapping = array(
'd' => 'd',
'dordinal' => 'dS',
'dtext' => 'l',
'm' => 'm',
'mtext' => 'F',
'y' => 'Y'
);
if(!empty($action_formats[$action])) {
return $action_formats[$action];
if(!empty($action_mapping[$action])) {
return date_i18n($action_mapping[$action], current_time('timestamp'));
}
return ($action === 'custom' && $action_argument === 'format') ?
$date->format($action_argument_value) :
date_i18n($action_argument_value, current_time('timestamp')) :
false;
}
}

View File

@ -1,4 +1,5 @@
<?php
namespace MailPoet\Newsletter\Shortcodes;
use MailPoet\Models\CustomField;
@ -115,7 +116,7 @@ class ShortcodesHelper {
static function getCustomFields() {
$custom_fields = CustomField::findMany();
if(!$custom_fields) return false;
return array_map(function ($custom_field) {
return array_map(function($custom_field) {
return array(
'text' => $custom_field->name,
'shortcode' => '[subscriber:cf_' . $custom_field->id . ']'

View File

@ -1,4 +1,5 @@
<?php
namespace MailPoet\Subscribers\ImportExport\Export;
use MailPoet\Config\Env;
@ -26,7 +27,9 @@ class Export {
public $subscriber_batch_size;
public function __construct($data) {
set_time_limit(0);
if(strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
set_time_limit(0);
}
$this->export_confirmed_option = $data['export_confirmed_option'];
$this->export_format_option = $data['export_format_option'];
$this->group_by_segment_option = $data['group_by_segment_option'];
@ -47,7 +50,7 @@ class Export {
function process() {
try {
if(is_writable($this->export_path) === false) {
throw new \Exception(__("The export file could not be saved on the server.", 'mailpoet'));
throw new \Exception(__('The export file could not be saved on the server.', 'mailpoet'));
}
if(!extension_loaded('zip')) {
throw new \Exception(__('Export requires a ZIP extension to be installed on the host.', 'mailpoet'));
@ -211,7 +214,7 @@ class Export {
} else {
// if all subscribers belong to at least one segment, select the segment name
$subscribers = $subscribers
->selectExpr('MAX('.Segment::$_table . '.name) as segment_name')
->selectExpr('MAX(' . Segment::$_table . '.name) as segment_name')
->whereIn(SubscriberSegment::$_table . '.segment_id', $this->segments);
}
if($this->group_by_segment_option) {
@ -273,4 +276,4 @@ class Export {
return $subscriber[$field];
}, $this->subscriber_fields);
}
}
}

View File

@ -4,7 +4,7 @@ if(!defined('ABSPATH')) exit;
/*
* Plugin Name: MailPoet 3 (new)
* Version: 3.0.0-rc.1.0.2
* Version: 3.0.0-rc.1.0.3
* Plugin URI: http://www.mailpoet.com
* Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
* Author: MailPoet
@ -21,7 +21,7 @@ if(!defined('ABSPATH')) exit;
*/
$mailpoet_plugin = array(
'version' => '3.0.0-rc.1.0.2',
'version' => '3.0.0-rc.1.0.3',
'filename' => __FILE__,
'path' => dirname(__FILE__),
'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',

View File

@ -3,7 +3,7 @@ Contributors: mailpoet, wysija
Tags: newsletter, email, welcome email, post notification, autoresponder, signup, subscription, SMTP
Requires at least: 4.6
Tested up to: 4.8
Stable tag: 3.0.0-rc.1.0.2
Stable tag: 3.0.0-rc.1.0.3
Create and send beautiful emails and newsletters from WordPress.
== Description ==
@ -93,6 +93,12 @@ Our [support site](https://beta.docs.mailpoet.com) has plenty of articles. You c
== Changelog ==
= 3.0.0-rc.1.0.3 - 2017-08-15 =
* Improved: newsletter browser preview window in newsletter editor now fits correctly in any screen height;
* Improved: date shortcode displays WP time and is available to be translated into other laguages. Thanks Rik and Yves!
* Improved: rendered form body can be modified via a hook. Thanks, Vrodo;
* Fixed: subscriber export will not fail on hosts with PHP's set_time_limit() disabled. Thanks, @miguelarroyo;
= 3.0.0-rc.1.0.2 - 2017-08-08 =
* Fixed: correct error notice is displayed when using IIS server. Thanks @flauer!

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -e
echo "Getting translations from Transifex..."
tx pull -a -f

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -e
# Write ~/.transifexrc file if not exists
if [ ! -f ~/.transifexrc ]; then

View File

@ -0,0 +1,54 @@
<?php
namespace MailPoet\Test\Form;
use MailPoet\Form\Widget;
use MailPoet\Models\Form;
use MailPoet\Util\pQuery\pQuery;
use MailPoet\WP\Hooks;
class WidgetTest extends \MailPoetTest {
function testItAllowsModifyingRenderedFormWidgetViaHook() {
$form = Form::createOrUpdate(
array(
'name' => 'Test Form',
'body' => array(
array(
'type' => 'text',
'id' => 'email',
)
)
)
);
$form_widget = new Widget();
// form target is set to _self by default
$rendered_form_widget = $form_widget->widget(
array(),
array(
'form' => $form->id,
'form_type' => 'html'
)
);
$DOM = pQuery::parseStr($rendered_form_widget);
expect($DOM->query('form')->attr('target'))->equals('_self');
// form target is modified to _top via hook
Hooks::addFilter(
'mailpoet_form_widget_post_process',
function($form) {
$form = str_replace('target="_self"', 'target="_top"', $form);
return $form;
}
);
$rendered_form_widget = $form_widget->widget(
array(),
array(
'form' => $form->id,
'form_type' => 'html'
)
);
$DOM = pQuery::parseStr($rendered_form_widget);
expect($DOM->query('form')->attr('target'))->equals('_top');
}
}

View File

@ -5,7 +5,7 @@ use MailPoet\Models\CustomField;
use MailPoet\Newsletter\Shortcodes\ShortcodesHelper;
class ShortcodesHelperTest extends \MailPoetTest {
function testItCanGetShortcodes() {
function testGetsShortcodes() {
$shortcodes = ShortcodesHelper::getShortcodes();
expect(array_keys($shortcodes))->equals(
array(
@ -18,7 +18,7 @@ class ShortcodesHelperTest extends \MailPoetTest {
);
}
function testItCanGetCustomShortShortcodes() {
function testItGetsCustomShortShortcodes() {
$shortcodes = ShortcodesHelper::getShortcodes();
expect(count($shortcodes['Subscriber']))->equals(5);
$custom_field = CustomField::create();

View File

@ -80,15 +80,15 @@ class ShortcodesTest extends \MailPoetTest {
}
function testItCanProcessDateShortcodes() {
$date = new \DateTime('now');
expect(Date::process('d'))->equals($date->format('d'));
expect(Date::process('dordinal'))->equals($date->format('dS'));
expect(Date::process('dtext'))->equals($date->format('l'));
expect(Date::process('m'))->equals($date->format('m'));
expect(Date::process('mtext'))->equals($date->format('F'));
expect(Date::process('y'))->equals($date->format('Y'));
$date = new \DateTime(current_time('mysql'));
expect(Date::process('d'))->equals(date_i18n('d', current_time('timestamp')));
expect(Date::process('dordinal'))->equals(date_i18n('dS', current_time('timestamp')));
expect(Date::process('dtext'))->equals(date_i18n('l', current_time('timestamp')));
expect(Date::process('m'))->equals(date_i18n('m', current_time('timestamp')));
expect(Date::process('mtext'))->equals(date_i18n('F', current_time('timestamp')));
expect(Date::process('y'))->equals(date_i18n('Y', current_time('timestamp')));
// allow custom date formats (http://php.net/manual/en/function.date.php)
expect(Date::process('custom', 'format', 'U'))->equals($date->format('U'));
expect(Date::process('custom', 'format', 'U F'))->equals(date_i18n('U F', current_time('timestamp')));
}
function testItCanProcessNewsletterShortcodes() {
@ -109,7 +109,6 @@ class ShortcodesTest extends \MailPoetTest {
expect($result['0'])->equals($wp_post->post_title);
}
function itCanProcessPostNotificationNewsletterNumberShortcode() {
// create first post notification
$post_notification_history = $this->_createNewsletter(
@ -365,4 +364,5 @@ class ShortcodesTest extends \MailPoetTest {
wp_delete_post($this->WP_post, true);
wp_delete_user($this->WP_user->ID);
}
}

View File

@ -8,6 +8,7 @@
<div id="<%= form_id %>" class="mailpoet_form mailpoet_form_<%= form_type %>">
<%= styles | raw %>
<form
target="_self"
method="post"
action="<%= admin_url('admin-post.php?action=mailpoet_subscription_form') | raw %>"
class="mailpoet_form mailpoet_form_<%= form_type %>"

View File

@ -60,8 +60,8 @@
<div class="feature-section one-col mailpoet_centered">
<h2><%= __('Care to Give Your Opinion?') %></h2>
<script type="text/javascript" charset="utf-8" src="https://secure.polldaddy.com/p/9792513.js"></script>
<noscript><a href="//polldaddy.com/poll/9792513/">How many people on this website use MailPoet to send emails?</a></noscript>
<script type="text/javascript" charset="utf-8" src="//secure.polldaddy.com/p/9801039.js"></script>
<noscript><a href="//polldaddy.com/poll/9801039/">How would you rate the reliability of MailPoet?</a></noscript>
</div>
<hr>