Basics, Signup, Advanced tabs
This commit is contained in:
@ -1,2 +1,7 @@
|
||||
.mailpoet_form th
|
||||
width:300px
|
||||
.mailpoet_form .form-table th
|
||||
width:20em
|
||||
|
||||
// responsive
|
||||
@media screen and (max-width: 782px)
|
||||
.mailpoet_form .form-table th
|
||||
width: auto
|
@ -139,11 +139,70 @@ class Menu {
|
||||
$pages[$key] = $page;
|
||||
}
|
||||
|
||||
// Charsets
|
||||
$charsets = array(
|
||||
'UTF-8', 'UTF-7', 'BIG5', 'ISO-2022-JP',
|
||||
'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3',
|
||||
'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6',
|
||||
'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9',
|
||||
'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14',
|
||||
'ISO-8859-15', 'Windows-1251', 'Windows-1252'
|
||||
);
|
||||
|
||||
// Roles & Permissions
|
||||
global $wp_roles;
|
||||
$editable_roles = apply_filters('editable_roles', $wp_roles->roles);
|
||||
$roles = array();
|
||||
foreach($editable_roles as $role => $role_data) {
|
||||
$roles[$role] = translate_user_role($role_data['name']);
|
||||
}
|
||||
|
||||
$capabilities = array(
|
||||
'mailpoet_newsletters' =>
|
||||
__('Who can create newsletters?'),
|
||||
'mailpoet_newsletter_styles' =>
|
||||
__('Who can see the styles tab in the visual editor?'),
|
||||
'mailpoet_subscribers' =>
|
||||
__('Who can manage subscribers?'),
|
||||
'mailpoet_settings' =>
|
||||
__("Who can change MailPoet's settings?"),
|
||||
);
|
||||
$capabilities = apply_filters('mailpoet_capabilities', $capabilities);
|
||||
|
||||
// go over each capability
|
||||
foreach($capabilities as $capability => $label) {
|
||||
$capability_roles = array();
|
||||
// go over each role and check permission
|
||||
foreach($roles as $role_key => $role_data) {
|
||||
// get role object based on role key
|
||||
$role = get_role($role_key);
|
||||
|
||||
// assign role capability
|
||||
$capability_roles[$role_key] = array(
|
||||
'capability' => $capability,
|
||||
'is_capable' => (
|
||||
in_array($role_key, array('administrator', 'super_admin'))
|
||||
|| ($role->has_cap($capability))
|
||||
),
|
||||
'is_disabled' =>(
|
||||
in_array($role_key, array('administrator', 'super_admin'))
|
||||
)
|
||||
);
|
||||
}
|
||||
$capabilities[$capability] = array(
|
||||
'label' => $label,
|
||||
'roles' => $capability_roles
|
||||
);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'segments' => $segments,
|
||||
'pages' => $pages,
|
||||
'flags' => $flags,
|
||||
'current_user' => $current_user
|
||||
'charsets' => $charsets,
|
||||
'current_user' => $current_user,
|
||||
'capabilities' => $capabilities,
|
||||
'roles' => $roles
|
||||
);
|
||||
|
||||
echo $this->renderer->render('settings.html', $data);
|
||||
|
@ -46,7 +46,7 @@ class Renderer {
|
||||
|
||||
function setupSyntax() {
|
||||
$lexer = new TwigLexer($this->renderer, array(
|
||||
'tag_comment' => array('<%#', '%>'),
|
||||
'tag_comment' => array('<#', '#>'),
|
||||
'tag_block' => array('<%', '%>'),
|
||||
'tag_variable' => array('<%=', '%>'),
|
||||
'interpolation' => array('%{', '}')
|
||||
|
@ -36,6 +36,11 @@ class Functions extends \Twig_Extension {
|
||||
'admin_url',
|
||||
'admin_url',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
'get_option',
|
||||
'get_option',
|
||||
array('is_safe' => array('all'))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
</h2>
|
||||
|
||||
<!-- basics -->
|
||||
|
||||
<div id="mailpoet_settings_basics" class="mailpoet_panel">
|
||||
<% include 'settings/basics.html' %>
|
||||
</div>
|
||||
@ -30,22 +31,22 @@
|
||||
<div id="mailpoet_settings_signup" class="mailpoet_panel">
|
||||
<% include 'settings/signup.html' %>
|
||||
</div>
|
||||
|
||||
<#
|
||||
<!-- sending method -->
|
||||
<div id="mailpoet_settings_mta" class="mailpoet_panel">
|
||||
<% include 'settings/mta.html' %>
|
||||
</div>
|
||||
|
||||
#>
|
||||
<!-- advanced -->
|
||||
<div id="mailpoet_settings_advanced" class="mailpoet_panel">
|
||||
<% include 'settings/advanced.html' %>
|
||||
</div>
|
||||
|
||||
<#
|
||||
<!-- bounce -->
|
||||
<div id="mailpoet_settings_bounce" class="mailpoet_panel">
|
||||
<% include 'settings/bounce.html' %>
|
||||
</div>
|
||||
|
||||
#>
|
||||
<p>
|
||||
<input
|
||||
type="submit"
|
||||
@ -58,6 +59,46 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
// on dom loaded
|
||||
$(function() {
|
||||
|
||||
// setup toggle checkboxes
|
||||
function toggleContent() {
|
||||
$('#'+$(this).data('toggle'))[
|
||||
($(this).is(':checked'))
|
||||
? 'show'
|
||||
: 'hide'
|
||||
]();
|
||||
}
|
||||
$(document).on('click', 'input[data-toggle]', toggleContent);
|
||||
$('input[data-toggle]').each(toggleContent);
|
||||
|
||||
// page preview
|
||||
$('.mailpoet_page_preview').on('click', function() {
|
||||
var selection = $(this).siblings('.mailpoet_page_selection');
|
||||
|
||||
if(selection.length > 0) {
|
||||
$(this).attr('href', $(selection).find('option[value="'+$(selection).val()+'"]').data('preview-url'));
|
||||
$(this).attr('target', '_blank');
|
||||
} else {
|
||||
$(this).attr('href', 'javascript:;');
|
||||
$(this).removeAttr('target');
|
||||
}
|
||||
});
|
||||
|
||||
// page edit
|
||||
$('.mailpoet_page_edit').on('click', function() {
|
||||
var selection = $(this).siblings('.mailpoet_page_selection');
|
||||
if(selection.length > 0) {
|
||||
$(this).attr('href', $(selection).find('option[value="'+$(selection).val()+'"]').data('edit-url'));
|
||||
$(this).attr('target', '_blank');
|
||||
} else {
|
||||
$(this).attr('href', 'javascript:;');
|
||||
$(this).removeAttr('target');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% endblock %>
|
||||
|
@ -1 +1,181 @@
|
||||
advanced.html
|
||||
<table class="widefat fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="manage-column">
|
||||
<%= __('Roles and permissions') %>
|
||||
</th>
|
||||
<% for role in roles %>
|
||||
<th class="manage-column">
|
||||
<%= role %>
|
||||
</th>
|
||||
<% endfor %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for capability in capabilities %>
|
||||
<tr class="<%= cycle(['alternate', ''], loop.index0) %>">
|
||||
<td>
|
||||
<%= capability.label %>
|
||||
</td>
|
||||
<% for role in capability.roles %>
|
||||
<td>
|
||||
<input
|
||||
class="mailpoet_role_permission"
|
||||
type="checkbox"
|
||||
data-role="<%= role %>"
|
||||
data-capability="<%= capability %>"
|
||||
value="1"
|
||||
<% if(role.is_capable) %>
|
||||
checked="checked"
|
||||
<% endif %>
|
||||
<% if(role.is_disabled) %>
|
||||
disabled="disabled"
|
||||
<% endif %>
|
||||
/>
|
||||
</td>
|
||||
<% endfor %>
|
||||
</tr>
|
||||
<% endfor %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<!-- bounce email -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[bounce_email]">
|
||||
<%= __('Bounce email') %>
|
||||
<p class="description">
|
||||
<%= __('To which address should all the bounced emails go?') %>
|
||||
</p>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input type="text"
|
||||
id="settings[bounce_email]"
|
||||
name="bounce_email"
|
||||
value="<%= settings.bounce_email %>"
|
||||
placeholder="bounce@mydomain.com"
|
||||
/>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- share anonymous data? -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label>
|
||||
<%= __('Share anonymous data') %>
|
||||
<p class="description">
|
||||
<%= __('Share anonymous data and help us improve the plugin.') %>
|
||||
<a
|
||||
href="http://support.mailpoet.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=advanced_settings"
|
||||
target="_blank"
|
||||
><%= __('Read more.') %></a>
|
||||
</p>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="analytics"
|
||||
value="1"
|
||||
<% if(settings.analytics) %>
|
||||
checked="checked"
|
||||
<% endif %>
|
||||
/> <%= __('Yes') %>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="analytics"
|
||||
value=""
|
||||
<% if not(settings.analytics) %>
|
||||
checked="checked"
|
||||
<% endif %>
|
||||
/> <%= __('No') %>
|
||||
</label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- charset -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[newsletter_charset]">
|
||||
<%= __('Charset') %>
|
||||
<p class="description">
|
||||
<%= __('Squares or weird characters are displayed in your emails? Select the encoding for your language.') %>
|
||||
</p>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<select id="settings[newsletter_charset]" name="newsletter_charset">
|
||||
<% for charset in charsets %>
|
||||
<option
|
||||
value="<%= charset %>"
|
||||
<% if(settings.newsletter_charset == charset) %>
|
||||
selected="selected"
|
||||
<% endif %>
|
||||
><%= charset %></option>
|
||||
<% endfor %>
|
||||
</select>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- debug mode -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label>
|
||||
<%= __('Debug mode') %>
|
||||
<p class="description">
|
||||
<%= __("Enable this to show MailPoet's errors. Our support might ask you to enable this if you seek their help.") %>
|
||||
</p>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="debug"
|
||||
value="1"
|
||||
<% if(settings.debug) %>
|
||||
checked="checked"
|
||||
<% endif %>
|
||||
/><%= __('Yes') %>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="debug"
|
||||
value=""
|
||||
<% if not(settings.debug) %>
|
||||
checked="checked"
|
||||
<% endif %>
|
||||
/><%= __('No') %>
|
||||
</label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- reinstall -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label><%= __('Reinstall from scratch') %>
|
||||
<p class="description"><%= __('Want to start all over again? This will wipe out MailPoet and reinstall anew.') %></p>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<a
|
||||
id="mailpoet_reinstall"
|
||||
class="button"
|
||||
href="javascript:;"><%= __('Reinstall now...') %></a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -330,43 +330,6 @@
|
||||
jQuery(function($) {
|
||||
// on dom loaded
|
||||
$(function() {
|
||||
|
||||
// setup toggle checkboxes
|
||||
function toggleContent() {
|
||||
$('#'+$(this).data('toggle'))[
|
||||
($(this).is(':checked'))
|
||||
? 'show'
|
||||
: 'hide'
|
||||
]();
|
||||
}
|
||||
$(document).on('click', 'input[data-toggle]', toggleContent);
|
||||
$('input[data-toggle]').each(toggleContent);
|
||||
|
||||
// page preview
|
||||
$('.mailpoet_page_preview').on('click', function() {
|
||||
var selection = $(this).siblings('.mailpoet_page_selection');
|
||||
|
||||
if(selection.length > 0) {
|
||||
$(this).attr('href', $(selection).find('option[value="'+$(selection).val()+'"]').data('preview-url'));
|
||||
$(this).attr('target', '_blank');
|
||||
} else {
|
||||
$(this).attr('href', 'javascript:;');
|
||||
$(this).removeAttr('target');
|
||||
}
|
||||
});
|
||||
|
||||
// page edit
|
||||
$('.mailpoet_page_edit').on('click', function() {
|
||||
var selection = $(this).siblings('.mailpoet_page_selection');
|
||||
if(selection.length > 0) {
|
||||
$(this).attr('href', $(selection).find('option[value="'+$(selection).val()+'"]').data('edit-url'));
|
||||
$(this).attr('target', '_blank');
|
||||
} else {
|
||||
$(this).attr('href', 'javascript:;');
|
||||
$(this).removeAttr('target');
|
||||
}
|
||||
});
|
||||
|
||||
// select2 instances
|
||||
$('#mailpoet_subscribe_on_comment_lists').select2();
|
||||
$('#mailpoet_subscribe_on_register_lists').select2();
|
||||
|
@ -1 +1,216 @@
|
||||
signup.html
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<!-- enable signup confirmation -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label>
|
||||
<%= __('Enable signup confirmation') %>
|
||||
<p class="description">
|
||||
<%= __('Prevent people from being subscribed to your list unwillingly,this option ensures you to keep a clean list.') %>
|
||||
<a href="#TODO" target="_blank"><%= __('Learn more.') %></a>
|
||||
</p>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
class="mailpoet_signup_confirmation"
|
||||
name="signup_confirmation"
|
||||
value="1"
|
||||
<% if not(settings.signup_confirmation) %>
|
||||
checked="checked"
|
||||
<% endif %>
|
||||
/><%= __('Yes') %>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
class="mailpoet_signup_confirmation"
|
||||
name="signup_confirmation"
|
||||
value=""
|
||||
<% if(settings.signup_confirmation) %>
|
||||
checked="checked"
|
||||
<% endif %>
|
||||
/><%= __('No') %>
|
||||
</label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="mailpoet_signup_options" class="form-table">
|
||||
<tbody>
|
||||
<!-- signup confirmation: from name & email -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[signup_confirmation_from_name]">
|
||||
<%= __('From') %>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input
|
||||
type="text"
|
||||
id="settings[signup_confirmation_from_name]"
|
||||
name="signup_confirmation_from_name"
|
||||
value="<%= settings.signup_confirmation_from_name %>"
|
||||
placeholder="<%= __('Your name') %>"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
id="settings[signup_confirmation_from_email]"
|
||||
name="signup_confirmation_from_email"
|
||||
value="<%= settings.signup_confirmation_from_email %>"
|
||||
placeholder="confirmation@mydomain.com"
|
||||
size="28"
|
||||
/>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- signup confirmation: reply_to name & email -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[signup_confirmation_reply_name]">
|
||||
<%= __('Reply-to') %>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<input
|
||||
type="text"
|
||||
id="settings[signup_confirmation_reply_name]"
|
||||
name="signup_confirmation_reply_name"
|
||||
value="<%= settings.signup_confirmation_reply_name %>"
|
||||
placeholder="<%= __('Your name') %>"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
id="settings[signup_confirmation_reply_email]"
|
||||
name="signup_confirmation_reply_email"
|
||||
value="<%= settings.signup_confirmation_reply_email %>"
|
||||
placeholder="confirmation@mydomain.com"
|
||||
size="28"
|
||||
/>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- confirmation email: title -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[signup_confirmation_email_subject]">
|
||||
<%= __('Email subject') %>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<input
|
||||
size="52"
|
||||
type="text"
|
||||
id="settings[signup_confirmation_email_subject]"
|
||||
name="signup_confirmation_email_subject"
|
||||
<% if(settings.signup_confirmation_email_subject) %>
|
||||
value="<%= settings.signup_confirmation_email_subject %>"
|
||||
<% else %>
|
||||
value="<%= __('Confirm your subscription to %1$s') %>"
|
||||
<% endif %>
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- confirmation email: body -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="settings[signup_confirmation_email_body]">
|
||||
<%= __('Email content') %>
|
||||
<p class="description">
|
||||
<%= __("Don't forget to include:<br /><br />[activation_link]Confirm your subscription.[/activation_link].<br /><br />Optional: [lists_to_confirm].") %>
|
||||
</p>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<textarea
|
||||
cols="50"
|
||||
rows="15"
|
||||
id="settings[signup_confirmation_email_body]"
|
||||
name="signup_confirmation_email_body"
|
||||
><% if(settings.signup_confirmation_email_body) %>
|
||||
<%=- settings.signup_confirmation_email_body -%>
|
||||
<% else %>
|
||||
<%=- __("Hello!\n\nHurray! You've subscribed to our site.\nWe need you to activate your subscription to the list(s): [lists_to_confirm] by clicking the link below: \n\n[activation_link]Click here to confirm your subscription.[/activation_link]\n\nThank you,\n\nThe team!") -%>
|
||||
<% endif %></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- signup confirmation: confirmation page -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label>
|
||||
<%= __('Confirmation page') %>
|
||||
<p class="description">
|
||||
<%= __('When subscribers click on the activation link, they are redirected to a page of your choice.') %>
|
||||
</p>
|
||||
</label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<select
|
||||
class="mailpoet_page_selection"
|
||||
name="signup_confirmation_page"
|
||||
>
|
||||
<% for page in pages %>
|
||||
<option
|
||||
value="<%= page.ID %>"
|
||||
data-preview-url="<%= page.preview_url|raw %>"
|
||||
data-edit-url="<%= page.edit_url|raw %>"
|
||||
<% if(page.ID == settings.signup_confirmation_page) %>
|
||||
selected="selected"
|
||||
<% endif %>
|
||||
><%= page.post_title %></option>
|
||||
<% endfor %>
|
||||
</select>
|
||||
<a
|
||||
class="mailpoet_page_preview"
|
||||
href="javascript:;"
|
||||
title="<%= __('Preview page') %>"
|
||||
><%= __('Preview') %></a> | <a
|
||||
class="mailpoet_page_edit"
|
||||
href="javascript:;"
|
||||
title="<%= __('Edit page') %>"
|
||||
><%= __('Edit') %></a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
// om dom loaded
|
||||
$(function() {
|
||||
// double optin toggling
|
||||
toggleSignupOptions();
|
||||
|
||||
$('.mailpoet_signup_confirmation').on('click', function() {
|
||||
var result = false;
|
||||
|
||||
if(parseInt($(this).val(), 10) === 1) {
|
||||
result = confirm("<%= __('Subscribers will now need to activate their subscription by email in order to receive your newsletters. This is recommended.') %>");
|
||||
} else {
|
||||
result = confirm("<%= __('Unconfirmed subscribers will receive your newsletters from now on without the need to activate their subscriptions.') %>");
|
||||
}
|
||||
// if the user confirmed changing the signup confirmation (yes/no)
|
||||
if(result === true) {
|
||||
// toggle signup options depending on the currently selected value
|
||||
toggleSignupOptions();
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
function toggleSignupOptions() {
|
||||
var is_enabled =
|
||||
parseInt($('.mailpoet_signup_confirmation:checked').val(), 10) === 1;
|
||||
$('#mailpoet_signup_options')[(is_enabled) ? 'show' : 'hide']();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user