Commit Graph

25 Commits

Author SHA1 Message Date
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
87352ee366 Remove version from the image url
[MAILPOET-5217]
2023-04-26 11:52:16 +02:00
8a4f5c13da Add tracking for users arriving to the wizard from WooCommerce
MailPoet adds a link to the WooCommerce task list pointing to its own
welcome wizard. We want to track users that arrive to the MP wizard from
WooCommerce but at this point tracking is not enabled. So we store the
information in a setting, and send the tracking event to Mixpanel, if it
is enabled, after the user completes the wizard.

[MAILPOET-4814]
2023-01-30 15:01:42 +01:00
40f4216ff8 Add method for getting WC coupons
[MAILPOET-4761]
2023-01-30 09:36:21 +01:00
1e76b214ea Don't load HelpScout Beacon on Dotcom Ecommerce plan
[MAILPOET-5017]
2023-01-26 09:31:27 +01:00
4e3b1527cd If no translation for the current language exists, return 'en'
[MAILPOET-3487]
2022-12-07 11:53:48 +01:00
7b584dd482 Add language function to twig
[MAILPOET-3487]
2022-12-07 11:53:48 +01:00
926620e8f8 Ignore strict types rule in all existing files that don't have it
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
0f23dea7fc Don't add hash of JS bundles to their filenames, use plugin version parameter instead
[MAILPOET-4611]
2022-10-31 10:03:45 +01:00
c601aaa3eb Autofix issues detected by CodeSniffer
[MAILPOET-4617]
2022-09-06 17:38:01 +02:00
f19de77f70 Fix sending system info when creating a HelpScout ticket
We were calling the wrong Beacon API method to send system info
data to HelpScout when users create tickets inside WordPress. This
commit fixes this by calling the method `session-data` instead of
`identify`. It is likely that `identify` was the correct method in the
past, but the Beacon API changed
(https://developer.helpscout.com/beacon-2/web/javascript-api/).
Nowadays, the `identify` method is used to add data to the HelpScout
users and fields need to be created in advance in the HelpScout web
interface. `session-data` is used to add information to the ticket which
is what we are trying to achieve. Only `name` and `email` should still
be passed to `identify` to make it possible to match the correct
HelpScout user.

[MAILPOET-4525]
2022-08-18 15:43:12 +02:00
218de96024 Fix WordPress.WP.I18n.MissingTranslatorsComment errors
[MAILPOET-4524]
2022-08-09 13:23:16 +02:00
b05e6d414c Remove WP\Functions::__ and other translate functions
Under the new sniffer rules, those functions produce errors and, when those methods
are used, the sniffer can not properly be applied.

[MAILPOET-4524]
2022-08-09 13:23:16 +02:00
566cef6ef8 Instantiate CdnAssetUrl late
[MAILPOET-3985]
2022-06-08 15:25:41 +02:00
2b63b0ed45 Use a more descriptive method name for retrieving the anayltics class
[MAILPOET-3985]
2022-06-08 15:25:41 +02:00
e18b562212 Load dependencies late
When we create the templates, we are not in the WordPress environment and do not
have a connection to the database. Therefore, we need to instantiate our dependencies
later, so they get only invoked once they are needed, which is, when we are
in the WordPress environment again.

[MAILPOET-3985]
2022-06-08 15:25:41 +02:00
bd2b064c8f Use empty string when translation is null
In a case when translation is not set correctly in a template
(e.g. 'helpTooltipSendPreview': helpTooltipSendPreview)
it's value might be evaluated as null and trigger a deprecation warning on PHP8.1.
[MAILPOET-4243]
2022-04-13 11:17:33 +02:00
5c93d20468 Remove new lines from translations passed to JS
A translator accidentally used a new line character in the translated
string and that broke JS code we generate in Twig helper function.
We don't want to support new lines in translated strings so as a fix
we just remove those characters to prevent the error in case it happens again.

[MAILPOET-4153]
2022-02-28 09:37:07 +01:00
ea7aa51e39 Remove opened_stats_text() Twig function
This commit removes the opened_stats_text() Twig function as it is not
used anymore.

[MAILPOET-4102]
2022-02-16 11:19:02 +01:00
c21e12e82a Fix ranges for displaying colors in stats email
The specs for [MAILPOET-3324] had a minor error that is fixed by this
commit. The ranges for displaying different colors for the percentage of
clicks should be < 1%, 1-3% and > 3% instead of < 10%, 10-30% and > 30%.

[MAILPOET-3324]
2022-02-09 15:07:41 +01:00
ee6f081ab2 Add helper function to format the numbers differently in the stats email
This commit adds a helper function that will return a number with two
decimal digits if the number is smaller than 0.1 and will return a
number with one decimal digit if the number is equal to or greater than
0.1. It is used to format the numbers in the stats notification email.

[MAILPOET-3324]
2022-02-09 15:07:41 +01:00
3700af261f Remove duplication of methods to get stats color
The criteria used to determine the color used for clicked and opened
stats is the same, but we had one method to get the color of each stats.
This commit combines both methods into one to avoid duplication.

[MAILPOET-3324]
2022-02-09 15:07:41 +01:00
d359c048e3 Fix a bug in clickedStatsColor()
The method clickedStatsColor() should return different color codes
depending on the percentage of clicks (> 30%, < 30% and > 10%, < 10%).
It receives the percentage value as an absolute number. There was a bug
in this method where it was checking for values greater than 3, between
3 and 1, and smaller than 1 instead of greater than 30, between 30 and
  10, and smaller than 10.

[MAILPOET-3324]
2022-02-09 15:07:41 +01:00
509d97c2c0 Change the colors and text used when displaying clicked stats
[MAILPOET-3324]
2022-02-09 15:07:41 +01:00
9f790efbf0 Move plugin files to a subfolder
[MAILPOET-3988]
2022-01-18 15:30:22 +01:00