Compare commits
265 Commits
Author | SHA1 | Date | |
---|---|---|---|
a6d802e2fa | |||
1732c4f634 | |||
bb77134224 | |||
f1cb64b240 | |||
3689545589 | |||
9b67c56281 | |||
dc38b19667 | |||
a574733217 | |||
b90aaa629e | |||
8de186c0e6 | |||
e3719967f9 | |||
138a631ed7 | |||
07b7636a72 | |||
a63ce3cdac | |||
f5c7bb87af | |||
2c8d925971 | |||
0c5beb2511 | |||
9c0316a87d | |||
46c1b682fa | |||
7954346a3f | |||
d87ff67f50 | |||
6642bb3bfa | |||
2cb32e7a78 | |||
fcea9adbd9 | |||
bbdd0dbb6e | |||
1b2cf7bd16 | |||
b7cfa549d5 | |||
ffc1d0a61c | |||
d1b160def7 | |||
493fd01754 | |||
9ced4b1757 | |||
17010e5ba9 | |||
42ad7584d4 | |||
dbc0f9b238 | |||
e62e9a5892 | |||
bc25fa61b4 | |||
2590967183 | |||
86eafd3c17 | |||
90a6f160c2 | |||
c774aec6a2 | |||
8f2fd1d76e | |||
4df11163a1 | |||
82a736ffbb | |||
87052986e8 | |||
0c73c0fadc | |||
5c7e11076d | |||
d1df94c759 | |||
53cc39c6f5 | |||
4955c72ee1 | |||
16661af8c3 | |||
bc80f69e41 | |||
0192934e65 | |||
2793e74858 | |||
5996696cc9 | |||
7f6cf5bbf3 | |||
c0ef2254cd | |||
0dbe04c3f8 | |||
ef1805d9b5 | |||
514f539e83 | |||
50f072705e | |||
f8f7bc3d3d | |||
f1bf2bb097 | |||
bbe2f69a7f | |||
c844488b0b | |||
112fe0cd6e | |||
c9e6dce785 | |||
d1c09c015a | |||
8d61866b77 | |||
0831c748b1 | |||
b2a0bc3860 | |||
1f99345e7b | |||
89782bc94b | |||
155ff09280 | |||
132e6d3342 | |||
f02699158f | |||
be3462925d | |||
3d82230d10 | |||
c20c46fd86 | |||
6e63c72aa5 | |||
e059eec5ea | |||
a2d38c9076 | |||
8d507b2ee0 | |||
5e2979c283 | |||
84ec0de3cd | |||
ee07780833 | |||
ed104156a9 | |||
90f2e9ff9d | |||
98fb7aa65e | |||
a51eb59cf8 | |||
270023b89c | |||
7d77e075e9 | |||
9bbe36b3cb | |||
7a904ed093 | |||
e3c065b353 | |||
4ca2872e0e | |||
ce338f7fe2 | |||
fa28b0a955 | |||
a298650187 | |||
95772ef68a | |||
e1c94db516 | |||
7be1a11d1e | |||
c04b95c09a | |||
cdfeb8d512 | |||
3ef8067968 | |||
9fb04bc3c0 | |||
25727ea0ba | |||
4c8ac369b7 | |||
268dabdc9f | |||
c0ba218949 | |||
ee85139089 | |||
b4f83fe1bd | |||
bd83001ef5 | |||
fb3a9f485f | |||
fd44776ae9 | |||
6dbe338b01 | |||
1f06a7dd0b | |||
37c218f782 | |||
25016f2a8d | |||
792744a270 | |||
c5fbfca132 | |||
c2fde308cb | |||
533d9b0d38 | |||
2035b802e3 | |||
a5e66ec6a0 | |||
beb939df9e | |||
44e342c692 | |||
3a417d460f | |||
1950d6661f | |||
da6e154642 | |||
acebf669a7 | |||
4a2bbe3f88 | |||
9b011c0281 | |||
bf58d8a22d | |||
72d1eb79a6 | |||
bb4893c0a0 | |||
9929cf0aee | |||
83967e84ba | |||
9621cb3ca9 | |||
a413f666fe | |||
d1e2c6c074 | |||
3b6a9f7a6e | |||
d2e5fb89c2 | |||
97d1e95037 | |||
48fbce22e7 | |||
916fe76795 | |||
e10310fb5c | |||
367afcf814 | |||
67fa9e0993 | |||
d7553a5f27 | |||
8c847825fa | |||
d21d9b99b0 | |||
8461c13532 | |||
3b7ffe9ba7 | |||
1724fa22c1 | |||
01089d7a72 | |||
717ebfd20c | |||
daff3d5016 | |||
98fb838169 | |||
f13a4dd4f3 | |||
62a164e4c6 | |||
04238f3339 | |||
bc62474f3c | |||
98005a2a6f | |||
b7fe8dc6d6 | |||
436faea591 | |||
4208b148b4 | |||
5ce5f0bf8a | |||
18518de397 | |||
68f747211a | |||
ebd26ddd98 | |||
924aa0439f | |||
3124d6a61b | |||
149d031b52 | |||
fa96c4697d | |||
d46c9d5412 | |||
9ab8b1f0c5 | |||
9425ac1593 | |||
4e32479609 | |||
7d95b38dc4 | |||
17c83c5bd4 | |||
23bb2f111f | |||
4655b2c64c | |||
84fede11b8 | |||
f37488fc0b | |||
20e2e03982 | |||
a5d96f1534 | |||
a516eb1a95 | |||
6dd8270bec | |||
981cbd579f | |||
52a0aae10f | |||
ebca4257a6 | |||
c3944095bc | |||
a1445d1b6a | |||
e62c24879b | |||
00f06ea202 | |||
32ca24ce38 | |||
44e3adb422 | |||
a1346ebecc | |||
25b51d0446 | |||
556a170903 | |||
7ac386a8e2 | |||
d91b55ec52 | |||
786fbc36a2 | |||
160e8b7a12 | |||
0b1f85da09 | |||
fbc6f54ddc | |||
a603e97b8c | |||
0875b627b6 | |||
035784ece0 | |||
aa93c7349f | |||
82cf4a28fd | |||
832e5ef342 | |||
e3de3a123a | |||
db91590159 | |||
28c61fca0b | |||
e62a8c2ec5 | |||
fdbd1245e3 | |||
0eef46db57 | |||
080ae88a04 | |||
225be9f3cd | |||
c9a42ebb76 | |||
ae9b3df92d | |||
63a08ebb55 | |||
2ef5096fa9 | |||
95cfe2d8ec | |||
49676b3fc5 | |||
c96ac06423 | |||
6a3166c311 | |||
0017df1c2d | |||
f2a0d4ce96 | |||
cb50517cbc | |||
0fedd1779f | |||
1625e1771b | |||
bde78b607b | |||
f3c58c27be | |||
9fec460295 | |||
162859529e | |||
3bdaaf8368 | |||
f6ab0050b2 | |||
10a20935c3 | |||
8135b677f7 | |||
90382bc86d | |||
47af8939cc | |||
4a0deb2182 | |||
3a206b2c88 | |||
70cfcbe7cc | |||
6342cb17bd | |||
64c35b12c8 | |||
6a14f97419 | |||
dfec34eda9 | |||
893231e8e5 | |||
e9110680ee | |||
7b54285ca6 | |||
33ea16eb0f | |||
b1ae07d38e | |||
3f168d052f | |||
158d26ef86 | |||
ae03ee2c46 | |||
ad0adb48e1 | |||
ff5353c894 | |||
abb2389378 | |||
3cf50810f9 | |||
20a6e6d6de | |||
0b1fc8f6c3 | |||
0a771acb02 |
5
.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
TODO
|
TODO
|
||||||
composer.phar
|
composer.phar
|
||||||
vendor
|
/vendor
|
||||||
tests/_output/*
|
tests/_output/*
|
||||||
tests/acceptance.suite.yml
|
tests/acceptance.suite.yml
|
||||||
tests/_support/_generated/*
|
tests/_support/_generated/*
|
||||||
@ -15,4 +15,5 @@ temp
|
|||||||
wysija-newsletters.zip
|
wysija-newsletters.zip
|
||||||
tests/javascript/testBundles
|
tests/javascript/testBundles
|
||||||
assets/css/*.css
|
assets/css/*.css
|
||||||
assets/js/*.js
|
assets/js/*.js
|
||||||
|
.vagrant
|
||||||
|
11
README.md
@ -8,7 +8,6 @@ MailPoet done the right way.
|
|||||||
```
|
```
|
||||||
php
|
php
|
||||||
nodejs
|
nodejs
|
||||||
phantomjs
|
|
||||||
wordpress
|
wordpress
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -47,16 +46,6 @@ $ ./do compile:all
|
|||||||
$ ./do test:unit
|
$ ./do test:unit
|
||||||
```
|
```
|
||||||
|
|
||||||
- Acceptance tests:
|
|
||||||
```sh
|
|
||||||
$ ./do test:acceptance
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run all tests:
|
|
||||||
```sh
|
|
||||||
$ ./do test:all
|
|
||||||
```
|
|
||||||
|
|
||||||
- Debug tests:
|
- Debug tests:
|
||||||
```sh
|
```sh
|
||||||
$ ./do test:debug
|
$ ./do test:debug
|
||||||
|
20
RoboFile.php
@ -47,6 +47,19 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function watchCss() {
|
||||||
|
$css_files = $this->rsearch('assets/css/src/', array('styl'));
|
||||||
|
$this->taskWatch()
|
||||||
|
->monitor($css_files, function() {
|
||||||
|
$this->compileCss();
|
||||||
|
})
|
||||||
|
->run();
|
||||||
|
}
|
||||||
|
|
||||||
|
function watchJs() {
|
||||||
|
$this->_exec('./node_modules/webpack/bin/webpack.js --watch');
|
||||||
|
}
|
||||||
|
|
||||||
function compileAll() {
|
function compileAll() {
|
||||||
$this->compileJs();
|
$this->compileJs();
|
||||||
$this->compileCss();
|
$this->compileCss();
|
||||||
@ -61,7 +74,8 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
'assets/css/src/admin.styl',
|
'assets/css/src/admin.styl',
|
||||||
'assets/css/src/newsletter_editor/newsletter_editor.styl',
|
'assets/css/src/newsletter_editor/newsletter_editor.styl',
|
||||||
'assets/css/src/public.styl',
|
'assets/css/src/public.styl',
|
||||||
'assets/css/src/rtl.styl'
|
'assets/css/src/rtl.styl',
|
||||||
|
'assets/css/src/importExport.styl'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->_exec(join(' ', array(
|
$this->_exec(join(' ', array(
|
||||||
@ -91,7 +105,7 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
function testUnit($file = null) {
|
function testUnit($file = null) {
|
||||||
$this->loadEnv();
|
$this->loadEnv();
|
||||||
$this->_exec('vendor/bin/codecept build');
|
$this->_exec('vendor/bin/codecept build');
|
||||||
$this->_exec('vendor/bin/codecept run unit -f '.(($file) ? $file : ''));
|
$this->_exec('vendor/bin/codecept run unit '.(($file) ? $file : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testJavascript() {
|
function testJavascript() {
|
||||||
@ -120,4 +134,4 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
$dotenv = new Dotenv\Dotenv(__DIR__);
|
$dotenv = new Dotenv\Dotenv(__DIR__);
|
||||||
$dotenv->load();
|
$dotenv->load();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,12 +5,15 @@
|
|||||||
@require 'common'
|
@require 'common'
|
||||||
@require 'modal'
|
@require 'modal'
|
||||||
@require 'notice'
|
@require 'notice'
|
||||||
@require 'parsley'
|
|
||||||
|
|
||||||
@require 'form_editor'
|
@require 'form_editor'
|
||||||
@require 'listing'
|
@require 'listing'
|
||||||
@require 'box'
|
@require 'box'
|
||||||
@require 'breadcrumb'
|
@require 'breadcrumb'
|
||||||
@require 'form'
|
|
||||||
|
|
||||||
@require 'settings'
|
@require 'form'
|
||||||
|
@require 'parsley'
|
||||||
|
@require 'form_validation'
|
||||||
|
|
||||||
|
@require 'settings'
|
||||||
|
@require 'progress_bar'
|
||||||
|
@ -19,6 +19,8 @@ a:focus
|
|||||||
|
|
||||||
// select 2
|
// select 2
|
||||||
.select2-container
|
.select2-container
|
||||||
|
width: 25em !important
|
||||||
|
|
||||||
// textareas
|
// textareas
|
||||||
textarea.regular-text
|
textarea.regular-text
|
||||||
width: 25em !important
|
width: 25em !important
|
||||||
@ -26,3 +28,25 @@ textarea.regular-text
|
|||||||
@media screen and (max-width: 782px)
|
@media screen and (max-width: 782px)
|
||||||
.select2-container
|
.select2-container
|
||||||
width: 100% !important
|
width: 100% !important
|
||||||
|
|
||||||
|
// progress bars
|
||||||
|
progress-border-radius = 5px
|
||||||
|
progress-background = #efefef
|
||||||
|
progress-foreground = #69b1e9
|
||||||
|
|
||||||
|
progress
|
||||||
|
background-color: progress-background;
|
||||||
|
height: 2em
|
||||||
|
border: 0
|
||||||
|
width: 100%
|
||||||
|
|
||||||
|
progress::-webkit-progress-bar
|
||||||
|
background-color: progress-background;
|
||||||
|
|
||||||
|
progress::-webkit-progress-value
|
||||||
|
background-color: progress-foreground
|
||||||
|
border-radius: progress-border-radius
|
||||||
|
|
||||||
|
progress::-moz-progress-bar
|
||||||
|
background-color: progress-foreground
|
||||||
|
border-radius: progress-border-radius
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
icons = '../img/form_editor_icons.png'
|
icons = '../img/form_editor_icons.png'
|
||||||
handle_icon = '../img/handle.png'
|
handle_icon = '../img/handle.png'
|
||||||
|
|
||||||
|
#mailpoet_form_name
|
||||||
|
font-size: 23px
|
||||||
|
|
||||||
#mailpoet_form_history
|
#mailpoet_form_history
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
@ -99,6 +102,7 @@ handle_icon = '../img/handle.png'
|
|||||||
/* MailPoet Form wrapper */
|
/* MailPoet Form wrapper */
|
||||||
#mailpoet_form_wrapper
|
#mailpoet_form_wrapper
|
||||||
position: relative
|
position: relative
|
||||||
|
margin: 20px 0 0 0
|
||||||
|
|
||||||
/* MailPoet Form container */
|
/* MailPoet Form container */
|
||||||
#mailpoet_form_container
|
#mailpoet_form_container
|
||||||
|
6
assets/css/src/form_validation.styl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
.parsley-errors-list
|
||||||
|
margin-top: 8px
|
||||||
|
|
||||||
|
.parsley-required
|
||||||
|
.parsley-custom-error-message
|
||||||
|
color: #b94a48
|
78
assets/css/src/importExport.styl
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
.mailpoet_hidden, .mailpoet_validation_error
|
||||||
|
display none
|
||||||
|
|
||||||
|
.form-table
|
||||||
|
th
|
||||||
|
width 300px
|
||||||
|
|
||||||
|
#paste_input
|
||||||
|
width 100%
|
||||||
|
|
||||||
|
input[type="radio"]
|
||||||
|
margin-right 0.5em !important
|
||||||
|
& + span
|
||||||
|
margin-right 2.5em
|
||||||
|
|
||||||
|
span
|
||||||
|
&.mailpoet_mailchimp-key-status
|
||||||
|
&.mailpoet_mailchimp-ok
|
||||||
|
&:before
|
||||||
|
content "\2713"
|
||||||
|
color #0e90d2
|
||||||
|
margin-left 15px
|
||||||
|
&.mailpoet_mailchimp-error
|
||||||
|
&:before
|
||||||
|
content "\2717"
|
||||||
|
color #900
|
||||||
|
margin-left 15px
|
||||||
|
|
||||||
|
#subscribers_data
|
||||||
|
overflow auto
|
||||||
|
table
|
||||||
|
width auto
|
||||||
|
td
|
||||||
|
padding 0.5em
|
||||||
|
& > table
|
||||||
|
& > tbody
|
||||||
|
& > td
|
||||||
|
padding 0.5em
|
||||||
|
& > tr
|
||||||
|
&:nth-child(odd)
|
||||||
|
background #f9f9f9
|
||||||
|
.mailpoet_header
|
||||||
|
text-transform uppercase
|
||||||
|
font-weight 600
|
||||||
|
text-decoration underline
|
||||||
|
|
||||||
|
#subscribers_data th:first-child, #subscribers_data td:first-child
|
||||||
|
width 10em !important
|
||||||
|
text-align center !important
|
||||||
|
padding 0 1em 0 1em !important
|
||||||
|
vertical-align inherit !important
|
||||||
|
|
||||||
|
#subscribers_data
|
||||||
|
& > table
|
||||||
|
& > thead
|
||||||
|
& > tr
|
||||||
|
& > th
|
||||||
|
& > span
|
||||||
|
width 15em !important
|
||||||
|
|
||||||
|
.mailpoet_data_match
|
||||||
|
color #0e90d2
|
||||||
|
margin-left 0.25em
|
||||||
|
|
||||||
|
.mailpoet_import_error, .mailpoet_validation_error
|
||||||
|
color #900
|
||||||
|
|
||||||
|
tr
|
||||||
|
&.mailpoet_segments
|
||||||
|
& > td
|
||||||
|
& > a
|
||||||
|
margin-left 15px
|
||||||
|
|
||||||
|
span
|
||||||
|
&.select2-search
|
||||||
|
&.select2-search--dropdown
|
||||||
|
display none !important
|
||||||
|
|
@ -90,7 +90,7 @@ body.mailpoet_modal_opened
|
|||||||
padding: 0
|
padding: 0
|
||||||
margin: 0
|
margin: 0
|
||||||
width: 100%
|
width: 100%
|
||||||
transition: margin 0.3s ease-out
|
transition: margin 350ms ease-out
|
||||||
|
|
||||||
.mailpoet_panel_wrapper
|
.mailpoet_panel_wrapper
|
||||||
background-color: #f1f1f1
|
background-color: #f1f1f1
|
||||||
@ -159,23 +159,6 @@ body.mailpoet_modal_opened
|
|||||||
margin: 0
|
margin: 0
|
||||||
text-align: right
|
text-align: right
|
||||||
|
|
||||||
.mailpoet_button
|
|
||||||
padding: 3px 15px
|
|
||||||
border: 1px solid #444
|
|
||||||
font-weight: normal
|
|
||||||
cursor: pointer
|
|
||||||
background-color: #222
|
|
||||||
color: #cfcfcf
|
|
||||||
font-size: 1em
|
|
||||||
|
|
||||||
.mailpoet_button:hover
|
|
||||||
background-color: #00aacc
|
|
||||||
color: #fff
|
|
||||||
|
|
||||||
.mailpoet_button:active
|
|
||||||
background-color: #00ccff
|
|
||||||
color: #fff
|
|
||||||
|
|
||||||
@media screen and (max-width: 782px)
|
@media screen and (max-width: 782px)
|
||||||
#mailpoet_modal_overlay.mailpoet_panel_overlay
|
#mailpoet_modal_overlay.mailpoet_panel_overlay
|
||||||
top: 46px
|
top: 46px
|
||||||
@ -217,4 +200,4 @@ body.mailpoet_modal_opened
|
|||||||
0%
|
0%
|
||||||
50%
|
50%
|
||||||
background-color: #064E6D
|
background-color: #064E6D
|
||||||
100%
|
100%
|
||||||
|
@ -7,7 +7,6 @@ $tool-active-secondary-color = #ffffff
|
|||||||
|
|
||||||
$tool-width = 20px
|
$tool-width = 20px
|
||||||
$master-column-tool-width = 24px
|
$master-column-tool-width = 24px
|
||||||
$layer-selector-width = 30px
|
|
||||||
|
|
||||||
.mailpoet_tools
|
.mailpoet_tools
|
||||||
position: absolute
|
position: absolute
|
||||||
@ -33,10 +32,35 @@ $layer-selector-width = 30px
|
|||||||
width: $master-column-tool-width
|
width: $master-column-tool-width
|
||||||
height: $master-column-tool-width
|
height: $master-column-tool-width
|
||||||
|
|
||||||
|
|
||||||
|
.mailpoet_delete_block_activate
|
||||||
|
max-width: 100%
|
||||||
|
max-height: $master-column-tool-width
|
||||||
|
opacity: 1
|
||||||
|
display: block
|
||||||
|
|
||||||
|
.mailpoet_delete_block_confirm,
|
||||||
|
.mailpoet_delete_block_cancel
|
||||||
|
max-width: 100%
|
||||||
|
max-height: 0
|
||||||
|
opacity: 0
|
||||||
|
overflow: hidden
|
||||||
|
display: block
|
||||||
|
|
||||||
.mailpoet_delete_block_activated
|
.mailpoet_delete_block_activated
|
||||||
width: auto
|
width: auto
|
||||||
height: auto
|
height: auto
|
||||||
|
|
||||||
|
.mailpoet_delete_block_activate
|
||||||
|
overflow: hidden
|
||||||
|
max-height: 0
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
.mailpoet_delete_block_confirm,
|
||||||
|
.mailpoet_delete_block_cancel
|
||||||
|
max-height: $master-column-tool-width*2
|
||||||
|
opacity: 1
|
||||||
|
|
||||||
.mailpoet_tool
|
.mailpoet_tool
|
||||||
display: inline-block
|
display: inline-block
|
||||||
width: $tool-width
|
width: $tool-width
|
||||||
@ -76,28 +100,45 @@ $layer-selector-width = 30px
|
|||||||
display: inline-block
|
display: inline-block
|
||||||
padding: 2px
|
padding: 2px
|
||||||
vertical-align: top
|
vertical-align: top
|
||||||
|
animation-background-color()
|
||||||
|
|
||||||
.mailpoet_tool
|
.mailpoet_tool
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
|
.mailpoet_delete_block_activate
|
||||||
|
max-width: $tool-width
|
||||||
|
display: inline-block
|
||||||
|
opacity: 1
|
||||||
|
animation-fade-in-and-scale-horizontally()
|
||||||
|
|
||||||
.mailpoet_delete_block_confirm,
|
.mailpoet_delete_block_confirm,
|
||||||
.mailpoet_delete_block_cancel
|
.mailpoet_delete_block_cancel
|
||||||
display: none
|
max-width: 0
|
||||||
|
opacity: 0
|
||||||
|
overflow: hidden
|
||||||
|
display: inline-block
|
||||||
|
animation-fade-in-and-scale-horizontally()
|
||||||
|
|
||||||
.mailpoet_delete_block_activated
|
.mailpoet_delete_block_activated
|
||||||
|
height: auto
|
||||||
width: auto
|
width: auto
|
||||||
border-radius(3px)
|
border-radius(3px)
|
||||||
background-color: $warning-background-color
|
background-color: $warning-background-color
|
||||||
padding: 3px 5px
|
padding: 3px 5px
|
||||||
line-height: 1.2em
|
line-height: 1.2em
|
||||||
height: auto
|
|
||||||
|
|
||||||
.mailpoet_delete_block_activate
|
.mailpoet_delete_block_activate
|
||||||
display: none
|
overflow: hidden
|
||||||
|
max-width: 0
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
.mailpoet_delete_block_confirm,
|
.mailpoet_delete_block_confirm,
|
||||||
.mailpoet_delete_block_cancel
|
.mailpoet_delete_block_cancel
|
||||||
display: inline-block
|
max-width: 100%
|
||||||
|
opacity: 1
|
||||||
|
|
||||||
|
.mailpoet_delete_block_cancel
|
||||||
|
margin-left: 3px
|
||||||
|
|
||||||
.mailpoet_delete_block_confirm
|
.mailpoet_delete_block_confirm
|
||||||
color: $warning-text-color
|
color: $warning-text-color
|
||||||
|
@ -52,6 +52,7 @@ $draggable-widget-z-index = 2
|
|||||||
padding: 0
|
padding: 0
|
||||||
margin: 0
|
margin: 0
|
||||||
z-index: $draggable-widget-z-index
|
z-index: $draggable-widget-z-index
|
||||||
|
animation-fade-in()
|
||||||
|
|
||||||
.mailpoet_widget_icon
|
.mailpoet_widget_icon
|
||||||
padding: 0
|
padding: 0
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
.mailpoet_save_as_template_container,
|
.mailpoet_save_as_template_container,
|
||||||
.mailpoet_export_template_container
|
.mailpoet_export_template_container
|
||||||
border-radius(3px)
|
border-radius(3px)
|
||||||
float: left
|
display: inline-block
|
||||||
clear: both
|
clear: both
|
||||||
|
|
||||||
margin-top: 5px
|
margin-top: 5px
|
||||||
|
@ -26,13 +26,9 @@ $widget-icon-width = 30px
|
|||||||
border-right: 0
|
border-right: 0
|
||||||
|
|
||||||
&.closed .mailpoet_region_content
|
&.closed .mailpoet_region_content
|
||||||
max-height: 0px
|
display: none
|
||||||
overflow: hidden
|
|
||||||
margin-top: 0
|
|
||||||
|
|
||||||
.mailpoet_region_content
|
.mailpoet_region_content
|
||||||
max-height: 2000px
|
|
||||||
transition: max-height 0.2s ease
|
|
||||||
padding: 0 20px
|
padding: 0 20px
|
||||||
margin-top: 12px
|
margin-top: 12px
|
||||||
|
|
||||||
|
@ -18,3 +18,6 @@
|
|||||||
|
|
||||||
& > .mailpoet_block
|
& > .mailpoet_block
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
|
.mailpoet_automated_latest_content_display_options
|
||||||
|
animation-slide-open-downwards()
|
||||||
|
@ -79,3 +79,4 @@ $three-column-width = ($newsletter-width / 3) - (2 * $column-margin)
|
|||||||
box-shadow(inset 1px 2px 1px $primary-inactive-color)
|
box-shadow(inset 1px 2px 1px $primary-inactive-color)
|
||||||
color: #656565
|
color: #656565
|
||||||
border-radius(3px)
|
border-radius(3px)
|
||||||
|
animation-background-color()
|
||||||
|
@ -19,6 +19,10 @@ $divider-hover-border-color = $primary-active-color
|
|||||||
width: 100%
|
width: 100%
|
||||||
border: 1px solid transparent
|
border: 1px solid transparent
|
||||||
|
|
||||||
|
.mailpoet_active_divider_style
|
||||||
|
border: 1px solid $active-divider-border-color
|
||||||
|
background: $active-divider-background-color
|
||||||
|
|
||||||
.mailpoet_field_divider_style:hover
|
.mailpoet_field_divider_style:hover
|
||||||
border: 1px solid $divider-hover-border-color
|
border: 1px solid $divider-hover-border-color
|
||||||
|
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
.mailpoet_image_block
|
.mailpoet_image_block
|
||||||
|
|
||||||
|
img
|
||||||
|
vertical-align: bottom
|
||||||
|
max-width: 100%
|
||||||
|
width: auto
|
||||||
|
height: auto
|
||||||
|
|
||||||
&.mailpoet_full_image
|
&.mailpoet_full_image
|
||||||
padding-left: 0
|
padding-left: 0
|
||||||
padding-right: 0
|
padding-right: 0
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
|
|
||||||
|
img
|
||||||
|
width: 100%
|
||||||
|
|
||||||
.mailpoet_content a:hover
|
.mailpoet_content a:hover
|
||||||
cursor: all-scroll
|
cursor: all-scroll
|
||||||
|
|
||||||
img
|
|
||||||
vertical-align: bottom
|
|
||||||
max-width: $newsletter-width
|
|
||||||
width: 100%
|
|
||||||
height: auto
|
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
.mailpoet_posts_block
|
.mailpoet_posts_block
|
||||||
box-shadow(none)
|
padding-left: 0
|
||||||
|
padding-right: 0
|
||||||
|
|
||||||
& > .mailpoet_content
|
.mailpoet_posts_block_posts
|
||||||
font-size: 1em
|
overflow: auto
|
||||||
text-align: center
|
|
||||||
background-color: $primary-active-color
|
& > .mailpoet_block
|
||||||
margin: 20px 0
|
width: 100%
|
||||||
padding: 15px
|
|
||||||
box-shadow(inset 1px 2px 1px $primary-inset-shadow-color)
|
|
||||||
color: $white-color
|
|
||||||
border-radius(3px)
|
|
||||||
|
|
||||||
.mailpoet_post_selection_filter_row
|
.mailpoet_post_selection_filter_row
|
||||||
margin-top: 5px
|
margin-top: 5px
|
||||||
@ -18,7 +15,11 @@
|
|||||||
.mailpoet_posts_categories_and_tags
|
.mailpoet_posts_categories_and_tags
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
.mailpoet_settings_posts_show_display_options
|
.mailpoet_settings_posts_display_options
|
||||||
|
.mailpoet_settings_posts_selection
|
||||||
|
animation-slide-open-downwards()
|
||||||
|
|
||||||
|
.mailpoet_settings_posts_show_display_options,
|
||||||
.mailpoet_settings_posts_show_post_selection
|
.mailpoet_settings_posts_show_post_selection
|
||||||
display: block
|
display: block
|
||||||
margin-top: 10px
|
margin-top: 10px
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* Fix select2 z-index to work with MailPoet.Modal */
|
/* Fix select2 z-index to work with MailPoet.Modal */
|
||||||
.select2-dropdown
|
.select2-dropdown
|
||||||
z-index: 101000
|
z-index: 101000 !important
|
||||||
|
|
||||||
/* Remove input field styles from select2 type input */
|
/* Remove input field styles from select2 type input */
|
||||||
.select2-container
|
.select2-container
|
||||||
@ -129,3 +129,7 @@ body
|
|||||||
|
|
||||||
#mailpoet_modal_close
|
#mailpoet_modal_close
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
.wrap > .mailpoet_notice,
|
||||||
|
.update-nag
|
||||||
|
margin-left: 2px + 15px !important
|
||||||
|
31
assets/css/src/newsletter_editor/mixins/transitions.styl
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
animation-slide-open-downwards()
|
||||||
|
transition: all 250ms cubic-bezier(0.420, 0.000, 0.580, 1.000) /* ease-in-out */
|
||||||
|
max-height: 2000px
|
||||||
|
opacity: 1
|
||||||
|
|
||||||
|
&.mailpoet_closed
|
||||||
|
max-height: 0
|
||||||
|
opacity: 0
|
||||||
|
overflow-y: hidden
|
||||||
|
|
||||||
|
animation-background-color()
|
||||||
|
transition: background 250ms cubic-bezier(0.420, 0.000, 0.580, 1.000) /* ease-in-out */
|
||||||
|
|
||||||
|
animation-fade-in()
|
||||||
|
animation-name: fadeIn
|
||||||
|
animation-duration: 300ms
|
||||||
|
animation-fill-mode: forwards
|
||||||
|
animation-timing-function: ease-in
|
||||||
|
|
||||||
|
animation-fade-in-and-scale-horizontally()
|
||||||
|
transition: all 250ms cubic-bezier(0.420, 0.000, 0.580, 1.000) /* ease-in-out */
|
||||||
|
|
||||||
|
@keyframes fadeIn {
|
||||||
|
0% {
|
||||||
|
opacity: 0.3
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@
|
|||||||
@require 'mixins/border-radius'
|
@require 'mixins/border-radius'
|
||||||
@require 'mixins/box-shadow'
|
@require 'mixins/box-shadow'
|
||||||
@require 'mixins/filter-shadow'
|
@require 'mixins/filter-shadow'
|
||||||
|
@require 'mixins/transitions'
|
||||||
|
|
||||||
@require 'variables'
|
@require 'variables'
|
||||||
@require 'common'
|
@require 'common'
|
||||||
|
29
assets/css/src/progress_bar.styl
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
.mailpoet_progress
|
||||||
|
background-color: #efefef
|
||||||
|
height: 25px
|
||||||
|
padding: 0
|
||||||
|
width: 100%
|
||||||
|
margin: 0
|
||||||
|
border-radius: 5px
|
||||||
|
position: relative
|
||||||
|
|
||||||
|
.mailpoet_progress_label
|
||||||
|
position: absolute
|
||||||
|
width: 100%
|
||||||
|
text-align: center
|
||||||
|
display: inline-block
|
||||||
|
margin: 2px 0 0 0
|
||||||
|
|
||||||
|
.mailpoet_progress_bar
|
||||||
|
position: absolute
|
||||||
|
display: inline-block
|
||||||
|
height: 100%
|
||||||
|
border-radius: 3px
|
||||||
|
box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset
|
||||||
|
background-color: #34c2e3
|
||||||
|
background-image: linear-gradient(top, #34c2e3, darken(#34c2e3, 20%))
|
||||||
|
|
||||||
|
.mailpoet_progress_complete
|
||||||
|
.mailpoet_progress_bar
|
||||||
|
background-color: #fecf23
|
||||||
|
background-image: linear-gradient(top, #fecf23, #fd9215)
|
@ -1,3 +1,4 @@
|
|||||||
@import 'nib'
|
@import 'nib'
|
||||||
|
|
||||||
@require 'parsley'
|
@require 'parsley'
|
||||||
|
@require 'form_validation'
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
assets/img/post_notifications_template/ALC-widget-icon.png
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
assets/img/post_notifications_template/settings-icon-highlight.png
Executable file
After Width: | Height: | Size: 7.2 KiB |
12
assets/img/preview_magnifying_glass.svg
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
width="47.002px" height="38.003px" viewBox="0 0 47.002 38.003" enable-background="new 0 0 47.002 38.003" xml:space="preserve">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" fill="#565656" d="M46.328,36.365c-1.188,1.725-3.553,2.158-5.273,0.962L25.479,26.52
|
||||||
|
c-1.104-0.763-1.674-2.007-1.631-3.257c-2.006,2.157-4.642,3.606-7.594,4.145c-3.626,0.663-7.288-0.13-10.311-2.227
|
||||||
|
c-3.024-2.098-5.054-5.253-5.714-8.887c-0.661-3.636,0.127-7.31,2.221-10.344c4.325-6.264,12.927-7.834,19.177-3.5
|
||||||
|
c5.672,3.938,7.486,11.412,4.537,17.443c1.152-0.486,2.519-0.392,3.627,0.377l15.58,10.808C47.09,32.274,47.52,34.641,46.328,36.365
|
||||||
|
z M23.235,12.09c-0.459-2.534-1.874-4.734-3.982-6.196C14.897,2.87,8.896,3.963,5.878,8.331c-3.014,4.373-1.922,10.388,2.435,13.408
|
||||||
|
c4.356,3.025,10.356,1.932,13.374-2.438C23.146,17.187,23.696,14.625,23.235,12.09z"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
BIN
assets/img/sample_template/coffee-grain.jpg
Normal file
After Width: | Height: | Size: 178 KiB |
BIN
assets/img/sample_template/header-v2.jpg
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
assets/img/sample_template/map-v2.jpg
Normal file
After Width: | Height: | Size: 130 KiB |
BIN
assets/img/sample_template/sandwich.jpg
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
assets/img/welcome_template/logo-header.gif
Executable file
After Width: | Height: | Size: 4.8 KiB |
8
assets/js/lib/analytics.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
|
||||||
|
for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f)}})(document,window.mixpanel||[]);
|
||||||
|
|
||||||
|
mixpanel.init("f683d388fb25fcf331f1b2b5c4449798");
|
||||||
|
|
||||||
|
if (typeof mailpoet_analytics_data === 'object') {
|
||||||
|
mixpanel.track('Wysija Usage', mailpoet_analytics_data || {});
|
||||||
|
}
|
106
assets/js/src/cron.jsx
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
define(
|
||||||
|
[
|
||||||
|
'react',
|
||||||
|
'react-dom',
|
||||||
|
'mailpoet'
|
||||||
|
],
|
||||||
|
function(
|
||||||
|
React,
|
||||||
|
ReactDOM,
|
||||||
|
MailPoet
|
||||||
|
) {
|
||||||
|
var CronControl = React.createClass({
|
||||||
|
getInitialState: function() {
|
||||||
|
return {
|
||||||
|
status: 'loading'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getCronData: function() {
|
||||||
|
MailPoet.Ajax.post({
|
||||||
|
endpoint: 'cron',
|
||||||
|
action: 'getStatus'
|
||||||
|
})
|
||||||
|
.done(function(response) {
|
||||||
|
jQuery('.button-primary')
|
||||||
|
.removeClass('disabled');
|
||||||
|
if(response.status !== undefined) {
|
||||||
|
this.setState(response);
|
||||||
|
} else {
|
||||||
|
this.replaceState();
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
componentDidMount: function() {
|
||||||
|
if(this.isMounted()) {
|
||||||
|
this.getCronData();
|
||||||
|
setInterval(this.getCronData, 5000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
controlCron: function(action) {
|
||||||
|
if(jQuery('.button-primary').hasClass('disabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
jQuery('.button-primary')
|
||||||
|
.addClass('disabled');
|
||||||
|
MailPoet.Ajax.post({
|
||||||
|
endpoint: 'cron',
|
||||||
|
action: action,
|
||||||
|
})
|
||||||
|
.done(function(response) {
|
||||||
|
if(!response.result) {
|
||||||
|
MailPoet.Notice.error(MailPoetI18n.daemonControlError);
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
render: function() {
|
||||||
|
if(this.state.status === 'loading') {
|
||||||
|
return(<div>Loading daemon status...</div>);
|
||||||
|
}
|
||||||
|
switch(this.state.status) {
|
||||||
|
case 'started':
|
||||||
|
return(
|
||||||
|
<div>
|
||||||
|
Cron daemon is running.
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
It was started
|
||||||
|
<strong> {this.state.timeSinceStart} </strong> and last executed
|
||||||
|
<strong> {this.state.timeSinceUpdate} </strong> for a total of
|
||||||
|
<strong> {this.state.counter} </strong> times (once every 30 seconds, unless it was interrupted and restarted).
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<a href="#" className="button-primary" onClick={this.controlCron.bind(null, 'stop')}>Stop</a>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'starting':
|
||||||
|
case 'stopping':
|
||||||
|
return(
|
||||||
|
<div>
|
||||||
|
Daemon is {this.state.status}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'stopped':
|
||||||
|
return(
|
||||||
|
<div>
|
||||||
|
Daemon is {this.state.status}
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<a href="#" className="button-primary" onClick={this.controlCron.bind(null, 'start')}>Start</a>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const container = document.getElementById('cron_container');
|
||||||
|
|
||||||
|
if(container) {
|
||||||
|
ReactDOM.render(
|
||||||
|
<CronControl />,
|
||||||
|
container
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
@ -23,7 +23,9 @@ function(
|
|||||||
name={ this.props.field.name }
|
name={ this.props.field.name }
|
||||||
id={ 'field_'+this.props.field.name }
|
id={ 'field_'+this.props.field.name }
|
||||||
value={ this.props.item[this.props.field.name] }
|
value={ this.props.item[this.props.field.name] }
|
||||||
onChange={ this.props.onValueChange }>
|
onChange={ this.props.onValueChange }
|
||||||
|
{...this.props.field.validation}
|
||||||
|
>
|
||||||
{options}
|
{options}
|
||||||
</select>
|
</select>
|
||||||
);
|
);
|
||||||
|
@ -20,8 +20,15 @@ function(
|
|||||||
this.loadCachedItems();
|
this.loadCachedItems();
|
||||||
this.setupSelect2();
|
this.setupSelect2();
|
||||||
},
|
},
|
||||||
componentDidUpdate: function() {
|
componentDidUpdate: function(prevProps, prevState) {
|
||||||
this.setupSelect2();
|
if(
|
||||||
|
(this.props.item !== undefined && prevProps.item !== undefined)
|
||||||
|
&& (this.props.item.id !== prevProps.item.id)
|
||||||
|
) {
|
||||||
|
jQuery('#'+this.refs.select.id)
|
||||||
|
.val(this.props.item[this.props.field.name])
|
||||||
|
.trigger('change');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setupSelect2: function() {
|
setupSelect2: function() {
|
||||||
if(
|
if(
|
||||||
@ -43,7 +50,19 @@ function(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var hasRemoved = false;
|
||||||
|
select2.on('select2:unselecting', function(e) {
|
||||||
|
hasRemoved = true;
|
||||||
|
});
|
||||||
|
select2.on('select2:opening', function(e) {
|
||||||
|
if(hasRemoved === true) {
|
||||||
|
hasRemoved = false;
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
select2.on('change', this.handleChange);
|
select2.on('change', this.handleChange);
|
||||||
|
|
||||||
select2.select2(
|
select2.select2(
|
||||||
'val',
|
'val',
|
||||||
this.props.item[this.props.field.name]
|
this.props.item[this.props.field.name]
|
||||||
@ -54,6 +73,11 @@ function(
|
|||||||
loadCachedItems: function() {
|
loadCachedItems: function() {
|
||||||
if(typeof(window['mailpoet_'+this.props.field.endpoint]) !== 'undefined') {
|
if(typeof(window['mailpoet_'+this.props.field.endpoint]) !== 'undefined') {
|
||||||
var items = window['mailpoet_'+this.props.field.endpoint];
|
var items = window['mailpoet_'+this.props.field.endpoint];
|
||||||
|
|
||||||
|
if(this.props.field['filter'] !== undefined) {
|
||||||
|
items = items.filter(this.props.field.filter);
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
items: items
|
items: items
|
||||||
});
|
});
|
||||||
@ -62,7 +86,7 @@ function(
|
|||||||
handleChange: function(e) {
|
handleChange: function(e) {
|
||||||
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).select2('val');
|
value = jQuery('#'+this.refs.select.id).val();
|
||||||
} else {
|
} else {
|
||||||
value = e.target.value;
|
value = e.target.value;
|
||||||
}
|
}
|
||||||
@ -73,40 +97,35 @@ function(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
if(this.state.items.length === 0) {
|
var options = this.state.items.map(function(item, index) {
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
var options = this.state.items.map(function(item, index) {
|
|
||||||
return (
|
|
||||||
<option
|
|
||||||
key={ item.id }
|
|
||||||
value={ item.id }
|
|
||||||
>
|
|
||||||
{ item.name }
|
|
||||||
</option>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
var default_value = (
|
|
||||||
(this.props.item !== undefined && this.props.field.name !== undefined)
|
|
||||||
? this.props.item[this.props.field.name]
|
|
||||||
: null
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<select
|
<option
|
||||||
id={ this.props.field.id || this.props.field.name }
|
key={ item.id }
|
||||||
ref="select"
|
value={ item.id }
|
||||||
placeholder={ this.props.field.placeholder }
|
>
|
||||||
multiple={ this.props.field.multiple }
|
{ item.name }
|
||||||
onChange={ this.handleChange }
|
</option>
|
||||||
defaultValue={ default_value }
|
|
||||||
>{ options }</select>
|
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
|
||||||
|
var default_value = (
|
||||||
|
(this.props.item !== undefined && this.props.field.name !== undefined)
|
||||||
|
? this.props.item[this.props.field.name]
|
||||||
|
: null
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<select
|
||||||
|
id={ this.props.field.id || this.props.field.name }
|
||||||
|
ref="select"
|
||||||
|
placeholder={ this.props.field.placeholder }
|
||||||
|
multiple={ this.props.field.multiple }
|
||||||
|
defaultValue={ default_value }
|
||||||
|
{...this.props.field.validation}
|
||||||
|
>{ options }</select>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ function(
|
|||||||
) {
|
) {
|
||||||
var FormFieldText = React.createClass({
|
var FormFieldText = React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
|
var value = this.props.item[this.props.field.name];
|
||||||
|
if(!value) { value = null; }
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@ -17,10 +19,12 @@ function(
|
|||||||
}
|
}
|
||||||
name={ this.props.field.name }
|
name={ this.props.field.name }
|
||||||
id={ 'field_'+this.props.field.name }
|
id={ 'field_'+this.props.field.name }
|
||||||
value={ this.props.item[this.props.field.name] }
|
value={ value }
|
||||||
placeholder={ this.props.field.placeholder }
|
placeholder={ this.props.field.placeholder }
|
||||||
defaultValue={ this.props.field.defaultValue }
|
defaultValue={ this.props.field.defaultValue }
|
||||||
onChange={ this.props.onValueChange } />
|
onChange={ this.props.onValueChange }
|
||||||
|
{...this.props.field.validation}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,9 @@ function(
|
|||||||
value={ this.props.item[this.props.field.name] }
|
value={ this.props.item[this.props.field.name] }
|
||||||
placeholder={ this.props.field.placeholder }
|
placeholder={ this.props.field.placeholder }
|
||||||
defaultValue={ this.props.field.defaultValue }
|
defaultValue={ this.props.field.defaultValue }
|
||||||
onChange={ this.props.onValueChange } />
|
onChange={ this.props.onValueChange }
|
||||||
|
{...this.props.field.validation}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -68,12 +68,25 @@ define(
|
|||||||
handleSubmit: function(e) {
|
handleSubmit: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
// handle validation
|
||||||
|
if(this.props.isValid !== undefined) {
|
||||||
|
if(this.props.isValid() === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
|
|
||||||
// only get values from displayed fields
|
// only get values from displayed fields
|
||||||
item = {};
|
var item = {};
|
||||||
this.props.fields.map(function(field) {
|
this.props.fields.map(function(field) {
|
||||||
item[field.name] = this.state.item[field.name];
|
if(field['fields'] !== undefined) {
|
||||||
|
field.fields.map(function(subfield) {
|
||||||
|
item[subfield.name] = this.state.item[subfield.name];
|
||||||
|
}.bind(this));
|
||||||
|
} else {
|
||||||
|
item[field.name] = this.state.item[field.name];
|
||||||
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
// set id if specified
|
// set id if specified
|
||||||
@ -88,23 +101,23 @@ define(
|
|||||||
}).done(function(response) {
|
}).done(function(response) {
|
||||||
this.setState({ loading: false });
|
this.setState({ loading: false });
|
||||||
|
|
||||||
if(response === true) {
|
if(response.result === true) {
|
||||||
if(this.props.onSuccess !== undefined) {
|
if(this.props.onSuccess !== undefined) {
|
||||||
this.props.onSuccess()
|
this.props.onSuccess();
|
||||||
} else {
|
} else {
|
||||||
this.history.pushState(null, '/')
|
this.history.pushState(null, '/')
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.props.params.id !== undefined) {
|
if(this.props.params.id !== undefined) {
|
||||||
this.props.messages['updated']();
|
this.props.messages.onUpdate();
|
||||||
} else {
|
} else {
|
||||||
this.props.messages['created']();
|
this.props.messages.onCreate();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(response === false) {
|
if(response.result === false) {
|
||||||
// unknown error occurred
|
if(response.errors.length > 0) {
|
||||||
} else {
|
this.setState({ errors: response.errors });
|
||||||
this.setState({ errors: response });
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
@ -121,13 +134,15 @@ define(
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var errors = this.state.errors.map(function(error, index) {
|
if(this.state.errors !== undefined) {
|
||||||
return (
|
var errors = this.state.errors.map(function(error, index) {
|
||||||
<p key={ 'error-'+index } className="mailpoet_error">
|
return (
|
||||||
{ error }
|
<p key={ 'error-'+index } className="mailpoet_error">
|
||||||
</p>
|
{ error }
|
||||||
);
|
</p>
|
||||||
});
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var formClasses = classNames(
|
var formClasses = classNames(
|
||||||
'mailpoet_form',
|
'mailpoet_form',
|
||||||
|
@ -231,7 +231,7 @@ var WysijaHistory = {
|
|||||||
|
|
||||||
/* MailPoet Form */
|
/* MailPoet Form */
|
||||||
var WysijaForm = {
|
var WysijaForm = {
|
||||||
version: '0.6',
|
version: '0.7',
|
||||||
options: {
|
options: {
|
||||||
container: 'mailpoet_form_container',
|
container: 'mailpoet_form_container',
|
||||||
editor: 'mailpoet_form_editor',
|
editor: 'mailpoet_form_editor',
|
||||||
@ -317,6 +317,7 @@ var WysijaForm = {
|
|||||||
save: function() {
|
save: function() {
|
||||||
var position = 1,
|
var position = 1,
|
||||||
data = {
|
data = {
|
||||||
|
'name': $F('mailpoet_form_name'),
|
||||||
'settings': $('mailpoet_form_settings').serialize(true),
|
'settings': $('mailpoet_form_settings').serialize(true),
|
||||||
'body': [],
|
'body': [],
|
||||||
'styles': (MailPoet.CodeEditor !== undefined) ? MailPoet.CodeEditor.getValue() : null
|
'styles': (MailPoet.CodeEditor !== undefined) ? MailPoet.CodeEditor.getValue() : null
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import ReactDOM from 'react-dom'
|
|
||||||
import { Router, History } from 'react-router'
|
|
||||||
import MailPoet from 'mailpoet'
|
|
||||||
import Form from 'form/form.jsx'
|
|
||||||
|
|
||||||
const fields = [
|
|
||||||
{
|
|
||||||
name: 'name',
|
|
||||||
label: 'Name',
|
|
||||||
type: 'text'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'segments',
|
|
||||||
label: 'Lists',
|
|
||||||
type: 'selection',
|
|
||||||
endpoint: 'segments',
|
|
||||||
multiple: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const messages = {
|
|
||||||
updated: function() {
|
|
||||||
MailPoet.Notice.success('Form successfully updated!');
|
|
||||||
},
|
|
||||||
created: function() {
|
|
||||||
MailPoet.Notice.success('Form successfully added!');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const FormForm = React.createClass({
|
|
||||||
mixins: [
|
|
||||||
History
|
|
||||||
],
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<h2 className="title">
|
|
||||||
Form <a
|
|
||||||
href="javascript:;"
|
|
||||||
className="add-new-h2"
|
|
||||||
onClick={ this.history.goBack }
|
|
||||||
>Back to list</a>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<Form
|
|
||||||
endpoint="forms"
|
|
||||||
fields={ fields }
|
|
||||||
params={ this.props.params }
|
|
||||||
messages={ messages }
|
|
||||||
onSuccess={ this.history.goBack } />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = FormForm
|
|
@ -2,7 +2,6 @@ import React from 'react'
|
|||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import { Router, Route, IndexRoute } from 'react-router'
|
import { Router, Route, IndexRoute } from 'react-router'
|
||||||
import FormList from 'forms/list.jsx'
|
import FormList from 'forms/list.jsx'
|
||||||
import FormForm from 'forms/form.jsx'
|
|
||||||
import createHashHistory from 'history/lib/createHashHistory'
|
import createHashHistory from 'history/lib/createHashHistory'
|
||||||
|
|
||||||
let history = createHashHistory({ queryKey: false })
|
let history = createHashHistory({ queryKey: false })
|
||||||
@ -20,8 +19,6 @@ if(container) {
|
|||||||
<Router history={ history }>
|
<Router history={ history }>
|
||||||
<Route path="/" component={ App }>
|
<Route path="/" component={ App }>
|
||||||
<IndexRoute component={ FormList } />
|
<IndexRoute component={ FormList } />
|
||||||
<Route path="new" component={ FormForm } />
|
|
||||||
<Route path="edit/:id" component={ FormForm } />
|
|
||||||
<Route path="*" component={ FormList } />
|
<Route path="*" component={ FormList } />
|
||||||
</Route>
|
</Route>
|
||||||
</Router>
|
</Router>
|
||||||
|
@ -105,6 +105,9 @@ const item_actions = [
|
|||||||
refresh();
|
refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'trash'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
3
assets/js/src/helpscout.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
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:!1,baseUrl:""},contact:{enabled:!0,formId:"e5c408c7-895e-11e5-9e75-0a7d6919297d"}};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||{});
|
||||||
|
});
|
@ -15,16 +15,16 @@ function(
|
|||||||
this.setState({
|
this.setState({
|
||||||
action: e.target.value,
|
action: e.target.value,
|
||||||
extra: false
|
extra: false
|
||||||
});
|
}, function() {
|
||||||
|
var action = this.getSelectedAction();
|
||||||
|
|
||||||
var action = this.getSelectedAction();
|
// action on select callback
|
||||||
|
if(action !== null && action['onSelect'] !== undefined) {
|
||||||
// action on select callback
|
this.setState({
|
||||||
if(action !== null && action['onSelect'] !== undefined) {
|
extra: action.onSelect(e)
|
||||||
this.setState({
|
});
|
||||||
extra: action.onSelect(e)
|
}
|
||||||
});
|
}.bind(this));
|
||||||
}
|
|
||||||
},
|
},
|
||||||
handleApplyAction: function(e) {
|
handleApplyAction: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -85,7 +85,12 @@ function(
|
|||||||
Select bulk action
|
Select bulk action
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<select ref="action" value={ this.state.action } onChange={this.handleChangeAction}>
|
<select
|
||||||
|
name="bulk_actions"
|
||||||
|
ref="action"
|
||||||
|
value={ this.state.action }
|
||||||
|
onChange={this.handleChangeAction}
|
||||||
|
>
|
||||||
<option value="">Bulk Actions</option>
|
<option value="">Bulk Actions</option>
|
||||||
{ this.props.bulk_actions.map(function(action, index) {
|
{ this.props.bulk_actions.map(function(action, index) {
|
||||||
return (
|
return (
|
||||||
|
@ -11,7 +11,7 @@ define(['react', 'classnames'], function(React, classNames) {
|
|||||||
column.is_primary = (index === 0);
|
column.is_primary = (index === 0);
|
||||||
column.sorted = (this.props.sort_by === column.name)
|
column.sorted = (this.props.sort_by === column.name)
|
||||||
? this.props.sort_order
|
? this.props.sort_order
|
||||||
: 'asc';
|
: 'desc';
|
||||||
return (
|
return (
|
||||||
<ListingColumn
|
<ListingColumn
|
||||||
onSort={this.props.onSort}
|
onSort={this.props.onSort}
|
||||||
@ -32,6 +32,7 @@ define(['react', 'classnames'], function(React, classNames) {
|
|||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
name="select_all"
|
||||||
ref="toggle"
|
ref="toggle"
|
||||||
checked={ this.props.selection }
|
checked={ this.props.selection }
|
||||||
onChange={ this.handleSelectItems } />
|
onChange={ this.handleSelectItems } />
|
||||||
|
@ -79,27 +79,48 @@ define(
|
|||||||
|
|
||||||
if(custom_actions.length > 0) {
|
if(custom_actions.length > 0) {
|
||||||
item_actions = custom_actions.map(function(action, index) {
|
item_actions = custom_actions.map(function(action, index) {
|
||||||
if(action.refresh) {
|
if(action.display !== undefined) {
|
||||||
|
if(action.display(this.props.item) === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(action.name === 'trash') {
|
||||||
|
return (
|
||||||
|
<span key={ 'action-'+index } className="trash">
|
||||||
|
{(index > 0) ? ' | ' : ''}
|
||||||
|
<a
|
||||||
|
href="javascript:;"
|
||||||
|
onClick={ this.handleTrashItem.bind(
|
||||||
|
null,
|
||||||
|
this.props.item.id
|
||||||
|
) }>
|
||||||
|
Trash
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
} else if(action.refresh) {
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
onClick={ this.props.onRefreshItems }
|
onClick={ this.props.onRefreshItems }
|
||||||
key={ 'action-'+index } className={ action.name }>
|
key={ 'action-'+index } className={ action.name }>
|
||||||
|
{(index > 0) ? ' | ' : ''}
|
||||||
{ action.link(this.props.item) }
|
{ action.link(this.props.item) }
|
||||||
{(index < (custom_actions.length - 1)) ? ' | ' : ''}
|
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else if(action.link) {
|
} else if(action.link) {
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
key={ 'action-'+index } className={ action.name }>
|
key={ 'action-'+index } className={ action.name }>
|
||||||
|
{(index > 0) ? ' | ' : ''}
|
||||||
{ action.link(this.props.item) }
|
{ action.link(this.props.item) }
|
||||||
{(index < (custom_actions.length - 1)) ? ' | ' : ''}
|
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
key={ 'action-'+index } className={ action.name }>
|
key={ 'action-'+index } className={ action.name }>
|
||||||
|
{(index > 0) ? ' | ' : ''}
|
||||||
<a href="javascript:;" onClick={
|
<a href="javascript:;" onClick={
|
||||||
(action.onClick !== undefined)
|
(action.onClick !== undefined)
|
||||||
? action.onClick.bind(null,
|
? action.onClick.bind(null,
|
||||||
@ -108,7 +129,6 @@ define(
|
|||||||
)
|
)
|
||||||
: false
|
: false
|
||||||
}>{ action.label }</a>
|
}>{ action.label }</a>
|
||||||
{(index < (custom_actions.length - 1)) ? ' | ' : ''}
|
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -158,17 +178,6 @@ define(
|
|||||||
<div>
|
<div>
|
||||||
<div className="row-actions">
|
<div className="row-actions">
|
||||||
{ item_actions }
|
{ item_actions }
|
||||||
{ ' | ' }
|
|
||||||
<span className="trash">
|
|
||||||
<a
|
|
||||||
href="javascript:;"
|
|
||||||
onClick={ this.handleTrashItem.bind(
|
|
||||||
null,
|
|
||||||
this.props.item.id
|
|
||||||
) }>
|
|
||||||
Trash
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={ this.handleToggleItem.bind(null, this.props.item.id) }
|
onClick={ this.handleToggleItem.bind(null, this.props.item.id) }
|
||||||
@ -388,6 +397,12 @@ define(
|
|||||||
if(this.isMounted()) {
|
if(this.isMounted()) {
|
||||||
const params = this.props.params || {}
|
const params = this.props.params || {}
|
||||||
this.initWithParams(params)
|
this.initWithParams(params)
|
||||||
|
|
||||||
|
if(this.props.auto_refresh) {
|
||||||
|
jQuery(document).on('heartbeat-tick.mailpoet', function(e, data) {
|
||||||
|
this.getItems();
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
componentWillReceiveProps: function(nextProps) {
|
componentWillReceiveProps: function(nextProps) {
|
||||||
@ -419,7 +434,13 @@ define(
|
|||||||
groups: response.groups || [],
|
groups: response.groups || [],
|
||||||
count: response.count || 0,
|
count: response.count || 0,
|
||||||
loading: false
|
loading: false
|
||||||
});
|
}, function() {
|
||||||
|
if(this.props['onGetItems'] !== undefined) {
|
||||||
|
this.props.onGetItems(
|
||||||
|
~~(this.state.groups[0]['count'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -631,7 +652,7 @@ define(
|
|||||||
// bulk actions
|
// bulk actions
|
||||||
var bulk_actions = this.props.bulk_actions || [];
|
var bulk_actions = this.props.bulk_actions || [];
|
||||||
|
|
||||||
if(this.state.group === 'trash') {
|
if(this.state.group === 'trash' && bulk_actions.length > 0) {
|
||||||
bulk_actions = [
|
bulk_actions = [
|
||||||
{
|
{
|
||||||
name: 'restore',
|
name: 'restore',
|
||||||
|
@ -47,7 +47,6 @@ define([
|
|||||||
autoScroll: true,
|
autoScroll: true,
|
||||||
|
|
||||||
onstart: function(event) {
|
onstart: function(event) {
|
||||||
console.log('Drag start', event, this);
|
|
||||||
|
|
||||||
if (that.options.cloneOriginal === true) {
|
if (that.options.cloneOriginal === true) {
|
||||||
// Use substitution instead of a clone
|
// Use substitution instead of a clone
|
||||||
|
@ -11,10 +11,10 @@ define([
|
|||||||
'newsletter_editor/blocks/base',
|
'newsletter_editor/blocks/base',
|
||||||
'newsletter_editor/blocks/button',
|
'newsletter_editor/blocks/button',
|
||||||
'newsletter_editor/blocks/divider',
|
'newsletter_editor/blocks/divider',
|
||||||
'newsletter_editor/components/wordpress',
|
'newsletter_editor/components/communication',
|
||||||
'underscore',
|
'underscore',
|
||||||
'jquery'
|
'jquery'
|
||||||
], function(App, BaseBlock, ButtonBlock, DividerBlock, WordpressComponent, _, jQuery) {
|
], function(App, BaseBlock, ButtonBlock, DividerBlock, CommunicationComponent, _, jQuery) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -69,9 +69,9 @@ define([
|
|||||||
},
|
},
|
||||||
fetchPosts: function() {
|
fetchPosts: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
WordpressComponent.getTransformedPosts(this.toJSON()).done(function(content) {
|
CommunicationComponent.getTransformedPosts(this.toJSON()).done(function(content) {
|
||||||
console.log('ALC fetched', arguments);
|
|
||||||
that.get('_container').get('blocks').reset(content, {parse: true});
|
that.get('_container').get('blocks').reset(content, {parse: true});
|
||||||
|
that.trigger('postsChanged');
|
||||||
}).fail(function(error) {
|
}).fail(function(error) {
|
||||||
console.log('ALC fetchPosts error', arguments);
|
console.log('ALC fetchPosts error', arguments);
|
||||||
});
|
});
|
||||||
@ -100,6 +100,11 @@ define([
|
|||||||
toolsRegion: '.mailpoet_tools',
|
toolsRegion: '.mailpoet_tools',
|
||||||
postsRegion: '.mailpoet_automated_latest_content_block_posts',
|
postsRegion: '.mailpoet_automated_latest_content_block_posts',
|
||||||
},
|
},
|
||||||
|
modelEvents: _.extend(
|
||||||
|
_.omit(base.BlockView.prototype.modelEvents, 'change'),
|
||||||
|
{
|
||||||
|
'postsChanged': 'render',
|
||||||
|
}),
|
||||||
events: _.extend(base.BlockView.prototype.events, {
|
events: _.extend(base.BlockView.prototype.events, {
|
||||||
'click .mailpoet_automated_latest_content_block_overlay': 'showSettings',
|
'click .mailpoet_automated_latest_content_block_overlay': 'showSettings',
|
||||||
}),
|
}),
|
||||||
@ -161,7 +166,7 @@ define([
|
|||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
// Dynamically update available post types
|
// Dynamically update available post types
|
||||||
WordpressComponent.getPostTypes().done(_.bind(this._updateContentTypes, this));
|
CommunicationComponent.getPostTypes().done(_.bind(this._updateContentTypes, this));
|
||||||
|
|
||||||
this.$('.mailpoet_automated_latest_content_categories_and_tags').select2({
|
this.$('.mailpoet_automated_latest_content_categories_and_tags').select2({
|
||||||
multiple: true,
|
multiple: true,
|
||||||
@ -174,10 +179,10 @@ define([
|
|||||||
},
|
},
|
||||||
transport: function(options, success, failure) {
|
transport: function(options, success, failure) {
|
||||||
var taxonomies,
|
var taxonomies,
|
||||||
promise = WordpressComponent.getTaxonomies(that.model.get('contentType')).then(function(tax) {
|
promise = CommunicationComponent.getTaxonomies(that.model.get('contentType')).then(function(tax) {
|
||||||
taxonomies = tax;
|
taxonomies = tax;
|
||||||
// Fetch available terms based on the list of taxonomies already fetched
|
// Fetch available terms based on the list of taxonomies already fetched
|
||||||
var promise = WordpressComponent.getTerms({
|
var promise = CommunicationComponent.getTerms({
|
||||||
search: options.data.term,
|
search: options.data.term,
|
||||||
taxonomies: _.keys(taxonomies)
|
taxonomies: _.keys(taxonomies)
|
||||||
}).then(function(terms) {
|
}).then(function(terms) {
|
||||||
@ -226,11 +231,11 @@ define([
|
|||||||
toggleDisplayOptions: function(event) {
|
toggleDisplayOptions: function(event) {
|
||||||
var el = this.$('.mailpoet_automated_latest_content_display_options'),
|
var el = this.$('.mailpoet_automated_latest_content_display_options'),
|
||||||
showControl = this.$('.mailpoet_automated_latest_content_show_display_options');
|
showControl = this.$('.mailpoet_automated_latest_content_show_display_options');
|
||||||
if (el.hasClass('mailpoet_hidden')) {
|
if (el.hasClass('mailpoet_closed')) {
|
||||||
el.removeClass('mailpoet_hidden');
|
el.removeClass('mailpoet_closed');
|
||||||
showControl.addClass('mailpoet_hidden');
|
showControl.addClass('mailpoet_hidden');
|
||||||
} else {
|
} else {
|
||||||
el.addClass('mailpoet_hidden');
|
el.addClass('mailpoet_closed');
|
||||||
showControl.removeClass('mailpoet_hidden');
|
showControl.removeClass('mailpoet_hidden');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -306,7 +311,7 @@ define([
|
|||||||
_.each(postTypes, function(type) {
|
_.each(postTypes, function(type) {
|
||||||
select.append(jQuery('<option>', {
|
select.append(jQuery('<option>', {
|
||||||
value: type.name,
|
value: type.name,
|
||||||
text: type.labels.singular_name,
|
text: type.label,
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
select.val(selectedValue);
|
select.val(selectedValue);
|
||||||
|
@ -48,6 +48,7 @@ define([
|
|||||||
},
|
},
|
||||||
modelEvents: {
|
modelEvents: {
|
||||||
'change': 'render',
|
'change': 'render',
|
||||||
|
'delete': 'deleteBlock',
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
"mouseenter": "showTools",
|
"mouseenter": "showTools",
|
||||||
@ -88,7 +89,9 @@ define([
|
|||||||
this.$el.addClass('mailpoet_editor_view_' + this.cid);
|
this.$el.addClass('mailpoet_editor_view_' + this.cid);
|
||||||
},
|
},
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.on('showSettings', this.showSettings);
|
this.on('showSettings', this.showSettings, this);
|
||||||
|
this.on('dom:refresh', this.showBlock, this);
|
||||||
|
this._isFirstRender = true;
|
||||||
},
|
},
|
||||||
showTools: function(_event) {
|
showTools: function(_event) {
|
||||||
if (!this.showingToolsDisabled) {
|
if (!this.showingToolsDisabled) {
|
||||||
@ -114,12 +117,49 @@ define([
|
|||||||
* Defines drop behavior of BlockView instance
|
* Defines drop behavior of BlockView instance
|
||||||
*/
|
*/
|
||||||
getDropFunc: function() {
|
getDropFunc: function() {
|
||||||
var that = this;
|
|
||||||
return function() {
|
return function() {
|
||||||
var newModel = that.model.clone();
|
return this.model.clone();
|
||||||
//that.model.destroy();
|
}.bind(this);
|
||||||
return newModel;
|
},
|
||||||
};
|
showBlock: function() {
|
||||||
|
if (this._isFirstRender) {
|
||||||
|
this.transitionIn();
|
||||||
|
this._isFirstRender = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteBlock: function() {
|
||||||
|
this.transitionOut().then(function() {
|
||||||
|
this.model.destroy();
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
transitionIn: function() {
|
||||||
|
return this._transition('slideDown', 'fadeIn', 'easeOut');
|
||||||
|
},
|
||||||
|
transitionOut: function() {
|
||||||
|
return this._transition('slideUp', 'fadeOut', 'easeIn');
|
||||||
|
},
|
||||||
|
_transition: function(slideDirection, fadeDirection, easing) {
|
||||||
|
var promise = jQuery.Deferred();
|
||||||
|
|
||||||
|
this.$el.velocity(
|
||||||
|
slideDirection,
|
||||||
|
{
|
||||||
|
duration: 250,
|
||||||
|
easing: easing,
|
||||||
|
complete: function() {
|
||||||
|
promise.resolve();
|
||||||
|
}.bind(this),
|
||||||
|
}
|
||||||
|
).velocity(
|
||||||
|
fadeDirection,
|
||||||
|
{
|
||||||
|
duration: 250,
|
||||||
|
easing: easing,
|
||||||
|
queue: false, // Do not enqueue, trigger animation in parallel
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return promise;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -168,24 +208,22 @@ define([
|
|||||||
},
|
},
|
||||||
deleteBlock: function(event) {
|
deleteBlock: function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.model.destroy();
|
this.model.trigger('delete');
|
||||||
return false;
|
return false;
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Module.BlockSettingsView = Marionette.LayoutView.extend({
|
Module.BlockSettingsView = Marionette.LayoutView.extend({
|
||||||
className: 'mailpoet_editor_settings',
|
className: 'mailpoet_editor_settings',
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
var that = this;
|
|
||||||
|
|
||||||
MailPoet.Modal.panel({
|
MailPoet.Modal.panel({
|
||||||
element: this.$el,
|
element: this.$el,
|
||||||
template: '',
|
template: '',
|
||||||
position: 'right',
|
position: 'right',
|
||||||
width: App.getConfig().get('sidepanelWidth'),
|
width: App.getConfig().get('sidepanelWidth'),
|
||||||
onCancel: function() {
|
onCancel: function() {
|
||||||
that.destroy();
|
this.destroy();
|
||||||
},
|
}.bind(this),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
close: function(event) {
|
close: function(event) {
|
||||||
@ -203,6 +241,9 @@ define([
|
|||||||
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') ? true : false);
|
||||||
},
|
},
|
||||||
|
changeBoolCheckboxField: function(field, event) {
|
||||||
|
this.model.set(field, (!!jQuery(event.target).prop('checked')));
|
||||||
|
},
|
||||||
changeColorField: function(field, event) {
|
changeColorField: function(field, event) {
|
||||||
var value = jQuery(event.target).val();
|
var value = jQuery(event.target).val();
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
|
@ -42,16 +42,12 @@ 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 templates.buttonBlock; },
|
||||||
modelEvents: {
|
|
||||||
'change': 'render',
|
|
||||||
},
|
|
||||||
onDragSubstituteBy: function() { return Module.ButtonWidgetView; },
|
onDragSubstituteBy: function() { return Module.ButtonWidgetView; },
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
base.BlockView.prototype.initialize.apply(this, arguments);
|
base.BlockView.prototype.initialize.apply(this, arguments);
|
||||||
var that = this;
|
|
||||||
|
|
||||||
// Listen for attempts to change all dividers in one go
|
// Listen for attempts to change all dividers in one go
|
||||||
this._replaceButtonStylesHandler = function(data) { that.model.set(data); };
|
this._replaceButtonStylesHandler = function(data) { this.model.set(data); }.bind(this);
|
||||||
App.getChannel().on('replaceAllButtonStyles', this._replaceButtonStylesHandler);
|
App.getChannel().on('replaceAllButtonStyles', this._replaceButtonStylesHandler);
|
||||||
},
|
},
|
||||||
onRender: function() {
|
onRender: function() {
|
||||||
|
@ -75,7 +75,8 @@ define([
|
|||||||
getEmptyView: function() { return Module.ContainerBlockEmptyView; },
|
getEmptyView: function() { return Module.ContainerBlockEmptyView; },
|
||||||
emptyViewOptions: function() { return { renderOptions: this.renderOptions }; },
|
emptyViewOptions: function() { return { renderOptions: this.renderOptions }; },
|
||||||
modelEvents: {
|
modelEvents: {
|
||||||
'change': 'render'
|
'change': 'render',
|
||||||
|
'delete': 'deleteBlock',
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
"mouseenter": "showTools",
|
"mouseenter": "showTools",
|
||||||
@ -136,6 +137,8 @@ define([
|
|||||||
},
|
},
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this.renderOptions = _.defaults(options.renderOptions || {}, {});
|
this.renderOptions = _.defaults(options.renderOptions || {}, {});
|
||||||
|
this.on('dom:refresh', this.showBlock, this);
|
||||||
|
this._isFirstRender = true;
|
||||||
},
|
},
|
||||||
// Determines which view type should be used for a child
|
// Determines which view type should be used for a child
|
||||||
getChildView: function(model) {
|
getChildView: function(model) {
|
||||||
@ -162,10 +165,10 @@ define([
|
|||||||
this.toolsView = new Module.ContainerBlockToolsView({
|
this.toolsView = new Module.ContainerBlockToolsView({
|
||||||
model: this.model,
|
model: this.model,
|
||||||
tools: {
|
tools: {
|
||||||
settings: this.renderOptions.depth > 1,
|
settings: this.renderOptions.depth === 1,
|
||||||
delete: this.renderOptions.depth === 1,
|
delete: this.renderOptions.depth === 1,
|
||||||
move: this.renderOptions.depth === 1,
|
move: this.renderOptions.depth === 1,
|
||||||
layerSelector: this.renderOptions.depth === 1,
|
layerSelector: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.toolsRegion.show(this.toolsView);
|
this.toolsRegion.show(this.toolsView);
|
||||||
@ -229,12 +232,49 @@ define([
|
|||||||
_.extend(this, this._buildRegions(this.regions));
|
_.extend(this, this._buildRegions(this.regions));
|
||||||
},
|
},
|
||||||
getDropFunc: function() {
|
getDropFunc: function() {
|
||||||
var that = this;
|
|
||||||
return function() {
|
return function() {
|
||||||
var newModel = that.model.clone();
|
return this.model.clone();
|
||||||
that.model.destroy();
|
}.bind(this);
|
||||||
return newModel;
|
},
|
||||||
};
|
showBlock: function() {
|
||||||
|
if (this._isFirstRender) {
|
||||||
|
this.transitionIn();
|
||||||
|
this._isFirstRender = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteBlock: function() {
|
||||||
|
this.transitionOut().done(function() {
|
||||||
|
this.model.destroy();
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
transitionIn: function() {
|
||||||
|
return this._transition('slideDown', 'fadeIn', 'easeIn');
|
||||||
|
},
|
||||||
|
transitionOut: function() {
|
||||||
|
return this._transition('slideUp', 'fadeOut', 'easeOut');
|
||||||
|
},
|
||||||
|
_transition: function(slideDirection, fadeDirection, easing) {
|
||||||
|
var promise = jQuery.Deferred();
|
||||||
|
|
||||||
|
this.$el.velocity(
|
||||||
|
slideDirection,
|
||||||
|
{
|
||||||
|
duration: 250,
|
||||||
|
easing: easing,
|
||||||
|
complete: function() {
|
||||||
|
promise.resolve();
|
||||||
|
}.bind(this),
|
||||||
|
}
|
||||||
|
).velocity(
|
||||||
|
fadeDirection,
|
||||||
|
{
|
||||||
|
duration: 250,
|
||||||
|
easing: easing,
|
||||||
|
queue: false, // Do not enqueue, trigger animation in parallel
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return promise;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -265,6 +305,41 @@ define([
|
|||||||
behaviors: {
|
behaviors: {
|
||||||
ColorPickerBehavior: {},
|
ColorPickerBehavior: {},
|
||||||
},
|
},
|
||||||
|
regions: {
|
||||||
|
columnsSettingsRegion: '.mailpoet_container_columns_settings',
|
||||||
|
},
|
||||||
|
initialize: function() {
|
||||||
|
base.BlockSettingsView.prototype.initialize.apply(this, arguments);
|
||||||
|
|
||||||
|
this._columnsSettingsView = new (Module.ContainerBlockColumnsSettingsView)({
|
||||||
|
collection: this.model.get('blocks'),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onRender: function() {
|
||||||
|
this.columnsSettingsRegion.show(this._columnsSettingsView);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Module.ContainerBlockColumnsSettingsView = Marionette.CollectionView.extend({
|
||||||
|
getChildView: function() { return Module.ContainerBlockColumnSettingsView; },
|
||||||
|
childViewOptions: function(model, index) {
|
||||||
|
return {
|
||||||
|
columnIndex: index,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Module.ContainerBlockColumnSettingsView = Marionette.ItemView.extend({
|
||||||
|
getTemplate: function() { return templates.containerBlockColumnSettings; },
|
||||||
|
initialize: function(options) {
|
||||||
|
this.columnNumber = (options.columnIndex || 0) + 1;
|
||||||
|
},
|
||||||
|
templateHelpers: function() {
|
||||||
|
return {
|
||||||
|
model: this.model.toJSON(),
|
||||||
|
columnNumber: this.columnNumber,
|
||||||
|
};
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Module.OneColumnContainerWidgetView = base.WidgetView.extend({
|
Module.OneColumnContainerWidgetView = base.WidgetView.extend({
|
||||||
|
@ -57,11 +57,9 @@ define([
|
|||||||
this.listenTo(this.model, 'change:styles.block.padding', this.changePadding);
|
this.listenTo(this.model, 'change:styles.block.padding', this.changePadding);
|
||||||
},
|
},
|
||||||
templateHelpers: function() {
|
templateHelpers: function() {
|
||||||
return {
|
return _.extend({
|
||||||
model: this.model.toJSON(),
|
|
||||||
viewCid: this.cid,
|
|
||||||
totalHeight: parseInt(this.model.get('styles.block.padding'), 10)*2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px',
|
totalHeight: parseInt(this.model.get('styles.block.padding'), 10)*2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px',
|
||||||
};
|
}, base.BlockView.prototype.templateHelpers.apply(this));
|
||||||
},
|
},
|
||||||
onRender: function() {
|
onRender: function() {
|
||||||
this.toolsView = new Module.DividerBlockToolsView({ model: this.model });
|
this.toolsView = new Module.DividerBlockToolsView({ model: this.model });
|
||||||
|
@ -39,9 +39,9 @@ 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 templates.footerBlock; },
|
||||||
modelEvents: {
|
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',
|
||||||
},
|
}, base.BlockView.prototype.modelEvents),
|
||||||
onDragSubstituteBy: function() { return Module.FooterWidgetView; },
|
onDragSubstituteBy: function() { return Module.FooterWidgetView; },
|
||||||
onRender: function() {
|
onRender: function() {
|
||||||
this.toolsView = new Module.FooterBlockToolsView({ model: this.model });
|
this.toolsView = new Module.FooterBlockToolsView({ model: this.model });
|
||||||
|
@ -39,9 +39,9 @@ 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 templates.headerBlock; },
|
||||||
modelEvents: {
|
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',
|
||||||
},
|
}, base.BlockView.prototype.modelEvents),
|
||||||
onDragSubstituteBy: function() { return Module.HeaderWidgetView; },
|
onDragSubstituteBy: function() { return Module.HeaderWidgetView; },
|
||||||
onRender: function() {
|
onRender: function() {
|
||||||
this.toolsView = new Module.HeaderBlockToolsView({ model: this.model });
|
this.toolsView = new Module.HeaderBlockToolsView({ model: this.model });
|
||||||
|
@ -37,11 +37,9 @@ define([
|
|||||||
getTemplate: function() { return templates.imageBlock; },
|
getTemplate: function() { return templates.imageBlock; },
|
||||||
onDragSubstituteBy: function() { return Module.ImageWidgetView; },
|
onDragSubstituteBy: function() { return Module.ImageWidgetView; },
|
||||||
templateHelpers: function() {
|
templateHelpers: function() {
|
||||||
return {
|
return _.extend({
|
||||||
model: this.model.toJSON(),
|
|
||||||
viewCid: this.cid,
|
|
||||||
imageMissingSrc: App.getConfig().get('urls.imageMissing'),
|
imageMissingSrc: App.getConfig().get('urls.imageMissing'),
|
||||||
};
|
}, base.BlockView.prototype.templateHelpers.apply(this));
|
||||||
},
|
},
|
||||||
onRender: function() {
|
onRender: function() {
|
||||||
this.toolsView = new Module.ImageBlockToolsView({ model: this.model });
|
this.toolsView = new Module.ImageBlockToolsView({ model: this.model });
|
||||||
@ -66,7 +64,7 @@ define([
|
|||||||
"keyup .mailpoet_field_image_link": _.partial(this.changeField, "link"),
|
"keyup .mailpoet_field_image_link": _.partial(this.changeField, "link"),
|
||||||
"keyup .mailpoet_field_image_address": _.partial(this.changeField, "src"),
|
"keyup .mailpoet_field_image_address": _.partial(this.changeField, "src"),
|
||||||
"keyup .mailpoet_field_image_alt_text": _.partial(this.changeField, "alt"),
|
"keyup .mailpoet_field_image_alt_text": _.partial(this.changeField, "alt"),
|
||||||
"change .mailpoet_field_image_padded": _.partial(this.changeBoolField, "padded"),
|
"change .mailpoet_field_image_padded": _.partial(this.changeBoolCheckboxField, "padded"),
|
||||||
"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",
|
||||||
|
@ -18,12 +18,12 @@ define([
|
|||||||
'jquery',
|
'jquery',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
'newsletter_editor/components/wordpress',
|
'newsletter_editor/components/communication',
|
||||||
'newsletter_editor/blocks/base',
|
'newsletter_editor/blocks/base',
|
||||||
'newsletter_editor/blocks/button',
|
'newsletter_editor/blocks/button',
|
||||||
'newsletter_editor/blocks/divider',
|
'newsletter_editor/blocks/divider',
|
||||||
'select2'
|
'select2'
|
||||||
], function(Backbone, Marionette, Radio, _, jQuery, MailPoet, App, WordpressComponent, BaseBlock, ButtonBlock, DividerBlock) {
|
], function(Backbone, Marionette, Radio, _, jQuery, MailPoet, App, CommunicationComponent, BaseBlock, ButtonBlock, DividerBlock) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ define([
|
|||||||
base = BaseBlock;
|
base = BaseBlock;
|
||||||
|
|
||||||
Module.PostsBlockModel = base.BlockModel.extend({
|
Module.PostsBlockModel = base.BlockModel.extend({
|
||||||
stale: ['_selectedPosts', '_availablePosts'],
|
stale: ['_selectedPosts', '_availablePosts', '_transformedPosts'],
|
||||||
defaults: function() {
|
defaults: function() {
|
||||||
return this._getDefaults({
|
return this._getDefaults({
|
||||||
type: 'posts',
|
type: 'posts',
|
||||||
@ -63,6 +63,7 @@ define([
|
|||||||
divider: {},
|
divider: {},
|
||||||
_selectedPosts: [],
|
_selectedPosts: [],
|
||||||
_availablePosts: [],
|
_availablePosts: [],
|
||||||
|
_transformedPosts: new (App.getBlockTypeModel('container'))(),
|
||||||
}, App.getConfig().get('blockDefaults.posts'));
|
}, App.getConfig().get('blockDefaults.posts'));
|
||||||
},
|
},
|
||||||
relations: function() {
|
relations: function() {
|
||||||
@ -71,21 +72,31 @@ define([
|
|||||||
divider: App.getBlockTypeModel('divider'),
|
divider: App.getBlockTypeModel('divider'),
|
||||||
_selectedPosts: Backbone.Collection,
|
_selectedPosts: Backbone.Collection,
|
||||||
_availablePosts: Backbone.Collection,
|
_availablePosts: Backbone.Collection,
|
||||||
|
_transformedPosts: App.getBlockTypeModel('container'),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
var that = this;
|
var that = this,
|
||||||
|
POST_REFRESH_DELAY_MS = 500,
|
||||||
|
refreshAvailablePosts = _.debounce(this.fetchAvailablePosts.bind(this), POST_REFRESH_DELAY_MS),
|
||||||
|
refreshTransformedPosts = _.debounce(this._refreshTransformedPosts.bind(this), POST_REFRESH_DELAY_MS);
|
||||||
|
|
||||||
// Attach Radio.Requests API primarily for highlighting
|
// Attach Radio.Requests API primarily for highlighting
|
||||||
_.extend(this, Radio.Requests);
|
_.extend(this, Radio.Requests);
|
||||||
|
|
||||||
this.fetchAvailablePosts();
|
this.fetchAvailablePosts();
|
||||||
this.on('change:amount change:contentType change:terms change:inclusionType change:postStatus change:search change:sortBy', this._scheduleFetchAvailablePosts, this);
|
this.on('change:amount change:contentType change:terms change:inclusionType change:postStatus change:search change:sortBy', refreshAvailablePosts);
|
||||||
|
|
||||||
|
this.listenTo(this.get('_selectedPosts'), 'add remove reset', refreshTransformedPosts);
|
||||||
|
this.on('change:displayType change:titleFormat change:titlePosition change:titleAlignment change:titleIsLink change:imagePadded change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:showDivider', refreshTransformedPosts);
|
||||||
|
this.listenTo(this.get('readMoreButton'), 'change', refreshTransformedPosts);
|
||||||
|
this.listenTo(this.get('divider'), 'change', refreshTransformedPosts);
|
||||||
|
|
||||||
this.on('insertSelectedPosts', this._insertSelectedPosts, this);
|
this.on('insertSelectedPosts', this._insertSelectedPosts, this);
|
||||||
},
|
},
|
||||||
fetchAvailablePosts: function() {
|
fetchAvailablePosts: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
WordpressComponent.getPosts(this.toJSON()).done(function(posts) {
|
CommunicationComponent.getPosts(this.toJSON()).done(function(posts) {
|
||||||
console.log('Posts fetched', arguments);
|
|
||||||
that.get('_availablePosts').reset(posts);
|
that.get('_availablePosts').reset(posts);
|
||||||
that.get('_selectedPosts').reset(); // Empty out the collection
|
that.get('_selectedPosts').reset(); // Empty out the collection
|
||||||
that.trigger('change:_availablePosts');
|
that.trigger('change:_availablePosts');
|
||||||
@ -93,20 +104,22 @@ define([
|
|||||||
console.log('Posts fetchPosts error', arguments);
|
console.log('Posts fetchPosts error', arguments);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
_refreshTransformedPosts: function() {
|
||||||
* Batch more changes during a specific time, instead of fetching
|
var that = this,
|
||||||
* ALC posts on each model change
|
data = this.toJSON();
|
||||||
*/
|
|
||||||
_scheduleFetchAvailablePosts: function() {
|
data.posts = this.get('_selectedPosts').pluck('ID');
|
||||||
var timeout = 500,
|
|
||||||
that = this;
|
if (data.posts.length === 0) {
|
||||||
if (this._fetchPostsTimer !== undefined) {
|
this.get('_transformedPosts.blocks').reset();
|
||||||
clearTimeout(this._fetchPostsTimer);
|
return;
|
||||||
}
|
}
|
||||||
this._fetchPostsTimer = setTimeout(function() {
|
|
||||||
that.fetchAvailablePosts();
|
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
||||||
that._fetchPostsTimer = undefined;
|
that.get('_transformedPosts').get('blocks').reset(posts, {parse: true});
|
||||||
}, timeout);
|
}).fail(function() {
|
||||||
|
console.log('Posts _refreshTransformedPosts error', arguments);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
_insertSelectedPosts: function() {
|
_insertSelectedPosts: function() {
|
||||||
var that = this,
|
var that = this,
|
||||||
@ -118,8 +131,7 @@ define([
|
|||||||
|
|
||||||
if (data.posts.length === 0) return;
|
if (data.posts.length === 0) return;
|
||||||
|
|
||||||
WordpressComponent.getTransformedPosts(data).done(function(posts) {
|
CommunicationComponent.getTransformedPosts(data).done(function(posts) {
|
||||||
console.log('Available posts fetched', arguments);
|
|
||||||
collection.add(posts, { at: index });
|
collection.add(posts, { at: index });
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
console.log('Posts fetchPosts error', arguments);
|
console.log('Posts fetchPosts error', arguments);
|
||||||
@ -130,10 +142,14 @@ 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 templates.postsBlock; },
|
||||||
modelEvents: {},
|
modelEvents: {}, // Forcefully disable all events
|
||||||
|
regions: _.extend({
|
||||||
|
postsRegion: '.mailpoet_posts_block_posts',
|
||||||
|
}, base.BlockView.prototype.regions),
|
||||||
onDragSubstituteBy: function() { return Module.PostsWidgetView; },
|
onDragSubstituteBy: function() { return Module.PostsWidgetView; },
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
base.BlockView.prototype.initialize.apply(this, arguments);
|
base.BlockView.prototype.initialize.apply(this, arguments);
|
||||||
|
|
||||||
this.toolsView = new Module.PostsBlockToolsView({ model: this.model });
|
this.toolsView = new Module.PostsBlockToolsView({ model: this.model });
|
||||||
this.model.reply('blockView', this.notifyAboutSelf, this);
|
this.model.reply('blockView', this.notifyAboutSelf, this);
|
||||||
},
|
},
|
||||||
@ -142,6 +158,13 @@ define([
|
|||||||
this.toolsRegion.show(this.toolsView);
|
this.toolsRegion.show(this.toolsView);
|
||||||
}
|
}
|
||||||
this.trigger('showSettings');
|
this.trigger('showSettings');
|
||||||
|
|
||||||
|
var ContainerView = App.getBlockTypeView('container'),
|
||||||
|
renderOptions = {
|
||||||
|
disableTextEditor: true,
|
||||||
|
disableDragAndDrop: true,
|
||||||
|
};
|
||||||
|
this.postsRegion.show(new ContainerView({ model: this.model.get('_transformedPosts'), renderOptions: renderOptions }));
|
||||||
},
|
},
|
||||||
notifyAboutSelf: function() {
|
notifyAboutSelf: function() {
|
||||||
return this;
|
return this;
|
||||||
@ -197,8 +220,8 @@ define([
|
|||||||
},
|
},
|
||||||
switchToDisplayOptions: function() {
|
switchToDisplayOptions: function() {
|
||||||
// Switch content view
|
// Switch content view
|
||||||
this.$('.mailpoet_settings_posts_selection').addClass('mailpoet_hidden');
|
this.$('.mailpoet_settings_posts_selection').addClass('mailpoet_closed');
|
||||||
this.$('.mailpoet_settings_posts_display_options').removeClass('mailpoet_hidden');
|
this.$('.mailpoet_settings_posts_display_options').removeClass('mailpoet_closed');
|
||||||
|
|
||||||
// Switch controls
|
// Switch controls
|
||||||
this.$('.mailpoet_settings_posts_show_display_options').addClass('mailpoet_hidden');
|
this.$('.mailpoet_settings_posts_show_display_options').addClass('mailpoet_hidden');
|
||||||
@ -206,8 +229,8 @@ define([
|
|||||||
},
|
},
|
||||||
switchToPostSelection: function() {
|
switchToPostSelection: function() {
|
||||||
// Switch content view
|
// Switch content view
|
||||||
this.$('.mailpoet_settings_posts_display_options').addClass('mailpoet_hidden');
|
this.$('.mailpoet_settings_posts_display_options').addClass('mailpoet_closed');
|
||||||
this.$('.mailpoet_settings_posts_selection').removeClass('mailpoet_hidden');
|
this.$('.mailpoet_settings_posts_selection').removeClass('mailpoet_closed');
|
||||||
|
|
||||||
// Switch controls
|
// Switch controls
|
||||||
this.$('.mailpoet_settings_posts_show_post_selection').addClass('mailpoet_hidden');
|
this.$('.mailpoet_settings_posts_show_post_selection').addClass('mailpoet_hidden');
|
||||||
@ -216,6 +239,7 @@ define([
|
|||||||
insertPosts: function() {
|
insertPosts: function() {
|
||||||
this.model.trigger('insertSelectedPosts');
|
this.model.trigger('insertSelectedPosts');
|
||||||
this.model.destroy();
|
this.model.destroy();
|
||||||
|
this.close();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -245,7 +269,7 @@ define([
|
|||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
// Dynamically update available post types
|
// Dynamically update available post types
|
||||||
WordpressComponent.getPostTypes().done(_.bind(this._updateContentTypes, this));
|
CommunicationComponent.getPostTypes().done(_.bind(this._updateContentTypes, this));
|
||||||
|
|
||||||
this.$('.mailpoet_posts_categories_and_tags').select2({
|
this.$('.mailpoet_posts_categories_and_tags').select2({
|
||||||
multiple: true,
|
multiple: true,
|
||||||
@ -258,10 +282,10 @@ define([
|
|||||||
},
|
},
|
||||||
transport: function(options, success, failure) {
|
transport: function(options, success, failure) {
|
||||||
var taxonomies,
|
var taxonomies,
|
||||||
promise = WordpressComponent.getTaxonomies(that.model.get('contentType')).then(function(tax) {
|
promise = CommunicationComponent.getTaxonomies(that.model.get('contentType')).then(function(tax) {
|
||||||
taxonomies = tax;
|
taxonomies = tax;
|
||||||
// Fetch available terms based on the list of taxonomies already fetched
|
// Fetch available terms based on the list of taxonomies already fetched
|
||||||
var promise = WordpressComponent.getTerms({
|
var promise = CommunicationComponent.getTerms({
|
||||||
search: options.data.term,
|
search: options.data.term,
|
||||||
taxonomies: _.keys(taxonomies)
|
taxonomies: _.keys(taxonomies)
|
||||||
}).then(function(terms) {
|
}).then(function(terms) {
|
||||||
@ -307,11 +331,6 @@ define([
|
|||||||
},
|
},
|
||||||
}).trigger( 'change' );
|
}).trigger( 'change' );
|
||||||
},
|
},
|
||||||
onBeforeDestroy: function() {
|
|
||||||
base.BlockSettingsView.prototype.onBeforeDestroy.apply(this, arguments);
|
|
||||||
// Force close select2 if it hasn't closed yet
|
|
||||||
this.$('.mailpoet_posts_categories_and_tags').select2('close');
|
|
||||||
},
|
|
||||||
changeField: function(field, event) {
|
changeField: function(field, event) {
|
||||||
this.model.set(field, jQuery(event.target).val());
|
this.model.set(field, jQuery(event.target).val());
|
||||||
},
|
},
|
||||||
@ -323,7 +342,7 @@ define([
|
|||||||
_.each(postTypes, function(type) {
|
_.each(postTypes, function(type) {
|
||||||
select.append(jQuery('<option>', {
|
select.append(jQuery('<option>', {
|
||||||
value: type.name,
|
value: type.name,
|
||||||
text: type.labels.singular_name,
|
text: type.label,
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
select.val(selectedValue);
|
select.val(selectedValue);
|
||||||
|
@ -103,7 +103,8 @@ define([
|
|||||||
getTemplate: function() { return templates.socialBlock; },
|
getTemplate: function() { return templates.socialBlock; },
|
||||||
childViewContainer: '.mailpoet_social',
|
childViewContainer: '.mailpoet_social',
|
||||||
modelEvents: {
|
modelEvents: {
|
||||||
'change': 'render'
|
'change': 'render',
|
||||||
|
'delete': 'deleteBlock',
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
"mouseover": "showTools",
|
"mouseover": "showTools",
|
||||||
@ -145,6 +146,10 @@ define([
|
|||||||
arguments[0].collection = arguments[0].model.get('icons');
|
arguments[0].collection = arguments[0].model.get('icons');
|
||||||
Marionette.CompositeView.apply(this, arguments);
|
Marionette.CompositeView.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
initialize: function() {
|
||||||
|
this.on('dom:refresh', this.showBlock, this);
|
||||||
|
this._isFirstRender = true;
|
||||||
|
},
|
||||||
// Determines which view type should be used for a child
|
// Determines which view type should be used for a child
|
||||||
childView: SocialIconView,
|
childView: SocialIconView,
|
||||||
templateHelpers: function() {
|
templateHelpers: function() {
|
||||||
@ -170,12 +175,9 @@ define([
|
|||||||
_event.stopPropagation();
|
_event.stopPropagation();
|
||||||
},
|
},
|
||||||
getDropFunc: function() {
|
getDropFunc: function() {
|
||||||
var that = this;
|
|
||||||
return function() {
|
return function() {
|
||||||
var newModel = that.model.clone();
|
return this.model.clone();
|
||||||
//that.model.destroy();
|
}.bind(this);
|
||||||
return newModel;
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
_buildRegions: function(regions) {
|
_buildRegions: function(regions) {
|
||||||
var that = this;
|
var that = this;
|
||||||
@ -194,6 +196,46 @@ define([
|
|||||||
this.regionManager.destroy();
|
this.regionManager.destroy();
|
||||||
_.extend(this, this._buildRegions(this.regions));
|
_.extend(this, this._buildRegions(this.regions));
|
||||||
},
|
},
|
||||||
|
showBlock: function() {
|
||||||
|
if (this._isFirstRender) {
|
||||||
|
this.transitionIn();
|
||||||
|
this._isFirstRender = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteBlock: function() {
|
||||||
|
this.transitionOut().done(function() {
|
||||||
|
this.model.destroy();
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
transitionIn: function() {
|
||||||
|
return this._transition('slideDown', 'fadeIn', 'easeIn');
|
||||||
|
},
|
||||||
|
transitionOut: function() {
|
||||||
|
return this._transition('slideUp', 'fadeOut', 'easeOut');
|
||||||
|
},
|
||||||
|
_transition: function(slideDirection, fadeDirection, easing) {
|
||||||
|
var promise = jQuery.Deferred();
|
||||||
|
|
||||||
|
this.$el.velocity(
|
||||||
|
slideDirection,
|
||||||
|
{
|
||||||
|
duration: 250,
|
||||||
|
easing: easing,
|
||||||
|
complete: function() {
|
||||||
|
promise.resolve();
|
||||||
|
}.bind(this),
|
||||||
|
}
|
||||||
|
).velocity(
|
||||||
|
fadeDirection,
|
||||||
|
{
|
||||||
|
duration: 250,
|
||||||
|
easing: easing,
|
||||||
|
queue: false, // Do not enqueue, trigger animation in parallel
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Module.SocialBlockToolsView = base.BlockToolsView.extend({
|
Module.SocialBlockToolsView = base.BlockToolsView.extend({
|
||||||
|
@ -26,6 +26,8 @@ define([
|
|||||||
getTemplate: function() { return templates.textBlock; },
|
getTemplate: function() { return 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
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
base.BlockView.prototype.initialize.apply(this, arguments);
|
||||||
|
|
||||||
this.renderOptions = _.defaults(options.renderOptions || {}, {
|
this.renderOptions = _.defaults(options.renderOptions || {}, {
|
||||||
disableTextEditor: false,
|
disableTextEditor: false,
|
||||||
});
|
});
|
||||||
|
@ -63,16 +63,18 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
Module.saveNewsletter = function(options) {
|
Module.saveNewsletter = function(options) {
|
||||||
return Module._query({
|
return MailPoet.Ajax.post({
|
||||||
|
endpoint: 'newsletters',
|
||||||
action: 'save',
|
action: 'save',
|
||||||
options: options,
|
data: options || {},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Module.previewNewsletter = function(options) {
|
Module.previewNewsletter = function(options) {
|
||||||
return Module._query({
|
return MailPoet.Ajax.post({
|
||||||
action: 'preview',
|
endpoint: 'newsletters',
|
||||||
options: options,
|
action: 'sendPreview',
|
||||||
|
data: options || {},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -44,10 +44,10 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
Module.getBody = function() {
|
Module.getBody = function() {
|
||||||
return JSON.stringify({
|
return {
|
||||||
content: App._contentContainer.toJSON(),
|
content: App._contentContainer.toJSON(),
|
||||||
globalStyles: App.getGlobalStyles().toJSON(),
|
globalStyles: App.getGlobalStyles().toJSON(),
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
Module.toJSON = function() {
|
Module.toJSON = function() {
|
||||||
@ -73,8 +73,7 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
App.on('start', function(options) {
|
App.on('start', function(options) {
|
||||||
// TODO: Other newsletter information will be needed as well.
|
var body = options.newsletter.body;
|
||||||
var body = JSON.parse(options.newsletter.body);
|
|
||||||
App._contentContainer = new (App.getBlockTypeModel('container'))(body.content, {parse: true});
|
App._contentContainer = new (App.getBlockTypeModel('container'))(body.content, {parse: true});
|
||||||
App._contentContainerView = new (App.getBlockTypeView('container'))({
|
App._contentContainerView = new (App.getBlockTypeView('container'))({
|
||||||
model: App._contentContainer,
|
model: App._contentContainer,
|
||||||
|
@ -1,13 +1,26 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
|
'newsletter_editor/components/communication',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
'notice',
|
'notice',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'jquery',
|
'jquery',
|
||||||
'blob',
|
'blob',
|
||||||
'filesaver'
|
'filesaver',
|
||||||
], function(App, MailPoet, Notice, Backbone, Marionette, jQuery, Blob, FileSaver) {
|
'html2canvas'
|
||||||
|
], function(
|
||||||
|
App,
|
||||||
|
CommunicationComponent,
|
||||||
|
MailPoet,
|
||||||
|
Notice,
|
||||||
|
Backbone,
|
||||||
|
Marionette,
|
||||||
|
jQuery,
|
||||||
|
Blob,
|
||||||
|
FileSaver,
|
||||||
|
html2canvas
|
||||||
|
) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -16,26 +29,33 @@ define([
|
|||||||
|
|
||||||
// Save editor contents to server
|
// Save editor contents to server
|
||||||
Module.save = function() {
|
Module.save = function() {
|
||||||
App.getChannel().trigger('beforeEditorSave');
|
|
||||||
|
|
||||||
var json = App.toJSON();
|
var json = App.toJSON();
|
||||||
|
|
||||||
|
// Stringify to enable transmission of primitive non-string value types
|
||||||
|
if (!_.isUndefined(json.body)) {
|
||||||
|
json.body = JSON.stringify(json.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
App.getChannel().trigger('beforeEditorSave', json);
|
||||||
|
|
||||||
// save newsletter
|
// save newsletter
|
||||||
MailPoet.Ajax.post({
|
CommunicationComponent.saveNewsletter(json).done(function(response) {
|
||||||
endpoint: 'newsletters',
|
|
||||||
action: 'save',
|
|
||||||
data: json,
|
|
||||||
}).done(function(response) {
|
|
||||||
if(response.success !== undefined && response.success === true) {
|
if(response.success !== undefined && response.success === true) {
|
||||||
// TODO: Handle translations
|
// TODO: Handle translations
|
||||||
//MailPoet.Notice.success("<?php _e('Newsletter has been saved.'); ?>");
|
//MailPoet.Notice.success("<?php _e('Newsletter has been saved.'); ?>");
|
||||||
} else if(response.error !== undefined) {
|
} else if(response.error !== undefined) {
|
||||||
if(response.error.length === 0) {
|
if(response.error.length === 0) {
|
||||||
// TODO: Handle translations
|
// TODO: Handle translations
|
||||||
MailPoet.Notice.error("<?php _e('An unknown error occurred, please check your settings.'); ?>");
|
MailPoet.Notice.error(
|
||||||
|
"An unknown error occurred, please check your settings.",
|
||||||
|
{
|
||||||
|
scroll: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$(response.error).each(function(i, error) {
|
$(response.error).each(function(i, error) {
|
||||||
MailPoet.Notice.error(error);
|
MailPoet.Notice.error(error, { scroll: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,26 +66,52 @@ define([
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Module.getThumbnail = function(element, options) {
|
||||||
|
return html2canvas(element, options || {});
|
||||||
|
};
|
||||||
|
|
||||||
Module.saveTemplate = function(options) {
|
Module.saveTemplate = function(options) {
|
||||||
return MailPoet.Ajax.post({
|
var that = this,
|
||||||
endpoint: 'newsletterTemplates',
|
promise = jQuery.Deferred();
|
||||||
action: 'save',
|
|
||||||
data: _.extend(options || {}, {
|
promise.then(function(thumbnail) {
|
||||||
body: App.getBody(),
|
var data = _.extend(options || {}, {
|
||||||
}),
|
thumbnail: thumbnail.toDataURL('image/jpeg'),
|
||||||
|
body: JSON.stringify(App.getBody()),
|
||||||
|
});
|
||||||
|
|
||||||
|
return MailPoet.Ajax.post({
|
||||||
|
endpoint: 'newsletterTemplates',
|
||||||
|
action: 'save',
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Module.getThumbnail(
|
||||||
|
jQuery('#mailpoet_editor_content > .mailpoet_block').get(0)
|
||||||
|
).then(function(thumbnail) {
|
||||||
|
promise.resolve(thumbnail);
|
||||||
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
Module.exportTemplate = function(options) {
|
Module.exportTemplate = function(options) {
|
||||||
var data = _.extend(options || {}, {
|
var that = this;
|
||||||
body: App.getBody(),
|
return Module.getThumbnail(
|
||||||
});
|
jQuery('#mailpoet_editor_content > .mailpoet_block').get(0)
|
||||||
var blob = new Blob(
|
).then(function(thumbnail) {
|
||||||
[JSON.stringify(data)],
|
var data = _.extend(options || {}, {
|
||||||
{ type: 'application/json;charset=utf-8' }
|
thumbnail: thumbnail.toDataURL('image/jpeg'),
|
||||||
);
|
body: App.getBody(),
|
||||||
|
});
|
||||||
|
var blob = new Blob(
|
||||||
|
[JSON.stringify(data)],
|
||||||
|
{ type: 'application/json;charset=utf-8' }
|
||||||
|
);
|
||||||
|
|
||||||
FileSaver.saveAs(blob, 'template.json');
|
FileSaver.saveAs(blob, 'template.json');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Module.SaveView = Marionette.LayoutView.extend({
|
Module.SaveView = Marionette.LayoutView.extend({
|
||||||
@ -119,20 +165,52 @@ define([
|
|||||||
},
|
},
|
||||||
saveAsTemplate: function() {
|
saveAsTemplate: function() {
|
||||||
var templateName = this.$('.mailpoet_save_as_template_name').val(),
|
var templateName = this.$('.mailpoet_save_as_template_name').val(),
|
||||||
templateDescription = this.$('.mailpoet_save_as_template_description').val();
|
templateDescription = this.$('.mailpoet_save_as_template_description').val(),
|
||||||
|
that = this;
|
||||||
|
|
||||||
console.log('Saving template with ', templateName, templateDescription);
|
if (templateName === '') {
|
||||||
Module.saveTemplate({
|
MailPoet.Notice.error(
|
||||||
name: templateName,
|
App.getConfig().get('translations.templateNameMissing'),
|
||||||
description: templateDescription,
|
{
|
||||||
}).done(function() {
|
positionAfter: that.$el,
|
||||||
console.log('Template saved', arguments);
|
scroll: true,
|
||||||
}).fail(function() {
|
}
|
||||||
// TODO: Handle error messages
|
);
|
||||||
console.log('Template save failed', arguments);
|
} else if (templateDescription === '') {
|
||||||
});
|
MailPoet.Notice.error(
|
||||||
|
App.getConfig().get('translations.templateDescriptionMissing'),
|
||||||
|
{
|
||||||
|
positionAfter: that.$el,
|
||||||
|
scroll: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.log('Saving template with ', templateName, templateDescription);
|
||||||
|
Module.saveTemplate({
|
||||||
|
name: templateName,
|
||||||
|
description: templateDescription,
|
||||||
|
}).done(function() {
|
||||||
|
console.log('Template saved', arguments);
|
||||||
|
MailPoet.Notice.success(
|
||||||
|
App.getConfig().get('translations.templateSaved'),
|
||||||
|
{
|
||||||
|
positionAfter: that.$el,
|
||||||
|
scroll: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}).fail(function() {
|
||||||
|
console.log('Template save failed', arguments);
|
||||||
|
MailPoet.Notice.error(
|
||||||
|
App.getConfig().get('translations.templateSaveFailed'),
|
||||||
|
{
|
||||||
|
positionAfter: that.$el,
|
||||||
|
scroll: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
this.hideOptionContents();
|
||||||
|
}
|
||||||
|
|
||||||
this.hideOptionContents();
|
|
||||||
},
|
},
|
||||||
toggleExportTemplate: function() {
|
toggleExportTemplate: function() {
|
||||||
this.$('.mailpoet_export_template_container').toggleClass('mailpoet_hidden');
|
this.$('.mailpoet_export_template_container').toggleClass('mailpoet_hidden');
|
||||||
@ -143,12 +221,25 @@ define([
|
|||||||
},
|
},
|
||||||
exportTemplate: function() {
|
exportTemplate: function() {
|
||||||
var templateName = this.$('.mailpoet_export_template_name').val(),
|
var templateName = this.$('.mailpoet_export_template_name').val(),
|
||||||
templateDescription = this.$('.mailpoet_export_template_description').val();
|
templateDescription = this.$('.mailpoet_export_template_description').val(),
|
||||||
|
that = this;
|
||||||
|
|
||||||
if (templateName === '') {
|
if (templateName === '') {
|
||||||
MailPoet.Notice.error(App.getConfig().get('translations.templateNameMissing'));
|
MailPoet.Notice.error(
|
||||||
|
App.getConfig().get('translations.templateNameMissing'),
|
||||||
|
{
|
||||||
|
positionAfter: that.$el,
|
||||||
|
scroll: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
} else if (templateDescription === '') {
|
} else if (templateDescription === '') {
|
||||||
MailPoet.Notice.error(App.getConfig().get('translations.templateDescriptionMissing'));
|
MailPoet.Notice.error(
|
||||||
|
App.getConfig().get('translations.templateDescriptionMissing'),
|
||||||
|
{
|
||||||
|
positionAfter: that.$el,
|
||||||
|
scroll: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log('Exporting template with ', templateName, templateDescription);
|
console.log('Exporting template with ', templateName, templateDescription);
|
||||||
Module.exportTemplate({
|
Module.exportTemplate({
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
define([
|
define([
|
||||||
'newsletter_editor/App',
|
'newsletter_editor/App',
|
||||||
|
'newsletter_editor/components/communication',
|
||||||
'backbone',
|
'backbone',
|
||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'backbone.supermodel',
|
'backbone.supermodel',
|
||||||
'underscore',
|
'underscore',
|
||||||
'jquery',
|
'jquery',
|
||||||
'sticky-kit'
|
'sticky-kit'
|
||||||
], function(App, Backbone, Marionette, SuperModel, _, jQuery, StickyKit) {
|
], function(App, CommunicationComponent, Backbone, Marionette, SuperModel, _, jQuery, StickyKit) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -50,8 +51,33 @@ define([
|
|||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'click .mailpoet_sidebar_region h3, .mailpoet_sidebar_region .handlediv': function(event) {
|
'click .mailpoet_sidebar_region h3, .mailpoet_sidebar_region .handlediv': function(event) {
|
||||||
this.$el.find('.mailpoet_sidebar_region').addClass('closed');
|
var $openRegion = this.$el.find('.mailpoet_sidebar_region:not(.closed)'),
|
||||||
this.$el.find(event.target).parent().parent().removeClass('closed');
|
$targetRegion = this.$el.find(event.target).closest('.mailpoet_sidebar_region');
|
||||||
|
|
||||||
|
if ($openRegion.get(0) === $targetRegion.get(0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$openRegion.find('.mailpoet_region_content').velocity(
|
||||||
|
'slideUp',
|
||||||
|
{
|
||||||
|
duration: 250,
|
||||||
|
easing: "easeOut",
|
||||||
|
complete: function() {
|
||||||
|
$openRegion.addClass('closed');
|
||||||
|
}.bind(this)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$targetRegion.find('.mailpoet_region_content').velocity(
|
||||||
|
'slideDown',
|
||||||
|
{
|
||||||
|
duration: 250,
|
||||||
|
easing: "easeIn",
|
||||||
|
complete: function() {
|
||||||
|
$targetRegion.removeClass('closed');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
@ -90,7 +116,6 @@ define([
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onDomRefresh: function() {
|
onDomRefresh: function() {
|
||||||
var that = this;
|
|
||||||
this.$el.parent().stick_in_parent({
|
this.$el.parent().stick_in_parent({
|
||||||
offset_top: 32,
|
offset_top: 32,
|
||||||
});
|
});
|
||||||
@ -169,10 +194,8 @@ define([
|
|||||||
},
|
},
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this.availableStyles = options.availableStyles;
|
this.availableStyles = options.availableStyles;
|
||||||
var that = this;
|
|
||||||
},
|
},
|
||||||
onRender: function() {
|
onRender: function() {
|
||||||
var that = this;
|
|
||||||
this.$('.mailpoet_color').spectrum({
|
this.$('.mailpoet_color').spectrum({
|
||||||
clickoutFiresChange: true,
|
clickoutFiresChange: true,
|
||||||
showInput: true,
|
showInput: true,
|
||||||
@ -219,26 +242,29 @@ define([
|
|||||||
console.log('trying to send a preview');
|
console.log('trying to send a preview');
|
||||||
// get form data
|
// get form data
|
||||||
var data = {
|
var data = {
|
||||||
from_name: this.$('#mailpoet_preview_from_name').val(),
|
subscriber: this.$('#mailpoet_preview_to_email').val(),
|
||||||
from_email: this.$('#mailpoet_preview_from_email').val(),
|
id: App.getNewsletter().get('id'),
|
||||||
to_email: this.$('#mailpoet_preview_to_email').val(),
|
|
||||||
newsletter: App.newsletterId,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// send test email
|
// send test email
|
||||||
MailPoet.Modal.loading(true);
|
MailPoet.Modal.loading(true);
|
||||||
|
|
||||||
// TODO: Migrate logic to new AJAX format
|
CommunicationComponent.previewNewsletter(data).done(function(response) {
|
||||||
Wordpress.previewNewsletter(data).done(function(response) {
|
if(response.result !== undefined && response.result === true) {
|
||||||
if(response.success !== undefined && response.success === true) {
|
MailPoet.Notice.success(App.getConfig().get('translations.newsletterPreviewSent'), { scroll: true });
|
||||||
MailPoet.Notice.success(App.getConfig().get('translations.testEmailSent'));
|
} else {
|
||||||
} else if(response.error !== undefined) {
|
if (_.isArray(response.errors)) {
|
||||||
if(response.error.length === 0) {
|
response.errors.map(function(error) {
|
||||||
MailPoet.Notice.error(App.getConfig().get('translations.unknownErrorOccurred'));
|
MailPoet.Notice.error(error, { scroll: true });
|
||||||
} else {
|
|
||||||
$(response.error).each(function(i, error) {
|
|
||||||
MailPoet.Notice.error(error);
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
MailPoet.Notice.error(
|
||||||
|
App.getConfig().get('translations.newsletterPreviewFailedToSend'),
|
||||||
|
{
|
||||||
|
scroll: true,
|
||||||
|
static: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MailPoet.Modal.loading(false);
|
MailPoet.Modal.loading(false);
|
||||||
|
@ -17,7 +17,7 @@ define([
|
|||||||
},
|
},
|
||||||
h1: {
|
h1: {
|
||||||
fontColor: '#111111',
|
fontColor: '#111111',
|
||||||
fontFamily: 'Arial Black',
|
fontFamily: 'Arial',
|
||||||
fontSize: '40px'
|
fontSize: '40px'
|
||||||
},
|
},
|
||||||
h2: {
|
h2: {
|
||||||
@ -72,7 +72,7 @@ define([
|
|||||||
|
|
||||||
App.getAvailableStyles = Module.getAvailableStyles;
|
App.getAvailableStyles = Module.getAvailableStyles;
|
||||||
|
|
||||||
var body = JSON.parse(options.newsletter.body);
|
var body = options.newsletter.body;
|
||||||
this.setGlobalStyles(body.globalStyles);
|
this.setGlobalStyles(body.globalStyles);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -21,6 +21,10 @@ define(
|
|||||||
label: 'Subject',
|
label: 'Subject',
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'status',
|
||||||
|
label: 'Status'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'segments',
|
name: 'segments',
|
||||||
label: 'Lists'
|
label: 'Lists'
|
||||||
@ -112,12 +116,101 @@ define(
|
|||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'trash'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
var NewsletterList = React.createClass({
|
var NewsletterList = React.createClass({
|
||||||
renderItem: function(newsletter, actions) {
|
pauseSending: function(item) {
|
||||||
|
MailPoet.Ajax.post({
|
||||||
|
endpoint: 'sendingQueue',
|
||||||
|
action: 'pause',
|
||||||
|
data: item.id
|
||||||
|
}).done(function() {
|
||||||
|
jQuery('#resume_'+item.id).show();
|
||||||
|
jQuery('#pause_'+item.id).hide();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
resumeSending: function(item) {
|
||||||
|
MailPoet.Ajax.post({
|
||||||
|
endpoint: 'sendingQueue',
|
||||||
|
action: 'resume',
|
||||||
|
data: item.id
|
||||||
|
}).done(function() {
|
||||||
|
jQuery('#pause_'+item.id).show();
|
||||||
|
jQuery('#resume_'+item.id).hide();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
renderStatus: function(item) {
|
||||||
|
if(item.queue === null) {
|
||||||
|
return (
|
||||||
|
<span>Not sent yet.</span>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
var progressClasses = classNames(
|
||||||
|
'mailpoet_progress',
|
||||||
|
{ 'mailpoet_progress_complete': item.queue.status === 'completed'}
|
||||||
|
);
|
||||||
|
|
||||||
|
// calculate percentage done
|
||||||
|
var percentage = Math.round(
|
||||||
|
(item.queue.count_processed * 100) / (item.queue.count_total)
|
||||||
|
);
|
||||||
|
|
||||||
|
var label = false;
|
||||||
|
|
||||||
|
if(item.queue.status === 'completed') {
|
||||||
|
label = (
|
||||||
|
<span>
|
||||||
|
Sent to {
|
||||||
|
item.queue.count_processed - item.queue.count_failed
|
||||||
|
} out of { item.queue.count_total }.
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
label = (
|
||||||
|
<span>
|
||||||
|
{ item.queue.count_processed } / { item.queue.count_total }
|
||||||
|
|
||||||
|
<a
|
||||||
|
id={ 'resume_'+item.id }
|
||||||
|
className="button"
|
||||||
|
style={{ display: (item.queue.status === 'paused') ? 'inline-block': 'none' }}
|
||||||
|
href="javascript:;"
|
||||||
|
onClick={ this.resumeSending.bind(null, item) }
|
||||||
|
>Resume</a>
|
||||||
|
<a
|
||||||
|
id={ 'pause_'+item.id }
|
||||||
|
className="button mailpoet_pause"
|
||||||
|
style={{ display: (item.queue.status === null) ? 'inline-block': 'none' }}
|
||||||
|
href="javascript:;"
|
||||||
|
onClick={ this.pauseSending.bind(null, item) }
|
||||||
|
>Pause</a>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className={ progressClasses }>
|
||||||
|
<span
|
||||||
|
className="mailpoet_progress_bar"
|
||||||
|
style={ { width: percentage + "%"} }
|
||||||
|
></span>
|
||||||
|
<span className="mailpoet_progress_label">
|
||||||
|
{ percentage + "%" }
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<p style={{ textAlign:'center' }}>
|
||||||
|
{ label }
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
renderItem: function(newsletter, actions) {
|
||||||
var rowClasses = classNames(
|
var rowClasses = classNames(
|
||||||
'manage-column',
|
'manage-column',
|
||||||
'column-primary',
|
'column-primary',
|
||||||
@ -138,6 +231,9 @@ define(
|
|||||||
</strong>
|
</strong>
|
||||||
{ actions }
|
{ actions }
|
||||||
</td>
|
</td>
|
||||||
|
<td className="column" data-colname="Lists">
|
||||||
|
{ this.renderStatus(newsletter) }
|
||||||
|
</td>
|
||||||
<td className="column" data-colname="Lists">
|
<td className="column" data-colname="Lists">
|
||||||
{ segments }
|
{ segments }
|
||||||
</td>
|
</td>
|
||||||
@ -164,7 +260,8 @@ define(
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
bulk_actions={ bulk_actions }
|
bulk_actions={ bulk_actions }
|
||||||
item_actions={ item_actions }
|
item_actions={ item_actions }
|
||||||
messages={ messages } />
|
messages={ messages }
|
||||||
|
auto_refresh={ true } />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ define(
|
|||||||
Breadcrumb
|
Breadcrumb
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var settings = window.mailpoet_settings || {};
|
var settings = window.mailpoet_settings || {};
|
||||||
|
|
||||||
var fields = [
|
var fields = [
|
||||||
{
|
{
|
||||||
@ -24,17 +24,26 @@ define(
|
|||||||
label: 'Subject line',
|
label: 'Subject line',
|
||||||
tip: "Be creative! It's the first thing your subscribers see."+
|
tip: "Be creative! It's the first thing your subscribers see."+
|
||||||
"Tempt them to open your email.",
|
"Tempt them to open your email.",
|
||||||
type: 'text'
|
type: 'text',
|
||||||
|
validation: {
|
||||||
|
'data-parsley-required': true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'segments',
|
name: 'segments',
|
||||||
label: 'Lists',
|
label: 'Segments',
|
||||||
tip: "The subscriber list that will be used for this campaign.",
|
tip: "The subscriber segment that will be used for this campaign.",
|
||||||
type: 'selection',
|
type: 'selection',
|
||||||
placeholder: "Select a list",
|
placeholder: "Select a segment",
|
||||||
id: "mailpoet_segments",
|
id: "mailpoet_segments",
|
||||||
endpoint: "segments",
|
endpoint: "segments",
|
||||||
multiple: true
|
multiple: true,
|
||||||
|
filter: function(segment) {
|
||||||
|
return !!(!segment.deleted_at);
|
||||||
|
},
|
||||||
|
validation: {
|
||||||
|
'data-parsley-required': true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'sender',
|
name: 'sender',
|
||||||
@ -42,17 +51,24 @@ define(
|
|||||||
tip: "Name & email of yourself or your company.",
|
tip: "Name & email of yourself or your company.",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: 'from_name',
|
name: 'sender_name',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
placeholder: 'John Doe',
|
placeholder: 'John Doe',
|
||||||
defaultValue: settings.from_name
|
defaultValue: (settings.sender !== undefined) ? settings.sender.name : '',
|
||||||
|
validation: {
|
||||||
|
'data-parsley-required': true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'from_email',
|
name: 'sender_address',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
placeholder: 'john.doe@email.com',
|
placeholder: 'john.doe@email.com',
|
||||||
defaultValue: settings.from_address
|
defaultValue: (settings.sender !== undefined) ? settings.sender.address : '',
|
||||||
},
|
validation: {
|
||||||
|
'data-parsley-required': true,
|
||||||
|
'data-parsley-type': 'email'
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -65,20 +81,25 @@ define(
|
|||||||
{
|
{
|
||||||
name: 'reply_to_name',
|
name: 'reply_to_name',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
placeholder: 'John Doe'
|
placeholder: 'John Doe',
|
||||||
|
defaultValue: (settings.reply_to !== undefined) ? settings.reply_to.name : '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'reply_to_email',
|
name: 'reply_to_address',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
placeholder: 'john.doe@email.com'
|
placeholder: 'john.doe@email.com',
|
||||||
|
defaultValue: (settings.reply_to !== undefined) ? settings.reply_to.address : ''
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
var messages = {
|
var messages = {
|
||||||
updated: function() {
|
onUpdate: function() {
|
||||||
MailPoet.Notice.success('The newsletter has been updated!');
|
MailPoet.Notice.success('Newsletter successfully updated!');
|
||||||
|
},
|
||||||
|
onCreate: function() {
|
||||||
|
MailPoet.Notice.success('Newsletter successfully added!');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,34 +108,50 @@ define(
|
|||||||
Router.History
|
Router.History
|
||||||
],
|
],
|
||||||
handleSend: function() {
|
handleSend: function() {
|
||||||
MailPoet.Ajax.post({
|
if(jQuery('#mailpoet_newsletter').parsley().validate() === true) {
|
||||||
endpoint: 'newsletters',
|
MailPoet.Ajax.post({
|
||||||
action: 'send',
|
endpoint: 'sendingQueue',
|
||||||
data: {
|
action: 'add',
|
||||||
id: this.props.params.id,
|
data: {
|
||||||
newsletter: jQuery('#mailpoet_newsletter').serializeObject(),
|
newsletter_id: this.props.params.id,
|
||||||
segments: jQuery('#mailpoet_segments').val()
|
segments: jQuery('#mailpoet_segments').val(),
|
||||||
}
|
sender: {
|
||||||
}).done(function(response) {
|
'name': jQuery('#mailpoet_newsletter [name="sender_name"]').val(),
|
||||||
if(response === true) {
|
'address': jQuery('#mailpoet_newsletter [name="sender_address"]').val()
|
||||||
this.history.pushState(null, '/');
|
},
|
||||||
|
reply_to: {
|
||||||
MailPoet.Notice.success(
|
'name': jQuery('#mailpoet_newsletter [name="reply_to_name"]').val(),
|
||||||
'The newsletter has been sent!'
|
'address': jQuery('#mailpoet_newsletter [name="reply_to_address"]').val()
|
||||||
);
|
}
|
||||||
} else {
|
}
|
||||||
if(response.errors) {
|
}).done(function(response) {
|
||||||
MailPoet.Notice.error(
|
if(response.result === true) {
|
||||||
response.errors.join("<br />")
|
this.history.pushState(null, '/');
|
||||||
|
MailPoet.Notice.success(
|
||||||
|
'The newsletter is being sent...'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MailPoet.Notice.error(
|
if(response.errors) {
|
||||||
'An error occurred while trying to send. '+
|
MailPoet.Notice.error(
|
||||||
'<a href="?page=mailpoet-settings">Check your settings.</a>'
|
response.errors.join("<br />")
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
MailPoet.Notice.error(
|
||||||
|
'An error occurred while trying to send. '+
|
||||||
|
'<a href="?page=mailpoet-settings">Check your settings.</a>'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}.bind(this));
|
||||||
}.bind(this));
|
}
|
||||||
|
},
|
||||||
|
componentDidMount: function() {
|
||||||
|
if(this.isMounted()) {
|
||||||
|
jQuery('#mailpoet_newsletter').parsley();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isValid: function() {
|
||||||
|
return (jQuery('#mailpoet_newsletter').parsley().validate());
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
@ -128,7 +165,8 @@ define(
|
|||||||
endpoint="newsletters"
|
endpoint="newsletters"
|
||||||
fields={ fields }
|
fields={ fields }
|
||||||
params={ this.props.params }
|
params={ this.props.params }
|
||||||
messages={ messages }>
|
messages={ messages }
|
||||||
|
isValid={ this.isValid }>
|
||||||
|
|
||||||
<p className="submit">
|
<p className="submit">
|
||||||
<input
|
<input
|
||||||
|
@ -18,6 +18,12 @@ define(
|
|||||||
|
|
||||||
var ImportTemplate = React.createClass({
|
var ImportTemplate = React.createClass({
|
||||||
saveTemplate: function(template) {
|
saveTemplate: function(template) {
|
||||||
|
|
||||||
|
// Stringify to enable transmission of primitive non-string value types
|
||||||
|
if (!_.isUndefined(template.body)) {
|
||||||
|
template.body = JSON.stringify(template.body);
|
||||||
|
}
|
||||||
|
|
||||||
MailPoet.Ajax.post({
|
MailPoet.Ajax.post({
|
||||||
endpoint: 'newsletterTemplates',
|
endpoint: 'newsletterTemplates',
|
||||||
action: 'save',
|
action: 'save',
|
||||||
@ -99,7 +105,7 @@ define(
|
|||||||
"MailPoet's Guide",
|
"MailPoet's Guide",
|
||||||
description:
|
description:
|
||||||
"This is the standard template that comes with MailPoet.",
|
"This is the standard template that comes with MailPoet.",
|
||||||
readonly: true
|
readonly: "1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -111,19 +117,26 @@ define(
|
|||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
handleSelectTemplate: function(template) {
|
handleSelectTemplate: function(template) {
|
||||||
|
var body = template.body;
|
||||||
|
|
||||||
|
// Stringify to enable transmission of primitive non-string value types
|
||||||
|
if (!_.isUndefined(body)) {
|
||||||
|
body = JSON.stringify(body);
|
||||||
|
}
|
||||||
|
|
||||||
MailPoet.Ajax.post({
|
MailPoet.Ajax.post({
|
||||||
endpoint: 'newsletters',
|
endpoint: 'newsletters',
|
||||||
action: 'save',
|
action: 'save',
|
||||||
data: {
|
data: {
|
||||||
id: this.props.params.id,
|
id: this.props.params.id,
|
||||||
body: template.body
|
body: body
|
||||||
}
|
}
|
||||||
}).done(function(response) {
|
}).done(function(response) {
|
||||||
if(response === true) {
|
if(response.result === true) {
|
||||||
// TODO: Move this URL elsewhere
|
// TODO: Move this URL elsewhere
|
||||||
window.location = 'admin.php?page=mailpoet-newsletter-editor&id=' + this.props.params.id;
|
window.location = 'admin.php?page=mailpoet-newsletter-editor&id=' + this.props.params.id;
|
||||||
} else {
|
} else {
|
||||||
response.map(function(error) {
|
response.errors.map(function(error) {
|
||||||
MailPoet.Notice.error(error);
|
MailPoet.Notice.error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -150,6 +163,13 @@ define(
|
|||||||
this.setState({ loading: false });
|
this.setState({ loading: false });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleShowTemplate: function(template) {
|
||||||
|
MailPoet.Modal.popup({
|
||||||
|
title: template.name,
|
||||||
|
template: '<div class="mailpoet_boxes_preview" style="background-color: {{ body.globalStyles.body.backgroundColor }}"><img src="{{ thumbnail }}" /></div>',
|
||||||
|
data: template,
|
||||||
|
});
|
||||||
|
},
|
||||||
handleTemplateImport: function() {
|
handleTemplateImport: function() {
|
||||||
this.getTemplates();
|
this.getTemplates();
|
||||||
},
|
},
|
||||||
@ -164,11 +184,22 @@ define(
|
|||||||
Delete
|
Delete
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
);
|
), thumbnail = '';
|
||||||
|
|
||||||
|
if (typeof template.thumbnail === 'string'
|
||||||
|
&& template.thumbnail.length > 0) {
|
||||||
|
thumbnail = (
|
||||||
|
<a href="javascript:;" onClick={this.handleShowTemplate.bind(null, template)}>
|
||||||
|
<img src={ template.thumbnail } />
|
||||||
|
<div className="mailpoet_overlay"></div>
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li key={ 'template-'+index }>
|
<li key={ 'template-'+index }>
|
||||||
<div className="mailpoet_thumbnail">
|
<div className="mailpoet_thumbnail">
|
||||||
|
{ thumbnail }
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mailpoet_description">
|
<div className="mailpoet_description">
|
||||||
@ -192,7 +223,7 @@ define(
|
|||||||
Preview
|
Preview
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{ (template.readonly) ? false : deleteLink }
|
{ (template.readonly === "1") ? false : deleteLink }
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -26,6 +26,7 @@ define(
|
|||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
type: type,
|
type: type,
|
||||||
|
subject: 'Draft newsletter',
|
||||||
}
|
}
|
||||||
}).done(function(response) {
|
}).done(function(response) {
|
||||||
if(response.id !== undefined) {
|
if(response.id !== undefined) {
|
||||||
|
@ -1,191 +1,212 @@
|
|||||||
define('notice', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
define('notice', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
||||||
"use strict";
|
"use strict";
|
||||||
/*==================================================================================================
|
/*==================================================================================================
|
||||||
|
|
||||||
MailPoet Notice:
|
MailPoet Notice:
|
||||||
|
|
||||||
description: Handles notices
|
description: Handles notices
|
||||||
version: 0.2
|
version: 0.2
|
||||||
author: Jonathan Labreuille
|
author: Jonathan Labreuille
|
||||||
company: Wysija
|
company: Wysija
|
||||||
dependencies: jQuery
|
dependencies: jQuery
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
// success message (static: false)
|
// success message (static: false)
|
||||||
MailPoet.Notice.success('Yatta!');
|
MailPoet.Notice.success('Yatta!');
|
||||||
|
|
||||||
// error message (static: false)
|
// error message (static: false)
|
||||||
MailPoet.Notice.error('Boo!');
|
MailPoet.Notice.error('Boo!');
|
||||||
|
|
||||||
// system message (static: true)
|
// system message (static: true)
|
||||||
MailPoet.Notice.system('You need to updated ASAP!');
|
MailPoet.Notice.system('You need to updated ASAP!');
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
MailPoet.Notice.success('- success #1 -');
|
MailPoet.Notice.success('- success #1 -');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
MailPoet.Notice.success('- success #2 -');
|
MailPoet.Notice.success('- success #2 -');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
MailPoet.Notice.error('- error -');
|
MailPoet.Notice.error('- error -');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
MailPoet.Notice.system('- system -');
|
MailPoet.Notice.system('- system -');
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
MailPoet.Notice.hide();
|
MailPoet.Notice.hide();
|
||||||
}, 2500);
|
}, 2500);
|
||||||
}, 300);
|
}, 300);
|
||||||
}, 400);
|
}, 400);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
==================================================================================================*/
|
==================================================================================================*/
|
||||||
|
|
||||||
MailPoet.Notice = {
|
MailPoet.Notice = {
|
||||||
version: 0.2,
|
version: 0.2,
|
||||||
// default options
|
// default options
|
||||||
defaults: {
|
defaults: {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: '',
|
message: '',
|
||||||
static: false,
|
static: false,
|
||||||
scroll: false,
|
hideClose: false,
|
||||||
timeout: 2000,
|
id: null,
|
||||||
onOpen: null,
|
positionAfter: false,
|
||||||
onClose: null
|
scroll: false,
|
||||||
},
|
timeout: 2000,
|
||||||
options: {},
|
onOpen: null,
|
||||||
init: function(options) {
|
onClose: null
|
||||||
// set options
|
},
|
||||||
this.options = jQuery.extend({}, this.defaults, options);
|
options: {},
|
||||||
|
init: function(options) {
|
||||||
// clone element
|
// set options
|
||||||
this.element = jQuery('#mailpoet_notice_'+this.options.type).clone();
|
this.options = jQuery.extend({}, this.defaults, options);
|
||||||
|
|
||||||
// remove id from clone
|
// clone element
|
||||||
this.element.removeAttr('id');
|
this.element = jQuery('#mailpoet_notice_'+this.options.type).clone();
|
||||||
|
|
||||||
// insert notice after its parent
|
// add data-id to the element
|
||||||
jQuery('#mailpoet_notice_'+this.options.type).after(this.element);
|
if (this.options.id) this.element.attr('data-id', 'notice_' + this.options.id);
|
||||||
|
|
||||||
// setup onClose callback
|
// remove id from clone
|
||||||
var onClose = null;
|
this.element.removeAttr('id');
|
||||||
if(this.options.onClose !== null) {
|
|
||||||
onClose = this.options.onClose;
|
// insert notice after its parent
|
||||||
}
|
var positionAfter;
|
||||||
|
if (typeof this.options.positionAfter === 'object') {
|
||||||
// listen to remove event
|
positionAfter = this.options.positionAfter;
|
||||||
var element = this.element;
|
} else if (typeof this.options.positionAfter === 'string') {
|
||||||
jQuery(this.element).on('close', function() {
|
positionAfter = jQuery(this.options.positionAfter);
|
||||||
jQuery(this).fadeOut(200, function() {
|
} else {
|
||||||
// on close callback
|
positionAfter = jQuery('#mailpoet_notice_'+this.options.type);
|
||||||
if(onClose !== null) {
|
}
|
||||||
onClose();
|
positionAfter.after(this.element);
|
||||||
}
|
|
||||||
// remove notice
|
// setup onClose callback
|
||||||
jQuery(this).remove();
|
var onClose = null;
|
||||||
});
|
if(this.options.onClose !== null) {
|
||||||
}.bind(this.element));
|
onClose = this.options.onClose;
|
||||||
|
}
|
||||||
// listen to message event
|
|
||||||
jQuery(this.element).on('message', function(e, message) {
|
// listen to remove event
|
||||||
MailPoet.Notice.setMessage(message);
|
jQuery(this.element).on('close', function() {
|
||||||
}.bind(this.element));
|
jQuery(this).fadeOut(200, function() {
|
||||||
|
// on close callback
|
||||||
return this;
|
if(onClose !== null) {
|
||||||
},
|
onClose();
|
||||||
isHTML: function(str) {
|
}
|
||||||
var a = document.createElement('div');
|
// remove notice
|
||||||
a.innerHTML = str;
|
jQuery(this).remove();
|
||||||
for(var c = a.childNodes, i = c.length; i--;) {
|
});
|
||||||
if(c[i].nodeType == 1) return true;
|
}.bind(this.element));
|
||||||
}
|
|
||||||
return false;
|
// listen to message event
|
||||||
},
|
jQuery(this.element).on('message', function(e, message) {
|
||||||
setMessage: function(message) {
|
MailPoet.Notice.setMessage(message);
|
||||||
// if it's not an html message, let's sugar coat the message with a fancy <p>
|
}.bind(this.element));
|
||||||
if(this.isHTML(message) === false) {
|
|
||||||
message = '<p>'+message+'</p>';
|
return this;
|
||||||
}
|
},
|
||||||
// set message
|
isHTML: function(str) {
|
||||||
return this.element.html(message);
|
var a = document.createElement('div');
|
||||||
},
|
a.innerHTML = str;
|
||||||
show: function(options) {
|
for(var c = a.childNodes, i = c.length; i--;) {
|
||||||
// initialize
|
if(c[i].nodeType == 1) return true;
|
||||||
this.init(options);
|
}
|
||||||
|
return false;
|
||||||
// show notice
|
},
|
||||||
this.showNotice();
|
setMessage: function(message) {
|
||||||
|
// if it's not an html message, let's sugar coat the message with a fancy <p>
|
||||||
// return this;
|
if(this.isHTML(message) === false) {
|
||||||
},
|
message = '<p>'+message+'</p>';
|
||||||
showNotice: function() {
|
}
|
||||||
// set message
|
// set message
|
||||||
this.setMessage(this.options.message);
|
return this.element.html(message);
|
||||||
|
},
|
||||||
// position notice
|
show: function(options) {
|
||||||
this.element.insertAfter(jQuery('h2.title'));
|
// initialize
|
||||||
|
this.init(options);
|
||||||
// set class name
|
|
||||||
switch(this.options.type) {
|
// show notice
|
||||||
case 'success':
|
this.showNotice();
|
||||||
this.element.addClass('updated');
|
|
||||||
break;
|
// return this;
|
||||||
case 'system':
|
},
|
||||||
this.element.addClass('update-nag');
|
showNotice: function() {
|
||||||
break;
|
// set message
|
||||||
case 'error':
|
this.setMessage(this.options.message);
|
||||||
this.element.addClass('error');
|
|
||||||
break;
|
// position notice
|
||||||
}
|
this.element.insertAfter(jQuery('h2.title'));
|
||||||
|
|
||||||
// make the notice appear
|
// set class name
|
||||||
this.element.fadeIn(200);
|
switch(this.options.type) {
|
||||||
|
case 'success':
|
||||||
// if scroll option is enabled, scroll to the notice
|
this.element.addClass('updated');
|
||||||
if(this.options.scroll === true) {
|
break;
|
||||||
this.element.get(0).scrollIntoView(false);
|
case 'system':
|
||||||
}
|
this.element.addClass('update-nag');
|
||||||
|
break;
|
||||||
// if the notice is not static, it has to disappear after a timeout
|
case 'error':
|
||||||
if(this.options.static === false) {
|
this.element.addClass('error');
|
||||||
this.element.delay(this.options.timeout).trigger('close');
|
break;
|
||||||
} else {
|
}
|
||||||
this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
|
|
||||||
this.element.find('.mailpoet_notice_close').on('click', function() {
|
// make the notice appear
|
||||||
jQuery(this).trigger('close');
|
this.element.fadeIn(200);
|
||||||
});
|
|
||||||
}
|
// if scroll option is enabled, scroll to the notice
|
||||||
|
if(this.options.scroll === true) {
|
||||||
// call onOpen callback
|
this.element.get(0).scrollIntoView(false);
|
||||||
if(this.options.onOpen !== null) {
|
}
|
||||||
this.options.onOpen(this.element);
|
|
||||||
}
|
// if the notice is not static, it has to disappear after a timeout
|
||||||
},
|
if(this.options.static === false) {
|
||||||
hide: function(all) {
|
this.element.delay(this.options.timeout).trigger('close');
|
||||||
if(all !== undefined && all === true) {
|
} else if (this.options.hideClose === false) {
|
||||||
jQuery('.mailpoet_notice:not([id])').trigger('close');
|
this.element.append('<a href="javascript:;" class="mailpoet_notice_close"><span class="dashicons dashicons-dismiss"></span></a>');
|
||||||
} else {
|
this.element.find('.mailpoet_notice_close').on('click', function() {
|
||||||
jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])')
|
jQuery(this).trigger('close');
|
||||||
.trigger('close');
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
error: function(message, options) {
|
// call onOpen callback
|
||||||
this.show(jQuery.extend({}, {
|
if(this.options.onOpen !== null) {
|
||||||
type: 'error',
|
this.options.onOpen(this.element);
|
||||||
message: '<p>'+message+'</p>'
|
}
|
||||||
}, options));
|
},
|
||||||
},
|
hide: function(all) {
|
||||||
success: function(message, options) {
|
if(all !== undefined && all === true) {
|
||||||
this.show(jQuery.extend({}, {
|
jQuery('.mailpoet_notice:not([id])').trigger('close');
|
||||||
type: 'success',
|
} else if (all !== undefined && jQuery.isArray(all)) {
|
||||||
message: '<p>'+message+'</p>'
|
for (var id in all) {
|
||||||
}, options));
|
jQuery('[data-id="notice_' + all[id] + '"]')
|
||||||
},
|
.trigger('close');
|
||||||
system: function(message, options) {
|
}
|
||||||
this.show(jQuery.extend({}, {
|
} if (all !== undefined) {
|
||||||
type: 'system',
|
jQuery('[data-id="notice_' + all + '"]')
|
||||||
static: true,
|
.trigger('close');
|
||||||
message: message
|
} else {
|
||||||
}, options));
|
jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])')
|
||||||
}
|
.trigger('close');
|
||||||
};
|
}
|
||||||
});
|
},
|
||||||
|
error: function(message, options) {
|
||||||
|
this.show(jQuery.extend({}, {
|
||||||
|
type: 'error',
|
||||||
|
message: '<p>'+message+'</p>'
|
||||||
|
}, options));
|
||||||
|
},
|
||||||
|
success: function(message, options) {
|
||||||
|
this.show(jQuery.extend({}, {
|
||||||
|
type: 'success',
|
||||||
|
message: '<p>'+message+'</p>'
|
||||||
|
}, options));
|
||||||
|
},
|
||||||
|
system: function(message, options) {
|
||||||
|
this.show(jQuery.extend({}, {
|
||||||
|
type: 'system',
|
||||||
|
static: true,
|
||||||
|
message: message
|
||||||
|
}, options));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
@ -20,7 +20,10 @@ function(
|
|||||||
$('form.mailpoet_form').each(function() {
|
$('form.mailpoet_form').each(function() {
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
|
|
||||||
form.parsley().on('form:submit', function(parsley) {
|
form.parsley({
|
||||||
|
errorsWrapper: '<p></p>',
|
||||||
|
errorTemplate: '<span></span>'
|
||||||
|
}).on('form:submit', function(parsley) {
|
||||||
|
|
||||||
var data = form.serializeObject() || {};
|
var data = form.serializeObject() || {};
|
||||||
|
|
||||||
|
@ -26,10 +26,10 @@ define(
|
|||||||
];
|
];
|
||||||
|
|
||||||
var messages = {
|
var messages = {
|
||||||
updated: function() {
|
onUpdate: function() {
|
||||||
MailPoet.Notice.success('Segment successfully updated!');
|
MailPoet.Notice.success('Segment successfully updated!');
|
||||||
},
|
},
|
||||||
created: function() {
|
onCreate: function() {
|
||||||
MailPoet.Notice.success('Segment successfully added!');
|
MailPoet.Notice.success('Segment successfully added!');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -42,11 +42,7 @@ define(
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2 className="title">
|
<h2 className="title">
|
||||||
Segment <a
|
Segment
|
||||||
href="javascript:;"
|
|
||||||
className="add-new-h2"
|
|
||||||
onClick={ this.history.goBack }
|
|
||||||
>Back to list</a>
|
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
@ -54,7 +50,7 @@ define(
|
|||||||
fields={ fields }
|
fields={ fields }
|
||||||
params={ this.props.params }
|
params={ this.props.params }
|
||||||
messages={ messages }
|
messages={ messages }
|
||||||
onSuccess={ this.history.goBack } />
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,32 @@ const item_actions = [
|
|||||||
);
|
);
|
||||||
refresh();
|
refresh();
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
display: function(segment) {
|
||||||
|
return (segment.type !== 'wp_users');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'synchronize_segment',
|
||||||
|
label: 'Update',
|
||||||
|
className: 'update',
|
||||||
|
onClick: function(item, refresh) {
|
||||||
|
MailPoet.Modal.loading(true);
|
||||||
|
MailPoet.Ajax.post({
|
||||||
|
endpoint: 'segments',
|
||||||
|
action: 'synchronize'
|
||||||
|
}).done(function(response) {
|
||||||
|
MailPoet.Modal.loading(false);
|
||||||
|
if(response === true) {
|
||||||
|
MailPoet.Notice.success(
|
||||||
|
('List "%$1s" has been synchronized.').replace('%$1s', item.name)
|
||||||
|
);
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
display: function(segment) {
|
||||||
|
return (segment.type === 'wp_users');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -130,15 +156,16 @@ const item_actions = [
|
|||||||
<a href={ item.subscribers_url }>View subscribers</a>
|
<a href={ item.subscribers_url }>View subscribers</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'trash',
|
||||||
|
display: function(segment) {
|
||||||
|
return (segment.type !== 'wp_users');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const bulk_actions = [
|
const bulk_actions = [
|
||||||
{
|
|
||||||
name: 'trash',
|
|
||||||
label: 'Trash',
|
|
||||||
onSuccess: messages.onTrash
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const SegmentList = React.createClass({
|
const SegmentList = React.createClass({
|
||||||
@ -148,7 +175,6 @@ const SegmentList = React.createClass({
|
|||||||
'column-primary',
|
'column-primary',
|
||||||
'has-row-actions'
|
'has-row-actions'
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<td className={ rowClasses }>
|
<td className={ rowClasses }>
|
||||||
|
@ -15,10 +15,10 @@ define(
|
|||||||
|
|
||||||
MailPoet.Router = new (Backbone.Router.extend({
|
MailPoet.Router = new (Backbone.Router.extend({
|
||||||
routes: {
|
routes: {
|
||||||
'mta(/:method)': 'sendingMethod',
|
'mta(/:group)': 'sendingMethodGroup',
|
||||||
'(:tab)': 'tabs',
|
'(:tab)': 'tabs',
|
||||||
},
|
},
|
||||||
sendingMethod: function(method) {
|
sendingMethodGroup: function(group) {
|
||||||
// display mta tab
|
// display mta tab
|
||||||
this.tabs('mta');
|
this.tabs('mta');
|
||||||
|
|
||||||
@ -30,13 +30,13 @@ define(
|
|||||||
// hide "save settings" button
|
// hide "save settings" button
|
||||||
jQuery('.mailpoet_settings_submit').hide();
|
jQuery('.mailpoet_settings_submit').hide();
|
||||||
|
|
||||||
if(method === null) {
|
if(group === null) {
|
||||||
// show sending methods
|
// show sending methods
|
||||||
jQuery('.mailpoet_sending_methods').fadeIn();
|
jQuery('.mailpoet_sending_methods').fadeIn();
|
||||||
} else {
|
} else {
|
||||||
// hide DKIM option when using MailPoet's API
|
// hide DKIM option when using MailPoet's API
|
||||||
jQuery('#mailpoet_mta_dkim')[
|
jQuery('#mailpoet_mta_dkim')[
|
||||||
(method === 'mailpoet')
|
(group === 'mailpoet')
|
||||||
? 'hide'
|
? 'hide'
|
||||||
: 'show'
|
: 'show'
|
||||||
]();
|
]();
|
||||||
@ -45,7 +45,7 @@ define(
|
|||||||
jQuery('.mailpoet_sending_methods').hide();
|
jQuery('.mailpoet_sending_methods').hide();
|
||||||
|
|
||||||
// display selected sending method's settings
|
// display selected sending method's settings
|
||||||
jQuery('.mailpoet_sending_method[data-method="'+ method +'"]').show();
|
jQuery('.mailpoet_sending_method[data-group="'+ group +'"]').show();
|
||||||
jQuery('#mailpoet_sending_method_setup').fadeIn();
|
jQuery('#mailpoet_sending_method_setup').fadeIn();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -73,7 +73,7 @@ define(
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
Backbone.history.start();
|
if (!Backbone.History.started) Backbone.history.start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
@ -37,14 +37,25 @@ define(
|
|||||||
'subscribed': 'Subscribed',
|
'subscribed': 'Subscribed',
|
||||||
'unsubscribed': 'Unsubscribed'
|
'unsubscribed': 'Unsubscribed'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'segments',
|
||||||
|
label: 'Lists',
|
||||||
|
type: 'selection',
|
||||||
|
placeholder: "Select a list",
|
||||||
|
endpoint: "segments",
|
||||||
|
multiple: true,
|
||||||
|
filter: function(segment) {
|
||||||
|
return !!(!segment.deleted_at);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
var messages = {
|
var messages = {
|
||||||
updated: function() {
|
onUpdate: function() {
|
||||||
MailPoet.Notice.success('Subscriber successfully updated!');
|
MailPoet.Notice.success('Subscriber successfully updated!');
|
||||||
},
|
},
|
||||||
created: function() {
|
onCreate: function() {
|
||||||
MailPoet.Notice.success('Subscriber successfully added!');
|
MailPoet.Notice.success('Subscriber successfully added!');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -59,11 +70,7 @@ define(
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2 className="title">
|
<h2 className="title">
|
||||||
Subscriber <a
|
Subscriber
|
||||||
href="javascript:;"
|
|
||||||
className="add-new-h2"
|
|
||||||
onClick={ this.history.goBack }
|
|
||||||
>Back to list</a>
|
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
@ -71,7 +78,7 @@ define(
|
|||||||
fields={ fields }
|
fields={ fields }
|
||||||
params={ this.props.params }
|
params={ this.props.params }
|
||||||
messages={ messages }
|
messages={ messages }
|
||||||
onSuccess={ this.history.goBack } />
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
170
assets/js/src/subscribers/importExport/export.js
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
define(
|
||||||
|
[
|
||||||
|
'underscore',
|
||||||
|
'jquery',
|
||||||
|
'mailpoet',
|
||||||
|
'handlebars',
|
||||||
|
'select2'
|
||||||
|
],
|
||||||
|
function (
|
||||||
|
_,
|
||||||
|
jQuery,
|
||||||
|
MailPoet,
|
||||||
|
Handlebars
|
||||||
|
) {
|
||||||
|
if (!jQuery("#mailpoet_subscribers_export").length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
if (!exportData.segments) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var subscribers_export_template =
|
||||||
|
Handlebars.compile(jQuery('#mailpoet_subscribers_export_template').html());
|
||||||
|
|
||||||
|
//render template
|
||||||
|
jQuery('#mailpoet_subscribers_export > div.inside').html(subscribers_export_template(exportData));
|
||||||
|
|
||||||
|
// define reusable variables
|
||||||
|
var segmentsContainerElement = jQuery("#export_lists"),
|
||||||
|
subscriberFieldsContainerElement = jQuery("#export_columns"),
|
||||||
|
exportConfirmedOptionElement = jQuery(':radio[name="option_confirmed"]'),
|
||||||
|
groupBySegmentOptionElement = jQuery(':checkbox[name="option_group_by_list"]'),
|
||||||
|
nextStepButton = jQuery("a.mailpoet_export_process"),
|
||||||
|
renderSegmentsAndFields = function (container, data) {
|
||||||
|
if (container.data('select2')) {
|
||||||
|
container
|
||||||
|
.html('')
|
||||||
|
.select2('destroy');
|
||||||
|
}
|
||||||
|
container
|
||||||
|
.select2({
|
||||||
|
data: data,
|
||||||
|
width: '20em',
|
||||||
|
templateResult: function (item) {
|
||||||
|
return (item.subscriberCount > 0)
|
||||||
|
? item.name + ' (' + item.subscriberCount + ')'
|
||||||
|
: item.name;
|
||||||
|
},
|
||||||
|
templateSelection: function (item) {
|
||||||
|
return (item.subscriberCount > 0)
|
||||||
|
? item.name + ' (' + item.subscriberCount + ')'
|
||||||
|
: item.name;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.on('select2:selecting', function (selectEvent) {
|
||||||
|
var selectElement = this,
|
||||||
|
selectedOptionId = selectEvent.params.args.data.id,
|
||||||
|
fieldsToExclude = [
|
||||||
|
'select',
|
||||||
|
'deselect'
|
||||||
|
];
|
||||||
|
if (_.contains(fieldsToExclude, selectedOptionId)) {
|
||||||
|
selectEvent.preventDefault();
|
||||||
|
if (selectedOptionId === 'deselect') {
|
||||||
|
jQuery(selectElement).val('').trigger('change');
|
||||||
|
} else {
|
||||||
|
var allOptions = [];
|
||||||
|
_.each(container.find('option'), function (field) {
|
||||||
|
if (!_.contains(fieldsToExclude, field.value)) {
|
||||||
|
allOptions.push(field.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
jQuery(selectElement).val(allOptions).trigger('change');
|
||||||
|
}
|
||||||
|
jQuery(selectElement).select2('close');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.on('change', function () {
|
||||||
|
if ((exportData.segments && segmentsContainerElement.select2('data').length && subscriberFieldsContainerElement.select2('data').length)
|
||||||
|
||
|
||||||
|
(!exportData.segments && subscriberFieldsContainerElement.select2('data').length)
|
||||||
|
) {
|
||||||
|
toggleNextStepButton('on');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toggleNextStepButton('off');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (segmentsContainerElement.select2('data').length > 1 && exportData.groupBySegmentOption) {
|
||||||
|
jQuery('.mailpoet_group_by_list').show();
|
||||||
|
}
|
||||||
|
else if (exportData.groupBySegmentOption) {
|
||||||
|
jQuery('.mailpoet_group_by_list').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
renderSegmentsAndFields(subscriberFieldsContainerElement, subscriberFieldsSelect2);
|
||||||
|
renderSegmentsAndFields(segmentsContainerElement, segments);
|
||||||
|
|
||||||
|
subscriberFieldsContainerElement.select2('val', [
|
||||||
|
'status',
|
||||||
|
'email',
|
||||||
|
'first_name',
|
||||||
|
'last_name'
|
||||||
|
]);
|
||||||
|
|
||||||
|
exportConfirmedOptionElement.change(function () {
|
||||||
|
var selectedSegments = segmentsContainerElement.val();
|
||||||
|
if (this.value == 1) {
|
||||||
|
exportData.exportConfirmedOption = true;
|
||||||
|
renderSegmentsAndFields(segmentsContainerElement, segmentsWithConfirmedSubscribers);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
exportData.exportConfirmedOption = false;
|
||||||
|
renderSegmentsAndFields(segmentsContainerElement, segments);
|
||||||
|
}
|
||||||
|
segmentsContainerElement.select2('val', selectedSegments);
|
||||||
|
});
|
||||||
|
|
||||||
|
function toggleNextStepButton(condition) {
|
||||||
|
var disabled = 'button-disabled';
|
||||||
|
if (condition === 'on') {
|
||||||
|
nextStepButton.removeClass(disabled);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nextStepButton.addClass(disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nextStepButton.click(function () {
|
||||||
|
if (jQuery(this).hasClass('button-disabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MailPoet.Modal.loading(true);
|
||||||
|
MailPoet.Ajax
|
||||||
|
.post({
|
||||||
|
endpoint: 'ImportExport',
|
||||||
|
action: 'processExport',
|
||||||
|
data: JSON.stringify({
|
||||||
|
'export_confirmed_option': exportData.exportConfirmedOption,
|
||||||
|
'export_format_option': jQuery(':radio[name="option_format"]:checked').val(),
|
||||||
|
'group_by_segment_option': (groupBySegmentOptionElement.is(":visible")) ? groupBySegmentOptionElement.prop('checked') : false,
|
||||||
|
'segments': (exportData.segments) ? segmentsContainerElement.val() : false,
|
||||||
|
'subscriber_fields': subscriberFieldsContainerElement.val()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.done(function (response) {
|
||||||
|
MailPoet.Modal.loading(false);
|
||||||
|
if (response.result === false) {
|
||||||
|
MailPoet.Notice.error(response.error);
|
||||||
|
} else {
|
||||||
|
resultMessage = MailPoetI18n.exportMessage
|
||||||
|
.replace('%1$s', '<strong>' + response.data.totalExported + '</strong>')
|
||||||
|
.replace('[link]', '<a href="' + response.data.exportFileURL + '" target="_blank" >')
|
||||||
|
.replace('[/link]', '</a>');
|
||||||
|
jQuery('#export_result_notice > ul > li').html(resultMessage);
|
||||||
|
jQuery('#export_result_notice').show();
|
||||||
|
window.location.href = response.data.exportFileURL;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.error(function (error) {
|
||||||
|
MailPoet.Modal.loading(false);
|
||||||
|
MailPoet.Notice.error(
|
||||||
|
MailPoetI18n.serverError + error.statusText.toLowerCase() + '.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
1157
assets/js/src/subscribers/importExport/import.js
Normal file
@ -101,7 +101,12 @@ const bulk_actions = [
|
|||||||
onSelect: function() {
|
onSelect: function() {
|
||||||
let field = {
|
let field = {
|
||||||
id: 'move_to_segment',
|
id: 'move_to_segment',
|
||||||
endpoint: 'segments'
|
endpoint: 'segments',
|
||||||
|
filter: function(segment) {
|
||||||
|
return !!(
|
||||||
|
!segment.deleted_at && segment.type === 'default'
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -127,7 +132,12 @@ const bulk_actions = [
|
|||||||
onSelect: function() {
|
onSelect: function() {
|
||||||
let field = {
|
let field = {
|
||||||
id: 'add_to_segment',
|
id: 'add_to_segment',
|
||||||
endpoint: 'segments'
|
endpoint: 'segments',
|
||||||
|
filter: function(segment) {
|
||||||
|
return !!(
|
||||||
|
!segment.deleted_at && segment.type === 'default'
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -153,7 +163,12 @@ const bulk_actions = [
|
|||||||
onSelect: function() {
|
onSelect: function() {
|
||||||
let field = {
|
let field = {
|
||||||
id: 'remove_from_segment',
|
id: 'remove_from_segment',
|
||||||
endpoint: 'segments'
|
endpoint: 'segments',
|
||||||
|
filter: function(segment) {
|
||||||
|
return !!(
|
||||||
|
segment.type === 'default'
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -200,6 +215,21 @@ const bulk_actions = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const item_actions = [
|
||||||
|
{
|
||||||
|
name: 'edit',
|
||||||
|
label: 'Edit',
|
||||||
|
link: function(item) {
|
||||||
|
return (
|
||||||
|
<Link to={ `/edit/${item.id}` }>Edit</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'trash'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
const SubscriberList = React.createClass({
|
const SubscriberList = React.createClass({
|
||||||
renderItem: function(subscriber, actions) {
|
renderItem: function(subscriber, actions) {
|
||||||
let row_classes = classNames(
|
let row_classes = classNames(
|
||||||
@ -270,11 +300,16 @@ const SubscriberList = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
onGetItems: function(count) {
|
||||||
|
jQuery('#mailpoet_export_button')[(count > 0) ? 'show' : 'hide']();
|
||||||
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2 className="title">
|
<h2 className="title">
|
||||||
Subscribers <Link className="add-new-h2" to="/new">New</Link>
|
Subscribers <Link className="add-new-h2" to="/new">New</Link>
|
||||||
|
<a className="add-new-h2" href="?page=mailpoet-import#step1">Import</a>
|
||||||
|
<a id="mailpoet_export_button" className="add-new-h2" href="?page=mailpoet-export">Export</a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<Listing
|
<Listing
|
||||||
@ -284,7 +319,9 @@ const SubscriberList = React.createClass({
|
|||||||
onRenderItem={ this.renderItem }
|
onRenderItem={ this.renderItem }
|
||||||
columns={ columns }
|
columns={ columns }
|
||||||
bulk_actions={ bulk_actions }
|
bulk_actions={ bulk_actions }
|
||||||
|
item_actions={ item_actions }
|
||||||
messages={ messages }
|
messages={ messages }
|
||||||
|
onGetItems={ this.onGetItems }
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
264
assets/js/src/vendor/jquery.sticky-kit.js
vendored
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
// Generated by CoffeeScript 1.9.2
|
||||||
|
|
||||||
|
/**
|
||||||
|
@license Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var $, win;
|
||||||
|
|
||||||
|
$ = this.jQuery || window.jQuery;
|
||||||
|
|
||||||
|
win = $(window);
|
||||||
|
|
||||||
|
$.fn.stick_in_parent = function(opts) {
|
||||||
|
var doc, elm, enable_bottoming, fn, i, inner_scrolling, len, manual_spacer, offset_top, outer_width, parent_selector, recalc_every, sticky_class;
|
||||||
|
if (opts == null) {
|
||||||
|
opts = {};
|
||||||
|
}
|
||||||
|
sticky_class = opts.sticky_class, inner_scrolling = opts.inner_scrolling, recalc_every = opts.recalc_every, parent_selector = opts.parent, offset_top = opts.offset_top, manual_spacer = opts.spacer, enable_bottoming = opts.bottoming;
|
||||||
|
if (offset_top == null) {
|
||||||
|
offset_top = 0;
|
||||||
|
}
|
||||||
|
if (parent_selector == null) {
|
||||||
|
parent_selector = void 0;
|
||||||
|
}
|
||||||
|
if (inner_scrolling == null) {
|
||||||
|
inner_scrolling = true;
|
||||||
|
}
|
||||||
|
if (sticky_class == null) {
|
||||||
|
sticky_class = "is_stuck";
|
||||||
|
}
|
||||||
|
doc = $(document);
|
||||||
|
if (enable_bottoming == null) {
|
||||||
|
enable_bottoming = true;
|
||||||
|
}
|
||||||
|
outer_width = function(el) {
|
||||||
|
var _el, computed, w;
|
||||||
|
if (window.getComputedStyle) {
|
||||||
|
_el = el[0];
|
||||||
|
computed = window.getComputedStyle(el[0]);
|
||||||
|
w = parseFloat(computed.getPropertyValue("width")) + parseFloat(computed.getPropertyValue("margin-left")) + parseFloat(computed.getPropertyValue("margin-right"));
|
||||||
|
if (computed.getPropertyValue("box-sizing") !== "border-box") {
|
||||||
|
w += parseFloat(computed.getPropertyValue("border-left-width")) + parseFloat(computed.getPropertyValue("border-right-width")) + parseFloat(computed.getPropertyValue("padding-left")) + parseFloat(computed.getPropertyValue("padding-right"));
|
||||||
|
}
|
||||||
|
return w;
|
||||||
|
} else {
|
||||||
|
return el.outerWidth(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float, detached) {
|
||||||
|
var bottomed, detach, fixed, last_pos, last_scroll_height, offset, parent, recalc, recalc_and_tick, recalc_counter, spacer, tick;
|
||||||
|
if (elm.data("sticky_kit")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
elm.data("sticky_kit", true);
|
||||||
|
last_scroll_height = doc.height();
|
||||||
|
parent = elm.parent();
|
||||||
|
if (parent_selector != null) {
|
||||||
|
parent = parent.closest(parent_selector);
|
||||||
|
}
|
||||||
|
if (!parent.length) {
|
||||||
|
throw "failed to find stick parent";
|
||||||
|
}
|
||||||
|
fixed = false;
|
||||||
|
bottomed = false;
|
||||||
|
spacer = manual_spacer != null ? manual_spacer && elm.closest(manual_spacer) : $("<div />");
|
||||||
|
if (spacer) {
|
||||||
|
spacer.css('position', elm.css('position'));
|
||||||
|
}
|
||||||
|
recalc = function() {
|
||||||
|
var border_top, padding_top, restore;
|
||||||
|
if (detached) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
last_scroll_height = doc.height();
|
||||||
|
border_top = parseInt(parent.css("border-top-width"), 10);
|
||||||
|
padding_top = parseInt(parent.css("padding-top"), 10);
|
||||||
|
padding_bottom = parseInt(parent.css("padding-bottom"), 10);
|
||||||
|
parent_top = parent.offset().top + border_top + padding_top;
|
||||||
|
parent_height = parent.height();
|
||||||
|
if (fixed) {
|
||||||
|
fixed = false;
|
||||||
|
bottomed = false;
|
||||||
|
if (manual_spacer == null) {
|
||||||
|
elm.insertAfter(spacer);
|
||||||
|
spacer.detach();
|
||||||
|
}
|
||||||
|
elm.css({
|
||||||
|
position: "",
|
||||||
|
top: "",
|
||||||
|
width: "",
|
||||||
|
bottom: ""
|
||||||
|
}).removeClass(sticky_class);
|
||||||
|
restore = true;
|
||||||
|
}
|
||||||
|
top = elm.offset().top - (parseInt(elm.css("margin-top"), 10) || 0) - offset_top;
|
||||||
|
height = elm.outerHeight(true);
|
||||||
|
el_float = elm.css("float");
|
||||||
|
if (spacer) {
|
||||||
|
spacer.css({
|
||||||
|
width: outer_width(elm),
|
||||||
|
height: height,
|
||||||
|
display: elm.css("display"),
|
||||||
|
"vertical-align": elm.css("vertical-align"),
|
||||||
|
"float": el_float
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (restore) {
|
||||||
|
return tick();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
recalc();
|
||||||
|
|
||||||
|
last_pos = void 0;
|
||||||
|
offset = offset_top;
|
||||||
|
recalc_counter = recalc_every;
|
||||||
|
tick = function() {
|
||||||
|
var css, delta, recalced, scroll, will_bottom, win_height;
|
||||||
|
if (detached) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
recalced = false;
|
||||||
|
if (recalc_counter != null) {
|
||||||
|
recalc_counter -= 1;
|
||||||
|
if (recalc_counter <= 0) {
|
||||||
|
recalc_counter = recalc_every;
|
||||||
|
recalc();
|
||||||
|
recalced = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!recalced && doc.height() !== last_scroll_height) {
|
||||||
|
recalc();
|
||||||
|
recalced = true;
|
||||||
|
}
|
||||||
|
scroll = win.scrollTop();
|
||||||
|
if (last_pos != null) {
|
||||||
|
delta = scroll - last_pos;
|
||||||
|
}
|
||||||
|
last_pos = scroll;
|
||||||
|
if (fixed) {
|
||||||
|
if (enable_bottoming) {
|
||||||
|
will_bottom = scroll + height + offset > parent_height + parent_top;
|
||||||
|
if (bottomed && !will_bottom) {
|
||||||
|
bottomed = false;
|
||||||
|
elm.css({
|
||||||
|
position: "fixed",
|
||||||
|
bottom: "",
|
||||||
|
top: offset
|
||||||
|
}).trigger("sticky_kit:unbottom");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scroll < top) {
|
||||||
|
fixed = false;
|
||||||
|
offset = offset_top;
|
||||||
|
if (manual_spacer == null) {
|
||||||
|
if (el_float === "left" || el_float === "right") {
|
||||||
|
elm.insertAfter(spacer);
|
||||||
|
}
|
||||||
|
spacer.detach();
|
||||||
|
}
|
||||||
|
css = {
|
||||||
|
position: "",
|
||||||
|
width: "",
|
||||||
|
top: ""
|
||||||
|
};
|
||||||
|
elm.css(css).removeClass(sticky_class).trigger("sticky_kit:unstick");
|
||||||
|
}
|
||||||
|
if (inner_scrolling) {
|
||||||
|
win_height = win.height();
|
||||||
|
if (height + offset_top > win_height) {
|
||||||
|
if (!bottomed) {
|
||||||
|
offset -= delta;
|
||||||
|
offset = Math.max(win_height - height, offset);
|
||||||
|
offset = Math.min(offset_top, offset);
|
||||||
|
if (fixed) {
|
||||||
|
elm.css({
|
||||||
|
top: offset + "px"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (scroll > top) {
|
||||||
|
fixed = true;
|
||||||
|
css = {
|
||||||
|
position: "fixed",
|
||||||
|
top: offset
|
||||||
|
};
|
||||||
|
css.width = elm.css("box-sizing") === "border-box" ? elm.outerWidth() + "px" : elm.width() + "px";
|
||||||
|
elm.css(css).addClass(sticky_class);
|
||||||
|
if (manual_spacer == null) {
|
||||||
|
elm.after(spacer);
|
||||||
|
if (el_float === "left" || el_float === "right") {
|
||||||
|
spacer.append(elm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elm.trigger("sticky_kit:stick");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fixed && enable_bottoming) {
|
||||||
|
if (will_bottom == null) {
|
||||||
|
will_bottom = scroll + height + offset > parent_height + parent_top;
|
||||||
|
}
|
||||||
|
if (!bottomed && will_bottom) {
|
||||||
|
bottomed = true;
|
||||||
|
if (parent.css("position") === "static") {
|
||||||
|
parent.css({
|
||||||
|
position: "relative"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return elm.css({
|
||||||
|
position: "absolute",
|
||||||
|
bottom: padding_bottom,
|
||||||
|
top: "auto"
|
||||||
|
}).trigger("sticky_kit:bottom");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
recalc_and_tick = function() {
|
||||||
|
recalc();
|
||||||
|
return tick();
|
||||||
|
};
|
||||||
|
detach = function() {
|
||||||
|
detached = true;
|
||||||
|
win.off("touchmove", tick);
|
||||||
|
win.off("scroll", tick);
|
||||||
|
win.off("resize", recalc_and_tick);
|
||||||
|
$(document.body).off("sticky_kit:recalc", recalc_and_tick);
|
||||||
|
elm.off("sticky_kit:detach", detach);
|
||||||
|
elm.removeData("sticky_kit");
|
||||||
|
elm.css({
|
||||||
|
position: "",
|
||||||
|
bottom: "",
|
||||||
|
top: "",
|
||||||
|
width: ""
|
||||||
|
});
|
||||||
|
parent.position("position", "");
|
||||||
|
if (fixed) {
|
||||||
|
if (manual_spacer == null) {
|
||||||
|
if (el_float === "left" || el_float === "right") {
|
||||||
|
elm.insertAfter(spacer);
|
||||||
|
}
|
||||||
|
spacer.remove();
|
||||||
|
}
|
||||||
|
return elm.removeClass(sticky_class);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
win.on("touchmove", tick);
|
||||||
|
win.on("scroll", tick);
|
||||||
|
win.on("resize", recalc_and_tick);
|
||||||
|
$(document.body).on("sticky_kit:recalc", recalc_and_tick);
|
||||||
|
elm.on("sticky_kit:detach", detach);
|
||||||
|
return setTimeout(tick, 0);
|
||||||
|
};
|
||||||
|
for (i = 0, len = this.length; i < len; i++) {
|
||||||
|
elm = this[i];
|
||||||
|
fn($(elm));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(this);
|
||||||
|
|
42
build
@ -1,42 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Remove previous build.
|
|
||||||
rm wysija-newsletters.zip;
|
|
||||||
|
|
||||||
# Create temp dir.
|
|
||||||
mkdir wysija-newsletters;
|
|
||||||
|
|
||||||
# Production assets.
|
|
||||||
./do compile:all;
|
|
||||||
|
|
||||||
# Production libraries.
|
|
||||||
rm -rf vendor;
|
|
||||||
rm composer.lock;
|
|
||||||
./composer.phar install --no-dev;
|
|
||||||
|
|
||||||
# Copy release folders.
|
|
||||||
cp -rf lang wysija-newsletters;
|
|
||||||
cp -rfL assets wysija-newsletters;
|
|
||||||
cp -rf lib wysija-newsletters;
|
|
||||||
cp -rf vendor wysija-newsletters;
|
|
||||||
cp -rf views wysija-newsletters;
|
|
||||||
rm -rf wysija-newsletters/assets/css/src;
|
|
||||||
rm -rf wysija-newsletters/assets/js/src;
|
|
||||||
|
|
||||||
# Copy release files.
|
|
||||||
cp LICENSE wysija-newsletters;
|
|
||||||
cp index.php wysija-newsletters;
|
|
||||||
cp mailpoet.php wysija-newsletters;
|
|
||||||
cp readme.txt wysija-newsletters;
|
|
||||||
cp uninstall.php wysija-newsletters;
|
|
||||||
|
|
||||||
# Zip final release.
|
|
||||||
zip -r wysija-newsletters.zip wysija-newsletters;
|
|
||||||
|
|
||||||
# Remove temp dir.
|
|
||||||
rm -rf wysija-newsletters;
|
|
||||||
|
|
||||||
# Reinstall dev dependencies.
|
|
||||||
rm composer.lock;
|
|
||||||
./composer.phar install;
|
|
||||||
./do install;
|
|
42
build.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
plugin_name='mailpoet'
|
||||||
|
|
||||||
|
# Remove previous build.
|
||||||
|
rm $plugin_name.zip
|
||||||
|
|
||||||
|
# Create temp dir.
|
||||||
|
mkdir $plugin_name
|
||||||
|
|
||||||
|
# Production assets.
|
||||||
|
rm -rf node_modules
|
||||||
|
npm install
|
||||||
|
./do compile:all
|
||||||
|
|
||||||
|
# Production libraries.
|
||||||
|
./composer.phar install --no-dev
|
||||||
|
|
||||||
|
# Copy release folders.
|
||||||
|
cp -Rf lang $plugin_name
|
||||||
|
cp -RfL assets $plugin_name
|
||||||
|
cp -Rf lib $plugin_name
|
||||||
|
cp -Rf vendor $plugin_name
|
||||||
|
cp -Rf views $plugin_name
|
||||||
|
rm -Rf $plugin_name/assets/css/src
|
||||||
|
rm -Rf $plugin_name/assets/js/src
|
||||||
|
|
||||||
|
# Copy release files.
|
||||||
|
cp LICENSE $plugin_name
|
||||||
|
cp index.php $plugin_name
|
||||||
|
cp $plugin_name.php $plugin_name
|
||||||
|
cp readme.txt $plugin_name
|
||||||
|
cp uninstall.php $plugin_name
|
||||||
|
|
||||||
|
# Zip final release.
|
||||||
|
zip -r $plugin_name.zip $plugin_name
|
||||||
|
|
||||||
|
# Remove temp dir.
|
||||||
|
rm -rf $plugin_name
|
||||||
|
|
||||||
|
# Reinstall dev dependencies.
|
||||||
|
./composer.phar install
|
@ -8,7 +8,9 @@
|
|||||||
"tburry/pquery": "*",
|
"tburry/pquery": "*",
|
||||||
"j4mie/paris": "1.5.4",
|
"j4mie/paris": "1.5.4",
|
||||||
"swiftmailer/swiftmailer": "^5.4",
|
"swiftmailer/swiftmailer": "^5.4",
|
||||||
"phpseclib/phpseclib": "*"
|
"phpseclib/phpseclib": "*",
|
||||||
|
"mtdowling/cron-expression": "^1.0",
|
||||||
|
"nesbot/carbon": "^1.21"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"codeception/codeception": "*",
|
"codeception/codeception": "*",
|
||||||
|
498
composer.lock
generated
@ -4,8 +4,8 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "7d7ef94b6e40ac2b2d594e5832d7e16d",
|
"hash": "4720dce62e4a6a7bf4d3ba3944b9c2b9",
|
||||||
"content-hash": "2e70c335edf7429df0794ebf49e2f210",
|
"content-hash": "748470f0803c52a798a4ecd1bb8a93b9",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "cerdic/css-tidy",
|
"name": "cerdic/css-tidy",
|
||||||
@ -158,6 +158,97 @@
|
|||||||
],
|
],
|
||||||
"time": "2014-09-23 10:49:36"
|
"time": "2014-09-23 10:49:36"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "mtdowling/cron-expression",
|
||||||
|
"version": "v1.0.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/mtdowling/cron-expression.git",
|
||||||
|
"reference": "fd92e883195e5dfa77720b1868cf084b08be4412"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/fd92e883195e5dfa77720b1868cf084b08be4412",
|
||||||
|
"reference": "fd92e883195e5dfa77720b1868cf084b08be4412",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "4.*"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Cron": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Michael Dowling",
|
||||||
|
"email": "mtdowling@gmail.com",
|
||||||
|
"homepage": "https://github.com/mtdowling"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due",
|
||||||
|
"keywords": [
|
||||||
|
"cron",
|
||||||
|
"schedule"
|
||||||
|
],
|
||||||
|
"time": "2015-01-11 23:07:46"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "nesbot/carbon",
|
||||||
|
"version": "1.21.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||||
|
"reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7b08ec6f75791e130012f206e3f7b0e76e18e3d7",
|
||||||
|
"reference": "7b08ec6f75791e130012f206e3f7b0e76e18e3d7",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0",
|
||||||
|
"symfony/translation": "~2.6|~3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.0|~5.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Carbon\\": "src/Carbon/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Brian Nesbitt",
|
||||||
|
"email": "brian@nesbot.com",
|
||||||
|
"homepage": "http://nesbot.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A simple API extension for DateTime.",
|
||||||
|
"homepage": "http://carbon.nesbot.com",
|
||||||
|
"keywords": [
|
||||||
|
"date",
|
||||||
|
"datetime",
|
||||||
|
"time"
|
||||||
|
],
|
||||||
|
"time": "2015-11-04 20:07:17"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpmailer/phpmailer",
|
"name": "phpmailer/phpmailer",
|
||||||
"version": "v5.2.14",
|
"version": "v5.2.14",
|
||||||
@ -403,6 +494,69 @@
|
|||||||
],
|
],
|
||||||
"time": "2015-06-06 14:19:39"
|
"time": "2015-06-06 14:19:39"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/translation",
|
||||||
|
"version": "v2.7.7",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/translation.git",
|
||||||
|
"reference": "e4ecb9c3ba1304eaf24de15c2d7a428101c1982f"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/translation/zipball/e4ecb9c3ba1304eaf24de15c2d7a428101c1982f",
|
||||||
|
"reference": "e4ecb9c3ba1304eaf24de15c2d7a428101c1982f",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.9"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"symfony/config": "<2.7"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"psr/log": "~1.0",
|
||||||
|
"symfony/config": "~2.7",
|
||||||
|
"symfony/intl": "~2.4",
|
||||||
|
"symfony/yaml": "~2.2"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"psr/log": "To use logging capability in translator",
|
||||||
|
"symfony/config": "",
|
||||||
|
"symfony/yaml": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.7-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\Translation\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony Translation Component",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"time": "2015-11-18 13:41:01"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "tburry/pquery",
|
"name": "tburry/pquery",
|
||||||
"version": "v1.1.0",
|
"version": "v1.1.0",
|
||||||
@ -520,16 +674,16 @@
|
|||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
{
|
{
|
||||||
"name": "codeception/codeception",
|
"name": "codeception/codeception",
|
||||||
"version": "2.1.3",
|
"version": "2.1.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Codeception/Codeception.git",
|
"url": "https://github.com/Codeception/Codeception.git",
|
||||||
"reference": "cd810cb78a869408602e17271f9b7368b09a7ca8"
|
"reference": "6a812e8a0d1b1db939a29b4dc14cb398b21b6112"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/Codeception/Codeception/zipball/cd810cb78a869408602e17271f9b7368b09a7ca8",
|
"url": "https://api.github.com/repos/Codeception/Codeception/zipball/6a812e8a0d1b1db939a29b4dc14cb398b21b6112",
|
||||||
"reference": "cd810cb78a869408602e17271f9b7368b09a7ca8",
|
"reference": "6a812e8a0d1b1db939a29b4dc14cb398b21b6112",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -596,7 +750,7 @@
|
|||||||
"functional testing",
|
"functional testing",
|
||||||
"unit testing"
|
"unit testing"
|
||||||
],
|
],
|
||||||
"time": "2015-10-02 09:38:59"
|
"time": "2015-11-12 03:57:06"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "codeception/verify",
|
"name": "codeception/verify",
|
||||||
@ -740,16 +894,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "facebook/webdriver",
|
"name": "facebook/webdriver",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/facebook/php-webdriver.git",
|
"url": "https://github.com/facebook/php-webdriver.git",
|
||||||
"reference": "d843e33fd19b49db5ac9daaef2610079daab0bad"
|
"reference": "a6e209a309bf7cd71acf15476f40b11a25d5a79d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/d843e33fd19b49db5ac9daaef2610079daab0bad",
|
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/a6e209a309bf7cd71acf15476f40b11a25d5a79d",
|
||||||
"reference": "d843e33fd19b49db5ac9daaef2610079daab0bad",
|
"reference": "a6e209a309bf7cd71acf15476f40b11a25d5a79d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -779,20 +933,20 @@
|
|||||||
"selenium",
|
"selenium",
|
||||||
"webdriver"
|
"webdriver"
|
||||||
],
|
],
|
||||||
"time": "2015-11-01 20:09:34"
|
"time": "2015-11-03 22:17:22"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/guzzle",
|
"name": "guzzlehttp/guzzle",
|
||||||
"version": "6.1.0",
|
"version": "6.1.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/guzzle.git",
|
"url": "https://github.com/guzzle/guzzle.git",
|
||||||
"reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81"
|
"reference": "c6851d6e48f63b69357cbfa55bca116448140e0c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/66fd14b4d0b8f2389eaf37c5458608c7cb793a81",
|
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/c6851d6e48f63b69357cbfa55bca116448140e0c",
|
||||||
"reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81",
|
"reference": "c6851d6e48f63b69357cbfa55bca116448140e0c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -841,7 +995,7 @@
|
|||||||
"rest",
|
"rest",
|
||||||
"web service"
|
"web service"
|
||||||
],
|
],
|
||||||
"time": "2015-09-08 17:36:26"
|
"time": "2015-11-23 00:47:50"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/promises",
|
"name": "guzzlehttp/promises",
|
||||||
@ -1362,16 +1516,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "4.8.16",
|
"version": "4.8.18",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e"
|
"reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/625f8c345606ed0f3a141dfb88f4116f0e22978e",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa33d4ad96481b91df343d83e8c8aabed6b1dfd3",
|
||||||
"reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e",
|
"reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1430,7 +1584,7 @@
|
|||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2015-10-23 06:48:33"
|
"time": "2015-11-11 11:32:49"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit-mock-objects",
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
@ -1961,16 +2115,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/browser-kit",
|
"name": "symfony/browser-kit",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/browser-kit.git",
|
"url": "https://github.com/symfony/browser-kit.git",
|
||||||
"reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367"
|
"reference": "bd28847ea2193916074c7b11d4fdd78570049694"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/07d664a052572ccc28eb2ab7dbbe82155b1ad367",
|
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/bd28847ea2193916074c7b11d4fdd78570049694",
|
||||||
"reference": "07d664a052572ccc28eb2ab7dbbe82155b1ad367",
|
"reference": "bd28847ea2193916074c7b11d4fdd78570049694",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1993,7 +2147,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\BrowserKit\\": ""
|
"Symfony\\Component\\BrowserKit\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2011,20 +2168,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony BrowserKit Component",
|
"description": "Symfony BrowserKit Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-23 14:47:27"
|
"time": "2015-11-02 20:20:53"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/config",
|
"name": "symfony/config",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/config.git",
|
"url": "https://github.com/symfony/config.git",
|
||||||
"reference": "831f88908b51b9ce945f5e6f402931d1ac544423"
|
"reference": "61973327bfb054f6f470de7be033a28b76c1dc20"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/config/zipball/831f88908b51b9ce945f5e6f402931d1ac544423",
|
"url": "https://api.github.com/repos/symfony/config/zipball/61973327bfb054f6f470de7be033a28b76c1dc20",
|
||||||
"reference": "831f88908b51b9ce945f5e6f402931d1ac544423",
|
"reference": "61973327bfb054f6f470de7be033a28b76c1dc20",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2040,7 +2197,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\Config\\": ""
|
"Symfony\\Component\\Config\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2058,20 +2218,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Config Component",
|
"description": "Symfony Config Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-11-02 20:20:53"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/console.git",
|
"url": "https://github.com/symfony/console.git",
|
||||||
"reference": "5efd632294c8320ea52492db22292ff853a43766"
|
"reference": "16bb1cb86df43c90931df65f529e7ebd79636750"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/console/zipball/5efd632294c8320ea52492db22292ff853a43766",
|
"url": "https://api.github.com/repos/symfony/console/zipball/16bb1cb86df43c90931df65f529e7ebd79636750",
|
||||||
"reference": "5efd632294c8320ea52492db22292ff853a43766",
|
"reference": "16bb1cb86df43c90931df65f529e7ebd79636750",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2096,7 +2256,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\Console\\": ""
|
"Symfony\\Component\\Console\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2114,20 +2277,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Console Component",
|
"description": "Symfony Console Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-20 14:38:46"
|
"time": "2015-11-18 09:54:26"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/css-selector",
|
"name": "symfony/css-selector",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/css-selector.git",
|
"url": "https://github.com/symfony/css-selector.git",
|
||||||
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b"
|
"reference": "abb47717fb88aebd9437da2fc8bb01a50a36679f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b",
|
"url": "https://api.github.com/repos/symfony/css-selector/zipball/abb47717fb88aebd9437da2fc8bb01a50a36679f",
|
||||||
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b",
|
"reference": "abb47717fb88aebd9437da2fc8bb01a50a36679f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2142,7 +2305,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\CssSelector\\": ""
|
"Symfony\\Component\\CssSelector\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2164,20 +2330,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony CssSelector Component",
|
"description": "Symfony CssSelector Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-10-30 20:10:21"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/dom-crawler",
|
"name": "symfony/dom-crawler",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/dom-crawler.git",
|
"url": "https://github.com/symfony/dom-crawler.git",
|
||||||
"reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612"
|
"reference": "b33593cbfe1d81b50d48353f338aca76a08658d8"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/5fef7d8b80d8f9992df99d8ee283f420484c9612",
|
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b33593cbfe1d81b50d48353f338aca76a08658d8",
|
||||||
"reference": "5fef7d8b80d8f9992df99d8ee283f420484c9612",
|
"reference": "b33593cbfe1d81b50d48353f338aca76a08658d8",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2198,7 +2364,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\DomCrawler\\": ""
|
"Symfony\\Component\\DomCrawler\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2216,20 +2385,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony DomCrawler Component",
|
"description": "Symfony DomCrawler Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-11-02 20:20:53"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/event-dispatcher",
|
"name": "symfony/event-dispatcher",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||||
"reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8"
|
"reference": "7e2f9c31645680026c2372edf66f863fc7757af5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87a5db5ea887763fa3a31a5471b512ff1596d9b8",
|
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7e2f9c31645680026c2372edf66f863fc7757af5",
|
||||||
"reference": "87a5db5ea887763fa3a31a5471b512ff1596d9b8",
|
"reference": "7e2f9c31645680026c2372edf66f863fc7757af5",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2255,7 +2424,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\EventDispatcher\\": ""
|
"Symfony\\Component\\EventDispatcher\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2273,20 +2445,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony EventDispatcher Component",
|
"description": "Symfony EventDispatcher Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-10-30 20:10:21"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/filesystem",
|
"name": "symfony/filesystem",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/filesystem.git",
|
"url": "https://github.com/symfony/filesystem.git",
|
||||||
"reference": "56fd6df73be859323ff97418d97edc1d756df6df"
|
"reference": "8e173509d7fdbbba3cf34d6d072f2073c0210c1d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/56fd6df73be859323ff97418d97edc1d756df6df",
|
"url": "https://api.github.com/repos/symfony/filesystem/zipball/8e173509d7fdbbba3cf34d6d072f2073c0210c1d",
|
||||||
"reference": "56fd6df73be859323ff97418d97edc1d756df6df",
|
"reference": "8e173509d7fdbbba3cf34d6d072f2073c0210c1d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2301,7 +2473,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\Filesystem\\": ""
|
"Symfony\\Component\\Filesystem\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2319,20 +2494,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Filesystem Component",
|
"description": "Symfony Filesystem Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-18 20:23:18"
|
"time": "2015-11-18 13:41:01"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/finder",
|
"name": "symfony/finder",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/finder.git",
|
"url": "https://github.com/symfony/finder.git",
|
||||||
"reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d"
|
"reference": "a06a0c0ff7db3736a50d530c908cca547bf13da9"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/finder/zipball/2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d",
|
"url": "https://api.github.com/repos/symfony/finder/zipball/a06a0c0ff7db3736a50d530c908cca547bf13da9",
|
||||||
"reference": "2ffb4e9598db3c48eb6d0ae73b04bbf09280c59d",
|
"reference": "a06a0c0ff7db3736a50d530c908cca547bf13da9",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2347,7 +2522,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\Finder\\": ""
|
"Symfony\\Component\\Finder\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2365,20 +2543,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Finder Component",
|
"description": "Symfony Finder Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-10-30 20:10:21"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/form",
|
"name": "symfony/form",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/form.git",
|
"url": "https://github.com/symfony/form.git",
|
||||||
"reference": "b93fcb816bec2b8470ea9d54e4b6658b2461b83c"
|
"reference": "0a2c2ce0d4bd3c50bb0ae4e75ac27e5274c25e81"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/form/zipball/b93fcb816bec2b8470ea9d54e4b6658b2461b83c",
|
"url": "https://api.github.com/repos/symfony/form/zipball/0a2c2ce0d4bd3c50bb0ae4e75ac27e5274c25e81",
|
||||||
"reference": "b93fcb816bec2b8470ea9d54e4b6658b2461b83c",
|
"reference": "0a2c2ce0d4bd3c50bb0ae4e75ac27e5274c25e81",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2416,7 +2594,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\Form\\": ""
|
"Symfony\\Component\\Form\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2434,20 +2615,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Form Component",
|
"description": "Symfony Form Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-27 15:38:06"
|
"time": "2015-11-23 10:34:14"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/intl",
|
"name": "symfony/intl",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/intl.git",
|
"url": "https://github.com/symfony/intl.git",
|
||||||
"reference": "330f52a996749eb6a2fdc1506c7a4868e070d678"
|
"reference": "6c6c3aa69f68aff72e48a9bfc11f24680e23eb2d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/intl/zipball/330f52a996749eb6a2fdc1506c7a4868e070d678",
|
"url": "https://api.github.com/repos/symfony/intl/zipball/6c6c3aa69f68aff72e48a9bfc11f24680e23eb2d",
|
||||||
"reference": "330f52a996749eb6a2fdc1506c7a4868e070d678",
|
"reference": "6c6c3aa69f68aff72e48a9bfc11f24680e23eb2d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2474,6 +2655,9 @@
|
|||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"Resources/stubs/functions.php"
|
"Resources/stubs/functions.php"
|
||||||
|
],
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
@ -2508,20 +2692,20 @@
|
|||||||
"l10n",
|
"l10n",
|
||||||
"localization"
|
"localization"
|
||||||
],
|
],
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-11-18 13:41:01"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/options-resolver",
|
"name": "symfony/options-resolver",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/options-resolver.git",
|
"url": "https://github.com/symfony/options-resolver.git",
|
||||||
"reference": "85fd10e551677d3c9a4632def78b8ec4670b247d"
|
"reference": "d6b7d3452b4cfff89b642993e02fea7cc254530e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/85fd10e551677d3c9a4632def78b8ec4670b247d",
|
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/d6b7d3452b4cfff89b642993e02fea7cc254530e",
|
||||||
"reference": "85fd10e551677d3c9a4632def78b8ec4670b247d",
|
"reference": "d6b7d3452b4cfff89b642993e02fea7cc254530e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2536,7 +2720,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\OptionsResolver\\": ""
|
"Symfony\\Component\\OptionsResolver\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2559,20 +2746,20 @@
|
|||||||
"configuration",
|
"configuration",
|
||||||
"options"
|
"options"
|
||||||
],
|
],
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-11-18 13:41:01"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/process",
|
"name": "symfony/process",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/process.git",
|
"url": "https://github.com/symfony/process.git",
|
||||||
"reference": "4a959dd4e19c2c5d7512689413921e0a74386ec7"
|
"reference": "f6290983c8725d0afa29bdc3e5295879de3e58f5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/process/zipball/4a959dd4e19c2c5d7512689413921e0a74386ec7",
|
"url": "https://api.github.com/repos/symfony/process/zipball/f6290983c8725d0afa29bdc3e5295879de3e58f5",
|
||||||
"reference": "4a959dd4e19c2c5d7512689413921e0a74386ec7",
|
"reference": "f6290983c8725d0afa29bdc3e5295879de3e58f5",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2587,7 +2774,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\Process\\": ""
|
"Symfony\\Component\\Process\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2605,20 +2795,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Process Component",
|
"description": "Symfony Process Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-23 14:47:27"
|
"time": "2015-11-19 16:11:24"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/property-access",
|
"name": "symfony/property-access",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/property-access.git",
|
"url": "https://github.com/symfony/property-access.git",
|
||||||
"reference": "368b784738fa932e6d86866038312b03e073a824"
|
"reference": "49d76463a54d8b3005fa58f3b8df41d0ae206eaa"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/property-access/zipball/368b784738fa932e6d86866038312b03e073a824",
|
"url": "https://api.github.com/repos/symfony/property-access/zipball/49d76463a54d8b3005fa58f3b8df41d0ae206eaa",
|
||||||
"reference": "368b784738fa932e6d86866038312b03e073a824",
|
"reference": "49d76463a54d8b3005fa58f3b8df41d0ae206eaa",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2633,7 +2823,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\PropertyAccess\\": ""
|
"Symfony\\Component\\PropertyAccess\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2662,20 +2855,20 @@
|
|||||||
"property path",
|
"property path",
|
||||||
"reflection"
|
"reflection"
|
||||||
],
|
],
|
||||||
"time": "2015-10-23 14:47:27"
|
"time": "2015-11-18 13:41:01"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/routing",
|
"name": "symfony/routing",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/routing.git",
|
"url": "https://github.com/symfony/routing.git",
|
||||||
"reference": "f353e1f588679c3ec987624e6c617646bd01ba38"
|
"reference": "7450f6196711b124fb8b04a12286d01a0401ddfe"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/routing/zipball/f353e1f588679c3ec987624e6c617646bd01ba38",
|
"url": "https://api.github.com/repos/symfony/routing/zipball/7450f6196711b124fb8b04a12286d01a0401ddfe",
|
||||||
"reference": "f353e1f588679c3ec987624e6c617646bd01ba38",
|
"reference": "7450f6196711b124fb8b04a12286d01a0401ddfe",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2708,7 +2901,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\Routing\\": ""
|
"Symfony\\Component\\Routing\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2732,85 +2928,25 @@
|
|||||||
"uri",
|
"uri",
|
||||||
"url"
|
"url"
|
||||||
],
|
],
|
||||||
"time": "2015-10-27 15:38:06"
|
"time": "2015-11-18 13:41:01"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "symfony/translation",
|
|
||||||
"version": "v2.7.6",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/symfony/translation.git",
|
|
||||||
"reference": "6ccd9289ec1c71d01a49d83480de3b5293ce30c8"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/symfony/translation/zipball/6ccd9289ec1c71d01a49d83480de3b5293ce30c8",
|
|
||||||
"reference": "6ccd9289ec1c71d01a49d83480de3b5293ce30c8",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.9"
|
|
||||||
},
|
|
||||||
"conflict": {
|
|
||||||
"symfony/config": "<2.7"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"psr/log": "~1.0",
|
|
||||||
"symfony/config": "~2.7",
|
|
||||||
"symfony/intl": "~2.4",
|
|
||||||
"symfony/yaml": "~2.2"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"psr/log": "To use logging capability in translator",
|
|
||||||
"symfony/config": "",
|
|
||||||
"symfony/yaml": ""
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "2.7-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Component\\Translation\\": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Fabien Potencier",
|
|
||||||
"email": "fabien@symfony.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Symfony Community",
|
|
||||||
"homepage": "https://symfony.com/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Symfony Translation Component",
|
|
||||||
"homepage": "https://symfony.com",
|
|
||||||
"time": "2015-10-27 15:38:06"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/twig-bridge",
|
"name": "symfony/twig-bridge",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/twig-bridge.git",
|
"url": "https://github.com/symfony/twig-bridge.git",
|
||||||
"reference": "3dd44937b1e08af8c8f6b14850f4b9c4d1039c6f"
|
"reference": "7c491aa71af4320747f81ab0140eac4f0ad5509b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/twig-bridge/zipball/3dd44937b1e08af8c8f6b14850f4b9c4d1039c6f",
|
"url": "https://api.github.com/repos/symfony/twig-bridge/zipball/7c491aa71af4320747f81ab0140eac4f0ad5509b",
|
||||||
"reference": "3dd44937b1e08af8c8f6b14850f4b9c4d1039c6f",
|
"reference": "7c491aa71af4320747f81ab0140eac4f0ad5509b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.9",
|
"php": ">=5.3.9",
|
||||||
"twig/twig": "~1.20|~2.0"
|
"twig/twig": "~1.23|~2.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/asset": "~2.7",
|
"symfony/asset": "~2.7",
|
||||||
@ -2852,7 +2988,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Bridge\\Twig\\": ""
|
"Symfony\\Bridge\\Twig\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2870,20 +3009,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Twig Bridge",
|
"description": "Symfony Twig Bridge",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-11-02 20:25:31"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/yaml",
|
"name": "symfony/yaml",
|
||||||
"version": "v2.7.6",
|
"version": "v2.7.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/yaml.git",
|
"url": "https://github.com/symfony/yaml.git",
|
||||||
"reference": "eca9019c88fbe250164affd107bc8057771f3f4d"
|
"reference": "4cfcd7a9fceba662b3c036b7d9a91f6197af046c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d",
|
"url": "https://api.github.com/repos/symfony/yaml/zipball/4cfcd7a9fceba662b3c036b7d9a91f6197af046c",
|
||||||
"reference": "eca9019c88fbe250164affd107bc8057771f3f4d",
|
"reference": "4cfcd7a9fceba662b3c036b7d9a91f6197af046c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2898,7 +3037,10 @@
|
|||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Symfony\\Component\\Yaml\\": ""
|
"Symfony\\Component\\Yaml\\": ""
|
||||||
}
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -2916,7 +3058,7 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Yaml Component",
|
"description": "Symfony Yaml Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2015-10-11 09:39:48"
|
"time": "2015-11-18 13:41:01"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "twig/extensions",
|
"name": "twig/extensions",
|
||||||
|
25
lib/Analytics/Reporter.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
namespace MailPoet\Analytics;
|
||||||
|
|
||||||
|
class Reporter {
|
||||||
|
|
||||||
|
private $fields = array(
|
||||||
|
'Plugin Version' => 'pluginVersion',
|
||||||
|
);
|
||||||
|
|
||||||
|
function __construct() {}
|
||||||
|
|
||||||
|
function getData() {
|
||||||
|
$_this = $this;
|
||||||
|
|
||||||
|
$analytics_data = array_map(function($func) use ($_this) {
|
||||||
|
return $_this->$func();
|
||||||
|
}, $this->fields);
|
||||||
|
|
||||||
|
return $analytics_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function pluginVersion() {
|
||||||
|
return MAILPOET_VERSION;
|
||||||
|
}
|
||||||
|
}
|
@ -23,4 +23,9 @@ class Activator {
|
|||||||
$populator = new Populator();
|
$populator = new Populator();
|
||||||
$populator->up();
|
$populator->up();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deactivate() {
|
||||||
|
$migrator = new Migrator();
|
||||||
|
$migrator->down();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
33
lib/Config/Analytics.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
namespace MailPoet\Config;
|
||||||
|
use \MailPoet\Analytics\Reporter;
|
||||||
|
use \MailPoet\Models\Setting;
|
||||||
|
|
||||||
|
if(!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
|
class Analytics {
|
||||||
|
function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// review: this creates a fatal error when mailpoet tables are dropped.
|
||||||
|
//add_action('admin_enqueue_scripts', array($this, 'setupAdminDependencies'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupAdminDependencies() {
|
||||||
|
if(Setting::getValue('send_analytics_now', false)) {
|
||||||
|
$analytics = new Reporter();
|
||||||
|
wp_enqueue_script(
|
||||||
|
'analytics',
|
||||||
|
Env::$assets_url . '/js/lib/analytics.js',
|
||||||
|
array(),
|
||||||
|
Env::$version
|
||||||
|
);
|
||||||
|
wp_localize_script(
|
||||||
|
'analytics',
|
||||||
|
'mailpoet_analytics_data',
|
||||||
|
$analytics->getData()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
61
lib/Config/Changelog.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
namespace MailPoet\Config;
|
||||||
|
use \MailPoet\Models\Setting;
|
||||||
|
|
||||||
|
class Changelog {
|
||||||
|
function init() {
|
||||||
|
$doing_ajax = (bool)(defined('DOING_AJAX') && DOING_AJAX);
|
||||||
|
|
||||||
|
// don't run any check when it's an ajax request
|
||||||
|
if($doing_ajax) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't run any check when we're not on our pages
|
||||||
|
if(
|
||||||
|
!(isset($_GET['page']))
|
||||||
|
or
|
||||||
|
(isset($_GET['page']) && strpos($_GET['page'], 'mailpoet') !== 0)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action(
|
||||||
|
'admin_init',
|
||||||
|
array($this, 'check')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function check() {
|
||||||
|
$version = Setting::getValue('version', null);
|
||||||
|
$redirect_url = null;
|
||||||
|
|
||||||
|
if($version === null) {
|
||||||
|
// new install
|
||||||
|
$redirect_url = admin_url('admin.php?page=mailpoet-welcome');
|
||||||
|
} else if($version !== Env::$version) {
|
||||||
|
// update
|
||||||
|
$redirect_url = admin_url('admin.php?page=mailpoet-update');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($redirect_url !== null) {
|
||||||
|
// save version number
|
||||||
|
Setting::setValue('version', Env::$version);
|
||||||
|
|
||||||
|
global $wp;
|
||||||
|
$current_url = home_url(add_query_arg($wp->query_string, $wp->request));
|
||||||
|
|
||||||
|
if($redirect_url !== $current_url) {
|
||||||
|
wp_safe_redirect(
|
||||||
|
add_query_arg(
|
||||||
|
array(
|
||||||
|
'mailpoet_redirect' => urlencode($current_url)
|
||||||
|
),
|
||||||
|
$redirect_url
|
||||||
|
)
|
||||||
|
);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,53 +4,87 @@ namespace MailPoet\Config;
|
|||||||
if(!defined('ABSPATH')) exit;
|
if(!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
class Env {
|
class Env {
|
||||||
public static $version;
|
static $version;
|
||||||
public static $plugin_name;
|
static $plugin_name;
|
||||||
public static $file;
|
static $plugin_path;
|
||||||
public static $path;
|
static $file;
|
||||||
public static $views_path;
|
static $path;
|
||||||
public static $assets_path;
|
static $views_path;
|
||||||
public static $assets_url;
|
static $assets_path;
|
||||||
public static $languages_path;
|
static $assets_url;
|
||||||
public static $lib_path;
|
static $temp_path;
|
||||||
public static $plugin_prefix;
|
static $temp_URL;
|
||||||
public static $db_prefix;
|
static $languages_path;
|
||||||
public static $db_source_name;
|
static $lib_path;
|
||||||
public static $db_host;
|
static $plugin_prefix;
|
||||||
public static $db_name;
|
static $db_prefix;
|
||||||
public static $db_username;
|
static $db_source_name;
|
||||||
public static $db_password;
|
static $db_host;
|
||||||
public static $db_charset;
|
static $db_socket;
|
||||||
|
static $db_port;
|
||||||
|
static $db_name;
|
||||||
|
static $db_username;
|
||||||
|
static $db_password;
|
||||||
|
static $db_charset;
|
||||||
|
|
||||||
public static function init($file, $version) {
|
static function init($file, $version) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
self::$version = $version;
|
self::$version = $version;
|
||||||
self::$plugin_name = 'mailpoet';
|
|
||||||
self::$file = $file;
|
self::$file = $file;
|
||||||
self::$path = dirname(self::$file);
|
self::$path = dirname(self::$file);
|
||||||
|
self::$plugin_name = 'mailpoet';
|
||||||
self::$views_path = self::$path . '/views';
|
self::$views_path = self::$path . '/views';
|
||||||
self::$assets_path = self::$path . '/assets';
|
self::$assets_path = self::$path . '/assets';
|
||||||
self::$assets_url = plugins_url('/assets', $file);
|
self::$assets_url = plugins_url('/assets', $file);
|
||||||
|
self::$temp_path = wp_upload_dir()['path'];
|
||||||
|
self::$temp_URL = wp_upload_dir()['url'];
|
||||||
self::$languages_path = self::$path . '/lang';
|
self::$languages_path = self::$path . '/lang';
|
||||||
self::$lib_path = self::$path . '/lib';
|
self::$lib_path = self::$path . '/lib';
|
||||||
self::$plugin_prefix = 'mailpoet_';
|
self::$plugin_prefix = 'mailpoet_';
|
||||||
self::$db_prefix = $wpdb->prefix . self::$plugin_prefix;
|
self::$db_prefix = $wpdb->prefix . self::$plugin_prefix;
|
||||||
self::$db_source_name = self::dbSourceName();
|
|
||||||
self::$db_host = DB_HOST;
|
self::$db_host = DB_HOST;
|
||||||
|
self::$db_port = 3306;
|
||||||
|
self::$db_socket = false;
|
||||||
|
if(preg_match('/(?=:\d+$)/', DB_HOST)) {
|
||||||
|
list(self::$db_host, self::$db_port) = explode(':', DB_HOST);
|
||||||
|
} else {
|
||||||
|
if(preg_match('/:/', DB_HOST)) {
|
||||||
|
self::$db_socket = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
self::$db_name = DB_NAME;
|
self::$db_name = DB_NAME;
|
||||||
self::$db_username = DB_USER;
|
self::$db_username = DB_USER;
|
||||||
self::$db_password = DB_PASSWORD;
|
self::$db_password = DB_PASSWORD;
|
||||||
self::$db_charset = $wpdb->get_charset_collate();
|
self::$db_charset = $wpdb->get_charset_collate();
|
||||||
|
self::$db_source_name = self::dbSourceName(self::$db_host, self::$db_socket, self::$db_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function dbSourceName() {
|
private static function dbSourceName($host, $socket, $port) {
|
||||||
$source_name = array(
|
$source_name = array(
|
||||||
'mysql:host=',
|
(!$socket) ? 'mysql:host=' : 'mysql:unix_socket=',
|
||||||
DB_HOST,
|
$host,
|
||||||
|
';',
|
||||||
|
'port=',
|
||||||
|
$port,
|
||||||
';',
|
';',
|
||||||
'dbname=',
|
'dbname=',
|
||||||
DB_NAME
|
DB_NAME
|
||||||
);
|
);
|
||||||
return implode('', $source_name);
|
return implode('', $source_name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
static function isPluginActivated() {
|
||||||
|
$activatesPlugins = get_option('active_plugins');
|
||||||
|
$isActivated = (
|
||||||
|
in_array(
|
||||||
|
sprintf('%s/%s.php', basename(self::$path), self::$plugin_name),
|
||||||
|
$activatesPlugins
|
||||||
|
) ||
|
||||||
|
in_array(
|
||||||
|
sprintf('%s/%s.php', explode('/', plugin_basename(__FILE__))[0], self::$plugin_name),
|
||||||
|
$activatesPlugins
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return ($isActivated) ? true : false;
|
||||||
|
}
|
||||||
|
}
|
106
lib/Config/Hooks.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
namespace MailPoet\Config;
|
||||||
|
use \MailPoet\Models\Setting;
|
||||||
|
|
||||||
|
class Hooks {
|
||||||
|
function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// Subscribe in comments
|
||||||
|
if((bool)Setting::getValue('subscribe.on_comment.enabled')) {
|
||||||
|
add_action(
|
||||||
|
'comment_form_after_fields',
|
||||||
|
'\MailPoet\Subscription\Comment::extendForm'
|
||||||
|
);
|
||||||
|
|
||||||
|
add_action(
|
||||||
|
'comment_post',
|
||||||
|
'\MailPoet\Subscription\Comment::onSubmit',
|
||||||
|
60,
|
||||||
|
2
|
||||||
|
);
|
||||||
|
|
||||||
|
add_action(
|
||||||
|
'wp_set_comment_status',
|
||||||
|
'\MailPoet\Subscription\Comment::onStatusUpdate',
|
||||||
|
60,
|
||||||
|
2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subscribe in registration form
|
||||||
|
if((bool)Setting::getValue('subscribe.on_register.enabled')) {
|
||||||
|
if(is_multisite()) {
|
||||||
|
add_action(
|
||||||
|
'signup_extra_fields',
|
||||||
|
'\MailPoet\Subscription\Registration::extendForm'
|
||||||
|
);
|
||||||
|
add_action(
|
||||||
|
'wpmu_validate_user_signup',
|
||||||
|
'\MailPoet\Subscription\Registration::onMultiSiteRegister',
|
||||||
|
60,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
add_action(
|
||||||
|
'register_form',
|
||||||
|
'\MailPoet\Subscription\Registration::extendForm'
|
||||||
|
);
|
||||||
|
add_action(
|
||||||
|
'register_post',
|
||||||
|
'\MailPoet\Subscription\Registration::onRegister',
|
||||||
|
60,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WP Users synchronization
|
||||||
|
add_action(
|
||||||
|
'user_register',
|
||||||
|
'\MailPoet\Segments\WP::synchronizeUser',
|
||||||
|
1
|
||||||
|
);
|
||||||
|
add_action(
|
||||||
|
'added_existing_user',
|
||||||
|
'\MailPoet\Segments\WP::synchronizeUser',
|
||||||
|
1
|
||||||
|
);
|
||||||
|
add_action(
|
||||||
|
'profile_update',
|
||||||
|
'\MailPoet\Segments\WP::synchronizeUser',
|
||||||
|
1
|
||||||
|
);
|
||||||
|
add_action(
|
||||||
|
'delete_user',
|
||||||
|
'\MailPoet\Segments\WP::synchronizeUser',
|
||||||
|
1
|
||||||
|
);
|
||||||
|
// multisite
|
||||||
|
add_action(
|
||||||
|
'deleted_user',
|
||||||
|
'\MailPoet\Segments\WP::synchronizeUser',
|
||||||
|
1
|
||||||
|
);
|
||||||
|
add_action(
|
||||||
|
'remove_user_from_blog',
|
||||||
|
'\MailPoet\Segments\WP::synchronizeUser',
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'image_size_names_choose',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'appendImageSizes'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendImageSizes($sizes) {
|
||||||
|
return array_merge($sizes, array(
|
||||||
|
'mailpoet_newsletter_max' => __('MailPoet Newsletter'),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,10 @@
|
|||||||
namespace MailPoet\Config;
|
namespace MailPoet\Config;
|
||||||
|
|
||||||
use MailPoet\Models;
|
use MailPoet\Models;
|
||||||
|
use MailPoet\Cron\Supervisor;
|
||||||
use MailPoet\Router;
|
use MailPoet\Router;
|
||||||
|
use MailPoet\Models\Setting;
|
||||||
|
use MailPoet\Settings\Pages;
|
||||||
|
|
||||||
if(!defined('ABSPATH')) exit;
|
if(!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
@ -22,7 +25,15 @@ class Initializer {
|
|||||||
$this->setupMenu();
|
$this->setupMenu();
|
||||||
$this->setupRouter();
|
$this->setupRouter();
|
||||||
$this->setupWidget();
|
$this->setupWidget();
|
||||||
|
$this->setupAnalytics();
|
||||||
$this->setupPermissions();
|
$this->setupPermissions();
|
||||||
|
$this->setupChangelog();
|
||||||
|
$this->setupPublicAPI();
|
||||||
|
$this->runQueueSupervisor();
|
||||||
|
$this->setupShortcodes();
|
||||||
|
$this->setupHooks();
|
||||||
|
$this->setupPages();
|
||||||
|
$this->setupImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupDB() {
|
function setupDB() {
|
||||||
@ -31,7 +42,8 @@ class Initializer {
|
|||||||
\ORM::configure('password', Env::$db_password);
|
\ORM::configure('password', Env::$db_password);
|
||||||
\ORM::configure('logging', WP_DEBUG);
|
\ORM::configure('logging', WP_DEBUG);
|
||||||
\ORM::configure('driver_options', array(
|
\ORM::configure('driver_options', array(
|
||||||
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
|
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
|
||||||
|
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET TIME_ZONE = "+00:00"'
|
||||||
));
|
));
|
||||||
|
|
||||||
$subscribers = Env::$db_prefix . 'subscribers';
|
$subscribers = Env::$db_prefix . 'subscribers';
|
||||||
@ -39,6 +51,8 @@ class Initializer {
|
|||||||
$newsletters = Env::$db_prefix . 'newsletters';
|
$newsletters = Env::$db_prefix . 'newsletters';
|
||||||
$newsletter_templates = Env::$db_prefix . 'newsletter_templates';
|
$newsletter_templates = Env::$db_prefix . 'newsletter_templates';
|
||||||
$segments = Env::$db_prefix . 'segments';
|
$segments = Env::$db_prefix . 'segments';
|
||||||
|
$filters = Env::$db_prefix . 'filters';
|
||||||
|
$segment_filter = Env::$db_prefix . 'segment_filter';
|
||||||
$forms = Env::$db_prefix . 'forms';
|
$forms = Env::$db_prefix . 'forms';
|
||||||
$subscriber_segment = Env::$db_prefix . 'subscriber_segment';
|
$subscriber_segment = Env::$db_prefix . 'subscriber_segment';
|
||||||
$newsletter_segment = Env::$db_prefix . 'newsletter_segment';
|
$newsletter_segment = Env::$db_prefix . 'newsletter_segment';
|
||||||
@ -46,11 +60,15 @@ class Initializer {
|
|||||||
$subscriber_custom_field = Env::$db_prefix . 'subscriber_custom_field';
|
$subscriber_custom_field = Env::$db_prefix . 'subscriber_custom_field';
|
||||||
$newsletter_option_fields = Env::$db_prefix . 'newsletter_option_fields';
|
$newsletter_option_fields = Env::$db_prefix . 'newsletter_option_fields';
|
||||||
$newsletter_option = Env::$db_prefix . 'newsletter_option';
|
$newsletter_option = Env::$db_prefix . 'newsletter_option';
|
||||||
|
$sending_queues = Env::$db_prefix . 'sending_queues';
|
||||||
|
$newsletter_statistics = Env::$db_prefix . 'newsletter_statistics';
|
||||||
|
|
||||||
define('MP_SUBSCRIBERS_TABLE', $subscribers);
|
define('MP_SUBSCRIBERS_TABLE', $subscribers);
|
||||||
define('MP_SETTINGS_TABLE', $settings);
|
define('MP_SETTINGS_TABLE', $settings);
|
||||||
define('MP_NEWSLETTERS_TABLE', $newsletters);
|
define('MP_NEWSLETTERS_TABLE', $newsletters);
|
||||||
define('MP_SEGMENTS_TABLE', $segments);
|
define('MP_SEGMENTS_TABLE', $segments);
|
||||||
|
define('MP_FILTERS_TABLE', $filters);
|
||||||
|
define('MP_SEGMENT_FILTER_TABLE', $segment_filter);
|
||||||
define('MP_FORMS_TABLE', $forms);
|
define('MP_FORMS_TABLE', $forms);
|
||||||
define('MP_SUBSCRIBER_SEGMENT_TABLE', $subscriber_segment);
|
define('MP_SUBSCRIBER_SEGMENT_TABLE', $subscriber_segment);
|
||||||
define('MP_NEWSLETTER_TEMPLATES_TABLE', $newsletter_templates);
|
define('MP_NEWSLETTER_TEMPLATES_TABLE', $newsletter_templates);
|
||||||
@ -59,6 +77,8 @@ class Initializer {
|
|||||||
define('MP_SUBSCRIBER_CUSTOM_FIELD_TABLE', $subscriber_custom_field);
|
define('MP_SUBSCRIBER_CUSTOM_FIELD_TABLE', $subscriber_custom_field);
|
||||||
define('MP_NEWSLETTER_OPTION_FIELDS_TABLE', $newsletter_option_fields);
|
define('MP_NEWSLETTER_OPTION_FIELDS_TABLE', $newsletter_option_fields);
|
||||||
define('MP_NEWSLETTER_OPTION_TABLE', $newsletter_option);
|
define('MP_NEWSLETTER_OPTION_TABLE', $newsletter_option);
|
||||||
|
define('MP_SENDING_QUEUES_TABLE', $sending_queues);
|
||||||
|
define('MP_NEWSLETTER_STATISTICS_TABLE', $newsletter_statistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupActivator() {
|
function setupActivator() {
|
||||||
@ -94,8 +114,50 @@ class Initializer {
|
|||||||
$widget->init();
|
$widget->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupAnalytics() {
|
||||||
|
$widget = new Analytics();
|
||||||
|
$widget->init();
|
||||||
|
}
|
||||||
|
|
||||||
function setupPermissions() {
|
function setupPermissions() {
|
||||||
$permissions = new Permissions();
|
$permissions = new Permissions();
|
||||||
$permissions->init();
|
$permissions->init();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
function setupChangelog() {
|
||||||
|
$changelog = new Changelog();
|
||||||
|
$changelog->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupPages() {
|
||||||
|
$pages = new Pages();
|
||||||
|
$pages->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupShortcodes() {
|
||||||
|
$shortcodes = new Shortcodes();
|
||||||
|
$shortcodes->init();
|
||||||
|
}
|
||||||
|
function setupHooks() {
|
||||||
|
$hooks = new Hooks();
|
||||||
|
$hooks->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupPublicAPI() {
|
||||||
|
$publicAPI = new PublicAPI();
|
||||||
|
$publicAPI->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
function runQueueSupervisor() {
|
||||||
|
if(php_sapi_name() === 'cli') return;
|
||||||
|
try {
|
||||||
|
$supervisor = new Supervisor();
|
||||||
|
$supervisor->checkDaemon();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupImages() {
|
||||||
|
add_image_size('mailpoet_newsletter_max', 1320);
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace MailPoet\Config;
|
namespace MailPoet\Config;
|
||||||
use \MailPoet\Models\Segment;
|
|
||||||
use \MailPoet\Models\Setting;
|
use MailPoet\Form\Block;
|
||||||
use \MailPoet\Models\Form;
|
use MailPoet\Form\Renderer as FormRenderer;
|
||||||
use \MailPoet\Form\Block;
|
use MailPoet\Models\CustomField;
|
||||||
use \MailPoet\Form\Renderer as FormRenderer;
|
use MailPoet\Models\Form;
|
||||||
use \MailPoet\Settings\Hosts;
|
use MailPoet\Models\Segment;
|
||||||
use \MailPoet\Settings\Pages;
|
use MailPoet\Models\Setting;
|
||||||
use \MailPoet\Settings\Charsets;
|
use MailPoet\Settings\Charsets;
|
||||||
use \MailPoet\Util\Permissions;
|
use MailPoet\Settings\Hosts;
|
||||||
use \MailPoet\Util\DKIM;
|
use MailPoet\Settings\Pages;
|
||||||
|
use MailPoet\Subscribers\ImportExport\BootStrapMenu;
|
||||||
|
use MailPoet\Util\DKIM;
|
||||||
|
use MailPoet\Util\Permissions;
|
||||||
|
|
||||||
if(!defined('ABSPATH')) exit;
|
if(!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
@ -22,7 +25,10 @@ class Menu {
|
|||||||
function init() {
|
function init() {
|
||||||
add_action(
|
add_action(
|
||||||
'admin_menu',
|
'admin_menu',
|
||||||
array($this, 'setup')
|
array(
|
||||||
|
$this,
|
||||||
|
'setup'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +38,10 @@ class Menu {
|
|||||||
'MailPoet',
|
'MailPoet',
|
||||||
'manage_options',
|
'manage_options',
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
array($this, 'home'),
|
array(
|
||||||
|
$this,
|
||||||
|
'home'
|
||||||
|
),
|
||||||
$this->assets_url . '/img/menu_icon.png',
|
$this->assets_url . '/img/menu_icon.png',
|
||||||
30
|
30
|
||||||
);
|
);
|
||||||
@ -42,7 +51,10 @@ class Menu {
|
|||||||
__('Newsletters'),
|
__('Newsletters'),
|
||||||
'manage_options',
|
'manage_options',
|
||||||
'mailpoet-newsletters',
|
'mailpoet-newsletters',
|
||||||
array($this, 'newsletters')
|
array(
|
||||||
|
$this,
|
||||||
|
'newsletters'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
@ -50,7 +62,10 @@ class Menu {
|
|||||||
__('Forms'),
|
__('Forms'),
|
||||||
'manage_options',
|
'manage_options',
|
||||||
'mailpoet-forms',
|
'mailpoet-forms',
|
||||||
array($this, 'forms')
|
array(
|
||||||
|
$this,
|
||||||
|
'forms'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
@ -58,7 +73,10 @@ class Menu {
|
|||||||
__('Subscribers'),
|
__('Subscribers'),
|
||||||
'manage_options',
|
'manage_options',
|
||||||
'mailpoet-subscribers',
|
'mailpoet-subscribers',
|
||||||
array($this, 'subscribers')
|
array(
|
||||||
|
$this,
|
||||||
|
'subscribers'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
@ -66,7 +84,10 @@ class Menu {
|
|||||||
__('Segments'),
|
__('Segments'),
|
||||||
'manage_options',
|
'manage_options',
|
||||||
'mailpoet-segments',
|
'mailpoet-segments',
|
||||||
array($this, 'segments')
|
array(
|
||||||
|
$this,
|
||||||
|
'segments'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
@ -74,32 +95,93 @@ class Menu {
|
|||||||
__('Settings'),
|
__('Settings'),
|
||||||
'manage_options',
|
'manage_options',
|
||||||
'mailpoet-settings',
|
'mailpoet-settings',
|
||||||
array($this, 'settings')
|
array(
|
||||||
|
$this,
|
||||||
|
'settings'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
add_submenu_page(
|
||||||
|
null,
|
||||||
|
__('Import'),
|
||||||
|
__('Import'),
|
||||||
|
'manage_options',
|
||||||
|
'mailpoet-import',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'import'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
add_submenu_page(
|
||||||
|
null,
|
||||||
|
__('Export'),
|
||||||
|
__('Export'),
|
||||||
|
'manage_options',
|
||||||
|
'mailpoet-export',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'export'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
// add_submenu_page(
|
|
||||||
// 'mailpoet',
|
|
||||||
// __('Newsletter editor'),
|
|
||||||
// __('Newsletter editor'),
|
|
||||||
// 'manage_options',
|
|
||||||
// 'mailpoet-newsletter-editor',
|
|
||||||
// array($this, 'newletterEditor')
|
|
||||||
// );
|
|
||||||
$this->registered_pages();
|
|
||||||
}
|
|
||||||
|
|
||||||
function registered_pages() {
|
add_submenu_page(
|
||||||
global $_registered_pages;
|
null,
|
||||||
$pages = array(
|
__('Welcome'),
|
||||||
'mailpoet-form-editor' => array($this, 'formEditor'),
|
__('Welcome'),
|
||||||
'mailpoet-newsletter-editor' => array($this, 'newletterEditor')
|
'manage_options',
|
||||||
|
'mailpoet-welcome',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'welcome'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
add_submenu_page(
|
||||||
|
null,
|
||||||
|
__('Update'),
|
||||||
|
__('Update'),
|
||||||
|
'manage_options',
|
||||||
|
'mailpoet-update',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'update'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
add_submenu_page(
|
||||||
|
null,
|
||||||
|
__('Form editor'),
|
||||||
|
__('Form editor'),
|
||||||
|
'manage_options',
|
||||||
|
'mailpoet-form-editor',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'formEditor'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
add_submenu_page(
|
||||||
|
null,
|
||||||
|
__('Newsletter editor'),
|
||||||
|
__('Newsletter editor'),
|
||||||
|
'manage_options',
|
||||||
|
'mailpoet-newsletter-editor',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'newletterEditor'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
add_submenu_page(
|
||||||
|
'mailpoet',
|
||||||
|
__('Cron'),
|
||||||
|
__('Cron'),
|
||||||
|
'manage_options',
|
||||||
|
'mailpoet-cron',
|
||||||
|
array(
|
||||||
|
$this,
|
||||||
|
'cron'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
foreach($pages as $menu_slug => $callback) {
|
|
||||||
$hookname = get_plugin_page_hookname($menu_slug, null);
|
|
||||||
if(!empty($hookname)) {
|
|
||||||
add_action($hookname, $callback);
|
|
||||||
}
|
|
||||||
$_registered_pages[$hookname] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function home() {
|
function home() {
|
||||||
@ -107,27 +189,60 @@ class Menu {
|
|||||||
echo $this->renderer->render('index.html', $data);
|
echo $this->renderer->render('index.html', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function settings() {
|
function welcome() {
|
||||||
// flags (available features on WP install)
|
if((bool)(defined('DOING_AJAX') && DOING_AJAX)) return;
|
||||||
$flags = array();
|
|
||||||
|
|
||||||
if(is_multisite()) {
|
global $wp;
|
||||||
// get multisite registration option
|
$current_url = home_url(add_query_arg($wp->query_string, $wp->request));
|
||||||
$registration = apply_filters(
|
$redirect_url =
|
||||||
'wpmu_registration_enabled',
|
(!empty($_GET['mailpoet_redirect']))
|
||||||
get_site_option('registration', 'all')
|
? urldecode($_GET['mailpoet_redirect'])
|
||||||
);
|
: wp_get_referer();
|
||||||
|
|
||||||
// check if users can register
|
if(
|
||||||
$flags['registration_enabled'] =
|
$redirect_url === $current_url
|
||||||
!(in_array($registration, array('none', 'blog')));
|
or
|
||||||
} else {
|
strpos($redirect_url, 'mailpoet') === false
|
||||||
// check if users can register
|
) {
|
||||||
$flags['registration_enabled'] =
|
$redirect_url = admin_url('admin.php?page=mailpoet');
|
||||||
(bool)get_option('users_can_register', false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'settings' => Setting::getAll(),
|
||||||
|
'current_user' => wp_get_current_user(),
|
||||||
|
'redirect_url' => $redirect_url
|
||||||
|
);
|
||||||
|
echo $this->renderer->render('welcome.html', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
global $wp;
|
||||||
|
$current_url = home_url(add_query_arg($wp->query_string, $wp->request));
|
||||||
|
$redirect_url =
|
||||||
|
(!empty($_GET['mailpoet_redirect']))
|
||||||
|
? urldecode($_GET['mailpoet_redirect'])
|
||||||
|
: wp_get_referer();
|
||||||
|
|
||||||
|
if(
|
||||||
|
$redirect_url === $current_url
|
||||||
|
or
|
||||||
|
strpos($redirect_url, 'mailpoet') === false
|
||||||
|
) {
|
||||||
|
$redirect_url = admin_url('admin.php?page=mailpoet');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'settings' => Setting::getAll(),
|
||||||
|
'current_user' => wp_get_current_user(),
|
||||||
|
'redirect_url' => $redirect_url
|
||||||
|
);
|
||||||
|
|
||||||
|
echo $this->renderer->render('update.html', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function settings() {
|
||||||
$settings = Setting::getAll();
|
$settings = Setting::getAll();
|
||||||
|
$flags = $this->_getFlags();
|
||||||
|
|
||||||
// dkim: check if public/private keys have been generated
|
// dkim: check if public/private keys have been generated
|
||||||
if(
|
if(
|
||||||
@ -146,7 +261,7 @@ class Menu {
|
|||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'segments' => Segment::findArray(),
|
'segments' => Segment::getPublic()->findArray(),
|
||||||
'pages' => Pages::getAll(),
|
'pages' => Pages::getAll(),
|
||||||
'flags' => $flags,
|
'flags' => $flags,
|
||||||
'charsets' => Charsets::getAll(),
|
'charsets' => Charsets::getAll(),
|
||||||
@ -161,12 +276,38 @@ class Menu {
|
|||||||
echo $this->renderer->render('settings.html', $data);
|
echo $this->renderer->render('settings.html', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function _getFlags() {
|
||||||
|
// flags (available features on WP install)
|
||||||
|
$flags = array();
|
||||||
|
|
||||||
|
if(is_multisite()) {
|
||||||
|
// get multisite registration option
|
||||||
|
$registration = apply_filters(
|
||||||
|
'wpmu_registration_enabled',
|
||||||
|
get_site_option('registration', 'all')
|
||||||
|
);
|
||||||
|
|
||||||
|
// check if users can register
|
||||||
|
$flags['registration_enabled'] =
|
||||||
|
!(in_array($registration, array(
|
||||||
|
'none',
|
||||||
|
'blog'
|
||||||
|
)));
|
||||||
|
} else {
|
||||||
|
// check if users can register
|
||||||
|
$flags['registration_enabled'] =
|
||||||
|
(bool) get_option('users_can_register', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $flags;
|
||||||
|
}
|
||||||
|
|
||||||
function subscribers() {
|
function subscribers() {
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
$data['segments'] = Segment::findArray();
|
$data['segments'] = Segment::findArray();
|
||||||
|
|
||||||
echo $this->renderer->render('subscribers.html', $data);
|
echo $this->renderer->render('subscribers/subscribers.html', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function segments() {
|
function segments() {
|
||||||
@ -187,25 +328,42 @@ class Menu {
|
|||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
$data['segments'] = Segment::findArray();
|
$data['segments'] = Segment::findArray();
|
||||||
$settings = Setting::findArray();
|
$data['settings'] = Setting::getAll();
|
||||||
$data['settings'] = array();
|
|
||||||
foreach($settings as $setting) {
|
|
||||||
$data['settings'][$setting['name']] = $setting['value'];
|
|
||||||
}
|
|
||||||
$data['roles'] = $wp_roles->get_names();
|
$data['roles'] = $wp_roles->get_names();
|
||||||
echo $this->renderer->render('newsletters.html', $data);
|
echo $this->renderer->render('newsletters.html', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function newletterEditor() {
|
function newletterEditor() {
|
||||||
$data = array();
|
$custom_fields = array_map(function($field) {
|
||||||
|
return array(
|
||||||
|
'text' => $field['name'],
|
||||||
|
'shortcode' => 'field:' . $field['id'],
|
||||||
|
);
|
||||||
|
}, CustomField::findArray());
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'customFields' => $custom_fields,
|
||||||
|
);
|
||||||
wp_enqueue_media();
|
wp_enqueue_media();
|
||||||
wp_enqueue_script('tinymce-wplink', includes_url('js/tinymce/plugins/wplink/plugin.js'));
|
wp_enqueue_script('tinymce-wplink', includes_url('js/tinymce/plugins/wplink/plugin.js'));
|
||||||
wp_enqueue_style('editor', includes_url('css/editor.css'));
|
wp_enqueue_style('editor', includes_url('css/editor.css'));
|
||||||
echo $this->renderer->render('newsletter/form.html', $data);
|
echo $this->renderer->render('newsletter/form.html', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function import() {
|
||||||
|
$import = new BootStrapMenu('import');
|
||||||
|
$data = $import->bootstrap();
|
||||||
|
echo $this->renderer->render('subscribers/importExport/import.html', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function export() {
|
||||||
|
$export = new BootStrapMenu('export');
|
||||||
|
$data = $export->bootstrap();
|
||||||
|
echo $this->renderer->render('subscribers/importExport/export.html', $data);
|
||||||
|
}
|
||||||
|
|
||||||
function formEditor() {
|
function formEditor() {
|
||||||
$id = (isset($_GET['id']) ? (int)$_GET['id'] : 0);
|
$id = (isset($_GET['id']) ? (int) $_GET['id'] : 0);
|
||||||
$form = Form::findOne($id);
|
$form = Form::findOne($id);
|
||||||
if($form !== false) {
|
if($form !== false) {
|
||||||
$form = $form->asArray();
|
$form = $form->asArray();
|
||||||
@ -214,12 +372,18 @@ class Menu {
|
|||||||
$data = array(
|
$data = array(
|
||||||
'form' => $form,
|
'form' => $form,
|
||||||
'pages' => Pages::getAll(),
|
'pages' => Pages::getAll(),
|
||||||
'segments' => Segment::findArray(),
|
'segments' => Segment::getPublic()
|
||||||
|
->findArray(),
|
||||||
'styles' => FormRenderer::getStyles($form),
|
'styles' => FormRenderer::getStyles($form),
|
||||||
'date_types' => Block\Date::getDateTypes(),
|
'date_types' => Block\Date::getDateTypes(),
|
||||||
'date_formats' => Block\Date::getDateFormats()
|
'date_formats' => Block\Date::getDateFormats(),
|
||||||
|
'month_names' => Block\Date::getMonthNames()
|
||||||
);
|
);
|
||||||
|
|
||||||
echo $this->renderer->render('form/editor.html', $data);
|
echo $this->renderer->render('form/editor.html', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cron() {
|
||||||
|
echo $this->renderer->render('cron.html');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ class Migrator {
|
|||||||
'subscriber_custom_field',
|
'subscriber_custom_field',
|
||||||
'newsletter_option_fields',
|
'newsletter_option_fields',
|
||||||
'newsletter_option',
|
'newsletter_option',
|
||||||
|
'sending_queues',
|
||||||
|
'newsletter_statistics',
|
||||||
'forms'
|
'forms'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -39,7 +41,7 @@ class Migrator {
|
|||||||
function down() {
|
function down() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$drop_table = function($model) {
|
$drop_table = function($model) use($wpdb) {
|
||||||
$table = $this->prefix . $model;
|
$table = $this->prefix . $model;
|
||||||
$wpdb->query("DROP TABLE {$table}");
|
$wpdb->query("DROP TABLE {$table}");
|
||||||
};
|
};
|
||||||
@ -50,6 +52,7 @@ class Migrator {
|
|||||||
function subscribers() {
|
function subscribers() {
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
||||||
|
'wp_user_id bigint(20) NULL,',
|
||||||
'first_name tinytext NOT NULL,',
|
'first_name tinytext NOT NULL,',
|
||||||
'last_name tinytext NOT NULL,',
|
'last_name tinytext NOT NULL,',
|
||||||
'email varchar(150) NOT NULL,',
|
'email varchar(150) NOT NULL,',
|
||||||
@ -81,6 +84,10 @@ class Migrator {
|
|||||||
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
||||||
'subject varchar(250) NOT NULL,',
|
'subject varchar(250) NOT NULL,',
|
||||||
'type varchar(20) NOT NULL DEFAULT "standard",',
|
'type varchar(20) NOT NULL DEFAULT "standard",',
|
||||||
|
'sender_address varchar(150) NOT NULL,',
|
||||||
|
'sender_name varchar(150) NOT NULL,',
|
||||||
|
'reply_to_address varchar(150) NOT NULL,',
|
||||||
|
'reply_to_name varchar(150) NOT NULL,',
|
||||||
'preheader varchar(250) NOT NULL,',
|
'preheader varchar(250) NOT NULL,',
|
||||||
'body longtext,',
|
'body longtext,',
|
||||||
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
@ -96,7 +103,9 @@ class Migrator {
|
|||||||
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
||||||
'name varchar(250) NOT NULL,',
|
'name varchar(250) NOT NULL,',
|
||||||
'description varchar(250) NOT NULL,',
|
'description varchar(250) NOT NULL,',
|
||||||
'body longtext,',
|
'body LONGTEXT,',
|
||||||
|
'thumbnail LONGTEXT,',
|
||||||
|
'readonly TINYINT(1) DEFAULT 0,',
|
||||||
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
'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)'
|
||||||
@ -106,14 +115,15 @@ class Migrator {
|
|||||||
|
|
||||||
function segments() {
|
function segments() {
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
||||||
'name varchar(90) NOT NULL,',
|
'name varchar(90) NOT NULL,',
|
||||||
'description varchar(250) NOT NULL,',
|
'type varchar(90) NOT NULL DEFAULT "default",',
|
||||||
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
'description varchar(250) NOT NULL,',
|
||||||
'deleted_at TIMESTAMP NULL DEFAULT NULL,',
|
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
|
'deleted_at TIMESTAMP NULL DEFAULT NULL,',
|
||||||
'PRIMARY KEY (id),',
|
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
|
||||||
'UNIQUE KEY name (name)'
|
'PRIMARY KEY (id),',
|
||||||
|
'UNIQUE KEY name (name)'
|
||||||
);
|
);
|
||||||
return $this->sqlify(__FUNCTION__, $attributes);
|
return $this->sqlify(__FUNCTION__, $attributes);
|
||||||
}
|
}
|
||||||
@ -123,6 +133,7 @@ class Migrator {
|
|||||||
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
||||||
'subscriber_id mediumint(9) NOT NULL,',
|
'subscriber_id mediumint(9) NOT NULL,',
|
||||||
'segment_id mediumint(9) NOT NULL,',
|
'segment_id mediumint(9) NOT NULL,',
|
||||||
|
'status varchar(12) NOT NULL DEFAULT "subscribed",',
|
||||||
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
'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),',
|
||||||
@ -166,7 +177,8 @@ class Migrator {
|
|||||||
'value varchar(255) NOT NULL,',
|
'value varchar(255) NOT NULL,',
|
||||||
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
'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_id_custom_field_id (subscriber_id,custom_field_id)'
|
||||||
);
|
);
|
||||||
return $this->sqlify(__FUNCTION__, $attributes);
|
return $this->sqlify(__FUNCTION__, $attributes);
|
||||||
}
|
}
|
||||||
@ -192,7 +204,43 @@ class Migrator {
|
|||||||
'value varchar(255) NOT NULL,',
|
'value varchar(255) NOT NULL,',
|
||||||
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
'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 newsletter_id_option_field_id (newsletter_id,option_field_id)'
|
||||||
|
);
|
||||||
|
return $this->sqlify(__FUNCTION__, $attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sending_queues() {
|
||||||
|
$attributes = array(
|
||||||
|
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
||||||
|
'newsletter_id mediumint(9) NOT NULL,',
|
||||||
|
'subscribers longtext,',
|
||||||
|
'status varchar(12) NULL DEFAULT NULL,',
|
||||||
|
'priority mediumint(9) NOT NULL DEFAULT 0,',
|
||||||
|
'count_total mediumint(9) NOT NULL DEFAULT 0,',
|
||||||
|
'count_processed mediumint(9) NOT NULL DEFAULT 0,',
|
||||||
|
'count_to_process mediumint(9) NOT NULL DEFAULT 0,',
|
||||||
|
'count_failed mediumint(9) NOT NULL DEFAULT 0,',
|
||||||
|
'processed_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
|
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
|
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
|
||||||
|
'deleted_at TIMESTAMP NULL DEFAULT NULL,',
|
||||||
|
'PRIMARY KEY (id)',
|
||||||
|
);
|
||||||
|
return $this->sqlify(__FUNCTION__, $attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function newsletter_statistics() {
|
||||||
|
$attributes = array(
|
||||||
|
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
|
||||||
|
'newsletter_id mediumint(9) NOT NULL,',
|
||||||
|
'subscriber_id mediumint(9) NOT NULL,',
|
||||||
|
'queue_id mediumint(9) NOT NULL,',
|
||||||
|
'sent_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
|
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
|
||||||
|
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
|
||||||
|
'deleted_at TIMESTAMP NULL DEFAULT NULL,',
|
||||||
|
'PRIMARY KEY (id)',
|
||||||
);
|
);
|
||||||
return $this->sqlify(__FUNCTION__, $attributes);
|
return $this->sqlify(__FUNCTION__, $attributes);
|
||||||
}
|
}
|
||||||
|
@ -1,120 +1,223 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace MailPoet\Config;
|
namespace MailPoet\Config;
|
||||||
|
|
||||||
if (!defined('ABSPATH')) exit;
|
use MailPoet\Config\PopulatorData\Templates\FranksRoastHouseTemplate;
|
||||||
|
use MailPoet\Config\PopulatorData\Templates\BlankTemplate;
|
||||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
use MailPoet\Config\PopulatorData\Templates\WelcomeTemplate;
|
||||||
|
use MailPoet\Config\PopulatorData\Templates\PostNotificationsBlankTemplate;
|
||||||
class Populator {
|
use \MailPoet\Models\Segment;
|
||||||
function __construct() {
|
use \MailPoet\Segments\WP;
|
||||||
$this->prefix = Env::$db_prefix;
|
use \MailPoet\Models\Setting;
|
||||||
$this->models = array(
|
use \MailPoet\Settings\Pages;
|
||||||
'newsletter_option_fields',
|
|
||||||
);
|
if (!defined('ABSPATH')) exit;
|
||||||
}
|
|
||||||
|
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||||
function up() {
|
|
||||||
global $wpdb;
|
class Populator {
|
||||||
|
function __construct() {
|
||||||
$_this = $this;
|
$this->prefix = Env::$db_prefix;
|
||||||
|
$this->models = array(
|
||||||
$populate = function($model) use($_this, $wpdb) {
|
'newsletter_option_fields',
|
||||||
$fields = $_this->$model();
|
'newsletter_templates',
|
||||||
$table = $_this->prefix . $model;
|
);
|
||||||
|
}
|
||||||
array_map(function($field) use ($wpdb, $table) {
|
|
||||||
$column_conditions = array_map(function($key) use ($field) {
|
function up() {
|
||||||
return $key . '=' . $field[$key];
|
global $wpdb;
|
||||||
}, $field);
|
|
||||||
if ($wpdb->get_var("SELECT COUNT(*) FROM " . $table . " WHERE " . implode(' AND ', $column_conditions)) === 0) {
|
$_this = $this;
|
||||||
$wpdb->insert(
|
|
||||||
$table,
|
$populate = function($model) use($_this, $wpdb) {
|
||||||
$field
|
$fields = $_this->$model();
|
||||||
);
|
$table = $_this->prefix . $model;
|
||||||
}
|
|
||||||
}, $fields);
|
array_map(function($field) use ($wpdb, $table) {
|
||||||
};
|
$column_conditions = array_map(function($key) use ($field) {
|
||||||
|
return $key . '=' . $field[$key];
|
||||||
array_map(array($this, 'populate'), $this->models);
|
}, $field);
|
||||||
}
|
if ($wpdb->get_var("SELECT COUNT(*) FROM " . $table . " WHERE " . implode(' AND ', $column_conditions)) === 0) {
|
||||||
|
$wpdb->insert(
|
||||||
function newsletter_option_fields() {
|
$table,
|
||||||
return array(
|
$field
|
||||||
array(
|
);
|
||||||
'name' => 'event',
|
}
|
||||||
'newsletter_type' => 'welcome',
|
}, $fields);
|
||||||
),
|
};
|
||||||
array(
|
|
||||||
'name' => 'segment',
|
array_map(array($this, 'populate'), $this->models);
|
||||||
'newsletter_type' => 'welcome',
|
|
||||||
),
|
$this->createDefaultSegments();
|
||||||
array(
|
$this->createDefaultSettings();
|
||||||
'name' => 'role',
|
$this->createMailPoetPage();
|
||||||
'newsletter_type' => 'welcome',
|
}
|
||||||
),
|
|
||||||
array(
|
private function createMailPoetPage() {
|
||||||
'name' => 'afterTimeNumber',
|
$pages = get_posts(array(
|
||||||
'newsletter_type' => 'welcome',
|
'posts_per_page' => 1,
|
||||||
),
|
'orderby' => 'date',
|
||||||
array(
|
'order' => 'DESC',
|
||||||
'name' => 'afterTimeType',
|
'post_type' => 'mailpoet_page'
|
||||||
'newsletter_type' => 'welcome',
|
));
|
||||||
),
|
|
||||||
|
$page = null;
|
||||||
array(
|
if(!empty($pages)) {
|
||||||
'name' => 'intervalType',
|
$page = array_shift($pages);
|
||||||
'newsletter_type' => 'notification',
|
if(strpos($page->post_content, '[mailpoet_page]') === false) {
|
||||||
),
|
$page = null;
|
||||||
array(
|
}
|
||||||
'name' => 'timeOfDay',
|
}
|
||||||
'newsletter_type' => 'notification',
|
|
||||||
),
|
if($page === null) {
|
||||||
array(
|
$mailpoet_page_id = Pages::createMailPoetPage();
|
||||||
'name' => 'weekDay',
|
Setting::setValue('subscription.page', $mailpoet_page_id);
|
||||||
'newsletter_type' => 'notification',
|
}
|
||||||
),
|
}
|
||||||
array(
|
|
||||||
'name' => 'monthDay',
|
private function createDefaultSettings() {
|
||||||
'newsletter_type' => 'notification',
|
$current_user = wp_get_current_user();
|
||||||
),
|
|
||||||
array(
|
// user name
|
||||||
'name' => 'nthWeekDay',
|
$user_name = '';
|
||||||
'newsletter_type' => 'notification',
|
if($current_user->user_firstname) {
|
||||||
),
|
$user_name = $current_user->user_firstname;
|
||||||
);
|
}
|
||||||
}
|
if($current_user->user_lastname) {
|
||||||
|
if($user_name) {
|
||||||
private function populate($model) {
|
$user_name .= ' '.$current_user->user_lastname;
|
||||||
$rows = $this->$model();
|
}
|
||||||
$table = $this->prefix . $model;
|
}
|
||||||
$_this = $this;
|
if(!$user_name) {
|
||||||
|
$user_name = $current_user->display_name;
|
||||||
array_map(function($row) use ($_this, $table) {
|
}
|
||||||
if (!$_this->rowExists($table, $row)) {
|
|
||||||
$_this->insertRow($table, $row);
|
// default from name & address
|
||||||
}
|
Setting::setValue('sender', array(
|
||||||
}, $rows);
|
'name' => $user_name,
|
||||||
}
|
'address' => $current_user->user_email
|
||||||
|
));
|
||||||
private function rowExists($table, $columns) {
|
|
||||||
global $wpdb;
|
// enable signup confirmation by default
|
||||||
|
Setting::setValue('signup_confirmation.enabled', true);
|
||||||
$conditions = array_map(function($key) use ($columns) {
|
}
|
||||||
return $key . '=%s';
|
|
||||||
}, array_keys($columns));
|
private function createDefaultSegments() {
|
||||||
|
// WP Users segment
|
||||||
return $wpdb->get_var($wpdb->prepare(
|
$wp_users_segment = Segment::getWPUsers();
|
||||||
"SELECT COUNT(*) FROM $table WHERE " . implode(' AND ', $conditions),
|
|
||||||
array_values($columns)
|
if($wp_users_segment === false) {
|
||||||
)) > 0;
|
// create the wp users list
|
||||||
}
|
$wp_users_segment = Segment::create();
|
||||||
|
$wp_users_segment->hydrate(array(
|
||||||
private function insertRow($table, $row) {
|
'name' => __('WordPress Users'),
|
||||||
global $wpdb;
|
'description' =>
|
||||||
|
__('The list containing all of your WordPress users.'),
|
||||||
return $wpdb->insert(
|
'type' => 'wp_users'
|
||||||
$table,
|
));
|
||||||
$row
|
$wp_users_segment->save();
|
||||||
);
|
}
|
||||||
}
|
|
||||||
}
|
// Synchronize WP Users
|
||||||
|
WP::synchronizeUsers();
|
||||||
|
|
||||||
|
// Default segment
|
||||||
|
if(Segment::where('type', 'default')->count() === 0) {
|
||||||
|
$default_segment = Segment::create();
|
||||||
|
$default_segment->hydrate(array(
|
||||||
|
'name' => __('My First List'),
|
||||||
|
'description' =>
|
||||||
|
__('The list created automatically on install of MailPoet')
|
||||||
|
));
|
||||||
|
$default_segment->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function newsletter_option_fields() {
|
||||||
|
return array(
|
||||||
|
array(
|
||||||
|
'name' => 'event',
|
||||||
|
'newsletter_type' => 'welcome',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'segment',
|
||||||
|
'newsletter_type' => 'welcome',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'role',
|
||||||
|
'newsletter_type' => 'welcome',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'afterTimeNumber',
|
||||||
|
'newsletter_type' => 'welcome',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'afterTimeType',
|
||||||
|
'newsletter_type' => 'welcome',
|
||||||
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'name' => 'intervalType',
|
||||||
|
'newsletter_type' => 'notification',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'timeOfDay',
|
||||||
|
'newsletter_type' => 'notification',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'weekDay',
|
||||||
|
'newsletter_type' => 'notification',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'monthDay',
|
||||||
|
'newsletter_type' => 'notification',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'nthWeekDay',
|
||||||
|
'newsletter_type' => 'notification',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function newsletter_templates() {
|
||||||
|
return array(
|
||||||
|
(new FranksRoastHouseTemplate(Env::$assets_url))->get(),
|
||||||
|
(new BlankTemplate(Env::$assets_url))->get(),
|
||||||
|
(new WelcomeTemplate(Env::$assets_url))->get(),
|
||||||
|
(new PostNotificationsBlankTemplate(Env::$assets_url))->get(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function populate($model) {
|
||||||
|
$rows = $this->$model();
|
||||||
|
$table = $this->prefix . $model;
|
||||||
|
$_this = $this;
|
||||||
|
|
||||||
|
array_map(function($row) use ($_this, $table) {
|
||||||
|
if (!$_this->rowExists($table, $row)) {
|
||||||
|
$_this->insertRow($table, $row);
|
||||||
|
}
|
||||||
|
}, $rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function rowExists($table, $columns) {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$conditions = array_map(function($key) use ($columns) {
|
||||||
|
return $key . '=%s';
|
||||||
|
}, array_keys($columns));
|
||||||
|
|
||||||
|
return $wpdb->get_var($wpdb->prepare(
|
||||||
|
"SELECT COUNT(*) FROM $table WHERE " . implode(' AND ', $conditions),
|
||||||
|
array_values($columns)
|
||||||
|
)) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function insertRow($table, $row) {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
return $wpdb->insert(
|
||||||
|
$table,
|
||||||
|
$row
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
213
lib/Config/PopulatorData/Templates/BlankTemplate.php
Normal file
350
lib/Config/PopulatorData/Templates/FranksRoastHouseTemplate.php
Normal file
295
lib/Config/PopulatorData/Templates/WelcomeTemplate.php
Normal file
53
lib/Config/PublicAPI.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
namespace MailPoet\Config;
|
||||||
|
|
||||||
|
use MailPoet\Cron\Daemon;
|
||||||
|
use MailPoet\Util\Helpers;
|
||||||
|
|
||||||
|
if(!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
|
class PublicAPI {
|
||||||
|
public $api;
|
||||||
|
public $section;
|
||||||
|
public $action;
|
||||||
|
public $request_payload;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
# http://example.com/?mailpoet-api§ion=&action=&request_payload=
|
||||||
|
$this->api = isset($_GET['mailpoet-api']) ? true : false;
|
||||||
|
$this->section = isset($_GET['section']) ? $_GET['section'] : false;
|
||||||
|
$this->action = isset($_GET['action']) ?
|
||||||
|
Helpers::underscoreToCamelCase($_GET['action']) :
|
||||||
|
false;
|
||||||
|
$this->request_payload = isset($_GET['request_payload']) ?
|
||||||
|
json_decode(urldecode($_GET['request_payload']), true) :
|
||||||
|
false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
if(!$this->api && !$this->section) return;
|
||||||
|
$this->_checkAndCallMethod($this, $this->section, $terminate = true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function queue() {
|
||||||
|
try {
|
||||||
|
$queue = new Daemon($this->request_payload);
|
||||||
|
$this->_checkAndCallMethod($queue, $this->action);
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _checkAndCallMethod($class, $method, $terminate = false) {
|
||||||
|
if(!method_exists($class, $method)) {
|
||||||
|
if(!$terminate) return;
|
||||||
|
header('HTTP/1.0 404 Not Found');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
call_user_func(
|
||||||
|
array(
|
||||||
|
$class,
|
||||||
|
$method
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
121
lib/Config/Shortcodes.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
namespace MailPoet\Config;
|
||||||
|
use \MailPoet\Models\Newsletter;
|
||||||
|
use \MailPoet\Models\Subscriber;
|
||||||
|
use \MailPoet\Models\SubscriberSegment;
|
||||||
|
|
||||||
|
class Shortcodes {
|
||||||
|
function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
// form widget shortcode
|
||||||
|
add_shortcode('mailpoet_form', array($this, 'formWidget'));
|
||||||
|
add_shortcode('wysija_form', array($this, 'formWidget'));
|
||||||
|
|
||||||
|
// subscribers count shortcode
|
||||||
|
add_shortcode('mailpoet_subscribers_count', array(
|
||||||
|
$this, 'getSubscribersCount'
|
||||||
|
));
|
||||||
|
add_shortcode('wysija_subscribers_count', array(
|
||||||
|
$this, 'getSubscribersCount'
|
||||||
|
));
|
||||||
|
|
||||||
|
// archives page
|
||||||
|
add_shortcode('mailpoet_archive', array(
|
||||||
|
$this, 'getArchive'
|
||||||
|
));
|
||||||
|
|
||||||
|
add_filter('mailpoet_archive_date', array(
|
||||||
|
$this, 'renderArchiveDate'
|
||||||
|
), 2);
|
||||||
|
add_filter('mailpoet_archive_subject', array(
|
||||||
|
$this, 'renderArchiveSubject'
|
||||||
|
), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formWidget($params = array()) {
|
||||||
|
// IMPORTANT: fixes conflict with MagicMember
|
||||||
|
remove_shortcode('user_list');
|
||||||
|
|
||||||
|
if(isset($params['id']) && (int)$params['id'] > 0) {
|
||||||
|
$form_widget = new \MailPoet\Form\Widget();
|
||||||
|
return $form_widget->widget(array(
|
||||||
|
'form' => (int)$params['id'],
|
||||||
|
'form_type' => 'shortcode'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSubscribersCount($params) {
|
||||||
|
if(!empty($params['segments'])) {
|
||||||
|
$segment_ids = array_map(function($segment_id) {
|
||||||
|
return (int)trim($segment_id);
|
||||||
|
}, explode(',', $params['segments']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($segment_ids)) {
|
||||||
|
return Subscriber::filter('subscribed')->count();
|
||||||
|
} else {
|
||||||
|
return SubscriberSegment::whereIn('segment_id', $segment_ids)
|
||||||
|
->select('subscriber_id')->distinct()
|
||||||
|
->filter('subscribed')
|
||||||
|
->findResultSet()->count();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getArchive($params) {
|
||||||
|
if(!empty($params['segments'])) {
|
||||||
|
$segment_ids = array_map(function($segment_id) {
|
||||||
|
return (int)trim($segment_id);
|
||||||
|
}, explode(',', $params['segments']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$newsletters = array();
|
||||||
|
$html = '';
|
||||||
|
|
||||||
|
// TODO: needs more advanced newsletters in order to finish
|
||||||
|
$newsletters = Newsletter::limit(10)->orderByDesc('created_at')->findMany();
|
||||||
|
|
||||||
|
if(empty($newsletters)) {
|
||||||
|
return apply_filters(
|
||||||
|
'mailpoet_archive_no_newsletters',
|
||||||
|
__('Oops! There are no newsletters to display.')
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$title = apply_filters('mailpoet_archive_title', '');
|
||||||
|
if(!empty($title)) {
|
||||||
|
$html .= '<h3 class="mailpoet_archive_title">'.$title.'</h3>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= '<ul class="mailpoet_archive">';
|
||||||
|
foreach($newsletters as $newsletter) {
|
||||||
|
$html .= '<li>'.
|
||||||
|
'<span class="mailpoet_archive_date">'.
|
||||||
|
apply_filters('mailpoet_archive_date', $newsletter).
|
||||||
|
'</span>
|
||||||
|
<span class="mailpoet_archive_subject">'.
|
||||||
|
apply_filters('mailpoet_archive_subject', $newsletter).
|
||||||
|
'</span>
|
||||||
|
</li>';
|
||||||
|
}
|
||||||
|
$html .= '</ul>';
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderArchiveDate($newsletter) {
|
||||||
|
return date_i18n(
|
||||||
|
get_option('date_format'),
|
||||||
|
strtotime($newsletter->created_at)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderArchiveSubject($newsletter) {
|
||||||
|
return '<a href="TODO" target="_blank" title="'
|
||||||
|
.esc_attr(__('Preview in new tab')).'">'
|
||||||
|
.esc_attr($newsletter->subject).
|
||||||
|
'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace MailPoet\Config;
|
namespace MailPoet\Config;
|
||||||
use \MailPoet\Models\Subscriber;
|
|
||||||
use \MailPoet\Util\Security;
|
use \MailPoet\Util\Security;
|
||||||
|
|
||||||
if(!defined('ABSPATH')) exit;
|
if(!defined('ABSPATH')) exit;
|
||||||
@ -22,18 +21,6 @@ class Widget {
|
|||||||
|
|
||||||
function registerWidget() {
|
function registerWidget() {
|
||||||
register_widget('\MailPoet\Form\Widget');
|
register_widget('\MailPoet\Form\Widget');
|
||||||
|
|
||||||
// subscribers count shortcode
|
|
||||||
add_shortcode('mailpoet_subscribers_count', array(
|
|
||||||
$this, 'getSubscribersCount'
|
|
||||||
));
|
|
||||||
add_shortcode('wysija_subscribers_count', array(
|
|
||||||
$this, 'getSubscribersCount'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSubscribersCount($params) {
|
|
||||||
return Subscriber::filter('subscribed')->count();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupDependencies() {
|
function setupDependencies() {
|
||||||
@ -61,19 +48,25 @@ class Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupAdminDependencies() {
|
function setupAdminDependencies() {
|
||||||
wp_enqueue_script('mailpoet_vendor',
|
if(
|
||||||
Env::$assets_url.'/js/vendor.js',
|
empty($_GET['page'])
|
||||||
array(),
|
or
|
||||||
Env::$version,
|
isset($_GET['page']) && strpos($_GET['page'], 'mailpoet') === false
|
||||||
true
|
) {
|
||||||
);
|
wp_enqueue_script('mailpoet_vendor',
|
||||||
|
Env::$assets_url.'/js/vendor.js',
|
||||||
|
array(),
|
||||||
|
Env::$version,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
wp_enqueue_script('mailpoet_admin',
|
wp_enqueue_script('mailpoet_admin',
|
||||||
Env::$assets_url.'/js/mailpoet.js',
|
Env::$assets_url.'/js/mailpoet.js',
|
||||||
array(),
|
array(),
|
||||||
Env::$version,
|
Env::$version,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupActions() {
|
function setupActions() {
|
||||||
|