Compare commits

..

187 Commits

Author SHA1 Message Date
b25877c514 Bump up release version to 3.0.1 2017-09-26 18:18:17 +03:00
7551fff93f Merge pull request #1116 from mailpoet/fix-tests
Fixing Shortcodes issue [MAILPOET-1104]
2017-09-25 17:14:35 -04:00
b2aa919574 Merge pull request #1118 from mailpoet/fix-query
Add index to improve query performance [MAILPOET-1117]
2017-09-25 17:04:25 -04:00
1102bbe483 Merge pull request #1056 from mailpoet/resize-image
Add image resize feature [MAILPOET-1047]
2017-09-25 13:07:10 +03:00
b78dd22ba9 Merge pull request #1109 from mailpoet/templates-images-src
Adding https prefix the image sources [MAILPOET-1109]
2017-09-25 12:08:02 +03:00
73110ada46 fixing ESLint tests 2017-09-25 09:06:55 +00:00
74dedd06bc changing missing tempaltes 2017-09-25 08:57:18 +00:00
20c936d13b limitting width with CSS 2017-09-21 18:58:17 +00:00
f135b89de9 Fixed image resize bugs 2017-09-21 18:58:16 +00:00
6a83930ae0 Resizing the image fixed 2017-09-21 18:57:35 +00:00
a1d0acfac2 Add image resize feature 2017-09-21 18:56:47 +00:00
04be06c0cb remove additional new line 2017-09-21 18:47:43 +00:00
78d52d6298 Merge pull request #1117 from mailpoet/eslint
Eslint rules [MAILPOET-1081]
2017-09-21 19:42:19 +03:00
5ff7c28c43 Merge pull request #1110 from mailpoet/es6_spacing
Fix ESLint spacing rules for ES6 [MAILPOET-1082]
2017-09-21 17:15:57 +03:00
5526f315d2 Merge pull request #1115 from mailpoet/scheduled_newsletter_status_fix
Sets newsletter status to draft when it's unscheduled [MAILPOET-1060]
2017-09-21 16:32:12 +03:00
d5e25fdeb1 Merge pull request #1114 from mailpoet/long_email_sql_error_fix
Fixes SQL error resulting from subscription with long email [MAILPOET-1113]
2017-09-21 16:17:21 +03:00
90a7bf5179 Adds back rendered subject clearing test
Removes duplicate line
2017-09-21 09:13:13 -04:00
bf1f696870 Add index to improve query performance
[MAILPOET-1117]
2017-09-21 13:17:02 +01:00
95551ad049 ES5 keyword-spacing 2017-09-21 09:13:36 +00:00
1ad90680f4 ES5 object-curly-spacing 2017-09-21 09:12:52 +00:00
d69d3cb421 ES5 array-bracket-spacing 2017-09-21 09:12:37 +00:00
9adca07393 ES5 computed-property-spacing 2017-09-21 09:12:23 +00:00
a9d129fddc ES5 block-spacing 2017-09-21 09:12:09 +00:00
b4ac09bea3 ES5 key-spacing 2017-09-21 09:11:55 +00:00
b1a403d9b5 ES5 space-infix-ops 2017-09-21 09:09:29 +00:00
28504fb5e3 ES5 spaced-comment 2017-09-21 09:08:52 +00:00
8ebb8e3c02 ES5 no-trailing-spaces 2017-09-21 09:04:47 +00:00
c95c2cd1ae ES5 space-in-parens 2017-09-21 09:04:32 +00:00
946bee2194 ES5 space-before-blocks 2017-09-21 09:02:50 +00:00
1f9bd04308 ES5 space-unary-ops 2017-09-21 08:52:30 +00:00
33572b2dc7 ES5 no-multi-spaces 2017-09-21 08:47:23 +00:00
680446b77e ES5 space-before-function-parens 2017-09-21 08:35:12 +00:00
bf1d76a3a7 Fix readme.txt 2017-09-20 16:57:17 +01:00
c915fcfdff Release 3.0.0 2017-09-20 15:21:55 +01:00
02966c3b93 Sets cron daemon timeout to 5s across the plugin
Adds hook to override cron request arguments
2017-09-20 14:59:48 +01:00
84dc48daec Allow passing cron timeouts
[MAILPOET-1114]
2017-09-20 14:59:48 +01:00
12225004f4 Apply hook on cron timeout
[MAILPOET-1114]
2017-09-20 14:59:48 +01:00
320dfa2ec5 Extracts duplicate code into reusable methods
Updates unit test
2017-09-20 14:59:48 +01:00
b5f3016085 Removes URL from user agent
(https://mailpoet.slack.com/archives/C02MTKAJL/p1505488541000029?thread_ts=1505488163.000795&cid=C02MTKAJL)
2017-09-20 14:59:48 +01:00
cd53e369d0 Allows accessing full URL from within custom cron hook 2017-09-20 14:59:48 +01:00
6fc11af774 Returns error message instead of empty body 2017-09-20 14:59:48 +01:00
42e3a97616 Fixing Shortcodes issue 2017-09-20 12:34:27 +00:00
6b16aa1692 Sets newsletter status to draft when it's unscheduled 2017-09-19 21:59:03 -04:00
03d0de74e4 Merge pull request #1108 from mailpoet/send_twice_tooltip
Show a tooltip about sending an email twice only when the Send button is disabled [MAILPOET-1098]
2017-09-19 20:38:10 -04:00
c3b643df84 Prevents leaking SQL errors in API response 2017-09-19 20:32:26 -04:00
697f9ba5bc Adds min/max email length in UI and backend 2017-09-19 20:04:49 -04:00
28c75c5b96 Adds a thousand separator 2017-09-19 09:55:38 -04:00
6f255854f2 Merge pull request #1112 from mailpoet/copy_update
Update free MSS plan size to 2000 subscribers [MAILPOET-1112]
2017-09-19 12:46:36 +03:00
91c5f9c43e Clarify Premium plugin benefits 2017-09-19 12:41:25 +03:00
62acd6404a Update free MSS plan size to 2k subscribers, update plugin description 2017-09-19 12:15:46 +03:00
adc1461771 Don't show send tooltip for paused newsletters [MAILPOET-1098] 2017-09-19 08:51:16 +03:00
66cc0964ce Merge pull request #1106 from mailpoet/fix-tests
Fixing MP API test
2017-09-18 18:23:20 -04:00
10d77720ad Merge pull request #1107 from mailpoet/hooks_unit_test_update
Updates hooks unit test [MAILPOET-1110]
2017-09-18 17:39:50 +02:00
475114c6f9 Fix ES6 no-irregular-whitespace eslint rule [MAILPOET-1082] 2017-09-18 18:31:13 +03:00
a0fec7d103 Fix ES6 space-infix-ops eslint rule [MAILPOET-1082] 2017-09-18 18:27:43 +03:00
4d9d92a026 Fix ES6 array-bracket-spacing eslint rule [MAILPOET-1082] 2017-09-18 18:26:43 +03:00
e51aa8c271 Fix ES6 space-in-parens eslint rule [MAILPOET-1082] 2017-09-18 18:25:37 +03:00
d44adedade Fix ES6 key-spacing eslint rule [MAILPOET-1082] 2017-09-18 18:24:26 +03:00
9fb3c50aa7 Fix ES6 no-multi-spaces eslint rule [MAILPOET-1082] 2017-09-18 18:23:36 +03:00
907053a349 Fix ES6 space-unary-ops eslint rule [MAILPOET-1082] 2017-09-18 18:22:48 +03:00
f0f85cfb59 Fix ES6 template-curly-spacing eslint rule [MAILPOET-1082] 2017-09-18 18:21:44 +03:00
44d0341fb2 Fix ES6 keyword-spacing eslint rule [MAILPOET-1082] 2017-09-18 18:20:55 +03:00
0cdae52c66 Fix ES6 react/jsx-curly-spacing eslint rule [MAILPOET-1082] 2017-09-18 18:18:45 +03:00
0cd9c8e416 Adding https prefix the image sources 2017-09-18 15:11:55 +00:00
9e3010ab52 Fix ES6 react/jsx-tag-spacing eslint rule [MAILPOET-1082] 2017-09-18 18:05:57 +03:00
d831b2df55 Explicitly sets up hooks instead of assuming they are already set up 2017-09-18 10:43:17 -04:00
16ff630e88 Show a tooltip about sending an email twice only when the Send button is dsiabled [MAILPOET-1098] 2017-09-18 17:42:24 +03:00
d35763662e Fixing MP API test 2017-09-18 12:00:43 +00:00
10be411b12 Prepare release v3.0.0 2017-09-18 11:35:59 +01:00
6ecce192f7 Merge pull request #1105 from mailpoet/wp_sync_multisite
Fix WP sync throwing 'Table "users" doesn't exist' errors on multisite subsites [MAILPOET-1107]
2017-09-18 11:48:30 +03:00
ee07e60fe9 Adds new survey 2017-09-18 09:13:06 +01:00
a35d7a1154 Fix WP sync throwing 'Table users doesn't exist' errors on multisite subsites [MAILPOET-1107] 2017-09-18 10:55:49 +03:00
ebba8dbfd6 Merge pull request #1103 from mailpoet/twig_version_conflict_detection_improvement
Updates Twig version conflict detection logic [MAILPOET-1068]
2017-09-18 10:42:51 +03:00
44c637c06b Merge pull request #1101 from mailpoet/premium_key_in_beacon
Add Premium key to Help Scout beacon [MAILPOET-1090]
2017-09-17 12:08:52 -04:00
d54ba734bf Adds a min-max range of supported Twig versions 2017-09-17 11:25:35 -04:00
b45fc22306 Updates coding style and cleans up JS script inclusion part 2017-09-16 11:34:21 -04:00
994935d4ae Adds check for minimum Twig version loaded by external plugins 2017-09-16 11:33:40 -04:00
ceb5ce850c Removes deprecated Twig_ExtensionInterface::getName()
(https://github.com/twigphp/Twig/blob/2.x/CHANGELOG#L207)
Removes deprecated Twig_Extension_GlobalsInterface
(https://github.com/twigphp/Twig/blob/2.x/CHANGELOG#L259)
2017-09-16 11:30:40 -04:00
97b5ed945d Merge pull request #1100 from mailpoet/update-send-copy
Update send copy [MAILPOET-1101]
2017-09-14 20:02:28 +02:00
873b322245 Translate
[MAILPOET-1101]
2017-09-14 18:52:33 +01:00
12ad9e41e7 Translate a string
[MAILPOET-1101]
2017-09-14 18:40:04 +01:00
96b418e455 Our free plan will be for 1,000 subscribers and not 250
[MAILPOET-1101]
2017-09-14 17:35:15 +01:00
8ea7861f77 Merge pull request #1102 from mailpoet/welcome-tab-update
Update welcome tab [MAILPOET-1099]
2017-09-14 19:34:01 +03:00
821976c881 Make text random
[MAILPOET-1099]
2017-09-14 17:19:55 +01:00
6f1443e43d Update welcome tab
[MAILPOET-1099]
2017-09-14 15:35:07 +01:00
09fcaecdfc Add Premium key to Help Scout beacon [MAILPOET-1090] 2017-09-14 16:24:15 +03:00
efd72ca9f6 Merge pull request #1099 from mailpoet/update-readme
Update readme.txt for launch v3
2017-09-14 15:38:36 +03:00
550b5e9aed More readme.txt updates
[MAILPOET-1105]
2017-09-14 13:37:10 +01:00
4b7ae5fcff Fix typo
[MAILPOET-1105]
2017-09-14 13:28:44 +01:00
fa85e12127 Update premium section in readme.txt
[MAILPOET-1105]
2017-09-14 13:27:07 +01:00
1cce50902b Update Send with... other copy
[MAILPOET-1101]
2017-09-14 11:39:20 +01:00
2048fa5cf9 Update Send with... mailpoet copy
[MAILPOET-1101]
2017-09-14 11:31:43 +01:00
f438c8fd31 Update readme.txt for launch v3
[MAILPOET-1105]
2017-09-14 10:15:00 +01:00
0bfa832dad Merge pull request #1098 from mailpoet/subscribers-fix
Subscribers fix [MAILPOET-1102]
2017-09-13 18:17:56 +03:00
483dfbe1ec Fix removal of WP segment subscribers without wp_user_id [MAILPOET-1102] 2017-09-13 16:46:50 +03:00
561fee491d Merge pull request #1097 from mailpoet/makepot_views_fix
Fix makepot adding extra slashes to escaped characters in views [MAILPOET-1093]
2017-09-13 14:54:25 +02:00
97d157192a Remove orphaned links
[MAILPOET-1102]
2017-09-13 13:30:23 +01:00
6b14a8a057 Remove data from usermeta
[MAILPOET-1102]
2017-09-13 13:18:39 +01:00
d27b187f5e Fix QA problems
[MAILPOET-1102]
2017-09-13 13:15:50 +01:00
02d49ba2ca DELETE subscribers in WP list which are not WP users
[MAILPOET-1102]
2017-09-13 13:07:01 +01:00
f3571a5855 Add another testing scenario
[MAILPOET-1102]
2017-09-13 08:54:54 +01:00
3d5f0df213 Don't delete subscribers with wp_user_id = 0 [MAILPOET-1102] 2017-09-13 10:15:09 +03:00
595a201fe7 Stop deleting subscribers
[MAILPOET-1102]
2017-09-12 17:53:12 +01:00
c3db7d8148 Release 3.0.0-rc.2.0.3 2017-09-12 15:41:06 +03:00
4a2187ff32 Merge pull request #1096 from mailpoet/translation_strings_update
Removes escape character in translations [MAILPOET-1093]
2017-09-12 14:24:38 +03:00
279c36a30d Merge pull request #1094 from mailpoet/initializer_update
Updates plugin initialization logic [MAILPOET-1097]
2017-09-12 12:34:27 +03:00
fd65117a5d Fix makepot adding extra slashes to escaped characters in views [MAILPOET-1093] 2017-09-12 11:17:04 +03:00
9305beace3 Removes escape character in translations 2017-09-11 19:27:03 -04:00
ba86cbfb18 Updates unit test 2017-09-11 11:40:14 -04:00
2ac7d1d4ab Breaks plugin initialization into 3 stages: preInit, init and postInit 2017-09-11 11:33:03 -04:00
e9c55260c8 Merge pull request #1092 from mailpoet/db_version_settings_logic_update
Uses plugin's settings to store DB version [MAILPOET-1095]
2017-09-11 18:15:17 +03:00
99b6a287f8 Highlight a container block when hovering over its tools [MAILPOET-1088] 2017-09-11 15:32:45 +01:00
d645f0cad4 Merge pull request #1087 from mailpoet/eslint-un
Eslint un [MAILPOET-1073]
2017-09-11 16:16:51 +02:00
b0343254c0 Renames db version setting value 2017-09-11 10:05:09 -04:00
cc368f015b Remove redundant argument
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
4e508855fc Fix eslint no-unused-expressions in tests
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
72c0a6f165 Fix eslint no-undef in tests
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
f266508654 Fix eslint no-undef in ES6
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
1893d82b2d Fix eslint no-unused-expressions in ES6
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
bb1dd6a2ec Fix eslint import/no-unresolved in ES6
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
7097ea5d9b Fix eslint no-unreachable in ES6
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
b4092e0641 Fix eslint no-unneeded-ternary in ES5
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
2c068c7bb6 Fix eslint no-unreachable in ES5
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
a1a4fcb978 Fix eslint no-unused-expressions in ES5
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
f77620d649 Fix eslint no-undef in ES5
[MAILPOET-1085]
2017-09-11 15:03:30 +01:00
9e932c9078 Merge pull request #1085 from mailpoet/improve-user-sync
Improve user sync [MAILPOET-1073]
2017-09-11 14:56:41 +03:00
de47dbe41b Removes arrow functions that are not supported in IE 2017-09-11 10:25:43 +01:00
6d36d67a60 Delete orphaned subscribers instead of updating their id
[MAILPOET-1073]
2017-09-11 10:09:32 +01:00
607bf51b37 Merge two test cases for one class
[MAILPOET-1073]
2017-09-11 09:28:39 +01:00
f38ed0272c Merge pull request #1093 from mailpoet/cron_helper_improvement
Cron helper improvement [MAILPOET-1096]
2017-09-11 11:23:01 +03:00
eef969439b Code comment
[MAILPOET-1073]
2017-09-11 09:22:40 +01:00
272f552f3c Clean data befre and after test run
[MAILPOET-1073]
2017-09-11 09:22:18 +01:00
dff9c1012b Moves widget initialization back to widgets_init hook
Removes priority from plugin initialization
2017-09-10 19:49:05 -04:00
52470360a1 Returns ping response body instead of boolean 2017-09-10 18:49:15 -04:00
6c62459ed4 Adds filter to override default cron request URL 2017-09-10 18:36:22 -04:00
98482cebf9 Uses plugin's settings to store DB version 2017-09-10 16:31:36 -04:00
509880119e Merge pull request #1090 from mailpoet/eslint-indent
Eslint indent [MAILPOET-1029]
2017-09-07 20:13:20 -04:00
195ccb5eed Fix indent rule in tests
[MAILPOET-1029]
2017-09-07 16:05:45 +01:00
122af1c943 Fix react/jsx-indent rule in ES6
[MAILPOET-1029]
2017-09-07 15:59:38 +01:00
169940058b Fix react/jsx-indent-props rule in ES6
[MAILPOET-1029]
2017-09-07 15:52:46 +01:00
478e60d60e Fix indent rule in ES5
[MAILPOET-1029]
2017-09-07 15:51:25 +01:00
9fc0ac8c4f Merge pull request #1089 from mailpoet/color_picker
Change color on click, add history to color picker [MAILPOET-1087]
2017-09-07 17:08:09 +03:00
e86b780479 Fix build`
[MAILPOET-1073]
2017-09-07 14:44:55 +01:00
42f08bdc65 Fix handling of empty color and transparent color selected from palette [MAILPOET-1087] 2017-09-07 15:48:14 +03:00
c2789cdac3 Don't load all ids to memory, PHP could crash
[MAILPOET-1073]
2017-09-07 13:42:18 +01:00
8a362f49f8 Add test for users synchronisation
[MAILPOET-1073]
2017-09-07 13:42:18 +01:00
784a80d1a5 Use ->prefix instead of wp_
[MAILPOET-1073]
2017-09-07 13:42:18 +01:00
922d2b4b5f Fix migration
[MAILPOET-1073]
2017-09-07 13:42:18 +01:00
91e8461cac Clean the code
[MAILPOET-1073]
2017-09-07 13:42:18 +01:00
8757598a2d Add index
[MAILPOET-1073]
2017-09-07 13:42:18 +01:00
524aabea1d Split users sync into multiple queries
[MAILPOET-1073]
2017-09-07 13:42:18 +01:00
513181ff47 Change color on click, add history to color picker [MAILPOET-1087] 2017-09-07 13:17:57 +03:00
6bc288ed54 Merge pull request #1088 from mailpoet/depreciated_twig_notice_fix
Fixed Twig's deprecated notice [MAILPOET-1092]
2017-09-07 12:48:11 +03:00
77f3a875dd Does not set global is_rtl variable 2017-09-06 20:56:52 -04:00
6584250d1a Adds is_rtl() function to Twig 2017-09-06 20:55:44 -04:00
e42db162aa Merge pull request #1086 from mailpoet/translation_fixes
Fix translations based on translator feedback on TX [MAILPOET-1091]
2017-09-06 16:30:13 +03:00
2762096167 Switch strtoupper to mb_strtoupper based on feedback 2017-09-06 16:14:52 +03:00
b2ec3e5f7b Fix translations based on translator feedback on TX [MAILPOET-1091] 2017-09-06 13:45:42 +03:00
e012bd6cbe Updates changelog & bumps up release version to 3.0.0-rc.2.0.2 2017-09-05 11:17:32 -04:00
a02e64e805 Merge pull request #1084 from mailpoet/editor_get_post_type_optimization
Removes unused properties from the object used to display post types in editor [MAILPOET-1086]
2017-09-05 17:43:27 +03:00
e4bb3e1133 Adds unit test 2017-09-05 10:33:10 -04:00
998795e0e0 Fix tests semi eslint rule [MAILPOET-1030] 2017-09-05 12:31:51 +01:00
ec44b84cc9 Fix ES6 no-extra-semi eslint rule [MAILPOET-1030] 2017-09-05 12:31:51 +01:00
efece061d0 Fix ES5 semi eslint rule [MAILPOET-1030] 2017-09-05 12:31:51 +01:00
e347fc74a2 Fix ES5 no-extra-semi eslint rule [MAILPOET-1030] 2017-09-05 12:31:51 +01:00
027418a86c Fix ES5 semi-spacing eslint rule [MAILPOET-1030] 2017-09-05 12:31:51 +01:00
864187aa02 Merge pull request #1080 from mailpoet/json_api_method_check_fix
Throws error when JSON API endpoint method is not found [MAILPOET-1074]
2017-09-05 13:08:37 +03:00
59ae6619c0 Browser preview mixed content error fix
Strips protocol from preview URL

[MAILPOET-1080]
2017-09-05 08:54:23 +01:00
6aa0be8d01 Removes unused properties from the object 2017-09-04 21:07:15 -04:00
657658ea2b Adds new poll 2017-09-04 10:49:11 +02:00
8647128e12 Merge pull request #1081 from mailpoet/default_status_update
Default status is set depending on the signup confirmation option [MAILPOET-1079]
2017-09-04 10:02:45 +03:00
c8d92b3cd2 Default status is set depending on the signup confirmation option 2017-08-31 18:48:43 -04:00
cc8b7b45ed Throws error when endpoint method is not found 2017-08-31 15:18:22 -04:00
5b8b8c8441 Merge pull request #1077 from mailpoet/helpscout
Split support inquiries into Free and Premium inboxes [MAILPOET-869]
2017-08-31 12:38:18 -04:00
7106c640ef Refactor HelpScout Beacon embed script 2017-08-31 19:24:32 +03:00
300b84983d Merge pull request #1078 from mailpoet/spellchecker
Enable browser spellchecker [MAILPOET-1078]
2017-08-31 18:14:47 +03:00
49c1b92838 Enable browser spellchecker 2017-08-31 18:03:19 +03:00
d900827850 Merge pull request #1076 from mailpoet/lint-lines
Lint lines [MAILPOET-1031]
2017-08-31 12:49:10 +03:00
1688d4dbe1 Split support inquiries into Free and Premium inboxes [MAILPOET-869] 2017-08-31 12:02:20 +03:00
f438eee842 Fix ESLint newline-per-chained-call in tests
[MAILPOET-1031]
2017-08-30 15:26:02 +02:00
33733219f6 Fix ESLint object-property-newline in tests
[MAILPOET-1031]
2017-08-30 15:20:39 +02:00
737a83cdf3 Fix ESLint linebreak-style in tests
[MAILPOET-1031]
2017-08-30 15:19:15 +02:00
9061e1b495 Fix ESLint no-multipe-empty-lines ES6
[MAILPOET-1031]
2017-08-30 15:11:56 +02:00
09199e41a1 Fix ESLint linebreak-style ES5
[MAILPOET-1031]
2017-08-30 14:59:34 +02:00
4e91932613 Fix ESLint lines-around-directive ES5
[MAILPOET-1031]
2017-08-30 14:45:25 +02:00
227de4ecfa Fix ESLint newline-per-chained-call ES5
[MAILPOET-1031]
2017-08-30 14:40:42 +02:00
c1ccacf851 Fix ESLint newline-per-chained-call
[MAILPOET-1031]
2017-08-30 14:30:48 +02:00
208 changed files with 4823 additions and 3934 deletions

View File

@ -9,51 +9,32 @@
}, },
"rules": { "rules": {
"import/no-amd": 0, "import/no-amd": 0,
"space-before-function-paren": 0,
"prefer-arrow-callback": 0, "prefer-arrow-callback": 0,
"no-undef": 0,
"key-spacing": 0,
"radix": 0, "radix": 0,
"no-alert": 0, "no-alert": 0,
"block-scoped-var": 0, "block-scoped-var": 0,
"guard-for-in": 0, "guard-for-in": 0,
"no-prototype-builtins": 0, "no-prototype-builtins": 0,
"no-restricted-syntax": 0, "no-restricted-syntax": 0,
"newline-per-chained-call": 0,
"no-useless-concat": 0, "no-useless-concat": 0,
"no-multi-spaces": 0,
"no-nested-ternary": 0, "no-nested-ternary": 0,
"semi-spacing": 0,
"no-sequences": 0, "no-sequences": 0,
"no-useless-return": 0, "no-useless-return": 0,
"array-callback-return": 0, "array-callback-return": 0,
"new-cap": 0, "new-cap": 0,
"no-continue": 0, "no-continue": 0,
"no-new": 0, "no-new": 0,
"space-unary-ops": 0,
"no-redeclare": 0, "no-redeclare": 0,
"no-console": 0, "no-console": 0,
"no-empty": 0, "no-empty": 0,
"no-extra-semi": 0,
"no-useless-escape": 0, "no-useless-escape": 0,
"wrap-iife": 0, "wrap-iife": 0,
"no-unused-expressions": 0,
"block-spacing": 0,
"computed-property-spacing": 0,
"no-plusplus": 0, "no-plusplus": 0,
"array-bracket-spacing": 0,
"lines-around-directive": 0,
"no-unreachable": 0,
"default-case": 0, "default-case": 0,
"no-lonely-if": 0, "no-lonely-if": 0,
"space-before-blocks": 0,
"no-unneeded-ternary": 0,
"no-mixed-operators": 0, "no-mixed-operators": 0,
"eqeqeq": 0, "eqeqeq": 0,
"space-in-parens": 0,
"semi": 0,
"max-len": 0, "max-len": 0,
"no-trailing-spaces": 0,
"global-require": 0, "global-require": 0,
"no-throw-literal": 0, "no-throw-literal": 0,
"no-extra-bind": 0, "no-extra-bind": 0,
@ -66,21 +47,15 @@
"no-use-before-define": 0, "no-use-before-define": 0,
"one-var": 0, "one-var": 0,
"camelcase": 0, "camelcase": 0,
"spaced-comment": 0,
"padded-blocks": 0, "padded-blocks": 0,
"object-curly-spacing": 0,
"strict": 0, "strict": 0,
"vars-on-top": 0, "vars-on-top": 0,
"no-var": 0, "no-var": 0,
"space-infix-ops": 0,
"no-unused-vars": 0, "no-unused-vars": 0,
"object-shorthand": 0, "object-shorthand": 0,
"new-parens": 0, "new-parens": 0,
"keyword-spacing": 0,
"eol-last": 0, "eol-last": 0,
"dot-notation": 0, "dot-notation": 0,
"linebreak-style": 0,
"indent": 0,
"prefer-template": 0, "prefer-template": 0,
"func-names": 0 "func-names": 0
} }

View File

@ -10,6 +10,9 @@
"jsx": true "jsx": true
} }
}, },
"settings": {
"import/resolver": "webpack"
},
"rules": { "rules": {
"comma-dangle": ["error", "always-multiline"], "comma-dangle": ["error", "always-multiline"],
"import/no-amd": 0, "import/no-amd": 0,
@ -18,19 +21,15 @@
"react/jsx-max-props-per-line": 0, "react/jsx-max-props-per-line": 0,
"react/prop-types": 0, "react/prop-types": 0,
"react/jsx-first-prop-new-line": 0, "react/jsx-first-prop-new-line": 0,
"react/jsx-indent-props": 0,
"react/no-is-mounted": 0, "react/no-is-mounted": 0,
"react/jsx-no-target-blank": 0, "react/jsx-no-target-blank": 0,
"react/no-render-return-value": 0, "react/no-render-return-value": 0,
"react/jsx-boolean-value": 0, "react/jsx-boolean-value": 0,
"react/jsx-indent": 0,
"react/jsx-no-bind": 0, "react/jsx-no-bind": 0,
"react/no-array-index-key": 0, "react/no-array-index-key": 0,
"react/self-closing-comp": 0, "react/self-closing-comp": 0,
"react/jsx-tag-spacing": 0,
"react/jsx-closing-bracket-location": 0, "react/jsx-closing-bracket-location": 0,
"react/no-string-refs": 0, "react/no-string-refs": 0,
"react/jsx-curly-spacing": 0,
"react/no-did-mount-set-state": 0, "react/no-did-mount-set-state": 0,
"react/prefer-stateless-function": 0, "react/prefer-stateless-function": 0,
"jsx-a11y/label-has-for": 0, "jsx-a11y/label-has-for": 0,
@ -41,34 +40,21 @@
"no-bitwise": 0, "no-bitwise": 0,
"arrow-body-style": 0, "arrow-body-style": 0,
"prefer-template": 0, "prefer-template": 0,
"keyword-spacing": 0,
"default-case": 0, "default-case": 0,
"array-callback-return": 0, "array-callback-return": 0,
"consistent-return": 0, "consistent-return": 0,
"no-unreachable": 0,
"no-extra-semi": 0,
"import/no-unresolved": 0,
"import/extensions": 0, "import/extensions": 0,
"import/no-extraneous-dependencies": 0, "import/no-extraneous-dependencies": 0,
"camelcase": 0, "camelcase": 0,
"template-curly-spacing": 0,
"eqeqeq": 0, "eqeqeq": 0,
"no-lonely-if": 0, "no-lonely-if": 0,
"space-unary-ops": 0,
"block-scoped-var": 0, "block-scoped-var": 0,
"no-extra-bind": 0, "no-extra-bind": 0,
"no-multi-spaces": 0,
"class-methods-use-this": 0, "class-methods-use-this": 0,
"key-spacing": 0,
"no-multiple-empty-lines": 0,
"space-in-parens": 0,
"no-case-declarations": 0, "no-case-declarations": 0,
"array-bracket-spacing": 0,
"newline-per-chained-call": 0,
"no-else-return": 0, "no-else-return": 0,
"max-len": 0, "max-len": 0,
"no-useless-concat": 0, "no-useless-concat": 0,
"no-unused-expressions": 0,
"no-sequences": 0, "no-sequences": 0,
"no-extra-boolean-cast": 0, "no-extra-boolean-cast": 0,
"dot-notation": 0, "dot-notation": 0,
@ -79,10 +65,7 @@
"no-script-url": 0, "no-script-url": 0,
"wrap-iife": 0, "wrap-iife": 0,
"vars-on-top": 0, "vars-on-top": 0,
"space-infix-ops": 0,
"no-irregular-whitespace": 0,
"padded-blocks": 0, "padded-blocks": 0,
"no-underscore-dangle": 0, "no-underscore-dangle": 0
"no-undef": 0
} }
} }

View File

@ -9,23 +9,16 @@
}, },
"rules": { "rules": {
"import/no-amd": 0, "import/no-amd": 0,
"no-undef": 0,
"one-var": 0, "one-var": 0,
"indent": 0,
"linebreak-style": 0,
"no-whitespace-before-property": 0, "no-whitespace-before-property": 0,
"object-property-newline": 0,
"global-require": 0, "global-require": 0,
"semi": 0,
"keyword-spacing": 0, "keyword-spacing": 0,
"no-bitwise": 0, "no-bitwise": 0,
"newline-per-chained-call": 0,
"no-spaced-func": 0, "no-spaced-func": 0,
"func-call-spacing": 0, "func-call-spacing": 0,
"max-len": 0, "max-len": 0,
"space-unary-ops": 0, "space-unary-ops": 0,
"no-unused-vars": 0, "no-unused-vars": 0,
"no-unused-expressions": 0,
"no-underscore-dangle": 0, "no-underscore-dangle": 0,
"no-shadow": 0, "no-shadow": 0,
"padded-blocks": 0, "padded-blocks": 0,

View File

@ -48,3 +48,41 @@ $resize-handle-z-index = 2
.mailpoet_resize_handle .mailpoet_resize_handle
display: inline-block display: inline-block
.mailpoet_image_resize_handle_container
position: absolute
bottom: 0
right: 0
width: 20px
height: 20px
.mailpoet_image_resize_handle
position: relative
background: $resize-handle-background-color
border-radius(3px)
display: inline-block
width: 20px
height: 20px
cursor: nwse-resize
z-index: $resize-handle-z-index
.mailpoet_image_resize_handle_text,
.mailpoet_image_resize_handle_icon
pointer-events: none
.mailpoet_image_resize_handle_icon
position: absolute
top: 0
right: 0
& > svg
width: 100%
height: 100%
fill: $resize-handle-font-color
.mailpoet_block.mailpoet_image_resize_active > .mailpoet_block_highlight
border: 1px dashed $resize-active-color
.mailpoet_image_resize_handle
display: inline-block

View File

@ -23,9 +23,11 @@ $block-text-line-height = $text-line-height
border: 1px solid $transparent-color border: 1px solid $transparent-color
&:hover > .mailpoet_block_highlight &:hover > .mailpoet_block_highlight
&.mailpoet_highlight > .mailpoet_block_highlight
border: 1px dashed $block-hover-highlight-color border: 1px dashed $block-hover-highlight-color
&.mailpoet_highlight > .mailpoet_block_highlight
border: 1px dashed $block-hover-highlight-color !important
.mailpoet_content .mailpoet_content
position: relative position: relative
line-height: $block-text-line-height line-height: $block-text-line-height

View File

@ -3,14 +3,19 @@
img img
vertical-align: bottom vertical-align: bottom
max-width: 100% max-width: 100%
width: auto
height: auto height: auto
&.mailpoet_full_image &.mailpoet_full_image
padding-left: 0 padding-left: 0
padding-right: 0 padding-right: 0
margin: auto
margin-bottom: 0 margin-bottom: 0
.mailpoet_content a:hover .mailpoet_content
margin: auto
max-width: 100%
min-width: 36px
a:hover
cursor: all-scroll cursor: all-scroll

View File

@ -33,3 +33,6 @@ Custom styles for MailPoet pages.
p.top-space-triple p.top-space-triple
margin-top: 3em margin-top: 3em
p.mailpoet-top-text
margin-right: 0

View File

@ -62,6 +62,15 @@
margin-bottom: 2em margin-bottom: 2em
margin-top: 2em margin-top: 2em
.sending-free-plan-button
background: #FF5301
border-color: #e64c03
text-shadow: 0 -1px 1px #e64c03
box-shadow: 0 1px 0 #e64c03
margin: 10px 0
strong
text-transform: uppercase
.mailpoet_success_item::before .mailpoet_success_item::before
content ' ' content ' '

View File

@ -35,7 +35,7 @@ define('ajax', ['mailpoet', 'jquery', 'underscore'], function(mp, jQuery, _) {
// set default url // set default url
if (this.options.url === null) { if (this.options.url === null) {
this.options.url = ajaxurl; this.options.url = window.ajaxurl;
} }
// set default token // set default token

View File

@ -38,20 +38,11 @@ function exportMixpanel(mp) {
function trackCachedEvents() { function trackCachedEvents() {
eventsCache.map(function (event) { eventsCache.map(function (event) {
if (window.mailpoet_analytics_enabled || event.forced) { if (window.mailpoet_analytics_enabled || event.forced) {
window.mixpanel.track(event.name, event.data) window.mixpanel.track(event.name, event.data);
} }
}); });
} }
function initializeMixpanelWhenLoaded() {
if (typeof window.mixpanel === 'object') {
exportMixpanel(MailPoet);
trackCachedEvents();
} else {
setTimeout(initializeMixpanelWhenLoaded, 100);
}
}
function cacheEvent(forced, name, data) { function cacheEvent(forced, name, data) {
eventsCache.push({ eventsCache.push({
name: name, name: name,
@ -65,6 +56,15 @@ define(
function (mp, _) { function (mp, _) {
var MailPoet = mp; var MailPoet = mp;
function initializeMixpanelWhenLoaded() {
if (typeof window.mixpanel === 'object') {
exportMixpanel(MailPoet);
trackCachedEvents();
} else {
setTimeout(initializeMixpanelWhenLoaded, 100);
}
}
MailPoet.trackEvent = _.partial(cacheEvent, false); MailPoet.trackEvent = _.partial(cacheEvent, false);
MailPoet.forceTrackEvent = _.partial(cacheEvent, true); MailPoet.forceTrackEvent = _.partial(cacheEvent, true);

View File

@ -212,7 +212,6 @@ define([
year={this.state.year} year={this.state.year}
placeholder={this.props.field.year_placeholder} placeholder={this.props.field.year_placeholder}
/>); />);
break;
case 'MM': case 'MM':
return (<FormFieldDateMonth return (<FormFieldDateMonth
@ -224,7 +223,6 @@ define([
monthNames={monthNames} monthNames={monthNames}
placeholder={this.props.field.month_placeholder} placeholder={this.props.field.month_placeholder}
/>); />);
break;
case 'DD': case 'DD':
return (<FormFieldDateDay return (<FormFieldDateDay
@ -235,7 +233,6 @@ define([
day={this.state.day} day={this.state.day}
placeholder={this.props.field.day_placeholder} placeholder={this.props.field.day_placeholder}
/>); />);
break;
} }
}); });
@ -245,7 +242,7 @@ define([
</div> </div>
); );
} }
}; }
return FormFieldDate; return FormFieldDate;
}); });

View File

@ -7,6 +7,7 @@ define([
'form/fields/checkbox.jsx', 'form/fields/checkbox.jsx',
'form/fields/selection.jsx', 'form/fields/selection.jsx',
'form/fields/date.jsx', 'form/fields/date.jsx',
'jquery',
], ],
( (
React, React,
@ -16,7 +17,8 @@ define([
FormFieldRadio, FormFieldRadio,
FormFieldCheckbox, FormFieldCheckbox,
FormFieldSelection, FormFieldSelection,
FormFieldDate FormFieldDate,
jQuery
) => { ) => {
const FormField = React.createClass({ const FormField = React.createClass({
renderField: function (data, inline = false) { renderField: function (data, inline = false) {

View File

@ -116,6 +116,7 @@ define([
} }
}, },
handleChange: function (e) { handleChange: function (e) {
let value;
if (this.props.onValueChange !== undefined) { if (this.props.onValueChange !== undefined) {
if (this.props.field.multiple) { if (this.props.field.multiple) {
value = jQuery('#' + this.refs.select.id).val(); value = jQuery('#' + this.refs.select.id).val();

View File

@ -5,13 +5,15 @@ define(
'classnames', 'classnames',
'react-router', 'react-router',
'form/fields/field.jsx', 'form/fields/field.jsx',
'jquery',
], ],
( (
React, React,
MailPoet, MailPoet,
classNames, classNames,
Router, Router,
FormField FormField,
jQuery
) => { ) => {
const Form = React.createClass({ const Form = React.createClass({

View File

@ -4,6 +4,7 @@
* company: Wysija * company: Wysija
* framework: prototype 1.7.2 * framework: prototype 1.7.2
*/ */
'use strict'; 'use strict';
Event.cacheDelegated = {}; Event.cacheDelegated = {};
@ -24,14 +25,14 @@ Object.extend(document, (function() {
function findWrapper(selector, eventName, handler) { function findWrapper(selector, eventName, handler) {
var c = getWrappersForSelector(selector, eventName); var c = getWrappersForSelector(selector, eventName);
return c.find(function (wrapper) { return c.find(function (wrapper) {
return wrapper.handler === handler return wrapper.handler === handler;
}); });
} }
function destroyWrapper(selector, eventName, handler) { function destroyWrapper(selector, eventName, handler) {
var c = getCacheForSelector(selector); var c = getCacheForSelector(selector);
if (!c[eventName]) return false; if (!c[eventName]) return false;
var wrapper = findWrapper(selector, eventName, handler) var wrapper = findWrapper(selector, eventName, handler);
c[eventName] = c[eventName].without(wrapper); c[eventName] = c[eventName].without(wrapper);
return wrapper; return wrapper;
} }
@ -77,7 +78,7 @@ Object.extend(document, (function() {
} }
return document; return document;
} }
} };
})()); })());
var Observable = (function () { var Observable = (function () {
@ -90,7 +91,7 @@ var Observable = (function() {
function getHandlers(klass) { function getHandlers(klass) {
var proto = klass.prototype, var proto = klass.prototype,
namespace = proto.namespace; namespace = proto.namespace;
return Object.keys(proto).grep(/^on/).inject($H(), function(handlers, name) { return Object.keys(proto).grep(/^on/).inject(window.$H(), function (handlers, name) {
if (name === 'onDomLoaded') return handlers; if (name === 'onDomLoaded') return handlers;
handlers.set(getEventName(name, namespace), getWrapper(proto[name], klass)); handlers.set(getEventName(name, namespace), getWrapper(proto[name], klass));
return handlers; return handlers;
@ -100,11 +101,11 @@ var Observable = (function() {
function getWrapper(handler, klass) { function getWrapper(handler, klass) {
return function (event) { return function (event) {
return handler.call(new klass(this), event, event.memo); return handler.call(new klass(this), event, event.memo);
} };
} }
function onDomLoad(selector, klass) { function onDomLoad(selector, klass) {
$$(selector).each(function(element) { window.$$(selector).each(function (element) {
new klass(element).onDomLoaded(); new klass(element).onDomLoaded();
}); });
} }
@ -113,7 +114,13 @@ var Observable = (function() {
if (!this.handlers) this.handlers = {}; if (!this.handlers) this.handlers = {};
if (this.handlers[selector]) return; if (this.handlers[selector]) return;
var klass = this; var klass = this;
if(this.prototype.onDomLoaded) document.loaded ? onDomLoad(selector, klass) : document.observe('dom:loaded', onDomLoad.curry(selector, klass)); if (this.prototype.onDomLoaded) {
if (document.loaded) {
onDomLoad(selector, klass);
} else {
document.observe('dom:loaded', onDomLoad.curry(selector, klass));
}
}
this.handlers[selector] = getHandlers(klass).each(function (handler) { this.handlers[selector] = getHandlers(klass).each(function (handler) {
document.delegate(selector, handler.key, handler.value); document.delegate(selector, handler.key, handler.value);
}); });
@ -125,16 +132,16 @@ var Observable = (function() {
}); });
delete this.handlers[selector]; delete this.handlers[selector];
} }
} };
})(); })();
// override droppables // override droppables
Object.extend(Droppables, { Object.extend(window.Droppables, {
deactivate: Droppables.deactivate.wrap(function(proceed, drop, draggable) { deactivate: window.Droppables.deactivate.wrap(function (proceed, drop, draggable) {
if (drop.onLeave) drop.onLeave(draggable, drop.element); if (drop.onLeave) drop.onLeave(draggable, drop.element);
return proceed(drop); return proceed(drop);
}), }),
activate: Droppables.activate.wrap(function(proceed, drop, draggable) { activate: window.Droppables.activate.wrap(function (proceed, drop, draggable) {
if (drop.onEnter) drop.onEnter(draggable, drop.element); if (drop.onEnter) drop.onEnter(draggable, drop.element);
return proceed(drop); return proceed(drop);
}), }),
@ -142,14 +149,14 @@ Object.extend(Droppables, {
if (!this.drops.length) return; if (!this.drops.length) return;
var drop, affected = []; var drop, affected = [];
this.drops.each(function (drop) { this.drops.each(function (drop) {
if(Droppables.isAffected(point, element, drop)) affected.push(drop); if (window.Droppables.isAffected(point, element, drop)) affected.push(drop);
}); });
if(affected.length > 0) drop = Droppables.findDeepestChild(affected); if (affected.length > 0) drop = window.Droppables.findDeepestChild(affected);
if (this.last_active && this.last_active !== drop) this.deactivate(this.last_active, element); if (this.last_active && this.last_active !== drop) this.deactivate(this.last_active, element);
if (drop) { if (drop) {
Position.within(drop.element, point[0], point[1]); window.Position.within(drop.element, point[0], point[1]);
if(drop.onHover) drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); if (drop.onHover) drop.onHover(element, drop.element, window.Position.overlap(drop.overlap, drop.element));
if(drop !== this.last_active) Droppables.activate(drop, element); if (drop !== this.last_active) window.Droppables.activate(drop, element);
} }
}, },
displayArea: function (draggable) { displayArea: function (draggable) {
@ -198,36 +205,36 @@ var WysijaHistory = {
// check if the field is unique // check if the field is unique
if (parseInt(clone.readAttribute('wysija_unique'), 10) === 1) { if (parseInt(clone.readAttribute('wysija_unique'), 10) === 1) {
// check if the field is already in the queue // check if the field is already in the queue
$(WysijaHistory.container).select('[wysija_name="' + clone.readAttribute('wysija_name') + '"]').invoke('remove'); window.$(WysijaHistory.container).select('[wysija_name="' + clone.readAttribute('wysija_name') + '"]').invoke('remove');
} }
// check history size // check history size
if($(WysijaHistory.container).select('> div').length >= WysijaHistory.size) { if (window.$(WysijaHistory.container).select('> div').length >= WysijaHistory.size) {
// remove oldest element (last in the list) // remove oldest element (last in the list)
$(WysijaHistory.container).select('> div').last().remove(); window.$(WysijaHistory.container).select('> div').last().remove();
} }
// store block in history // store block in history
$(WysijaHistory.container).insert({ window.$(WysijaHistory.container).insert({
top: clone top: clone
}); });
}, },
dequeue: function () { dequeue: function () {
// pop last block off the history // pop last block off the history
var block = $(WysijaHistory.container).select('div').first(); var block = window.$(WysijaHistory.container).select('div').first();
if (block !== undefined) { if (block !== undefined) {
// insert block back into the editor // insert block back into the editor
$(WysijaForm.options.body).insert({ window.$(WysijaForm.options.body).insert({
top: block top: block
}); });
} }
}, },
clear: function () { clear: function () {
$(WysijaHistory.container).innerHTML = ''; window.$(WysijaHistory.container).innerHTML = '';
}, },
remove: function (field) { remove: function (field) {
$(WysijaHistory.container).select('[wysija_name="' + field + '"]').invoke('remove'); window.$(WysijaHistory.container).select('[wysija_name="' + field + '"]').invoke('remove');
} }
}; };
@ -271,17 +278,17 @@ var WysijaForm = {
}, },
loading: function (is_loading) { loading: function (is_loading) {
if (is_loading) { if (is_loading) {
$(WysijaForm.options.editor).addClassName('loading'); window.$(WysijaForm.options.editor).addClassName('loading');
$(WysijaForm.options.toolbar).addClassName('loading'); window.$(WysijaForm.options.toolbar).addClassName('loading');
} else { } else {
$(WysijaForm.options.editor).removeClassName('loading'); window.$(WysijaForm.options.editor).removeClassName('loading');
$(WysijaForm.options.toolbar).removeClassName('loading'); window.$(WysijaForm.options.toolbar).removeClassName('loading');
} }
}, },
loadStatic: function (blocks) { loadStatic: function (blocks) {
$A(blocks).each(function(block) { window.$A(blocks).each(function (block) {
// create block // create block
WysijaForm.Block.create(block, $('block_placeholder')); WysijaForm.Block.create(block, window.$('block_placeholder'));
}); });
}, },
load: function (data) { load: function (data) {
@ -289,13 +296,13 @@ var WysijaForm = {
// load body // load body
if (data.body !== undefined) { if (data.body !== undefined) {
$A(data.body).each(function(block) { window.$A(data.body).each(function (block) {
// create block // create block
WysijaForm.Block.create(block, $('block_placeholder')); WysijaForm.Block.create(block, window.$('block_placeholder'));
}); });
// load settings // load settings
var settings_elements = $('mailpoet_form_settings').getElements(); var settings_elements = window.$('mailpoet_form_settings').getElements();
settings_elements.each(function (setting) { settings_elements.each(function (setting) {
// skip lists // skip lists
if (setting.name === 'segments') { if (setting.name === 'segments') {
@ -304,7 +311,7 @@ var WysijaForm = {
// if the input value is equal to the one stored in the settings // if the input value is equal to the one stored in the settings
if (setting.value === data.settings[setting.name]) { if (setting.value === data.settings[setting.name]) {
// check selected value // check selected value
$(setting).checked = true; window.$(setting).checked = true;
} }
} else if (data.settings[setting.name] !== undefined) { } else if (data.settings[setting.name] !== undefined) {
if (typeof data.settings[setting.name] === 'string') { if (typeof data.settings[setting.name] === 'string') {
@ -319,10 +326,10 @@ var WysijaForm = {
save: function () { save: function () {
var position = 1, var position = 1,
data = { data = {
name: $F('mailpoet_form_name'), name: window.$F('mailpoet_form_name'),
settings: $('mailpoet_form_settings').serialize(true), settings: window.$('mailpoet_form_settings').serialize(true),
body: [], body: [],
styles: (MailPoet.CodeEditor !== undefined) ? MailPoet.CodeEditor.getValue() : null styles: (window.MailPoet.CodeEditor !== undefined) ? window.MailPoet.CodeEditor.getValue() : null
}; };
// body // body
WysijaForm.getBlocks().each(function (b) { WysijaForm.getBlocks().each(function (b) {
@ -394,11 +401,11 @@ var WysijaForm = {
return data; return data;
}, },
toggleWidgets: function () { toggleWidgets: function () {
$$('a[wysija_unique="1"]').invoke('removeClassName', 'disabled'); window.$$('a[wysija_unique="1"]').invoke('removeClassName', 'disabled');
// loop through each unique field already inserted in the editor and disable its toolbar equivalent // loop through each unique field already inserted in the editor and disable its toolbar equivalent
$$('#' + WysijaForm.options.editor + ' [wysija_unique="1"]').map(function(element) { window.$$('#' + WysijaForm.options.editor + ' [wysija_unique="1"]').map(function (element) {
var field = $$('#' + WysijaForm.options.toolbar + ' [wysija_id="' + element.readAttribute('wysija_id') + '"]'); var field = window.$$('#' + WysijaForm.options.toolbar + ' [wysija_id="' + element.readAttribute('wysija_id') + '"]');
if (field.length > 0) { if (field.length > 0) {
field.first().addClassName('disabled'); field.first().addClassName('disabled');
} }
@ -407,18 +414,18 @@ var WysijaForm = {
var hasSegmentSelection = WysijaForm.hasSegmentSelection(); var hasSegmentSelection = WysijaForm.hasSegmentSelection();
if (hasSegmentSelection) { if (hasSegmentSelection) {
$('mailpoet_form_segments').writeAttribute('required', false).disable(); window.$('mailpoet_form_segments').writeAttribute('required', false).disable();
$('mailpoet_settings_segment_selection').hide(); window.$('mailpoet_settings_segment_selection').hide();
} else { } else {
$('mailpoet_form_segments').writeAttribute('required', true).enable(); window.$('mailpoet_form_segments').writeAttribute('required', true).enable();
$('mailpoet_settings_segment_selection').show(); window.$('mailpoet_settings_segment_selection').show();
} }
}, },
hasSegmentSelection: function () { hasSegmentSelection: function () {
return ($$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]').length > 0); return (window.$$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]').length > 0);
}, },
isSegmentSelectionValid: function () { isSegmentSelectionValid: function () {
var segment_selection = $$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]')[0]; var segment_selection = window.$$('#' + WysijaForm.options.editor + ' [wysija_id="segments"]')[0];
if (segment_selection !== undefined) { if (segment_selection !== undefined) {
var block = WysijaForm.get(segment_selection).block.getData(); var block = WysijaForm.get(segment_selection).block.getData();
return ( return (
@ -446,7 +453,7 @@ var WysijaForm = {
if (target !== undefined) { if (target !== undefined) {
// get placeholders (previous placeholder matches the placeholder linked to the next block) // get placeholders (previous placeholder matches the placeholder linked to the next block)
var block_placeholder = $(target.element.readAttribute('wysija_placeholder')), var block_placeholder = window.$(target.element.readAttribute('wysija_placeholder')),
previous_placeholder = target.element.previous('.block_placeholder'); previous_placeholder = target.element.previous('.block_placeholder');
if (block_placeholder !== null) { if (block_placeholder !== null) {
@ -468,18 +475,18 @@ var WysijaForm = {
WysijaForm.scroll = document.viewport.getScrollOffsets(); WysijaForm.scroll = document.viewport.getScrollOffsets();
}, },
hideSettings: function () { hideSettings: function () {
$(WysijaForm.options.container).select('.wysija_settings').invoke('hide'); window.$(WysijaForm.options.container).select('.wysija_settings').invoke('hide');
}, },
setSettingsPosition: function () { setSettingsPosition: function () {
// get viewport offsets and dimensions // get viewport offsets and dimensions
var viewportHeight = document.viewport.getHeight(), var viewportHeight = document.viewport.getHeight(),
blockPadding = 5; blockPadding = 5;
$(WysijaForm.options.container).select('.wysija_settings').each(function(element) { window.$(WysijaForm.options.container).select('.wysija_settings').each(function (element) {
// get parent dimensions and position // get parent dimensions and position
var parentDim = element.up('.mailpoet_form_block').getDimensions(), var parentDim = element.up('.mailpoet_form_block').getDimensions(),
parentPos = element.up('.mailpoet_form_block').cumulativeOffset(), parentPos = element.up('.mailpoet_form_block').cumulativeOffset(),
is_visible = (parentPos.top <= (WysijaForm.scroll.top + viewportHeight)) ? true : false, is_visible = (parentPos.top <= (WysijaForm.scroll.top + viewportHeight)),
buttonMargin = 5, buttonMargin = 5,
relativeTop = buttonMargin; relativeTop = buttonMargin;
@ -493,22 +500,22 @@ var WysijaForm = {
relativeTop = parseInt((parentDim.height / 2) - (element.getHeight() / 2), 10); relativeTop = parseInt((parentDim.height / 2) - (element.getHeight() / 2), 10);
} }
// set position for button // set position for button
$(element).setStyle({ window.$(element).setStyle({
left: parseInt((parentDim.width / 2) - (element.getWidth() / 2)) + 'px', left: parseInt((parentDim.width / 2) - (element.getWidth() / 2)) + 'px',
top: relativeTop + 'px' top: relativeTop + 'px'
}); });
}); });
}, },
initToolbarPosition: function () { initToolbarPosition: function () {
if(WysijaForm.toolbar.top === null) WysijaForm.toolbar.top = parseInt($(WysijaForm.options.container).positionedOffset().top); if (WysijaForm.toolbar.top === null) WysijaForm.toolbar.top = parseInt(window.$(WysijaForm.options.container).positionedOffset().top);
if (WysijaForm.toolbar.y === null) WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top); if (WysijaForm.toolbar.y === null) WysijaForm.toolbar.y = parseInt(WysijaForm.toolbar.top);
if(isRtl) { if (window.isRtl) {
if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0; if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0;
} else { } else {
if(WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = parseInt($(WysijaForm.options.container).positionedOffset().left); if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = parseInt(window.$(WysijaForm.options.container).positionedOffset().left);
} }
if(WysijaForm.toolbar.x === null) WysijaForm.toolbar.x = parseInt(WysijaForm.toolbar.left + $(WysijaForm.options.container).getDimensions().width + 15); if (WysijaForm.toolbar.x === null) WysijaForm.toolbar.x = parseInt(WysijaForm.toolbar.left + window.$(WysijaForm.options.container).getDimensions().width + 15);
}, },
setToolbarPosition: function () { setToolbarPosition: function () {
@ -519,13 +526,13 @@ var WysijaForm = {
visibility: 'visible' visibility: 'visible'
}; };
if(isRtl) { if (window.isRtl) {
position.right = WysijaForm.toolbar.x + 'px'; position.right = WysijaForm.toolbar.x + 'px';
} else { } else {
position.left = WysijaForm.toolbar.x + 'px'; position.left = WysijaForm.toolbar.x + 'px';
} }
$(WysijaForm.options.toolbar).setStyle(position); window.$(WysijaForm.options.toolbar).setStyle(position);
}, },
updateToolbarPosition: function () { updateToolbarPosition: function () {
// init toolbar position (updates scroll and toolbar y) // init toolbar position (updates scroll and toolbar y)
@ -537,31 +544,31 @@ var WysijaForm = {
if (WysijaForm.scroll.top >= (WysijaForm.toolbar.top - 20)) { if (WysijaForm.scroll.top >= (WysijaForm.toolbar.top - 20)) {
WysijaForm.toolbar.y = parseInt(20 + WysijaForm.scroll.top); WysijaForm.toolbar.y = parseInt(20 + WysijaForm.scroll.top);
// start effect // start effect
WysijaForm.toolbar.effect = new Effect.Move(WysijaForm.options.toolbar, { WysijaForm.toolbar.effect = new window.Effect.Move(WysijaForm.options.toolbar, {
x: WysijaForm.toolbar.x, x: WysijaForm.toolbar.x,
y: WysijaForm.toolbar.y, y: WysijaForm.toolbar.y,
mode: 'absolute', mode: 'absolute',
duration: 0.2 duration: 0.2
}); });
} else { } else {
$(WysijaForm.options.toolbar).setStyle({ window.$(WysijaForm.options.toolbar).setStyle({
left: WysijaForm.toolbar.x + 'px', left: WysijaForm.toolbar.x + 'px',
top: WysijaForm.toolbar.top + 'px' top: WysijaForm.toolbar.top + 'px'
}); });
} }
}, },
blockDropOptions: { blockDropOptions: {
accept: $w('mailpoet_form_field'), // acceptable items (classes array) accept: window.$w('mailpoet_form_field'), // acceptable items (classes array)
onEnter: function (draggable, droppable) { onEnter: function (draggable, droppable) {
$(droppable).addClassName('hover'); window.$(droppable).addClassName('hover');
}, },
onLeave: function (draggable, droppable) { onLeave: function (draggable, droppable) {
$(droppable).removeClassName('hover'); window.$(droppable).removeClassName('hover');
}, },
onDrop: function (draggable, droppable) { onDrop: function (draggable, droppable) {
// custom data for images // custom data for images
droppable.fire('wjfe:item:drop', WysijaForm.getFieldData(draggable)); droppable.fire('wjfe:item:drop', WysijaForm.getFieldData(draggable));
$(droppable).removeClassName('hover'); window.$(droppable).removeClassName('hover');
} }
}, },
hideControls: function () { hideControls: function () {
@ -572,7 +579,7 @@ var WysijaForm = {
} }
}, },
hideTools: function () { hideTools: function () {
$$('.wysija_tools').invoke('hide'); window.$$('.wysija_tools').invoke('hide');
WysijaForm.locks.showingTools = false; WysijaForm.locks.showingTools = false;
}, },
instances: {}, instances: {},
@ -587,11 +594,11 @@ var WysijaForm = {
return instance; return instance;
}, },
makeDroppable: function () { makeDroppable: function () {
Droppables.add('block_placeholder', WysijaForm.blockDropOptions); window.Droppables.add('block_placeholder', WysijaForm.blockDropOptions);
}, },
makeSortable: function () { makeSortable: function () {
var body = $(WysijaForm.options.body); var body = window.$(WysijaForm.options.body);
Sortable.create(body, { window.Sortable.create(body, {
tag: 'div', tag: 'div',
only: 'mailpoet_form_block', only: 'mailpoet_form_block',
scroll: window, scroll: window,
@ -599,15 +606,15 @@ var WysijaForm = {
constraint: 'vertical' constraint: 'vertical'
}); });
Draggables.removeObserver(body); window.Draggables.removeObserver(body);
Draggables.addObserver({ window.Draggables.addObserver({
element: body, element: body,
onStart: WysijaForm.startBlockPositions, onStart: WysijaForm.startBlockPositions,
onEnd: WysijaForm.setBlockPositions onEnd: WysijaForm.setBlockPositions
}); });
}, },
hideBlockControls: function () { hideBlockControls: function () {
$$('.wysija_controls').invoke('hide'); window.$$('.wysija_controls').invoke('hide');
this.getBlockElements().invoke('removeClassName', 'hover'); this.getBlockElements().invoke('removeClassName', 'hover');
}, },
getBlocks: function () { getBlocks: function () {
@ -616,7 +623,7 @@ var WysijaForm = {
}); });
}, },
getBlockElements: function () { getBlockElements: function () {
return $(WysijaForm.options.container).select('.mailpoet_form_block'); return window.$(WysijaForm.options.container).select('.mailpoet_form_block');
}, },
startBlockPositions: function (event, target) { startBlockPositions: function (event, target) {
if (target.element.hasClassName('mailpoet_form_block')) { if (target.element.hasClassName('mailpoet_form_block')) {
@ -664,14 +671,14 @@ var WysijaForm = {
} }
}; };
WysijaForm.DraggableItem = Class.create({ WysijaForm.DraggableItem = window.Class.create({
initialize: function (element) { initialize: function (element) {
this.elementType = $(element).readAttribute('wysija_type'); this.elementType = window.$(element).readAttribute('wysija_type');
this.element = $(element).down() || $(element); this.element = window.$(element).down() || window.$(element);
this.clone = this.cloneElement(); this.clone = this.cloneElement();
this.insert(); this.insert();
}, },
STYLES: new Template('position: absolute; top: #{top}px; left: #{left}px;'), STYLES: new window.Template('position: absolute; top: #{top}px; left: #{left}px;'),
cloneElement: function () { cloneElement: function () {
var clone = this.element.clone(), var clone = this.element.clone(),
offset = this.element.cumulativeOffset(), offset = this.element.cumulativeOffset(),
@ -694,27 +701,27 @@ WysijaForm.DraggableItem = Class.create({
return this.element.up('ul'); return this.element.up('ul');
}, },
insert: function () { insert: function () {
$$('body')[0].insert(this.clone); window.$$('body')[0].insert(this.clone);
}, },
onMousedown: function (event) { onMousedown: function (event) {
var draggable = new Draggable(this.clone, { var draggable = new window.Draggable(this.clone, {
scroll: window, scroll: window,
onStart: function () { onStart: function () {
Droppables.displayArea(draggable); window.Droppables.displayArea(draggable);
}, },
onEnd: function (drag) { onEnd: function (drag) {
drag.destroy(); drag.destroy();
drag.element.remove(); drag.element.remove();
Droppables.hideArea(); window.Droppables.hideArea();
}, },
starteffect: function (element) { starteffect: function (element) {
new Effect.Opacity(element, { new window.Effect.Opacity(element, {
duration: 0.2, duration: 0.2,
from: element.getOpacity(), from: element.getOpacity(),
to: 0.7 to: 0.7
}); });
}, },
endeffect: Prototype.emptyFunction endeffect: window.Prototype.emptyFunction
}); });
draggable.initDrag(event); draggable.initDrag(event);
draggable.startDrag(event); draggable.startDrag(event);
@ -724,12 +731,12 @@ WysijaForm.DraggableItem = Class.create({
Object.extend(WysijaForm.DraggableItem, Observable).observe('a[class="mailpoet_form_field"]'); Object.extend(WysijaForm.DraggableItem, Observable).observe('a[class="mailpoet_form_field"]');
WysijaForm.Block = Class.create({ WysijaForm.Block = window.Class.create({
/* Invoked on load */ /* Invoked on load */
initialize: function (element) { initialize: function (element) {
info('block -> init'); info('block -> init');
this.element = $(element); this.element = window.$(element);
this.block = new WysijaForm.Widget(this.element); this.block = new WysijaForm.Widget(this.element);
// enable block placeholder // enable block placeholder
@ -755,21 +762,21 @@ WysijaForm.Block = Class.create({
this.element.addClassName('hover'); this.element.addClassName('hover');
try { try {
this.getControls().show(); this.getControls().show();
} catch(e) {; } catch (e) {
} }
} }
}, },
makeBlockDroppable: function () { makeBlockDroppable: function () {
if (this.isBlockDroppableEnabled() === false) { if (this.isBlockDroppableEnabled() === false) {
var block_placeholder = this.getBlockDroppable(); var block_placeholder = this.getBlockDroppable();
Droppables.add(block_placeholder.identify(), WysijaForm.blockDropOptions); window.Droppables.add(block_placeholder.identify(), WysijaForm.blockDropOptions);
block_placeholder.addClassName('enabled'); block_placeholder.addClassName('enabled');
} }
}, },
removeBlockDroppable: function () { removeBlockDroppable: function () {
if (this.isBlockDroppableEnabled()) { if (this.isBlockDroppableEnabled()) {
var block_placeholder = this.getBlockDroppable(); var block_placeholder = this.getBlockDroppable();
Droppables.remove(block_placeholder.identify()); window.Droppables.remove(block_placeholder.identify());
block_placeholder.removeClassName('enabled'); block_placeholder.removeClassName('enabled');
} }
}, },
@ -785,7 +792,7 @@ WysijaForm.Block = Class.create({
createBlockDroppable: function () { createBlockDroppable: function () {
info('block -> createBlockDroppable'); info('block -> createBlockDroppable');
this.element.insert({ this.element.insert({
before: '<div class=\"block_placeholder\">' + $('block_placeholder').innerHTML + '</div>' before: '<div class=\"block_placeholder\">' + window.$('block_placeholder').innerHTML + '</div>'
}); });
return this.element.previous('.block_placeholder'); return this.element.previous('.block_placeholder');
}, },
@ -850,7 +857,7 @@ WysijaForm.Block = Class.create({
if (this.settingsButton !== null) { if (this.settingsButton !== null) {
this.settingsButton.observe('click', function (event) { this.settingsButton.observe('click', function (event) {
// TODO: refactor // TODO: refactor
var block = $(event.target).up('.mailpoet_form_block') || null; var block = window.$(event.target).up('.mailpoet_form_block') || null;
if (block !== null) { if (block !== null) {
var field = WysijaForm.getFieldData(block); var field = WysijaForm.getFieldData(block);
this.editSettings(); this.editSettings();
@ -866,7 +873,7 @@ WysijaForm.Block = Class.create({
// save block in history // save block in history
WysijaHistory.enqueue(this.element); WysijaHistory.enqueue(this.element);
Effect.Fade(this.element.identify(), { window.Effect.Fade(this.element.identify(), {
duration: 0.2, duration: 0.2,
afterFinish: function (effect) { afterFinish: function (effect) {
// remove placeholder // remove placeholder
@ -898,20 +905,20 @@ WysijaForm.Block = Class.create({
/* Invoked on item dropped */ /* Invoked on item dropped */
WysijaForm.Block.create = function (createBlock, target) { WysijaForm.Block.create = function (createBlock, target) {
var block = createBlock; var block = createBlock;
if($('form_template_' + block.type) === null) { if (window.$('form_template_' + block.type) === null) {
return false; return false;
} }
var body = $(WysijaForm.options.body), var body = window.$(WysijaForm.options.body),
block_template = Handlebars.compile($('form_template_block').innerHTML), block_template = window.Handlebars.compile(window.$('form_template_block').innerHTML),
template = Handlebars.compile($('form_template_' + block.type).innerHTML), template = window.Handlebars.compile(window.$('form_template_' + block.type).innerHTML),
output = ''; output = '';
if (block.type === 'segment') { if (block.type === 'segment') {
if (block.params.values === undefined) { if (block.params.values === undefined) {
var settings_segments = jQuery('#mailpoet_form_segments').val(); var settings_segments = window.jQuery('#mailpoet_form_segments').val();
if (settings_segments !== null && settings_segments.length > 0) { if (settings_segments !== null && settings_segments.length > 0) {
block.params.values = mailpoet_segments.filter(function(segment) { block.params.values = window.mailpoet_segments.filter(function (segment) {
return (settings_segments.indexOf(segment.id) !== -1); return (settings_segments.indexOf(segment.id) !== -1);
}); });
} }
@ -966,10 +973,10 @@ document.observe('wjfe:item:drop', function(event) {
}); });
/* Form Widget */ /* Form Widget */
WysijaForm.Widget = Class.create(WysijaForm.Block, { WysijaForm.Widget = window.Class.create(WysijaForm.Block, {
initialize: function (element) { initialize: function (element) {
info('widget -> init'); info('widget -> init');
this.element = $(element); this.element = window.$(element);
return this; return this;
}, },
setup: function () { setup: function () {
@ -988,7 +995,7 @@ WysijaForm.Widget = Class.create(WysijaForm.Block, {
}, },
setData: function (data) { setData: function (data) {
var current_data = this.getData(), var current_data = this.getData(),
params = $H(current_data.params).merge(data.params).toObject(); params = window.$H(current_data.params).merge(data.params).toObject();
// update type if it changed // update type if it changed
if (data.type !== undefined && data.type !== current_data.type) { if (data.type !== undefined && data.type !== current_data.type) {
@ -1017,9 +1024,9 @@ WysijaForm.Widget = Class.create(WysijaForm.Block, {
this.setData(data); this.setData(data);
var options = this.getData(); var options = this.getData();
// redraw block // redraw block
var block_template = Handlebars.compile($('form_template_block').innerHTML), var block_template = window.Handlebars.compile(window.$('form_template_block').innerHTML),
template = Handlebars.compile($('form_template_' + options.type).innerHTML), template = window.Handlebars.compile(window.$('form_template_' + options.type).innerHTML),
data = $H(options).merge({ data = window.$H(options).merge({
template: template(options) template: template(options)
}).toObject(); }).toObject();
this.element.replace(block_template(data)); this.element.replace(block_template(data));
@ -1027,12 +1034,12 @@ WysijaForm.Widget = Class.create(WysijaForm.Block, {
WysijaForm.init(); WysijaForm.init();
}, },
editSettings: function () { editSettings: function () {
MailPoet.Modal.popup({ window.MailPoet.Modal.popup({
title: MailPoet.I18n.t('editFieldSettings'), title: window.MailPoet.I18n.t('editFieldSettings'),
template: jQuery('#form_template_field_settings').html(), template: window.jQuery('#form_template_field_settings').html(),
data: this.getData(), data: this.getData(),
onSuccess: function () { onSuccess: function () {
var data = jQuery('#form_field_settings').serializeObject(); var data = window.jQuery('#form_field_settings').serializeObject();
this.redraw(data); this.redraw(data);
}.bind(this) }.bind(this)
}); });

View File

@ -2,7 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Router, Route, IndexRoute, useRouterHistory } from 'react-router'; import { Router, Route, IndexRoute, useRouterHistory } from 'react-router';
import { createHashHistory } from 'history'; import { createHashHistory } from 'history';
import FormList from 'forms/list.jsx'; import FormList from './list.jsx';
const history = useRouterHistory(createHashHistory)({ queryKey: false }); const history = useRouterHistory(createHashHistory)({ queryKey: false });

View File

@ -1,7 +1,8 @@
import React from 'react'; import React from 'react';
import Listing from 'listing/listing.jsx';
import classNames from 'classnames'; import classNames from 'classnames';
import MailPoet from 'mailpoet'; import MailPoet from 'mailpoet';
import jQuery from 'jquery';
import Listing from '../listing/listing.jsx';
const columns = [ const columns = [
{ {
@ -128,7 +129,7 @@ const FormList = React.createClass({
endpoint: 'forms', endpoint: 'forms',
action: 'create', action: 'create',
}).done((response) => { }).done((response) => {
window.location = mailpoet_form_edit_url + response.data.id; window.location = window.mailpoet_form_edit_url + response.data.id;
}).fail((response) => { }).fail((response) => {
if (response.errors.length > 0) { if (response.errors.length > 0) {
MailPoet.Notice.error( MailPoet.Notice.error(
@ -145,7 +146,7 @@ const FormList = React.createClass({
'has-row-actions' 'has-row-actions'
); );
let segments = mailpoet_segments.filter((segment) => { let segments = window.mailpoet_segments.filter((segment) => {
return (jQuery.inArray(segment.id, form.segments) !== -1); return (jQuery.inArray(segment.id, form.segments) !== -1);
}).map((segment) => { }).map((segment) => {
return segment.name; return segment.name;
@ -190,7 +191,7 @@ const FormList = React.createClass({
</h1> </h1>
<Listing <Listing
limit={ mailpoet_listing_per_page } limit={window.mailpoet_listing_per_page}
location={this.props.location} location={this.props.location}
params={this.props.params} params={this.props.params}
messages={messages} messages={messages}

View File

@ -5,7 +5,7 @@ define('handlebars_helpers', ['handlebars'], function(Handlebars) {
output = ''; output = '';
for (var i = 0; i < size; i++) { for (var i = 0; i < size; i++) {
output += arguments[i]; output += arguments[i];
}; }
return output; return output;
}); });
@ -22,13 +22,13 @@ define('handlebars_helpers', ['handlebars'], function(Handlebars) {
var f = block.hash.format || 'MMM Do, YYYY'; var f = block.hash.format || 'MMM Do, YYYY';
// check if we passed a timestamp // check if we passed a timestamp
if (parseInt(timestamp, 10) == timestamp) { if (parseInt(timestamp, 10) == timestamp) {
return moment.unix(timestamp).format(f); return window.moment.unix(timestamp).format(f);
} else { } else {
return moment.utc(timestamp).format(f); return window.moment.utc(timestamp).format(f);
} }
} else { } else {
return timestamp; return timestamp;
}; }
}); });
Handlebars.registerHelper('cycle', function (value, block) { Handlebars.registerHelper('cycle', function (value, block) {

View File

@ -1,6 +1,7 @@
define('helpTooltip', ['mailpoet', 'react', 'react-dom', 'help-tooltip.jsx'], define('helpTooltip', ['mailpoet', 'react', 'react-dom', 'help-tooltip.jsx'],
function (mp, React, ReactDOM, TooltipComponent) { function (mp, React, ReactDOM, TooltipComponent) {
'use strict'; 'use strict';
var MailPoet = mp; var MailPoet = mp;
MailPoet.helpTooltip = { MailPoet.helpTooltip = {

View File

@ -24,6 +24,6 @@ function KnowledgeBase() {
<a target="_blank" href="http://beta.docs.mailpoet.com/" className="button button-primary">{MailPoet.I18n.t('knowledgeBaseButton')}</a> <a target="_blank" href="http://beta.docs.mailpoet.com/" className="button button-primary">{MailPoet.I18n.t('knowledgeBaseButton')}</a>
</div> </div>
); );
}; }
module.exports = KnowledgeBase; module.exports = KnowledgeBase;

View File

@ -42,6 +42,6 @@ function KnowledgeBase() {
{printData(data)} {printData(data)}
</div> </div>
); );
}; }
module.exports = KnowledgeBase; module.exports = KnowledgeBase;

View File

@ -38,7 +38,7 @@ function Tabs(props) {
{ tabLinks } { tabLinks }
</h2> </h2>
); );
}; }
Tabs.propTypes = { tab: React.PropTypes.string }; Tabs.propTypes = { tab: React.PropTypes.string };
Tabs.defaultProps = { tab: 'knowledgeBase' }; Tabs.defaultProps = { tab: 'knowledgeBase' };

View File

@ -1,3 +0,0 @@
define([], function() {
!function(e, o, n){window.HSCW=o, window.HS=n, n.beacon=n.beacon||{};var t=n.beacon;t.userConfig={}, t.readyQueue=[], t.config=function(e){this.userConfig=e}, t.ready=function(e){this.readyQueue.push(e)}, o.config={docs:{enabled:!0, baseUrl:"//mailpoet3.helpscoutdocs.com/"}, contact:{enabled:!0, formId:"aa21ca80-a4f5-11e6-91aa-0a5fecc78a4d"}};var r=e.getElementsByTagName("script")[0], c=e.createElement("script");c.type="text/javascript", c.async=!0, c.src="https://djtflbt20bdde.cloudfront.net/", r.parentNode.insertBefore(c, r)}(document, window.HSCW||{}, window.HS||{});
});

View File

@ -5,6 +5,7 @@ define('i18n',
mp mp
) { ) {
'use strict'; 'use strict';
var MailPoet = mp; var MailPoet = mp;
var translations = {}; var translations = {};

View File

@ -1,5 +1,6 @@
define('iframe', ['mailpoet'], function (mp) { define('iframe', ['mailpoet'], function (mp) {
'use strict'; 'use strict';
var MailPoet = mp; var MailPoet = mp;
MailPoet.Iframe = { MailPoet.Iframe = {
marginY: 20, marginY: 20,

View File

@ -56,7 +56,7 @@ define([
const promise = this.props.onBulkAction(selected_ids, data); const promise = this.props.onBulkAction(selected_ids, data);
if (promise !== false) { if (promise !== false) {
promise.then(onSuccess); promise.then(onSuccess);
}; }
} }
this.setState({ this.setState({

View File

@ -276,7 +276,7 @@ const ListingItems = React.createClass({
selection={this.props.selection} selection={this.props.selection}
is_selectable={this.props.is_selectable} is_selectable={this.props.is_selectable}
item_actions={this.props.item_actions} item_actions={this.props.item_actions}
group={ this.props.group } group={this.props.group}
key={`item-${renderItem.id}-${index}`} key={`item-${renderItem.id}-${index}`}
item={renderItem} /> item={renderItem} />
); );

View File

@ -1,6 +1,7 @@
define('modal', ['mailpoet', 'jquery'], define('modal', ['mailpoet', 'jquery'],
function (mp, jQuery) { function (mp, jQuery) {
'use strict'; 'use strict';
var MailPoet = mp; var MailPoet = mp;
/** ************************************************************************* /** *************************************************************************
MailPoet Modal: MailPoet Modal:
@ -111,9 +112,8 @@ define('modal', ['mailpoet', 'jquery'],
if (this.renderer === 'html') { if (this.renderer === 'html') {
return function () { return template; }; return function () { return template; };
} else { } else {
return Handlebars.compile(template); return window.Handlebars.compile(template);
} }
return false;
}, },
init: function (options) { init: function (options) {
if (this.initialized === true) { if (this.initialized === true) {

View File

@ -1,5 +1,6 @@
define('mp2migrator', ['mailpoet', 'jquery'], function (mp, jQuery) { define('mp2migrator', ['mailpoet', 'jquery'], function (mp, jQuery) {
'use strict'; 'use strict';
var MailPoet = mp; var MailPoet = mp;
MailPoet.MP2Migrator = { MailPoet.MP2Migrator = {
@ -11,7 +12,7 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(mp, jQuery) {
clearTimeout(MailPoet.MP2Migrator.displayLogs_timeout); clearTimeout(MailPoet.MP2Migrator.displayLogs_timeout);
clearTimeout(MailPoet.MP2Migrator.updateProgressbar_timeout); clearTimeout(MailPoet.MP2Migrator.updateProgressbar_timeout);
clearTimeout(MailPoet.MP2Migrator.update_wordpress_info_timeout); clearTimeout(MailPoet.MP2Migrator.update_wordpress_info_timeout);
setTimeout(MailPoet.MP2Migrator.updateDisplay, 1000) setTimeout(MailPoet.MP2Migrator.updateDisplay, 1000);
}, },
stopLogger: function () { stopLogger: function () {
@ -25,7 +26,7 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(mp, jQuery) {
displayLogs: function () { displayLogs: function () {
jQuery.ajax({ jQuery.ajax({
url: mailpoet_mp2_migrator.log_file_url, url: window.mailpoet_mp2_migrator.log_file_url,
cache: false cache: false
}).done(function (result) { }).done(function (result) {
jQuery('#logger').html(''); jQuery('#logger').html('');
@ -52,7 +53,7 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(mp, jQuery) {
updateProgressbar: function () { updateProgressbar: function () {
jQuery.ajax({ jQuery.ajax({
url: mailpoet_mp2_migrator.progress_url, url: window.mailpoet_mp2_migrator.progress_url,
cache: false, cache: false,
dataType: 'json' dataType: 'json'
}).always(function (result) { }).always(function (result) {

View File

@ -13,14 +13,34 @@ define([
BL.ColorPickerBehavior = Marionette.Behavior.extend({ BL.ColorPickerBehavior = Marionette.Behavior.extend({
onRender: function () { onRender: function () {
this.view.$('.mailpoet_color').spectrum({ var that = this,
preferredFormat = 'hex6';
this.view.$('.mailpoet_color').each(function () {
var $input = that.view.$(this);
var updateColorInput = function (color) {
if (color && color.getAlpha() > 0) {
$input.val(color.toString(preferredFormat));
} else {
$input.val('');
}
$input.trigger('change');
};
$input.spectrum({
clickoutFiresChange: true, clickoutFiresChange: true,
showInput: true, showInput: true,
showInitial: true, showInitial: true,
preferredFormat: 'hex6', showPalette: true,
showSelectionPalette: true,
palette: [],
localStorageKey: 'newsletter_editor.spectrum.palette',
preferredFormat: preferredFormat,
allowEmpty: true, allowEmpty: true,
chooseText: MailPoet.I18n.t('selectColor'), chooseText: MailPoet.I18n.t('selectColor'),
cancelText: MailPoet.I18n.t('cancelColorSelection') cancelText: MailPoet.I18n.t('cancelColorSelection'),
change: updateColorInput,
move: updateColorInput,
hide: updateColorInput
});
}); });
} }
}); });

View File

@ -1,3 +1,4 @@
/** /**
* ContainerDropZoneBehavior * ContainerDropZoneBehavior
* *
@ -195,7 +196,8 @@ define([
if (view.model.get('orientation') === 'horizontal' && droppableModel.get('type') !== 'container') { if (view.model.get('orientation') === 'horizontal' && droppableModel.get('type') !== 'container') {
// Regular blocks always need to be inserted into columns - vertical containers // Regular blocks always need to be inserted into columns - vertical containers
tempCollection = new (EditorApplication.getBlockTypeModel('container'))({
tempCollection = new (window.EditorApplication.getBlockTypeModel('container'))({
orientation: 'vertical' orientation: 'vertical'
}); });
tempCollection.get('blocks').add(droppableModel); tempCollection.get('blocks').add(droppableModel);
@ -210,7 +212,7 @@ define([
// and inserting dropModel into that // and inserting dropModel into that
var tempModel = viewCollection.at(dropPosition.index); var tempModel = viewCollection.at(dropPosition.index);
tempCollection = new (EditorApplication.getBlockTypeModel('container'))({ tempCollection = new (window.EditorApplication.getBlockTypeModel('container'))({
orientation: (view.model.get('orientation') === 'vertical') ? 'horizontal' : 'vertical' orientation: (view.model.get('orientation') === 'vertical') ? 'horizontal' : 'vertical'
}); });
@ -218,19 +220,19 @@ define([
if (tempCollection.get('orientation') === 'horizontal') { if (tempCollection.get('orientation') === 'horizontal') {
if (dropPosition.position === 'before') { if (dropPosition.position === 'before') {
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({ tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
orientation: 'vertical' orientation: 'vertical'
}); });
tempCollection2.get('blocks').add(droppableModel); tempCollection2.get('blocks').add(droppableModel);
tempCollection.get('blocks').add(tempCollection2); tempCollection.get('blocks').add(tempCollection2);
} }
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({ tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
orientation: 'vertical' orientation: 'vertical'
}); });
tempCollection2.get('blocks').add(tempModel); tempCollection2.get('blocks').add(tempModel);
tempCollection.get('blocks').add(tempCollection2); tempCollection.get('blocks').add(tempCollection2);
if (dropPosition.position === 'after') { if (dropPosition.position === 'after') {
tempCollection2 = new (EditorApplication.getBlockTypeModel('container'))({ tempCollection2 = new (window.EditorApplication.getBlockTypeModel('container'))({
orientation: 'vertical' orientation: 'vertical'
}); });
tempCollection2.get('blocks').add(droppableModel); tempCollection2.get('blocks').add(droppableModel);
@ -291,7 +293,7 @@ define([
insertionType, index, position, indexAndPosition; insertionType, index, position, indexAndPosition;
unsafe = !!is_unsafe; var unsafe = !!is_unsafe;
if (this.getCollection().length === 0) { if (this.getCollection().length === 0) {
return { return {

View File

@ -54,7 +54,7 @@ define([
// Use substitution instead of a clone // Use substitution instead of a clone
var tempClone = (_.isFunction(that.options.onDragSubstituteBy)) ? that.options.onDragSubstituteBy(that) : undefined, var tempClone = (_.isFunction(that.options.onDragSubstituteBy)) ? that.options.onDragSubstituteBy(that) : undefined,
// Or use a clone // Or use a clone
clone = tempClone ? tempClone : event.target.cloneNode(true), clone = tempClone || event.target.cloneNode(true),
$original = jQuery(event.target), $original = jQuery(event.target),
$clone = jQuery(clone), $clone = jQuery(clone),

View File

@ -0,0 +1,26 @@
/**
* Highlight Container Behavior
*
* Highlights a container block when hovering over its tools
*/
define([
'backbone.marionette',
'newsletter_editor/behaviors/BehaviorsLookup'
], function (Marionette, BehaviorsLookup) {
var BL = BehaviorsLookup;
BL.HighlightContainerBehavior = Marionette.Behavior.extend({
events: {
'mouseenter @ui.tools': 'enableHighlight',
'mouseleave @ui.tools': 'disableHighlight'
},
enableHighlight: function () {
this.$el.addClass('mailpoet_highlight');
},
disableHighlight: function () {
if (!this.view._isBeingEdited) {
this.$el.removeClass('mailpoet_highlight');
}
}
});
});

View File

@ -15,9 +15,11 @@ define([
stopEditing: 'disableHighlight' stopEditing: 'disableHighlight'
}, },
enableHighlight: function () { enableHighlight: function () {
this.view._isBeingEdited = true;
this.$el.addClass('mailpoet_highlight'); this.$el.addClass('mailpoet_highlight');
}, },
disableHighlight: function () { disableHighlight: function () {
this.view._isBeingEdited = false;
this.$el.removeClass('mailpoet_highlight'); this.$el.removeClass('mailpoet_highlight');
} }
}); });

View File

@ -14,9 +14,15 @@ define([
defaults: { defaults: {
elementSelector: null, elementSelector: null,
resizeHandleSelector: true, // true will use edges of the element itself resizeHandleSelector: true, // true will use edges of the element itself
transformationFunction: function(y) { return y; },
minLength: 0, minLength: 0,
modelField: 'styles.block.height' maxLength: Infinity,
modelField: 'styles.block.height',
onResize: function (event) {
var currentLength = parseFloat(this.view.model.get(this.options.modelField)),
newLength = currentLength + event.y;
newLength = Math.min(this.options.maxLength, Math.max(this.options.minLength, newLength));
this.view.model.set(this.options.modelField, newLength + 'px');
}
}, },
events: { events: {
mouseenter: 'showResizeHandle', mouseenter: 'showResizeHandle',
@ -40,17 +46,16 @@ define([
right: false, right: false,
bottom: (typeof this.options.resizeHandleSelector === 'string') ? this.view.$(this.options.resizeHandleSelector).get(0) : this.options.resizeHandleSelector bottom: (typeof this.options.resizeHandleSelector === 'string') ? this.view.$(this.options.resizeHandleSelector).get(0) : this.options.resizeHandleSelector
} }
}).on('resizestart', function(event) { })
.on('resizestart', function (event) {
that.isBeingResized = true; that.isBeingResized = true;
that.$el.addClass('mailpoet_resize_active'); that.$el.addClass('mailpoet_resize_active');
}).on('resizemove', function(event) { })
var currentLength = parseFloat(that.view.model.get(that.options.modelField)), .on('resizemove', function (event) {
newLength = currentLength + that.options.transformationFunction(event.dy); var onResize = that.options.onResize.bind(that);
return onResize(event);
if (newLength < that.options.minLength) newLength = that.options.minLength; })
.on('resizeend', function (event) {
that.view.model.set(that.options.modelField, newLength + 'px');
}).on('resizeend', function(event) {
that.isBeingResized = null; that.isBeingResized = null;
that.$el.removeClass('mailpoet_resize_active'); that.$el.removeClass('mailpoet_resize_active');
}); });

View File

@ -34,6 +34,8 @@ define([
toolbar1: this.options.toolbar1, toolbar1: this.options.toolbar1,
toolbar2: this.options.toolbar2, toolbar2: this.options.toolbar2,
browser_spellcheck: true,
valid_elements: this.options.validElements, valid_elements: this.options.validElements,
invalid_elements: this.options.invalidElements, invalid_elements: this.options.invalidElements,
block_formats: this.options.blockFormats, block_formats: this.options.blockFormats,
@ -63,7 +65,7 @@ define([
editor.focus(); editor.focus();
if (that._isActivationClick) { if (that._isActivationClick) {
editor.selection.setRng( editor.selection.setRng(
tinymce.dom.RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc()) window.tinymce.dom.RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc())
); );
that._isActivationClick = false; that._isActivationClick = false;
} }

View File

@ -135,7 +135,7 @@ define([
} }
App.getChannel().on('replaceAllButtonStyles', replaceButtonStylesHandler.bind(this)); App.getChannel().on('replaceAllButtonStyles', replaceButtonStylesHandler.bind(this));
}, },
getTemplate: function() { return templates.automatedLatestContentBlock; }, getTemplate: function () { return window.templates.automatedLatestContentBlock; },
regions: { regions: {
toolsRegion: '.mailpoet_tools', toolsRegion: '.mailpoet_tools',
postsRegion: '.mailpoet_automated_latest_content_block_posts' postsRegion: '.mailpoet_automated_latest_content_block_posts'
@ -168,7 +168,7 @@ define([
// Sidebar view container // Sidebar view container
Module.AutomatedLatestContentBlockSettingsView = base.BlockSettingsView.extend({ Module.AutomatedLatestContentBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.automatedLatestContentBlockSettings; }, getTemplate: function () { return window.templates.automatedLatestContentBlockSettings; },
events: function () { events: function () {
return { return {
'click .mailpoet_automated_latest_content_hide_display_options': 'toggleDisplayOptions', 'click .mailpoet_automated_latest_content_hide_display_options': 'toggleDisplayOptions',
@ -364,7 +364,7 @@ define([
}); });
Module.AutomatedLatestContentWidgetView = base.WidgetView.extend({ Module.AutomatedLatestContentWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.automatedLatestContentInsertion; }, getTemplate: function () { return window.templates.automatedLatestContentInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -178,7 +178,7 @@ define([
}); });
Module.BlockToolsView = AugmentedView.extend({ Module.BlockToolsView = AugmentedView.extend({
getTemplate: function() { return templates.genericBlockTools; }, getTemplate: function () { return window.templates.genericBlockTools; },
events: { events: {
'click .mailpoet_edit_block': 'changeSettings', 'click .mailpoet_edit_block': 'changeSettings',
'click .mailpoet_delete_block_activate': 'showDeletionConfirmation', 'click .mailpoet_delete_block_activate': 'showDeletionConfirmation',
@ -275,7 +275,7 @@ define([
this.model.set(field, jQuery(event.target).val() + suffix); this.model.set(field, jQuery(event.target).val() + suffix);
}, },
changeBoolField: function (field, event) { changeBoolField: function (field, event) {
this.model.set(field, (jQuery(event.target).val() === 'true') ? true : false); this.model.set(field, (jQuery(event.target).val() === 'true'));
}, },
changeBoolCheckboxField: function (field, event) { changeBoolCheckboxField: function (field, event) {
this.model.set(field, (!!jQuery(event.target).prop('checked'))); this.model.set(field, (!!jQuery(event.target).prop('checked')));

View File

@ -42,7 +42,7 @@ define([
Module.ButtonBlockView = base.BlockView.extend({ Module.ButtonBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_button_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_button_block mailpoet_droppable_block',
getTemplate: function() { return templates.buttonBlock; }, getTemplate: function () { return window.templates.buttonBlock; },
onDragSubstituteBy: function () { return Module.ButtonWidgetView; }, onDragSubstituteBy: function () { return Module.ButtonWidgetView; },
behaviors: _.extend({}, base.BlockView.prototype.behaviors, { behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
ShowSettingsBehavior: {} ShowSettingsBehavior: {}
@ -65,7 +65,7 @@ define([
}); });
Module.ButtonBlockSettingsView = base.BlockSettingsView.extend({ Module.ButtonBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.buttonBlockSettings; }, getTemplate: function () { return window.templates.buttonBlockSettings; },
events: function () { events: function () {
return { return {
'input .mailpoet_field_button_text': _.partial(this.changeField, 'text'), 'input .mailpoet_field_button_text': _.partial(this.changeField, 'text'),
@ -121,7 +121,7 @@ define([
}); });
Module.ButtonWidgetView = base.WidgetView.extend({ Module.ButtonWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.buttonInsertion; }, getTemplate: function () { return window.templates.buttonInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -103,7 +103,7 @@ define([
} }
}), }),
className: 'mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block', className: 'mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block',
getTemplate: function() { return templates.containerBlock; }, getTemplate: function () { return window.templates.containerBlock; },
events: _.extend({}, base.BlockView.prototype.events, { events: _.extend({}, base.BlockView.prototype.events, {
'click .mailpoet_newsletter_layer_selector': 'toggleEditingLayer' 'click .mailpoet_newsletter_layer_selector': 'toggleEditingLayer'
}), }),
@ -138,7 +138,8 @@ define([
// for root and column containers. // for root and column containers.
return view.renderOptions.depth === 1; return view.renderOptions.depth === 1;
} }
} },
HighlightContainerBehavior: {}
}), }),
onDragSubstituteBy: function () { onDragSubstituteBy: function () {
// For two and three column layouts display their respective widgets, // For two and three column layouts display their respective widgets,
@ -217,7 +218,7 @@ define([
}); });
Module.ContainerBlockEmptyView = Marionette.View.extend({ Module.ContainerBlockEmptyView = Marionette.View.extend({
getTemplate: function() { return templates.containerEmpty; }, getTemplate: function () { return window.templates.containerEmpty; },
initialize: function (options) { initialize: function (options) {
this.renderOptions = _.defaults(options.renderOptions || {}, {}); this.renderOptions = _.defaults(options.renderOptions || {}, {});
}, },
@ -234,7 +235,7 @@ define([
}); });
Module.ContainerBlockSettingsView = base.BlockSettingsView.extend({ Module.ContainerBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.containerBlockSettings; }, getTemplate: function () { return window.templates.containerBlockSettings; },
events: function () { events: function () {
return { return {
'change .mailpoet_field_container_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'), 'change .mailpoet_field_container_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
@ -266,7 +267,7 @@ define([
}); });
Module.ContainerBlockColumnSettingsView = Marionette.View.extend({ Module.ContainerBlockColumnSettingsView = Marionette.View.extend({
getTemplate: function() { return templates.containerBlockColumnSettings; }, getTemplate: function () { return window.templates.containerBlockColumnSettings; },
initialize: function (options) { initialize: function (options) {
this.columnNumber = (options.columnIndex || 0) + 1; this.columnNumber = (options.columnIndex || 0) + 1;
}, },
@ -280,7 +281,7 @@ define([
Module.OneColumnContainerWidgetView = base.WidgetView.extend({ Module.OneColumnContainerWidgetView = base.WidgetView.extend({
className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block', className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
getTemplate: function() { return templates.oneColumnLayoutInsertion; }, getTemplate: function () { return window.templates.oneColumnLayoutInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,
@ -298,7 +299,7 @@ define([
Module.TwoColumnContainerWidgetView = base.WidgetView.extend({ Module.TwoColumnContainerWidgetView = base.WidgetView.extend({
className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block', className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
getTemplate: function() { return templates.twoColumnLayoutInsertion; }, getTemplate: function () { return window.templates.twoColumnLayoutInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,
@ -317,7 +318,7 @@ define([
Module.ThreeColumnContainerWidgetView = base.WidgetView.extend({ Module.ThreeColumnContainerWidgetView = base.WidgetView.extend({
className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block', className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
getTemplate: function() { return templates.threeColumnLayoutInsertion; }, getTemplate: function () { return window.templates.threeColumnLayoutInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -33,7 +33,7 @@ define([
Module.DividerBlockView = base.BlockView.extend({ Module.DividerBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_divider_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_divider_block mailpoet_droppable_block',
getTemplate: function() { return templates.dividerBlock; }, getTemplate: function () { return window.templates.dividerBlock; },
modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'),
behaviors: _.defaults({ behaviors: _.defaults({
ResizableBehavior: { ResizableBehavior: {
@ -84,7 +84,7 @@ define([
}); });
Module.DividerBlockSettingsView = base.BlockSettingsView.extend({ Module.DividerBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.dividerBlockSettings; }, getTemplate: function () { return window.templates.dividerBlockSettings; },
events: function () { events: function () {
return { return {
'click .mailpoet_field_divider_style': 'changeStyle', 'click .mailpoet_field_divider_style': 'changeStyle',
@ -129,7 +129,7 @@ define([
}); });
Module.DividerWidgetView = base.WidgetView.extend({ Module.DividerWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.dividerInsertion; }, getTemplate: function () { return window.templates.dividerInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -4,8 +4,9 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/base', 'newsletter_editor/blocks/base',
'underscore' 'underscore',
], function(App, BaseBlock, _) { 'mailpoet'
], function (App, BaseBlock, _, MailPoet) {
'use strict'; 'use strict';
@ -38,7 +39,7 @@ define([
Module.FooterBlockView = base.BlockView.extend({ Module.FooterBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_footer_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_footer_block mailpoet_droppable_block',
getTemplate: function() { return templates.footerBlock; }, getTemplate: function () { return window.templates.footerBlock; },
modelEvents: _.extend({ modelEvents: _.extend({
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render' 'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
}, _.omit(base.BlockView.prototype.modelEvents, 'change')), }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
@ -75,7 +76,7 @@ define([
}); });
Module.FooterBlockSettingsView = base.BlockSettingsView.extend({ Module.FooterBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.footerBlockSettings; }, getTemplate: function () { return window.templates.footerBlockSettings; },
events: function () { events: function () {
return { return {
'change .mailpoet_field_footer_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'), 'change .mailpoet_field_footer_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
@ -98,7 +99,7 @@ define([
}); });
Module.FooterWidgetView = base.WidgetView.extend({ Module.FooterWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.footerInsertion; }, getTemplate: function () { return window.templates.footerInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -4,8 +4,9 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/base', 'newsletter_editor/blocks/base',
'underscore' 'underscore',
], function(App, BaseBlock, _) { 'mailpoet'
], function (App, BaseBlock, _, MailPoet) {
'use strict'; 'use strict';
@ -38,7 +39,7 @@ define([
Module.HeaderBlockView = base.BlockView.extend({ Module.HeaderBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_header_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_header_block mailpoet_droppable_block',
getTemplate: function() { return templates.headerBlock; }, getTemplate: function () { return window.templates.headerBlock; },
modelEvents: _.extend({ modelEvents: _.extend({
'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render' 'change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration': 'render'
}, _.omit(base.BlockView.prototype.modelEvents, 'change')), }, _.omit(base.BlockView.prototype.modelEvents, 'change')),
@ -75,7 +76,7 @@ define([
}); });
Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({ Module.HeaderBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.headerBlockSettings; }, getTemplate: function () { return window.templates.headerBlockSettings; },
events: function () { events: function () {
return { return {
'change .mailpoet_field_header_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'), 'change .mailpoet_field_header_text_color': _.partial(this.changeColorField, 'styles.text.fontColor'),
@ -98,7 +99,7 @@ define([
}); });
Module.HeaderWidgetView = base.WidgetView.extend({ Module.HeaderWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.headerInsertion; }, getTemplate: function () { return window.templates.headerInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -5,8 +5,9 @@ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/base', 'newsletter_editor/blocks/base',
'underscore', 'underscore',
'mailpoet' 'mailpoet',
], function(App, BaseBlock, _, MailPoet) { 'jquery'
], function (App, BaseBlock, _, MailPoet, jQuery) {
'use strict'; 'use strict';
@ -35,7 +36,7 @@ define([
Module.ImageBlockView = base.BlockView.extend({ Module.ImageBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_image_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_image_block mailpoet_droppable_block',
getTemplate: function() { return templates.imageBlock; }, getTemplate: function () { return window.templates.imageBlock; },
onDragSubstituteBy: function () { return Module.ImageWidgetView; }, onDragSubstituteBy: function () { return Module.ImageWidgetView; },
templateContext: function () { templateContext: function () {
return _.extend({ return _.extend({
@ -43,17 +44,28 @@ define([
}, base.BlockView.prototype.templateContext.apply(this)); }, base.BlockView.prototype.templateContext.apply(this));
}, },
behaviors: _.extend({}, base.BlockView.prototype.behaviors, { behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
ShowSettingsBehavior: {} ResizableBehavior: {
elementSelector: '.mailpoet_image',
resizeHandleSelector: '.mailpoet_image_resize_handle',
onResize: function (event) {
var corner = this.$('.mailpoet_image').offset(),
width = event.pageX - corner.left;
this.view.model.set('width', width + 'px');
}
},
ShowSettingsBehavior: {
ignoreFrom: '.mailpoet_image_resize_handle'
}
}), }),
onRender: function () { onRender: function () {
this.toolsView = new Module.ImageBlockToolsView({ model: this.model }); this.toolsView = new Module.ImageBlockToolsView({ model: this.model });
this.showChildView('toolsRegion', this.toolsView); this.showChildView('toolsRegion', this.toolsView);
if (this.model.get('fullWidth')) { if (this.model.get('fullWidth')) {
this.$el.addClass('mailpoet_full_image'); this.$el.addClass('mailpoet_full_image');
} else { } else {
this.$el.removeClass('mailpoet_full_image'); this.$el.removeClass('mailpoet_full_image');
} }
this.$('.mailpoet_content').css('width', this.model.get('width'));
} }
}); });
@ -72,7 +84,7 @@ define([
tooltip: MailPoet.I18n.t('helpTooltipDesignerIdealWidth') tooltip: MailPoet.I18n.t('helpTooltipDesignerIdealWidth')
}); });
}, },
getTemplate: function() { return templates.imageBlockSettings; }, getTemplate: function () { return window.templates.imageBlockSettings; },
events: function () { events: function () {
return { return {
'input .mailpoet_field_image_link': _.partial(this.changeField, 'link'), 'input .mailpoet_field_image_link': _.partial(this.changeField, 'link'),
@ -81,9 +93,32 @@ define([
'change .mailpoet_field_image_full_width': _.partial(this.changeBoolCheckboxField, 'fullWidth'), 'change .mailpoet_field_image_full_width': _.partial(this.changeBoolCheckboxField, 'fullWidth'),
'change .mailpoet_field_image_alignment': _.partial(this.changeField, 'styles.block.textAlign'), 'change .mailpoet_field_image_alignment': _.partial(this.changeField, 'styles.block.textAlign'),
'click .mailpoet_field_image_select_another_image': 'showMediaManager', 'click .mailpoet_field_image_select_another_image': 'showMediaManager',
'click .mailpoet_done_editing': 'close' 'click .mailpoet_done_editing': 'close',
'input .mailpoet_field_image_width': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width_input', _.partial(this.changePixelField, 'width').bind(this)),
'change .mailpoet_field_image_width': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width_input', _.partial(this.changePixelField, 'width').bind(this)),
'input .mailpoet_field_image_width_input': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width', _.partial(this.changePixelField, 'width').bind(this))
}; };
}, },
modelEvents: function () {
return {
'change:maxWidth': 'updateMaxWidth',
'change:width': 'updateWidth'
};
},
updateValueAndCall: function (fieldToUpdate, callable, event) {
this.$(fieldToUpdate).val(jQuery(event.target).val());
callable(event);
},
updateMaxWidth: function () {
var maxWidth = parseInt(this.model.get('maxWidth'));
this.$('.mailpoet_field_image_width').attr('max', maxWidth);
this.$('.mailpoet_field_image_width_input').attr('max', maxWidth);
},
updateWidth: function () {
var width = parseInt(this.model.get('width'));
this.$('.mailpoet_field_image_width').val(width);
this.$('.mailpoet_field_image_width_input').val(width);
},
initialize: function (options) { initialize: function (options) {
base.BlockSettingsView.prototype.initialize.apply(this, arguments); base.BlockSettingsView.prototype.initialize.apply(this, arguments);
@ -98,10 +133,10 @@ define([
return; return;
} }
var MediaManager = wp.media.view.MediaFrame.Select.extend({ var MediaManager = window.wp.media.view.MediaFrame.Select.extend({
initialize: function () { initialize: function () {
wp.media.view.MediaFrame.prototype.initialize.apply(this, arguments); window.wp.media.view.MediaFrame.prototype.initialize.apply(this, arguments);
_.defaults(this.options, { _.defaults(this.options, {
multiple: true, multiple: true,
@ -123,7 +158,7 @@ define([
}, },
createQuery: function (options) { createQuery: function (options) {
var query = wp.media.query(options); var query = window.wp.media.query(options);
return query; return query;
}, },
@ -133,7 +168,7 @@ define([
// Add the default states. // Add the default states.
this.states.add([ this.states.add([
// Main states. // Main states.
new wp.media.controller.Library({ new window.wp.media.controller.Library({
id: 'insert', id: 'insert',
title: 'Add images', title: 'Add images',
priority: 20, priority: 20,
@ -155,8 +190,8 @@ define([
}) })
]); ]);
if(wp.media.view.settings.post.featuredImageId) { if (window.wp.media.view.settings.post.featuredImageId) {
this.states.add(new wp.media.controller.FeaturedImage()); this.states.add(new window.wp.media.controller.FeaturedImage());
} }
}, },
@ -193,13 +228,13 @@ define([
}, },
uploadContent: function () { uploadContent: function () {
wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this, arguments); window.wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this, arguments);
this.$el.addClass('hide-toolbar'); this.$el.addClass('hide-toolbar');
}, },
// Content // Content
embedContent: function () { embedContent: function () {
var view = new wp.media.view.Embed({ var view = new window.wp.media.view.Embed({
controller: this, controller: this,
model: this.state() model: this.state()
}).render(); }).render();
@ -213,7 +248,7 @@ define([
selection = state.get('selection'), selection = state.get('selection'),
view; view;
view = new wp.media.view.AttachmentsBrowser({ view = new window.wp.media.view.AttachmentsBrowser({
controller: this, controller: this,
collection: selection, collection: selection,
selection: selection, selection: selection,
@ -222,7 +257,7 @@ define([
search: false, search: false,
dragInfo: true, dragInfo: true,
AttachmentView: wp.media.view.Attachment.EditSelection AttachmentView: window.wp.media.view.Attachment.EditSelection
}).render(); }).render();
view.toolbar.set('backToLibrary', { view.toolbar.set('backToLibrary', {
@ -242,7 +277,7 @@ define([
selectionStatusToolbar: function (view) { selectionStatusToolbar: function (view) {
var editable = this.state().get('editable'); var editable = this.state().get('editable');
view.set('selection', new wp.media.view.Selection({ view.set('selection', new window.wp.media.view.Selection({
controller: this, controller: this,
collection: this.state().get('selection'), collection: this.state().get('selection'),
priority: -40, priority: -40,
@ -278,7 +313,7 @@ define([
mainEmbedToolbar: function (toolbar) { mainEmbedToolbar: function (toolbar) {
var tbar = toolbar; var tbar = toolbar;
tbar.view = new wp.media.view.Toolbar.Embed({ tbar.view = new window.wp.media.view.Toolbar.Embed({
controller: this, controller: this,
text: 'Add images' text: 'Add images'
}); });
@ -363,7 +398,7 @@ define([
}); });
ImageWidgetView = base.WidgetView.extend({ ImageWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.imageInsertion; }, getTemplate: function () { return window.templates.imageInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -177,7 +177,7 @@ define([
Module.PostsBlockView = base.BlockView.extend({ Module.PostsBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_posts_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_posts_block mailpoet_droppable_block',
getTemplate: function() { return templates.postsBlock; }, getTemplate: function () { return window.templates.postsBlock; },
modelEvents: {}, // Forcefully disable all events modelEvents: {}, // Forcefully disable all events
regions: _.extend({ regions: _.extend({
postsRegion: '.mailpoet_posts_block_posts' postsRegion: '.mailpoet_posts_block_posts'
@ -216,7 +216,7 @@ define([
}); });
Module.PostsBlockSettingsView = base.BlockSettingsView.extend({ Module.PostsBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.postsBlockSettings; }, getTemplate: function () { return window.templates.postsBlockSettings; },
regions: { regions: {
selectionRegion: '.mailpoet_settings_posts_selection', selectionRegion: '.mailpoet_settings_posts_selection',
displayOptionsRegion: '.mailpoet_settings_posts_display_options' displayOptionsRegion: '.mailpoet_settings_posts_display_options'
@ -308,7 +308,7 @@ define([
}); });
var PostSelectionSettingsView = Marionette.View.extend({ var PostSelectionSettingsView = Marionette.View.extend({
getTemplate: function() { return templates.postSelectionPostsBlockSettings; }, getTemplate: function () { return window.templates.postSelectionPostsBlockSettings; },
regions: { regions: {
posts: '.mailpoet_post_selection_container' posts: '.mailpoet_post_selection_container'
}, },
@ -428,11 +428,11 @@ define([
}); });
var EmptyPostSelectionSettingsView = Marionette.View.extend({ var EmptyPostSelectionSettingsView = Marionette.View.extend({
getTemplate: function() { return templates.emptyPostPostsBlockSettings; } getTemplate: function () { return window.templates.emptyPostPostsBlockSettings; }
}); });
var SinglePostSelectionSettingsView = Marionette.View.extend({ var SinglePostSelectionSettingsView = Marionette.View.extend({
getTemplate: function() { return templates.singlePostPostsBlockSettings; }, getTemplate: function () { return window.templates.singlePostPostsBlockSettings; },
events: function () { events: function () {
return { return {
'change .mailpoet_select_post_checkbox': 'postSelectionChange' 'change .mailpoet_select_post_checkbox': 'postSelectionChange'
@ -459,7 +459,7 @@ define([
}); });
var PostsDisplayOptionsSettingsView = base.BlockSettingsView.extend({ var PostsDisplayOptionsSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.displayOptionsPostsBlockSettings; }, getTemplate: function () { return window.templates.displayOptionsPostsBlockSettings; },
events: function () { events: function () {
return { return {
'click .mailpoet_posts_select_button': 'showButtonSettings', 'click .mailpoet_posts_select_button': 'showButtonSettings',
@ -564,7 +564,7 @@ define([
}); });
Module.PostsWidgetView = base.WidgetView.extend({ Module.PostsWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.postsInsertion; }, getTemplate: function () { return window.templates.postsInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -85,7 +85,7 @@ define([
var SocialIconView = Marionette.View.extend({ var SocialIconView = Marionette.View.extend({
tagName: 'span', tagName: 'span',
getTemplate: function() { return templates.socialIconBlock; }, getTemplate: function () { return window.templates.socialIconBlock; },
modelEvents: { modelEvents: {
change: 'render' change: 'render'
}, },
@ -105,7 +105,7 @@ define([
Module.SocialBlockView = base.BlockView.extend({ Module.SocialBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_social_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_social_block mailpoet_droppable_block',
getTemplate: function() { return templates.socialBlock; }, getTemplate: function () { return window.templates.socialBlock; },
regions: _.extend({}, base.BlockView.prototype.regions, { regions: _.extend({}, base.BlockView.prototype.regions, {
icons: '.mailpoet_social' icons: '.mailpoet_social'
}), }),
@ -121,7 +121,7 @@ define([
this.showChildView('toolsRegion', this.toolsView); this.showChildView('toolsRegion', this.toolsView);
this.showChildView('icons', new Module.SocialIconCollectionView({ this.showChildView('icons', new Module.SocialIconCollectionView({
collection: this.model.get('icons') collection: this.model.get('icons')
})) }));
} }
}); });
@ -131,7 +131,7 @@ define([
// Sidebar view container // Sidebar view container
Module.SocialBlockSettingsView = base.BlockSettingsView.extend({ Module.SocialBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.socialBlockSettings; }, getTemplate: function () { return window.templates.socialBlockSettings; },
regions: { regions: {
iconRegion: '#mailpoet_social_icons_selection', iconRegion: '#mailpoet_social_icons_selection',
stylesRegion: '#mailpoet_social_icons_styles' stylesRegion: '#mailpoet_social_icons_styles'
@ -155,7 +155,7 @@ define([
// Single icon settings view, used by the selector view // Single icon settings view, used by the selector view
SocialBlockSettingsIconView = Marionette.View.extend({ SocialBlockSettingsIconView = Marionette.View.extend({
getTemplate: function() { return templates.socialSettingsIcon; }, getTemplate: function () { return window.templates.socialSettingsIcon; },
events: function () { events: function () {
return { return {
'click .mailpoet_delete_block': 'deleteIcon', 'click .mailpoet_delete_block': 'deleteIcon',
@ -212,7 +212,7 @@ define([
// Select icons section container view // Select icons section container view
SocialBlockSettingsIconSelectorView = Marionette.View.extend({ SocialBlockSettingsIconSelectorView = Marionette.View.extend({
getTemplate: function() { return templates.socialSettingsIconSelector; }, getTemplate: function () { return window.templates.socialSettingsIconSelector; },
regions: { regions: {
icons: '#mailpoet_social_icon_selector_contents' icons: '#mailpoet_social_icon_selector_contents'
}, },
@ -235,7 +235,7 @@ define([
}); });
SocialBlockSettingsStylesView = Marionette.View.extend({ SocialBlockSettingsStylesView = Marionette.View.extend({
getTemplate: function() { return templates.socialSettingsStyles; }, getTemplate: function () { return window.templates.socialSettingsStyles; },
modelEvents: { modelEvents: {
change: 'render' change: 'render'
}, },
@ -263,7 +263,7 @@ define([
}); });
Module.SocialWidgetView = base.WidgetView.extend({ Module.SocialWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.socialInsertion; }, getTemplate: function () { return window.templates.socialInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -28,7 +28,7 @@ define([
Module.SpacerBlockView = base.BlockView.extend({ Module.SpacerBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_spacer_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_spacer_block mailpoet_droppable_block',
getTemplate: function() { return templates.spacerBlock; }, getTemplate: function () { return window.templates.spacerBlock; },
behaviors: _.defaults({ behaviors: _.defaults({
ResizableBehavior: { ResizableBehavior: {
elementSelector: '.mailpoet_spacer', elementSelector: '.mailpoet_spacer',
@ -66,7 +66,7 @@ define([
}); });
Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({ Module.SpacerBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.spacerBlockSettings; }, getTemplate: function () { return window.templates.spacerBlockSettings; },
events: function () { events: function () {
return { return {
'change .mailpoet_field_spacer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'), 'change .mailpoet_field_spacer_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
@ -76,7 +76,7 @@ define([
}); });
Module.SpacerWidgetView = base.WidgetView.extend({ Module.SpacerWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.spacerInsertion; }, getTemplate: function () { return window.templates.spacerInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -4,8 +4,9 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'newsletter_editor/blocks/base', 'newsletter_editor/blocks/base',
'underscore' 'underscore',
], function(App, BaseBlock, _) { 'mailpoet'
], function (App, BaseBlock, _, MailPoet) {
'use strict'; 'use strict';
@ -23,7 +24,7 @@ define([
Module.TextBlockView = base.BlockView.extend({ Module.TextBlockView = base.BlockView.extend({
className: 'mailpoet_block mailpoet_text_block mailpoet_droppable_block', className: 'mailpoet_block mailpoet_text_block mailpoet_droppable_block',
getTemplate: function() { return templates.textBlock; }, getTemplate: function () { return window.templates.textBlock; },
modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), // Prevent rerendering on model change due to text editor redrawing modelEvents: _.omit(base.BlockView.prototype.modelEvents, 'change'), // Prevent rerendering on model change due to text editor redrawing
behaviors: _.extend({}, base.BlockView.prototype.behaviors, { behaviors: _.extend({}, base.BlockView.prototype.behaviors, {
TextEditorBehavior: { TextEditorBehavior: {
@ -78,11 +79,11 @@ define([
}); });
Module.TextBlockSettingsView = base.BlockSettingsView.extend({ Module.TextBlockSettingsView = base.BlockSettingsView.extend({
getTemplate: function() { return templates.textBlockSettings; } getTemplate: function () { return window.templates.textBlockSettings; }
}); });
Module.TextWidgetView = base.WidgetView.extend({ Module.TextWidgetView = base.WidgetView.extend({
getTemplate: function() { return templates.textInsertion; }, getTemplate: function () { return window.templates.textInsertion; },
behaviors: { behaviors: {
DraggableBehavior: { DraggableBehavior: {
cloneOriginal: true, cloneOriginal: true,

View File

@ -23,6 +23,7 @@
} }
}(this, function (Marionette, Radio, _) { }(this, function (Marionette, Radio, _) {
'use strict'; 'use strict';
var MarionetteApplication = Marionette.Application; var MarionetteApplication = Marionette.Application;
MarionetteApplication.prototype._initChannel = function () { MarionetteApplication.prototype._initChannel = function () {
this.channelName = _.result(this, 'channelName') || 'global'; this.channelName = _.result(this, 'channelName') || 'global';

View File

@ -3,15 +3,16 @@ define([
'backbone', 'backbone',
'backbone.marionette', 'backbone.marionette',
'underscore', 'underscore',
'jquery' 'jquery',
], function(App, Backbone, Marionette, _, jQuery) { 'mailpoet'
], function (App, Backbone, Marionette, _, jQuery, MailPoet) {
'use strict'; 'use strict';
var Module = {}; var Module = {};
Module.HeadingView = Marionette.View.extend({ Module.HeadingView = Marionette.View.extend({
getTemplate: function() { return templates.heading; }, getTemplate: function () { return window.templates.heading; },
templateContext: function () { templateContext: function () {
return { return {
model: this.model.toJSON() model: this.model.toJSON()

View File

@ -8,7 +8,9 @@ define([
'jquery', 'jquery',
'blob', 'blob',
'file-saver', 'file-saver',
'html2canvas' 'html2canvas',
'underscore',
'jquery'
], function ( ], function (
App, App,
CommunicationComponent, CommunicationComponent,
@ -19,7 +21,9 @@ define([
jQuery, jQuery,
Blob, Blob,
FileSaver, FileSaver,
html2canvas html2canvas,
_,
$
) { ) {
'use strict'; 'use strict';
@ -139,7 +143,7 @@ define([
}; };
Module.SaveView = Marionette.View.extend({ Module.SaveView = Marionette.View.extend({
getTemplate: function() { return templates.save; }, getTemplate: function () { return window.templates.save; },
events: { events: {
'click .mailpoet_save_button': 'save', 'click .mailpoet_save_button': 'save',
'click .mailpoet_save_show_options': 'toggleSaveOptions', 'click .mailpoet_save_show_options': 'toggleSaveOptions',

View File

@ -53,7 +53,7 @@ define([
Module.getLayoutWidgets = function () { return Module._layoutWidgets; }; Module.getLayoutWidgets = function () { return Module._layoutWidgets; };
var SidebarView = Marionette.View.extend({ var SidebarView = Marionette.View.extend({
getTemplate: function() { return templates.sidebar; }, getTemplate: function () { return window.templates.sidebar; },
regions: { regions: {
contentRegion: '.mailpoet_content_region', contentRegion: '.mailpoet_content_region',
layoutRegion: '.mailpoet_layout_region', layoutRegion: '.mailpoet_layout_region',
@ -147,7 +147,7 @@ define([
* Responsible for rendering draggable content widgets * Responsible for rendering draggable content widgets
*/ */
Module.SidebarWidgetsView = Marionette.View.extend({ Module.SidebarWidgetsView = Marionette.View.extend({
getTemplate: function() { return templates.sidebarContent; }, getTemplate: function () { return window.templates.sidebarContent; },
regions: { regions: {
widgets: '.mailpoet_region_content' widgets: '.mailpoet_region_content'
}, },
@ -167,14 +167,14 @@ define([
* Responsible for rendering draggable layout widgets * Responsible for rendering draggable layout widgets
*/ */
Module.SidebarLayoutWidgetsView = Module.SidebarWidgetsView.extend({ Module.SidebarLayoutWidgetsView = Module.SidebarWidgetsView.extend({
getTemplate: function() { return templates.sidebarLayout; } getTemplate: function () { return window.templates.sidebarLayout; }
}); });
/** /**
* Responsible for managing global styles * Responsible for managing global styles
*/ */
Module.SidebarStylesView = Marionette.View.extend({ Module.SidebarStylesView = Marionette.View.extend({
getTemplate: function() { return templates.sidebarStyles; }, getTemplate: function () { return window.templates.sidebarStyles; },
behaviors: { behaviors: {
ColorPickerBehavior: {} ColorPickerBehavior: {}
}, },
@ -238,7 +238,7 @@ define([
}); });
Module.SidebarPreviewView = Marionette.View.extend({ Module.SidebarPreviewView = Marionette.View.extend({
getTemplate: function() { return templates.sidebarPreview; }, getTemplate: function () { return window.templates.sidebarPreview; },
events: { events: {
'click .mailpoet_show_preview': 'showPreview', 'click .mailpoet_show_preview': 'showPreview',
'click #mailpoet_send_preview': 'sendPreview' 'click #mailpoet_send_preview': 'sendPreview'
@ -346,7 +346,7 @@ define([
}); });
Module.NewsletterPreviewView = Marionette.View.extend({ Module.NewsletterPreviewView = Marionette.View.extend({
getTemplate: function() { return templates.newsletterPreview; }, getTemplate: function () { return window.templates.newsletterPreview; },
initialize: function (options) { initialize: function (options) {
this.previewUrl = options.previewUrl; this.previewUrl = options.previewUrl;
this.width = '100%'; this.width = '100%';

View File

@ -1,8 +1,9 @@
define([ define([
'newsletter_editor/App', 'newsletter_editor/App',
'backbone.marionette', 'backbone.marionette',
'backbone.supermodel' 'backbone.supermodel',
], function(App, Marionette, SuperModel) { 'underscore'
], function (App, Marionette, SuperModel, _) {
'use strict'; 'use strict';
@ -47,7 +48,7 @@ define([
}); });
Module.StylesView = Marionette.View.extend({ Module.StylesView = Marionette.View.extend({
getTemplate: function() { return templates.styles; }, getTemplate: function () { return window.templates.styles; },
modelEvents: { modelEvents: {
change: 'render' change: 'render'
}, },

View File

@ -1,27 +0,0 @@
/**
* A sample implementation of template widgets.
* A draggable widget, on drop creates a container with (image|text) block.
*/
ImageAndTextTemplateWidgetView = EditorApplication.module('blocks.base').WidgetView.extend({
getTemplate: function() { return templates.imageAndTextInsertion; },
className: 'mailpoet_droppable_block mailpoet_droppable_widget',
behaviors: {
DraggableBehavior: {
drop: function() {
return new (EditorApplication.getBlockTypeModel('container'))({
type: 'container',
orientation: 'horizontal',
blocks: [
{
type: 'image'
},
{
type: 'text',
text: 'Some random text'
}
]
}, {parse: true});
}
}
}
});

View File

@ -374,8 +374,6 @@ const _MailerMixin = {
}; };
export { _QueueMixin as QueueMixin }; export { _QueueMixin as QueueMixin };
export { _StatisticsMixin as StatisticsMixin }; export { _StatisticsMixin as StatisticsMixin };
export { _MailerMixin as MailerMixin }; export { _MailerMixin as MailerMixin };

View File

@ -185,7 +185,7 @@ const NewsletterListNotification = React.createClass({
return ( return (
<select <select
data-id={newsletter.id} data-id={newsletter.id}
defaultValue={ newsletter.status } defaultValue={newsletter.status}
onChange={this.updateStatus} onChange={this.updateStatus}
> >
<option value="active">{ MailPoet.I18n.t('active') }</option> <option value="active">{ MailPoet.I18n.t('active') }</option>
@ -317,7 +317,7 @@ const NewsletterListNotification = React.createClass({
<ListingTabs tab="notification" /> <ListingTabs tab="notification" />
<Listing <Listing
limit={ mailpoet_listing_per_page } limit={window.mailpoet_listing_per_page}
location={this.props.location} location={this.props.location}
params={this.props.params} params={this.props.params}
endpoint="newsletters" endpoint="newsletters"

View File

@ -110,7 +110,7 @@ const NewsletterListNotificationHistory = React.createClass({
>{MailPoet.I18n.t('backToPostNotifications')}</Link> >{MailPoet.I18n.t('backToPostNotifications')}</Link>
<Listing <Listing
limit={ mailpoet_listing_per_page } limit={window.mailpoet_listing_per_page}
location={this.props.location} location={this.props.location}
params={this.props.params} params={this.props.params}
endpoint="newsletters" endpoint="newsletters"

View File

@ -218,7 +218,7 @@ const NewsletterListStandard = React.createClass({
<ListingTabs tab="standard" /> <ListingTabs tab="standard" />
<Listing <Listing
limit={ mailpoet_listing_per_page } limit={window.mailpoet_listing_per_page}
location={this.props.location} location={this.props.location}
params={this.props.params} params={this.props.params}
endpoint="newsletters" endpoint="newsletters"

View File

@ -165,7 +165,7 @@ const NewsletterListWelcome = React.createClass({
<p> <p>
<select <select
data-id={newsletter.id} data-id={newsletter.id}
defaultValue={ newsletter.status } defaultValue={newsletter.status}
onChange={this.updateStatus} onChange={this.updateStatus}
> >
<option value="active">{ MailPoet.I18n.t('active') }</option> <option value="active">{ MailPoet.I18n.t('active') }</option>
@ -295,7 +295,7 @@ const NewsletterListWelcome = React.createClass({
<ListingTabs tab="welcome" /> <ListingTabs tab="welcome" />
<Listing <Listing
limit={ mailpoet_listing_per_page } limit={window.mailpoet_listing_per_page}
location={this.props.location} location={this.props.location}
params={this.props.params} params={this.props.params}
endpoint="newsletters" endpoint="newsletters"

View File

@ -10,6 +10,7 @@ define(
'newsletters/send/welcome.jsx', 'newsletters/send/welcome.jsx',
'newsletters/breadcrumb.jsx', 'newsletters/breadcrumb.jsx',
'help-tooltip.jsx', 'help-tooltip.jsx',
'jquery',
], ],
( (
React, React,
@ -21,7 +22,8 @@ define(
NotificationNewsletterFields, NotificationNewsletterFields,
WelcomeNewsletterFields, WelcomeNewsletterFields,
Breadcrumb, Breadcrumb,
HelpTooltip HelpTooltip,
jQuery
) => { ) => {
const NewsletterSend = React.createClass({ const NewsletterSend = React.createClass({
@ -162,7 +164,9 @@ define(
} }
}).fail(this._showError); }).fail(this._showError);
} }
}).fail(this._showError).always(() => { })
.fail(this._showError)
.always(() => {
this.setState({ loading: false }); this.setState({ loading: false });
}); });
} }
@ -196,7 +200,9 @@ define(
); );
} }
}); });
}).fail(this._showError).always(() => { })
.fail(this._showError)
.always(() => {
this.setState({ loading: false }); this.setState({ loading: false });
}); });
} }
@ -279,6 +285,7 @@ define(
} }
return newField; return newField;
}); });
const sendButtonOptions = this.getSendButtonOptions();
return ( return (
<div> <div>
<h1>{MailPoet.I18n.t('finalNewsletterStep')}</h1> <h1>{MailPoet.I18n.t('finalNewsletterStep')}</h1>
@ -307,7 +314,7 @@ define(
type="button" type="button"
onClick={this.handleSend} onClick={this.handleSend}
value={MailPoet.I18n.t('send')} value={MailPoet.I18n.t('send')}
{...this.getSendButtonOptions()} {...sendButtonOptions}
/> />
} }
&nbsp; &nbsp;
@ -324,10 +331,12 @@ define(
{MailPoet.I18n.t('goBackToDesign')} {MailPoet.I18n.t('goBackToDesign')}
</a>. </a>.
</p> </p>
{ !isPaused && sendButtonOptions['disabled'] && sendButtonOptions['disabled'] === 'disabled' && (
<HelpTooltip <HelpTooltip
tooltip={MailPoet.I18n.t('helpTooltipSendEmail')} tooltip={MailPoet.I18n.t('helpTooltipSendEmail')}
tooltipId="helpTooltipSendEmail" tooltipId="helpTooltipSendEmail"
/> />
) }
</Form> </Form>
</div> </div>
); );

View File

@ -1,5 +1,6 @@
define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) { define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) {
'use strict'; 'use strict';
/*= ================================================================================================= /*= =================================================================================================
MailPoet Notice: MailPoet Notice:

View File

@ -33,13 +33,13 @@ function(
form.parsley().on('form:submit', function (parsley) { form.parsley().on('form:submit', function (parsley) {
var form_data = form.serializeObject() || {}; var form_data = form.serializeObject() || {};
// check if we're on the same domain // check if we're on the same domain
if(isSameDomain(MailPoetForm.ajax_url) === false) { if (isSameDomain(window.MailPoetForm.ajax_url) === false) {
// non ajax post request // non ajax post request
return true; return true;
} else { } else {
// ajax request // ajax request
MailPoet.Ajax.post({ MailPoet.Ajax.post({
url: MailPoetForm.ajax_url, url: window.MailPoetForm.ajax_url,
token: form_data.token, token: form_data.token,
api_version: form_data.api_version, api_version: form_data.api_version,
endpoint: 'subscribers', endpoint: 'subscribers',

View File

@ -210,7 +210,7 @@ const SegmentList = React.createClass({
if (segment.type === 'wp_users') { if (segment.type === 'wp_users') {
// the WP users segment is not editable so just display its name // the WP users segment is not editable so just display its name
segment_name = ( segment_name = (
<span className="row-title">{ segment.name }</span> <span className="row-title">{ segment.name }</span>
); );
} else { } else {
segment_name = ( segment_name = (
@ -258,7 +258,7 @@ const SegmentList = React.createClass({
</h1> </h1>
<Listing <Listing
limit={ mailpoet_listing_per_page } limit={window.mailpoet_listing_per_page}
location={this.props.location} location={this.props.location}
params={this.props.params} params={this.props.params}
messages={messages} messages={messages}

View File

@ -107,7 +107,7 @@ define(
}, },
]; ];
const custom_fields = window.mailpoet_custom_fields || []; const custom_fields = window.mailpoet_custom_fields || [];
custom_fields.map((custom_field) => { custom_fields.map((custom_field) => {
const field = { const field = {
name: 'cf_' + custom_field.id, name: 'cf_' + custom_field.id,

View File

@ -17,14 +17,14 @@ define(
return; return;
} }
jQuery(document).ready(function () { jQuery(document).ready(function () {
if (!exportData.segments) { if (!window.exportData.segments) {
return; return;
} }
var subscribers_export_template = var subscribers_export_template =
Handlebars.compile(jQuery('#mailpoet_subscribers_export_template').html()); Handlebars.compile(jQuery('#mailpoet_subscribers_export_template').html());
// render template // render template
jQuery('#mailpoet_subscribers_export > div.inside').html(subscribers_export_template(exportData)); jQuery('#mailpoet_subscribers_export > div.inside').html(subscribers_export_template(window.exportData));
// define reusable variables // define reusable variables
var segmentsContainerElement = jQuery('#export_lists'), var segmentsContainerElement = jQuery('#export_lists'),
@ -77,9 +77,9 @@ define(
} }
}) })
.on('change', function () { .on('change', function () {
if ((exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length) if ((window.exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
|| ||
(!exportData.segments && subscriberFieldsContainerElement.select2('data').length) (!window.exportData.segments && subscriberFieldsContainerElement.select2('data').length)
) { ) {
toggleNextStepButton('on'); toggleNextStepButton('on');
} }
@ -87,20 +87,20 @@ define(
toggleNextStepButton('off'); toggleNextStepButton('off');
} }
if (segmentsContainerElement.select2('data').length > 1 && exportData.groupBySegmentOption) { if (segmentsContainerElement.select2('data').length > 1 && window.exportData.groupBySegmentOption) {
jQuery('.mailpoet_group_by_list').show(); jQuery('.mailpoet_group_by_list').show();
} }
else if (exportData.groupBySegmentOption) { else if (window.exportData.groupBySegmentOption) {
jQuery('.mailpoet_group_by_list').hide(); jQuery('.mailpoet_group_by_list').hide();
} }
}); });
}; };
// set confirmed subscribers export option to false // set confirmed subscribers export option to false
exportData.exportConfirmedOption = false; window.exportData.exportConfirmedOption = false;
renderSegmentsAndFields(subscriberFieldsContainerElement, subscriberFieldsSelect2); renderSegmentsAndFields(subscriberFieldsContainerElement, window.subscriberFieldsSelect2);
renderSegmentsAndFields(segmentsContainerElement, segments); renderSegmentsAndFields(segmentsContainerElement, window.segments);
subscriberFieldsContainerElement.val([ subscriberFieldsContainerElement.val([
'email', 'email',
@ -112,12 +112,12 @@ define(
exportConfirmedOptionElement.change(function () { exportConfirmedOptionElement.change(function () {
var selectedSegments = segmentsContainerElement.val(); var selectedSegments = segmentsContainerElement.val();
if (this.value == 1) { if (this.value == 1) {
exportData.exportConfirmedOption = true; window.exportData.exportConfirmedOption = true;
renderSegmentsAndFields(segmentsContainerElement, segmentsWithConfirmedSubscribers); renderSegmentsAndFields(segmentsContainerElement, window.segmentsWithConfirmedSubscribers);
} }
else { else {
exportData.exportConfirmedOption = false; window.exportData.exportConfirmedOption = false;
renderSegmentsAndFields(segmentsContainerElement, segments); renderSegmentsAndFields(segmentsContainerElement, window.segments);
} }
segmentsContainerElement.val(selectedSegments).trigger('change'); segmentsContainerElement.val(selectedSegments).trigger('change');
}); });
@ -143,16 +143,16 @@ define(
endpoint: 'ImportExport', endpoint: 'ImportExport',
action: 'processExport', action: 'processExport',
data: JSON.stringify({ data: JSON.stringify({
export_confirmed_option: exportData.exportConfirmedOption, export_confirmed_option: window.exportData.exportConfirmedOption,
export_format_option: exportFormat, export_format_option: exportFormat,
group_by_segment_option: (groupBySegmentOptionElement.is(':visible')) ? groupBySegmentOptionElement.prop('checked') : false, group_by_segment_option: (groupBySegmentOptionElement.is(':visible')) ? groupBySegmentOptionElement.prop('checked') : false,
segments: (exportData.segments) ? segmentsContainerElement.val() : false, segments: (window.exportData.segments) ? segmentsContainerElement.val() : false,
subscriber_fields: subscriberFieldsContainerElement.val() subscriber_fields: subscriberFieldsContainerElement.val()
}) })
}).always(function (response) { }).always(function (response) {
MailPoet.Modal.loading(false); MailPoet.Modal.loading(false);
}).done(function (response) { }).done(function (response) {
resultMessage = MailPoet.I18n.t('exportMessage') var resultMessage = MailPoet.I18n.t('exportMessage')
.replace('%1$s', '<strong>' + parseInt(response.data.totalExported).toLocaleString() + '</strong>') .replace('%1$s', '<strong>' + parseInt(response.data.totalExported).toLocaleString() + '</strong>')
.replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >') .replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
.replace('[/link]', '</a>'); .replace('[/link]', '</a>');
@ -160,7 +160,7 @@ define(
window.location.href = response.data.exportFileURL; window.location.href = response.data.exportFileURL;
MailPoet.trackEvent('Subscribers export completed', { MailPoet.trackEvent('Subscribers export completed', {
'Total exported': response.data.totalExported, 'Total exported': response.data.totalExported,
'Only confirmed?': exportData.exportConfirmedOption, 'Only confirmed?': window.exportData.exportConfirmedOption,
'File Format': exportFormat, 'File Format': exportFormat,
'MailPoet Free version': window.mailpoet_version 'MailPoet Free version': window.mailpoet_version
}); });

View File

@ -27,7 +27,7 @@ define(
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery('input[name="select_method"]').attr('checked', false); jQuery('input[name="select_method"]').attr('checked', false);
// configure router // configure router
router = new (Backbone.Router.extend({ var router = new (Backbone.Router.extend({
routes: { routes: {
'': 'home', '': 'home',
step1: 'step1', step1: 'step1',
@ -51,13 +51,13 @@ define(
*/ */
router.on('route:step1', function () { router.on('route:step1', function () {
// set or reset temporary validation rule on all columns // set or reset temporary validation rule on all columns
mailpoetColumns = jQuery.map(mailpoetColumns, function (column, columnIndex) { window.mailpoetColumns = jQuery.map(window.mailpoetColumns, function (column, columnIndex) {
var col = column; var col = column;
col.validation_rule = false; col.validation_rule = false;
return col; return col;
}); });
if (typeof (importData.step1) !== 'undefined') { if (typeof (window.importData.step1) !== 'undefined') {
showCurrentStep(); showCurrentStep();
return; return;
} }
@ -134,7 +134,7 @@ define(
MailPoet.Notice.hide(); MailPoet.Notice.hide();
// get an approximate size of textarea paste in bytes // get an approximate size of textarea paste in bytes
var pasteSize = encodeURI(pasteInputElement.val()).split(/%..|./).length - 1; var pasteSize = encodeURI(pasteInputElement.val()).split(/%..|./).length - 1;
if (pasteSize > maxPostSizeBytes) { if (pasteSize > window.maxPostSizeBytes) {
MailPoet.Notice.error(MailPoet.I18n.t('maxPostSizeNotice')); MailPoet.Notice.error(MailPoet.I18n.t('maxPostSizeNotice'));
return; return;
} }
@ -169,7 +169,7 @@ define(
setTimeout(function () { setTimeout(function () {
uploadElement.parse({ uploadElement.parse({
config: parseCSV(true) config: parseCSV(true)
}) });
}, 10); }, 10);
} }
}); });
@ -237,7 +237,7 @@ define(
}).always(function (response) { }).always(function (response) {
MailPoet.Modal.loading(false); MailPoet.Modal.loading(false);
}).done(function (response) { }).done(function (response) {
importData.step1 = response.data; window.importData.step1 = response.data;
MailPoet.trackEvent('Subscribers import started', { MailPoet.trackEvent('Subscribers import started', {
source: 'MailChimp', source: 'MailChimp',
'MailPoet Free version': window.mailpoet_version 'MailPoet Free version': window.mailpoet_version
@ -368,7 +368,7 @@ define(
for (var column in rowData) { for (var column in rowData) {
var email = detectAndCleanupEmail(rowData[column]); var email = detectAndCleanupEmail(rowData[column]);
if (emailColumnPosition === null if (emailColumnPosition === null
&& emailRegex.test(email)) { && window.emailRegex.test(email)) {
emailColumnPosition = column; emailColumnPosition = column;
parsedEmails[email] = true; // add current e-mail to an object index parsedEmails[email] = true; // add current e-mail to an object index
rowData[column] = email; rowData[column] = email;
@ -387,7 +387,7 @@ define(
if (_.has(parsedEmails, email)) { if (_.has(parsedEmails, email)) {
duplicateEmails.push(email); duplicateEmails.push(email);
} }
else if (!emailRegex.test(email)) { else if (!window.emailRegex.test(email)) {
invalidEmails.push(rowData[emailColumnPosition]); invalidEmails.push(rowData[emailColumnPosition]);
} }
// if we haven't yet processed this e-mail and it passed // if we haven't yet processed this e-mail and it passed
@ -410,8 +410,8 @@ define(
) { ) {
// since we assume that the header line is always present, we need // since we assume that the header line is always present, we need
// to detect the header by checking if it contains a valid e-mail address // to detect the header by checking if it contains a valid e-mail address
importData.step1 = { window.importData.step1 = {
header: (!emailRegex.test( header: (!window.emailRegex.test(
processedSubscribers[0][emailColumnPosition]) processedSubscribers[0][emailColumnPosition])
) ? processedSubscribers.shift() : null, ) ? processedSubscribers.shift() : null,
subscribers: processedSubscribers, subscribers: processedSubscribers,
@ -433,12 +433,12 @@ define(
MailPoet.Notice.error(errorNotice); MailPoet.Notice.error(errorNotice);
} }
} }
} };
} }
}); });
router.on('route:step2', function () { router.on('route:step2', function () {
if (typeof (importData.step1) === 'undefined') { if (typeof (window.importData.step1) === 'undefined') {
router.navigate('step1', { trigger: true }); router.navigate('step1', { trigger: true });
return; return;
} }
@ -446,7 +446,7 @@ define(
var nextStepButton = jQuery('#step2_process'), var nextStepButton = jQuery('#step2_process'),
previousStepButton = jQuery('#return_to_step1'), previousStepButton = jQuery('#return_to_step1'),
// create a copy of subscribers object for further manipulation // create a copy of subscribers object for further manipulation
subscribers = jQuery.extend(true, {}, importData.step1), subscribers = jQuery.extend(true, {}, window.importData.step1),
subscribersDataTemplate = subscribersDataTemplate =
Handlebars Handlebars
.compile(jQuery('#subscribers_data_template') .compile(jQuery('#subscribers_data_template')
@ -526,7 +526,7 @@ define(
}); });
// show available segments // show available segments
if (mailpoetSegments.length) { if (window.mailpoetSegments.length) {
jQuery('.mailpoet_segments').show(); jQuery('.mailpoet_segments').show();
} }
else { else {
@ -573,14 +573,14 @@ define(
toggleNextStepButton('on'); toggleNextStepButton('on');
} }
} }
}) });
} }
jQuery('.mailpoet_create_segment').click(function () { jQuery('.mailpoet_create_segment').click(function () {
MailPoet.Modal.popup({ MailPoet.Modal.popup({
title: MailPoet.I18n.t('addNewList'), title: MailPoet.I18n.t('addNewList'),
template: jQuery('#new_segment_template').html() template: jQuery('#new_segment_template').html()
}) });
jQuery('#new_segment_name').keypress(function (e) { jQuery('#new_segment_name').keypress(function (e) {
if (e.which == 13) { if (e.which == 13) {
jQuery('#new_segment_process').click(); jQuery('#new_segment_process').click();
@ -599,7 +599,7 @@ define(
description: segmentDescription description: segmentDescription
} }
}).done(function (response) { }).done(function (response) {
mailpoetSegments.push({ window.mailpoetSegments.push({
id: response.data.id, id: response.data.id,
name: response.data.name, name: response.data.name,
subscriberCount: 0 subscriberCount: 0
@ -607,12 +607,12 @@ define(
var selected_values = segmentSelectElement.val(); var selected_values = segmentSelectElement.val();
if (selected_values === null) { if (selected_values === null) {
selected_values = [response.data.id] selected_values = [response.data.id];
} else { } else {
selected_values.push(response.data.id); selected_values.push(response.data.id);
} }
enableSegmentSelection(mailpoetSegments); enableSegmentSelection(window.mailpoetSegments);
segmentSelectElement.val(selected_values).trigger('change'); segmentSelectElement.val(selected_values).trigger('change');
jQuery('.mailpoet_segments:hidden').show(); jQuery('.mailpoet_segments:hidden').show();
jQuery('.mailpoet_no_segments:visible').hide(); jQuery('.mailpoet_no_segments:visible').hide();
@ -649,16 +649,16 @@ define(
var columnData = subscribers.subscribers[0][i], var columnData = subscribers.subscribers[0][i],
columnId = 'ignore'; // set default column type columnId = 'ignore'; // set default column type
// if the column is not undefined and has a valid e-mail, set type as email // if the column is not undefined and has a valid e-mail, set type as email
if (columnData % 1 !== 0 && emailRegex.test(columnData)) { if (columnData % 1 !== 0 && window.emailRegex.test(columnData)) {
columnId = 'email'; columnId = 'email';
} else if (subscribers.header) { } else if (subscribers.header) {
var headerName = subscribers.header[i], var headerName = subscribers.header[i],
headerNameMatch = mailpoetColumns.map(function (el) { headerNameMatch = window.mailpoetColumns.map(function (el) {
return el.name; return el.name;
}).indexOf(headerName); }).indexOf(headerName);
// set column type using header // set column type using header
if (headerNameMatch !== -1) { if (headerNameMatch !== -1) {
columnId = mailpoetColumns[headerNameMatch].id; columnId = window.mailpoetColumns[headerNameMatch].id;
}// set column type using header name }// set column type using header name
else if (headerName) { else if (headerName) {
if (/first|first name|given name/i.test(headerName)) { if (/first|first name|given name/i.test(headerName)) {
@ -723,7 +723,7 @@ define(
// filter displayed data // filter displayed data
jQuery('select.mailpoet_subscribers_column_data_match') jQuery('select.mailpoet_subscribers_column_data_match')
.select2({ .select2({
data: mailpoetColumnsSelect2, data: window.mailpoetColumnsSelect2,
width: '15em', width: '15em',
templateResult: function (item) { templateResult: function (item) {
return item.name; return item.name;
@ -762,21 +762,21 @@ define(
custom: true custom: true
}; };
// if this is the first custom column, create an "optgroup" // if this is the first custom column, create an "optgroup"
if (mailpoetColumnsSelect2.length === 2) { if (window.mailpoetColumnsSelect2.length === 2) {
mailpoetColumnsSelect2.push({ window.mailpoetColumnsSelect2.push({
name: MailPoet.I18n.t('userColumns'), name: MailPoet.I18n.t('userColumns'),
children: [] children: []
}); });
} }
mailpoetColumnsSelect2[2].children.push(new_column_data); window.mailpoetColumnsSelect2[2].children.push(new_column_data);
mailpoetColumns.push(new_column_data); window.mailpoetColumns.push(new_column_data);
jQuery('select.mailpoet_subscribers_column_data_match') jQuery('select.mailpoet_subscribers_column_data_match')
.each(function () { .each(function () {
jQuery(this) jQuery(this)
.html('') .html('')
.select2('destroy') .select2('destroy')
.select2({ .select2({
data: mailpoetColumnsSelect2, data: window.mailpoetColumnsSelect2,
width: '15em', width: '15em',
templateResult: function (item) { templateResult: function (item) {
return item.name; return item.name;
@ -784,7 +784,7 @@ define(
templateSelection: function (item) { templateSelection: function (item) {
return item.name; return item.name;
} }
}) });
}); });
jQuery(selectElement).data('column-id', new_column_data.id); jQuery(selectElement).data('column-id', new_column_data.id);
jQuery(selectElement).data('validation-rule', false); jQuery(selectElement).data('validation-rule', false);
@ -845,14 +845,14 @@ define(
return { id: columnId, index: elementIndex, validationRule: validationRule, element: element }; return { id: columnId, index: elementIndex, validationRule: validationRule, element: element };
}); });
// iterate through the object of mailpoet columns // iterate through the object of mailpoet columns
jQuery.map(mailpoetColumns, function (column, columnIndex) { jQuery.map(window.mailpoetColumns, function (column, columnIndex) {
// check if the column id matches the selected id of one of the // check if the column id matches the selected id of one of the
// subscriber's data columns // subscriber's data columns
var matchedColumn = _.find(displayedColumns, function (data) { return data.id === column.id; }); var matchedColumn = _.find(displayedColumns, function (data) { return data.id === column.id; });
// EMAIL filter: if the first value in the column doesn't have a valid // EMAIL filter: if the first value in the column doesn't have a valid
// email, hide the next button // email, hide the next button
if (column.id === 'email') { if (column.id === 'email') {
if (!emailRegex.test(subscribersClone.subscribers[0][matchedColumn.index])) { if (!window.emailRegex.test(subscribersClone.subscribers[0][matchedColumn.index])) {
preventNextStep = true; preventNextStep = true;
if (!jQuery('[data-id="notice_invalidEmail"]').length) { if (!jQuery('[data-id="notice_invalidEmail"]').length) {
MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidElement'), { MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidElement'), {
@ -893,11 +893,11 @@ define(
} }
else { else {
for (var format in allowedDateFormats) { for (var format in allowedDateFormats) {
var testedFormat = allowedDateFormats[format] var testedFormat = allowedDateFormats[format];
if (Moment(firstRowData, testedFormat, true).isValid()) { if (Moment(firstRowData, testedFormat, true).isValid()) {
var validationRule = (typeof (testedFormat) === 'function') ? var validationRule = (typeof (testedFormat) === 'function') ?
'datetime' : 'datetime' :
testedFormat testedFormat;
// set validation on the column element // set validation on the column element
jQuery(matchedColumn.element).data('validation-rule', validationRule); jQuery(matchedColumn.element).data('validation-rule', validationRule);
break; break;
@ -931,7 +931,7 @@ define(
+ '</span> ' + '</span> '
); );
preventNextStep = true; preventNextStep = true;
}; }
}); });
if (preventNextStep && !jQuery('.mailpoet_invalidDate').length) { if (preventNextStep && !jQuery('.mailpoet_invalidDate').length) {
MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidDate'), { MailPoet.Notice.error(MailPoet.I18n.t('columnContainsInvalidDate'), {
@ -996,7 +996,7 @@ define(
return res; return res;
}, []); }, []);
}, },
subscribers = splitSubscribers(importData.step1.subscribers, batchSize); subscribers = splitSubscribers(window.importData.step1.subscribers, batchSize);
_.each(jQuery('select.mailpoet_subscribers_column_data_match'), _.each(jQuery('select.mailpoet_subscribers_column_data_match'),
function (column, columnIndex) { function (column, columnIndex) {
@ -1020,7 +1020,7 @@ define(
subscribers: subscribers[batchNumber], subscribers: subscribers[batchNumber],
timestamp: timestamp, timestamp: timestamp,
segments: segmentSelectElement.val(), segments: segmentSelectElement.val(),
updateSubscribers: (jQuery(':radio[name="subscriber_update_option"]:checked').val() === 'yes') ? true : false updateSubscribers: (jQuery(':radio[name="subscriber_update_option"]:checked').val() === 'yes')
}) })
}).done(function (response) { }).done(function (response) {
importResults.created += response.data.created; importResults.created += response.data.created;
@ -1038,7 +1038,7 @@ define(
} }
}); });
batchNumber++; batchNumber++;
}) });
}); });
queue.run(); queue.run();
@ -1050,37 +1050,37 @@ define(
); );
} }
else { else {
mailpoetSegments = importResults.segments; window.mailpoetSegments = importResults.segments;
importResults.segments = _.map(segmentSelectElement.select2('data'), importResults.segments = _.map(segmentSelectElement.select2('data'),
function (data) { function (data) {
return data.name; return data.name;
}); });
importData.step2 = importResults; window.importData.step2 = importResults;
enableSegmentSelection(mailpoetSegments); enableSegmentSelection(window.mailpoetSegments);
router.navigate('step3', { trigger: true }); router.navigate('step3', { trigger: true });
} }
}); });
}); });
filterSubscribers(); filterSubscribers();
enableSegmentSelection(mailpoetSegments); enableSegmentSelection(window.mailpoetSegments);
}); });
router.on('route:step3', function () { router.on('route:step3', function () {
if (typeof (importData.step2) === 'undefined') { if (typeof (window.importData.step2) === 'undefined') {
router.navigate('step2', { trigger: true }); router.navigate('step2', { trigger: true });
return; return;
} }
showCurrentStep(); showCurrentStep();
if (importData.step2.errors.length > 0) { if (window.importData.step2.errors.length > 0) {
MailPoet.Notice.error(_.flatten(importData.step2.errors)); MailPoet.Notice.error(_.flatten(window.importData.step2.errors));
} }
MailPoet.trackEvent('Subscribers import finished', { MailPoet.trackEvent('Subscribers import finished', {
'Subscribers created': importData.step2.created, 'Subscribers created': window.importData.step2.created,
'Subscribers updated': importData.step2.updated, 'Subscribers updated': window.importData.step2.updated,
'MailPoet Free version': window.mailpoet_version 'MailPoet Free version': window.mailpoet_version
}); });
@ -1091,18 +1091,18 @@ define(
.html()), .html()),
exportMenuElement = jQuery('span.mailpoet_export'), exportMenuElement = jQuery('span.mailpoet_export'),
importResults = { importResults = {
created: (importData.step2.created) created: (window.importData.step2.created)
? MailPoet.I18n.t('subscribersCreated') ? MailPoet.I18n.t('subscribersCreated')
.replace('%1$s', '<strong>' + importData.step2.created.toLocaleString() + '</strong>') .replace('%1$s', '<strong>' + window.importData.step2.created.toLocaleString() + '</strong>')
.replace('%2$s', '"' + importData.step2.segments.join('", "') + '"') .replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
: false, : false,
updated: (importData.step2.updated) updated: (window.importData.step2.updated)
? MailPoet.I18n.t('subscribersUpdated') ? MailPoet.I18n.t('subscribersUpdated')
.replace('%1$s', '<strong>' + importData.step2.updated.toLocaleString() + '</strong>') .replace('%1$s', '<strong>' + window.importData.step2.updated.toLocaleString() + '</strong>')
.replace('%2$s', '"' + importData.step2.segments.join('", "') + '"') .replace('%2$s', '"' + window.importData.step2.segments.join('", "') + '"')
: false, : false,
no_action: (!importData.step2.created && !importData.step2.updated), no_action: (!window.importData.step2.created && !window.importData.step2.updated),
added_to_segment_with_welcome_notification: importData.step2.added_to_segment_with_welcome_notification added_to_segment_with_welcome_notification: window.importData.step2.added_to_segment_with_welcome_notification
}; };
jQuery('#subscribers_data_import_results') jQuery('#subscribers_data_import_results')
@ -1125,7 +1125,7 @@ define(
} }
// reset previous step's data so that coming back to this step is prevented // reset previous step's data so that coming back to this step is prevented
importData.step2 = undefined; window.importData.step2 = undefined;
}); });
if (!Backbone.History.started) { if (!Backbone.History.started) {

View File

@ -83,7 +83,7 @@ const messages = {
MailPoet.Notice.success(message); MailPoet.Notice.success(message);
}, },
onNoItemsFound: (group) => { onNoItemsFound: (group) => {
if (group === 'bounced' && !mailpoet_premium_active) { if (group === 'bounced' && !window.mailpoet_premium_active) {
return ( return (
<div> <div>
<p>{MailPoet.I18n.t('bouncedSubscribersHelp')}</p> <p>{MailPoet.I18n.t('bouncedSubscribersHelp')}</p>
@ -245,7 +245,7 @@ const item_actions = [
const SubscriberList = React.createClass({ const SubscriberList = React.createClass({
getSegmentFromId: function (segment_id) { getSegmentFromId: function (segment_id) {
let result = false; let result = false;
mailpoet_segments.map((segment) => { window.mailpoet_segments.map((segment) => {
if (segment.id === segment_id) { if (segment.id === segment_id) {
result = segment; result = segment;
} }
@ -350,7 +350,7 @@ const SubscriberList = React.createClass({
</h1> </h1>
<Listing <Listing
limit={ mailpoet_listing_per_page } limit={window.mailpoet_listing_per_page}
location={this.props.location} location={this.props.location}
params={this.props.params} params={this.props.params}
endpoint="subscribers" endpoint="subscribers"

View File

@ -130,6 +130,10 @@ class API {
$endpoint = new $this->_request_endpoint_class(); $endpoint = new $this->_request_endpoint_class();
if(!method_exists($endpoint, $this->_request_method)) {
throw new \Exception(__('Invalid API endpoint method.', 'mailpoet'));
}
// check the accessibility of the requested endpoint's action // check the accessibility of the requested endpoint's action
// by default, an endpoint's action is considered "private" // by default, an endpoint's action is considered "private"
if(!$this->validatePermissions($this->_request_method, $endpoint->permissions)) { if(!$this->validatePermissions($this->_request_method, $endpoint->permissions)) {

View File

@ -1,4 +1,5 @@
<?php <?php
namespace MailPoet\API\JSON; namespace MailPoet\API\JSON;
if(!defined('ABSPATH')) exit; if(!defined('ABSPATH')) exit;
@ -12,23 +13,19 @@ class ErrorResponse extends Response {
} }
function getData() { function getData() {
if(empty($this->errors)) { return (empty($this->errors)) ? null : array('errors' => $this->errors);
return null;
} else {
return array(
'errors' => $this->errors
);
}
} }
function formatErrors($errors = array()) { function formatErrors($errors = array()) {
$formatted_errors = array(); return array_map(function($error, $message) {
foreach($errors as $error => $message) { // sanitize SQL error
$formatted_errors[] = array( if(preg_match('/^SQLSTATE/i', $message)) {
$message = __('An unknown error occurred.', 'mailpoet');
}
return array(
'error' => $error, 'error' => $error,
'message' => $message 'message' => $message
); );
} }, array_keys($errors), array_values($errors));
return $formatted_errors;
} }
} }

View File

@ -19,8 +19,14 @@ class AutomatedLatestContent extends APIEndpoint {
} }
function getPostTypes() { function getPostTypes() {
$post_types = array_map(function($post_type) {
return array(
'name' => $post_type->name,
'label' => $post_type->label
);
}, get_post_types(array(), 'objects'));
return $this->successResponse( return $this->successResponse(
get_post_types(array(), 'objects') $post_types
); );
} }

View File

@ -65,13 +65,11 @@ class Newsletters extends APIEndpoint {
$newsletter = Newsletter::createOrUpdate($data); $newsletter = Newsletter::createOrUpdate($data);
$errors = $newsletter->getErrors(); $errors = $newsletter->getErrors();
if(!empty($errors)) { if(!empty($errors)) return $this->badRequest($errors);
return $this->badRequest($errors);
} else {
if(!empty($segments)) { if(!empty($segments)) {
NewsletterSegment::where('newsletter_id', $newsletter->id) NewsletterSegment::where('newsletter_id', $newsletter->id)
->deleteMany(); ->deleteMany();
foreach($segments as $segment) { foreach($segments as $segment) {
if(!is_array($segment)) continue; if(!is_array($segment)) continue;
$relation = NewsletterSegment::create(); $relation = NewsletterSegment::create();
@ -86,7 +84,6 @@ class Newsletters extends APIEndpoint {
'newsletter_type', 'newsletter_type',
$newsletter->type $newsletter->type
)->findMany(); )->findMany();
// update newsletter options // update newsletter options
foreach($option_fields as $option_field) { foreach($option_fields as $option_field) {
if(isset($options[$option_field->name])) { if(isset($options[$option_field->name])) {
@ -99,11 +96,9 @@ class Newsletters extends APIEndpoint {
); );
} }
} }
// reload newsletter with updated options // reload newsletter with updated options
$newsletter = Newsletter::filter('filterWithOptions') $newsletter = Newsletter::filter('filterWithOptions')
->findOne($newsletter->id); ->findOne($newsletter->id);
// if this is a post notification, process newsletter options and update its schedule // if this is a post notification, process newsletter options and update its schedule
if($newsletter->type === Newsletter::TYPE_NOTIFICATION) { if($newsletter->type === Newsletter::TYPE_NOTIFICATION) {
// generate the new schedule from options and get the new "next run" date // generate the new schedule from options and get the new "next run" date
@ -120,16 +115,22 @@ class Newsletters extends APIEndpoint {
$queue = $newsletter->getQueue(); $queue = $newsletter->getQueue();
if($queue) { if($queue) {
// if newsletter was previously scheduled and is now unscheduled, set its status to DRAFT and delete associated queue record
if($newsletter->status === Newsletter::STATUS_SCHEDULED && isset($options['isScheduled']) && empty($options['isScheduled'])) {
$queue->delete();
$newsletter->status = Newsletter::STATUS_DRAFT;
$newsletter->save();
} else {
$queue->newsletter_rendered_body = null; $queue->newsletter_rendered_body = null;
$queue->newsletter_rendered_subject = null; $queue->newsletter_rendered_subject = null;
$queue->save(); $queue->save();
} }
}
Hooks::doAction('mailpoet_api_newsletters_save_after', $newsletter); Hooks::doAction('mailpoet_api_newsletters_save_after', $newsletter);
return $this->successResponse($newsletter->asArray()); return $this->successResponse($newsletter->asArray());
} }
}
function setStatus($data = array()) { function setStatus($data = array()) {
$status = (isset($data['status']) ? $data['status'] : null); $status = (isset($data['status']) ? $data['status'] : null);
@ -267,6 +268,8 @@ class Newsletters extends APIEndpoint {
$newsletter, $newsletter,
$subscriber $subscriber
); );
// strip protocol to avoid mix content error
$preview_url = preg_replace('{^https?:}i', '', $preview_url);
return $this->successResponse( return $this->successResponse(
Newsletter::findOne($newsletter->id)->asArray(), Newsletter::findOne($newsletter->id)->asArray(),

View File

@ -2,6 +2,8 @@
namespace MailPoet\Config; namespace MailPoet\Config;
use MailPoet\Models\Setting;
if(!defined('ABSPATH')) exit; if(!defined('ABSPATH')) exit;
class Activator { class Activator {
@ -11,8 +13,7 @@ class Activator {
$populator = new Populator(); $populator = new Populator();
$populator->up(); $populator->up();
Setting::setValue('db_version', Env::$version);
update_option('mailpoet_db_version', Env::$version);
} }
function deactivate() { function deactivate() {

View File

@ -4,6 +4,7 @@ namespace MailPoet\Config;
use MailPoet\API; use MailPoet\API;
use MailPoet\Cron\CronTrigger; use MailPoet\Cron\CronTrigger;
use MailPoet\Models\Setting;
use MailPoet\Router; use MailPoet\Router;
use MailPoet\Util\ConflictResolver; use MailPoet\Util\ConflictResolver;
use MailPoet\Util\Helpers; use MailPoet\Util\Helpers;
@ -61,12 +62,17 @@ class Initializer {
add_action('init', array( add_action('init', array(
$this, $this,
'onInit' 'preInitialize'
), 0); ), 0);
add_action('init', array(
$this,
'initialize'
));
add_action('wp_loaded', array( add_action('wp_loaded', array(
$this, $this,
'setupHooks' 'postInitialize'
)); ));
add_action('admin_init', array( add_action('admin_init', array(
@ -90,7 +96,27 @@ class Initializer {
$database->init(); $database->init();
} }
function onInit() { function preInitialize() {
try {
$this->setupRenderer();
$this->setupWidget();
} catch(\Exception $e) {
$this->handleFailedInitialization($e);
}
}
function setupRenderer() {
$caching = !WP_DEBUG;
$debugging = WP_DEBUG;
$this->renderer = new Renderer($caching, $debugging);
}
function setupWidget() {
$widget = new Widget($this->renderer);
$widget->init();
}
function initialize() {
try { try {
$this->setupAccessControl(); $this->setupAccessControl();
@ -98,8 +124,6 @@ class Initializer {
$this->setupInstaller(); $this->setupInstaller();
$this->setupUpdater(); $this->setupUpdater();
$this->setupRenderer();
$this->setupWidget();
$this->setupLocalizer(); $this->setupLocalizer();
$this->setupMenu(); $this->setupMenu();
$this->setupShortcodes(); $this->setupShortcodes();
@ -109,8 +133,6 @@ class Initializer {
$this->setupCronTrigger(); $this->setupCronTrigger();
$this->setupConflictResolver(); $this->setupConflictResolver();
$this->setupJSONAPI();
$this->setupRouter();
$this->setupPages(); $this->setupPages();
do_action('mailpoet_initialized', MAILPOET_VERSION); do_action('mailpoet_initialized', MAILPOET_VERSION);
@ -122,7 +144,11 @@ class Initializer {
} }
function maybeDbUpdate() { function maybeDbUpdate() {
$current_db_version = get_option('mailpoet_db_version', false); try {
$current_db_version = Setting::getValue('db_version');
} catch(\Exception $e) {
$current_db_version = null;
}
// if current db version and plugin version differ // if current db version and plugin version differ
if(version_compare($current_db_version, Env::$version) !== 0) { if(version_compare($current_db_version, Env::$version) !== 0) {
@ -158,19 +184,8 @@ class Initializer {
$updater->init(); $updater->init();
} }
function setupRenderer() {
$caching = !WP_DEBUG;
$debugging = WP_DEBUG;
$this->renderer = new Renderer($caching, $debugging);
}
function setupWidget() {
$widget = new Widget($this->renderer);
$widget->init();
}
function setupLocalizer() { function setupLocalizer() {
$localizer = new Localizer($this->renderer); $localizer = new Localizer();
$localizer->init(); $localizer->init();
} }
@ -206,6 +221,17 @@ class Initializer {
$conflict_resolver->init(); $conflict_resolver->init();
} }
function postInitialize() {
if(!defined(self::INITIALIZED)) return;
try {
$this->setupHooks();
$this->setupJSONAPI();
$this->setupRouter();
} catch(\Exception $e) {
$this->handleFailedInitialization($e);
}
}
function setupJSONAPI() { function setupJSONAPI() {
$json_api = API\API::JSON($this->access_control); $json_api = API\API::JSON($this->access_control);
$json_api->init(); $json_api->init();
@ -222,13 +248,8 @@ class Initializer {
} }
function setupHooks() { function setupHooks() {
if(!defined(self::INITIALIZED)) return;
try {
$hooks = new Hooks(); $hooks = new Hooks();
$hooks->init(); $hooks->init();
} catch(\Exception $e) {
$this->handleFailedInitialization($e);
}
} }
function handleFailedInitialization($exception) { function handleFailedInitialization($exception) {

View File

@ -1,32 +1,21 @@
<?php <?php
namespace MailPoet\Config; namespace MailPoet\Config;
if(!defined('ABSPATH')) exit; if(!defined('ABSPATH')) exit;
class Localizer { class Localizer {
function __construct($renderer) {
$this->renderer = $renderer;
}
function init() { function init() {
add_action(
'init',
array($this, 'setup')
);
}
function setup() {
$this->loadGlobalText(); $this->loadGlobalText();
$this->loadPluginText(); $this->loadPluginText();
$this->setGlobalRtl();
} }
function loadGlobalText() { function loadGlobalText() {
$language_path = $language_path = sprintf(
Env::$languages_path '%s/%s.mo',
. '/' Env::$languages_path,
. $this->locale() $this->locale()
. '.mo'; );
load_textdomain(Env::$plugin_name, $language_path); load_textdomain(Env::$plugin_name, $language_path);
} }
@ -38,10 +27,6 @@ class Localizer {
); );
} }
function setGlobalRtl() {
$this->renderer->addGlobal('is_rtl', is_rtl());
}
function locale() { function locale() {
$locale = apply_filters( $locale = apply_filters(
'plugin_locale', 'plugin_locale',

View File

@ -148,7 +148,7 @@ class MP2Migrator {
} }
ob_start(); ob_start();
$datetime = new \MailPoet\WP\DateTime(); $datetime = new \MailPoet\WP\DateTime();
$this->log(sprintf('=== ' . __('START IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT))); $this->log(sprintf('=== ' . mb_strtoupper(__('Start import', 'mailpoet'), 'UTF-8') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
Setting::setValue('import_stopped', false); // Reset the stop import action Setting::setValue('import_stopped', false); // Reset the stop import action
if(!Setting::getValue('mailpoet_migration_started', false)) { if(!Setting::getValue('mailpoet_migration_started', false)) {
@ -165,10 +165,10 @@ class MP2Migrator {
if(!$this->importStopped()) { if(!$this->importStopped()) {
Setting::setValue('mailpoet_migration_complete', true); Setting::setValue('mailpoet_migration_complete', true);
$this->log(__('IMPORT COMPLETE', 'mailpoet')); $this->log(mb_strtoupper(__('Import complete', 'mailpoet'), 'UTF-8'));
} }
$this->log(sprintf('=== ' . __('END IMPORT', 'mailpoet') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT))); $this->log(sprintf('=== ' . mb_strtoupper(__('End import', 'mailpoet'), 'UTF-8') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));
$result = ob_get_contents(); $result = ob_get_contents();
ob_clean(); ob_clean();
return $result; return $result;
@ -223,7 +223,7 @@ class MP2Migrator {
*/ */
public function stopImport() { public function stopImport() {
Setting::setValue('import_stopped', true); Setting::setValue('import_stopped', true);
$this->log(__('IMPORT STOPPED BY USER', 'mailpoet')); $this->log(mb_strtoupper(__('Import stopped by user', 'mailpoet'), 'UTF-8'));
} }
/** /**
@ -486,7 +486,7 @@ class MP2Migrator {
break; break;
default: default:
$params['date_format'] = strtoupper($params['date_order']); $params['date_format'] = mb_strtoupper($params['date_order'], 'UTF-8');
} }
unset($params['date_order']); unset($params['date_order']);
} }

View File

@ -172,7 +172,8 @@ class Migrator {
'deleted_at TIMESTAMP NULL,', 'deleted_at TIMESTAMP NULL,',
'unconfirmed_data longtext,', 'unconfirmed_data longtext,',
'PRIMARY KEY (id),', 'PRIMARY KEY (id),',
'UNIQUE KEY email (email)' 'UNIQUE KEY email (email),',
'KEY wp_user_id (wp_user_id)',
); );
return $this->sqlify(__FUNCTION__, $attributes); return $this->sqlify(__FUNCTION__, $attributes);
} }
@ -186,7 +187,8 @@ class Migrator {
'created_at TIMESTAMP NULL,', 'created_at TIMESTAMP NULL,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,', 'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'PRIMARY KEY (id),', 'PRIMARY KEY (id),',
'UNIQUE KEY subscriber_segment (subscriber_id,segment_id)' 'UNIQUE KEY subscriber_segment (subscriber_id,segment_id),',
'KEY segment_id (segment_id)',
); );
return $this->sqlify(__FUNCTION__, $attributes); return $this->sqlify(__FUNCTION__, $attributes);
} }

View File

@ -3,8 +3,6 @@
namespace MailPoet\Config; namespace MailPoet\Config;
class PluginActivatedHook { class PluginActivatedHook {
/** @var DeferredAdminNotices */
private $deferred_admin_notices; private $deferred_admin_notices;
public function __construct(DeferredAdminNotices $deferred_admin_notices) { public function __construct(DeferredAdminNotices $deferred_admin_notices) {
@ -13,8 +11,7 @@ class PluginActivatedHook {
public function action($plugin, $network_wide) { public function action($plugin, $network_wide) {
if($plugin === plugin_basename(Env::$file) && $network_wide) { if($plugin === plugin_basename(Env::$file) && $network_wide) {
$this->deferred_admin_notices->addNetworkAdminNotice(__('We noticed that you\'re using an unsupported environment. While MailPoet might work within a MultiSite environment, we dont support it.', 'mailpoet')); $this->deferred_admin_notices->addNetworkAdminNotice(__("We noticed that you're using an unsupported environment. While MailPoet might work within a MultiSite environment, we dont support it.", 'mailpoet'));
} }
} }
} }

View File

@ -337,7 +337,7 @@ class Populator {
function convertExistingDataToUTF8() { function convertExistingDataToUTF8() {
global $wpdb; global $wpdb;
if(!version_compare(get_option('mailpoet_db_version', '3.0.0-beta.33'), '3.0.0-beta.32', '<=')) { if(!version_compare(Setting::getValue('db_version', '3.0.0-beta.33'), '3.0.0-beta.32', '<=')) {
// Data conversion should only be performed only once, when migrating from // Data conversion should only be performed only once, when migrating from
// older version // older version
return false; return false;
@ -402,7 +402,7 @@ class Populator {
global $wpdb; global $wpdb;
// perform once for versions below 3.0.0-beta.36.2.1 // perform once for versions below 3.0.0-beta.36.2.1
if(version_compare(get_option('mailpoet_db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) { if(version_compare(Setting::getValue('db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
return false; return false;
} }
@ -455,7 +455,7 @@ class Populator {
global $wpdb; global $wpdb;
// perform once for versions below 3.0.0-beta.36.2.1 // perform once for versions below 3.0.0-beta.36.2.1
if(version_compare(get_option('mailpoet_db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) { if(version_compare(Setting::getValue('db_version', '3.0.0-beta.36.2.3'), '3.0.0-beta.36.2.1', '>=')) {
return false; return false;
} }

View File

@ -8,7 +8,7 @@ class AppWelcome {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/app_welcome'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/app_welcome';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class BurgerJoint {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = 'http://ps.w.org/mailpoet/assets/newsletter-templates/burger_joint'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/burger_joint';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class ChocolateStore {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/chocolate_store'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/chocolate_store';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class CoffeeShop {
private $template_image_url; private $template_image_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/franks-roast-house'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/franks-roast-house';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class Discount {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/discount'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/discount';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class Faith {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/faith'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/faith';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class FestivalEvent {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/festival_event'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/festival_event';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -9,7 +9,7 @@ class FoodBox {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/food_box'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/food_box';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class KickOff {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/kick_off'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/kick_off';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class NewsDay {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/news_day'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/news_day';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -7,7 +7,7 @@ class NewsletterBlank121Column {
function __construct($assets_url) { function __construct($assets_url) {
$this->assets_url = $assets_url; $this->assets_url = $assets_url;
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-1-column'; $this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-1-column';
$this->template_image_url = $this->assets_url . '/img/blank_templates'; $this->template_image_url = $this->assets_url . '/img/blank_templates';
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -7,7 +7,7 @@ class NewsletterBlank12Column {
function __construct($assets_url) { function __construct($assets_url) {
$this->assets_url = $assets_url; $this->assets_url = $assets_url;
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-column'; $this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-column';
$this->template_image_url = $this->assets_url . '/img/blank_templates'; $this->template_image_url = $this->assets_url . '/img/blank_templates';
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
} }
@ -117,7 +117,7 @@ class NewsletterBlank12Column {
), ),
array( array(
"type" => "text", "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 help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet') "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started!</strong></h1>\n<p>&nbsp;</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>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
), ),
array( array(
"type" => "divider", "type" => "divider",

View File

@ -7,7 +7,7 @@ class NewsletterBlank13Column {
function __construct($assets_url) { function __construct($assets_url) {
$this->assets_url = $assets_url; $this->assets_url = $assets_url;
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-3-column'; $this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-3-column';
$this->template_image_url = $this->assets_url . '/img/blank_templates'; $this->template_image_url = $this->assets_url . '/img/blank_templates';
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
} }
@ -117,7 +117,7 @@ class NewsletterBlank13Column {
), ),
array( array(
"type" => "text", "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 four menu items that will help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet') "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p>&nbsp;</p>\n<p>It's time to design your newsletter! In 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>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
), ),
array( array(
"type" => "divider", "type" => "divider",

View File

@ -7,7 +7,7 @@ class NewsletterBlank1Column {
function __construct($assets_url) { function __construct($assets_url) {
$this->assets_url = $assets_url; $this->assets_url = $assets_url;
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-column'; $this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-column';
$this->template_image_url = $this->assets_url . '/img/blank_templates'; $this->template_image_url = $this->assets_url . '/img/blank_templates';
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
} }
@ -117,7 +117,7 @@ class NewsletterBlank1Column {
), ),
array( array(
"type" => "text", "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 help you customize your newsletter:</p>\n<ol>\n<li>Content</li>\n<li>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet') "text" => __("<h1 style=\"text-align: center;\"><strong>Let's Get Started! </strong></h1>\n<p>&nbsp;</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>Columns</li>\n<li>Styles</li>\n<li>Preview</li>\n</ol>", 'mailpoet')
) )
) )
) )

View File

@ -8,7 +8,7 @@ class PieceOfCake {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/piece_of_cake'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/piece_of_cake';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -7,7 +7,7 @@ class PostNotificationsBlank1Column {
function __construct($assets_url) { function __construct($assets_url) {
$this->assets_url = $assets_url; $this->assets_url = $assets_url;
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/post-notifications-blank-1-column'; $this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/post-notifications-blank-1-column';
$this->template_image_url = $this->assets_url . '/img/blank_templates'; $this->template_image_url = $this->assets_url . '/img/blank_templates';
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
} }
@ -117,7 +117,7 @@ class PostNotificationsBlank1Column {
), ),
array( array(
"type" => "text", "type" => "text",
"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 in 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') "text" => __("<h1 style=\"text-align: center;\"><strong>Check Out Our New Blog Posts! </strong></h1>\n<p>&nbsp;</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 in 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( array(
"type" => "divider", "type" => "divider",

View File

@ -8,7 +8,7 @@ class ScienceWeekly {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/science_weekly'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/science_weekly';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class Shoes {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/shoes'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/shoes';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -7,7 +7,7 @@ class SimpleText {
function __construct($assets_url) { function __construct($assets_url) {
$this->assets_url = $assets_url; $this->assets_url = $assets_url;
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/simple-text'; $this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/simple-text';
$this->template_image_url = $this->assets_url . '/img/blank_templates'; $this->template_image_url = $this->assets_url . '/img/blank_templates';
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
} }
@ -132,7 +132,7 @@ class SimpleText {
), ),
array( array(
"type" => "text", "type" => "text",
"text" => __("<p>Thanks for reading. See you soon!</p>\n<p></p>\n<p><strong><em>The MailPoet Team</em></strong></p>", 'mailpoet') "text" => __("<p>Thanks for reading. See you soon!</p>\n<p>&nbsp;</p>\n<p><strong><em>The MailPoet Team</em></strong></p>", 'mailpoet')
), ),
array( array(
"type" => "footer", "type" => "footer",

View File

@ -8,7 +8,7 @@ class TakeAHike {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/take_a_hike'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/take_a_hike';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -8,7 +8,7 @@ class TravelNomads {
private $social_icon_url; private $social_icon_url;
function __construct($assets_url) { function __construct($assets_url) {
$this->template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/travel_nomads'; $this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/travel_nomads';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
} }

View File

@ -7,7 +7,7 @@ class WelcomeBlank12Column {
function __construct($assets_url) { function __construct($assets_url) {
$this->assets_url = $assets_url; $this->assets_url = $assets_url;
$this->external_template_image_url = '//ps.w.org/mailpoet/assets/newsletter-templates/welcome-email-blank-1-2-column'; $this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/welcome-email-blank-1-2-column';
$this->template_image_url = $this->assets_url . '/img/blank_templates'; $this->template_image_url = $this->assets_url . '/img/blank_templates';
$this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons'; $this->social_icon_url = $this->assets_url . '/img/newsletter_editor/social-icons';
} }
@ -117,7 +117,7 @@ class WelcomeBlank12Column {
), ),
array( array(
"type" => "text", "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 you a warm welcome!</p>", 'mailpoet') "text" => __("<h1 style=\"text-align: center;\"><strong>Hi, new subscriber!</strong></h1>\n<p>&nbsp;</p>\n<p>[subscriber:firstname | default:Subscriber],</p>\n<p>&nbsp;</p>\n<p>You recently joined our list and we'd like to give you a warm welcome!</p>", 'mailpoet')
), ),
array( array(
"type" => "divider", "type" => "divider",

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