Commit Graph

19873 Commits

Author SHA1 Message Date
Jan Jakes
c40cb47928 Evaluate filter group operators (and/or)
[MAILPOET-5218]
2023-05-04 14:34:11 +02:00
Rodrigo Primo
e0317c5dbf Bump WP require at least to 6.0 and tested up to 6.2
[MAILPOET-5075]
2023-05-03 16:34:35 +02:00
Rostislav Wolny
5fa1ba823b When deleting old logs Delete oldest logs first
[MAILPOET-5071]
2023-05-03 13:34:33 +02:00
Rostislav Wolny
6f70cd1651 Limit rows deleted from mailpoet_logs in on run of purge routine
The probability of the routine to run is 5% so it should run approximately 5 times
per 100 writes. So the limit 1000 should be pretty safe to prevent the table from bloating.
[MAILPOET-5071]
2023-05-03 13:34:33 +02:00
Brezo Cordero
bcee2abb2c Improve translations error handling
Use wp_json_encode in case files contain invalid UTF-8 characters and catch WP_Errors when fetching the translations.

[MAILPOET-5253]
2023-05-03 12:46:07 +02:00
Jan Lysý
c711eac7f4 Update custom fields on confirmation when are stored in unconfirmed data
[MAILPOET-5246]
2023-05-03 11:31:24 +02:00
Jan Lysý
150042f670 Disable overriding custom fields on repeated subscribing
[MAILPOET-5246]
2023-05-03 11:31:24 +02:00
Jan Lysý
2ef78b1bba Add getter for specific subscriberCustomField entity in relation
[MAILPOET-5246]
2023-05-03 11:31:24 +02:00
Jan Lysý
41abed3b15 Add custom field to subscriber's relation when it is created
[MAILPOET-5246]
2023-05-03 11:31:24 +02:00
Rodrigo Primo
9ab4fd2bdf Escape data sent from Twig to JS variables
This commit changes the way that we are passing data from Twig to JS
variables. Before we were using the raw value of the variable which
could be insecure depending on the source of the variable. Malicious
code could be injected in the variable that would result in JS code
being executed in the browser.

Now we are escaping the value of the variable and then parsing it with
JSON.parse(). This should ensure that whatever is the content of the
Twig variable, it is never possible to inject code that is executed by
the browser.

[MAILPOET-5238]
2023-05-03 10:48:40 +02:00
Rodrigo Primo
33caa0c539 Add a new Twig filter that uses wp_kses() and use it instead of raw
Before this commit, whenever we needed to output HTML from a function
call in a Twig template, we would use the raw filter that allows any
kind of HTML to be outputted.

This commit adds a new filter called wpKses that internally calls
wp_kses(). We can use this filter instead of raw, this way we can define
the list of allowed HTML and the output becomes more secure.

This commit also replaces all the instances where we were using raw.

[MAILPOET-5238]
2023-05-03 10:48:40 +02:00
Rodrigo Primo
4912e28389 Remove unnecessary call to Twig raw filter
Since here we are just outputing a URL to a HTML attribute, raw is not
needed and we can let Twig auto escaping work.

[MAILPOET-5238]
2023-05-03 10:48:40 +02:00
Rodrigo Primo
dad6cb5795 Remove use of the Twig raw filter
In this particular template, using raw was not necessary as the HTML
markup encapsulated the full translatable string. So I removed the call
to raw, and added the HTML markup directly to the template.

[MAILPOET-5238]
2023-05-03 10:48:40 +02:00
Rodrigo Primo
fac3d77407 Remove unused view index.html
I found this file as part of the ticket to investigate Twig templates in
the context of the security scan ([MAILPOET-5238]) as it use the `raw`
filter. It seems this file is not used anymore, so instead of fixing the
use of `raw`, I'm removing it.

As far as I can check, we stopped using this view back in 2016, when
this commit f8efb3934b replaced the homepage
with the newsletter page.
2023-05-03 10:48:40 +02:00
John Oleksowicz
c411186a98 Add migration to fix problem on existing sites
MAILPOET-5261
2023-05-03 10:21:13 +02:00
John Oleksowicz
2b55416e76 Extract settings translations to be available in welcome wizard
MAILPOET-5261
2023-05-03 10:21:13 +02:00
John Oleksowicz
3c5a80bbf4 Update WC versions for release 7.6.1
MAILPOET-5268
2023-05-03 09:14:48 +02:00
Rostislav Wolny
a97ee6adfb Use older version of tracy based on PHP version
[MAILPOET-5277]
2023-05-02 18:25:34 +02:00
Rostislav Wolny
758f005a50 Release 4.14.0 2023-05-02 11:05:40 +02:00
John Oleksowicz
5ccf96e402 Do not run PR stats workflow for dependabot PRs
Currently there is only one person per week who is supposed to review
dependabot PRs, so it makes the most sense to me to simply skip this
workflow for any dependabot PRs.

I took this solution from here: https://github
.com/flowwer-dev/pull-request-stats/issues/47
#issuecomment-1221583794

MAILPOET-5260
2023-05-02 07:33:12 +02:00
Rodrigo Primo
d400a758fd Update Tracy to version 2.9.7 to get rid of PHP 8.2 warnings
We were running Tracy 2.9.1 and this version was generating warnings
when running PHP 8.2. Example:

```
ErrorException: Creation of dynamic property Tracy\DefaultBarPanel::$time is deprecated in phar:///var/www/html/wp-content/plugins/mailpoet/tools/vendor/tracy.phar/Tracy/Bar/panels/info.tab.phtml:2
```

[MAILPOET-5265]
2023-05-01 19:36:29 +02:00
Brezo Cordero
f3cd33b3c9 Return same data object on empty or null subscriber
If subscriber is empty we want to return the same token as if it is null.

