Escape output according to WP sniffs
[MAILPOET-4129]
This commit is contained in:
@ -233,14 +233,13 @@ class API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setTokenAndAPIVersion() {
|
public function setTokenAndAPIVersion() {
|
||||||
$global = '<script type="text/javascript">';
|
|
||||||
$global .= 'var mailpoet_token = "%s";';
|
|
||||||
$global .= 'var mailpoet_api_version = "%s";';
|
|
||||||
$global .= '</script>';
|
|
||||||
echo sprintf(
|
echo sprintf(
|
||||||
$global,
|
'<script type="text/javascript">' .
|
||||||
Security::generateToken(),
|
'var mailpoet_token = "%s";' .
|
||||||
self::CURRENT_VERSION
|
'var mailpoet_api_version = "%s";' .
|
||||||
|
'</script>',
|
||||||
|
esc_js(Security::generateToken()),
|
||||||
|
esc_js(self::CURRENT_VERSION)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ abstract class Response {
|
|||||||
$response = array_merge($response, $data);
|
$response = array_merge($response, $data);
|
||||||
|
|
||||||
@header('Content-Type: application/json; charset=' . get_option('blog_charset'));
|
@header('Content-Type: application/json; charset=' . get_option('blog_charset'));
|
||||||
echo WPFunctions::get()->wpJsonEncode($response);
|
echo wp_json_encode($response);
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class NewsletterEditor {
|
|||||||
) {
|
) {
|
||||||
$location = 'admin.php?page=mailpoet-settings&enable-customizer-notice#woocommerce';
|
$location = 'admin.php?page=mailpoet-settings&enable-customizer-notice#woocommerce';
|
||||||
if (headers_sent()) {
|
if (headers_sent()) {
|
||||||
echo '<script>window.location = "' . $location . '";</script>';
|
echo '<script>window.location = "' . esc_js($location) . '";</script>';
|
||||||
} else {
|
} else {
|
||||||
header('Location: ' . $location, true, 302);
|
header('Location: ' . $location, true, 302);
|
||||||
}
|
}
|
||||||
|
@ -89,21 +89,22 @@ class Menu {
|
|||||||
// Disable WP emojis to not interfere with the newsletter editor emoji handling
|
// Disable WP emojis to not interfere with the newsletter editor emoji handling
|
||||||
$this->disableWPEmojis();
|
$this->disableWPEmojis();
|
||||||
$this->wp->addAction('admin_head', function() {
|
$this->wp->addAction('admin_head', function() {
|
||||||
$fonts = 'Arvo:400,400i,700,700i'
|
echo '<link href="https://fonts.googleapis.com/css?family='
|
||||||
. '|Lato:400,400i,700,700i'
|
. 'Arvo:400,400i,700,700i'
|
||||||
. '|Lora:400,400i,700,700i'
|
. '|Lato:400,400i,700,700i'
|
||||||
. '|Merriweather:400,400i,700,700i'
|
. '|Lora:400,400i,700,700i'
|
||||||
. '|Merriweather+Sans:400,400i,700,700i'
|
. '|Merriweather:400,400i,700,700i'
|
||||||
. '|Noticia+Text:400,400i,700,700i'
|
. '|Merriweather+Sans:400,400i,700,700i'
|
||||||
. '|Open+Sans:400,400i,700,700i'
|
. '|Noticia+Text:400,400i,700,700i'
|
||||||
. '|Playfair+Display:400,400i,700,700i'
|
. '|Open+Sans:400,400i,700,700i'
|
||||||
. '|Roboto:400,400i,700,700i'
|
. '|Playfair+Display:400,400i,700,700i'
|
||||||
. '|Source+Sans+Pro:400,400i,700,700i'
|
. '|Roboto:400,400i,700,700i'
|
||||||
. '|Oswald:400,400i,700,700i'
|
. '|Source+Sans+Pro:400,400i,700,700i'
|
||||||
. '|Raleway:400,400i,700,700i'
|
. '|Oswald:400,400i,700,700i'
|
||||||
. '|Permanent+Marker:400,400i,700,700i'
|
. '|Raleway:400,400i,700,700i'
|
||||||
. '|Pacifico:400,400i,700,700i';
|
. '|Permanent+Marker:400,400i,700,700i'
|
||||||
echo '<link href="https://fonts.googleapis.com/css?family=' . $fonts . '" rel="stylesheet">';
|
. '|Pacifico:400,400i,700,700i'
|
||||||
|
. '" rel="stylesheet">';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,8 @@ class DaemonHttpRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function terminateRequest($message = false) {
|
public function terminateRequest($message = false) {
|
||||||
die($message);
|
echo esc_html($message);
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isCronTriggerMethodWordPress() {
|
public function isCronTriggerMethodWordPress() {
|
||||||
|
@ -95,7 +95,7 @@ class Widget extends \WP_Widget {
|
|||||||
try {
|
try {
|
||||||
echo $this->renderer->render('form/iframe.html', $data);
|
echo $this->renderer->render('form/iframe.html', $data);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
echo $e->getMessage();
|
echo esc_html($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
@ -137,27 +137,26 @@ class Widget extends \WP_Widget {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="widefat"
|
class="widefat"
|
||||||
id="<?php echo $this->get_field_id('title') ?>"
|
id="<?php echo esc_attr($this->get_field_id('title')) ?>"
|
||||||
name="<?php echo $this->get_field_name('title'); ?>"
|
name="<?php echo esc_attr($this->get_field_name('title')); ?>"
|
||||||
value="<?php echo WPFunctions::get()->escAttr($title); ?>"
|
value="<?php echo esc_attr($title); ?>"
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<select class="widefat" id="<?php echo $this->get_field_id('form') ?>" name="<?php echo $this->get_field_name('form'); ?>">
|
<select class="widefat" id="<?php echo esc_attr($this->get_field_id('form')) ?>" name="<?php echo esc_attr($this->get_field_name('form')); ?>">
|
||||||
<?php
|
<?php
|
||||||
// Select the first one from the list if none selected
|
// Select the first one from the list if none selected
|
||||||
if ($selectedForm === 0 && !empty($forms)) $selectedForm = $forms[0]->getId();
|
if ($selectedForm === 0 && !empty($forms)) $selectedForm = $forms[0]->getId();
|
||||||
foreach ($forms as $form) {
|
foreach ($forms as $form) {
|
||||||
$isSelected = ($selectedForm === $form->getId()) ? 'selected="selected"' : '';
|
|
||||||
$formName = $form->getName() ? $this->wp->escHtml($form->getName()) : "({$this->wp->_x('no name', 'fallback for forms without a name in a form list')})";
|
$formName = $form->getName() ? $this->wp->escHtml($form->getName()) : "({$this->wp->_x('no name', 'fallback for forms without a name in a form list')})";
|
||||||
$formName .= $form->getStatus() === FormEntity::STATUS_DISABLED ? ' (' . __('inactive', 'mailpoet') . ')' : '';
|
$formName .= $form->getStatus() === FormEntity::STATUS_DISABLED ? ' (' . __('inactive', 'mailpoet') . ')' : '';
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo $form->getId(); ?>" <?php echo $isSelected; ?>><?php echo $formName; ?></option>
|
<option value="<?php echo esc_attr((string)$form->getId()); ?>" <?php echo ($selectedForm === $form->getId()) ? 'selected="selected"' : ''; ?>><?php echo esc_html($formName); ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="<?php echo $formEditUrl; ?>" target="_blank" class="mailpoet_form_new"><?php WPFunctions::get()->_e('Create a new form', 'mailpoet'); ?></a>
|
<a href="<?php echo esc_url($formEditUrl); ?>" target="_blank" class="mailpoet_form_new"><?php echo esc_html(WPFunctions::get()->__('Create a new form', 'mailpoet')); ?></a>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
return '';
|
return '';
|
||||||
|
@ -26,6 +26,6 @@ class Form extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static function deprecationError($methodName) {
|
private static function deprecationError($methodName) {
|
||||||
trigger_error('Calling ' . $methodName . ' is deprecated and will be removed. Use MailPoet\Statistics\StatisticsFormsRepository and respective Doctrine entities instead.', E_USER_DEPRECATED);
|
trigger_error('Calling ' . esc_html($methodName) . ' is deprecated and will be removed. Use MailPoet\Statistics\StatisticsFormsRepository and respective Doctrine entities instead.', E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class NewsletterLink extends Model {
|
|||||||
|
|
||||||
private static function deprecationError($methodName) {
|
private static function deprecationError($methodName) {
|
||||||
trigger_error(
|
trigger_error(
|
||||||
'Calling ' . $methodName . ' is deprecated and will be removed. Use \MailPoet\Cron\Workers\StatsNotifications\NewsletterLinkRepository and respective Doctrine entities instead.',
|
'Calling ' . esc_html($methodName) . ' is deprecated and will be removed. Use \MailPoet\Cron\Workers\StatsNotifications\NewsletterLinkRepository and respective Doctrine entities instead.',
|
||||||
E_USER_DEPRECATED
|
E_USER_DEPRECATED
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,6 @@ class StatisticsUnsubscribes extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static function deprecationError($methodName) {
|
private static function deprecationError($methodName) {
|
||||||
trigger_error('Calling ' . $methodName . ' is deprecated and will be removed. Use MailPoet\Statistics\StatisticsUnsubscribesRepository and respective Doctrine entity instead.', E_USER_DEPRECATED);
|
trigger_error('Calling ' . esc_html($methodName) . ' is deprecated and will be removed. Use MailPoet\Statistics\StatisticsUnsubscribesRepository and respective Doctrine entity instead.', E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,22 +43,23 @@ class SubscriptionFormBlock {
|
|||||||
|
|
||||||
$this->wp->addAction('admin_head', function() {
|
$this->wp->addAction('admin_head', function() {
|
||||||
$forms = $this->formsRepository->findAllNotDeleted();
|
$forms = $this->formsRepository->findAllNotDeleted();
|
||||||
$formsEncoded = json_encode(
|
|
||||||
array_map(
|
|
||||||
function(FormEntity $form) {
|
|
||||||
return $form->toArray();
|
|
||||||
},
|
|
||||||
$forms
|
|
||||||
)
|
|
||||||
);
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.mailpoet_forms = <?php echo $formsEncoded ?>;
|
window.mailpoet_forms = <?php
|
||||||
|
echo wp_json_encode(
|
||||||
|
array_map(
|
||||||
|
function(FormEntity $form) {
|
||||||
|
return $form->toArray();
|
||||||
|
},
|
||||||
|
$forms
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>;
|
||||||
window.locale = {
|
window.locale = {
|
||||||
selectForm: '<?php echo __('Select a MailPoet form', 'mailpoet') ?>',
|
selectForm: '<?php echo esc_js(__('Select a MailPoet form', 'mailpoet')) ?>',
|
||||||
createForm: '<?php echo __('Create a new form', 'mailpoet') ?>',
|
createForm: '<?php echo esc_js(__('Create a new form', 'mailpoet')) ?>',
|
||||||
subscriptionForm: '<?php echo __('MailPoet Subscription Form', 'mailpoet') ?>',
|
subscriptionForm: '<?php echo esc_js(__('MailPoet Subscription Form', 'mailpoet')) ?>',
|
||||||
inactive: '<?php echo __('inactive', 'mailpoet') ?>',
|
inactive: '<?php echo esc_js(__('inactive', 'mailpoet')) ?>',
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
@ -40,7 +40,7 @@ class CronDaemon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function ping() {
|
public function ping() {
|
||||||
die($this->cronHelper->pingDaemon());
|
die(esc_html($this->cronHelper->pingDaemon()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pingResponse() {
|
public function pingResponse() {
|
||||||
|
@ -84,7 +84,9 @@ class Opens {
|
|||||||
if (!$displayImage) return;
|
if (!$displayImage) return;
|
||||||
// return 1x1 pixel transparent gif image
|
// return 1x1 pixel transparent gif image
|
||||||
header('Content-Type: image/gif');
|
header('Content-Type: image/gif');
|
||||||
echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==');
|
|
||||||
|
// Output of base64_decode is predetermined and safe in this case
|
||||||
|
echo base64_decode('R0lGODlhAQABAJAAAP8AAAAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw=='); // phpcs:ignore
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,21 @@ class Comment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function extendLoggedOutForm() {
|
public function extendLoggedOutForm() {
|
||||||
echo $this->getSubscriptionField();
|
$allowedHtml = [
|
||||||
|
'p' => [
|
||||||
|
'class' => true,
|
||||||
|
],
|
||||||
|
'label' => [
|
||||||
|
'for' => true,
|
||||||
|
],
|
||||||
|
'input' => [
|
||||||
|
'type' => true,
|
||||||
|
'id' => true,
|
||||||
|
'value' => true,
|
||||||
|
'name' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
echo wp_kses($this->getSubscriptionField(), $allowedHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSubscriptionField() {
|
private function getSubscriptionField() {
|
||||||
@ -47,7 +61,7 @@ class Comment {
|
|||||||
id="mailpoet_subscribe_on_comment"
|
id="mailpoet_subscribe_on_comment"
|
||||||
value="1"
|
value="1"
|
||||||
name="mailpoet[subscribe_on_comment]"
|
name="mailpoet[subscribe_on_comment]"
|
||||||
/> ' . esc_attr($label) . '
|
/> ' . esc_html($label) . '
|
||||||
</label>
|
</label>
|
||||||
</p>';
|
</p>';
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,22 @@ class Registration {
|
|||||||
</label>
|
</label>
|
||||||
</p>';
|
</p>';
|
||||||
|
|
||||||
$form = $this->wp->applyFilters('mailpoet_register_form_extend', $form);
|
$form = (string)$this->wp->applyFilters('mailpoet_register_form_extend', $form);
|
||||||
|
$allowedHtml = [
|
||||||
print $form;
|
'p' => [
|
||||||
|
'class' => true,
|
||||||
|
],
|
||||||
|
'label' => [
|
||||||
|
'for' => true,
|
||||||
|
],
|
||||||
|
'input' => [
|
||||||
|
'type' => true,
|
||||||
|
'id' => true,
|
||||||
|
'value' => true,
|
||||||
|
'name' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
print wp_kses($form, $allowedHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onMultiSiteRegister($result) {
|
public function onMultiSiteRegister($result) {
|
||||||
|
@ -111,7 +111,7 @@ class DIPanel implements IBarPanel {
|
|||||||
* @param string $item
|
* @param string $item
|
||||||
*/
|
*/
|
||||||
public function printItem($item) {
|
public function printItem($item) {
|
||||||
echo $item;
|
echo esc_html($item);
|
||||||
if (array_key_exists($item, $this->definitions)) {
|
if (array_key_exists($item, $this->definitions)) {
|
||||||
$arguments = $this->definitions[$item]->getArguments();
|
$arguments = $this->definitions[$item]->getArguments();
|
||||||
if (!empty($arguments)) {
|
if (!empty($arguments)) {
|
||||||
@ -127,7 +127,7 @@ class DIPanel implements IBarPanel {
|
|||||||
$this->printItem((string)$argument);
|
$this->printItem((string)$argument);
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
} elseif (is_string($argument)) {
|
} elseif (is_string($argument)) {
|
||||||
echo $argument;
|
echo esc_html($argument);
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,9 +149,9 @@ class DIPanel implements IBarPanel {
|
|||||||
|
|
||||||
if (count($usedIn)) {
|
if (count($usedIn)) {
|
||||||
$label = 'Used in ' . count($usedIn) . ' services';
|
$label = 'Used in ' . count($usedIn) . ' services';
|
||||||
echo '<span class="tracy-toggle tracy-collapsed">' . $label . '...</span>';
|
echo '<span class="tracy-toggle tracy-collapsed">' . esc_html($label) . '...</span>';
|
||||||
echo '<div class="tracy-collapsed" style="padding-left: 10px">';
|
echo '<div class="tracy-collapsed" style="padding-left: 10px">';
|
||||||
echo join('<br>', $usedIn);
|
echo wp_kses_post(join('<br>', $usedIn));
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ class Functions {
|
|||||||
return __($text, $domain);
|
return __($text, $domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function _e($text, $domain = 'default') {
|
public function _e($text, $domain = 'default') { //phpcs:ignore
|
||||||
return _e($text, $domain);
|
return _e($text, $domain); //phpcs:ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
public function _n($single, $plural, $number, $domain = 'default') {
|
public function _n($single, $plural, $number, $domain = 'default') {
|
||||||
@ -337,8 +337,8 @@ class Functions {
|
|||||||
return is_admin();
|
return is_admin();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isEmail($email, $deprecated = false) {
|
public function isEmail($email) {
|
||||||
return is_email($email, $deprecated);
|
return is_email($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isMultisite() {
|
public function isMultisite() {
|
||||||
@ -362,11 +362,11 @@ class Functions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|false $deprecated
|
* @param string $domain
|
||||||
* @param string|false $pluginRelPath
|
* @param string|false $pluginRelPath
|
||||||
*/
|
*/
|
||||||
public function loadPluginTextdomain($domain, $deprecated = false, $pluginRelPath = false) {
|
public function loadPluginTextdomain($domain, $pluginRelPath = false) {
|
||||||
return load_plugin_textdomain($domain, $deprecated, $pluginRelPath);
|
return load_plugin_textdomain($domain, "", $pluginRelPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadTextdomain($domain, $mofile) {
|
public function loadTextdomain($domain, $mofile) {
|
||||||
@ -742,7 +742,12 @@ class Functions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function deprecatedHook(string $hook_name, string $version, string $replacement, string $message) {
|
public function deprecatedHook(string $hook_name, string $version, string $replacement, string $message) {
|
||||||
_deprecated_hook($hook_name, $version, $replacement, $message);
|
_deprecated_hook(
|
||||||
|
esc_html($hook_name),
|
||||||
|
esc_html($version),
|
||||||
|
esc_html($replacement),
|
||||||
|
wp_kses_post($message)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTheExcerpt($post = null) {
|
public function getTheExcerpt($post = null) {
|
||||||
|
@ -67,12 +67,21 @@ class Notice {
|
|||||||
public function displayWPNotice() {
|
public function displayWPNotice() {
|
||||||
$class = sprintf('notice notice-%s mailpoet_notice_server %s', $this->type, $this->classes);
|
$class = sprintf('notice notice-%s mailpoet_notice_server %s', $this->type, $this->classes);
|
||||||
$message = nl2br($this->message);
|
$message = nl2br($this->message);
|
||||||
$dataNoticeName = !empty($this->dataNoticeName) ? sprintf('data-notice="%s"', $this->dataNoticeName) : '';
|
|
||||||
|
|
||||||
if ($this->renderInParagraph) {
|
if ($this->renderInParagraph) {
|
||||||
printf('<div class="%1$s" %3$s><p>%2$s</p></div>', $class, $message, $dataNoticeName);
|
printf(
|
||||||
|
'<div class="%1$s" %3$s><p>%2$s</p></div>',
|
||||||
|
esc_attr($class),
|
||||||
|
wp_kses_post($message),
|
||||||
|
!empty($this->dataNoticeName) ? sprintf('data-notice="%s"', esc_attr($this->dataNoticeName)) : ''
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
printf('<div class="%1$s" %3$s>%2$s</div>', $class, $message, $dataNoticeName);
|
printf(
|
||||||
|
'<div class="%1$s" %3$s>%2$s</div>',
|
||||||
|
esc_attr($class),
|
||||||
|
wp_kses_post($message),
|
||||||
|
!empty($this->dataNoticeName) ? sprintf('data-notice="%s"', esc_attr($this->dataNoticeName)) : ''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,30 @@ class Subscription {
|
|||||||
const OPTIN_SEGMENTS_SETTING_NAME = 'woocommerce.optin_on_checkout.segments';
|
const OPTIN_SEGMENTS_SETTING_NAME = 'woocommerce.optin_on_checkout.segments';
|
||||||
const OPTIN_MESSAGE_SETTING_NAME = 'woocommerce.optin_on_checkout.message';
|
const OPTIN_MESSAGE_SETTING_NAME = 'woocommerce.optin_on_checkout.message';
|
||||||
|
|
||||||
|
private $allowedHtml = [
|
||||||
|
'input' => [
|
||||||
|
'type' => true,
|
||||||
|
'name' => true,
|
||||||
|
'id' => true,
|
||||||
|
'class' => true,
|
||||||
|
'value' => true,
|
||||||
|
'checked' => true,
|
||||||
|
],
|
||||||
|
'span' => [
|
||||||
|
'class' => true,
|
||||||
|
],
|
||||||
|
'label' => [
|
||||||
|
'class' => true,
|
||||||
|
'data-automation-id' => true,
|
||||||
|
'for' => true,
|
||||||
|
],
|
||||||
|
'p' => [
|
||||||
|
'class' => true,
|
||||||
|
'id' => true,
|
||||||
|
'data-priority' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
/** @var SettingsController */
|
/** @var SettingsController */
|
||||||
private $settings;
|
private $settings;
|
||||||
|
|
||||||
@ -63,16 +87,17 @@ class Subscription {
|
|||||||
$checked = true;
|
$checked = true;
|
||||||
}
|
}
|
||||||
$labelString = $this->settings->get(self::OPTIN_MESSAGE_SETTING_NAME);
|
$labelString = $this->settings->get(self::OPTIN_MESSAGE_SETTING_NAME);
|
||||||
$template = $this->wp->applyFilters(
|
$template = (string)$this->wp->applyFilters(
|
||||||
'mailpoet_woocommerce_checkout_optin_template',
|
'mailpoet_woocommerce_checkout_optin_template',
|
||||||
$this->getSubscriptionField($inputName, $checked, $labelString),
|
$this->getSubscriptionField($inputName, $checked, $labelString),
|
||||||
$inputName,
|
$inputName,
|
||||||
$checked,
|
$checked,
|
||||||
$labelString
|
$labelString
|
||||||
);
|
);
|
||||||
echo $template;
|
echo wp_kses($template, $this->allowedHtml);
|
||||||
if ($template) {
|
if ($template) {
|
||||||
echo $this->getSubscriptionPresenceCheckField();
|
$field = $this->getSubscriptionPresenceCheckField();
|
||||||
|
echo wp_kses($field, $this->allowedHtml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,18 @@ function mailpoet_wp_version_notice() {
|
|||||||
__('MailPoet plugin requires WordPress version 4.6 or newer. Please read our [link]instructions[/link] on how to resolve this issue.', 'mailpoet')
|
__('MailPoet plugin requires WordPress version 4.6 or newer. Please read our [link]instructions[/link] on how to resolve this issue.', 'mailpoet')
|
||||||
);
|
);
|
||||||
$notice = str_replace('[/link]', '</a>', $notice);
|
$notice = str_replace('[/link]', '</a>', $notice);
|
||||||
printf('<div class="error"><p>%1$s</p></div>', $notice);
|
printf(
|
||||||
|
'<div class="error"><p>%1$s</p></div>',
|
||||||
|
wp_kses(
|
||||||
|
$notice,
|
||||||
|
[
|
||||||
|
'a' => [
|
||||||
|
'href' => true,
|
||||||
|
'target' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display PHP version error notice
|
// Display PHP version error notice
|
||||||
@ -79,7 +90,24 @@ function mailpoet_php_version_notice() {
|
|||||||
);
|
);
|
||||||
$noticeP3 = str_replace('[/link]', '</a>', $noticeP3);
|
$noticeP3 = str_replace('[/link]', '</a>', $noticeP3);
|
||||||
|
|
||||||
printf('<div class="error"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>', $noticeP1, $noticeP2, $noticeP3);
|
$allowedTags = [
|
||||||
|
'a' => [
|
||||||
|
'href' => true,
|
||||||
|
'target' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
printf(
|
||||||
|
'<div class="error"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>',
|
||||||
|
esc_html($noticeP1),
|
||||||
|
wp_kses(
|
||||||
|
$noticeP2,
|
||||||
|
$allowedTags
|
||||||
|
),
|
||||||
|
wp_kses(
|
||||||
|
$noticeP3,
|
||||||
|
$allowedTags
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== false) {
|
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== false) {
|
||||||
@ -92,7 +120,7 @@ if (isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower($_SERVER['SERVER_SOF
|
|||||||
// Display IIS server error notice
|
// Display IIS server error notice
|
||||||
function mailpoet_microsoft_iis_notice() {
|
function mailpoet_microsoft_iis_notice() {
|
||||||
$notice = __("MailPoet plugin cannot run under Microsoft's Internet Information Services (IIS) web server. We recommend that you use a web server powered by Apache or NGINX.", 'mailpoet');
|
$notice = __("MailPoet plugin cannot run under Microsoft's Internet Information Services (IIS) web server. We recommend that you use a web server powered by Apache or NGINX.", 'mailpoet');
|
||||||
printf('<div class="error"><p>%1$s</p></div>', $notice);
|
printf('<div class="error"><p>%1$s</p></div>', esc_html($notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for presence of core dependencies
|
// Check for presence of core dependencies
|
||||||
@ -106,7 +134,7 @@ if (!file_exists($mailpoetPlugin['autoloader']) || !file_exists($mailpoetPlugin[
|
|||||||
// Display missing core dependencies error notice
|
// Display missing core dependencies error notice
|
||||||
function mailpoet_core_dependency_notice() {
|
function mailpoet_core_dependency_notice() {
|
||||||
$notice = __('MailPoet cannot start because it is missing core files. Please reinstall the plugin.', 'mailpoet');
|
$notice = __('MailPoet cannot start because it is missing core files. Please reinstall the plugin.', 'mailpoet');
|
||||||
printf('<div class="error"><p>%1$s</p></div>', $notice);
|
printf('<div class="error"><p>%1$s</p></div>', esc_html($notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize plugin
|
// Initialize plugin
|
||||||
|
@ -1201,7 +1201,12 @@ parameters:
|
|||||||
path: ../../lib/Subscription/ManageSubscriptionFormRenderer.php
|
path: ../../lib/Subscription/ManageSubscriptionFormRenderer.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter mixed of print cannot be converted to string\\.$#"
|
message: "#^Cannot cast mixed to string\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: ../../lib/WooCommerce/Subscription.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Cannot cast mixed to string\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../lib/Subscription/Registration.php
|
path: ../../lib/Subscription/Registration.php
|
||||||
|
|
||||||
@ -1285,11 +1290,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../lib/WooCommerce/Helper.php
|
path: ../../lib/WooCommerce/Helper.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\(mixed\\) of echo cannot be converted to string\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../../lib/WooCommerce/Subscription.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^PHPDoc type MailPoet\\\\Segments\\\\DynamicSegments\\\\SegmentSaveController of property MailPoet\\\\Test\\\\DataFactories\\\\DynamicSegment\\:\\:\\$saveController is not covariant with PHPDoc type MailPoet\\\\Segments\\\\SegmentSaveController of overridden property MailPoet\\\\Test\\\\DataFactories\\\\Segment\\:\\:\\$saveController\\.$#"
|
message: "#^PHPDoc type MailPoet\\\\Segments\\\\DynamicSegments\\\\SegmentSaveController of property MailPoet\\\\Test\\\\DataFactories\\\\DynamicSegment\\:\\:\\$saveController is not covariant with PHPDoc type MailPoet\\\\Segments\\\\SegmentSaveController of overridden property MailPoet\\\\Test\\\\DataFactories\\\\Segment\\:\\:\\$saveController\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1201,7 +1201,12 @@ parameters:
|
|||||||
path: ../../lib/Subscription/ManageSubscriptionFormRenderer.php
|
path: ../../lib/Subscription/ManageSubscriptionFormRenderer.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter mixed of print cannot be converted to string\\.$#"
|
message: "#^Cannot cast mixed to string\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: ../../lib/WooCommerce/Subscription.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Cannot cast mixed to string\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../lib/Subscription/Registration.php
|
path: ../../lib/Subscription/Registration.php
|
||||||
|
|
||||||
@ -1290,11 +1295,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../lib/WooCommerce/Helper.php
|
path: ../../lib/WooCommerce/Helper.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\(mixed\\) of echo cannot be converted to string\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../../lib/WooCommerce/Subscription.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^PHPDoc type MailPoet\\\\Segments\\\\DynamicSegments\\\\SegmentSaveController of property MailPoet\\\\Test\\\\DataFactories\\\\DynamicSegment\\:\\:\\$saveController is not covariant with PHPDoc type MailPoet\\\\Segments\\\\SegmentSaveController of overridden property MailPoet\\\\Test\\\\DataFactories\\\\Segment\\:\\:\\$saveController\\.$#"
|
message: "#^PHPDoc type MailPoet\\\\Segments\\\\DynamicSegments\\\\SegmentSaveController of property MailPoet\\\\Test\\\\DataFactories\\\\DynamicSegment\\:\\:\\$saveController is not covariant with PHPDoc type MailPoet\\\\Segments\\\\SegmentSaveController of overridden property MailPoet\\\\Test\\\\DataFactories\\\\Segment\\:\\:\\$saveController\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1221,7 +1221,12 @@ parameters:
|
|||||||
path: ../../lib/Subscription/ManageSubscriptionFormRenderer.php
|
path: ../../lib/Subscription/ManageSubscriptionFormRenderer.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter mixed of print cannot be converted to string\\.$#"
|
message: "#^Cannot cast mixed to string\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: ../../lib/WooCommerce/Subscription.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Cannot cast mixed to string\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../lib/Subscription/Registration.php
|
path: ../../lib/Subscription/Registration.php
|
||||||
|
|
||||||
@ -1310,11 +1315,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../lib/WooCommerce/Helper.php
|
path: ../../lib/WooCommerce/Helper.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\(mixed\\) of echo cannot be converted to string\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: ../../lib/WooCommerce/Subscription.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^PHPDoc type MailPoet\\\\Segments\\\\DynamicSegments\\\\SegmentSaveController of property MailPoet\\\\Test\\\\DataFactories\\\\DynamicSegment\\:\\:\\$saveController is not covariant with PHPDoc type MailPoet\\\\Segments\\\\SegmentSaveController of overridden property MailPoet\\\\Test\\\\DataFactories\\\\Segment\\:\\:\\$saveController\\.$#"
|
message: "#^PHPDoc type MailPoet\\\\Segments\\\\DynamicSegments\\\\SegmentSaveController of property MailPoet\\\\Test\\\\DataFactories\\\\DynamicSegment\\:\\:\\$saveController is not covariant with PHPDoc type MailPoet\\\\Segments\\\\SegmentSaveController of overridden property MailPoet\\\\Test\\\\DataFactories\\\\Segment\\:\\:\\$saveController\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -49,4 +49,4 @@ $args = array_map(function ($arg) {
|
|||||||
|
|
||||||
$result = null;
|
$result = null;
|
||||||
passthru(escapeshellcmd("$filePath/tx") . ' ' . implode(' ', $args), $result);
|
passthru(escapeshellcmd("$filePath/tx") . ' ' . implode(' ', $args), $result);
|
||||||
exit($result);
|
exit((int)$result);
|
||||||
|
Reference in New Issue
Block a user