first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,157 @@
<?php
/* @var $this NewsletterSubscription */
defined('ABSPATH') || exit;
@include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
if ($controls->is_action()) {
if ($controls->is_action('save')) {
$controls->data['ip_blacklist'] = $this->to_array($controls->data['ip_blacklist']);
$controls->data['address_blacklist'] = $this->to_array($controls->data['address_blacklist']);
$this->save_options($controls->data, 'antibot');
$controls->add_message_saved();
}
} else {
$controls->data = $this->get_options('antibot');
}
?>
<div class="wrap" id="tnp-wrap">
<?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
<div id="tnp-heading">
<h2><?php _e('Security', 'newsletter') ?></h2>
<?php $controls->page_help('https://www.thenewsletterplugin.com/documentation/antiflood') ?>
</div>
<div id="tnp-body">
<form method="post" action="">
<?php $controls->init(); ?>
<div class="tnp-buttons">
<?php $controls->button_save() ?>
</div>
<div id="tabs">
<ul>
<li><a href="#tabs-general"><?php _e('Security', 'newsletter') ?></a></li>
<li><a href="#tabs-blacklists"><?php _e('Blacklists', 'newsletter') ?></a></li>
</ul>
<div id="tabs-general">
<table class="form-table">
<tr>
<th><?php _e('Disable antibot/antispam?', 'newsletter') ?></th>
<td>
<?php $controls->yesno('disabled'); ?>
<p class="description">
<?php _e('Disable for ajax form submission', 'newsletter'); ?>
</p>
</td>
</tr>
<tr>
<th>Akismet</th>
<td>
<?php
$controls->select('akismet', array(
0 => __('Disabled', 'newsletter'),
1 => __('Enabled', 'newsletter')
));
?>
<?php $controls->help('https://www.thenewsletterplugin.com/documentation/antiflood') ?>
</td>
</tr>
<tr>
<th><?php _e('Antiflood', 'newsletter') ?></th>
<td>
<?php
$controls->select('antiflood', array(
0 => __('Disabled', 'newsletter'),
5 => '5 ' . __('seconds', 'newsletter'),
10 => '10 ' . __('seconds', 'newsletter'),
15 => '15 ' . __('seconds', 'newsletter'),
30 => '30 ' . __('seconds', 'newsletter'),
60 => '1 ' . __('minute', 'newsletter'),
120 => '2 ' . __('minutes', 'newsletter'),
300 => '5 ' . __('minutes', 'newsletter'),
600 => '10 ' . __('minutes', 'newsletter'),
900 => '15 ' . __('minutes', 'newsletter'),
1800 => '30 ' . __('minutes', 'newsletter'),
360 => '60 ' . __('minutes', 'newsletter')
));
?>
<?php $controls->help('https://www.thenewsletterplugin.com/documentation/antiflood') ?>
</td>
</tr>
<tr>
<th><?php _e('Captcha', 'newsletter') ?> </th>
<td>
<?php $controls->enabled('captcha'); ?> <?php $controls->field_help('https://www.thenewsletterplugin.com/documentation/antiflood#captcha') ?>
</td>
</tr>
<?php /*
<tr>
<th><?php _e('Domain check', 'newsletter') ?></th>
<td>
<?php
$controls->yesno('domain_check');
?>
</td>
</tr>
*/ ?>
</table>
</div>
<div id="tabs-blacklists">
<table class="form-table">
<tr>
<th>
<?php _e('IP black list', 'newsletter') ?>
<?php $controls->field_help('https://www.thenewsletterplugin.com/documentation/antiflood#ip') ?>
</th>
<td>
<?php $controls->textarea('ip_blacklist'); ?>
<p class="description"><?php _e('One per line', 'newsletter') ?></p>
</td>
</tr>
<tr>
<th>
<?php _e('Address black list', 'newsletter') ?>
<?php $controls->field_help('https://www.thenewsletterplugin.com/documentation/antiflood#domains') ?>
</th>
<td>
<?php $controls->textarea('address_blacklist'); ?>
<p class="description"><?php _e('One per line', 'newsletter') ?></p>
</td>
</tr>
</table>
</div>
</div>
<p>
<?php $controls->button_save() ?>
</p>
</form>
</div>
<?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
</div>

View File

@@ -0,0 +1,11 @@
<?php
// This file is used only on first installation!
$options = array();
$options['ip_blacklist'] = array();
$options['address_blacklist'] = array();
$options['antiflood'] = 60;
$options['akismet'] = 0;
$options['captcha'] = 0;
$options['disabled'] = 0;

View File

@@ -0,0 +1,10 @@
<?php
$options = array();
for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
$options['list_' . $i] = '';
$options['list_' . $i . '_status'] = 0;
$options['list_' . $i . '_checked'] = 0;
$options['list_' . $i . '_forced'] = 0;
}

View File

