Compare commits

..

151 Commits

Author SHA1 Message Date
1220f47d87 Clear vendor files in build before reinstalling production deps 2016-11-08 12:28:55 +02:00
583b34a5c1 Bump up release version to 3.0.0-beta.3 2016-11-08 11:56:18 +02:00
b36d13a087 Merge pull request #699 from mailpoet/php53-fix
Fixes various errors on PHP 5.3.x
2016-11-07 16:48:18 +01:00
1a3aa7a4e4 Merge pull request #701 from mailpoet/rendering_update
Rendering update
2016-11-07 16:27:48 +01:00
6ce13df2f3 Merge pull request #696 from mailpoet/beacon_report
HS Beacon enhanced report
2016-11-07 15:59:06 +02:00
4eb85c5d7e Merge pull request #697 from mailpoet/php7_compatibility_update
PHP 7.0 compatibility update
2016-11-07 15:40:48 +02:00
6eb6636e8b Merge pull request #694 from mailpoet/newsletter_number_shortcode_fix
Newsletter number shortcode fix
2016-11-07 14:03:01 +02:00
9635fb5365 - Replaces   with spaces in all templates 2016-11-06 20:06:26 -05:00
d4b39cb1f4 - Replaces &nbsp with spaces in text blocks 2016-11-06 20:04:18 -05:00
af36e7a0d9 - Converts template to UTF-8 2016-11-06 20:03:21 -05:00
1db8626e35 - Fixes 'Cannot access self:: when no class scope is active' error in PHP 5.3 2016-11-06 18:55:20 -05:00
61c255564f - Fixes 'Using $this when not in object context' error in PHP 5.3 2016-11-06 18:55:12 -05:00
7e5047d98f - Sets default timezone for CI's PHP configuration
- Prevents PHP Compatibility sniffer from throwing a "default timeezone is
  required" error
2016-11-05 19:54:56 -04:00
4698d5a4db - Indirectly invokes hash_equals() functions. This prevents PHP Compatibility sniffer
from complains about the function not present in <5.6. WP provides a shim for older
  PHP versions in wp-includes/compat.php