[MAILPOET-5248]
2023-05-01 13:15:04 +02:00
Jan Jakes
01320f4511 Fix tests checking the same values twice
[MAILPOET-5187]
2023-05-01 12:42:35 +02:00
Jan Jakes
6e32f57275 Add missing value to subscriber status field
[MAILPOET-5187]
2023-05-01 12:42:35 +02:00
Jan Jakes
07266e4833 Fix error when filter for an unknown field is defined
[MAILPOET-4624]
2023-05-01 12:42:35 +02:00
Jan Jakes
2bded12e54 Allow rendering no filter value
[MAILPOET-4624]
2023-05-01 12:42:35 +02:00
Jan Jakes
d4a77ba057 Render filter values in filters list
[MAILPOET-4624]
[MAILPOET-5001]
[MAILPOET-5187]
2023-05-01 12:42:35 +02:00
Jan Jakes
554d195219 Expose number control
[MAILPOET-4624]
2023-05-01 12:42:35 +02:00
Jan Jakes
2da3e08c09 Implement enum filter
[MAILPOET-5187]
2023-05-01 12:42:35 +02:00
Jan Jakes
de0199421c Implement integer filter
[MAILPOET-4624]
2023-05-01 12:42:35 +02:00
Jan Jakes
94e3c0e391 Implement number filter
[MAILPOET-4624]
2023-05-01 12:42:35 +02:00
Jan Jakes
3f923ffce9 Implement boolean filter
[MAILPOET-5001]
2023-05-01 12:42:35 +02:00
Jan Jakes
ee0c3f4bbf Add one field for each new filter type (number, integer, boolean, string)
[MAILPOET-4624]
[MAILPOET-5001]
[MAILPOET-5187]
2023-05-01 12:42:35 +02:00
Jan Jakes
0cd14002ec Fix filter type and improve values in enum array filter test
[MAILPOET-5187]
2023-05-01 12:42:35 +02:00
John Oleksowicz
8a66c83257 Add "was sent email" filter
MAILPOET-5004
2023-05-01 11:28:25 +02:00
Rodrigo Primo
87f703f22a Update NewsletterOption and NewsletterOptionField removal date
This commit updates the remove date of the deprecated models
NewsletterOption and NewsletterOptionField. When they were initially
deprecated it was missed that two Newsletter model methods still used
them.

Those two methods are deprecated in this commit as apparently they are
not used anymore in MP's codebase.

[MAILPOET-5252]
2023-04-28 17:23:03 +01:00
Rodrigo Primo
6f511c685b Remove deprecated methods from the Newslleter model
Those methods were deprecated over six months ago.

[MAILPOET-5252]
2023-04-28 17:23:03 +01:00
Rodrigo Primo
854e8a7f07 Remove models that were deprecated over six months ago
The removal date of all these models passed a couple of months ago.

[MAILPOET-5252]
2023-04-28 17:23:03 +01:00
Rodrigo Primo
5a85390655 Replace remaining calls to utf8_encode() with mb_convert_encoding()
In the previous commit, I removed all calls to the deprecated
utf8_encode() that seemed safe to remove. In this commit, I'm replacing
the calls to this function that I'm not sure if are same to remove or
not with mb_convert_encoding().

mb_convert_encoding() requires the extension mbstring to be enabled. It
should be enabled on most PHP install but not all. We are already using
mbstring functions in our code base and we provide a polyfill for PHP
installs where the extension is not enabled
(62bb75ed91/mailpoet/prefixer/composer.json (L25)).
So it should be safe to use it.

[MAILPOET-4865]
2023-04-28 10:26:03 +02:00
Rodrigo Primo
19028eee3d Stop using utf8_encode() when calling php_uname()
This was added in a37ff8d. Per the commit message, php_uname() in a
Windows server can sometimes return the string using encondings other
than ISO-8859-1 and thus utf8_encode() was added. The problem is that
utf8_encode() only converts from ISO-8859-1 to UTF-8 so it does not work
for the purpose that it was added and it was deprecated in PHP 8.2.

Removing it seems safe. If we start having problems with character
encoding in the string that we are sending to Helpscout, we can consider
other alternatives to make sure the string is always send using UTF-8.

[MAILPOET-4865]
2023-04-28 10:26:03 +02:00
Rodrigo Primo
7c4a84aaf4 Remove notices for hooks that were deprecated over six months ago
[MAILPOET-5272]
2023-04-28 06:05:29 +01:00
David Remer
62bb75ed91 Introduce keywords and dynamic titles
[PREMIUM-223]
2023-04-27 13:40:10 +02:00
David Remer
ca3487abee Introduce Automation notification email type
[PREMIUM-223]
2023-04-27 13:40:10 +02:00
David Remer
6b36eaa6d8 Fix colors of icon
[PREMIUM-223]
2023-04-27 13:40:10 +02:00
David Remer
9301b5b070 Add Notification Email Action stubs
[PREMIUM-223]
2023-04-27 13:40:10 +02:00
David Remer
0843dde765 Export StepName
[PREMIUM-223]
2023-04-27 13:40:10 +02:00
Rostislav Wolny
e62a3ee5b5 Add escaping for known shortcodes when rendered in form textarea's value
[MAILPOET-5243]
2023-04-27 10:42:34 +02:00
Jan Lysý
fb2c839fad Remove version from image url in templates
[MAILPOET-5217]
2023-04-26 11:52:16 +02:00
Jan Lysý
87352ee366 Remove version from the image url
[MAILPOET-5217]
2023-04-26 11:52:16 +02:00
Rostislav Wolny
380e6d0f0a Use Bridge API error constants instead of strings for error mapping
[MAILPOET-5103]
2023-04-26 10:57:40 +02:00