@@ -0,0 +1,44 @@
<?php
// This file is used only on first installation!
$options = array();
$options['email'] = 'Email';
$options['email_error'] = __('Email address is not correct', 'newsletter');
$options['name'] = __('First name or full name', 'newsletter');
$options['name_error'] = __('Name is required', 'newsletter');
$options['name_status'] = 0;
$options['name_rules'] = 0;
$options['surname'] = __('Last name', 'newsletter');
$options['surname_error'] = __('Last name is required', 'newsletter');
$options['surname_status'] = 0;
$options['sex_status'] = 0;
$options['sex'] = __('I\'m', 'newsletter');
$options['privacy'] = __('By continuing, you accept the privacy policy', 'newsletter');
$options['privacy_error'] = 'You must accept the privacy policy';
$options['privacy_status'] = 0;
$options['privacy_url'] = '';
$options['privacy_use_wp_url'] = 0;
$options['subscribe'] = __('Subscribe', 'newsletter');
$options['title_female'] = __('Ms.', 'newsletter');
$options['title_male'] = __('Mr.', 'newsletter');
$options['title_none'] = __('Dear', 'newsletter');
$options['sex_male'] = 'Man';
$options['sex_female'] = 'Woman';
$options['sex_none'] = 'Not specified';
$options['profile_error'] = __('A mandatory field is not filled in', 'newsletter');
for ($i=1; $i<=NEWSLETTER_PROFILE_MAX; $i++) {
$options['profile_' . $i . '_status'] = 0;
$options['profile_' . $i] = '';
$options['profile_' . $i . '_type'] = 'text';
$options['profile_' . $i . '_placeholder'] = '';
$options['profile_' . $i . '_rules'] = 0;
$options['profile_' . $i . '_options'] = '';
}

View File

@@ -0,0 +1,6 @@
<?php
// This file is used only on first installation!
$options = array();
$options['template'] = @file_get_contents(__DIR__ . '/email.html');

View File

@@ -0,0 +1,58 @@
<?php
// Those default options are used ONLY on FIRST setup and on plugin updates but limited to
// new options that may have been added between your and new version.
//
// This is the main language file, too, which is always loaded by Newsletter. Other language
// files are loaded according the WPLANG constant defined in wp-config.php file. Those language
// specific files are "merged" with this one and the language specific configuration
// keys override the ones in this file.
//
// Language specific files only need to override configurations containing texts
// langiage dependant.
$options = array();
$options['noconfirmation'] = 1;
//$options['antiflood'] = 10;
//$options['ip_blacklist'] = array();
//$options['address_blacklist'] = array();
//$options['domain_check'] = 0;
//$options['akismet'] = 1;
//$options['captcha'] = 1;
$options['notify_email'] = get_option('admin_email');
$options['multiple'] = 1;
$options['notify'] = 0;
$options['error_text'] = '<p>' . __('You cannot subscribe with the email address you entered, please contact the site administrator.', 'newsletter') . '</p>';
//$options['already_confirmed_text'] = '<p>This email address is already subscribed, anyway a welcome email has been sent again. Thank you.</p>';
// Subscription page introductory text (befor the subscription form)
$options['subscription_text'] = "{subscription_form}";
// Message show after a subbscription request has made.
$options['confirmation_text'] = '<p>' . __('A confirmation email is on the way. Follow the instructions and check the spam folder. Thank you.') . '</p>';
// Confirmation email subject (double opt-in)
$options['confirmation_subject'] = __("Please confirm your subscription", 'newsletter');
$options['confirmation_tracking'] = '';
// Confirmation email body (double opt-in)
$options['confirmation_message'] = '<p>' . __('Please confirm your subscription <a href="{subscription_confirm_url}">clicking here</a>', 'newsletter') . '</p>';
// Subscription confirmed text (after a user clicked the confirmation link
// on the email he received
$options['confirmed_text'] = '<p>' . __('Your subscription has been confirmed', 'newsletter') . '</p>';
$options['confirmed_subject'] = __('Welcome', 'newsletter');
$options['confirmed_message'] =
"<p>" . __('This message confirms your subscription to our newsletter. Thank you!', 'newsletter') . '</p>' .
'<hr>' .
'<p><a href="{profile_url}">' . __('Change your profile', 'newsletter') . '</p>';
$options['confirmed_tracking'] = '';