2016-11-05 19:54:55 -04:00
864c9cbe95 - Updates code sniffer rules to run PHP Compatibility sniff 2016-11-05 19:54:54 -04:00
011b6f9b3c - Adds PHP Compatibility sniffer dependency
- Updates build script to ignore running post-update|install commands
2016-11-05 19:54:53 -04:00
e45fc0c0a0 - Renames functions that start with underscores (i.e., names reserved by PHP)
- Removes the unused date_format function
2016-11-05 19:54:46 -04:00
6bebdd6e95 - Removes unused PHPMailer dependency 2016-11-05 11:27:58 -04:00
8df4da768a Merge pull request #695 from mailpoet/plugin_activation
Fix Populator in plugin activation
2016-11-04 17:56:59 +01:00
67f4c21aa8 Fix coding standard issue - extra space after foreach 2016-11-04 17:00:10 +02:00
5eba0e2731 Fix referencing $this in anonymous function context 2016-11-04 17:00:10 +02:00
3efa429a1b - Updates newsletters listing to display rendered subject for post
notification history emails
2016-11-04 09:51:50 -04:00
3a78441a83 Merge pull request #691 from mailpoet/editor_fixes
Fitting text in template selection boxes
2016-11-04 09:38:28 -04:00
c05be7d987 remove useless comment (containing a typo on top of that...) 2016-11-04 14:14:48 +01:00
b8cb1da777 added custom information to HS Beacon 2016-11-04 14:11:37 +01:00
ac8d1d808f Merge pull request #689 from mailpoet/index_files
Adds folder index files
2016-11-04 11:21:03 +01:00
9cd7b1a204 - Updates unit tests
- Addresses #628 (3)
2016-11-03 20:56:25 -04:00
0d32c09df3 - Replaces model arrays with model objects 2016-11-03 20:45:53 -04:00
9f288ae11a - Removes unused classes
- Fixes [newsletter:number] shortcode not working
2016-11-03 20:38:20 -04:00
e87ccd6b92 - Corrects/updates code comments 2016-11-03 18:11:00 -04:00
8a2b6ac69b Merge pull request #690 from mailpoet/obsolete_dependencies
Remove obsolete JS dependencies
2016-11-03 17:57:56 +01:00
43bd2d4413 Fixes template selection boxes to fit text in different configurations 2016-11-03 18:17:45 +02:00
9fdb99a06b Merge pull request #688 from mailpoet/editor_xss
Reflected XSS in newsletter editor
2016-11-03 16:56:25 +01:00
f3c69c8353 Remove obsolete JS dependencies 2016-11-03 14:29:40 +02:00
29a32d3da9 Enumerate build.sh steps to improve visibility for any issues 2016-11-03 14:12:49 +02:00
8412cc852d Add index files during build to ensure dirs aren't browsable #650 2016-11-03 14:12:12 +02:00
b4e4320508 Fix newsletter editor XSS #638 2016-11-03 13:20:22 +02:00
dbd6e6f310 Remove obsolete JS libraries: d3, c3, swag, xss 2016-11-02 17:12:51 +02:00
bdcb7f0e58 Merge pull request #687 from mailpoet/issue_681_670
fixed HTML export of subscription form + updated docs url in settings
2016-11-02 16:15:07 +02:00
85c9b121f5 Merge pull request #678 from mailpoet/ci_improvements
CI improvements [MAILPOET-618]
2016-11-02 08:46:04 -04:00
069bc95297 fixed HTML export of subscription form + updated docs url in settings 2016-11-02 13:24:55 +01:00
0b711e6341 Add running QA scripts in CI, disable checking for useless overrides 2016-11-02 13:10:23 +02:00
2a961cca01 Eliminate an extra level of indentation 2016-11-02 13:10:23 +02:00
e855fdbbaf Fix composer installation for CI 2016-11-02 13:10:23 +02:00
288464e8cb Change Robo tasks to return error exit codes when they fail 2016-11-02 13:10:23 +02:00
1331ed70f1 Remove phpseclib dependency, which is no longer needed 2016-11-02 13:10:23 +02:00
411188c345 Remove PopulatorData from coverage reports as it's irrelevant 2016-11-02 13:03:15 +02:00
ee275532b1 Merge pull request #679 from mailpoet/secissue_640
XSS in listing sort by
2016-11-02 12:48:40 +02:00
b2eef93516 Merge pull request #685 from mailpoet/issue_489
fixed NaN in sending stats, show 'no subscribers' instead
2016-11-02 12:23:31 +02:00
40ca54c447 sort by defaults to 'id' if invalid 2016-11-02 11:17:27 +01:00
b65db1afbf Merge pull request #684 from mailpoet/issue_639
removed risky file from css-tidy vendor when building
2016-11-02 12:11:29 +02:00
c258b1c3a2 Merge pull request #680 from mailpoet/css_inliner_update
Fixes PHP 7 compatibility issue with CSS  inliner
2016-11-02 11:43:46 +02:00
7a5a726400 removed risky file from css-tidy vendor when building 2016-11-02 10:30:57 +01:00
e553922eca Update composer.lock and remove leftover comment 2016-11-02 11:30:52 +02:00
04e9e8a45d fixed NaN in sending stats, show 'no subscribers' instead 2016-11-02 10:21:02 +01:00
f037e1271d - Removes php-simple-html-dom-parser dependency
- Updates CSS inliner to use pQuery DOM parser
2016-10-31 19:01:48 -04:00
f4563e18cd use filter_var instead of regex 2016-10-31 17:36:53 +01:00
feaac5eb54 constrain sort_by to alphanumeric/underscore in order to avoid xss in error notices 2016-10-31 17:36:53 +01:00
a6059d5bc3 Update to 3.0.0-beta.2 release 2016-10-31 12:45:03 +02:00
f2104ef30f Merge pull request #677 from mailpoet/plugin_description
Updated plugin description
2016-10-31 12:31:43 +02:00
e7f760328e updated plugin description 2016-10-31 11:15:36 +01:00
c09bcd51ad Merge pull request #675 from mailpoet/amazon_ses_fix
Fixes const value declaration for PHP <5.6
2016-10-28 17:29:57 +03:00
01af4d3401 - Fixes const value declaration for PHP <5.6 2016-10-28 10:13:56 -04:00
2ba9d95a2e Update plugin repo icon to "beta" 2016-10-28 16:03:14 +03:00
b2d4bfc760 Initial MailPoet 3.0.0-beta.1 release 2016-10-28 13:52:40 +03:00
57f5f16bb6 Merge pull request #674 from mailpoet/premium_hook
Bypasses subscriber count enforcement for premium users
2016-10-27 20:47:14 +03:00
7d2e13b9a3 - Updates license check logic
- Updates subscriber limit check logic
- Updates unit tests
- Updates Menu's check for subscriber limit
2016-10-27 12:35:57 -04:00
6d39f9fa78 Merge pull request #671 from mailpoet/plugin_repository_assets
Preparation for plugin repository
2016-10-27 11:36:57 -04:00
a4395f2350 - Adds unit tests 2016-10-27 11:16:30 -04:00
411969b3eb - Adds check for premium plugin status
- Bypasses subscriber count enforcement if premium is enabled
2016-10-27 10:20:05 -04:00
1868ca3155 Merge pull request #673 from mailpoet/scheduler_update
Scheduler update
2016-10-27 13:17:03 +03:00
e765471f5d - Changes month days count to start from 1 instead of 0
- Closes #672
2016-10-26 21:18:07 -04:00
bdce7c5e5a - Remove unused dependency 2016-10-26 11:43:32 -04:00
773be9f5c8 Add assets for plugin repository 2016-10-26 13:59:02 +03:00
6ae46b05e5 Merge pull request #669 from mailpoet/string_updates
String updates
2016-10-25 18:00:44 +03:00
217894745d - Updates text strings
- Closes #655
2016-10-25 10:21:23 -04:00
a03891895c Bump up release version to 0.0.50 and update changelog 2016-10-25 13:04:55 +03:00
3368e84a99 Merge pull request #668 from mailpoet/export_confirmed_subscribers_option_update
Fixes minor export UI issues
2016-10-25 12:46:13 +03:00
e90df2f08d - Fixes Select2 not dislaying multiple options in the list of export
fields
- Sets default "export confirmed subscriber" option to "no"
2016-10-24 13:09:48 -04:00
2391ae1cad Merge pull request #665 from mailpoet/post_notification_fix
Fixes post notification issues
2016-10-24 16:02:19 +03:00
83114a8be4 - Removes unused class declarations 2016-10-24 08:55:22 -04:00
d08d5a3b6c - Updates unit tests 2016-10-24 08:55:22 -04:00
8330bfc884 - Fixes "completed" status update of notification history
newsletters
- Fixes detection of post notification newsletters that do not contain any posts (i.e., blank ALC blocks)
- Updates unit test
2016-10-24 08:55:22 -04:00
ef21a8cca7 - Enables post notification schedule update upon newsletter saving during
step 3
2016-10-24 08:55:22 -04:00
e32c46a755 - Detaches posts_where action after posts are pulled from the database 2016-10-24 08:55:22 -04:00
092f69538a Merge pull request #667 from mailpoet/sending_to_trashed_subscribers_fix
Prevents newsletters from being sent to trashed subscribers
2016-10-24 15:26:55 +03:00
7a75367d75 Merge pull request #666 from mailpoet/export_filename_update
Increases export filename length and randomness
2016-10-24 13:36:36 +03:00
0b2701ade2 Merge pull request #656 from mailpoet/security_issue_636
API Token
2016-10-24 13:26:44 +03:00
1ac288d286 - Prevents newsletters from being sent to trashed subscribers
- Updates unit tests
- Addresses #629
2016-10-21 14:36:44 -04:00
516bc73092 - Increases export filename length and randomness 2016-10-21 11:42:13 -04:00
4088abef68 removed useless 'use' in unit test 2016-10-21 13:42:19 +02:00
f6cefc3f5c wrong email address in unit test 2016-10-21 13:38:23 +02:00
202e4b90e1 added unit test for API::checkPermissions 2016-10-21 13:36:41 +02:00
ee89bf0722 refactored API class 2016-10-21 13:36:41 +02:00
876d21300a fixed duplicated lines due to faulty rebase 2016-10-21 13:36:41 +02:00
0ca5b7a79f API Security
- added APIAccess class to define access levels of API Endpoints (permissions)
- use "mailpoet_token" for all nonce (just as before)
- merged setupPublic/setupAdmin methods in API in order to avoid duplication
- check permission if access level is not all
- fixed ABSPATH check in some classes
2016-10-21 13:36:41 +02:00
5d0ee43921 removed checkToken for admin ajax 2016-10-21 13:36:41 +02:00
cc523a3c0b ability to specify action for generateToken() method 2016-10-21 13:36:41 +02:00
2787998d32 Merge pull request #664 from mailpoet/editor_fixes
Editor fixes
2016-10-20 17:29:55 +02:00
38f6c95059 Update newsletter saving to reflect code review comments
- Switch to using full segment objects when saving newsletters
- Fix stale comment in newsletter editor's Newsletter model
- Fix typo in newsletter editor tests
2016-10-20 17:52:05 +03:00
cc03b631ff Allow newsletters.save endpoint to accept segments as list of objects 2016-10-20 16:08:41 +03:00
a3c77fb685 Fix PHP to JS date format converter to handle escaped symbols 2016-10-20 15:19:04 +03:00
3817e28960 Change newsletter not found error to a static one in editor 2016-10-20 13:38:07 +03:00
c3a78b1ea3 Fix newsletter editor to only save properties it changes 2016-10-20 13:37:32 +03:00
42877236c8 Merge pull request #663 from mailpoet/wp_repo_files
Preparation for plugin repo
2016-10-19 09:08:54 -04:00
6e87f3539c Update license.txt, readme.txt and link to plugin's repo page 2016-10-19 13:46:14 +03:00
7704ea4b68 Bump up release version to 0.0.49 2016-10-19 13:23:00 +03:00
12a3931b7b Merge pull request #662 from mailpoet/security_issue_634
PHP Object injection in front Router
2016-10-18 16:46:14 +03:00
25a55dbb67 Merge pull request #661 from mailpoet/security_issue_633
Import SQL injection
2016-10-18 14:50:08 +02:00
6758f60a81 Merge pull request #659 from mailpoet/import_data_sanitization
Sanitize import data
2016-10-18 12:35:52 +02:00
5e9e53ec41 - Updates router to use json_encode() instead of serialize() for publicly modified data payload
- Updates unit tests
- Fixes #634
2016-10-17 22:39:36 -04:00
1285252a8c - Adds unit tests 2016-10-17 20:27:58 -04:00
98f95f72ad - Adds validation for import data, including column names (fixes #633)
- Prevents nonexistent custom fields from being associated with subscribers
2016-10-17 20:22:25 -04:00
09ca788371 - Fixes subscriber count not being shown when new segment is created 2016-10-17 20:12:57 -04:00
b48cc5a959 - Updates import UI to escape HTML text
- Allows mixing of escaped and unescaped HTML text
- Removes server-side text escaping
2016-10-17 11:01:54 -04:00
812d138c4e Merge pull request #658 from mailpoet/import_and_mailer_host_restriction
Import and mailer host restriction
2016-10-17 16:19:42 +02:00
07bc35d4cd Merge pull request #625 from mailpoet/unit_tests
Adds unit test for newsletter scheduler
2016-10-17 11:37:17 +02:00
90b95a2c25 fixed 'newletter' typo and replaced integer weekdays by their carbon constant equivalent 2016-10-17 11:35:57 +02:00
78c50c41e3 - Fixes unit test
- Updates code as per code review comments
2016-10-18 14:29:53 -04:00
7eee7def63 Merge pull request #657 from mailpoet/security_issue_635
Security issue #635
2016-10-16 16:42:11 -04:00
9ba6e9806f - Adds data sanitization on the client and server side
- Closes #641
2016-10-16 13:02:49 -04:00
8c28dc3d8a - Restricts Amazon SES region to a specific list of hosts
- Updates unit tests
- Closes #647
2016-10-16 12:19:47 -04:00
9197e39fb4 - Restricts MailChimp API key to specific format
- Updates unit test
2016-10-16 11:57:56 -04:00
37f59814e5 removed unused methods in Util/CSS -> fixes security issue #635 2016-10-13 10:34:36 +02:00
bf894fc26f Bump up release version to 0.0.48, update changelog 2016-10-11 13:02:08 +03:00
0b2b42cf4d Merge pull request #654 from mailpoet/security_issue_1
Security issues round 1
2016-10-11 12:51:11 +03:00
542015a4f6 Improved removal of useless files in vendor folder during build process
- moved sort_order constraining logic to Listing handler's construct
2016-10-10 14:52:09 +02:00
f5a8323f5d removed 'test*' from removed folders in vendor as it was creating issues with Twig 2016-10-07 15:12:58 +02:00
55942cd88b prevent odd values for sort_order in listing.jsx 2016-10-07 14:38:25 +02:00
f26a2cbd26 fixes issue #651 2016-10-06 13:18:46 +02:00
4402f826c3 fixed issue with namespace AND fixed issue #649 2016-10-06 12:54:04 +02:00
b9745b555a make sure ABSPATH is defined before using it - fixes issue #648 2016-10-06 12:52:53 +02:00
f923a8063b cleanup useless files in vendor folder when building release (fixes issue #637) 2016-10-06 11:24:18 +02:00
f4367b9146 optimized the composer install a bit 2016-10-06 09:52:42 +02:00
a3395e41c9 fixes issue #632 2016-10-06 09:25:09 +02:00
be61135daf Merge pull request #627 from mailpoet/translations
Translations
2016-10-05 12:26:03 +03:00
21b4187a11 added missing text domains in _e functions 2016-10-05 10:26:59 +02:00
1c3c1e35e7 added 'lang' to gitignore 2016-10-05 10:08:24 +02:00
ded373557e Bump up release version to 0.0.47 and update changelog 2016-10-04 12:05:34 +03:00
280c4762bb Merge pull request #630 from mailpoet/subscribers_count_in_segments
Subscribers count in segments
2016-10-04 11:58:44 +03:00
bbd02260be Fix showing segment subscriber counts on newsletter creation pages 2016-10-04 11:54:07 +03:00
1b1e9abd68 Merge pull request #631 from mailpoet/issue_629
Bugs in latest release (0.0.46) - issue 629
2016-10-03 15:42:57 +03:00
b0ab9e0408 fixed import/export unit tests + added specific method for getting segments for import 2016-09-30 15:52:17 +02:00
d32abff78d display subscribers count in segments selection 2016-09-30 15:23:18 +02:00
7fbf84db1f converted text domain to string instead of constant 2016-09-30 09:58:26 +02:00
8c5aebc7d6 Don't send signup confirmation when signup confirmation is disabled
Fixed issue with select2 not selecting values by default on newsletter send step
2016-09-29 15:42:44 +02:00
42202f676a updated Env::plugin_name to constant for text domain 2016-09-27 14:54:23 +02:00
ba6198f956 added textdomain to __() calls 2016-09-27 14:53:44 +02:00
120af4170b fixed do makepot + removed mailpoet.pot from repo 2016-09-27 14:53:44 +02:00
e565a7a234 - Uses Codeception's native methods to verify expectations
- Updates next run date test conditions to use account for possible time
  difference
2016-09-26 12:35:00 -04:00
e1c5f609ff - Adds unit test 2016-09-23 20:16:53 -04:00
180 changed files with 2952 additions and 5823 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ tests/javascript/testBundles
assets/css/*.css
assets/js/*.js
.vagrant
lang

View File

@ -3,14 +3,21 @@
class RoboFile extends \Robo\Tasks {
function install() {
$this->_exec('./composer.phar install');
$this->_exec('npm install');
return $this->taskExecStack()
->stopOnFail()
->exec('./composer.phar install')
->exec('npm install')
->run();
}
function update() {
$this->say(getenv('WP_TEST_URL'));
$this->_exec('./composer.phar update');
$this->_exec('npm update');
return $this->taskExecStack()
->stopOnFail()
->exec('./composer.phar update')
->exec('npm update')
->run();
}
protected function rsearch($folder, $extensions = array()) {
@ -61,12 +68,14 @@ class RoboFile extends \Robo\Tasks {
}
function compileAll() {
$this->compileJs();
$this->compileCss();
$collection = $this->collection();
$collection->add(array($this, 'compileJs'));
$collection->add(array($this, 'compileCss'));
return $collection->run();
}
function compileJs() {
$this->_exec('./node_modules/webpack/bin/webpack.js');
return $this->_exec('./node_modules/webpack/bin/webpack.js --bail');
}
function compileCss() {
@ -78,7 +87,7 @@ class RoboFile extends \Robo\Tasks {
'assets/css/src/importExport.styl'
);
$this->_exec(join(' ', array(
return $this->_exec(join(' ', array(
'./node_modules/stylus/bin/stylus',
'--include ./node_modules',
'--include-css',
@ -89,14 +98,14 @@ class RoboFile extends \Robo\Tasks {
}
function makepot() {
$this->_exec('./node_modules/.bin/grunt makepot'.
return $this->_exec('./node_modules/.bin/grunt makepot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__
);
}
function pushpot() {
$this->_exec('./node_modules/.bin/grunt pushpot'.
return $this->_exec('./node_modules/.bin/grunt pushpot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__
);
@ -152,22 +161,26 @@ class RoboFile extends \Robo\Tasks {
function testDebug() {
$this->_exec('vendor/bin/codecept build');
$this->loadEnv();
$this->_exec('vendor/bin/codecept run unit --debug');
return $this->_exec('vendor/bin/codecept run unit --debug');
}
function testFailed() {
$this->loadEnv();
$this->_exec('vendor/bin/codecept build');
$this->_exec('vendor/bin/codecept run -g failed');
return $this->_exec('vendor/bin/codecept run -g failed');
}
function qa() {
$this->qaLint();
$this->qaCodeSniffer('all');
$collection = $this->collection();
$collection->add(array($this, 'qaLint'));
$collection->add(function() {
return $this->qaCodeSniffer('all');
});
return $collection->run();
}
function qaLint() {
$this->_exec('./tasks/php_lint.sh lib/ tests/ mailpoet.php');
return $this->_exec('./tasks/php_lint.sh lib/ tests/ mailpoet.php');
}
function qaCodeSniffer($severity='errors') {
@ -176,7 +189,7 @@ class RoboFile extends \Robo\Tasks {
} else {
$severityFlag = '-n';
}
$this->_exec(
return $this->_exec(
'./vendor/bin/phpcs '.
'--standard=./tasks/code_sniffer/MailPoet '.
'--ignore=./lib/Util/Sudzy/*,./lib/Util/CSS.php,./lib/Util/XLSXWriter.php,'.

View File

@ -1,3 +1,15 @@
$box-width = 425px
$box-height = 150px
$thumbnail-width = $box-height
$thumbnail-height = $thumbnail-width
$box-description-space-between-heading-and-paragraph = 5px
$box-description-height = 110px
$box-description-text-height = $box-description-height - $box-description-space-between-heading-and-paragraph
$box-heading-line-height = $box-description-text-height / 4
$box-heading-font-size = $box-heading-line-height * 5/7
$box-description-line-height = $box-heading-line-height / 2
$box-description-font-size = $box-description-line-height
.mailpoet_boxes.mailpoet_boxes_loading
opacity: 0.2
@ -6,8 +18,8 @@
position: relative
padding: 15px
margin: 15px 25px 0 0
width: 425px
height: 150px
width: $box-width
height: $box-height
border: 1px solid #dedede
background-color: #fff
@ -18,15 +30,15 @@
background-position: center
color: #222
border: 1px solid #ccc
width: 150px
height: 150px
width: $thumbnail-height
height: $thumbnail-width
margin-right: 15px
float: left
overflow: hidden
position: relative
img
min-width: 150px
min-width: $thumbnail-width
height: auto
width: 110%
position: relative
@ -60,20 +72,21 @@
.mailpoet_boxes .mailpoet_description
float:left
width: 245px
max-height: calc(115px - 2em)
padding-bottom: 2em
max-height: $box-description-height
padding-bottom: 0
overflow: hidden
h3
margin: 0 0 0.7em 0
margin: 0 0 $box-description-space-between-heading-and-paragraph 0
overflow: hidden
max-width: 210px
line-height: 1.4em
line-height: $box-heading-line-height
font-size: $box-heading-font-size
p
font-size: 13px
line-height: 1.5
margin: 1em 0
font-size: $box-description-font-size
line-height: $box-description-line-height
margin: 0
.mailpoet_boxes .mailpoet_actions
position: absolute

View File

@ -71,30 +71,43 @@ define('date',
convertFormat: function(format) {
var format_mappings = {
date: {
D: 'ddd',
l: 'dddd',
d: 'DD',
D: 'ddd',
j: 'D',
z: 'DDDD',
l: 'dddd',
N: 'E',
S: '',
M: 'MMM',
S: 'o',
w: 'e',
z: 'DDD',
W: 'W',
F: 'MMMM',
m: 'MM',
n: '',
t: '',
y: 'YY',
M: 'MMM',
n: 'M',
t: '', // no equivalent
L: '', // no equivalent
o: 'YYYY',
Y: 'YYYY',
H: 'HH',
h: 'hh',
g: 'h',
y: 'YY',
a: 'a',
A: 'A',
B: '', // no equivalent
g: 'h',
G: 'H',
h: 'hh',
H: 'HH',
i: 'mm',
s: 'ss',
T: 'z',
O: 'ZZ',
w: 'd',
W: 'WW'
u: 'SSS',
e: 'zz', // deprecated since version 1.6.0 of moment.js
I: '', // no equivalent
O: '', // no equivalent
P: '', // no equivalent
T: '', // no equivalent
Z: '', // no equivalent
c: '', // no equivalent
r: '', // no equivalent
U: 'X'
},
strftime: {
a: 'ddd',
@ -127,20 +140,29 @@ define('date',
var replacements = format_mappings['date'];
var outputFormat = '';
var convertedFormat = [];
var escapeToken = false;
Object.keys(replacements).forEach(function(key) {
if (format.indexOf(key) !== -1) {
format = format.replace(key, '%'+key);
for (var index in format) {
var token = format[index];
if (escapeToken === true) {
convertedFormat.push('['+token+']');
escapeToken = false;
} else {
if (token === '\\') {
// Slash escapes the next symbol to be treated as literal
escapeToken = true;
continue;
} else if (replacements[token] !== undefined) {
convertedFormat.push(replacements[token]);
} else {
convertedFormat.push('['+token+']');
}
}
});
outputFormat = format;
Object.keys(replacements).forEach(function(key) {
if (outputFormat.indexOf('%'+key) !== -1) {
outputFormat = outputFormat.replace('%'+key, replacements[key]);
}
});
return outputFormat;
}
return convertedFormat.join('');
}
};
});

View File

@ -89,10 +89,17 @@ function(
if(this.props.field['selected'] !== undefined) {
return this.props.field['selected'](this.props.item);
} else if(this.props.item !== undefined && this.props.field.name !== undefined) {
return this.props.item[this.props.field.name];
} else {
return null;
if (this.allowMultipleValues()) {
if (Array.isArray(this.props.item[this.props.field.name])) {
return this.props.item[this.props.field.name].map(function(item) {
return item.id;
});
}
} else {
return this.props.item[this.props.field.name];
}
}
return null;
},
loadCachedItems: function() {
if(typeof(window['mailpoet_'+this.props.field.endpoint]) !== 'undefined') {
@ -115,9 +122,10 @@ function(
} else {
value = e.target.value;
}
var transformedValue = this.transformChangedValue(value);
this.props.onValueChange({
target: {
value: value,
value: transformedValue,
name: this.props.field.name
}
});
@ -141,6 +149,16 @@ function(
}
return item.id;
},
// When it's impossible to represent the desired value in DOM,
// this function may be used to transform the placeholder value into
// desired value.
transformChangedValue: function(value) {
if(typeof this.props.field['transformChangedValue'] === 'function') {
return this.props.field.transformChangedValue.call(this, value);
} else {
return value;
}
},
render: function() {
const options = this.state.items.map((item, index) => {
let label = this.getLabel(item);

View File

@ -624,7 +624,7 @@ const Listing = React.createClass({
handleSort: function(sort_by, sort_order = 'asc') {
this.setState({
sort_by: sort_by,
sort_order: sort_order,
sort_order: (sort_order === 'asc') ? 'asc' : 'desc',
}, function() {
this.setParams();
}.bind(this));

View File

@ -11,15 +11,16 @@ define([
// Does not hold newsletter content nor newsletter styles, those are
// handled by other components.
Module.NewsletterModel = SuperModel.extend({
stale: ['body', 'created_at', 'deleted_at', 'updated_at'],
whitelisted: ['id', 'subject', 'preheader'],
initialize: function(options) {
this.on('change', function() {
App.getChannel().trigger('autoSave');
});
},
toJSON: function() {
// Remove stale attributes from resulting JSON object
return _.omit(SuperModel.prototype.toJSON.call(this), this.stale);
// Use only whitelisted properties to ensure properties editor
// doesn't control don't change.
return _.pick(SuperModel.prototype.toJSON.call(this), this.whitelisted);
},
});

View File

@ -61,7 +61,7 @@ const _QueueMixin = {
);
// calculate percentage done
const percentage = Math.round(
let percentage = Math.round(
(newsletter.queue.count_processed * 100) / (newsletter.queue.count_total)
);
@ -108,15 +108,24 @@ const _QueueMixin = {
);
}
let progress_bar_width = 0;
if (isNaN(percentage)) {
percentage = MailPoet.I18n.t('noSubscribers');
} else {
progress_bar_width = percentage;
percentage += "%";
}
return (
<div>
<div className={ progressClasses }>
<span
className="mailpoet_progress_bar"
style={ { width: percentage + "%"} }
style={ { width: progress_bar_width + "%"} }
></span>
<span className="mailpoet_progress_label">
{ percentage + "%" }
{ percentage }
</span>
</div>
<p style={{ textAlign:'center' }}>

View File

@ -68,7 +68,7 @@ const NewsletterListNotificationHistory = React.createClass({
<a
href={ newsletter.preview_url }
target="_blank"
>{ newsletter.subject }</a>
>{ newsletter.queue.newsletter_rendered_subject }</a>
</strong>
{ actions }
</td>

View File

@ -62,7 +62,7 @@ const _monthDayValues = _.object(
} else {
label = MailPoet.I18n.t('nth').replace("%$1d", day + 1);
}
return [day, label];
return [day + 1, label];
}
)
);

View File

@ -1,11 +1,13 @@
define(
[
'mailpoet',
'newsletters/types/notification/scheduling.jsx'
'newsletters/types/notification/scheduling.jsx',
'underscore'
],
function(
MailPoet,
Scheduling
Scheduling,
_
) {
var settings = window.mailpoet_settings || {};
@ -40,11 +42,15 @@ define(
return !!(!segment.deleted_at);
},
getLabel: function(segment) {
var name = segment.name;
if (segment.subscribers > 0) {
name += ' (%$1s)'.replace('%$1s', parseInt(segment.subscribers).toLocaleString());
}
return name;
return segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')';
},
transformChangedValue: function(segment_ids) {
var all_segments = this.state.items;
return _.map(segment_ids, function(id) {
return _.find(all_segments, function(segment) {
return segment.id === id;
});
});
},
validation: {
'data-parsley-required': true,

View File

@ -346,11 +346,15 @@ define(
return !!(!segment.deleted_at);
},
getLabel: function(segment) {
var name = segment.name;
if (segment.subscribers > 0) {
name += ' (%$1s)'.replace('%$1s', parseInt(segment.subscribers).toLocaleString());
}
return name;
return segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')';
},
transformChangedValue: function(segment_ids) {
var all_segments = this.state.items;
return _.map(segment_ids, function(id) {
return _.find(all_segments, function(segment) {
return segment.id === id;
});
});
},
validation: {
'data-parsley-required': true,

View File

@ -1,6 +1,5 @@
import _ from 'underscore'
import React from 'react'
import MailPoet from 'mailpoet'
import Select from 'form/fields/select.jsx'
import {
intervalValues,

View File

@ -27,10 +27,7 @@ const events = {
const availableSegmentValues = _.object(_.map(
availableSegments,
function(segment) {
let name = segment.name;
if (segment.subscribers > 0) {
name += ' (%$1s)'.replace('%$1s', parseInt(segment.subscribers).toLocaleString());
}
let name = segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')';
return [segment.id, name];
}
));

View File

@ -40,7 +40,7 @@ function(
// ajax request
MailPoet.Ajax.post({
url: MailPoetForm.ajax_url,
token: MailPoetForm.token,
token: data.token,
endpoint: 'subscribers',
action: 'subscribe',
data: data

View File

@ -134,7 +134,7 @@ const item_actions = [
link: function(item) {
return (
<a
href="https://www.mailpoet.com/#TODO"
href="http://docs.mailpoet.com/article/133-the-wordpress-users-list"
target="_blank"
>{MailPoet.I18n.t('readMore')}</a>
);

View File

@ -75,6 +75,9 @@ define(
filter: function(segment) {
return !!(!segment.deleted_at && segment.type === 'default');
},
getLabel: function(segment) {
return segment.name + ' ('+ segment.subscribers +')';
},
getSearchLabel: function(segment, subscriber) {
let label = '';

View File

@ -95,15 +95,18 @@ define(
});
};
// set confirmed subscribers export option to false
exportData.exportConfirmedOption = false;
renderSegmentsAndFields(subscriberFieldsContainerElement, subscriberFieldsSelect2);
renderSegmentsAndFields(segmentsContainerElement, segments);
subscriberFieldsContainerElement.select2('val', [
'status',
subscriberFieldsContainerElement.val([
'email',
'first_name',
'last_name'
]);
'last_name',
'status'
]).trigger("change");
exportConfirmedOptionElement.change(function () {
var selectedSegments = segmentsContainerElement.val();

View File

@ -7,7 +7,6 @@ define(
'handlebars',
'papaparse',
'asyncqueue',
'xss',
'moment',
'select2'
],
@ -19,7 +18,6 @@ define(
Handlebars,
Papa,
AsyncQueue,
xss,
Moment
) {
if (!jQuery('#mailpoet_subscribers_import').length) {
@ -337,9 +335,9 @@ define(
complete: function (CSV) {
for (var rowCount in CSV.data) {
var rowData = CSV.data[rowCount].map(function (el) {
return filterXSS(el.trim());
}),
rowColumnCount = rowData.length;
return el.trim();
});
var rowColumnCount = rowData.length;
// set the number of row elements based on the first non-empty row
if (columnCount === null) {
columnCount = rowColumnCount;
@ -530,15 +528,11 @@ define(
width: '20em',
templateResult: function (item) {
item.subscriberCount = parseInt(item.subscriberCount);
return (item.subscriberCount > 0)
? item.name + ' (' + item.subscriberCount.toLocaleString() + ')'
: item.name;
return item.name + ' (' + item.subscriberCount.toLocaleString() + ')';
},
templateSelection: function (item) {
item.subscriberCount = parseInt(item.subscriberCount);
return (item.subscriberCount > 0)
? item.name + ' (' + item.subscriberCount.toLocaleString() + ')'
: item.name;
return item.name + ' (' + item.subscriberCount.toLocaleString() + ')';
}
})
.change(function () {
@ -586,7 +580,8 @@ define(
}).done(function(response) {
mailpoetSegments.push({
'id': response.data.id,
'name': response.data.name
'name': response.data.name,
'subscriberCount': 0
});
var selected_values = segmentSelectElement.val();
@ -673,8 +668,15 @@ define(
return options.fn(displayedColumns);
});
// sanitize unsafe data
Handlebars.registerHelper('sanitize_data', function(data) {
return (data instanceof Handlebars.SafeString) ?
data :
new Handlebars.SafeString(Handlebars.Utils.escapeExpression(data));
});
// start array index from 1
Handlebars.registerHelper('show_real_index', function (index) {
Handlebars.registerHelper('calculate_index', function (index) {
var index = parseInt(index);
// display filler data (e.g., ellipsis) if we've reached the maximum number of rows and
// subscribers count is greater than the maximum number of rows we're displaying
@ -869,7 +871,7 @@ define(
'<span class="mailpoet_data_match mailpoet_import_error" title="'
+ MailPoet.I18n.t('noDateFieldMatch') + '">'
+ MailPoet.I18n.t('emptyFirstRowDate')
+ '</span>';
+ '</span> ';
preventNextStep = true;
}
else {
@ -883,7 +885,9 @@ define(
jQuery(matchedColumn.element).data('validation-rule', validationRule);
break;
}
if (validationRule === 'datetime') validationRule = Moment.ISO_8601;
if (validationRule === 'datetime') {
validationRule = Moment.ISO_8601;
}
}
}
jQuery.map(subscribersClone.subscribers, function (data, index) {
@ -892,18 +896,22 @@ define(
var date = Moment(rowData, testedFormat, true);
// validate date
if (date.isValid()) {
data[matchedColumn.index] +=
'<span class="mailpoet_data_match" title="'
+ MailPoet.I18n.t('verifyDateMatch') + '">'
+ MailPoet.Date.format(date)
+ '</span>';
data[matchedColumn.index] = new Handlebars.SafeString(
Handlebars.Utils.escapeExpression(data[matchedColumn.index])
+ '<span class="mailpoet_data_match" title="'
+ MailPoet.I18n.t('verifyDateMatch') + '">'
+ MailPoet.Date.format(date)
+ '</span> '
);
}
else {
data[matchedColumn.index] +=
'<span class="mailpoet_data_match mailpoet_import_error" title="'
data[matchedColumn.index] = new Handlebars.SafeString(
Handlebars.Utils.escapeExpression(data[matchedColumn.index])
+ '<span class="mailpoet_data_match mailpoet_import_error" title="'
+ MailPoet.I18n.t('noDateFieldMatch') + '">'
+ MailPoet.I18n.t('dateMatchError')
+ '</span>';
+ (new Handlebars.SafeString(MailPoet.I18n.t('dateMatchError')))
+ '</span> '
);
preventNextStep = true;
};
});

View File

@ -1,25 +1,32 @@
#!/bin/sh
# Translations (npm install & composer install need to be run before)
echo '[BUILD] Generating translations'
./do makepot
plugin_name='mailpoet'
# Remove previous build.
echo '[BUILD] Removing previous build'
rm $plugin_name.zip
# Create temp dir.
echo '[BUILD] Creating temporary directory'
mkdir $plugin_name
# Production assets.
echo '[BUILD] Generating production CSS and JS assets'
rm -rf node_modules
npm install
./do compile:all
# Production libraries.
./composer.phar install --no-dev
# Translations
./do makepot
echo '[BUILD] Fetching production libraries'
rm -rf vendor
./composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-scripts
# Copy release folders.
echo '[BUILD] Copying release folders'
cp -Rf lang $plugin_name
cp -RfL assets $plugin_name
cp -Rf lib $plugin_name
@ -28,18 +35,49 @@ cp -Rf views $plugin_name
rm -Rf $plugin_name/assets/css/src
rm -Rf $plugin_name/assets/js/src
# Remove extra files (docs, examples,...) from 3rd party extensions
echo '[BUILD] Removing obsolete files from vendor libraries'
find $plugin_name/vendor -type f -regextype posix-egrep -iregex ".*\/*\.(markdown|md|txt)" -print0 | xargs -0 rm -f
find $plugin_name/vendor -type f -regextype posix-egrep -iregex ".*\/(readme|license|version|changes|changelog)" -print0 | xargs -0 rm -f
find $plugin_name/vendor -type d -regextype posix-egrep -iregex ".*\/(docs?|examples?|\.git)" -print0 | xargs -0 rm -rf
# Remove unit tests from 3rd party extensions
echo '[BUILD] Removing unit tests from vendor libraries'
rm -rf $plugin_name/vendor/twig/twig/test
rm -rf $plugin_name/vendor/symfony/translation/Tests
rm -rf $plugin_name/vendor/phpmailer/phpmailer/test
rm -rf $plugin_name/vendor/soundasleep/html2text/tests
rm -rf $plugin_name/vendor/mtdowling/cron-expression/tests
rm -rf $plugin_name/vendor/swiftmailer/swiftmailer/tests
rm -rf $plugin_name/vendor/cerdic/css-tidy/testing
# Remove risky files from 3rd party extensions
echo '[BUILD] Removing risky and demo files from vendor libraries'
rm -f $plugin_name/vendor/j4mie/idiorm/demo.php
rm -f $plugin_name/vendor/cerdic/css-tidy/css_optimiser.php
# Copy release files.
cp LICENSE $plugin_name
echo '[BUILD] Copying release files'
cp license.txt $plugin_name
cp index.php $plugin_name
cp $plugin_name.php $plugin_name
cp readme.txt $plugin_name
cp uninstall.php $plugin_name
# Add index files if they don't exist to all folders
echo '[BUILD] Adding index files to all project folders'
find $plugin_name -type d -exec touch {}/index.php \;
# Zip final release.
echo '[BUILD] Creating final release zip'
zip -r $plugin_name.zip $plugin_name
# Remove temp dir.
echo '[BUILD] Removing temp directory'
rm -rf $plugin_name
# Reinstall dev dependencies.
echo '[BUILD] Reinstalling dev dependencies'
./composer.phar install
echo '[BUILD] Build finished!'

View File

@ -17,7 +17,8 @@ dependencies:
- sudo a2enmod rewrite
- sudo service apache2 restart
# install Phoenix dependencies
- composer install
- curl -sS https://getcomposer.org/installer | php
- ./composer.phar install
- ./do install
# Set up Wordpress
# No password is required for the MySQL user `ubuntu`
@ -46,6 +47,10 @@ dependencies:
## tests override
test:
override:
# Add default timezone to PHP's configuration (required for PHP >=5.4)
- echo "date.timezone = UTC" > /opt/circleci/php/$(phpenv global)/etc/conf.d/date.ini
# Run QA scripts
- ./do qa
# Run JS tests
- mkdir $CIRCLE_TEST_REPORTS/mocha
- ./do t:j $CIRCLE_TEST_REPORTS/mocha/junit.xml

View File

@ -27,6 +27,7 @@ coverage:
include:
- lib/*
exclude:
- lib/Config/PopulatorData/*
- lib/Util/Sudzy/*
- lib/Util/CSS.php
- lib/Util/Helpers.php

View File

@ -8,13 +8,10 @@
"require": {
"php": ">=5.3.3",
"twig/twig": "1.*",
"phpmailer/phpmailer": "~5.2",
"cerdic/css-tidy": "*",
"sunra/php-simple-html-dom-parser": "*",
"tburry/pquery": "*",
"j4mie/paris": "1.5.4",
"swiftmailer/swiftmailer": "^5.4",
"phpseclib/phpseclib": "*",
"mtdowling/cron-expression": "^1.1",
"nesbot/carbon": "^1.21",
"soundasleep/html2text": "dev-master"
@ -26,12 +23,18 @@
"vlucas/phpdotenv": "*",
"umpirsky/twig-gettext-extractor": "1.1.*",
"raveren/kint": "^1.0",
"squizlabs/php_codesniffer": "2.*"
"squizlabs/php_codesniffer": "*",
"wimg/php-compatibility": "*",
"simplyadmire/composer-plugins" : "@dev"
},
"autoload": {
"psr-4": {
"MailPoet\\": "lib/",
"Sudzy\\": "lib/Util/Sudzy"
}
},
"scripts": {
"post-update-cmd": "rm -rf vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility; cp -rpd vendor/wimg/php-compatibility vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility",
"post-install-cmd": "rm -rf vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility; cp -rpd vendor/wimg/php-compatibility vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility"
}
}
}

841
composer.lock generated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,44 @@
<?php
namespace MailPoet\API;
use \MailPoet\Util\Security;
if(!defined('ABSPATH')) exit;
class API {
private $_endpoint;
private $_method;
private $_token;
private $_endpoint_class;
private $_data = array();
function init() {
// security token
// Admin Security token
add_action(
'admin_head',
array($this, 'setToken')
);
// Admin API (Ajax only)
// ajax (logged in users)
add_action(
'wp_ajax_mailpoet',
array($this, 'setupAdmin')
array($this, 'setupAjax')
);
// Public API (Ajax)
// ajax (logged out users)
add_action(
'wp_ajax_nopriv_mailpoet',
array($this, 'setupPublic')
array($this, 'setupAjax')
);
}
function setupAdmin() {
function setupAjax() {
$this->getRequestData();
if($this->checkToken() === false) {
$error_response = new ErrorResponse(
array(
Error::UNAUTHORIZED => __('You need to specify a valid API token.')
Error::UNAUTHORIZED => __('Invalid request.', 'mailpoet')
),
array(),
Response::STATUS_UNAUTHORIZED
@ -38,55 +46,84 @@ class API {
$error_response->send();
}
if($this->checkPermissions() === false) {
$error_response = new ErrorResponse(
array(
Error::FORBIDDEN => __('You do not have the required permissions.')
),
array(),
Response::STATUS_FORBIDDEN
);
$error_response->send();
}
$this->processRoute();
}
function setupPublic() {
if($this->checkToken() === false) {
function getRequestData() {
$this->_endpoint = isset($_POST['endpoint'])
? trim($_POST['endpoint'])
: null;
$this->_method = isset($_POST['method'])
? trim($_POST['method'])
: null;
$this->_token = isset($_POST['token'])
? trim($_POST['token'])
: null;
if(!$this->_endpoint || !$this->_method) {
// throw exception bad request
$error_response = new ErrorResponse(
array(
Error::UNAUTHORIZED => __('You need to specify a valid API token.')
Error::BAD_REQUEST => __('Invalid request.', 'mailpoet')
),
array(),
Response::STATUS_UNAUTHORIZED
Response::STATUS_BAD_REQUEST
);
$error_response->send();
}
} else {
$this->_endpoint_class = (
__NAMESPACE__."\\Endpoints\\".ucfirst($this->_endpoint)
);
$this->processRoute();
$this->_data = isset($_POST['data'])
? stripslashes_deep($_POST['data'])
: array();
// remove reserved keywords from data
if(is_array($this->_data) && !empty($this->_data)) {
// filter out reserved keywords from data
$reserved_keywords = array(
'token',
'endpoint',
'method',
'mailpoet_redirect'
);
$this->_data = array_diff_key(
$this->_data,
array_flip($reserved_keywords)
);
}
}
}
function processRoute() {
$class = ucfirst($_POST['endpoint']);
$endpoint = __NAMESPACE__ . "\\Endpoints\\" . $class;
$method = $_POST['method'];
$data = isset($_POST['data']) ? stripslashes_deep($_POST['data']) : array();
if(is_array($data) && !empty($data)) {
// filter out reserved keywords from data
$reserved_keywords = array(
'token',
'endpoint',
'method',
'mailpoet_redirect'
);
$data = array_diff_key($data, array_flip($reserved_keywords));
}
try {
$endpoint = new $endpoint();
$response = $endpoint->$method($data);
$endpoint = new $this->_endpoint_class();
// check the accessibility of the requested endpoint's action
// by default, an endpoint's action is considered "private"
$permissions = $endpoint->permissions;
if(
array_key_exists($this->_method, $permissions) === false
||
$permissions[$this->_method] !== Access::ALL
) {
if($this->checkPermissions() === false) {
$error_response = new ErrorResponse(
array(
Error::FORBIDDEN => __(
'You do not have the required permissions.',
'mailpoet'
)
),
array(),
Response::STATUS_FORBIDDEN
);
$error_response->send();
}
}
$response = $endpoint->{$this->_method}($this->_data);
$response->send();
} catch(\Exception $e) {
$error_response = new ErrorResponse(
@ -96,22 +133,20 @@ class API {
}
}
function setToken() {
$global = '<script type="text/javascript">';
$global .= 'var mailpoet_token = "'.Security::generateToken().'";';
$global .= '</script>';
echo $global;
}
function checkPermissions() {
return current_user_can('manage_options');
}
function checkToken() {
return (
isset($_POST['token'])
&&
wp_verify_nonce($_POST['token'], 'mailpoet_token')
);
return wp_verify_nonce($this->_token, 'mailpoet_token');
}
function setToken() {
$global = '<script type="text/javascript">';
$global .= 'var mailpoet_token = "';
$global .= Security::generateToken();
$global .= '";';
$global .= '</script>';
echo $global;
}
}

12
lib/API/Access.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace MailPoet\API;
if(!defined('ABSPATH')) exit;
final class Access {
const ALL = 'all';
private function __construct() {
}
}

View File

@ -5,6 +5,8 @@ if(!defined('ABSPATH')) exit;
abstract class Endpoint {
public $permissions = array();
function successResponse(
$data = array(), $meta = array(), $status = Response::STATUS_OK
) {
@ -16,7 +18,7 @@ abstract class Endpoint {
) {
if(empty($errors)) {
$errors = array(
Error::UNKNOWN => __('An unknown error occurred.')
Error::UNKNOWN => __('An unknown error occurred.', 'mailpoet')
);
}
return new ErrorResponse($errors, $meta, $status);
@ -25,7 +27,7 @@ abstract class Endpoint {
function badRequest($errors = array(), $meta = array()) {
if(empty($errors)) {
$errors = array(
Error::BAD_REQUEST => __('Invalid request parameters.')
Error::BAD_REQUEST => __('Invalid request parameters.', 'mailpoet')
);
}
return new ErrorResponse($errors, $meta, Response::STATUS_BAD_REQUEST);

View File

@ -21,7 +21,7 @@ class CustomFields extends APIEndpoint {
$custom_field = CustomField::findOne($id);
if($custom_field === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This custom field does not exist.')
APIError::NOT_FOUND => __('This custom field does not exist.', 'mailpoet')
));
} else {
$custom_field->delete();
@ -48,7 +48,7 @@ class CustomFields extends APIEndpoint {
$custom_field = CustomField::findOne($id);
if($custom_field === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This custom field does not exist.')
APIError::NOT_FOUND => __('This custom field does not exist.', 'mailpoet')
));
} else {
return $this->successResponse($custom_field->asArray());

View File

@ -17,7 +17,7 @@ class Forms extends APIEndpoint {
$form = Form::findOne($id);
if($form === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This form does not exist.')
APIError::NOT_FOUND => __('This form does not exist.', 'mailpoet')
));
} else {
return $this->successResponse($form->asArray());
@ -57,31 +57,31 @@ class Forms extends APIEndpoint {
function create() {
// create new form
$form_data = array(
'name' => __('New form'),
'name' => __('New form', 'mailpoet'),
'body' => array(
array(
'id' => 'email',
'name' => __('Email'),
'name' => __('Email', 'mailpoet'),
'type' => 'text',
'static' => true,
'params' => array(
'label' => __('Email'),
'label' => __('Email', 'mailpoet'),
'required' => true
)
),
array(
'id' => 'submit',
'name' => __('Submit'),
'name' => __('Submit', 'mailpoet'),
'type' => 'submit',
'static' => true,
'params' => array(
'label' => __('Subscribe!')
'label' => __('Subscribe!', 'mailpoet')
)
)
),
'settings' => array(
'on_success' => 'message',
'success_message' => __('Check your inbox or spam folder to confirm your subscription.'),
'success_message' => __('Check your inbox or spam folder to confirm your subscription.', 'mailpoet'),
'segments' => null,
'segments_selected_by' => 'admin'
)
@ -124,7 +124,7 @@ class Forms extends APIEndpoint {
$form = Form::findOne($id);
if($form === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This form does not exist.')
APIError::NOT_FOUND => __('This form does not exist.', 'mailpoet')
));
} else {
$exports = Util\Export::getAll($form->asArray());
@ -136,7 +136,7 @@ class Forms extends APIEndpoint {
$id = (isset($data['id']) ? (int)$data['id'] : false);
$form_id = (isset($data['id']) ? (int)$data['id'] : 0);
$name = (isset($data['name']) ? $data['name'] : __('New form'));
$name = (isset($data['name']) ? $data['name'] : __('New form', 'mailpoet'));
$body = (isset($data['body']) ? $data['body'] : array());
$settings = (isset($data['settings']) ? $data['settings'] : array());
$styles = (isset($data['styles']) ? $data['styles'] : '');
@ -206,7 +206,7 @@ class Forms extends APIEndpoint {
$form = Form::findOne($id);
if($form === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This form does not exist.')
APIError::NOT_FOUND => __('This form does not exist.', 'mailpoet')
));
} else {
$form->restore();
@ -222,7 +222,7 @@ class Forms extends APIEndpoint {
$form = Form::findOne($id);
if($form === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This form does not exist.')
APIError::NOT_FOUND => __('This form does not exist.', 'mailpoet')
));
} else {
$form->trash();
@ -238,7 +238,7 @@ class Forms extends APIEndpoint {
$form = Form::findOne($id);
if($form === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This form does not exist.')
APIError::NOT_FOUND => __('This form does not exist.', 'mailpoet')
));
} else {
$form->delete();
@ -252,11 +252,11 @@ class Forms extends APIEndpoint {
if($form === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This form does not exist.')
APIError::NOT_FOUND => __('This form does not exist.', 'mailpoet')
));
} else {
$data = array(
'name' => sprintf(__('Copy of %s'), $form->name)
'name' => sprintf(__('Copy of %s', 'mailpoet'), $form->name)
);
$duplicate = $form->duplicate($data);
$errors = $duplicate->getErrors();

View File

@ -22,7 +22,7 @@ class Mailer extends APIEndpoint {
if($result === false) {
return $this->errorResponse(array(
APIError::BAD_REQUEST => __("The email could not be sent. Please check your settings.")
APIError::BAD_REQUEST => __("The email could not be sent. Please check your settings.", 'mailpoet')
));
} else {
return $this->successResponse(null);

View File

@ -13,7 +13,7 @@ class NewsletterTemplates extends APIEndpoint {
$template = NewsletterTemplate::findOne($id);
if($template === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This template does not exist.')
APIError::NOT_FOUND => __('This template does not exist.', 'mailpoet')
));
} else {
return $this->successResponse(
@ -49,7 +49,7 @@ class NewsletterTemplates extends APIEndpoint {
$template = NewsletterTemplate::findOne($id);
if($template === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This template does not exist.')
APIError::NOT_FOUND => __('This template does not exist.', 'mailpoet')
));
} else {
$template->delete();

View File

@ -27,7 +27,7 @@ class Newsletters extends APIEndpoint {
$newsletter = Newsletter::findOne($id);
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
return $this->successResponse(
@ -40,9 +40,9 @@ class Newsletters extends APIEndpoint {
}
function save($data = array()) {
$segment_ids = array();
$segments = array();
if(isset($data['segments'])) {
$segment_ids = $data['segments'];
$segments = $data['segments'];
unset($data['segments']);
}
@ -58,13 +58,14 @@ class Newsletters extends APIEndpoint {
if(!empty($errors)) {
return $this->badRequest($errors);
} else {
if(!empty($segment_ids)) {
if(!empty($segments)) {
NewsletterSegment::where('newsletter_id', $newsletter->id)
->deleteMany();
foreach($segment_ids as $segment_id) {
foreach($segments as $segment) {
if(!is_array($segment)) continue;
$relation = NewsletterSegment::create();
$relation->segment_id = $segment_id;
$relation->segment_id = (int)$segment['id'];
$relation->newsletter_id = $newsletter->id;
$relation->save();
}
@ -90,9 +91,14 @@ class Newsletters extends APIEndpoint {
}
}
return $this->successResponse(
Newsletter::findOne($newsletter->id)->asArray()
);
$newsletter = Newsletter::filter('filterWithOptions')->findOne($newsletter->id);
// if this is a post notification, process options and update its schedule
if($newsletter->type === Newsletter::TYPE_NOTIFICATION) {
Scheduler::processPostNotificationSchedule($newsletter);
}
return $this->successResponse($newsletter->asArray());
}
}
@ -101,7 +107,7 @@ class Newsletters extends APIEndpoint {
if(!$status) {
return $this->badRequest(array(
APIError::BAD_REQUEST => __('You need to specify a status.')
APIError::BAD_REQUEST => __('You need to specify a status.', 'mailpoet')
));
}
@ -110,7 +116,7 @@ class Newsletters extends APIEndpoint {
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
}
@ -131,7 +137,7 @@ class Newsletters extends APIEndpoint {
$newsletter = Newsletter::findOne($id);
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
$newsletter->restore();
@ -147,7 +153,7 @@ class Newsletters extends APIEndpoint {
$newsletter = Newsletter::findOne($id);
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
$newsletter->trash();
@ -163,7 +169,7 @@ class Newsletters extends APIEndpoint {
$newsletter = Newsletter::findOne($id);
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
$newsletter->delete();
@ -177,11 +183,11 @@ class Newsletters extends APIEndpoint {
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
$data = array(
'subject' => sprintf(__('Copy of %s'), $newsletter->subject)
'subject' => sprintf(__('Copy of %s', 'mailpoet'), $newsletter->subject)
);
$duplicate = $newsletter->duplicate($data);
$errors = $duplicate->getErrors();
@ -200,7 +206,7 @@ class Newsletters extends APIEndpoint {
function showPreview($data = array()) {
if(empty($data['body'])) {
return $this->badRequest(array(
APIError::BAD_REQUEST => __('Newsletter data is missing.')
APIError::BAD_REQUEST => __('Newsletter data is missing.', 'mailpoet')
));
}
@ -209,7 +215,7 @@ class Newsletters extends APIEndpoint {
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
$newsletter->body = $data['body'];
@ -229,7 +235,7 @@ class Newsletters extends APIEndpoint {
function sendPreview($data = array()) {
if(empty($data['subscriber'])) {
return $this->badRequest(array(
APIError::BAD_REQUEST => __('Please specify receiver information.')
APIError::BAD_REQUEST => __('Please specify receiver information.', 'mailpoet')
));
}
@ -238,7 +244,7 @@ class Newsletters extends APIEndpoint {
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
$newsletter = $newsletter->asArray();

View File

@ -17,7 +17,7 @@ class Segments extends APIEndpoint {
$segment = Segment::findOne($id);
if($segment === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This list does not exist.')
APIError::NOT_FOUND => __('This list does not exist.', 'mailpoet')
));
} else {
return $this->successResponse($segment->asArray());
@ -68,7 +68,7 @@ class Segments extends APIEndpoint {
$segment = Segment::findOne($id);
if($segment === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This list does not exist.')
APIError::NOT_FOUND => __('This list does not exist.', 'mailpoet')
));
} else {
$segment->restore();
@ -84,7 +84,7 @@ class Segments extends APIEndpoint {
$segment = Segment::findOne($id);
if($segment === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This list does not exist.')
APIError::NOT_FOUND => __('This list does not exist.', 'mailpoet')
));
} else {
$segment->trash();
@ -100,7 +100,7 @@ class Segments extends APIEndpoint {
$segment = Segment::findOne($id);
if($segment === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This list does not exist.')
APIError::NOT_FOUND => __('This list does not exist.', 'mailpoet')
));
} else {
$segment->delete();
@ -114,11 +114,11 @@ class Segments extends APIEndpoint {
if($segment === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This list does not exist.')
APIError::NOT_FOUND => __('This list does not exist.', 'mailpoet')
));
} else {
$data = array(
'name' => sprintf(__('Copy of %s'), $segment->name)
'name' => sprintf(__('Copy of %s', 'mailpoet'), $segment->name)
);
$duplicate = $segment->duplicate($data);
$errors = $duplicate->getErrors();

View File

@ -29,7 +29,7 @@ class SendingQueue extends APIEndpoint {
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
}
@ -49,7 +49,7 @@ class SendingQueue extends APIEndpoint {
if(!empty($queue)) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter is already being sent.')
APIError::NOT_FOUND => __('This newsletter is already being sent.', 'mailpoet')
));
}
@ -83,7 +83,7 @@ class SendingQueue extends APIEndpoint {
$subscribers = array_unique($subscribers);
if(!count($subscribers)) {
return $this->errorResponse(array(
APIError::UNKNOWN => __('There are no subscribers in that list!')
APIError::UNKNOWN => __('There are no subscribers in that list!', 'mailpoet')
));
}
$queue->status = null;
@ -119,14 +119,14 @@ class SendingQueue extends APIEndpoint {
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
$queue = $newsletter->getQueue();
if($queue === false) {
return $this->errorResponse(array(
APIError::UNKNOWN => __('This newsletter has not been sent yet.')
APIError::UNKNOWN => __('This newsletter has not been sent yet.', 'mailpoet')
));
} else {
$queue->pause();
@ -145,14 +145,14 @@ class SendingQueue extends APIEndpoint {
$newsletter = Newsletter::findOne($newsletter_id);
if($newsletter === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This newsletter does not exist.')
APIError::NOT_FOUND => __('This newsletter does not exist.', 'mailpoet')
));
} else {
$queue = $newsletter->getQueue();
if($queue === false) {
return $this->errorResponse(array(
APIError::UNKNOWN => __('This newsletter has not been sent yet.')
APIError::UNKNOWN => __('This newsletter has not been sent yet.', 'mailpoet')
));
} else {
$queue->resume();

View File

@ -15,7 +15,7 @@ class Settings extends APIEndpoint {
if(empty($settings)) {
return $this->badRequest(array(
APIError::BAD_REQUEST =>
__("You have not specified any settings to be saved.")
__("You have not specified any settings to be saved.", 'mailpoet')
));
} else {
foreach($settings as $name => $value) {

View File

@ -2,6 +2,7 @@
namespace MailPoet\API\Endpoints;
use \MailPoet\API\Endpoint as APIEndpoint;
use \MailPoet\API\Error as APIError;
use \MailPoet\API\Access as APIAccess;
use MailPoet\Listing;
use MailPoet\Models\Subscriber;
@ -15,12 +16,17 @@ use MailPoet\Models\StatisticsForms;
if(!defined('ABSPATH')) exit;
class Subscribers extends APIEndpoint {
public $permissions = array(
'subscribe' => APIAccess::ALL
);
function get($data = array()) {
$id = (isset($data['id']) ? (int)$data['id'] : false);
$subscriber = Subscriber::findOne($id);
if($subscriber === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This subscriber does not exist.')
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet')
));
} else {
return $this->successResponse(
@ -67,7 +73,7 @@ class Subscribers extends APIEndpoint {
if(empty($segment_ids)) {
return $this->badRequest(array(
APIError::BAD_REQUEST => __('Please select a list')
APIError::BAD_REQUEST => __('Please select a list', 'mailpoet')
));
}
@ -118,7 +124,7 @@ class Subscribers extends APIEndpoint {
$subscriber = Subscriber::findOne($id);
if($subscriber === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This subscriber does not exist.')
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet')
));
} else {
$subscriber->restore();
@ -134,7 +140,7 @@ class Subscribers extends APIEndpoint {
$subscriber = Subscriber::findOne($id);
if($subscriber === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This subscriber does not exist.')
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet')
));
} else {
$subscriber->trash();
@ -150,7 +156,7 @@ class Subscribers extends APIEndpoint {
$subscriber = Subscriber::findOne($id);
if($subscriber === false) {
return $this->errorResponse(array(
APIError::NOT_FOUND => __('This subscriber does not exist.')
APIError::NOT_FOUND => __('This subscriber does not exist.', 'mailpoet')
));
} else {
$subscriber->delete();

View File

@ -27,7 +27,6 @@ class Env {
static $db_password;
static $db_charset;
static $db_timezone_offset;
static $subscribers_limit = 2000;
static function init($file, $version) {
global $wpdb;
@ -39,11 +38,11 @@ class Env {
self::$assets_path = self::$path . '/assets';
self::$assets_url = plugins_url('/assets', $file);
$wp_upload_dir = wp_upload_dir();
self::$temp_path = $wp_upload_dir['basedir'].'/'.self::$plugin_name;
self::$temp_path = $wp_upload_dir['basedir'] . '/' . self::$plugin_name;
if(!is_dir(self::$temp_path)) {
mkdir(self::$temp_path);
}
self::$temp_url = $wp_upload_dir['baseurl'].'/'.self::$plugin_name;
self::$temp_url = $wp_upload_dir['baseurl'] . '/' . self::$plugin_name;
self::$languages_path = self::$path . '/lang';
self::$lib_path = self::$path . '/lib';
self::$plugin_prefix = 'mailpoet_';

View File

@ -148,7 +148,7 @@ class Hooks {
function appendImageSize($sizes) {
return array_merge($sizes, array(
'mailpoet_newsletter_max' => __('MailPoet Newsletter')
'mailpoet_newsletter_max' => __('MailPoet Newsletter', 'mailpoet')
));
}

View File

@ -4,6 +4,7 @@ namespace MailPoet\Config;
use MailPoet\Cron\CronTrigger;
use MailPoet\Router;
use MailPoet\API;
use MailPoet\Util\License\License as License;
use MailPoet\WP\Notice as WPNotice;
if(!defined('ABSPATH')) exit;
@ -116,6 +117,7 @@ class Initializer {
function onInit() {
if(!$this->plugin_initialized) {
define('MAILPOET_INITIALIZED', false);
return;
}
@ -126,6 +128,8 @@ class Initializer {
} catch(\Exception $e) {
$this->handleFailedInitialization($e);
}
define('MAILPOET_INITIALIZED', true);
}
function setupWidget() {
@ -206,4 +210,4 @@ class Initializer {
function handleFailedInitialization($message) {
return WPNotice::displayError($message);
}
}
}

View File

@ -25,8 +25,6 @@ class Localizer {
$language_path =
Env::$languages_path
. '/'
. Env::$plugin_name
. '-'
. $this->locale()
. '.mo';
load_textdomain(Env::$plugin_name, $language_path);

View File

@ -14,6 +14,7 @@ use MailPoet\Settings\Hosts;
use MailPoet\Settings\Pages;
use MailPoet\Subscribers\ImportExport\ImportExportFactory;
use MailPoet\Listing;
use MailPoet\Util\License\Features\Subscribers as SubscribersFeature;
use MailPoet\WP\DateTime;
if(!defined('ABSPATH')) exit;
@ -22,6 +23,8 @@ class Menu {
function __construct($renderer, $assets_url) {
$this->renderer = $renderer;
$this->assets_url = $assets_url;
$subscribers_feature = new SubscribersFeature();
$this->subscribers_over_limit = $subscribers_feature->check();
}
function init() {
@ -34,16 +37,6 @@ class Menu {
);
}
function checkSubscribersLimit() {
$subscribers_count = Subscriber::getTotalSubscribers();
if($subscribers_count > Env::$subscribers_limit) {
echo $this->renderer->render('limit.html', array(
'limit' => Env::$subscribers_limit
));
exit;
}
}
function setup() {
$main_page_slug = 'mailpoet-newsletters';
@ -59,8 +52,8 @@ class Menu {
$newsletters_page = add_submenu_page(
$main_page_slug,
$this->setPageTitle(__('Newsletters')),
__('Newsletters'),
$this->setPageTitle(__('Emails', 'mailpoet')),
__('Emails', 'mailpoet'),
'manage_options',
$main_page_slug,
array($this, 'newsletters')
@ -79,8 +72,8 @@ class Menu {
$forms_page = add_submenu_page(
$main_page_slug,
$this->setPageTitle(__('Forms')),
__('Forms'),
$this->setPageTitle(__('Forms', 'mailpoet')),
__('Forms', 'mailpoet'),
'manage_options',
'mailpoet-forms',
array($this, 'forms')
@ -98,8 +91,8 @@ class Menu {
$subscribers_page = add_submenu_page(
$main_page_slug,
$this->setPageTitle(__('Subscribers')),
__('Subscribers'),
$this->setPageTitle(__('Subscribers', 'mailpoet')),
__('Subscribers', 'mailpoet'),
'manage_options',
'mailpoet-subscribers',
array($this, 'subscribers')
@ -117,8 +110,8 @@ class Menu {
$segments_page = add_submenu_page(
$main_page_slug,
$this->setPageTitle(__('Lists')),
__('Lists'),
$this->setPageTitle(__('Lists', 'mailpoet')),
__('Lists', 'mailpoet'),
'manage_options',
'mailpoet-segments',
array($this, 'segments')
@ -137,16 +130,16 @@ class Menu {
add_submenu_page(
$main_page_slug,
$this->setPageTitle( __('Settings')),
__('Settings'),
$this->setPageTitle( __('Settings', 'mailpoet')),
__('Settings', 'mailpoet'),
'manage_options',
'mailpoet-settings',
array($this, 'settings')
);
add_submenu_page(
'admin.php?page=mailpoet-subscribers',
$this->setPageTitle( __('Import')),
__('Import'),
$this->setPageTitle( __('Import', 'mailpoet')),
__('Import', 'mailpoet'),
'manage_options',
'mailpoet-import',
array($this, 'import')
@ -154,8 +147,8 @@ class Menu {
add_submenu_page(
true,
$this->setPageTitle(__('Export')),
__('Export'),
$this->setPageTitle(__('Export', 'mailpoet')),
__('Export', 'mailpoet'),
'manage_options',
'mailpoet-export',
array($this, 'export')
@ -163,8 +156,8 @@ class Menu {
add_submenu_page(
true,
$this->setPageTitle(__('Welcome')),
__('Welcome'),
$this->setPageTitle(__('Welcome', 'mailpoet')),
__('Welcome', 'mailpoet'),
'manage_options',
'mailpoet-welcome',
array($this, 'welcome')
@ -172,8 +165,8 @@ class Menu {
add_submenu_page(
true,
$this->setPageTitle(__('Update')),
__('Update'),
$this->setPageTitle(__('Update', 'mailpoet')),
__('Update', 'mailpoet'),
'manage_options',
'mailpoet-update',
array($this, 'update')
@ -181,8 +174,8 @@ class Menu {
add_submenu_page(
true,
$this->setPageTitle(__('Form Editor')),
__('Form Editor'),
$this->setPageTitle(__('Form Editor', 'mailpoet')),
__('Form Editor', 'mailpoet'),
'manage_options',
'mailpoet-form-editor',
array($this, 'formEditor')
@ -190,8 +183,8 @@ class Menu {
add_submenu_page(
true,
$this->setPageTitle(__('Newsletter')),
__('Newsletter Editor'),
$this->setPageTitle(__('Newsletter', 'mailpoet')),
__('Newsletter Editor', 'mailpoet'),
'manage_options',
'mailpoet-newsletter-editor',
array($this, 'newletterEditor')
@ -252,14 +245,14 @@ class Menu {
}
function settings() {
$this->checkSubscribersLimit();
if ($this->subscribers_over_limit) return $this->displaySubscriberLimitExceededTemplate();
$settings = Setting::getAll();
$flags = $this->_getFlags();
$data = array(
'settings' => $settings,
'segments' => Segment::getPublic()->findArray(),
'segments' => Segment::getSegmentsWithSubscriberCount(),
'cron_trigger' => CronTrigger::getAvailableMethods(),
'pages' => Pages::getAll(),
'flags' => $flags,
@ -303,7 +296,7 @@ class Menu {
$data = array();
$data['items_per_page'] = $this->getLimitPerPage('subscribers');
$data['segments'] = Segment::findArray();
$data['segments'] = Segment::getSegmentsWithSubscriberCount($type = false);
$data['custom_fields'] = array_map(function($field) {
$field['params'] = unserialize($field['params']);
@ -326,7 +319,7 @@ class Menu {
}
function segments() {
$this->checkSubscribersLimit();
if ($this->subscribers_over_limit) return $this->displaySubscriberLimitExceededTemplate();
$data = array();
$data['items_per_page'] = $this->getLimitPerPage('segments');
@ -334,7 +327,7 @@ class Menu {
}
function forms() {
$this->checkSubscribersLimit();
if ($this->subscribers_over_limit) return $this->displaySubscriberLimitExceededTemplate();
$data = array();
@ -345,7 +338,7 @@ class Menu {
}
function newsletters() {
$this->checkSubscribersLimit();
if ($this->subscribers_over_limit) return $this->displaySubscriberLimitExceededTemplate();
global $wp_roles;
@ -355,7 +348,7 @@ class Menu {
$data['segments'] = Segment::getSegmentsWithSubscriberCount($type = false);
$data['settings'] = Setting::getAll();
$data['roles'] = $wp_roles->get_names();
$data['roles']['mailpoet_all'] = __('In any WordPress role');
$data['roles']['mailpoet_all'] = __('In any WordPress role', 'mailpoet');
$date_time = new DateTime();
$data['current_date'] = $date_time->getCurrentDate(DateTime::DEFAULT_DATE_FORMAT);
@ -416,7 +409,7 @@ class Menu {
$data = array(
'form' => $form,
'pages' => Pages::getAll(),
'segments' => Segment::getPublic()->findArray(),
'segments' => Segment::getSegmentsWithSubscriberCount(),
'styles' => FormRenderer::getStyles($form),
'date_types' => Block\Date::getDateTypes(),
'date_formats' => Block\Date::getDateFormats(),
@ -430,7 +423,7 @@ class Menu {
function setPageTitle($title) {
return sprintf(
'%s - %s',
__('MailPoet'),
__('MailPoet', 'mailpoet'),
$title
);
}
@ -447,4 +440,11 @@ class Menu {
? (int)$listing_per_page
: Listing\Handler::DEFAULT_LIMIT_PER_PAGE;
}
}
function displaySubscriberLimitExceededTemplate() {
echo $this->renderer->render('limit.html', array(
'limit' => SubscribersFeature::SUBSCRIBERS_LIMIT
));
exit;
}
}

View File

@ -52,8 +52,9 @@ class Migrator {
function down() {
global $wpdb;
$drop_table = function($model) use($wpdb) {
$table = $this->prefix . $model;
$_this = $this;
$drop_table = function($model) use($wpdb, $_this) {
$table = $_this->prefix . $model;
$wpdb->query("DROP TABLE {$table}");
};

View File

@ -131,9 +131,9 @@ class Populator {
if(Segment::where('type', 'default')->count() === 0) {
$default_segment = Segment::create();
$default_segment->hydrate(array(
'name' => __('My First List'),
'name' => __('My First List', 'mailpoet'),
'description' =>
__('This list is automatically created when you install MailPoet')
__('This list is automatically created when you install MailPoet', 'mailpoet')
));
$default_segment->save();
}
@ -211,13 +211,12 @@ class Populator {
$modelMethod = Helpers::underscoreToCamelCase($model);
$rows = $this->$modelMethod();
$table = $this->prefix . $model;
$_this = $this;
array_map(function($row) use ($_this, $table) {
if(!$_this->rowExists($table, $row)) {
$_this->insertRow($table, $row);
foreach($rows as $row) {
if(!$this->rowExists($table, $row)) {
$this->insertRow($table, $row);
}
}, $rows);
}
}
private function rowExists($table, $columns) {

View File

@ -13,8 +13,8 @@ class FranksRoastHouseTemplate {
function get() {
return array(
'name' => __("Frank's Roast House"),
'description' => __("Think of this as your sandbox. Play around with this example newsletter to see what MailPoet can do for you."),
'name' => __("Frank's Roast House", 'mailpoet'),
'description' => __("Think of this as your sandbox. Play around with this example newsletter to see what MailPoet can do for you.", 'mailpoet'),
'readonly' => 0,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -46,7 +46,7 @@ class FranksRoastHouseTemplate {
"blocks" => array(
array(
"type" => "header",
"text" => __("<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser.</a>"),
"text" => __("<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser.</a>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "#ccc6c6"
@ -67,7 +67,7 @@ class FranksRoastHouseTemplate {
"type" => "image",
"link" => "http://www.example.com",
"src" => $this->template_image_url . "/header-v2.jpg",
"alt" => __("Frank's Café"),
"alt" => __("Frank's Café", 'mailpoet'),
"fullWidth" => true,
"width" => "600px",
"height" => "220px",
@ -88,13 +88,13 @@ class FranksRoastHouseTemplate {
),
array(
"type" => "text",
"text" => __("<p>Hi there&nbsp;[subscriber:firstname | default:coffee drinker]</p>\n<p></p>\n<p>Sit back&nbsp;and enjoy your favorite roast as you read this week's newsletter.&nbsp;</p>")
"text" => __("<p>Hi there [subscriber:firstname | default:coffee drinker]</p>\n<p></p>\n<p>Sit back and enjoy your favorite roast as you read this week's newsletter. </p>", 'mailpoet')
),
array(
"type" => "image",
"link" => "http://example.org",
"src" => $this->template_image_url . "/coffee-grain.jpg",
"alt" => __("coffee-grain-3-1329675-1599x941"),
"alt" => __('Coffee grain', 'mailpoet'),
"fullWidth" => false,
"width" => "1599px",
"height" => "777px",
@ -106,7 +106,7 @@ class FranksRoastHouseTemplate {
),
array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\">--- Guest Coffee Roaster: <em>Brew Bros. ---</em></h1>\n<p><em></em></p>\n<p>Visit our Center Avenue store to try the latest guest coffee from Brew Bros, a local coffee roaster. This young duo started only two years ago, but have quickly gained&nbsp;popularity through pop-up shops, local events, and collaborations with food trucks.</p>\n<p></p>\n<blockquote>\n<p><span style=\"color: #ff6600;\"><em>Tasting notes: A rich, caramel flavor with subtle hints of molasses. The perfect wake-up morning espresso!</em></span></p>\n</blockquote>")
"text" => __("<h1 style=\"text-align: center;\">--- Guest Coffee Roaster: <em>Brew Bros. ---</em></h1>\n<p><em></em></p>\n<p>Visit our Center Avenue store to try the latest guest coffee from Brew Bros, a local coffee roaster. This young duo started only two years ago, but have quickly gained popularity through pop-up shops, local events, and collaborations with food trucks.</p>\n<p></p>\n<blockquote>\n<p><span style=\"color: #ff6600;\"><em>Tasting notes: A rich, caramel flavor with subtle hints of molasses. The perfect wake-up morning espresso!</em></span></p>\n</blockquote>", 'mailpoet')
)
)
)
@ -132,13 +132,13 @@ class FranksRoastHouseTemplate {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h2>Sandwich Competition</h2>")
"text" => __("<h2>Sandwich Competition</h2>", 'mailpoet')
),
array(
"type" => "image",
"link" => "http://example.org",
"src" => $this->template_image_url . "/sandwich.jpg",
"alt" => "sandwich",
"alt" => __('Sandwich', 'mailpoet'),
"fullWidth" => false,
"width" => "640px",
"height" => "344px",
@ -150,7 +150,7 @@ class FranksRoastHouseTemplate {
),
array(
"type" => "text",
"text" => __("<p>Have an idea for the Next Great Sandwich? Tell us! We're offering free lunch for a month if you can invent an awesome new sandwich for our menu.</p>\n<p></p>\n<p></p>\n<p>Simply tweet your ideas to <a href=\"http://www.example.com\" title=\"This isn't a real twitter account\">@franksroasthouse</a> and use #sandwichcomp and we'll let you know if you're a winner.</p>")
"text" => __("<p>Have an idea for the Next Great Sandwich? Tell us! We're offering free lunch for a month if you can invent an awesome new sandwich for our menu.</p>\n<p></p>\n<p></p>\n<p>Simply tweet your ideas to <a href=\"http://www.example.com\" title=\"This isn't a real twitter account\">@franksroasthouse</a> and use #sandwichcomp and we'll let you know if you're a winner.</p>", 'mailpoet')
),
array(
"type" => "button",
@ -175,7 +175,7 @@ class FranksRoastHouseTemplate {
),
array(
"type" => "text",
"text" => __("<h3 style=\"text-align: center;\">Follow Us</h3>")
"text" => __("<h3 style=\"text-align: center;\">Follow Us</h3>", 'mailpoet')
),
array(
"type" => "social",
@ -232,13 +232,13 @@ class FranksRoastHouseTemplate {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h2>New Store Opening!</h2>")
"text" => __("<h2>New Store Opening!</h2>", 'mailpoet')
),
array(
"type" => "image",
"link" => "http://example.org",
"src" => $this->template_image_url . "/map-v2.jpg",
"alt" => __("map-v2"),
"alt" => __('Map', 'mailpoet'),
"fullWidth" => false,
"width" => "636px",
"height" => "342px",
@ -250,11 +250,11 @@ class FranksRoastHouseTemplate {
),
array(
"type" => "text",
"text" => __("<p>Watch out Broad Street, we're coming to you very soon!&nbsp;</p>\n<p></p>\n<p>Keep an eye on your inbox, as we'll have some special offers for our email subscribers plus an exclusive launch party invite!<br /><br /></p>")
"text" => __("<p>Watch out Broad Street, we're coming to you very soon! </p>\n<p></p>\n<p>Keep an eye on your inbox, as we'll have some special offers for our email subscribers plus an exclusive launch party invite!<br /><br /></p>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<h2>New and Improved Hours!</h2>\n<p></p>\n<p>Frank's is now open even later, so you can get your caffeine fix all day (and night) long! Here's our new opening hours:</p>\n<p></p>\n<ul>\n<li>Monday - Thursday: 6am - 12am</li>\n<li>Friday - Saturday: 6am - 1:30am</li>\n<li>Sunday: 7:30am - 11pm</li>\n</ul>")
"text" => __("<h2>New and Improved Hours!</h2>\n<p></p>\n<p>Frank's is now open even later, so you can get your caffeine fix all day (and night) long! Here's our new opening hours:</p>\n<p></p>\n<ul>\n<li>Monday - Thursday: 6am - 12am</li>\n<li>Friday - Saturday: 6am - 1:30am</li>\n<li>Sunday: 7:30am - 11pm</li>\n</ul>", 'mailpoet')
)
)
)
@ -280,7 +280,7 @@ class FranksRoastHouseTemplate {
"blocks" => array(
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage subscription</a><br />12345 MailPoet Drive, EmailVille, 76543</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage subscription</a><br />12345 MailPoet Drive, EmailVille, 76543</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "#a9a7a7"

View File

@ -13,8 +13,8 @@ class NewsletterBlank121Column {
function get() {
return array(
'name' => __("Newsletter: Blank 1:2:1 Column"),
'description' => __("A blank Newsletter template with a 1:2:1 column layout."),
'name' => __("Newsletter: Blank 1:2:1 Column", 'mailpoet'),
'description' => __("A blank Newsletter template with a 1:2:1 column layout.", 'mailpoet'),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -52,7 +52,7 @@ class NewsletterBlank121Column {
"blocks" => array(
array(
"type" => "header",
"text" => __("Display problems?&nbsp;<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"text" => __("Display problems? <a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"
@ -104,7 +104,7 @@ class NewsletterBlank121Column {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/fake-logo.png",
"alt" => __("Fake logo"),
"alt" => __("Fake logo", 'mailpoet'),
"fullWidth" => false,
"width" => "598px",
"height" => "71px",
@ -116,7 +116,7 @@ class NewsletterBlank121Column {
),
array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p>It's time to design your newsletter! On&nbsp;the right sidebar, you'll find four menu items that will help&nbsp;you&nbsp;customize your&nbsp;newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Layout</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>")
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p>It's time to design your newsletter! On the right sidebar, you'll find four menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Layout</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
),
array(
"type" => "divider",
@ -154,11 +154,11 @@ class NewsletterBlank121Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h2>This template has...</h2>")
"text" => __("<h2>This template has...</h2>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<p>In the right sidebar, you can&nbsp;add layout blocks to your email:</p>\n<ul>\n<li>1 column</li>\n<li>2 columns</li>\n<li>3 columns</li>\n</ul>")
"text" => __("<p>In the right sidebar, you can add layout blocks to your email:</p>\n<ul>\n<li>1 column</li>\n<li>2 columns</li>\n<li>3 columns</li>\n</ul>", 'mailpoet')
)
)
),
@ -173,11 +173,11 @@ class NewsletterBlank121Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h2>... a 2-column layout.</h2>")
"text" => __("<h2>... a 2-column layout.</h2>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<p>You can change a layout's background color by clicking on the settings icon on the right edge of the&nbsp;Designer. Simply hover&nbsp;over this area to see the Settings (gear) icon.</p>")
"text" => __("<p>You can change a layout's background color by clicking on the settings icon on the right edge of the Designer. Simply hover over this area to see the Settings (gear) icon.</p>", 'mailpoet')
)
)
)
@ -237,7 +237,7 @@ class NewsletterBlank121Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h3 style=\"text-align: center;\"><span style=\"font-weight: 600;\">Let's end with&nbsp;a single column.&nbsp;</span></h3>\n<p style=\"line-height: 25.6px;\">In the right sidebar, you can&nbsp;add these layout blocks to your&nbsp;email:</p>\n<p style=\"line-height: 25.6px;\"></p>\n<ul style=\"line-height: 25.6px;\">\n<li>1 column</li>\n<li>2 columns</li>\n<li>3 columns</li>\n</ul>")
"text" => __("<h3 style=\"text-align: center;\"><span style=\"font-weight: 600;\">Let's end with a single column. </span></h3>\n<p style=\"line-height: 25.6px;\">In the right sidebar, you can add these layout blocks to your email:</p>\n<p style=\"line-height: 25.6px;\"></p>\n<ul style=\"line-height: 25.6px;\">\n<li>1 column</li>\n<li>2 columns</li>\n<li>3 columns</li>\n</ul>", 'mailpoet')
)
)
)
@ -311,7 +311,7 @@ class NewsletterBlank121Column {
),
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class NewsletterBlank12Column {
function get() {
return array(
'name' => __("Newsletter: Blank 1:2 Column"),
'description' => __("A blank Newsletter template with a 1:2 column layout."),
'name' => __("Newsletter: Blank 1:2 Column", 'mailpoet'),
'description' => __("A blank Newsletter template with a 1:2 column layout.", 'mailpoet'),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -52,7 +52,7 @@ class NewsletterBlank12Column {
"blocks" => array(
array(
"type" => "header",
"text" => __("Display problems?&nbsp;<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"text" => __("Display problems? <a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"
@ -104,7 +104,7 @@ class NewsletterBlank12Column {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/fake-logo.png",
"alt" => __("Fake Logo"),
"alt" => __("Fake Logo", 'mailpoet'),
"fullWidth" => false,
"width" => "598px",
"height" => "71px",
@ -116,7 +116,7 @@ class NewsletterBlank12Column {
),
array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will&nbsp;help you customize your&nbsp;newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Layout</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>")
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Layout</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
),
array(
"type" => "divider",
@ -154,11 +154,11 @@ class NewsletterBlank12Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h2>This template has...</h2>")
"text" => __("<h2>This template has...</h2>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<p>In the right sidebar, you can&nbsp;add these layout blocks to your email:</p>\n<ul>\n<li>1 column</li>\n<li>2 columns</li>\n<li>3 columns</li>\n</ul>")
"text" => __("<p>In the right sidebar, you can add these layout blocks to your email:</p>\n<ul>\n<li>1 column</li>\n<li>2 columns</li>\n<li>3 columns</li>\n</ul>", 'mailpoet')
)
)
),
@ -173,11 +173,11 @@ class NewsletterBlank12Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h2>... a 2-column layout.</h2>")
"text" => __("<h2>... a 2-column layout.</h2>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<p><span style=\"line-height: 25.6px;\">You can change a layout's background color by clicking on the settings icon on the right edge of the Designer. Simply hover&nbsp;over this area to see the Settings (gear) icon.</span></p>")
"text" => __("<p><span style=\"line-height: 25.6px;\">You can change a layout's background color by clicking on the settings icon on the right edge of the Designer. Simply hover over this area to see the Settings (gear) icon.</span></p>", 'mailpoet')
)
)
)
@ -251,7 +251,7 @@ class NewsletterBlank12Column {
),
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class NewsletterBlank13Column {
function get() {
return array(
'name' => __("Newsletter: Blank 1:3 Column"),
'description' => __("A blank Newsletter template with a 1:3 column layout."),
'name' => __("Newsletter: Blank 1:3 Column", 'mailpoet'),
'description' => __("A blank Newsletter template with a 1:3 column layout.", 'mailpoet'),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -52,7 +52,7 @@ class NewsletterBlank13Column {
"blocks" => array(
array(
"type" => "header",
"text" => __("Display problems?&nbsp;<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"text" => __("Display problems? <a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"
@ -104,7 +104,7 @@ class NewsletterBlank13Column {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/fake-logo.png",
"alt" => __("Fake logo"),
"alt" => __("Fake logo", 'mailpoet'),
"fullWidth" => false,
"width" => "598px",
"height" => "71px",
@ -116,7 +116,7 @@ class NewsletterBlank13Column {
),
array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!&nbsp;</strong></h1>\n<p></p>\n<p>It's time to design your newsletter! On&nbsp;the right sidebar, you'll find four menu items that will help&nbsp;you&nbsp;customize your&nbsp;newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Layout</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>")
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p></p>\n<p>It's time to design your newsletter! On the right sidebar, you'll find four menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Layout</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
),
array(
"type" => "divider",
@ -154,11 +154,11 @@ class NewsletterBlank13Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h3>This template...&nbsp;</h3>")
"text" => __("<h3>This template... </h3>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<p>In the right sidebar, you can&nbsp;add layout blocks to your newsletter.</p>")
"text" => __("<p>In the right sidebar, you can add layout blocks to your newsletter.</p>", 'mailpoet')
)
)
),
@ -173,11 +173,11 @@ class NewsletterBlank13Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h3>... has&nbsp;a...&nbsp;</h3>")
"text" => __("<h3>... has a... </h3>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<p>You have the choice of:</p>\n<ul>\n<li>1 column</li>\n<li>2 columns</li>\n<li>3 columns</li>\n</ul>")
"text" => __("<p>You have the choice of:</p>\n<ul>\n<li>1 column</li>\n<li>2 columns</li>\n<li>3 columns</li>\n</ul>", 'mailpoet')
)
)
),
@ -192,11 +192,11 @@ class NewsletterBlank13Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h3>3-column layout.</h3>")
"text" => __("<h3>3-column layout.</h3>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<p>You can add as many layout blocks as you want!</p>")
"text" => __("<p>You can add as many layout blocks as you want!</p>", 'mailpoet')
),
array(
"type" => "text",
@ -274,7 +274,7 @@ class NewsletterBlank13Column {
),
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class NewsletterBlank1Column {
function get() {
return array(
'name' => __("Newsletter: Blank 1 Column"),
'description' => __("A blank Newsletter template with a 1 column layout."),
'name' => __("Newsletter: Blank 1 Column", 'mailpoet'),
'description' => __("A blank Newsletter template with a 1 column layout.", 'mailpoet'),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -52,7 +52,7 @@ class NewsletterBlank1Column {
"blocks" => array(
array(
"type" => "header",
"text" => __("Display problems?&nbsp;<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"text" => __("Display problems? <a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"
@ -104,7 +104,7 @@ class NewsletterBlank1Column {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/fake-logo.png",
"alt" => __("Fake logo"),
"alt" => __("Fake logo", 'mailpoet'),
"fullWidth" => false,
"width" => "598px",
"height" => "71px",
@ -116,7 +116,7 @@ class NewsletterBlank1Column {
),
array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!&nbsp;</strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will&nbsp;help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Layout</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>")
"text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p></p>\n<p>It's time to design your newsletter! In the right sidebar, you'll find 4 menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Layout</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
)
)
)
@ -190,7 +190,7 @@ class NewsletterBlank1Column {
),
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class PostNotificationsBlank1Column {
function get() {
return array(
'name' => __("Post Notifications: Blank 1 Column"),
'description' => __("A blank Post Notifications template with a 1 column layout."),
'name' => __("Post Notifications: Blank 1 Column", 'mailpoet'),
'description' => __("A blank Post Notifications template with a 1 column layout.", 'mailpoet'),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -52,7 +52,7 @@ class PostNotificationsBlank1Column {
"blocks" => array(
array(
"type" => "header",
"text" => __("Display problems?&nbsp;<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"text" => __("Display problems? <a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"
@ -116,7 +116,7 @@ class PostNotificationsBlank1Column {
),
array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts!&nbsp;</strong></h1>\n<p></p>\n<p>MailPoet&nbsp;can&nbsp;<span style=\"line-height: 1.6em; background-color: inherit;\"><em>automatically</em>&nbsp;</span><span style=\"line-height: 1.6em; background-color: inherit;\">send your new blog posts to your subscribers.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">Below, you'll find three&nbsp;recent&nbsp;posts, which are displayed automatically, thanks to the&nbsp;<em>Automatic Latest Content</em>&nbsp;widget, which can be found on the right sidebar, under&nbsp;<em>Content</em>.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">To edit the settings and styles of your post, simply click on&nbsp;a&nbsp;post below.</span></p>")
"text" => __("<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts! </strong></h1>\n<p></p>\n<p>MailPoet can <span style=\"line-height: 1.6em; background-color: inherit;\"><em>automatically</em> </span><span style=\"line-height: 1.6em; background-color: inherit;\">send your new blog posts to your subscribers.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">Below, you'll find three recent posts, which are displayed automatically, thanks to the <em>Automatic Latest Content</em> widget, which can be found on the right sidebar, under <em>Content</em>.</span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\"></span></p>\n<p><span style=\"line-height: 1.6em; background-color: inherit;\">To edit the settings and styles of your post, simply click on a post below.</span></p>", 'mailpoet')
),
array(
"type" => "divider",
@ -174,14 +174,14 @@ class PostNotificationsBlank1Column {
"imageFullWidth" => false,
"featuredImagePosition" => "belowTitle",
"showAuthor" => "no",
"authorPrecededBy" => __("Author:"),
"authorPrecededBy" => __("Author:", 'mailpoet'),
"showCategories" => "no",
"categoriesPrecededBy" => __("Categories:"),
"categoriesPrecededBy" => __("Categories:", 'mailpoet'),
"readMoreType" => "button",
"readMoreText" => "Read more",
"readMoreButton" => array(
"type" => "button",
"text" => __("Read the post"),
"text" => __("Read the post", 'mailpoet'),
"url" => "[postLink]",
"styles" => array(
"block" => array(
@ -298,7 +298,7 @@ class PostNotificationsBlank1Column {
),
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class Restaurant {
function get() {
return array(
'name' => __("Restaurant"),
'description' => __("What's fresh on the menu?"),
'name' => __("Restaurant", 'mailpoet'),
'description' => __("What's fresh on the menu?", 'mailpoet'),
'readonly' => 0,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -332,7 +332,7 @@ class Restaurant {
))
), array(
"type" => "header",
"text" => "<p><a href=\"[link:newsletter_view_in_browser_url]\">View&nbsp;this email in your web browser</a></p>",
"text" => "<p><a href=\"[link:newsletter_view_in_browser_url]\">View this email in your web browser</a></p>",
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class SimpleText {
function get() {
return array(
'name' => __("Simple Text"),
'description' => __("A simple plain text template - just like a regular email."),
'name' => __("Simple Text", 'mailpoet'),
'description' => __("A simple plain text template - just like a regular email.", 'mailpoet'),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -63,7 +63,7 @@ class SimpleText {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/fake-logo.png",
"alt" => __("Fake logo"),
"alt" => __("Fake logo", 'mailpoet'),
"fullWidth" => false,
"width" => "598px",
"height" => "71px",
@ -75,7 +75,7 @@ class SimpleText {
),
array(
"type" => "text",
"text" => __("<p style=\"text-align: left;\">Hi&nbsp;[subscriber:firstname | default:subscriber],</p>\n<p style=\"text-align: left;\"></p>\n<p style=\"text-align: left;\">In MailPoet, you can write emails in plain text,&nbsp;just like in a regular email.&nbsp;This can make your email newsletters&nbsp;more personal and attention-grabbing.</p>\n<p style=\"text-align: left;\"></p>\n<p style=\"text-align: left;\">Is this too&nbsp;simple?&nbsp;You can still style your text with basic&nbsp;formatting,&nbsp;like&nbsp;<strong>bold</strong>&nbsp;or <em>italics.</em></p>\n<p style=\"text-align: left;\"></p>\n<p style=\"text-align: left;\">Finally, you can also add a call-to-action button between 2 blocks of text, like this:</p>")
"text" => __("<p style=\"text-align: left;\">Hi [subscriber:firstname | default:subscriber],</p>\n<p style=\"text-align: left;\"></p>\n<p style=\"text-align: left;\">In MailPoet, you can write emails in plain text, just like in a regular email. This can make your email newsletters more personal and attention-grabbing.</p>\n<p style=\"text-align: left;\"></p>\n<p style=\"text-align: left;\">Is this too simple? You can still style your text with basic formatting, like <strong>bold</strong> or <em>italics.</em></p>\n<p style=\"text-align: left;\"></p>\n<p style=\"text-align: left;\">Finally, you can also add a call-to-action button between 2 blocks of text, like this:</p>", 'mailpoet')
)
)
)
@ -110,7 +110,7 @@ class SimpleText {
),
array(
"type" => "button",
"text" => __("It's time to take action!"),
"text" => __("It's time to take action!", 'mailpoet'),
"url" => "",
"styles" => array(
"block" => array(
@ -131,11 +131,11 @@ class SimpleText {
),
array(
"type" => "text",
"text" => __("<p>Thanks for&nbsp;reading. See you soon!</p>\n<p></p>\n<p><strong><em>The MailPoet Team</em></strong></p>")
"text" => __("<p>Thanks for reading. See you soon!</p>\n<p></p>\n<p><strong><em>The MailPoet Team</em></strong></p>", 'mailpoet')
),
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class StoreDiscount {
function get() {
return array(
'name' => __("Store Discount"),
'description' => __("Store discount email with coupon and shopping suggestions"),
'name' => __("Store Discount", 'mailpoet'),
'description' => __("Store discount email with coupon and shopping suggestions", 'mailpoet'),
'readonly' => 0,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -59,7 +59,7 @@ class StoreDiscount {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/bicycle-header3.png",
"alt" => __("bicycle-header3"),
"alt" => __("bicycle-header3", 'mailpoet'),
"fullWidth" => false,
"width" => "423px",
"height" => "135px",
@ -70,7 +70,7 @@ class StoreDiscount {
)
), array(
"type" => "text",
"text" => __("<p></p>\n<p>Hi&nbsp;[subscriber:firstname | default:reader]</p>\n<p class=\"\"></p>\n<p>Fancy 15% off your next order? Use this coupon&nbsp;on all your favourite products from our store&nbsp;until Wednesday. Just&nbsp;enter the code on the payments page and&nbsp;your discount will applied.</p>")
"text" => __("<p></p>\n<p>Hi [subscriber:firstname | default:reader]</p>\n<p class=\"\"></p>\n<p>Fancy 15% off your next order? Use this coupon on all your favourite products from our store until Wednesday. Just enter the code on the payments page and your discount will applied.</p>", 'mailpoet')
), array(
"type" => "spacer",
"styles" => array(
@ -110,10 +110,10 @@ class StoreDiscount {
)
), array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><em><strong>Get 15% discount off your next order</strong></em></h1>")
"text" => __("<h1 style=\"text-align: center;\"><em><strong>Get 15% discount off your next order</strong></em></h1>", 'mailpoet')
), array(
"type" => "text",
"text" => __("<h2 style=\"text-align: center;\"><strong>USE CODE: WELOVEMAILPOET</strong></h2>")
"text" => __("<h2 style=\"text-align: center;\"><strong>USE CODE: WELOVEMAILPOET</strong></h2>", 'mailpoet')
), array(
"type" => "divider",
"styles" => array(
@ -153,7 +153,7 @@ class StoreDiscount {
)
), array(
"type" => "button",
"text" => __("SHOP NOW"),
"text" => __("SHOP NOW", 'mailpoet'),
"url" => "",
"styles" => array(
"block" => array(
@ -173,7 +173,7 @@ class StoreDiscount {
)
), array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong><em>Use your discount on these great&nbsp;products...</em></strong></h1>")
"text" => __("<h1 style=\"text-align: center;\"><strong><em>Use your discount on these great products...</em></strong></h1>", 'mailpoet')
), array(
"type" => "spacer",
"styles" => array(
@ -204,7 +204,7 @@ class StoreDiscount {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/red-icycle.jpg",
"alt" => __("red-icycle"),
"alt" => __("red-icycle", 'mailpoet'),
"fullWidth" => false,
"width" => "558px",
"height" => "399px",
@ -215,10 +215,10 @@ class StoreDiscount {
)
), array(
"type" => "text",
"text" => __("<h3 style=\"text-align: center;\">Lovely Red Bicycle</h3>\n<p>What can we say? It's a totally awesome red bike, and it's the first of its kind in our collection. No sweat!</p>\n<h3 style=\"text-align: center;\"><strong><span style=\"color: #488e88;\">$289.99</span></strong></h3>")
"text" => __("<h3 style=\"text-align: center;\">Lovely Red Bicycle</h3>\n<p>What can we say? It's a totally awesome red bike, and it's the first of its kind in our collection. No sweat!</p>\n<h3 style=\"text-align: center;\"><strong><span style=\"color: #488e88;\">$289.99</span></strong></h3>", 'mailpoet')
), array(
"type" => "button",
"text" => __("Buy"),
"text" => __("Buy", 'mailpoet'),
"url" => "",
"styles" => array(
"block" => array(
@ -249,7 +249,7 @@ class StoreDiscount {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/orange-bicycle.jpg",
"alt" => __("orange-bicycle"),
"alt" => __("orange-bicycle", 'mailpoet'),
"fullWidth" => false,
"width" => "639px",
"height" => "457px",
@ -260,10 +260,10 @@ class StoreDiscount {
)
), array(
"type" => "text",
"text" => __("<h3 style=\"text-align: center;\">Little Orange Bicycle</h3>\n<p>Another product that's just as awesome but it's the second type, and more orange, with some blue. Cool beans!</p>\n<h3 style=\"line-height: 22.4px; text-align: center;\"><span style=\"color: #488e88;\"><strong>$209.99</strong></span></h3>")
"text" => __("<h3 style=\"text-align: center;\">Little Orange Bicycle</h3>\n<p>Another product that's just as awesome but it's the second type, and more orange, with some blue. Cool beans!</p>\n<h3 style=\"line-height: 22.4px; text-align: center;\"><span style=\"color: #488e88;\"><strong>$209.99</strong></span></h3>", 'mailpoet')
), array(
"type" => "button",
"text" => __("Buy"),
"text" => __("Buy", 'mailpoet'),
"url" => "",
"styles" => array(
"block" => array(
@ -320,7 +320,7 @@ class StoreDiscount {
)
), array(
"type" => "text",
"text" => __("<p><em>Terms and Conditions:</em></p>\n<ul>\n<li><span style=\"line-height: 1.6em; background-color: inherit;\">Must be used by midnight EST December 15 2016.</span></li>\n<li><span style=\"line-height: 1.6em; background-color: inherit;\">Discount does not include shipping.</span></li>\n<li><span style=\"line-height: 1.6em; background-color: inherit;\">Cannot be used in conjunction with any other offer.</span></li>\n</ul>")
"text" => __("<p><em>Terms and Conditions:</em></p>\n<ul>\n<li><span style=\"line-height: 1.6em; background-color: inherit;\">Must be used by midnight EST December 15 2016.</span></li>\n<li><span style=\"line-height: 1.6em; background-color: inherit;\">Discount does not include shipping.</span></li>\n<li><span style=\"line-height: 1.6em; background-color: inherit;\">Cannot be used in conjunction with any other offer.</span></li>\n</ul>", 'mailpoet')
), array(
"type" => "social",
"iconSet" => "grey",
@ -331,7 +331,7 @@ class StoreDiscount {
"image" => $this->social_icon_url . "/02-grey/Facebook.png",
"height" => "32px",
"width" => "32px",
"text" => __("Facebook")
"text" => __("Facebook", 'mailpoet')
), array(
"type" => "socialIcon",
"iconType" => "twitter",
@ -339,11 +339,11 @@ class StoreDiscount {
"image" => $this->social_icon_url . "/02-grey/Twitter.png",
"height" => "32px",
"width" => "32px",
"text" => __("Twitter")
"text" => __("Twitter", 'mailpoet')
))
), array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage subscription</a></p>\n<p>1 Store Street, Shopville, CA 1345</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage subscription</a></p>\n<p>1 Store Street, Shopville, CA 1345</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class TravelEmail {
function get() {
return array(
'name' => __("Travel email"),
'description' => __("A little postcard from your trip"),
'name' => __("Travel email", 'mailpoet'),
'description' => __("A little postcard from your trip", 'mailpoet'),
'readonly' => 0,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -51,7 +51,7 @@ class TravelEmail {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/header.png",
"alt" => __("Travelling Tales with Jane & Steven"),
"alt" => __("Travelling Tales with Jane & Steven", 'mailpoet'),
"fullWidth" => true,
"width" => "660px",
"height" => "165px",
@ -70,7 +70,7 @@ class TravelEmail {
)
), array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\">Hi&nbsp;[subscriber:firstname | default:reader]!</h1>\n<p></p>\n<p>Greetings from New Zealand, we're here enjoying the sights and sounds (and bad smells!) of Rotarua. Yesterday we took advantage of the local amenities and visited&nbsp;the hot springs!&nbsp;</p>\n<p>Don't forget to stay up-to-date via twitter!</p>")
"text" => __("<h1 style=\"text-align: center;\">Hi [subscriber:firstname | default:reader]!</h1>\n<p></p>\n<p>Greetings from New Zealand, we're here enjoying the sights and sounds (and bad smells!) of Rotarua. Yesterday we took advantage of the local amenities and visited the hot springs! </p>\n<p>Don't forget to stay up-to-date via twitter!</p>", 'mailpoet')
), array(
"type" => "social",
"iconSet" => "circles",
@ -81,11 +81,11 @@ class TravelEmail {
"image" => $this->social_icon_url . "/03-circles/Twitter.png",
"height" => "32px",
"width" => "32px",
"text" => __("Twitter")
"text" => __("Twitter", 'mailpoet')
))
), array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong>Photos from Rotarua</strong></h1>")
"text" => __("<h1 style=\"text-align: center;\"><strong>Photos from Rotarua</strong></h1>", 'mailpoet')
), array(
"type" => "spacer",
"styles" => array(
@ -116,7 +116,7 @@ class TravelEmail {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/gallery1.jpg",
"alt" => __("hot thermals"),
"alt" => __("hot thermals", 'mailpoet'),
"fullWidth" => false,
"width" => "640px",
"height" => "425px",
@ -146,7 +146,7 @@ class TravelEmail {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/gallery2.jpg",
"alt" => __("The view from our campsite"),
"alt" => __("The view from our campsite", 'mailpoet'),
"fullWidth" => false,
"width" => "640px",
"height" => "425px",
@ -185,7 +185,7 @@ class TravelEmail {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/gallery3.jpg",
"alt" => __("Red sky at night"),
"alt" => __("Red sky at night", 'mailpoet'),
"fullWidth" => false,
"width" => "640px",
"height" => "425px",
@ -207,7 +207,7 @@ class TravelEmail {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/gallery4.jpg",
"alt" => __("Don't go chasing waterfalls"),
"alt" => __("Don't go chasing waterfalls", 'mailpoet'),
"fullWidth" => false,
"width" => "640px",
"height" => "425px",
@ -244,7 +244,7 @@ class TravelEmail {
)
), array(
"type" => "button",
"text" => __("View NZ Photo Gallery"),
"text" => __("View NZ Photo Gallery", 'mailpoet'),
"url" => "",
"styles" => array(
"block" => array(
@ -293,7 +293,7 @@ class TravelEmail {
)
), array(
"type" => "text",
"text" => __("<h2><em>Here's our top recommendations in Rotarua</em></h2>")
"text" => __("<h2><em>Here's our top recommendations in Rotarua</em></h2>", 'mailpoet')
), array(
"type" => "spacer",
"styles" => array(
@ -324,7 +324,7 @@ class TravelEmail {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/glow-worms.jpg",
"alt" => __("Glow worms, Waitomo Caves"),
"alt" => __("Glow worms, Waitomo Caves", 'mailpoet'),
"fullWidth" => true,
"width" => "640px",
"height" => "428px",
@ -335,7 +335,7 @@ class TravelEmail {
)
), array(
"type" => "text",
"text" => __("<p><em><a href=\"http://www.waitomo.com/Waitomo-Glowworm-Caves/Pages/default.aspx\"><strong>Waitomo Glow Worm Caves</strong></a></em></p>")
"text" => __("<p><em><a href=\"http://www.waitomo.com/Waitomo-Glowworm-Caves/Pages/default.aspx\"><strong>Waitomo Glow Worm Caves</strong></a></em></p>", 'mailpoet')
))
), array(
"type" => "container",
@ -349,7 +349,7 @@ class TravelEmail {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/luge.jpg",
"alt" => __("luge"),
"alt" => __("luge", 'mailpoet'),
"fullWidth" => false,
"width" => "375px",
"height" => "500px",
@ -360,7 +360,7 @@ class TravelEmail {
)
), array(
"type" => "text",
"text" => __("<p><em><strong><a href=\"http://www.skyline.co.nz/rotorua/ssr_luge/\">Luge!</a></strong></em></p>")
"text" => __("<p><em><strong><a href=\"http://www.skyline.co.nz/rotorua/ssr_luge/\">Luge!</a></strong></em></p>", 'mailpoet')
))
), array(
"type" => "container",
@ -374,7 +374,7 @@ class TravelEmail {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/holiday-park.jpg",
"alt" => __("holiday-park"),
"alt" => __("holiday-park", 'mailpoet'),
"fullWidth" => true,
"width" => "640px",
"height" => "425px",
@ -385,7 +385,7 @@ class TravelEmail {
)
), array(
"type" => "text",
"text" => __("<p><em><strong><a href=\"http://rotoruathermal.co.nz/\">Roturua Thermal Holiday Park</a></strong></em></p>")
"text" => __("<p><em><strong><a href=\"http://rotoruathermal.co.nz/\">Roturua Thermal Holiday Park</a></strong></em></p>", 'mailpoet')
))
))
), array(
@ -414,7 +414,7 @@ class TravelEmail {
)
), array(
"type" => "text",
"text" => __("<p>Tomorrow we're heading towards Taupo where we'll visit the&nbsp;'Craters of the moon' and go prawn fishing!&nbsp;Hopefully the weather will stay good.</p>\n<p></p>\n<p>Keep on travellin'</p>\n<p>Jane &amp; Steven</p>")
"text" => __("<p>Tomorrow we're heading towards Taupo where we'll visit the 'Craters of the moon' and go prawn fishing! Hopefully the weather will stay good.</p>\n<p></p>\n<p>Keep on travellin'</p>\n<p>Jane &amp; Steven</p>", 'mailpoet')
))
))
), array(
@ -446,7 +446,7 @@ class TravelEmail {
)
), array(
"type" => "header",
"text" => ("Display problems?&nbsp;<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"text" => ("Display problems? <a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"
@ -464,7 +464,7 @@ class TravelEmail {
)
), array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage subscription</a></p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage subscription</a></p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class WelcomeBlank12Column {
function get() {
return array(
'name' => __("Welcome Email: Blank 1:2 Column"),
'description' => __("A blank Welcome Email template with a 1:2 column layout."),
'name' => __("Welcome Email: Blank 1:2 Column", 'mailpoet'),
'description' => __("A blank Welcome Email template with a 1:2 column layout.", 'mailpoet'),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -52,7 +52,7 @@ class WelcomeBlank12Column {
"blocks" => array(
array(
"type" => "header",
"text" => __("Display problems?&nbsp;<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"text" => __("Display problems? <a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"
@ -104,7 +104,7 @@ class WelcomeBlank12Column {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/fake-logo.png",
"alt" => __("Fake logo"),
"alt" => __("Fake logo", 'mailpoet'),
"fullWidth" => false,
"width" => "598px",
"height" => "71px",
@ -116,7 +116,7 @@ class WelcomeBlank12Column {
),
array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p></p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p></p>\n<p>You recently joined our list and we'd like to give&nbsp;you a warm welcome!</p>")
"text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p></p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p></p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>", 'mailpoet')
),
array(
"type" => "divider",
@ -163,11 +163,11 @@ class WelcomeBlank12Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h3>Our Most Popular Posts</h3>")
"text" => __("<h3>Our Most Popular Posts</h3>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<ul>\n<li><a href=\"http://www.mailpoet.com/the-importance-of-focus-when-writing/\">The Importance of Focus When Writing</a></li>\n<li><a href=\"http://www.mailpoet.com/write-great-subject-line/\">How to Write a Great Subject Line</a></li>\n<li><a href=\"http://www.mailpoet.com/just-sit-write-advice-motivation-ernest-hemingway/\">Just Sit Down and Write &ndash; Advice on Motivation from Ernest Hemingway</a></li>\n</ul>")
"text" => __("<ul>\n<li><a href=\"http://www.mailpoet.com/the-importance-of-focus-when-writing/\">The Importance of Focus When Writing</a></li>\n<li><a href=\"http://www.mailpoet.com/write-great-subject-line/\">How to Write a Great Subject Line</a></li>\n<li><a href=\"http://www.mailpoet.com/just-sit-write-advice-motivation-ernest-hemingway/\">Just Sit Down and Write &ndash; Advice on Motivation from Ernest Hemingway</a></li>\n</ul>", 'mailpoet')
)
)
),
@ -182,15 +182,15 @@ class WelcomeBlank12Column {
"blocks" => array(
array(
"type" => "text",
"text" => __("<h3>What's&nbsp;Next?</h3>")
"text" => __("<h3>What's Next?</h3>", 'mailpoet')
),
array(
"type" => "text",
"text" => __("<p>Add a single button to your newsletter in order to have one clear call-to-action, which will increase your click rates.</p>")
"text" => __("<p>Add a single button to your newsletter in order to have one clear call-to-action, which will increase your click rates.</p>", 'mailpoet')
),
array(
"type" => "button",
"text" => __("Read up!"),
"text" => __("Read up!", 'mailpoet'),
"url" => "",
"styles" => array(
"block" => array(
@ -281,7 +281,7 @@ class WelcomeBlank12Column {
),
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -13,8 +13,8 @@ class WelcomeBlank1Column {
function get() {
return array(
'name' => __("Welcome Email: Blank 1 Column"),
'description' => __("A blank Welcome Email template with a 1 column layout."),
'name' => __("Welcome Email: Blank 1 Column", 'mailpoet'),
'description' => __("A blank Welcome Email template with a 1 column layout.", 'mailpoet'),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
@ -52,7 +52,7 @@ class WelcomeBlank1Column {
"blocks" => array(
array(
"type" => "header",
"text" => __("Display problems?&nbsp;<a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>"),
"text" => __("Display problems? <a href=\"[link:newsletter_view_in_browser_url]\">Open this email in your web browser</a>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"
@ -104,7 +104,7 @@ class WelcomeBlank1Column {
"type" => "image",
"link" => "",
"src" => $this->template_image_url . "/fake-logo.png",
"alt" => __("Fake logo"),
"alt" => __("Fake logo", 'mailpoet'),
"fullWidth" => false,
"width" => "598px",
"height" => "71px",
@ -116,7 +116,7 @@ class WelcomeBlank1Column {
),
array(
"type" => "text",
"text" => __("<h1 style=\"text-align: center;\"><strong>Hi,&nbsp;new subscriber!</strong></h1>\n<p></p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p></p>\n<p>You recently joined our list and we'd like to give&nbsp;you a warm welcome!</p>\n<p></p>\n<p>Want to get to know us better? Check&nbsp;out&nbsp;some of our most popular&nbsp;articles:&nbsp;</p>\n<ol>\n<li><a href=\"http://www.mailpoet.com/the-importance-of-focus-when-writing/\">The Importance of Focus When Writing</a></li>\n<li><a href=\"http://www.mailpoet.com/write-great-subject-line/\">How to Write a Great Subject Line</a></li>\n<li><a href=\"http://www.mailpoet.com/just-sit-write-advice-motivation-ernest-hemingway/\">Just Sit Down and Write &ndash; Advice on Motivation from Ernest Hemingway</a></li>\n</ol>")
"text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p></p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p></p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>\n<p></p>\n<p>Want to get to know us better? Check out some of our most popular articles: </p>\n<ol>\n<li><a href=\"http://www.mailpoet.com/the-importance-of-focus-when-writing/\">The Importance of Focus When Writing</a></li>\n<li><a href=\"http://www.mailpoet.com/write-great-subject-line/\">How to Write a Great Subject Line</a></li>\n<li><a href=\"http://www.mailpoet.com/just-sit-write-advice-motivation-ernest-hemingway/\">Just Sit Down and Write &ndash; Advice on Motivation from Ernest Hemingway</a></li>\n</ol>", 'mailpoet')
)
)
)
@ -190,7 +190,7 @@ class WelcomeBlank1Column {
),
array(
"type" => "footer",
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>"),
"text" => __("<p><a href=\"[link:subscription_unsubscribe_url]\">Unsubscribe</a> | <a href=\"[link:subscription_manage_url]\">Manage your subscription</a><br />Add your postal address here!</p>", 'mailpoet'),
"styles" => array(
"block" => array(
"backgroundColor" => "transparent"

View File

@ -25,6 +25,7 @@ class Renderer {
$this->setupTranslations();
$this->setupFunctions();
$this->setupHandlebars();
$this->setupHelpscout();
$this->setupGlobalVariables();
$this->setupSyntax();
@ -43,6 +44,10 @@ class Renderer {
$this->renderer->addExtension(new Twig\Handlebars());
}
function setupHelpscout() {
$this->renderer->addExtension(new Twig\Helpscout());
}
function setupGlobalVariables() {
$this->renderer->addExtension(new Twig\Assets(array(
'assets_url' => Env::$assets_url,

View File

@ -81,7 +81,7 @@ class Shortcodes {
if(empty($newsletters)) {
return apply_filters(
'mailpoet_archive_no_newsletters',
__('Oops! There are no newsletters to display.')
__('Oops! There are no newsletters to display.', 'mailpoet')
);
} else {
$title = apply_filters('mailpoet_archive_title', '');
@ -116,7 +116,7 @@ class Shortcodes {
$preview_url = NewsletterUrl::getViewInBrowserUrl($newsletter);
return '<a href="'.esc_attr($preview_url).'" target="_blank" title="'
.esc_attr(__('Preview in a new tab')).'">'
.esc_attr(__('Preview in a new tab', 'mailpoet')).'">'
.esc_attr($newsletter->subject).
'</a>';
}

View File

@ -69,8 +69,7 @@ class Widget {
'form' => $form_html,
'mailpoet_form' => array(
'ajax_url' => admin_url('admin-ajax.php', 'absolute'),
'is_rtl' => $is_rtl,
'token' => Security::generateToken()
'is_rtl' => $is_rtl
)
);
@ -103,8 +102,7 @@ class Widget {
wp_localize_script('mailpoet_public', 'MailPoetForm', array(
'ajax_url' => admin_url('admin-ajax.php'),
'is_rtl' => (function_exists('is_rtl') ? (bool)is_rtl() : false),
'token' => Security::generateToken()
'is_rtl' => (function_exists('is_rtl') ? (bool)is_rtl() : false)
));
}

View File

@ -80,13 +80,13 @@ class CronHelper {
$fp = @fsockopen($parsed_url['host'], $port, $errno, $errstr, 1);
if($fp) return sprintf('%s://%s', $parsed_url['scheme'], $parsed_url['host']);
// 4. throw an error if all connection attempts failed
throw new \Exception(__('Site URL is unreachable.'));
throw new \Exception(__('Site URL is unreachable.', 'mailpoet'));
}
static function enforceExecutionLimit($timer) {
$elapsed_time = microtime(true) - $timer;
if($elapsed_time >= self::DAEMON_EXECUTION_LIMIT) {
throw new \Exception(__('Maximum execution time has been reached.'));
throw new \Exception(__('Maximum execution time has been reached.', 'mailpoet'));
}
}
}

View File

@ -1,12 +1,10 @@
<?php
namespace MailPoet\Cron;
use MailPoet\Cron\Workers\Scheduler as SchedulerWorker;
use MailPoet\Cron\Workers\SendingQueue\SendingQueue as SendingQueueWorker;
require_once(ABSPATH . 'wp-includes/pluggable.php');
if(!defined('ABSPATH')) exit;
require_once(ABSPATH . 'wp-includes/pluggable.php');
class Daemon {
public $daemon;
@ -24,10 +22,10 @@ class Daemon {
function run() {
ignore_user_abort(true);
if(!$this->request_data) {
$error = __('Invalid or missing request data.');
$error = __('Invalid or missing request data.', 'mailpoet');
} else {
if(!$this->daemon) {
$error = __('Daemon does not exist.');
$error = __('Daemon does not exist.', 'mailpoet');
} else {
if(!isset($this->request_data['token']) ||
$this->request_data['token'] !== $this->daemon['token']

View File

@ -10,9 +10,8 @@ use MailPoet\Models\SubscriberSegment;
use MailPoet\Util\Helpers;
use MailPoet\Newsletter\Scheduler\Scheduler as NewsletterScheduler;
require_once(ABSPATH . 'wp-includes/pluggable.php');
if(!defined('ABSPATH')) exit;
require_once(ABSPATH . 'wp-includes/pluggable.php');
class Scheduler {
public $timer;

View File

@ -47,6 +47,7 @@ class SendingQueue {
// abort if execution limit is reached
CronHelper::enforceExecutionLimit($this->timer);
$found_subscribers = SubscriberModel::whereIn('id', $subscribers_to_process_ids)
->whereNull('deleted_at')
->findMany();
$found_subscribers_ids = array_map(function($subscriber) {
return $subscriber->id;

View File

@ -8,7 +8,6 @@ use MailPoet\Models\Newsletter as NewsletterModel;
use MailPoet\Models\Setting;
use MailPoet\Newsletter\Links\Links as NewsletterLinks;
use MailPoet\Newsletter\Renderer\PostProcess\OpenTracking;
use MailPoet\Newsletter\Renderer\Renderer;
use MailPoet\Util\Helpers;
if(!defined('ABSPATH')) exit;
@ -26,8 +25,7 @@ class Newsletter {
if(!$newsletter) {
return false;
}
// if the newsletter was previously rendered, return it
// otherwise, process/render it
// return the newsletter if it was previously rendered
if(!is_null($queue->getNewsletterRenderedBody())) {
return $newsletter;
}
@ -35,7 +33,7 @@ class Newsletter {
if($this->tracking_enabled) {
// hook to the newsletter post-processing filter and add tracking image
$this->tracking_image_inserted = OpenTracking::addTrackingImage();
// render newsletter and save its
// render newsletter
$rendered_newsletter = $newsletter->render();
// hash and save all links
$rendered_newsletter = LinksTask::process($rendered_newsletter, $newsletter, $queue);
@ -45,7 +43,9 @@ class Newsletter {
}
// check if this is a post notification and if it contains posts
$newsletter_contains_posts = strpos($rendered_newsletter['html'], 'data-post-id');
if($newsletter->type === 'notification' && !$newsletter_contains_posts) {
if($newsletter->type === NewsletterModel::TYPE_NOTIFICATION_HISTORY &&
!$newsletter_contains_posts
) {
return false;
}
// extract and save newsletter posts
@ -91,8 +91,10 @@ class Newsletter {
}
function markNewsletterAsSent($newsletter) {
// if it's a standard newsletter, update its status
if($newsletter->type === NewsletterModel::TYPE_STANDARD) {
// if it's a standard or notification history newsletter, update its status
if($newsletter->type === NewsletterModel::TYPE_STANDARD ||
$newsletter->type === NewsletterModel::TYPE_NOTIFICATION_HISTORY
) {
$newsletter->setStatus(NewsletterModel::STATUS_SENT);
}
}

View File

@ -20,10 +20,10 @@ class Posts {
$newsletter->parent_id :
$newsletter->id;
foreach($matched_posts_ids as $post_id) {
$newletter_post = NewsletterPost::create();
$newletter_post->newsletter_id = $newsletter_id;
$newletter_post->post_id = $post_id;
$newletter_post->save();
$newsletter_post = NewsletterPost::create();
$newsletter_post->newsletter_id = $newsletter_id;
$newsletter_post->post_id = $post_id;
$newsletter_post->save();
}
return true;
}

View File

@ -7,7 +7,7 @@ abstract class Base {
if($block['id'] === 'email') {
$rules['required'] = true;
$rules['error-message'] = __('Please specify a valid email address');
$rules['error-message'] = __('Please specify a valid email address', 'mailpoet');
}
if($block['id'] === 'segments') {
@ -15,7 +15,7 @@ abstract class Base {
$rules['mincheck'] = 1;
$rules['group'] = $block['id'];
$rules['errors-container'] = '.mailpoet_error_'.$block['id'];
$rules['required-message'] = __('Please select a list');
$rules['required-message'] = __('Please select a list', 'mailpoet');
}
if(!empty($block['params']['required'])) {
@ -25,7 +25,7 @@ abstract class Base {
if(!empty($block['params']['validate'])) {
if($block['params']['validate'] === 'phone') {
$rules['pattern'] = "^[\d\+\-\.\(\)\/\s]*$";
$rules['error-message'] = __('Please specify a valid phone number');
$rules['error-message'] = __('Please specify a valid phone number', 'mailpoet');
} else {
$rules['type'] = $block['params']['validate'];
}
@ -34,7 +34,7 @@ abstract class Base {
if(in_array($block['type'], array('radio', 'checkbox'))) {
$rules['group'] = 'custom_field_'.$block['id'];
$rules['errors-container'] = '.mailpoet_error_'.$block['id'];
$rules['required-message'] = __('Please select at least one option');
$rules['required-message'] = __('Please select at least one option', 'mailpoet');
}
if($block['type'] === 'date') {

View File

@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
if(!defined('ABSPATH')) exit;
class Checkbox extends Base {
static function render($block) {
@ -49,5 +51,4 @@ class Checkbox extends Base {
return $html;
}
}
}

View File

@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
if(!defined('ABSPATH')) exit;
use Carbon\Carbon;
class Date extends Base {
@ -70,27 +72,27 @@ class Date extends Base {
$block['selected'] = $day;
$html .= '<select class="mailpoet_date_day" ';
$html .= static::getInputValidation($block, array(
'required-message' => __('Please select a day')
'required-message' => __('Please select a day', 'mailpoet')
));
$html .= 'name="'.$field_name.'[day]" placeholder="'.__('Day').'">';
$html .= 'name="'.$field_name.'[day]" placeholder="'.__('Day', 'mailpoet').'">';
$html .= static::getDays($block);
$html .= '</select>';
} else if($date_selector === 'MM') {
$block['selected'] = $month;
$html .= '<select class="mailpoet_date_month" ';
$html .= static::getInputValidation($block, array(
'required-message' => __('Please select a month')
'required-message' => __('Please select a month', 'mailpoet')
));
$html .= 'name="'.$field_name.'[month]" placeholder="'.__('Month').'">';
$html .= 'name="'.$field_name.'[month]" placeholder="'.__('Month', 'mailpoet').'">';
$html .= static::getMonths($block);
$html .= '</select>';
} else if($date_selector === 'YYYY') {
$block['selected'] = $year;
$html .= '<select class="mailpoet_date_year" ';
$html .= static::getInputValidation($block, array(
'required-message' => __('Please select a year')
'required-message' => __('Please select a year', 'mailpoet')
));
$html .= 'name="'.$field_name.'[year]" placeholder="'.__('Year').'">';
$html .= 'name="'.$field_name.'[year]" placeholder="'.__('Year', 'mailpoet').'">';
$html .= static::getYears($block);
$html .= '</select>';
}
@ -103,10 +105,10 @@ class Date extends Base {
static function getDateTypes() {
return array(
'year_month_day' => __('Year, month, day'),
'year_month' => __('Year, month'),
'month' => __('Month (January, February,...)'),
'year' => __('Year')
'year_month_day' => __('Year, month, day', 'mailpoet'),
'year_month' => __('Year, month', 'mailpoet'),
'month' => __('Month (January, February,...)', 'mailpoet'),
'year' => __('Year', 'mailpoet')
);
}
@ -119,9 +121,9 @@ class Date extends Base {
);
}
static function getMonthNames() {
return array(__('January'), __('February'), __('March'), __('April'),
__('May'), __('June'), __('July'), __('August'), __('September'),
__('October'), __('November'), __('December')
return array(__('January', 'mailpoet'), __('February', 'mailpoet'), __('March', 'mailpoet'), __('April', 'mailpoet'),
__('May', 'mailpoet'), __('June', 'mailpoet'), __('July', 'mailpoet'), __('August', 'mailpoet'), __('September', 'mailpoet'),
__('October', 'mailpoet'), __('November', 'mailpoet'), __('December', 'mailpoet')
);
}
@ -138,7 +140,7 @@ class Date extends Base {
$html = '';
// empty value label
$html .= '<option value="">'.__('Month').'</option>';
$html .= '<option value="">'.__('Month', 'mailpoet').'</option>';
for($i = 1; $i < 13; $i++) {
$is_selected = ($i === $block['selected']) ? 'selected="selected"' : '';
@ -168,7 +170,7 @@ class Date extends Base {
$html = '';
// empty value label
$html .= '<option value="">'.__('Year').'</option>';
$html .= '<option value="">'.__('Year', 'mailpoet').'</option>';
// return years as an array
for($i = (int)$block['to']; $i > (int)($block['from'] - 1); $i--) {
@ -194,7 +196,7 @@ class Date extends Base {
$html = '';
// empty value label
$html .= '<option value="">'.__('Day').'</option>';
$html .= '<option value="">'.__('Day', 'mailpoet').'</option>';
// return days as an array
for($i = 1; $i < 32; $i++) {

View File

@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
if(!defined('ABSPATH')) exit;
class Radio extends Base {
static function render($block) {

View File

@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
if(!defined('ABSPATH')) exit;
class Segment extends Base {
static function render($block) {

View File

@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
if(!defined('ABSPATH')) exit;
class Select extends Base {
static function render($block) {

View File

@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
if(!defined('ABSPATH')) exit;
class Submit extends Base {
static function render($block) {

View File

@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
if(!defined('ABSPATH')) exit;
class Text extends Base {
static function render($block) {

View File

@ -1,6 +1,8 @@
<?php
namespace MailPoet\Form\Block;
if(!defined('ABSPATH')) exit;
class Textarea extends Base {
static function render($block) {
$html = '';

View File

@ -1,6 +1,7 @@
<?php
namespace MailPoet\Form\Util;
use MailPoet\Form\Widget;
use MailPoet\Config\Env;
class Export {
static function getAll($form = null) {
@ -41,39 +42,50 @@ class Export {
case 'php':
$output = array(
'$form_widget = new \MailPoet\Form\Widget();',
'echo $form_widget->widget(array(\'form\' => '.(int)$form['id'].', \'form_type\' => \'php\'));'
'echo $form_widget->widget(array(\'form\' => '.
(int)$form['id'].
', \'form_type\' => \'php\'));'
);
return join("\n", $output);
case 'html':
// TODO: get locale setting in order to load translations
$wp_locale = \get_locale();
$output = array();
$output[] = '<!-- BEGIN Scripts : you should place them in the header of your theme -->';
$output[] = '<!-- '.
__(
'BEGIN Scripts: you should place them in the header of your theme',
'mailpoet'
).
' -->';
// jQuery
$output[] = '<script type="text/javascript" src="'.includes_url().'js/jquery/jquery.js'.'?mpv='.MAILPOET_VERSION.'"></script>';
// CSS
$output[] = '<link rel="stylesheet" type="text/css" href="'.
Env::$assets_url.'/css/public.css?mp_ver='.MAILPOET_VERSION.
'" />';
// (JS) form validation
$output[] = '<script type="text/javascript" src="'.plugins_url('wysija-newsletters/'.'lib/jquery.validationEngine.js?mpv='.MAILPOET_VERSION).'"></script>';
$output[] = '<script type="text/javascript" src="'.plugins_url('wysija-newsletters/'.'lib/jquery.validationEngine-en.js?mpv='.MAILPOET_VERSION).'"></script>';
// jQuery
$output[] = '<script type="text/javascript" src="'.
includes_url().'js/jquery/jquery.js?mp_ver'.MAILPOET_VERSION.
'"></script>';
// (CSS) form validation styles
$output[] = '<link rel="stylesheet" type="text/css" href="'.plugins_url('wysija-newsletters/'.'lib/validationEngine.jquery.css?mpv='.MAILPOET_VERSION).'">';
// JS
$output[] = '<script type="text/javascript" src="'.
Env::$assets_url.'/js/vendor.js?mp_ver='.MAILPOET_VERSION.
'"></script>';
$output[] = '<script type="text/javascript" src="'.
Env::$assets_url.'/js/public.js?mp_ver='.MAILPOET_VERSION.
'"></script>';
// (JS) form submission
$output[] = '<script type="text/javascript" src="'.plugins_url('wysija-newsletters/'.'www/mailpoet_form_subscribe.js?mpv='.MAILPOET_VERSION).'"></script>';
// (JS) variables...
// (JS) variables...
$output[] = '<script type="text/javascript">';
$output[] = ' var MailPoetData = MailPoetData || {';
$output[] = ' var MailPoetForm = MailPoetForm || {';
$output[] = ' is_rtl: '.((int)is_rtl()).",";
$output[] = ' ajax_url: "'.admin_url('admin-ajax.php').'"';
$output[] = ' };';
$output[] = '</script>';
$output[] = '<!--END Scripts-->';
$output[] = '<!-- '.
__('END Scripts', 'mailpoet').
'-->';
$form_widget = new Widget();
$output[] = $form_widget->widget(array(

View File

@ -15,9 +15,9 @@ class Widget extends \WP_Widget {
function __construct () {
return parent::__construct(
'mailpoet_form',
__('MailPoet Form'),
__('MailPoet Form', 'mailpoet'),
array(
'description' => __('Add a newsletter subscription form')
'description' => __('Add a newsletter subscription form', 'mailpoet')
)
);
}
@ -40,7 +40,7 @@ class Widget extends \WP_Widget {
$instance = wp_parse_args(
(array)$instance,
array(
'title' => __("Subscribe to Our Newsletter")
'title' => __("Subscribe to Our Newsletter", 'mailpoet')
)
);
@ -55,7 +55,7 @@ class Widget extends \WP_Widget {
// get forms list
$forms = Form::getPublished()->orderByAsc('name')->findArray();
?><p>
<label for="<?php $this->get_field_id( 'title' ) ?>"><?php _e( 'Title:' ); ?></label>
<label for="<?php $this->get_field_id( 'title' ) ?>"><?php _e('Title:', 'mailpoet'); ?></label>
<input
type="text"
class="widefat"
@ -75,7 +75,7 @@ class Widget extends \WP_Widget {
</select>
</p>
<p>
<a href="javascript:;" onClick="createSubscriptionForm()" class="mailpoet_form_new"><?php _e("Create a new form"); ?></a>
<a href="javascript:;" onClick="createSubscriptionForm()" class="mailpoet_form_new"><?php _e('Create a new form', 'mailpoet'); ?></a>
</p>
<script type="text/javascript">
function createSubscriptionForm() {

47
lib/Helpscout/Beacon.php Normal file
View File

@ -0,0 +1,47 @@
<?php
namespace MailPoet\Helpscout;
use MailPoet\Models\Subscriber;
use MailPoet\Models\Setting;
if(!defined('ABSPATH')) exit;
class Beacon {
static function getData() {
global $wpdb;
$db_version = $wpdb->get_var('SELECT @@VERSION');
$mta = Setting::getValue('mta');
$current_theme = wp_get_theme();
$current_user = wp_get_current_user();
return array(
'name' => $current_user->display_name,
'email' => $current_user->user_email,
'PHP version' => PHP_VERSION,
'MailPoet version' => MAILPOET_VERSION,
'WordPress version' => get_bloginfo('version'),
'Database version' => $db_version,
'WP_MEMORY_LIMIT' => WP_MEMORY_LIMIT,
'WP_MAX_MEMORY_LIMIT' => WP_MAX_MEMORY_LIMIT,
'WP_DEBUG' => WP_DEBUG,
'PHP max_execution_time' => ini_get('max_execution_time'),
'PHP memory_limit' => ini_get('memory_limit'),
'PHP upload_max_filesize' => ini_get('upload_max_filesize'),
'PHP post_max_size' => ini_get('post_max_size'),
'WordPress language' => get_locale(),
'Multisite environment?' => (is_multisite() ? 'Yes' : 'No'),
'Current Theme' => $current_theme->get('Name').
' (version '.$current_theme->get('Version').')',
'Active Plugin names' => join(", ", get_option('active_plugins')),
'Sending Method' => $mta['method'],
'Sending Frequency' => sprintf('%d emails every %d minutes',
$mta['frequency']['emails'],
$mta['frequency']['interval']
),
'Task Scheduler method' => Setting::getValue('cron_trigger.method'),
'Default FROM address' => Setting::getValue('sender.address'),
'Default Reply-To address' => Setting::getValue('reply_to.address'),
'Bounce Email Address' => Setting::getValue('bounce.address'),
'Total number of subscribers' => Subscriber::getTotalSubscribers()
);
}
}

View File

@ -15,6 +15,20 @@ class Handler {
$this->model_class = $model_class;
$this->model = \Model::factory($this->model_class);
// check if sort order was specified or default to "asc"
$sort_order = (!empty($data['sort_order'])) ? $data['sort_order'] : 'asc';
// constrain sort order value to either be "asc" or "desc"
$sort_order = ($sort_order === 'asc') ? 'asc' : 'desc';
// sanitize sort by
$sort_by = (!empty($data['sort_by']))
? filter_var($data['sort_by'], FILTER_SANITIZE_STRING)
: '';
if(empty($sort_by)) {
$sort_by = 'id';
}
$this->data = array(
// extra parameters
'params' => (isset($data['params']) ? $data['params'] : array()),
@ -27,8 +41,8 @@ class Handler {
// searching
'search' => (isset($data['search']) ? $data['search'] : null),
// sorting
'sort_by' => (!empty($data['sort_by']) ? $data['sort_by'] : 'id'),
'sort_order' => (!empty($data['sort_order']) ? $data['sort_order'] : 'asc'),
'sort_by' => $sort_by,
'sort_order' => $sort_order,
// grouping
'group' => (isset($data['group']) ? $data['group'] : null),
// filters

View File

@ -1,11 +1,9 @@
<?php
namespace MailPoet\Mailer;
use MailPoet\Models\Setting;
require_once(ABSPATH . 'wp-includes/pluggable.php');
if(!defined('ABSPATH')) exit;
require_once(ABSPATH . 'wp-includes/pluggable.php');
class Mailer {
public $mailer_config;
@ -93,7 +91,7 @@ class Mailer {
);
break;
default:
throw new \Exception(__('Mailing method does not exist'));
throw new \Exception(__('Mailing method does not exist', 'mailpoet'));
}
return $mailer_instance;
}
@ -101,7 +99,7 @@ class Mailer {
static function getMailerConfig($mailer = false) {
if(!$mailer) {
$mailer = Setting::getValue(self::MAILER_CONFIG_SETTING_NAME);
if(!$mailer || !isset($mailer['method'])) throw new \Exception(__('Mailer is not configured'));
if(!$mailer || !isset($mailer['method'])) throw new \Exception(__('Mailer is not configured', 'mailpoet'));
}
if(empty($mailer['frequency'])) {
$default_settings = Setting::getDefaults();
@ -118,7 +116,7 @@ class Mailer {
function getSenderNameAndAddress($sender = false) {
if(empty($sender)) {
$sender = Setting::getValue('sender', array());
if(empty($sender['address'])) throw new \Exception(__('Sender name and email are not configured'));
if(empty($sender['address'])) throw new \Exception(__('Sender name and email are not configured', 'mailpoet'));
}
return array(
'from_name' => $sender['name'],

View File

@ -54,7 +54,7 @@ class MailerLog {
static function enforceSendingLimit() {
if(self::isSendingLimitReached()) {
throw new \Exception(__('Sending frequency limit has been reached.'));
throw new \Exception(__('Sending frequency limit has been reached.', 'mailpoet'));
}
}
}

View File

@ -17,11 +17,19 @@ class AmazonSES {
public $reply_to;
public $date;
public $date_without_time;
private $available_regions = array(
'US East (N. Virginia)' => 'us-east-1',
'US West (Oregon)' => 'us-west-2',
'EU (Ireland)' => 'eu-west-1'
);
function __construct($region, $access_key, $secret_key, $sender, $reply_to) {
$this->aws_access_key = $access_key;
$this->aws_secret_key = $secret_key;
$this->aws_region = $region;
$this->aws_region = (in_array($region, $this->available_regions)) ? $region : false;
if(!$this->aws_region) {
throw new \Exception(__('Unsupported Amazon SES region.', 'mailpoet'));
}
$this->aws_endpoint = sprintf('email.%s.amazonaws.com', $this->aws_region);
$this->aws_signing_algorithm = 'AWS4-HMAC-SHA256';
$this->aws_service = 'ses';
@ -34,6 +42,7 @@ class AmazonSES {
$this->date_without_time = gmdate('Ymd');
}
function send($newsletter, $subscriber) {
$result = wp_remote_post(
$this->url,

View File

@ -11,10 +11,10 @@ class CustomField extends Model {
function __construct() {
parent::__construct();
$this->addValidations('name', array(
'required' => __('Please specify a name')
'required' => __('Please specify a name', 'mailpoet')
));
$this->addValidations('type', array(
'required' => __('Please specify a type')
'required' => __('Please specify a type', 'mailpoet')
));
}

View File

@ -10,7 +10,7 @@ class Form extends Model {
parent::__construct();
$this->addValidations('name', array(
'required' => __('Please specify a name')
'required' => __('Please specify a name', 'mailpoet')
));
}
@ -47,12 +47,12 @@ class Form extends Model {
return array(
array(
'name' => 'all',
'label' => __('All'),
'label' => __('All', 'mailpoet'),
'count' => Form::getPublished()->count()
),
array(
'name' => 'trash',
'label' => __('Trash'),
'label' => __('Trash', 'mailpoet'),
'count' => Form::getTrashed()->count()
)
);

View File

@ -50,7 +50,7 @@ class Model extends \Sudzy\ValidModel {
$column = $matches[1];
$this->setError(
sprintf(
__('Another record already exists. Please specify a different "%1$s".'),
__('Another record already exists. Please specify a different "%1$s".', 'mailpoet'),
$column
)
);

View File

@ -23,7 +23,7 @@ class Newsletter extends Model {
function __construct() {
parent::__construct();
$this->addValidations('type', array(
'required' => __('Please specify a type')
'required' => __('Please specify a type', 'mailpoet')
));
}
@ -309,7 +309,7 @@ class Newsletter extends Model {
$segments = Segment::orderByAsc('name')->findMany();
$segment_list = array();
$segment_list[] = array(
'label' => __('All Lists'),
'label' => __('All Lists', 'mailpoet'),
'value' => ''
);
@ -408,7 +408,7 @@ class Newsletter extends Model {
$groups = array(
array(
'name' => 'all',
'label' => __('All'),
'label' => __('All', 'mailpoet'),
'count' => Newsletter::getPublished()
->filter('filterType', $type)
->count()
@ -420,7 +420,7 @@ class Newsletter extends Model {
$groups = array_merge($groups, array(
array(
'name' => self::STATUS_DRAFT,
'label' => __('Draft'),
'label' => __('Draft', 'mailpoet'),
'count' => Newsletter::getPublished()
->filter('filterType', $type)
->filter('filterStatus', self::STATUS_DRAFT)
@ -428,7 +428,7 @@ class Newsletter extends Model {
),
array(
'name' => self::STATUS_SCHEDULED,
'label' => __('Scheduled'),
'label' => __('Scheduled', 'mailpoet'),
'count' => Newsletter::getPublished()
->filter('filterType', $type)
->filter('filterStatus', self::STATUS_SCHEDULED)
@ -436,7 +436,7 @@ class Newsletter extends Model {
),
array(
'name' => self::STATUS_SENDING,
'label' => __('Sending'),
'label' => __('Sending', 'mailpoet'),
'count' => Newsletter::getPublished()
->filter('filterType', $type)
->filter('filterStatus', self::STATUS_SENDING)
@ -444,7 +444,7 @@ class Newsletter extends Model {
),
array(
'name' => self::STATUS_SENT,
'label' => __('Sent'),
'label' => __('Sent', 'mailpoet'),
'count' => Newsletter::getPublished()
->filter('filterType', $type)
->filter('filterStatus', self::STATUS_SENT)
@ -458,7 +458,7 @@ class Newsletter extends Model {
$groups = array_merge($groups, array(
array(
'name' => self::STATUS_ACTIVE,
'label' => __('Active'),
'label' => __('Active', 'mailpoet'),
'count' => Newsletter::getPublished()
->filter('filterType', $type)
->filter('filterStatus', self::STATUS_ACTIVE)
@ -466,7 +466,7 @@ class Newsletter extends Model {
),
array(
'name' => self::STATUS_DRAFT,
'label' => __('Not active'),
'label' => __('Not active', 'mailpoet'),
'count' => Newsletter::getPublished()
->filter('filterType', $type)
->filter('filterStatus', self::STATUS_DRAFT)
@ -478,7 +478,7 @@ class Newsletter extends Model {
$groups[] = array(
'name' => 'trash',
'label' => __('Trash'),
'label' => __('Trash', 'mailpoet'),
'count' => Newsletter::getTrashed()
->filter('filterType', $type)
->count()

View File

@ -9,10 +9,10 @@ class NewsletterOptionField extends Model {
function __construct() {
parent::__construct();
$this->addValidations('name', array(
'required' => __('Please specify a name')
'required' => __('Please specify a name', 'mailpoet')
));
$this->addValidations('newsletter_type', array(
'required' => __('Please specify a newsletter type')
'required' => __('Please specify a newsletter type', 'mailpoet')
));
}

View File

@ -10,10 +10,10 @@ class NewsletterTemplate extends Model {
parent::__construct();
$this->addValidations('name', array(
'required' => __('Please specify a name')
'required' => __('Please specify a name', 'mailpoet')
));
$this->addValidations('body', array(
'required' => __('The template body cannot be empty')
'required' => __('The template body cannot be empty', 'mailpoet')
));
}

View File

@ -10,7 +10,7 @@ class Segment extends Model {
parent::__construct();
$this->addValidations('name', array(
'required' => __('Please specify a name')
'required' => __('Please specify a name', 'mailpoet')
));
}
@ -100,9 +100,9 @@ class Segment extends Model {
// create the wp users segment
$wp_segment = Segment::create();
$wp_segment->hydrate(array(
'name' => __('WordPress Users'),
'name' => __('WordPress Users', 'mailpoet'),
'description' =>
__('This lists containts all of your WordPress users'),
__('This lists containts all of your WordPress users', 'mailpoet'),
'type' => 'wp_users'
));
$wp_segment->save();
@ -119,12 +119,12 @@ class Segment extends Model {
return array(
array(
'name' => 'all',
'label' => __('All'),
'label' => __('All', 'mailpoet'),
'count' => Segment::getPublished()->count()
),
array(
'name' => 'trash',
'label' => __('Trash'),
'label' => __('Trash', 'mailpoet'),
'count' => Segment::getTrashed()->count()
)
);
@ -143,7 +143,41 @@ class Segment extends Model {
$query = self::selectMany(array(self::$_table.'.id', self::$_table.'.name'))
->selectExpr(
self::$_table.'.*, ' .
'COUNT(IF('.MP_SUBSCRIBER_SEGMENT_TABLE.'.status="' . Subscriber::STATUS_SUBSCRIBED .'" AND '.MP_SUBSCRIBERS_TABLE.'.deleted_at IS NULL,1,NULL)) `subscribers`'
'COUNT(IF('.
MP_SUBSCRIBER_SEGMENT_TABLE.'.status="'.Subscriber::STATUS_SUBSCRIBED.'"'
.' AND '.
MP_SUBSCRIBERS_TABLE.'.deleted_at IS NULL'
.' AND '.
MP_SUBSCRIBERS_TABLE.'.status="'.Subscriber::STATUS_SUBSCRIBED.'"'
.', 1, NULL)) `subscribers`'
)
->leftOuterJoin(
MP_SUBSCRIBER_SEGMENT_TABLE,
array(self::$_table.'.id', '=', MP_SUBSCRIBER_SEGMENT_TABLE.'.segment_id'))
->leftOuterJoin(
MP_SUBSCRIBERS_TABLE,
array(MP_SUBSCRIBER_SEGMENT_TABLE.'.subscriber_id', '=', MP_SUBSCRIBERS_TABLE.'.id'))
->groupBy(self::$_table.'.id')
->groupBy(self::$_table.'.name')
->orderByAsc(self::$_table.'.name')
->whereNull(self::$_table.'.deleted_at');
if(!empty($type)) {
$query->where(self::$_table.'.type', $type);
}
return $query->findArray();
}
static function getSegmentsForImport() {
$query = self::selectMany(array(self::$_table.'.id', self::$_table.'.name'))
->selectExpr(
self::$_table.'.*, ' .
'COUNT(IF('.
MP_SUBSCRIBER_SEGMENT_TABLE.'.status="'.Subscriber::STATUS_SUBSCRIBED.'"'
.' AND '.
MP_SUBSCRIBERS_TABLE.'.deleted_at IS NULL'
.', 1, NULL)) `subscribers`'
)
->leftOuterJoin(
MP_SUBSCRIBER_SEGMENT_TABLE,
@ -176,7 +210,7 @@ class Segment extends Model {
'AND relation.status = "' . Subscriber::STATUS_SUBSCRIBED . '" ' .
'GROUP BY segments.id) ' .
'UNION ALL ' .
'(SELECT 0 as id, "' . __('Not in a List') . '" as name, COUNT(*) as subscribers ' .
'(SELECT 0 as id, "' . __('Not in a List', 'mailpoet') . '" as name, COUNT(*) as subscribers ' .
'FROM ' . MP_SUBSCRIBERS_TABLE . ' subscribers ' .
'LEFT JOIN ' . MP_SUBSCRIBER_SEGMENT_TABLE . ' relation on relation.subscriber_id = subscribers.id ' .
(($withConfirmedSubscribers) ?

View File

@ -19,7 +19,7 @@ class Setting extends Model {
parent::__construct();
$this->addValidations('name', array(
'required' => __('Please specify a name')
'required' => __('Please specify a name', 'mailpoet')
));
}
@ -45,8 +45,8 @@ class Setting extends Model {
),
'signup_confirmation' => array(
'enabled' => true,
'subject' => sprintf(__('Confirm your subscription to %1$s'), get_option('blogname')),
'body' => __("Hello!\n\nHurray! You've subscribed to our site.\n\nPlease confirm your subscription to the list(s): [lists_to_confirm] by clicking the link below: \n\n[activation_link]Click here to confirm your subscription.[/activation_link]\n\nThank you,\n\nThe Team")
'subject' => sprintf(__('Confirm your subscription to %1$s', 'mailpoet'), get_option('blogname')),
'body' => __("Hello!\n\nHurray! You've subscribed to our site.\n\nPlease confirm your subscription to the list(s): [lists_to_confirm] by clicking the link below: \n\n[activation_link]Click here to confirm your subscription.[/activation_link]\n\nThank you,\n\nThe Team", 'mailpoet')
),
'tracking' => array(
'enabled' => true

View File

@ -18,8 +18,8 @@ class Subscriber extends Model {
parent::__construct();
$this->addValidations('email', array(
'required' => __('Please enter your email address'),
'isEmail' => __('Your email address is invalid!')
'required' => __('Please enter your email address', 'mailpoet'),
'isEmail' => __('Your email address is invalid!', 'mailpoet')
));
}
@ -75,6 +75,10 @@ class Subscriber extends Model {
function sendConfirmationEmail() {
$signup_confirmation = Setting::getValue('signup_confirmation');
if((bool)$signup_confirmation['enabled'] === false) {
return false;
}
$segments = $this->segments()->findMany();
$segment_names = array_map(function($segment) {
return $segment->name;
@ -146,7 +150,7 @@ class Subscriber extends Model {
}
static function verifyToken($email, $token) {
return (self::generateToken($email) === $token);
return call_user_func('hash_equals', self::generateToken($email), $token);
}
static function subscribe($subscriber_data = array(), $segment_ids = array()) {
@ -214,13 +218,13 @@ class Subscriber extends Model {
$segments = Segment::orderByAsc('name')->findMany();
$segment_list = array();
$segment_list[] = array(
'label' => __('All Lists'),
'label' => __('All Lists', 'mailpoet'),
'value' => ''
);
$subscribers_without_segment = self::filter('withoutSegments')->count();
$subscribers_without_segment_label = sprintf(
__('Subscribers without a list (%s)'),
__('Subscribers without a list (%s)', 'mailpoet'),
number_format($subscribers_without_segment)
);
@ -276,27 +280,27 @@ class Subscriber extends Model {
return array(
array(
'name' => 'all',
'label' => __('All'),
'label' => __('All', 'mailpoet'),
'count' => self::getPublished()->count()
),
array(
'name' => self::STATUS_SUBSCRIBED,
'label' => __('Subscribed'),
'label' => __('Subscribed', 'mailpoet'),
'count' => self::filter(self::STATUS_SUBSCRIBED)->count()
),
array(
'name' => self::STATUS_UNCONFIRMED,
'label' => __('Unconfirmed'),
'label' => __('Unconfirmed', 'mailpoet'),
'count' => self::filter(self::STATUS_UNCONFIRMED)->count()
),
array(
'name' => self::STATUS_UNSUBSCRIBED,
'label' => __('Unsubscribed'),
'label' => __('Unsubscribed', 'mailpoet'),
'count' => self::filter(self::STATUS_UNSUBSCRIBED)->count()
),
array(
'name' => 'trash',
'label' => __('Trash'),
'label' => __('Trash', 'mailpoet'),
'count' => self::getTrashed()->count()
)
);
@ -379,6 +383,7 @@ class Subscriber extends Model {
'subscribers.id = relation.subscriber_id',
'subscribers'
)
->whereNull('subscribers.deleted_at')
->where('subscribers.status', 'subscribed');
return $subscribers;
}

View File

@ -15,12 +15,6 @@ class AutomatedLatestContent {
function __construct($newsletter_id = false, $newer_than_timestamp = false) {
$this->newsletter_id = $newsletter_id;
$this->newer_than_timestamp = $newer_than_timestamp;
$this->_attachSentPostsFilter();
}
function __destruct() {
$this->_detachSentPostsFilter();
}
function filterOutSentPosts($where) {
@ -72,7 +66,10 @@ class AutomatedLatestContent {
);
}
return get_posts($parameters);
$this->_attachSentPostsFilter();
$posts = get_posts($parameters);
$this->_detachSentPostsFilter();
return $posts;
}
function transformPosts($args, $posts) {
@ -129,4 +126,4 @@ class AutomatedLatestContent {
remove_action('posts_where', array($this, 'filterOutSentPosts'));
}
}
}
}

View File

@ -77,7 +77,7 @@ class PostContentManager {
// remove embedded video and replace with links
$content = preg_replace(
'#<iframe.*?src=\"(.+?)\".*><\/iframe>#',
'<a href="$1">'.__('Click here to view media.').'</a>',
'<a href="$1">'.__('Click here to view media.', 'mailpoet').'</a>',
$content
);

View File

@ -38,10 +38,11 @@ class Renderer {
function render($data, $column_count) {
$block_content = '';
array_map(function($block) use (&$block_content, &$column_content, $column_count) {
$rendered_block_element = $this->createElementFromBlockType($block, $column_count);
$_this = $this;
array_map(function($block) use (&$block_content, &$column_content, $column_count, $_this) {
$rendered_block_element = $_this->createElementFromBlockType($block, $column_count);
if(isset($block['blocks'])) {
$rendered_block_element = $this->render($block, $column_count);
$rendered_block_element = $_this->render($block, $column_count);
}
// vertical orientation denotes column container
if($block['type'] === 'container' && $block['orientation'] === 'vertical') {

View File

@ -6,6 +6,9 @@ use MailPoet\Newsletter\Renderer\StylesHelper;
class Text {
static function render($element) {
$html = $element['text'];
// replace &nbsp; with spaces
$html = str_replace('&nbsp;', ' ', $html);
$html = str_replace('\xc2\xa0', ' ', $html);
$html = self::convertBlockquotesToTables($html);
$html = self::convertParagraphsToTables($html);
$html = self::styleLists($html);

View File

@ -11,7 +11,7 @@ class Renderer {
$this->getOneColumnTemplate($styles, $class) :
$this->getMultipleColumnsTemplate($styles, $width, $alignment, $class);
$result = array_map(function($content) use ($template) {
$content = self::removePaddingFromLastElement($content);
$content = Renderer::removePaddingFromLastElement($content);
return $template['content_start'] . $content . $template['content_end'];
}, $columns_data);
$result = implode('', $result);

View File

@ -59,13 +59,14 @@ class Renderer {
? $content['blocks']
: array();
$rendered_content = array_map(function($content_block) {
$_this = $this;
$rendered_content = array_map(function($content_block) use($_this) {
$column_count = count($content_block['blocks']);
$column_data = $this->blocks_renderer->render(
$column_data = $_this->blocks_renderer->render(
$content_block,
$column_count
);
return $this->columns_renderer->render(
return $_this->columns_renderer->render(
$content_block['styles'],
$column_count,
$column_data
@ -107,6 +108,7 @@ class Renderer {
}
function renderTextVersion($template) {
$template = utf8_encode($template);
return \Html2Text\Html2Text::convert($template);
}

View File

@ -41,7 +41,7 @@ class StylesHelper {
static function getStyles($data, $type, $ignore_specific_styles = false) {
$styles = array_map(function($attribute, $style) use ($ignore_specific_styles) {
if(!$ignore_specific_styles || !in_array($attribute, $ignore_specific_styles)) {
return self::translateCSSAttribute($attribute) . ': ' . $style . ' !important;';
return StylesHelper::translateCSSAttribute($attribute) . ': ' . $style . ' !important;';
}
}, array_keys($data[$type]), $data[$type]);
return implode('', $styles);

View File

@ -14,4 +14,4 @@ class Date {
);
return (isset($actions[$action])) ? $actions[$action] : false;
}
}
}

View File

@ -24,7 +24,7 @@ class Link {
return sprintf(
'<a target="_blank" href="%s">%s</a>',
$url,
__('Unsubscribe')
__('Unsubscribe', 'mailpoet')
);
case 'subscription_unsubscribe_url':
@ -43,7 +43,7 @@ class Link {
return sprintf(
'<a target="_blank" href="%s">%s</a>',
$url,
__('Manage subscription')
__('Manage subscription', 'mailpoet')
);
case 'subscription_manage_url':
@ -60,7 +60,7 @@ class Link {
return sprintf(
'<a target="_blank" href="%s">%s</a>',
$url,
__('View in your browser')
__('View in your browser', 'mailpoet')
);
case 'newsletter_view_in_browser_url':
@ -125,4 +125,4 @@ class Link {
private static function getShortcode($action) {
return sprintf('[link:%s]', $action);
}
}
}

View File

@ -1,10 +1,10 @@
<?php
namespace MailPoet\Newsletter\Shortcodes\Categories;
use MailPoet\Models\SendingQueue;
use MailPoet\Newsletter\Shortcodes\ShortcodesHelper;
use MailPoet\Models\Newsletter as NewsletterModel;
require_once( ABSPATH . "wp-includes/pluggable.php" );
if(!defined('ABSPATH')) exit;
require_once(ABSPATH . "wp-includes/pluggable.php");
class Newsletter {
static function process($action,
@ -16,7 +16,7 @@ class Newsletter {
) {
switch($action) {
case 'subject':
return ($newsletter) ? $newsletter['subject'] : false;
return ($newsletter) ? $newsletter->subject : false;
case 'total':
return substr_count($content, 'data-post-id');
@ -28,10 +28,10 @@ class Newsletter {
return ($latest_post) ? $latest_post['post_title'] : false;
case 'number':
if($newsletter['type'] !== 'notification') return false;
if($newsletter->type !== NewsletterModel::TYPE_NOTIFICATION_HISTORY) return false;
$sent_newsletters =
SendingQueue::where('newsletter_id', $newsletter['id'])
->where('status', 'completed')
NewsletterModel::where('parent_id', $newsletter->parent_id)
->where('status', NewsletterModel::STATUS_SENT)
->count();
return ++$sent_newsletters;
@ -54,4 +54,4 @@ class Newsletter {
$posts->posts[0]->to_array() :
false;
}
}
}

Some files were not shown because too many files have changed in this diff Show More