The previous method was relying on the idea that product pages would not
trigger the `the_content` filter since they don't have to render the
content. Testing revealed that this idea was unreliable.
In one instance WordPress was triggering `the_content` when attempting
to filter the excerpt, even though the excerpt was empty.
This changes the detection method to a much more direct inspection of
the post's content.
MAILPOET-5859
The current logic for form rendering assumes that a single product page
will trigger the filter `the_content`. This is not always true. In cases
where the product has no description, WooCommerce does not render the
description tab at all, which is where that filter usually fires (in my
testing).
This change ensures that we still give these forms a chance to render on
such pages.
MAILPOET-5859
This code was preventing WordPress from rendering the public.js
script as deferred.
The defer attribute can be applied only to scripts
that are loaded via src. WP detected that there was an associated
inline script and removed the defer attribute from the public.js script.
In this commit, I moved the initialization of the error message to public.js and
I pass the value via static object.
[MAILPOET-5623]
We want to remove/refactor the whole ModelValidator class as part of the
Doctrine refactor.
This commit moves the method ModelValidator::validateNonRoleEmail() to a
new Validator class as the method is not used by the validator system of
the Paris models. ModelValidator::validateEmail() was also moved as it
is called by ModelValidator::validateNonRoleEmail().
[MAILPOET-4343]
We save the falsy value for bold as "0" which was causing that labels
were rendered bold in front end also when the checkbox was disabled.
[MAILPOET-5139]
It's possible that other plugins might define wc_get_page_id, so it's
more important to know that WC is installed/active than to know if the
function itself exists.
For good measure I'm including a cast to int even though the WC version
of the function always returns an integer. This is probably unnecessary
but it protects us from the possibility of the WC version of the
function returning something other than an integer in the future.
[MAILPOET-4834]
The current Captcha class has a lot of responsibilities. It renders the captcha
image, can check if a certain captcha type is a Google captcha, if a captcha is
required for a certain email. The SubscriberSubscribeController is not only in
charge of "controlling" the subscription process but also validates, whether a
captcha is correct or not. This architecture made it difficult to extend the
functionality and introduce the audio captcha feature.
Therefore this commit refactors the captcha architecture and tries to seperate
the different concerns into several classes and objects. Validation is now done
by validators.
The CaptchaPhrase now is in charge of keeping the captcha phrase consistent
between the image and the new audio, so that you can renew the captcha and both
captchas are in sync.
[MAILPOET-4514]