View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<!-- General styles, not used by all email clients -->
<style type="text/css" media="all">
a {
text-decoration: none;
color: #0088cc;
}
hr {
border-top: 1px solid #999;
}
</style>
</head>
<!-- KEEP THE LAYOUT SIMPLE: THOSE ARE SERVICE MESSAGES. -->
<body style="margin: 0; padding: 0;">
<!-- Top title with dark background -->
<table style="background-color: #444; width: 100%;" cellspacing="0" cellpadding="0">
<tr>
<td style="padding: 20px; text-align: center; font-family: sans-serif; color: #fff; font-size: 28px">
{blog_title}
</td>
</tr>
</table>
<!-- Main table 100% wide with background color #eee -->
<table style="background-color: #eee; width: 100%;">
<tr>
<td align="center" style="padding: 15px;">
<!-- Content table with backgdound color #fff, width 500px -->
<table style="background-color: #fff; max-width: 600px; width: 100%; border: 1px solid #ddd;">
<tr>
<td style="padding: 15px; color: #333; font-size: 16px; font-family: sans-serif">
<!-- The "message" tag below is replaced with one of confirmation, welcome or goodbye messages -->
<!-- Messages content can be configured on Newsletter List Building panels -->
{message}
<hr>
<!-- Signature if not already added to single messages (surround with <p>) -->
<p>
<small>
<a href="{blog_url}">{blog_url}</a><br>
{company_name}<br>
{company_address}
</small>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,65 @@
<?php
if (!defined('ABSPATH')) exit;
@include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
if (!$controls->is_action()) {
$controls->data = $module->get_options('forms');
}
if ($controls->is_action('save')) {
$module->save_options($controls->data, 'forms');
$controls->add_message_saved();
}
?>
<div class="wrap" id="tnp-wrap">
<?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
<div id="tnp-heading">
<h2><?php _e('Custom Forms', 'newsletter') ?></h2>
<p>
Here you can store your hand coded forms to recall them from short codes.
<a href="https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-forms" target="_blank">Read more about forms</a>.
</p>
</div>
<div id="tnp-body">
<form method="post" action="">
<?php $controls->init(); ?>
<div id="tabs">
<ul>
<li><a href="#tabs-forms">Forms</a></li>
</ul>
<div id="tabs-forms">
<table class="form-table">
<?php for ($i = 1; $i <= 10; $i++) { ?>
<tr>
<th>Form <?php echo $i; ?></th>
<td>
<?php $controls->textarea('form_' . $i); ?>
<br />
<?php $controls->button_save(); ?>
</td>
</tr>
<?php } ?>
</table>
</div>
</div>
</form>
</div>
<?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
</div>

View File

@@ -0,0 +1,128 @@
<?php
defined('ABSPATH') || exit;
@include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
$current_language = $module->get_current_language();
$is_all_languages = $module->is_all_languages();
$is_multilanguage = $module->is_multilanguage();
$controls->add_language_warning();
if (!$controls->is_action()) {
$controls->data = $module->get_options('lists', $current_language);
} else {
if ($controls->is_action('save')) {
$module->save_options($controls->data, 'lists', null, $current_language);
$controls->add_message_saved();
}
if ($controls->is_action('unlink')) {
$wpdb->query("update " . NEWSLETTER_USERS_TABLE . " set list_" . ((int) $controls->button_data) . "=0");
$controls->add_message_done();
}
}
for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
if (!isset($controls->data['list_' . $i . '_forced'])) {
$controls->data['list_' . $i . '_forced'] = empty($module->options['preferences_' . $i]) ? 0 : 1;
}
}
$status = array(0 => 'Disabled/Private use', 1 => 'Only on profile page', 2 => 'Even on subscription forms', '3' => 'Hidden');
?>
<script>
jQuery(function () {
jQuery(".tnp-notes").tooltip({
content: function () {
// That activates the HTML in the tooltip
return this.title;
}
});
});
</script>
<div class="wrap tnp-lists" id="tnp-wrap">
<?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
<div id="tnp-heading">
<h2><?php _e('Lists', 'newsletter') ?></h2>
</div>
<div id="tnp-body">
<form method="post" action="">
<?php $controls->init(); ?>
<p>
<?php $controls->button_save(); ?>
</p>
<table class="widefat" style="width: auto">
<thead>
<tr>
<th>#</th>
<th><?php _e('Name', 'newsletter') ?></th>
<?php if ($is_all_languages) { ?>
<th><?php _e('Visibility', 'newsletter') ?></th>
<th><?php _e('Pre-checked', 'newsletter') ?></th>
<th><?php _e('Pre-assigned', 'newsletter') ?></th>
<?php if ($is_multilanguage) { ?>
<th><?php _e('Pre-assigned by language', 'newsletter') ?></th>
<?php } ?>
<?php } ?>
<th><?php _e('Subscribers', 'newsletter') ?></th>
<th>&nbsp;</th>
<th><?php _e('Notes', 'newsletter') ?></th>
</tr>
</thead>
<?php for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { ?>
<?php
if (!$is_all_languages && empty($controls->data['list_' . $i])) {
continue;
}
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php $controls->text('list_' . $i, 50); ?></td>
<?php if ($is_all_languages) { ?>
<td><?php $controls->select('list_' . $i . '_status', $status); ?></td>
<td><?php $controls->select('list_' . $i . '_checked', array(0 => 'No', 1 => 'Yes')); ?></td>
<td><?php $controls->select('list_' . $i . '_forced', array(0 => 'No', 1 => 'Yes')); ?></td>
<?php if ($is_multilanguage) { ?>
<td><?php $controls->languages('list_' . $i . '_languages'); ?></td>
<?php } ?>
<?php } ?>
<td><?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where list_" . $i . "=1 and status='C'"); ?></td>
<td><?php $controls->button_confirm('unlink', __('Unlink everyone', 'newsletter'), '', $i); ?></td>
<td>
<?php $notes = apply_filters('newsletter_lists_notes', array(), $i); ?>
<?php
$text = '';
foreach ($notes as $note) {
$text .= $note . '<br>';
}
if (!empty($text)) {
echo '<i class="fa fa-info-circle tnp-notes" title="', esc_attr($text), '"></i>';
}
?>
</td>
</tr>
<?php } ?>
</table>
<p>
<?php $controls->button_save(); ?>
</p>
</form>
</div>
<?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
</div>

View File

@@ -0,0 +1,291 @@
<?php
defined('ABSPATH') || exit;
@include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
$current_language = $module->get_current_language();
$is_all_languages = $module->is_all_languages();
$controls->add_language_warning();
$options = $module->get_options('', $current_language);
if ($controls->is_action()) {
if ($controls->is_action('save')) {
$defaults = $module->get_default_options();
// Without the last curly bracket since there can be a form number apended
if (empty($controls->data['subscription_text'])) {
$controls->data['subscription_text'] = $defaults['subscription_text'];
}
if (empty($controls->data['confirmation_text'])) {
$controls->data['confirmation_text'] = $defaults['confirmation_text'];
}
if (empty($controls->data['confirmation_subject'])) {
$controls->data['confirmation_subject'] = $defaults['confirmation_subject'];
}
if (empty($controls->data['confirmation_message'])) {
$controls->data['confirmation_message'] = $defaults['confirmation_message'];
}
if (empty($controls->data['confirmed_text'])) {
$controls->data['confirmed_text'] = $defaults['confirmed_text'];
}
if (empty($controls->data['confirmed_subject'])) {
$controls->data['confirmed_subject'] = $defaults['confirmed_subject'];
}
if (empty($controls->data['confirmed_message'])) {
$controls->data['confirmed_message'] = $defaults['confirmed_message'];
}
$controls->data['confirmed_message'] = NewsletterModule::clean_url_tags($controls->data['confirmed_message']);
$controls->data['confirmed_text'] = NewsletterModule::clean_url_tags($controls->data['confirmed_text']);
$controls->data['confirmation_text'] = NewsletterModule::clean_url_tags($controls->data['confirmation_text']);
$controls->data['confirmation_message'] = NewsletterModule::clean_url_tags($controls->data['confirmation_message']);
$controls->data['confirmed_url'] = trim($controls->data['confirmed_url']);
$controls->data['confirmation_url'] = trim($controls->data['confirmation_url']);
$module->save_options($controls->data, '', null, $current_language);
$controls->add_message_saved();
}
if ($controls->is_action('reset')) {
$controls->data = $module->reset_options();
}
if ($controls->is_action('test-confirmation')) {
$users = NewsletterUsers::instance()->get_test_users();
if (count($users) == 0) {
$controls->errors = 'There are no test subscribers. Read more about test subscribers <a href="https://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
} else {
$addresses = array();
foreach ($users as &$user) {
$addresses[] = $user->email;
$res = $module->send_message('confirmation', $user);
if (!$res) {
$controls->errors = 'The email address ' . $user->email . ' failed.';
break;
}
}
$controls->messages .= 'Test emails sent to ' . count($users) . ' test subscribers: ' .
implode(', ', $addresses) . '. Read more about test subscribers <a href="https://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
$controls->messages .= '<br>If the message is not received, try to change the message text it could trigger some antispam filters.';
}
}
if ($controls->is_action('test-confirmed')) {
$users = NewsletterUsers::instance()->get_test_users();
if (count($users) == 0) {
$controls->errors = 'There are no test subscribers. Read more about test subscribers <a href="https://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
} else {
$addresses = array();
foreach ($users as $user) {
$addresses[] = $user->email;
$res = $module->send_message('confirmed', $user);
if (!$res) {
$controls->errors = 'The email address ' . $user->email . ' failed.';
break;
}
}
$controls->messages .= 'Test emails sent to ' . count($users) . ' test subscribers: ' .
implode(', ', $addresses) . '. Read more about test subscribers <a href="https://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
$controls->messages .= '<br>If the message is not received, try to change the message text it could trigger some antispam filters.';
}
}
} else {
$controls->data = $module->get_options('', $current_language);
}
?>
<div class="wrap" id="tnp-wrap">
<?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
<div id="tnp-heading">
<h2><?php _e('Subscription Configuration', 'newsletter') ?></h2>
<?php $controls->page_help('https://www.thenewsletterplugin.com/documentation/subscription') ?>
</div>
<div id="tnp-body">
<form method="post" action="">
<?php $controls->init(); ?>
<div id="tabs">
<ul>
<li><a href="#tabs-general"><?php _e('General', 'newsletter') ?></a></li>
<li><a href="#tabs-2"><?php _e('Subscription', 'newsletter') ?></a></li>
<li><a href="#tabs-4"><?php _e('Welcome', 'newsletter') ?></a></li>
<li><a href="#tabs-3"><?php _e('Activation', 'newsletter') ?></a></li>
</ul>
<div id="tabs-general">
<?php if ($is_all_languages) { ?>
<table class="form-table">
<tr>
<th><?php _e('Opt In', 'newsletter') ?></th>
<td>
<?php $controls->select('noconfirmation', array(0 => __('Double Opt In', 'newsletter'), 1 => __('Single Opt In', 'newsletter'))); ?>
<?php $controls->help('https://www.thenewsletterplugin.com/documentation/subscription#opt-in') ?>
</td>
</tr>
<tr>
<th><?php _e('Override Opt In', 'newsletter') ?></th>
<td>
<?php $controls->yesno('optin_override'); ?>
</td>
</tr>
<tr>
<th><?php _e('Repeated subscriptions', 'newsletter') ?></th>
<td>
<?php //$controls->select('multiple', array('0'=>__('No', 'newsletter'), '1'=>__('Yes', 'newsletter'), '2'=>__('On new lists added', 'newsletter'))); ?>
<?php $controls->select('multiple', array('0'=>__('No', 'newsletter'), '1'=>__('Yes', 'newsletter'))); ?>
<?php $controls->help('https://www.thenewsletterplugin.com/documentation/subscription#repeated')?>
</td>
</tr>
<tr>
<th><?php _e('Notifications', 'newsletter') ?></th>
<td>
<?php $controls->yesno('notify'); ?>
<?php $controls->text_email('notify_email'); ?>
</td>
</tr>
</table>
<?php } else { ?>
<p>Switch to "All languages" to manage these options.</p>
<?php } ?>
</div>
<div id="tabs-2">
<table class="form-table">
<tr>
<th><?php _e('Subscription page', 'newsletter') ?><br><?php echo $controls->help('https://www.thenewsletterplugin.com/documentation/newsletter-tags') ?></th>
<td>
<?php $controls->wp_editor('subscription_text'); ?>
</td>
</tr>
</table>
<h3>Special cases</h3>
<table class="form-table">
<tr>
<th><?php _e('Error page', 'newsletter') ?></th>
<td>
<?php $controls->wp_editor('error_text'); ?>
</td>
</tr>
</table>
</div>
<div id="tabs-3">
<p><?php _e('Only for double opt-in mode.', 'newsletter') ?></p>
<?php $controls->panel_help('https://www.thenewsletterplugin.com/documentation/subscription#activation') ?>
<table class="form-table">
<tr>
<th><?php _e('Activation message', 'newsletter') ?></th>
<td>
<?php $controls->wp_editor('confirmation_text'); ?>
</td>
</tr>
<tr>
<th><?php _e('Alternative activation page', 'newsletter'); ?></th>
<td>
<?php $controls->text('confirmation_url', 70, 'https://...'); ?>
</td>
</tr>
<!-- CONFIRMATION EMAIL -->
<tr>
<th><?php _e('Activation email', 'newsletter') ?></th>
<td>
<?php $controls->email('confirmation', 'wordpress'); ?>
<br>
<?php $controls->button('test-confirmation', 'Send a test'); ?>
</td>
</tr>
</table>
</div>
<div id="tabs-4">
<p>
<?php $controls->panel_help('https://www.thenewsletterplugin.com/documentation/subscription#welcome') ?>
</p>
<table class="form-table">
<tr>
<th><?php _e('Welcome message', 'newsletter') ?></th>
<td>
<?php $controls->wp_editor('confirmed_text'); ?>
</td>
</tr>
<tr>
<th><?php _e('Alternative welcome page URL', 'newsletter') ?></th>
<td>
<?php $controls->text('confirmed_url', 70, 'https://...'); ?>
</td>
</tr>
<tr>
<th><?php _e('Conversion tracking code', 'newsletter') ?>
<?php $controls->help('https://www.thenewsletterplugin.com/documentation/subscription#conversion') ?></th>
<td>
<?php $controls->textarea('confirmed_tracking'); ?>
</td>
</tr>
<!-- WELCOME/CONFIRMED EMAIL -->
<tr>
<th>
<?php _e('Welcome email', 'newsletter') ?>
</th>
<td>
<?php $controls->email('confirmed', 'wordpress', $is_all_languages); ?>
<br>
<?php $controls->button('test-confirmed', 'Send a test'); ?>
</td>
</tr>
</table>
</div>
</div>
<p>
<?php $controls->button_save() ?>
<?php $controls->button_reset() ?>
</p>
</form>
</div>
<?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
</div>

View File

@@ -0,0 +1,100 @@
<?php
// This page is used to show subscription messages to users along the various
// subscription and unsubscription steps.
//
// This page is used ONLY IF, on main configutation, you have NOT set a specific
// WordPress page to be used to show messages and when there are no alternative
// URLs specified on single messages.
//
// To create an alternative to this file, just copy the page-alternative.php on
//
// wp-content/extensions/newsletter/subscription/page.php
//
// and modify that copy.
if (!defined('ABSPATH')) exit;
$module = NewsletterSubscription::instance();
$message_key = $module->get_message_key_from_request();
if ($message_key == 'confirmation') {
$user = $module->get_user_from_request(true, 'preconfirm');
} else {
$user = $module->get_user_from_request(true);
}
$message = apply_filters('newsletter_page_text', '', $message_key, $user);
$options = $module->get_options('', $module->get_user_language($user));
if (!$message) {
$message = $options[$message_key . '_text'];
}
$message = $module->replace($message, $user);
if (isset($options[$message_key . '_tracking'])) {
$message .= $options[$message_key . '_tracking'];
}
$alert = '';
if (isset($_REQUEST['alert'])) $alert = stripslashes($_REQUEST['alert']);
// Force the UTF-8 charset
header('Content-Type: text/html;charset=UTF-8');
if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/subscription/page.php')) {
include WP_CONTENT_DIR . '/extensions/newsletter/subscription/page.php';
die();
}
?>
<html>
<head>
<style type="text/css">
body {
font-family: verdana;
background-color: #ddd;
font-size: 14px;
color: #333;
}
#container {
border: 1px solid #ccc;
border-radius: 0px;
background-color: #fff;
margin: 40px auto;
width: 650px;
padding: 30px
}
h1 {
font-size: 30px;
font-weight: normal;
border-bottom: 0px solid #aaa;
margin-top: 0;
}
h2 {
font-size: 20px;
}
th, td {
font-size: 12px;
}
th {
padding-right: 10px;
text-align: right;
vertical-align: middle;
font-weight: normal;
}
#message {
line-height: 1.6em;
}
</style>
</head>
<body>
<?php if (!empty($alert)) { ?>
<script>
alert("<?php echo addslashes(strip_tags($alert)); ?>");
</script>
<?php } ?>
<div id="container">
<h1><?php echo get_option('blogname'); ?></h1>
<div id="message">
<?php echo $message; ?>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,261 @@
<?php
if (!defined('ABSPATH'))
exit;
@include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
$current_language = $module->get_current_language();
$is_all_languages = $module->is_all_languages();
if (!$is_all_languages) {
$controls->warnings[] = 'You are configuring the language "<strong>' . $current_language . '</strong>". Switch to "all languages" to see every options.';
}
if (!$controls->is_action()) {
$controls->data = $module->get_options('profile', $current_language);
} else {
if ($controls->is_action('save')) {
$module->save_options($controls->data, 'profile', null, $current_language);
$controls->add_message_saved();
}
if ($controls->is_action('reset')) {
$controls->data = $module->reset_options('profile');
$controls->add_message_done();
}
}
$status = array(0 => __('Private', 'newsletter'), 1 => __('Show on profile page', 'newsletter'), 2 => __('Show on subscription form', 'newsletter'));
$rules = array(0 => __('Optional', 'newsletter'), 1 => __('Required', 'newsletter'));
?>
<div class="wrap" id="tnp-wrap">
<?php $help_url = 'https://www.thenewsletterplugin.com/plugins/newsletter/subscription-module'; ?>
<?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
<div id="tnp-heading">
<h2><?php _e('Subscription Form Fields and Layout', 'newsletter') ?></h2>
<p>
This panel contains the configuration of the subscription and profile editing forms which collect the subscriber data you want to have.<br>
And let you to <strong>translate</strong> every single button and label.<br>
<strong>Preferences</strong> can be an important setting for your newsletter: <a href="https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-preferences" target="_blank">here you can read more about them</a>.
</p>
</div>
<div id="tnp-body">
<form action="" method="post">
<?php $controls->init(); ?>
<div id="tabs">
<ul>
<li><a href="#tabs-2">Main profile fields</a></li>
<li><a href="#tabs-3">Extra profile fields</a></li>
<li><a href="#tabs-5">Form code</a></li>
</ul>
<div id="tabs-2">
<p>The main subscriber fields. Only the email field is, of course, mandatory.</p>
<table class="form-table">
<tr>
<th>Email</th>
<td>
<table class="newsletter-option-grid">
<tr><th>Field label</th><td><?php $controls->text('email', 50); ?></td></tr>
<tr><th>Error message</th><td><?php $controls->text('email_error', 50); ?></td></tr>
</table>
</td>
</tr>
<tr>
<th><?php _e('First name', 'newsletter') ?></th>
<td>
<table class="newsletter-option-grid">
<tr><th>Field label</th><td><?php $controls->text('name', 50); ?></td></tr>
<?php if ($is_all_languages) { ?>
<tr><th>When to show</th><td><?php $controls->select('name_status', $status); ?></td></tr>
<tr><th>Rules</th><td><?php $controls->select('name_rules', $rules); ?></td></tr>
<?php } ?>
<tr><th>Error message</th><td><?php $controls->text('name_error', 50); ?></td></tr>
</table>
<p class="description">
If you want to collect only a generic "name", use only this field and not the
last name field.
</p>
</td>
</tr>
<tr>
<th><?php _e('Last name', 'newsletter') ?></th>
<td>
<table class="newsletter-option-grid">
<tr><th>Field label</th><td><?php $controls->text('surname', 50); ?></td></tr>
<?php if ($is_all_languages) { ?>
<tr><th>When to show</th><td><?php $controls->select('surname_status', $status); ?></td></tr>
<tr><th>Rules</th><td><?php $controls->select('surname_rules', $rules); ?></td></tr>
<?php } ?>
<tr><th>Error message</th><td><?php $controls->text('surname_error', 50); ?></td></tr>
</table>
</td>
</tr>
<tr>
<th><?php _e('Gender', 'newsletter') ?></th>
<td>
<table class="newsletter-option-grid">
<tr><th>Field label</th><td><?php $controls->text('sex', 50); ?></td></tr>
<?php if ($is_all_languages) { ?>
<tr><th>When to show</th><td><?php $controls->select('sex_status', $status); ?></td></tr>
<tr><th>Rules</th><td><?php $controls->select('sex_rules', $rules); ?></td></tr>
<?php } ?>
<tr><th>Value labels</th><td>
female: <?php $controls->text('sex_female'); ?>
male: <?php $controls->text('sex_male'); ?>
not specified: <?php $controls->text('sex_none'); ?>
</td></tr>
<tr><th>Salutation titles</th><td>
for males: <?php $controls->text('title_male'); ?> (ex. "Mr")<br>
for females: <?php $controls->text('title_female'); ?> (ex. "Mrs")<br>
for others: <?php $controls->text('title_none'); ?>
</td></tr>
</table>
<p class="description">
Salutation titles are inserted in emails message when the tag {title} is used. For example
"Good morning {title} {surname} {name}".
</p>
</td>
</tr>
<tr>
<th><?php _e('"Subscribe" label', 'newsletter') ?></th>
<td>
<?php $controls->text('subscribe', 40); ?>
<p class="description">
You can use an image URL (http://...).
</p>
</td>
</tr>
<tr>
<th>Privacy checkbox/notice</th>
<td>
<table class="newsletter-option-grid">
<?php if ($is_all_languages) { ?>
<tr><th>Enabled?</th><td><?php $controls->select('privacy_status', array(0 => 'No', 1 => 'Yes', 2 => 'Only the notice')); ?></td></tr>
<?php } ?>
<tr><th>Label</th><td><?php $controls->text('privacy', 50); ?></td></tr>
<tr>
<th>Privacy URL</th>
<td>
<?php if (!$is_all_languages && !empty($controls->data['privacy_use_wp_url'])) { ?>
The "all language" setting is set to use the WordPress default privacy page. Please translate that page.
<?php } else { ?>
<?php if ($is_all_languages) { ?>
<?php if (function_exists('get_privacy_policy_url') && get_privacy_policy_url()) { ?>
<?php $controls->checkbox('privacy_use_wp_url', __('Use WordPress privacy URL', 'newsletter')); ?>
(<a href="<?php echo esc_attr(get_privacy_policy_url()) ?>"><?php echo esc_html(get_privacy_policy_url()) ?></a>)
<br>OR<br>
<?php } ?>
<?php } ?>
<?php if (!$is_all_languages) { ?>
To use the WordPress privacy page, switch to "all language" and activate it.<br>
<?php } ?>
<?php $controls->text_url('privacy_url', 50); ?>
<?php } ?>
</td>
</tr>
<tr>
<th>Error message</th>
<td><?php $controls->text('privacy_error', 50); ?></td></tr>
</table>
<p class="description">
The privacy acceptance checkbox (required in many Europen countries) force the subscriber to
check it before proceeding. If an URL is specified the label become a link.
</p>
</td>
</tr>
</table>
</div>
<div id="tabs-3">
<p>
Generic textual profile fields that can be collected during the subscription. Field formats can be one line text
or selection list. Fields of type "list" must be configured with a set of options, comma separated
like: "first option, second option, third option".
</p>
<p>
The placeholder works only on HTML 5 compliant browsers.
</p>
<table class="form-table">
<tr>
<th>Error message</th>
<td>
<?php $controls->text('profile_error', 50); ?>
</td>
</tr>
</table>
<table class="widefat">
<thead>
<tr>
<th>Field</th><th>Name/Label</th><th>Placeholder</th><th>When/Where</th><th>Type</th><th>Rule</th><th>List values comma separated</th>
</tr>
</thead>
<?php for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) { ?>
<tr>
<td><?php echo $i; ?></td>
<td><?php $controls->text('profile_' . $i); ?></td>
<td><?php $controls->text('profile_' . $i . '_placeholder'); ?></td>
<?php if ($is_all_languages) { ?>
<td><?php $controls->select('profile_' . $i . '_status', $status); ?></td>
<td><?php $controls->select('profile_' . $i . '_type', array('text' => 'Text', 'select' => 'List')); ?></td>
<td><?php $controls->select('profile_' . $i . '_rules', $rules); ?></td>
<?php } ?>
<td>
<?php $controls->textarea_fixed('profile_' . $i . '_options', '200px', '50px'); ?>
</td>
</tr>
<?php } ?>
</table>
</div>
<div id="tabs-5">
<p>This panel shows the form HTML code generated by Newsletter if you want to copy it as starting point for a custom form.</p>
<h3>Standard form code</h3>
<textarea readonly style="width: 100%; height: 500px; font-family: monospace"><?php echo esc_html(NewsletterSubscription::instance()->get_subscription_form()); ?></textarea>
<h3>Widget form code</h3>
<textarea readonly style="width: 100%; height: 500px; font-family: monospace"><?php echo htmlspecialchars(NewsletterSubscription::instance()->get_subscription_form()); ?></textarea>
</div>
</div>
<p>
<?php $controls->button_save(); ?>
<?php $controls->button_reset(); ?>
</p>
</form>
</div>
<?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,122 @@
<?php
defined('ABSPATH') || exit;
@include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
$controls = new NewsletterControls();
$module = NewsletterSubscription::instance();
$current_language = $module->get_current_language();
$is_all_languages = $module->is_all_languages();
if (!$is_all_languages) {
$controls->warnings[] = 'You are configuring the language <strong>' . $current_language . '</strong>.';
}
if (!$controls->is_action()) {
$controls->data = $module->get_options('template', $current_language);
} else {
if ($controls->is_action('save')) {
$module->save_options($controls->data, 'template', null, $current_language);
$controls->add_message_saved();
}
if ($controls->is_action('reset')) {
// TODO: Reset by language?
$module->reset_options('template');
$controls->data = $module->get_options('template', $current_language);
$controls->add_message_done();
}
if ($controls->is_action('test')) {
$users = $module->get_test_users();
if (count($users) == 0) {
$controls->errors = __('No test subscribers found.', 'newsletter') . ' <a href="https://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank"><i class="fa fa-info-circle"></i></a>';
} else {
$template = $controls->data['template'];
$message = '<p>This is a generic example of message embedded inside the template.</p>';
$message .= '<p>Subscriber data can be referenced using tags. See the <a href="https://www.thenewsletterplugin.com/documentation">plugin documentation</a>.</p>';
$message .= '<p>First name: {name}</p>';
$message .= '<p>Last name: {surname}</p>';
$message .= '<p>Email: {email}</p>';
$message .= '<p>Here an image as well. Make them styled with the CSS rule "max-width: 100%"</p>';
$message .= '<p><img src="' . plugins_url('newsletter') . '/images/test.jpg" style="max-width: 100%"></p>';
$message = str_replace('{message}', $message, $template);
$addresses = array();
foreach ($users as $user) {
$addresses[] = $user->email;
Newsletter::instance()->mail($user->email, 'Newsletter Messages Template Test', $module->replace($message, $user));
}
$controls->messages .= 'Test emails sent to ' . count($users) . ' test subscribers: ' .
implode(', ', $addresses) . '.' . ' <a href="https://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank"><i class="fa fa-info-circle"></i></a>';
}
}
}
if (strpos($controls->data['template'], '{message}') === false) {
$controls->errors = __('The tag {message} is missing in your template', 'newsletter');
}
?>
<?php include NEWSLETTER_INCLUDES_DIR . '/codemirror.php'; ?>
<style>
.CodeMirror {
height: 100%;
}
</style>
<script>
jQuery(function () {
templateEditor = CodeMirror.fromTextArea(document.getElementById("options-template"), {
lineNumbers: true,
mode: 'htmlmixed',
extraKeys: {"Ctrl-Space": "autocomplete"}
});
});
</script>
<div class="wrap" id="tnp-wrap">
<?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
<div id="tnp-heading">
<h2><?php _e('Messages template', 'newsletter') ?></h2>
<p>
Edit the default template of confirmation, welcome and cancellation emails. Add the {message} tag where you
want the specific message text to be included.
</p>
</div>
<div id="tnp-body">
<form method="post" action="">
<?php $controls->init(); ?>
<p>
<?php $controls->button_save(); ?>
<?php $controls->button_reset(); ?>
<?php $controls->button('test', 'Send a test'); ?>
</p>
<h3><?php _e('Template', 'newsletter') ?></h3>
<?php $controls->textarea_preview('template', '100%', '700px'); ?>
<br><br>
<p>
<?php $controls->button_save(); ?>
<?php $controls->button_reset(); ?>
<?php $controls->button('test', 'Send a test'); ?>
</p>
</form>
</div>
<?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
</div>

View File

@@ -0,0 +1,31 @@
function newsletter_check_field(field, message) {
if (!field) return true;
if (field.type == "checkbox" && !field.checked) {
alert(message);
return false;
}
if (field.required !== undefined && field.required !== false && field.value == "") {
alert(message);
return false;
}
return true;
}
function newsletter_check(f) {
var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-]{1,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!re.test(f.elements["ne"].value)) {
alert(newsletter.messages.email_error);
return false;
}
if (!newsletter_check_field(f.elements["nn"], newsletter.messages.name_error)) return false;
if (!newsletter_check_field(f.elements["ns"], newsletter.messages.surname_error)) return false;
for (var i=1; i<newsletter.profile_max; i++) {
if (!newsletter_check_field(f.elements["np" + i], newsletter.messages.profile_error)) return false;
}
if (!newsletter_check_field(f.elements["ny"], newsletter.messages.privacy_error)) return false;
return true;
}