diff --git a/README.txt b/README.txt
index ca54b89..8116da4 100755
--- a/README.txt
+++ b/README.txt
@@ -1,9 +1,9 @@
-=== Email Templates ===
+=== Email Templates Customizer and Designer for WordPress and WooCommerce ===
Contributors: wpexpertsio
-Tags: email templates, email template, html email, email template, template, better emails, wp better emails, wp email templates, html emails, postman, wp smtp, woocommerce, easy digital downloads
-Requires at least: 4.0
-Tested up to: 5.9
-Stable tag: 1.3.2.1
+Tags: Email templates, email designer, email customizer, email, woocommerce email
+Requires at least: 7.4
+Tested up to: 6.1.1
+Stable tag: 1.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -37,7 +37,8 @@ Send your translations to [Transifex](https://www.transifex.com/projects/p/wp-em
1. Upload the plugin in /wp-admin/plugin-install.php
2. Activate the plugin through the 'Plugins' menu in WordPress
-3. Click on Appearance -> "Email Templates" to start editing
+3. Click on Email Templates -> "WordPress Email" to start editing
+4. Click on Email Templates -> "WooCommerce Email" to start editing
== Frequently Asked Questions ==
@@ -54,9 +55,20 @@ Copy the templates folder into your theme , then in functions.php add the follow
1. Email Templates - Settings
2. Boxed layout
3. Full-width layout
+4. Email Notification
+5. Email Type
+6. Background Color
+7. Bundle Icon
+8. Send Preview Email
+9. Email Type and Text
+10. Font Family
+11. WooCommerce Emails
== Changelog ==
+= 1.4 =
+* NEW - WooCommerce Email Customizer Added
+
= 1.3.2.1 =
* Emails not being send when multiple emails where being sent at the same time
diff --git a/admin/class-mailtpl-admin.php b/admin/class-mailtpl-admin.php
index 3c86e76..5785faa 100755
--- a/admin/class-mailtpl-admin.php
+++ b/admin/class-mailtpl-admin.php
@@ -8,7 +8,7 @@
*
* @package Mailtpl
* @subpackage Mailtpl/admin
- * @author Damian Logghe
+ * @author wpexperts
*/
class Mailtpl_Admin {
@@ -43,15 +43,133 @@ public function __construct( $plugin_name, $version ) {
$this->version = $version;
}
-
+ public function email_template() {
+ $link = $this->get_customizer_link();
+ ?>
+
+
+
+
+
+
+ Email Templates
+
+
+
+
+
+
+
WordPress Email Templates
+
Live preview your WordPress emails.
+
Customize emails to match your brand colors.
+
Customize heading, subtitle, and body text.
+
Design and send custom-built emails with WordPress Email Templates.
+
Choose your template style, add a logo or some text, change colors, edit footer and start sending nice emails in WordPress.
+
+
+ Open WordPress Email Editor
+
+
+
+
+
+
WooCommerce Email Templates
+
Customize the default transactional emails.
+
Live preview your WooCommerce emails.
+
Export and import your plugin settings.
+
Design and customize WooCommerce's default transactional email templates.
+
Use WordPress's native customizer for visual edits and customize the text (including body text) in WooCommerce without editing code.
+
+
+ Open Woocommerce Email Editor
+
+
+
+
+ get_customizer_link();
- add_submenu_page( 'themes.php', 'Email Templates', 'Email Templates', apply_filters( 'mailtpl/roles', 'edit_theme_options'), $link , null );
-
+ public function add_menu_link() {
+
+ add_menu_page(
+ esc_html__( 'Email Templates', 'mailtpl-woocommerce-email-composer' ),
+ esc_html__( 'Email Templates', 'mailtpl-woocommerce-email-composer' ),
+ 'manage_woocommerce',
+ 'email-Template',
+ array( $this,'email_template' ),
+ 'dashicons-email',
+ 52
+ );
}
/**
* If we are in our template strip everything out and leave it clean
@@ -142,7 +260,7 @@ public function wp_pointers() {
wp_enqueue_style( 'wp-pointer' );
// Add pointers script to queue. Add custom script.
- wp_enqueue_script( 'mailtpl-pointer', MAILTPL_PLUGIN_URL . '/admin/js/mailtpl-pointer.js', array( 'wp-pointer' ) );
+ wp_enqueue_script( 'mailtpl-pointer', MAILTPL_WOOMAIL_URL . '/admin/js/mailtpl-pointer.js', array( 'wp-pointer' ) );
// Add pointer options to script.
wp_localize_script( 'mailtpl-pointer', 'mailtpl_pointer', $valid_pointers );
@@ -204,7 +322,7 @@ function woocommerce_integration( $WC_Emails ) {
remove_filter( 'mailtpl/email_content', 'convert_chars' );
remove_filter( 'mailtpl/email_content', 'wpautop' );
remove_action('woocommerce_email_header', array($WC_Emails , 'email_header'));
- remove_action('woocommerce_email_footer', array($WC_Emails , 'email_footer'));
+ //remove_action('woocommerce_email_footer', array($WC_Emails , 'email_footer'));
}
diff --git a/admin/js/mailtpl-admin.js b/admin/js/mailtpl-admin.js
index e2f42aa..f19eccd 100755
--- a/admin/js/mailtpl-admin.js
+++ b/admin/js/mailtpl-admin.js
@@ -1,24 +1,12 @@
(function( $ ) {
$(window).load(function () {
-
- wp.customize.panel( 'mailtpl' ).focus();
$('.mailtpl_range').on('input',function(){
var val = $(this).val();
$(this).parent().find('.font_value').html(val);
$(this).val(val);
});
- $('#mailtpl-send_mail').on('click', function(e){
- e.preventDefault();
- $('#mailtpl-spinner').fadeIn();
- $.ajax({
- url : ajaxurl,
- data : { action: 'mailtpl_send_email' }
- }).done(function(data) {
- $('#mailtpl-spinner').fadeOut();
- $('#mailtpl-success').fadeIn().delay(3000).fadeOut();
- });
- });
+
if( $('#customize-control-mailtpl_template select').val() != 'boxed' ) {
$('#customize-control-mailtpl_body_size').hide();
}
@@ -31,4 +19,18 @@
});
});
+ $( document ).ready( function() {
+ $(document).on('click', '#mailtpl-send_mail', function(e){
+ e.preventDefault();
+ $('#mailtpl-spinner').fadeIn();
+ $.ajax({
+ url : ajaxurl,
+ data : { action: 'mailtpl_send_email' }
+ }).done(function(data) {
+ $('#mailtpl-spinner').fadeOut();
+ $('#mailtpl-success').fadeIn().delay(3000).fadeOut();
+ });
+ });
+ } );
+
})( jQuery );
diff --git a/admin/templates/partials/default-message.php b/admin/templates/partials/default-message.php
index 6563a66..6ebf00e 100644
--- a/admin/templates/partials/default-message.php
+++ b/admin/templates/partials/default-message.php
@@ -4,7 +4,9 @@
Placeholders
-
+">
%%BLOG_URL%%
%%HOME_URL%%
%%BLOG_NAME%%
diff --git a/admin/templates/partials/footer.php b/admin/templates/partials/footer.php
index 80c8435..ff44038 100644
--- a/admin/templates/partials/footer.php
+++ b/admin/templates/partials/footer.php
@@ -5,7 +5,7 @@
* @version 1.0
* @since 1.4
* @package Wordpress Social Invitations
- * @author Timersys
+ * @author wpexpert
*/
if ( ! defined( 'ABSPATH' ) ) exit;
$border_radius = $settings['template'] == 'boxed' ? '6px' : '0px';
diff --git a/admin/templates/partials/header.php b/admin/templates/partials/header.php
index b633aa6..350ba9b 100644
--- a/admin/templates/partials/header.php
+++ b/admin/templates/partials/header.php
@@ -5,7 +5,7 @@
* @version 1.0
* @since 1.4
* @package Wordpress Social Invitations
- * @author Timersys
+ * @author wpexpert
*/
if ( ! defined( 'ABSPATH' ) ) exit;
diff --git a/assets/css/customizer-icon-select.css b/assets/css/customizer-icon-select.css
new file mode 100644
index 0000000..ef69eee
--- /dev/null
+++ b/assets/css/customizer-icon-select.css
@@ -0,0 +1,379 @@
+@font-face {
+ font-family: 'woomail-social';
+ src: url('fonts/woomail-social.eot?h4ww1a');
+ src: url('fonts/woomail-social.eot?h4ww1a#iefix') format('embedded-opentype'),
+ url('fonts/woomail-social.woff2?h4ww1a') format('woff2'),
+ url('fonts/woomail-social.ttf?h4ww1a') format('truetype'),
+ url('fonts/woomail-social.woff?h4ww1a') format('woff'),
+ url('fonts/woomail-social.svg?h4ww1a#woomail-social') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+
+[class^="mailtpl-woomail-"], [class*=" mailtpl-woomail-"] {
+ /* use !important to prevent issues with browser extensions that change fonts */
+ font-family: 'woomail-social' !important;
+ speak: none;
+ font-style: normal;
+ font-weight: normal;
+ font-variant: normal;
+ text-transform: none;
+ line-height: 1;
+
+ /* Better Font Rendering =========== */
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.mailtpl-woomail-stumbleupon:before {
+ content: "\e900";
+}
+.mailtpl-woomail-vk:before {
+ content: "\e901";
+}
+.mailtpl-woomail-twitter:before {
+ content: "\f081";
+}
+.mailtpl-woomail-facebook:before {
+ content: "\f082";
+}
+.mailtpl-woomail-linkedin:before {
+ content: "\f08c";
+}
+.mailtpl-woomail-link:before {
+ content: "\f0c1";
+}
+.mailtpl-woomail-google-plus:before {
+ content: "\f0d4";
+}
+.mailtpl-woomail-rss:before {
+ content: "\f143";
+}
+.mailtpl-woomail-youtube:before {
+ content: "\f166";
+}
+.mailtpl-woomail-instagram:before {
+ content: "\f16d";
+}
+.mailtpl-woomail-tumblr:before {
+ content: "\f174";
+}
+.mailtpl-woomail-dribbble:before {
+ content: "\f17d";
+}
+.mailtpl-woomail-vimeo:before {
+ content: "\f194";
+}
+.mailtpl-woomail-digg:before {
+ content: "\f1a6";
+}
+.mailtpl-woomail-whatsapp:before {
+ content: "\f232";
+}
+.mailtpl-woomail-pinterest:before {
+ content: "\f0d3";
+}
+
+
+.icons-selector * {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
+}
+/* Display */
+.icons-selector {
+ display: inline-block;
+}
+/* Icon selector */
+.icons-selector .selector {
+ border: 1px solid #EDEDED;
+ width: 100px;
+ height: 40px;
+ background-color: #fff;
+}
+/* Selector open button */
+.icons-selector .selector-button {
+ background-color: #F4F4F4;
+ width: 39px;
+ height: 100%;
+ display:block;
+ text-align: center;
+ cursor: pointer;
+ float: left;
+ border-left: 1px solid #E1E1E1;
+}
+/* Selector open button hover */
+.icons-selector .selector-button:hover {
+ background-color: #f1f1f1;
+}
+.icons-selector .selector-button:hover i {
+ color: #999;
+}
+/* Selector open button icon */
+.icons-selector .selector-button i {
+ line-height: 40px;
+ text-align: center;
+ color: #aaa;
+ text-shadow: 0px 1px 0px #FFF;
+}
+/* Selected icon container */
+.icons-selector .selected-icon {
+ display: block;
+ width: 60px;
+ height: 100%;
+ float: left;
+ text-align: center;
+}
+/* Selected icon */
+.icons-selector .selected-icon i {
+ line-height: 42px;
+ font-size: 18px;
+ cursor: default;
+ color: #404040;
+}
+/* IconPicker Popup */
+.icons-selector .selector-popup {
+ position: absolute;
+ z-index: 10000;
+ background-color: #fefefe;
+ padding: 5px;
+ -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+ box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+ height: auto;
+ width: 342px;
+ border: 1px solid #E5E5E5;
+ margin-top:-1px;
+}
+/* Search input */
+.icons-selector .selector-search input[type="text"] {
+ border: 0;
+ line-height: 20px;
+ padding: 10px 2.5%;
+ width: 100%;
+ border: 1px solid #EDEDED;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ margin-bottom: 5px;
+ font-size: 12px;
+ color: #404040;
+ -moz-box-shadow: none;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+ outline: none;
+}
+/* Search input placeholder */
+.icons-selector input::-webkit-input-placeholder { color:#ddd;text-transform: uppercase; }
+.icons-selector input:-moz-placeholder { color:#ddd;text-transform: uppercase; }
+.icons-selector input::-moz-placeholder { color:#ddd;text-transform: uppercase;}
+.icons-selector input:-ms-input-placeholder { color:#ddd !important;text-transform: uppercase; }
+/* Search and cancel icon */
+.icons-selector .selector-search i {
+ color: #eee;
+ margin-left: -30px;
+}
+/* Icon Container inside Popup */
+.icons-selector .fip-icons-container {
+ width: 100%;
+ background-color: #fff;
+ border: 1px solid #EDEDED;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ padding: 5px;
+}
+/* Icon container loading */
+.icons-selector .fip-icons-container .loading {
+ color:#eee;
+ font-size:24px;
+ margin:0 auto;
+ padding:20px 0;
+ text-align:center;
+ width:100%;
+}
+/* Single icon box */
+.icons-selector .fip-box {
+ height: 40px;
+ font-size: 16px;
+ border: 1px solid #EFEFEF;
+ display: inline-block;
+ margin: 2px;
+ width: 60px;
+ line-height: 42px;
+ text-align: center;
+ cursor: pointer;
+ vertical-align: top;
+}
+/* Single icon box hover */
+.icons-selector .fip-box:hover {
+ background-color: #f6f6f6;
+}
+/* Popup footer */
+.icons-selector .selector-footer {
+ line-height: 12px;
+ padding: 5px 5px 0 5px;
+}
+/* Pagination and footer icons */
+.icons-selector .selector-footer, .icons-selector .selector-footer i {
+ color: #999;
+font-size: 24px;
+}
+/* Pagination arrows container */
+.icons-selector .selector-arrows {
+ float: right;
+}
+/* Pagination text */
+.icons-selector .selector-pages {
+ font-size: 11px;
+}
+/* Pagination arrows icons */
+.icons-selector .selector-arrows i {
+ cursor: pointer;
+}
+/* Pagination arrows icons hover */
+.icons-selector .selector-arrows i:hover {
+ color: #777;
+}
+/* Currently selected icon color */
+.icons-selector span.current-icon, .icons-selector span.current-icon:hover {
+ background-color: #2EA2CC;color: #fff;border: 1px solid #298CBA;
+}
+/* No icons found */
+.icons-selector .icons-picker-error i:before {
+ color: #eee;
+ font-size: 22px;
+ padding: 20px 0;
+ display: block;
+ margin: 0 auto;
+ width: 20px;
+ cursor: default;
+}
+/* Icons */
+@font-face {
+ font-family: 'iconpicker';
+ src: url('fonts/iconpicker.eot?90190138');
+ src: url('fonts/iconpicker.eot?90190138#iefix') format('embedded-opentype'),
+ url('fonts/iconpicker.woff?90190138') format('woff'),
+ url('fonts/iconpicker.ttf?90190138') format('truetype'),
+ url('fonts/iconpicker.svg?90190138#iconpicker') format('svg');
+ font-weight: normal;
+ font-style: normal;
+}
+.icons-selector [class^="fip-icon-"]:before, .icons-selector [class*=" fip-icon-"]:before {
+ font-family: "iconpicker";
+ font-style: normal;
+ font-weight: normal;
+ speak: none;
+ display: inline-block;
+ text-decoration: inherit;
+ width: 1em;
+ margin-right: .2em;
+ text-align: center;
+ font-variant: normal;
+ text-transform: none;
+ line-height: 1em;
+ margin-left: .2em;
+}
+/* Search icon */
+.icons-selector .fip-icon-search:before { content: '\e812';cursor: default; }
+/* Cancel search icon */
+.icons-selector .fip-icon-cancel:before { content: '\e814';cursor: pointer; }
+/* No icon set */
+.icons-selector .fip-icon-block:before { content: '\e84e';color: #fed0d0; }
+/* Open picker icon */
+.icons-selector .fip-icon-down-dir:before { content: '\e800'; }
+/* Close picker icon */
+.icons-selector .fip-icon-up-dir:before { content: '\e813'; }
+/* Prev page icon */
+.icons-selector .fip-icon-left-dir:before { content: '\e801'; }
+/* Next page icon */
+.icons-selector .fip-icon-right-dir:before { content: '\e802'; }
+/* Loading icon */
+.icons-selector .fip-icon-spin3:before { content: '\e815'; }
+.icons-selector .fip-icon-spin3 {
+ -moz-animation: spin 2s infinite linear;
+ -o-animation: spin 2s infinite linear;
+ -webkit-animation: spin 2s infinite linear;
+ animation: spin 2s infinite linear;
+ display: inline-block;
+}
+@-moz-keyframes spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+@-webkit-keyframes spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+@-o-keyframes spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+@-ms-keyframes spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
+@keyframes spin {
+ 0% {
+ -moz-transform: rotate(0deg);
+ -o-transform: rotate(0deg);
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ -moz-transform: rotate(359deg);
+ -o-transform: rotate(359deg);
+ -webkit-transform: rotate(359deg);
+ transform: rotate(359deg);
+ }
+}
diff --git a/assets/css/customizer-range-value-control.css b/assets/css/customizer-range-value-control.css
new file mode 100644
index 0000000..d42782a
--- /dev/null
+++ b/assets/css/customizer-range-value-control.css
@@ -0,0 +1,110 @@
+/*
+*, *:before, *:after {
+ box-sizing: border-box;
+}
+
+body {
+ font-family: sans-serif;
+ padding: 60px 20px;
+}
+
+@media (min-width: 600px) {
+ body {
+ padding: 60px;
+ }
+}
+*/
+/*.range-slider {
+ margin: 60px 0 0 0%;
+}*/
+
+.range-slider {
+ width: 100%;
+}
+/*
+.range-slider__range {
+ -webkit-appearance: none;
+ width: calc(100% - (95px));
+ height: 10px;
+ border-radius: 5px;
+ background: #d7dcdf;
+ outline: none;
+ padding: 0;
+ margin: 0;
+}
+
+ .range-slider__range::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ background: #bb77ae;
+ cursor: pointer;
+ -webkit-transition: background .15s ease-in-out;
+ transition: background .15s ease-in-out;
+}
+
+.range-slider__range::-webkit-slider-thumb:hover {
+ background: #bb77ae;
+}
+
+.range-slider__range:active::-webkit-slider-thumb {
+ background: #bb77ae;
+}
+
+.range-slider__range::-moz-range-thumb {
+ width: 20px;
+ height: 20px;
+ border: 0;
+ border-radius: 50%;
+ background: #bb77ae;
+ cursor: pointer;
+ -webkit-transition: background .15s ease-in-out;
+ transition: background .15s ease-in-out;
+}
+
+.range-slider__range::-moz-range-thumb:hover {
+ background: #bb77ae;
+}
+
+.range-slider__range:active::-moz-range-thumb {
+ background: #bb77ae;
+} */
+
+.range-slider__value {
+ display: inline-block;
+ position: relative;
+ width: 60px;
+ color: #fff;
+ line-height: 20px;
+ text-align: center;
+ border-radius: 3px;
+ background: #0075ff;
+ padding: 5px 10px;
+ margin-left: 8px;
+}
+
+/*.range-slider__value:after {
+ position: absolute;
+ top: 8px;
+ left: -7px;
+ width: 0;
+ height: 0;
+ border-top: 7px solid transparent;
+ border-right: 7px solid #bb77ae;
+ border-bottom: 7px solid transparent;
+ content: '';
+}*/
+
+::-moz-range-track {
+ background: #d7dcdf;
+ border: 0;
+}
+
+input::-moz-focus-inner, input::-moz-focus-outer {
+ border: 0;
+}
+input[type=checkbox].tgl-light:checked + .tgl-btn {
+ background: #0075ff;
+}
\ No newline at end of file
diff --git a/assets/css/customizer-repeater-control.css b/assets/css/customizer-repeater-control.css
new file mode 100644
index 0000000..ad37132
--- /dev/null
+++ b/assets/css/customizer-repeater-control.css
@@ -0,0 +1,213 @@
+.customizer-repeater-general-control-repeater-container .customizer-repeater-box-content-hidden:after {
+ content: "";
+ display: table;
+ clear: both;
+}
+
+.customizer-repeater-general-control-repeater-container .customizer-repeater-box-content-hidden {
+ display: none;
+}
+
+.customizer-repeater-customize-control-title-box {
+ margin: 0;
+ padding: 15px;
+ font-size: 1em;
+ line-height: 1;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ display: block;
+ font-weight: 600;
+ color: #23282d;
+ border: 1px solid #e5e5e5;
+ cursor: move;
+}
+
+.customizer-repeater-customize-control-title-box:hover {
+ border: 1px solid #999;
+}
+
+.customizer-repeater-customize-control-title-box:after {
+ content: "\f140";
+ font-family: dashicons;
+ font-size: 20px;
+ height: 13px;
+ bottom: 3px;
+ position: relative;
+ float: right;
+}
+
+.customizer-repeater-customize-control-title-box.repeater-expanded:after {
+ content: "\f142";
+}
+
+.customizer-repeater-box-content-hidden {
+ border: 1px solid #e5e5e5;
+ border-top: none;
+ padding: 1px 10px 10px;
+}
+
+.customizer-repeater-box-content-hidden > div {
+ margin: 1em 0;
+}
+
+.customizer-repeater-box-content-hidden .customize-control-title {
+ font-size: 13px;
+ line-height: 1.5;
+ font-weight: normal;
+ margin-bottom: 0;
+ margin-top: 1em;
+}
+
+.customizer-repeater-box-content-hidden .customize-control-title:after {
+ content: ":";
+}
+
+.customizer-repeater-box-content-hidden span.description {
+ font-size: 12px;
+ font-style: normal;
+}
+
+.customizer-repeater-general-control-repeater-container, .customizer-repeater-general-control-repeater_container {
+ border: 1px solid #e5e5e5;
+ border-top: none;
+ margin-bottom: 12px;
+ width: 100%;
+ float: left;
+ background: #fff;
+ -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
+ box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
+}
+
+.customizer-repeater-box-content-hidden .wp-picker-container, .customizer-repeater-box-content-hidden .wp-picker-container .wp-color-result, .icp-container {
+ margin: 0;
+}
+
+.customizer-repeater-box-content-hidden input:not(.icp, .wp-color-picker),
+.customizer-repeater-box-content-hidden textarea,
+.customizer-repeater-box-content-hidden .wp-picker-container {
+ margin-bottom: 1em !important;
+}
+
+.social-repeater-general-control-remove-field {
+ cursor: pointer;
+ color: #a00;
+ background: none;
+ border: none;
+ padding: 0;
+ margin-top: 10px;
+}
+
+.social-repeater-general-control-remove-field:hover {
+ color: red;
+}
+
+.customizer-repeater-box-content-hidden .wp-picker-holder {
+ position: relative;
+ left: -10px;
+}
+
+.customizer-repeater-box-content-hidden .wp-picker-input-wrap {
+ margin-left: 10px;
+}
+
+.customizer-repeater-box-content-hidden .wp-picker-container .iris-picker {
+ border-left: none;
+ border-right: none;
+}
+
+button.customizer-repeater-new-field {
+ float: right;
+}
+
+button.customizer-repeater-new-field:before {
+ content: "\f132";
+ display: inline-block;
+ position: relative;
+ left: -2px;
+ top: -1px;
+ font: 400 20px/1 dashicons;
+ vertical-align: middle;
+ -webkit-transition: all .2s;
+ transition: all .2s;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.customizer-repeater-box-content-hidden > div.customizer-repeater-social-repeater {
+ margin-top: 0;
+}
+
+.customizer-repeater-general-control-repeater-container .customizer-repeater-icon-control {
+ width: 100%;
+ margin: 0;
+ padding: 0;
+}
+
+#customizer-repeater-new-field {
+ width: 100%;
+}
+
+.customize-control-widget_form .widget-control-save {
+ display: block !important;
+}
+
+.customizer-repeater-box-content-hidden {
+ background-color: #fff;
+}
+
+.customizer-repeater-image-control .customizer-repeater-custom-media-button {
+ margin-top: 5px;
+}
+
+.customizer-icons {
+ display: inline-block;
+ padding: 0 10px 0 0;
+ vertical-align: middle;
+}
+
+.social-repeater-remove-social-item {
+ display: inline-block;
+ vertical-align: top;
+ color: #a00;
+ border: none;
+ background: none;
+ cursor: pointer;
+ padding: 0;
+}
+
+.social-repeater-remove-social-item:hover {
+ color: red;
+}
+
+.customizer-repeater-social-repeater > .customizer-repeater-social-repeater-container:not(:first-child) {
+ margin-top: 25px;
+}
+
+.icp-container {
+ margin-bottom: 10px;
+}
+
+.button-secondary.social-repeater-add-social-item:before {
+ content: "\f132";
+ display: inline-block;
+ position: relative;
+ left: -2px;
+ top: -1px;
+ font: 400 20px/1 dashicons;
+ vertical-align: middle;
+ -webkit-transition: all .2s;
+ transition: all .2s;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.button-secondary.social-repeater-add-social-item {
+ vertical-align: text-top;
+ float: right;
+}
+
+.customizer-repeater-box-content-hidden textarea {
+ width: 100%;
+}
\ No newline at end of file
diff --git a/assets/css/customizer-styles.css b/assets/css/customizer-styles.css
new file mode 100644
index 0000000..72aab8f
--- /dev/null
+++ b/assets/css/customizer-styles.css
@@ -0,0 +1,166 @@
+
+#customize-theme-controls .accordion-section-content {
+ background-color: #f9f9f9;
+}
+
+/* Color Control Tweaks */
+.wp-picker-container, .wp-picker-input-wrap {
+ width: 100%;
+ border-radius: 3px;
+ overflow: hidden;
+}
+.wp-core-ui .wp-picker-container .wp-color-result.button {
+ height: 30px !important;
+ border-radius: 3px;
+ padding: 0 0 0 30px !important;
+ /* width:100%; */
+ color:#fff;
+ position:relative;
+}
+.wp-core-ui .button.wp-color-result .wp-color-result-text {
+ background-color: rgba(0,0,0,.2);
+ color: #fff;
+ height: 30px;
+ line-height: 30px;
+ border: none;
+ box-shadow: none;
+ font-size: 12px;
+ border-radius: 3;
+ padding: 0 15px;
+}
+.wp-core-ui button.wp-color-result + .wp-picker-input-wrap > label {
+ width: 45%;
+}
+.wp-core-ui button.wp-color-result + .wp-picker-input-wrap input[type=text].wp-color-picker {
+ width: 100% !important;
+ vertical-align: bottom;
+ margin-top: 10px;
+ line-height: 20px;
+ border-color: #ccc;
+}
+.wp-customizer .wp-picker-active .wp-picker-input-wrap .wp-picker-default, .wp-customizer .wp-picker-active .wp-picker-input-wrap .wp-picker-clear {
+ display: inline-block !important;
+ margin-left: 10%;
+ width: 45%;
+ height: 28px;
+ margin-top: 10px;
+}
+.wp-customizer .wp-picker-container .iris-picker {
+ width: 95% !important;
+ margin-top: 15px;
+}
+.wp-customizer .wp-picker-container .iris-picker .iris-square {
+ width: 80% !important;
+}
+.wp-customizer .wp-picker-container .iris-picker .iris-strip {
+ width: 10% !important;
+}
+/* General Tweaks */
+.customize-control-select select {
+ min-width: 100%;
+ height: 30px;
+ border-radius: 3px;
+ border-color: #ccc;
+}
+.customize-control-title {
+ margin-top: 15px;
+ text-transform: uppercase;
+ font-size: 12px;
+}
+.customize-control input[type=number], .customize-control input[type=search], .customize-control input[type=tel], .customize-control input[type=url], .customize-control input[type=text], .customize-control input[type=password], .customize-control input[type=email] {
+ line-height: 22px;
+ border-color:#ccc;
+}
+.customize-control code {
+ padding: 10px;
+ display: block;
+}
+
+/* Mobile preview */
+.preview-mobile #customize-preview iframe {
+ width:600px;
+ height: 1500px;
+ -ms-transform: scale(0.50);
+ -moz-transform: scale(0.50);
+ -o-transform: scale(0.50);
+ -webkit-transform: scale(0.50);
+ transform: scale(0.50);
+ -ms-transform-origin: 0 0;
+ -moz-transform-origin: 0 0;
+ -o-transform-origin: 0 0;
+ -webkit-transform-origin: 0 0;
+ transform-origin: 0 0;
+}
+.preview-mobile .wp-full-overlay-main {
+ overflow-y:scroll;
+ overflow-x:auto;
+}
+
+/* Template Control */
+.customize-control-mailtpltemplateload .image-radio-select label {
+ display: block;
+ height: auto;
+ float: none;
+ width: 100%;
+ margin-bottom: 8px;
+ padding: 8px 8px 0;
+ box-shadow: none;
+ box-sizing: border-box;
+}
+#customize-controls .customize-control-mailtpltemplateload label img {
+ border: 4px solid #ccc;
+ box-sizing: border-box;
+ cursor: pointer;
+ height: auto;
+ max-width: 100%;
+ padding: 1px;
+}
+#customize-controls .customize-control-mailtpltemplateload label.mailtplactive img {
+ border-color: #00a0d2;
+}
+.customize-control-mailtpltemplateload .mailtpl-template-woomail-load-controls:after {
+ clear: both;
+ display: table;
+ content: '';
+}
+/* Also Button for Importer */
+.mailtpl-woomail-button {
+ width: 100%;
+ padding: 6px 12px;
+ height: auto;
+}
+/* Import Export styles */
+.mailtpl-woomail-form {
+ position: absolute;
+ left: -99999px;
+}
+.mailtpl-woomail-hr {
+ margin: 20px 0px 10px;
+}
+.mailtpl-woomail-import-file {
+ background: #eeeeee;
+ width: 100%;
+ margin: 10px 0;
+ padding: 10px;
+ font-size: 12px;
+}
+.mailtpl-woomail-uploading, .mailtpl-woomail-loading {
+ background: #eeeeee;
+ display: none;
+ margin: 10px 0;
+ padding: 10px;
+ font-size: 12px;
+}
+
+.preview-mobile .wp-full-overlay-main {
+ margin: auto 0 auto -190px;
+ width: 380px;
+ height: 580px;
+ max-height: 100%;
+ max-width: 100%;
+ left: 50%;
+}
+/* Fix for Shopkeeper theme */
+#customize-control-mailtpl_woomail_email_load_template {
+ max-height: none;
+}
\ No newline at end of file
diff --git a/assets/css/customizer-toggle-switch-control.css b/assets/css/customizer-toggle-switch-control.css
new file mode 100644
index 0000000..b2cbf1b
--- /dev/null
+++ b/assets/css/customizer-toggle-switch-control.css
@@ -0,0 +1,114 @@
+input[type=checkbox].tgl {
+ display: none;
+}
+input[type=checkbox].tgl, input[type=checkbox].tgl:after, input[type=checkbox].tgl:before, input[type=checkbox].tgl *, input[type=checkbox].tgl *:after, input[type=checkbox].tgl *:before, input[type=checkbox].tgl + .tgl-btn {
+ box-sizing: border-box;
+}
+input[type=checkbox].tgl::-moz-selection, input[type=checkbox].tgl:after::-moz-selection, input[type=checkbox].tgl:before::-moz-selection, input[type=checkbox].tgl *::-moz-selection, input[type=checkbox].tgl *:after::-moz-selection, input[type=checkbox].tgl *:before::-moz-selection, input[type=checkbox].tgl + .tgl-btn::-moz-selection {
+ background: none;
+}
+input[type=checkbox].tgl::selection, input[type=checkbox].tgl:after::selection, input[type=checkbox].tgl:before::selection, input[type=checkbox].tgl *::selection, input[type=checkbox].tgl *:after::selection, input[type=checkbox].tgl *:before::selection, input[type=checkbox].tgl + .tgl-btn::selection {
+ background: none;
+}
+input[type=checkbox].tgl + .tgl-btn {
+ outline: 0;
+ display: block;
+ width: 4em;
+ height: 2em;
+ position: relative;
+ cursor: pointer;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+input[type=checkbox].tgl + .tgl-btn:after, input[type=checkbox].tgl + .tgl-btn:before {
+ position: relative;
+ display: block;
+ content: "";
+ width: 50%;
+ height: 100%;
+}
+input[type=checkbox].tgl + .tgl-btn:after {
+ left: 0;
+}
+input[type=checkbox].tgl + .tgl-btn:before {
+ display: none;
+}
+input[type=checkbox].tgl:checked + .tgl-btn:after {
+ left: 50%;
+}
+
+input[type=checkbox].tgl-light + .tgl-btn {
+ background: #f0f0f0;
+ border-radius: 2em;
+ padding: 2px;
+ -webkit-transition: all .4s ease;
+ transition: all .4s ease;
+}
+input[type=checkbox].tgl-light + .tgl-btn:after {
+ border-radius: 50%;
+ background: #fff;
+ -webkit-transition: all .2s ease;
+ transition: all .2s ease;
+}
+input[type=checkbox].tgl-light:checked + .tgl-btn {
+ background: #9FD6AE;
+}
+
+input[type=checkbox].tgl-ios + .tgl-btn {
+ background: #fbfbfb;
+ border-radius: 2em;
+ padding: 2px;
+ -webkit-transition: all .4s ease;
+ transition: all .4s ease;
+ border: 1px solid #e8eae9;
+}
+input[type=checkbox].tgl-ios + .tgl-btn:after {
+ border-radius: 2em;
+ background: #fbfbfb;
+ -webkit-transition: left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), padding 0.3s ease, margin 0.3s ease;
+ transition: left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), padding 0.3s ease, margin 0.3s ease;
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 4px 0 rgba(0, 0, 0, 0.08);
+}
+input[type=checkbox].tgl-ios + .tgl-btn:hover:after {
+ will-change: padding;
+}
+input[type=checkbox].tgl-ios + .tgl-btn:active {
+ box-shadow: inset 0 0 0 2em #e8eae9;
+}
+input[type=checkbox].tgl-ios + .tgl-btn:active:after {
+ padding-right: .8em;
+}
+input[type=checkbox].tgl-ios:checked + .tgl-btn {
+ background: #86d993;
+}
+input[type=checkbox].tgl-ios:checked + .tgl-btn:active {
+ box-shadow: none;
+}
+input[type=checkbox].tgl-ios:checked + .tgl-btn:active:after {
+ margin-left: -.8em;
+}
+
+input[type=checkbox].tgl-flat + .tgl-btn {
+ padding: 2px;
+ -webkit-transition: all .2s ease;
+ transition: all .2s ease;
+ background: #fff;
+ border: 4px solid #f2f2f2;
+ border-radius: 2em;
+}
+input[type=checkbox].tgl-flat + .tgl-btn:after {
+ -webkit-transition: all .2s ease;
+ transition: all .2s ease;
+ background: #f2f2f2;
+ content: "";
+ border-radius: 1em;
+}
+input[type=checkbox].tgl-flat:checked + .tgl-btn {
+ border: 4px solid #7FC6A6;
+}
+input[type=checkbox].tgl-flat:checked + .tgl-btn:after {
+ left: 50%;
+ background: #7FC6A6;
+}
\ No newline at end of file
diff --git a/assets/css/fonts/iconpicker.eot b/assets/css/fonts/iconpicker.eot
new file mode 100644
index 0000000..3b2c096
Binary files /dev/null and b/assets/css/fonts/iconpicker.eot differ
diff --git a/assets/css/fonts/iconpicker.svg b/assets/css/fonts/iconpicker.svg
new file mode 100644
index 0000000..de6a43d
--- /dev/null
+++ b/assets/css/fonts/iconpicker.svg
@@ -0,0 +1,19 @@
+
+
+
+Copyright (C) 2014 by original authors @ fontello.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/css/fonts/iconpicker.ttf b/assets/css/fonts/iconpicker.ttf
new file mode 100644
index 0000000..da45a6d
Binary files /dev/null and b/assets/css/fonts/iconpicker.ttf differ
diff --git a/assets/css/fonts/iconpicker.woff b/assets/css/fonts/iconpicker.woff
new file mode 100644
index 0000000..8fdcf70
Binary files /dev/null and b/assets/css/fonts/iconpicker.woff differ
diff --git a/assets/css/fonts/woomail-social.eot b/assets/css/fonts/woomail-social.eot
new file mode 100644
index 0000000..424cb88
Binary files /dev/null and b/assets/css/fonts/woomail-social.eot differ
diff --git a/assets/css/fonts/woomail-social.svg b/assets/css/fonts/woomail-social.svg
new file mode 100644
index 0000000..a323cd4
--- /dev/null
+++ b/assets/css/fonts/woomail-social.svg
@@ -0,0 +1,26 @@
+
+
+
+Generated by IcoMoon
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/css/fonts/woomail-social.ttf b/assets/css/fonts/woomail-social.ttf
new file mode 100644
index 0000000..bb35d29
Binary files /dev/null and b/assets/css/fonts/woomail-social.ttf differ
diff --git a/assets/css/fonts/woomail-social.woff b/assets/css/fonts/woomail-social.woff
new file mode 100644
index 0000000..257f5ef
Binary files /dev/null and b/assets/css/fonts/woomail-social.woff differ
diff --git a/assets/css/fonts/woomail-social.woff2 b/assets/css/fonts/woomail-social.woff2
new file mode 100644
index 0000000..b5a08ed
Binary files /dev/null and b/assets/css/fonts/woomail-social.woff2 differ
diff --git a/assets/fonts/iconpicker.eot b/assets/fonts/iconpicker.eot
new file mode 100644
index 0000000..3b2c096
Binary files /dev/null and b/assets/fonts/iconpicker.eot differ
diff --git a/assets/fonts/iconpicker.svg b/assets/fonts/iconpicker.svg
new file mode 100644
index 0000000..de6a43d
--- /dev/null
+++ b/assets/fonts/iconpicker.svg
@@ -0,0 +1,19 @@
+
+
+
+Copyright (C) 2014 by original authors @ fontello.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/fonts/iconpicker.ttf b/assets/fonts/iconpicker.ttf
new file mode 100644
index 0000000..da45a6d
Binary files /dev/null and b/assets/fonts/iconpicker.ttf differ
diff --git a/assets/fonts/iconpicker.woff b/assets/fonts/iconpicker.woff
new file mode 100644
index 0000000..8fdcf70
Binary files /dev/null and b/assets/fonts/iconpicker.woff differ
diff --git a/assets/images/WooCommerce-wordpress-01.png b/assets/images/WooCommerce-wordpress-01.png
new file mode 100644
index 0000000..9bee0ad
Binary files /dev/null and b/assets/images/WooCommerce-wordpress-01.png differ
diff --git a/assets/images/WooCommerce-wordpress-02.png b/assets/images/WooCommerce-wordpress-02.png
new file mode 100644
index 0000000..dfc890e
Binary files /dev/null and b/assets/images/WooCommerce-wordpress-02.png differ
diff --git a/assets/images/attendees.xlsx b/assets/images/attendees.xlsx
new file mode 100644
index 0000000..2de274e
Binary files /dev/null and b/assets/images/attendees.xlsx differ
diff --git a/assets/images/black/digg.png b/assets/images/black/digg.png
new file mode 100644
index 0000000..d1754db
Binary files /dev/null and b/assets/images/black/digg.png differ
diff --git a/assets/images/black/dribbble.png b/assets/images/black/dribbble.png
new file mode 100644
index 0000000..d18cedc
Binary files /dev/null and b/assets/images/black/dribbble.png differ
diff --git a/assets/images/black/facebook.png b/assets/images/black/facebook.png
new file mode 100644
index 0000000..943c362
Binary files /dev/null and b/assets/images/black/facebook.png differ
diff --git a/assets/images/black/google-plus.png b/assets/images/black/google-plus.png
new file mode 100644
index 0000000..8602002
Binary files /dev/null and b/assets/images/black/google-plus.png differ
diff --git a/assets/images/black/instagram.png b/assets/images/black/instagram.png
new file mode 100644
index 0000000..2a3c901
Binary files /dev/null and b/assets/images/black/instagram.png differ
diff --git a/assets/images/black/link.png b/assets/images/black/link.png
new file mode 100644
index 0000000..8672eff
Binary files /dev/null and b/assets/images/black/link.png differ
diff --git a/assets/images/black/linkedin.png b/assets/images/black/linkedin.png
new file mode 100644
index 0000000..9395674
Binary files /dev/null and b/assets/images/black/linkedin.png differ
diff --git a/assets/images/black/pinterest.png b/assets/images/black/pinterest.png
new file mode 100644
index 0000000..c84f27b
Binary files /dev/null and b/assets/images/black/pinterest.png differ
diff --git a/assets/images/black/rss.png b/assets/images/black/rss.png
new file mode 100644
index 0000000..8bdb0bc
Binary files /dev/null and b/assets/images/black/rss.png differ
diff --git a/assets/images/black/stumbleupon.png b/assets/images/black/stumbleupon.png
new file mode 100644
index 0000000..836c65d
Binary files /dev/null and b/assets/images/black/stumbleupon.png differ
diff --git a/assets/images/black/tumblr.png b/assets/images/black/tumblr.png
new file mode 100644
index 0000000..d6fbd36
Binary files /dev/null and b/assets/images/black/tumblr.png differ
diff --git a/assets/images/black/twitter.png b/assets/images/black/twitter.png
new file mode 100644
index 0000000..10f3592
Binary files /dev/null and b/assets/images/black/twitter.png differ
diff --git a/assets/images/black/vimeo.png b/assets/images/black/vimeo.png
new file mode 100644
index 0000000..f5b69ca
Binary files /dev/null and b/assets/images/black/vimeo.png differ
diff --git a/assets/images/black/vk.png b/assets/images/black/vk.png
new file mode 100644
index 0000000..fe6a144
Binary files /dev/null and b/assets/images/black/vk.png differ
diff --git a/assets/images/black/whatsapp.png b/assets/images/black/whatsapp.png
new file mode 100644
index 0000000..d8b49ed
Binary files /dev/null and b/assets/images/black/whatsapp.png differ
diff --git a/assets/images/black/youtube.png b/assets/images/black/youtube.png
new file mode 100644
index 0000000..eb2e588
Binary files /dev/null and b/assets/images/black/youtube.png differ
diff --git a/assets/images/gray/digg.png b/assets/images/gray/digg.png
new file mode 100644
index 0000000..572f6bf
Binary files /dev/null and b/assets/images/gray/digg.png differ
diff --git a/assets/images/gray/dribbble.png b/assets/images/gray/dribbble.png
new file mode 100644
index 0000000..c46f599
Binary files /dev/null and b/assets/images/gray/dribbble.png differ
diff --git a/assets/images/gray/facebook.png b/assets/images/gray/facebook.png
new file mode 100644
index 0000000..1dd5e62
Binary files /dev/null and b/assets/images/gray/facebook.png differ
diff --git a/assets/images/gray/google-plus.png b/assets/images/gray/google-plus.png
new file mode 100644
index 0000000..66f56bc
Binary files /dev/null and b/assets/images/gray/google-plus.png differ
diff --git a/assets/images/gray/instagram.png b/assets/images/gray/instagram.png
new file mode 100644
index 0000000..507ba4f
Binary files /dev/null and b/assets/images/gray/instagram.png differ
diff --git a/assets/images/gray/link.png b/assets/images/gray/link.png
new file mode 100644
index 0000000..de83e34
Binary files /dev/null and b/assets/images/gray/link.png differ
diff --git a/assets/images/gray/linkedin.png b/assets/images/gray/linkedin.png
new file mode 100644
index 0000000..31d57bf
Binary files /dev/null and b/assets/images/gray/linkedin.png differ
diff --git a/assets/images/gray/pinterest.png b/assets/images/gray/pinterest.png
new file mode 100644
index 0000000..89f5cf4
Binary files /dev/null and b/assets/images/gray/pinterest.png differ
diff --git a/assets/images/gray/rss.png b/assets/images/gray/rss.png
new file mode 100644
index 0000000..ea7ba52
Binary files /dev/null and b/assets/images/gray/rss.png differ
diff --git a/assets/images/gray/stumbleupon.png b/assets/images/gray/stumbleupon.png
new file mode 100644
index 0000000..f3ff07b
Binary files /dev/null and b/assets/images/gray/stumbleupon.png differ
diff --git a/assets/images/gray/tumblr.png b/assets/images/gray/tumblr.png
new file mode 100644
index 0000000..3cc2294
Binary files /dev/null and b/assets/images/gray/tumblr.png differ
diff --git a/assets/images/gray/twitter.png b/assets/images/gray/twitter.png
new file mode 100644
index 0000000..cce39b5
Binary files /dev/null and b/assets/images/gray/twitter.png differ
diff --git a/assets/images/gray/vimeo.png b/assets/images/gray/vimeo.png
new file mode 100644
index 0000000..b56902c
Binary files /dev/null and b/assets/images/gray/vimeo.png differ
diff --git a/assets/images/gray/vk.png b/assets/images/gray/vk.png
new file mode 100644
index 0000000..60f4352
Binary files /dev/null and b/assets/images/gray/vk.png differ
diff --git a/assets/images/gray/whatsapp.png b/assets/images/gray/whatsapp.png
new file mode 100644
index 0000000..43194c2
Binary files /dev/null and b/assets/images/gray/whatsapp.png differ
diff --git a/assets/images/gray/youtube.png b/assets/images/gray/youtube.png
new file mode 100644
index 0000000..e27f1c9
Binary files /dev/null and b/assets/images/gray/youtube.png differ
diff --git a/assets/images/icon-128x128.png b/assets/images/icon-128x128.png
new file mode 100644
index 0000000..2fc9bed
Binary files /dev/null and b/assets/images/icon-128x128.png differ
diff --git a/assets/images/image-1-01.png b/assets/images/image-1-01.png
new file mode 100644
index 0000000..57b761b
Binary files /dev/null and b/assets/images/image-1-01.png differ
diff --git a/assets/images/image-2-02.png b/assets/images/image-2-02.png
new file mode 100644
index 0000000..e44b548
Binary files /dev/null and b/assets/images/image-2-02.png differ
diff --git a/assets/images/kt_flat_template.jpg b/assets/images/kt_flat_template.jpg
new file mode 100644
index 0000000..33b7510
Binary files /dev/null and b/assets/images/kt_flat_template.jpg differ
diff --git a/assets/images/kt_full_template.jpg b/assets/images/kt_full_template.jpg
new file mode 100644
index 0000000..0e1446d
Binary files /dev/null and b/assets/images/kt_full_template.jpg differ
diff --git a/assets/images/kt_skinny_template.jpg b/assets/images/kt_skinny_template.jpg
new file mode 100644
index 0000000..69b2b96
Binary files /dev/null and b/assets/images/kt_skinny_template.jpg differ
diff --git a/assets/images/white/digg.png b/assets/images/white/digg.png
new file mode 100644
index 0000000..2dbdb85
Binary files /dev/null and b/assets/images/white/digg.png differ
diff --git a/assets/images/white/dribbble.png b/assets/images/white/dribbble.png
new file mode 100644
index 0000000..ee8bf3a
Binary files /dev/null and b/assets/images/white/dribbble.png differ
diff --git a/assets/images/white/facebook.png b/assets/images/white/facebook.png
new file mode 100644
index 0000000..af24b69
Binary files /dev/null and b/assets/images/white/facebook.png differ
diff --git a/assets/images/white/google-plus.png b/assets/images/white/google-plus.png
new file mode 100644
index 0000000..8427397
Binary files /dev/null and b/assets/images/white/google-plus.png differ
diff --git a/assets/images/white/instagram.png b/assets/images/white/instagram.png
new file mode 100644
index 0000000..0fb5a9c
Binary files /dev/null and b/assets/images/white/instagram.png differ
diff --git a/assets/images/white/link.png b/assets/images/white/link.png
new file mode 100644
index 0000000..137e434
Binary files /dev/null and b/assets/images/white/link.png differ
diff --git a/assets/images/white/linkedin.png b/assets/images/white/linkedin.png
new file mode 100644
index 0000000..21f491b
Binary files /dev/null and b/assets/images/white/linkedin.png differ
diff --git a/assets/images/white/pinterest.png b/assets/images/white/pinterest.png
new file mode 100644
index 0000000..38c8457
Binary files /dev/null and b/assets/images/white/pinterest.png differ
diff --git a/assets/images/white/rss.png b/assets/images/white/rss.png
new file mode 100644
index 0000000..43ac2ba
Binary files /dev/null and b/assets/images/white/rss.png differ
diff --git a/assets/images/white/stumbleupon.png b/assets/images/white/stumbleupon.png
new file mode 100644
index 0000000..11430bc
Binary files /dev/null and b/assets/images/white/stumbleupon.png differ
diff --git a/assets/images/white/tumblr.png b/assets/images/white/tumblr.png
new file mode 100644
index 0000000..692f0a3
Binary files /dev/null and b/assets/images/white/tumblr.png differ
diff --git a/assets/images/white/twitter.png b/assets/images/white/twitter.png
new file mode 100644
index 0000000..d9bb8cf
Binary files /dev/null and b/assets/images/white/twitter.png differ
diff --git a/assets/images/white/vimeo.png b/assets/images/white/vimeo.png
new file mode 100644
index 0000000..1fa316d
Binary files /dev/null and b/assets/images/white/vimeo.png differ
diff --git a/assets/images/white/vk.png b/assets/images/white/vk.png
new file mode 100644
index 0000000..f131a93
Binary files /dev/null and b/assets/images/white/vk.png differ
diff --git a/assets/images/white/whatsapp.png b/assets/images/white/whatsapp.png
new file mode 100644
index 0000000..08bdccc
Binary files /dev/null and b/assets/images/white/whatsapp.png differ
diff --git a/assets/images/white/youtube.png b/assets/images/white/youtube.png
new file mode 100644
index 0000000..a0d602e
Binary files /dev/null and b/assets/images/white/youtube.png differ
diff --git a/assets/js/customizer-range-value-control.js b/assets/js/customizer-range-value-control.js
new file mode 100644
index 0000000..e15574c
--- /dev/null
+++ b/assets/js/customizer-range-value-control.js
@@ -0,0 +1,29 @@
+/**
+ * Script run inside a Customizer control sidebar
+ */
+(function($) {
+ wp.customize.bind('ready', function() {
+ rangeSlider();
+ });
+
+ var rangeSlider = function() {
+ var slider = $('.range-slider'),
+ range = $('.range-slider__range'),
+ value = $('.range-slider__value');
+
+ slider.each(function() {
+
+ value.each(function() {
+ var value = $(this).prev().attr('value');
+ var suffix = ($(this).prev().attr('suffix')) ? $(this).prev().attr('suffix') : '';
+ $(this).html(value + suffix);
+ });
+
+ range.on('input', function() {
+ var suffix = ($(this).attr('suffix')) ? $(this).attr('suffix') : '';
+ $(this).next(value).html(this.value + suffix );
+ });
+ });
+ };
+
+})(jQuery);
diff --git a/assets/js/customizer-repeater-control.js b/assets/js/customizer-repeater-control.js
new file mode 100644
index 0000000..5b9d06a
--- /dev/null
+++ b/assets/js/customizer-repeater-control.js
@@ -0,0 +1,411 @@
+/* global jQuery */
+/* global wp */
+/**
+ * jQuery fontIconPicker - 3.1.1
+ *
+ * An icon picker built on top of font icons and jQuery
+ *
+ * http://codeb.it/fontIconPicker
+ *
+ * @author Alessandro Benoit & Swashata Ghosh
+ * @license MIT License
+ *
+ * {@link https://github.com/micc83/fontIconPicker}
+ */
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):t.initFontIconPickerNode=e(t.jQuery)}(this,function(t){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e ",{class:"icons-selector",style:"position: relative",html:this._getPickerTemplate(),attr:{"data-fip-origin":this.element.attr("id")}}),this.iconContainer=this.iconPicker.find(".fip-icons-container"),this.searchIcon=this.iconPicker.find(".selector-search i"),this.selectorPopup=this.iconPicker.find(".selector-popup-wrap"),this.selectorButton=this.iconPicker.find(".selector-button"),this.iconsSearched=[],this.isSearch=!1,this.totalPage=1,this.currentPage=1,this.currentIcon=!1,this.iconsCount=0,this.open=!1,this.guid=o++,this.eventNameSpace=".fontIconPicker".concat(o),this.searchValues=[],this.availableCategoriesSearch=[],this.triggerEvent=null,this.backupSource=[],this.backupSearch=[],this.isCategorized=!1,this.selectCategory=this.iconPicker.find(".icon-category-select"),this.selectedCategory=!1,this.availableCategories=[],this.unCategorizedKey=null,this.init()}function c(t){return!(!(e=t).fn||(!e.fn||!e.fn.fontIconPicker)&&(e.fn.fontIconPicker=function(t){var i=this;return this.each(function(){e.data(this,"fontIconPicker")||e.data(this,"fontIconPicker",new r(this,t))}),this.setIcons=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.each(function(){e.data(this,"fontIconPicker").setIcons(t,s)})},this.setIcon=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";i.each(function(){e.data(this,"fontIconPicker").setIcon(t)})},this.destroyPicker=function(){i.each(function(){e.data(this,"fontIconPicker")&&(e.data(this,"fontIconPicker").destroy(),e.removeData(this,"fontIconPicker"))})},this.refreshPicker=function(s){s||(s=t),i.destroyPicker(),i.each(function(){e.data(this,"fontIconPicker")||e.data(this,"fontIconPicker",new r(this,s))})},this.repositionPicker=function(){i.each(function(){e.data(this,"fontIconPicker").resetPosition()})},this.setPage=function(t){i.each(function(){e.data(this,"fontIconPicker").setPage(t)})},this},0));var e}r.prototype={init:function(){this.iconPicker.addClass(this.settings.theme),this.iconPicker.css({left:-9999}).appendTo("body");var t=this.iconPicker.outerHeight(),e=this.iconPicker.outerWidth();this.iconPicker.css({left:""}),this.element.before(this.iconPicker),this.element.css({visibility:"hidden",top:0,position:"relative",zIndex:"-1",left:"-"+e+"px",display:"inline-block",height:t+"px",width:e+"px",padding:"0",margin:"0 -"+e+"px 0 0",border:"0 none",verticalAlign:"top",float:"none"}),this.element.is("select")||(this.triggerEvent="input"),!this.settings.source&&this.element.is("select")?this._populateSourceFromSelect():this._initSourceIndex(),this._loadCategories(),this._loadIcons(),this._initDropDown(),this._initCategoryChanger(),this._initPagination(),this._initIconSearch(),this._initIconSelect(),this._initAutoClose(),this._initFixOnResize()},setIcons:function(t,e){this.settings.source=Array.isArray(t)?i(t):n.extend({},t),this.settings.searchSource=Array.isArray(e)?i(e):n.extend({},e),this._initSourceIndex(),this._loadCategories(),this._resetSearch(),this._loadIcons()},setIcon:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this._setSelectedIcon(t)},destroy:function(){this.iconPicker.off().remove(),this.element.css({visibility:"",top:"",position:"",zIndex:"",left:"",display:"",height:"",width:"",padding:"",margin:"",border:"",verticalAlign:"",float:""}),n(window).off("resize"+this.eventNameSpace),n("html").off("click"+this.eventNameSpace)},resetPosition:function(){this._fixOnResize()},setPage:function(t){"first"==t&&(t=1),"last"==t&&(t=this.totalPage),t=parseInt(t,10),isNaN(t)&&(t=1),t>this.totalPage&&(t=this.totalPage),1>t&&(t=1),this.currentPage=t,this._renderIconContainer()},_initFixOnResize:function(){var t,e,i,s=this;n(window).on("resize"+this.eventNameSpace,(t=function(){s._fixOnResize()},e=this.settings.windowDebounceDelay,function(){var s=this,n=arguments;clearTimeout(i),i=setTimeout(function(){return t.apply(s,n)},e)}))},_initAutoClose:function(){var t=this;this.settings.autoClose&&n("html").on("click"+this.eventNameSpace,function(e){var i=e.target;t.selectorPopup.has(i).length||t.selectorPopup.is(i)||t.iconPicker.has(i).length||t.iconPicker.is(i)||t.open&&t._toggleIconSelector()})},_initIconSelect:function(){var t=this;this.selectorPopup.on("click",".fip-box",function(e){var i=n(e.currentTarget);t._setSelectedIcon(i.attr("data-fip-value")),t._toggleIconSelector()})},_initIconSearch:function(){var t=this;this.selectorPopup.on("input",".icons-search-input",function(e){var i=n(e.currentTarget).val();""!==i?(t.searchIcon.removeClass("fip-icon-search"),t.searchIcon.addClass("fip-icon-cancel"),t.isSearch=!0,t.currentPage=1,t.iconsSearched=[],n.grep(t.searchValues,function(e,s){if(0<=e.toLowerCase().search(i.toLowerCase()))return t.iconsSearched[t.iconsSearched.length]=t.settings.source[s],!0}),t._renderIconContainer()):t._resetSearch()}),this.selectorPopup.on("click",".selector-search .fip-icon-cancel",function(){t.selectorPopup.find(".icons-search-input").focus(),t._resetSearch()})},_initPagination:function(){var t=this;this.selectorPopup.on("click",".selector-arrow-right",function(e){t.currentPage\n\t\n\t\t \n\t \n\t\n\t\t \n\t \n\n')},_initSourceIndex:function(){if("object"===e(this.settings.source)){if(Array.isArray(this.settings.source))this.isCategorized=!1,this.selectCategory.html("").hide(),this.settings.source=n.map(this.settings.source,function(t,e){return"function"==typeof t.toString?t.toString():t}),Array.isArray(this.settings.searchSource)?this.searchValues=n.map(this.settings.searchSource,function(t,e){return"function"==typeof t.toString?t.toString():t}):this.searchValues=this.settings.source.slice(0);else{var t=n.extend(!0,{},this.settings.source);for(var i in this.settings.source=[],this.searchValues=[],this.availableCategoriesSearch=[],this.selectedCategory=!1,this.availableCategories=[],this.unCategorizedKey=null,this.isCategorized=!0,this.selectCategory.html(""),t){var s=this.availableCategories.length,o=n(" ");for(var r in o.attr("value",s),o.html(i),this.selectCategory.append(o),this.availableCategories[s]=[],this.availableCategoriesSearch[s]=[],t[i]){var c=t[i][r],a=this.settings.searchSource&&this.settings.searchSource[i]&&this.settings.searchSource[i][r]?this.settings.searchSource[i][r]:c;"function"==typeof c.toString&&(c=c.toString()),c&&c!==this.settings.emptyIconValue&&(this.settings.source.push(c),this.availableCategories[s].push(c),this.searchValues.push(a),this.availableCategoriesSearch[s].push(a))}}}this.backupSource=this.settings.source.slice(0),this.backupSearch=this.searchValues.slice(0)}},_populateSourceFromSelect:function(){var t=this;this.settings.source=[],this.settings.searchSource=[],this.element.find("optgroup").length?(this.isCategorized=!0,this.element.find("optgroup").each(function(e,i){var s=t.availableCategories.length,o=n(" ");o.attr("value",s),o.html(n(i).attr("label")),t.selectCategory.append(o),t.availableCategories[s]=[],t.availableCategoriesSearch[s]=[],n(i).find("option").each(function(e,i){var o=n(i).val(),r=n(i).html();o&&o!==t.settings.emptyIconValue&&(t.settings.source.push(o),t.availableCategories[s].push(o),t.searchValues.push(r),t.availableCategoriesSearch[s].push(r))})}),this.element.find("> option").length&&this.element.find("> option").each(function(e,i){var s=n(i).val(),o=n(i).html();if(!s||""===s||s==t.settings.emptyIconValue)return!0;null===t.unCategorizedKey&&(t.unCategorizedKey=t.availableCategories.length,t.availableCategories[t.unCategorizedKey]=[],t.availableCategoriesSearch[t.unCategorizedKey]=[],n(" ").attr("value",t.unCategorizedKey).html(t.settings.unCategorizedText).appendTo(t.selectCategory)),t.settings.source.push(s),t.availableCategories[t.unCategorizedKey].push(s),t.searchValues.push(o),t.availableCategoriesSearch[t.unCategorizedKey].push(o)})):this.element.find("option").each(function(e,i){var s=n(i).val(),o=n(i).html();s&&(t.settings.source.push(s),t.searchValues.push(o))}),this.backupSource=this.settings.source.slice(0),this.backupSearch=this.searchValues.slice(0)},_loadCategories:function(){!1!==this.isCategorized&&(n(''+this.settings.allCategoryText+" ").prependTo(this.selectCategory),this.selectCategory.show().val("all").trigger("change"))},_loadIcons:function(){this.iconContainer.html(' '),Array.isArray(this.settings.source)&&this._renderIconContainer()},_iconGenerator:function(t){return"function"==typeof this.settings.iconGenerator?this.settings.iconGenerator(t):" "},_renderIconContainer:function(){var t,e=this,i=[];if(i=this.isSearch?this.iconsSearched:this.settings.source,this.iconsCount=i.length,this.totalPage=Math.ceil(this.iconsCount/this.settings.iconsPerPage),1("+this.iconsCount+")"),t=(this.currentPage-1)*this.settings.iconsPerPage,this.settings.emptyIcon)this.iconContainer.html(' ');else{if(1>i.length)return void this.iconContainer.html(' ');this.iconContainer.html("")}i=i.slice(t,t+this.settings.iconsPerPage);for(var s,o=function(t,i){var s=i;n.grep(e.settings.source,n.proxy(function(t,e){return t===i&&(s=this.searchValues[e],!0)},e)),n(" ",{html:e._iconGenerator(i),attr:{"data-fip-value":i},class:"fip-box",title:s}).appendTo(e.iconContainer)},r=0;s=i[r++];)o(0,s);if(this.settings.emptyIcon||this.element.val()&&-1!==n.inArray(this.element.val(),this.settings.source))if(-1===n.inArray(this.element.val(),this.settings.source))this._setSelectedIcon("");else{var c=this.element.val();c===this.settings.emptyIconValue&&(c="fip-icon-block"),this._setSelectedIcon(c)}else this._setSelectedIcon(i[0])},_setHighlightedIcon:function(){this.iconContainer.find(".current-icon").removeClass("current-icon"),this.currentIcon&&this.iconContainer.find('[data-fip-value="'+this.currentIcon+'"]').addClass("current-icon")},_setSelectedIcon:function(t){"fip-icon-block"===t&&(t="");var e=this.iconPicker.find(".selected-icon");""===t?e.html(' '):e.html(this._iconGenerator(t));var i=this.element.val();this.element.val(""===t?this.settings.emptyIconValue:t),i!==t&&(this.element.trigger("change"),null!==this.triggerEvent&&this.element.trigger(this.triggerEvent)),this.currentIcon=t,this._setHighlightedIcon()},_repositionIconSelector:function(){var t=this.iconPicker.offset(),e=t.top+this.iconPicker.outerHeight(!0),i=t.left;this.selectorPopup.css({left:i,top:e})},_fixWindowOverflow:function(){var t=this.selectorPopup.find(".selector-popup").is(":visible");t||this.selectorPopup.find(".selector-popup").show();var e=this.selectorPopup.outerWidth(),i=n(window).width(),s=this.selectorPopup.offset().left,o="self"==this.settings.appendTo?this.selectorPopup.parent().offset():n(this.settings.appendTo).offset();if(t||this.selectorPopup.find(".selector-popup").hide(),s+e>i-20){var r=this.selectorButton.offset().left+this.selectorButton.outerWidth(),c=Math.floor(r-e-1);0>c?this.selectorPopup.css({left:i-20-e-o.left}):this.selectorPopup.css({left:c})}},_fixOnResize:function(){"self"!==this.settings.appendTo&&this._repositionIconSelector(),this._fixWindowOverflow()},_toggleIconSelector:function(){this.open=this.open?0:1,this.open&&("self"!==this.settings.appendTo&&(this.selectorPopup.appendTo(this.settings.appendTo).css({zIndex:1e3}).addClass("icons-selector "+this.settings.theme),this._repositionIconSelector()),this._fixWindowOverflow()),this.selectorPopup.find(".selector-popup").slideToggle(300,n.proxy(function(){this.iconPicker.find(".selector-button i").toggleClass("fip-icon-down-dir"),this.iconPicker.find(".selector-button i").toggleClass("fip-icon-up-dir"),this.open?this.selectorPopup.find(".icons-search-input").trigger("focus").trigger("select"):this.selectorPopup.appendTo(this.iconPicker).css({left:"",top:"",zIndex:""}).removeClass("icons-selector "+this.settings.theme)},this))},_resetSearch:function(){this.selectorPopup.find(".icons-search-input").val(""),this.searchIcon.removeClass("fip-icon-cancel"),this.searchIcon.addClass("fip-icon-search"),this.currentPage=1,this.isSearch=!1,this._renderIconContainer()}},t&&t.fn&&c(t);return function(t){return c(t)}});
+
+function media_upload(button_class) {
+ 'use strict';
+ jQuery('body').on('click', button_class, function () {
+ var button_id = '#' + jQuery(this).attr('id');
+ var display_field = jQuery(this).parent().children('input:text');
+ var _custom_media = true;
+
+ wp.media.editor.send.attachment = function (props, attachment) {
+
+ if (_custom_media) {
+ if (typeof display_field !== 'undefined') {
+ switch (props.size) {
+ case 'full':
+ display_field.val(attachment.sizes.full.url);
+ display_field.trigger('change');
+ break;
+ case 'medium':
+ display_field.val(attachment.sizes.medium.url);
+ display_field.trigger('change');
+ break;
+ case 'thumbnail':
+ display_field.val(attachment.sizes.thumbnail.url);
+ display_field.trigger('change');
+ break;
+ default:
+ display_field.val(attachment.url);
+ display_field.trigger('change');
+ }
+ }
+ _custom_media = false;
+ } else {
+ return wp.media.editor.send.attachment(button_id, [props, attachment]);
+ }
+ };
+ wp.media.editor.open(button_class);
+ window.send_to_editor = function (html) {
+
+ };
+ return false;
+ });
+}
+
+/********************************************
+ *** Generate unique id ***
+ *********************************************/
+function customizer_repeater_uniqid(prefix, more_entropy) {
+ 'use strict';
+ if (typeof prefix === 'undefined') {
+ prefix = '';
+ }
+
+ var retId;
+ var php_js;
+ var formatSeed = function (seed, reqWidth) {
+ seed = parseInt(seed, 10)
+ .toString(16); // to hex str
+ if (reqWidth < seed.length) { // so long we split
+ return seed.slice(seed.length - reqWidth);
+ }
+ if (reqWidth > seed.length) { // so short we pad
+ return new Array(1 + (reqWidth - seed.length))
+ .join('0') + seed;
+ }
+ return seed;
+ };
+
+ // BEGIN REDUNDANT
+ if (!php_js) {
+ php_js = {};
+ }
+ // END REDUNDANT
+ if (!php_js.uniqidSeed) { // init seed with big random int
+ php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
+ }
+ php_js.uniqidSeed++;
+
+ retId = prefix; // start with prefix, add current milliseconds hex string
+ retId += formatSeed(parseInt(new Date()
+ .getTime() / 1000, 10), 8);
+ retId += formatSeed(php_js.uniqidSeed, 5); // add seed hex string
+ if (more_entropy) {
+ // for more entropy we add a float lower to 10
+ retId += (Math.random() * 10)
+ .toFixed(8)
+ .toString();
+ }
+
+ return retId;
+}
+
+
+/********************************************
+ *** General Repeater ***
+ *********************************************/
+// function customizer_repeater_refresh_social_icons(th) {
+// 'use strict';
+// var icons_repeater_values = [];
+// th.find('.customizer-repeater-social-repeater-container').each(function () {
+// var icon = jQuery(this).find('.icp').val();
+// var link = jQuery(this).find('.customizer-repeater-social-repeater-link').val();
+// var id = jQuery(this).find('.customizer-repeater-social-repeater-id').val();
+
+// if (!id) {
+// id = 'customizer-repeater-social-repeater-' + customizer_repeater_uniqid();
+// jQuery(this).find('.customizer-repeater-social-repeater-id').val(id);
+// }
+
+// if (icon !== '' && link !== '') {
+// icons_repeater_values.push({
+// 'icon': icon,
+// 'link': link,
+// 'id': id
+// });
+// }
+// });
+
+// th.find('.social-repeater-socials-repeater-colector').val(JSON.stringify(icons_repeater_values));
+// customizer_repeater_refresh_general_control_values();
+// }
+
+
+function customizer_repeater_refresh_general_control_values() {
+ 'use strict';
+ jQuery('.customizer-repeater-general-control-repeater').each(function () {
+ var values = [];
+ var th = jQuery(this);
+ th.find('.customizer-repeater-general-control-repeater-container').each(function () {
+
+ var icon_value = jQuery(this).find('.mailtpl-icon-select').val();
+ var icon_color = jQuery(this).find('.customizer-repeater-icon-color').val();
+ var text = jQuery(this).find('.customizer-repeater-text-control').val();
+ var link = jQuery(this).find('.customizer-repeater-link-control').val();
+ var text2 = jQuery(this).find('.customizer-repeater-text2-control').val();
+ var link2 = jQuery(this).find('.customizer-repeater-link2-control').val();
+ var color = jQuery(this).find('input.customizer-repeater-color-control').val();
+ var color2 = jQuery(this).find('input.customizer-repeater-color2-control').val();
+ var image_url = jQuery(this).find('.custom-media-url').val();
+ var choice = jQuery(this).find('.customizer-repeater-image-choice').val();
+ var title = jQuery(this).find('.customizer-repeater-title-control').val();
+ var subtitle = jQuery(this).find('.customizer-repeater-subtitle-control').val();
+ var id = jQuery(this).find('.social-repeater-box-id').val();
+ if (!id) {
+ id = 'social-repeater-' + customizer_repeater_uniqid();
+ jQuery(this).find('.social-repeater-box-id').val(id);
+ }
+ var shortcode = jQuery(this).find('.customizer-repeater-shortcode-control').val();
+
+ if (text !== '' || image_url !== '' || title !== '' || subtitle !== '' || icon_value !== '' || icon_color !== '' || link !== '' || choice !== '' || shortcode !== '' || color !== '') {
+ values.push({
+ 'icon_value': (choice === 'customizer_repeater_none' ? '' : icon_value),
+ 'icon_color': icon_color,
+ 'color': color,
+ 'color2': color2,
+ 'text': escapeHtml(text),
+ 'link': link,
+ 'text2': escapeHtml(text2),
+ 'link2': link2,
+ 'image_url': (choice === 'customizer_repeater_none' ? '' : image_url),
+ 'choice': choice,
+ 'title': escapeHtml(title),
+ 'subtitle': escapeHtml(subtitle),
+ 'id': id,
+ 'shortcode': escapeHtml(shortcode)
+ });
+ }
+
+ });
+ th.find('.customizer-repeater-colector').val(JSON.stringify(values));
+ th.find('.customizer-repeater-colector').trigger('change');
+ });
+}
+
+jQuery(document).ready(function ($) {
+ mailtpl_icon_picker_init();
+ function mailtpl_icon_picker_init(){
+ icon_picker = jQuery('select.mailtpl-icon-select').fontIconPicker({
+ emptyIcon:false,
+ iconsPerPage:25,
+ });
+ }
+ var theme_conrols = jQuery('#customize-theme-controls');
+ theme_conrols.on('click', '.customizer-repeater-customize-control-title-box', function () {
+ jQuery(this).next().slideToggle('medium', function () {
+ if (jQuery(this).is(':visible')){
+ jQuery(this).prev().addClass('repeater-expanded');
+ jQuery(this).css('display', 'block');
+ } else {
+ jQuery(this).prev().removeClass('repeater-expanded');
+ }
+ });
+ });
+
+ theme_conrols.on('change', '.mailtpl-icon-select',function(){
+ customizer_repeater_refresh_general_control_values();
+ return false;
+ });
+ theme_conrols.on('change', '.customizer-repeater-icon-color',function(){
+ customizer_repeater_refresh_general_control_values();
+ return false;
+ });
+
+ theme_conrols.on('change', '.customizer-repeater-image-choice', function () {
+ if (jQuery(this).val() === 'customizer_repeater_image') {
+ jQuery(this).parent().parent().find('.social-repeater-general-control-icon').hide();
+ jQuery(this).parent().parent().find('.customizer-repeater-image-control').show();
+ jQuery(this).parent().parent().find('.customizer-repeater-color-control').prev().prev().hide();
+ jQuery(this).parent().parent().find('.customizer-repeater-color-control').hide();
+ jQuery(this).parent().parent().find('.customizer-repeater-icon-color-control').hide();
+
+ }
+ if (jQuery(this).val() === 'customizer_repeater_icon') {
+ jQuery(this).parent().parent().find('.social-repeater-general-control-icon').show();
+ jQuery(this).parent().parent().find('.customizer-repeater-image-control').hide();
+ jQuery(this).parent().parent().find('.customizer-repeater-color-control').prev().prev().show();
+ jQuery(this).parent().parent().find('.customizer-repeater-color-control').show();
+ jQuery(this).parent().parent().find('.customizer-repeater-icon-color-control').show();
+ }
+ if (jQuery(this).val() === 'customizer_repeater_none') {
+ jQuery(this).parent().parent().find('.social-repeater-general-control-icon').hide();
+ jQuery(this).parent().parent().find('.customizer-repeater-image-control').hide();
+ jQuery(this).parent().parent().find('.customizer-repeater-color-control').prev().prev().hide();
+ jQuery(this).parent().parent().find('.customizer-repeater-color-control').hide();
+ jQuery(this).parent().parent().find('.customizer-repeater-icon-color-control').hide();
+ }
+
+ customizer_repeater_refresh_general_control_values();
+ return false;
+ });
+ media_upload('.customizer-repeater-custom-media-button');
+ jQuery('.custom-media-url').on('change', function () {
+ customizer_repeater_refresh_general_control_values();
+ return false;
+ });
+
+ var color_options = {
+ change: function(event, ui){
+ customizer_repeater_refresh_general_control_values();
+ }
+ };
+
+ /**
+ * This adds a new box to repeater
+ *
+ */
+ theme_conrols.on('click', '.customizer-repeater-new-field', function () {
+ var th = jQuery(this).parent();
+ var id = 'customizer-repeater-' + customizer_repeater_uniqid();
+ if (typeof th !== 'undefined') {
+ icon_picker.destroyPicker();
+ /* Clone the first box*/
+ var field = th.find('.customizer-repeater-general-control-repeater-container:first').clone( true, true );
+
+ if (typeof field !== 'undefined') {
+ /*Set the default value for choice between image and icon to icon*/
+ field.find('.customizer-repeater-image-choice').val('customizer_repeater_icon');
+
+ /*Show icon selector*/
+ field.find('.social-repeater-general-control-icon').show();
+
+ /*Hide image selector*/
+ if (field.find('.social-repeater-general-control-icon').length > 0) {
+ field.find('.customizer-repeater-image-control').hide();
+ }
+
+ /*Show delete box button because it's not the first box*/
+ field.find('.social-repeater-general-control-remove-field').show();
+
+ /*Remove value from icon field*/
+ field.find('.mailtpl-icon-select').val('');
+
+
+ /*Remove value from text field*/
+ field.find('.customizer-repeater-text-control').val('');
+
+ /*Remove value from link field*/
+ field.find('.customizer-repeater-link-control').val('');
+
+ /*Remove value from text field*/
+ field.find('.customizer-repeater-text2-control').val('');
+
+ /*Remove value from link field*/
+ field.find('.customizer-repeater-link2-control').val('');
+
+ /*Set box id*/
+ field.find('.social-repeater-box-id').val(id);
+
+ /*Remove value from media field*/
+ field.find('.custom-media-url').val('');
+
+ /*Remove value from title field*/
+ field.find('.customizer-repeater-title-control').val('');
+
+
+ /*Remove value from color field*/
+ field.find('div.customizer-repeater-color-control .wp-picker-container').replaceWith(' ');
+ field.find('input.customizer-repeater-color-control').wpColorPicker(color_options);
+
+
+ field.find('div.customizer-repeater-color2-control .wp-picker-container').replaceWith(' ');
+ field.find('input.customizer-repeater-color2-control').wpColorPicker(color_options);
+
+ // field.find('.customize-control-notifications-container').remove();
+
+
+ /*Remove value from subtitle field*/
+ field.find('.customizer-repeater-subtitle-control').val('');
+
+ /*Remove value from shortcode field*/
+ field.find('.customizer-repeater-shortcode-control').val('');
+
+ /*Append new box*/
+ th.find('.customizer-repeater-general-control-repeater-container:first').parent().append(field);
+
+ /*Refresh values*/
+ customizer_repeater_refresh_general_control_values();
+ }
+ mailtpl_icon_picker_init();
+ }
+ return false;
+ });
+
+
+ theme_conrols.on('click', '.social-repeater-general-control-remove-field', function () {
+ if (typeof jQuery(this).parent() !== 'undefined') {
+ jQuery(this).parent().hide(500, function(){
+ jQuery(this).parent().remove();
+ customizer_repeater_refresh_general_control_values();
+
+ });
+ }
+ return false;
+ });
+
+
+ theme_conrols.on('keyup', '.customizer-repeater-title-control', function () {
+ customizer_repeater_refresh_general_control_values();
+ });
+
+ jQuery('input.customizer-repeater-color-control').wpColorPicker(color_options);
+ jQuery('input.customizer-repeater-color2-control').wpColorPicker(color_options);
+
+ theme_conrols.on('keyup', '.customizer-repeater-subtitle-control', function () {
+ customizer_repeater_refresh_general_control_values();
+ });
+
+ theme_conrols.on('keyup', '.customizer-repeater-shortcode-control', function () {
+ customizer_repeater_refresh_general_control_values();
+ });
+
+ theme_conrols.on('keyup', '.customizer-repeater-text-control', function () {
+ customizer_repeater_refresh_general_control_values();
+ });
+
+ theme_conrols.on('keyup', '.customizer-repeater-link-control', function () {
+ customizer_repeater_refresh_general_control_values();
+ });
+
+ theme_conrols.on('keyup', '.customizer-repeater-text2-control', function () {
+ customizer_repeater_refresh_general_control_values();
+ });
+
+ theme_conrols.on('keyup', '.customizer-repeater-link2-control', function () {
+ customizer_repeater_refresh_general_control_values();
+ });
+
+ /*Drag and drop to change icons order*/
+
+ jQuery('.customizer-repeater-general-control-droppable').sortable({
+ axis: 'y',
+ update: function () {
+ customizer_repeater_refresh_general_control_values();
+ }
+ });
+
+});
+
+var entityMap = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '\'': ''',
+ '/': '/'
+};
+
+function escapeHtml(string) {
+ 'use strict';
+ //noinspection JSUnresolvedFunction
+ string = String(string).replace(new RegExp('\r?\n', 'g'), ' ');
+ string = String(string).replace(/\\/g, '\');
+ return String(string).replace(/[&<>"'\/]/g, function (s) {
+ return entityMap[s];
+ });
+
+}
\ No newline at end of file
diff --git a/assets/js/customizer-scripts.js b/assets/js/customizer-scripts.js
new file mode 100644
index 0000000..d27c912
--- /dev/null
+++ b/assets/js/customizer-scripts.js
@@ -0,0 +1,230 @@
+/*
+ * Customizer Scripts
+ * Need to rewrite and clean up this file.
+ */
+
+jQuery(document).ready(function() {
+
+ /**
+ * Change description
+ */
+ jQuery('#customize-info .customize-panel-description').html(mailtpl_woomail.labels.description);
+ jQuery('#customize-info .panel-title.site-title').html(mailtpl_woomail.labels.customtitle);
+ // Add reset button
+ jQuery('#customize-header-actions input#save').after(' ');
+
+ // Handle reset button click
+ jQuery('#customize-header-actions #mailtpl_woomail_reset').click(function(e) {
+
+ // Prevent form submit
+ e.preventDefault();
+
+ // Display confirmation prompt
+ var confirmation = confirm(mailtpl_woomail.labels.reset_confirmation);
+
+ // Check user input
+ if ( ! confirmation ) {
+ return;
+ }
+
+ // Disable reset button
+ jQuery(this).prop('disabled', true);
+
+ // Populate request data object
+ var data = {
+ wp_customize: 'on',
+ action: 'mailtpl_woomail_reset',
+ };
+
+ // Send request to server
+ jQuery.post(mailtpl_woomail.ajax_url, data, function() {
+ wp.customize.state('saved').set(true);
+ window.location.replace(mailtpl_woomail.customizer_url);
+ });
+ });
+ wp.customize.state('saved').bind( 'change', function() {
+ if( wp.customize.state( 'saved' ).get() ) {
+ jQuery('input[name=mailtpl-woomail-send-email]').prop('disabled', false);
+ } else {
+ jQuery('input[name=mailtpl-woomail-send-email]').prop('disabled', true);
+ }
+ });
+
+ // Handle send email button click
+ jQuery('input[name=mailtpl-woomail-send-email]').click(function(e) {
+
+ // Prevent form submit
+ e.preventDefault();
+
+ // Get recipients
+ var recipients = jQuery('input#_customize-input-mailtpl_woomail_email_recipient').val();
+ // Display confirmation prompt
+ var confirmation = confirm(mailtpl_woomail.labels.send_confirmation);
+
+ // Check user input
+ if ( ! confirmation ) {
+ return;
+ }
+
+ // Disable send button
+ jQuery(this).prop('disabled', true);
+
+ // Populate request data object
+ var data = {
+ wp_customize: 'on',
+ action: 'mailtpl_woomail_send_email',
+ recipients: recipients,
+ };
+ // Send request to server
+ jQuery.post(mailtpl_woomail.ajax_url, data, function( result ) {
+ if ( result != 0 ) {
+ alert( mailtpl_woomail.labels.sent );
+ } else {
+ alert( mailtpl_woomail.labels.failed );
+ }
+ jQuery(this).prop('disabled', false);
+ });
+ });
+
+ jQuery( '.image-radio-select label' ).on( 'click', function(e) {
+ var new_val = jQuery(this).attr('data-image-value');
+ jQuery('#mailtpl-woomail-prebuilt-template').val(new_val);
+ jQuery('.image-radio-select label.mailtplactive').each( function () {
+ jQuery(this).removeClass("mailtplactive");
+ });
+ jQuery(this).addClass("mailtplactive");
+ });
+
+ // Handle mobile button click
+ function custom_size_mobile() {
+ // get email width.
+ var email_width = parseInt( jQuery('#customize-control-mailtpl_woomail_content_width .range-slider__range').val() );
+ var ratio = 380/email_width;
+ var framescale = 100/ratio;
+ var framescale = framescale/100;
+ jQuery('#customize-preview iframe').width(email_width+'px');
+ jQuery('#customize-preview iframe').css({
+ '-webkit-transform' : 'scale(' + ratio + ')',
+ '-moz-transform' : 'scale(' + ratio + ')',
+ '-ms-transform' : 'scale(' + ratio + ')',
+ '-o-transform' : 'scale(' + ratio + ')',
+ 'transform' : 'scale(' + ratio + ')'
+ });
+ }
+ jQuery('#customize-footer-actions .preview-mobile').click(function(e) {
+ if ( mailtpl_woomail.responsive_mode ) {
+ jQuery('#customize-preview iframe').width('100%');
+ jQuery('#customize-preview iframe').css({
+ '-webkit-transform' : 'scale(1)',
+ '-moz-transform' : 'scale(1)',
+ '-ms-transform' : 'scale(1)',
+ '-o-transform' : 'scale(1)',
+ 'transform' : 'scale(1)'
+ });
+ } else {
+ custom_size_mobile();
+ }
+ });
+
+ jQuery('#customize-footer-actions .preview-desktop').click(function(e) {
+ jQuery('#customize-preview iframe').width('100%');
+ jQuery('#customize-preview iframe').css({
+ '-webkit-transform' : 'scale(1)',
+ '-moz-transform' : 'scale(1)',
+ '-ms-transform' : 'scale(1)',
+ '-o-transform' : 'scale(1)',
+ 'transform' : 'scale(1)'
+ });
+ });
+ jQuery('#customize-footer-actions .preview-tablet').click(function(e) {
+ jQuery('#customize-preview iframe').width('100%');
+ jQuery('#customize-preview iframe').css({
+ '-webkit-transform' : 'scale(1)',
+ '-moz-transform' : 'scale(1)',
+ '-ms-transform' : 'scale(1)',
+ '-o-transform' : 'scale(1)',
+ 'transform' : 'scale(1)'
+ });
+ });
+
+});
+
+( function( $ ) {
+
+ var KWMDIE = {
+
+ init: function() {
+ $( 'input[name=mailtpl-woomail-export-button]' ).on( 'click', KWMDIE._export );
+ $( 'input[name=mailtpl-woomail-import-button]' ).on( 'click', KWMDIE._import );
+ },
+
+ _export: function() {
+ window.location.href = KWMDIEConfig.customizerURL + '&mailtpl-woomail-export=' + KWMDIEConfig.exportNonce;
+ },
+
+ _import: function() {
+
+ // Display confirmation prompt
+ var confirmation = confirm(KWMDIEl10n.confrim_override);
+
+ // Check user input
+ if ( ! confirmation ) {
+ return;
+ }
+
+ var win = $( window ),
+ body = $( 'body' ),
+ form = $( '' ),
+ controls = $( '.mailtpl-woomail-import-controls' ),
+ file = $( 'input[name=mailtpl-woomail-import-file]' ),
+ message = $( '.mailtpl-woomail-uploading' );
+
+ if ( '' == file.val() ) {
+ alert( KWMDIEl10n.emptyImport );
+ } else {
+ win.off( 'beforeunload' );
+ body.append( form );
+ form.append( controls );
+ message.show();
+ form.submit();
+ }
+ }
+ };
+
+ $( KWMDIE.init );
+
+})( jQuery );
+
+( function( $ ) {
+
+ var KWMDTL = {
+
+ init: function() {
+ $( 'input[name=mailtpl-woomail-template-button]' ).on( 'click', KWMDTL._import_template );
+ },
+ _import_template: function() {
+
+ // Display confirmation prompt
+ var confirmation = confirm(KWMDIEl10n.confrim_override);
+
+ // Check user input
+ if ( ! confirmation ) {
+ return;
+ }
+ var win = $( window ),
+ body = $( 'body' ),
+ form = $( '' ),
+ controls = $( '.mailtpl-template-woomail-load-controls' ),
+ message = $( '.mailtpl-woomail-loading' );
+
+ win.off( 'beforeunload' );
+ body.append( form );
+ form.append( controls );
+ message.show();
+ form.submit();
+ }
+ };
+
+ $( KWMDTL.init );
+
+})( jQuery );
diff --git a/assets/js/customizer-toggle-switch-control.js b/assets/js/customizer-toggle-switch-control.js
new file mode 100644
index 0000000..ccb6457
--- /dev/null
+++ b/assets/js/customizer-toggle-switch-control.js
@@ -0,0 +1,28 @@
+/*
+ * Script run inside a Customizer control sidebar
+ *
+ * Enable / disable the control title by toggeling its .disabled-control-title style class on or off.
+ */
+( function( $ ) {
+ wp.customize.bind( 'ready', function() { // Ready?
+
+ var customize = this; // Customize object alias.
+ // Array with the control names
+ // TODO: Replace #CONTROLNAME01#, #CONTROLNAME02# etc with the real control names.
+ var toggleControls = [
+ '#CONTROLNAME01#',
+ '#CONTROLNAME02#'
+ ];
+ $.each( toggleControls, function( index, control_name ) {
+ customize( control_name, function( value ) {
+ var controlTitle = customize.control( control_name ).container.find( '.customize-control-title' ); // Get control title.
+ // 1. On loading.
+ controlTitle.toggleClass('disabled-control-title', !value.get() );
+ // 2. Binding to value change.
+ value.bind( function( to ) {
+ controlTitle.toggleClass( 'disabled-control-title', !value.get() );
+ } );
+ } );
+ } );
+ } );
+} )( jQuery );
\ No newline at end of file
diff --git a/email-templates.php b/email-templates.php
index 857b2a2..7156456 100755
--- a/email-templates.php
+++ b/email-templates.php
@@ -1,17 +1,21 @@
run();
+ }
+
+ public function on_plugins_loaded_woomail() {
-define( 'MAILTPL_VERSION' , '1.3.2.1');
-define( 'MAILTPL_PLUGIN_FILE' , __FILE__);
-define( 'MAILTPL_PLUGIN_DIR' , plugin_dir_path(__FILE__) );
-define( 'MAILTPL_PLUGIN_URL' , plugin_dir_url(__FILE__) );
-define( 'MAILTPL_PLUGIN_HOOK' , basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
+ if ( ! mailtpl_woomail_is_woo_active() ) {
+ add_action( 'admin_notices', array( $this, 'admin_notice_need_woocommerce' ) );
+ return;
+ }
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-mailtpl-woomail-settings.php'; // Gets all settings.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-mailtpl-woomail-customizer.php'; // Gets custom customizer set up.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-mailtpl-woomail-import-export.php'; // Adds Customizer control.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-customizer-range-value-control.php'; // Adds Customizer control.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-customizer-mailtpltemplateload-control.php'; // Adds Customizer control.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-customizer-mailtplsendemail-control.php'; // Adds Customizer control.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-customizer-repeater-control.php'; // Adds Customizer control.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-customizer-mailtplinfoblock-control.php'; // Adds Customizer control.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-customizer-mailtplimportexport-control.php'; // Adds Customizer control.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-customizer-toggle-control.php'; // Adds customizer control.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-mailtpl-woomail-preview.php'; // Builds the email preview for customizer.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-mailtpl-woomail-woo.php'; // Add settings to woocommerce email settings page.
-/**
- * The code that runs during plugin activation.
- * This action is documented in includes/class-mailtpl-activator.php
- */
-function activate_mailtpl() {
- require_once plugin_dir_path( __FILE__ ) . 'includes/class-mailtpl-activator.php';
- Mailtpl_Activator::activate();
+ add_action( 'init', array( $this, 'on_init' ), 80 );
+
+ // Get translation set up.
+ load_plugin_textdomain( 'mailtpl-woocommerce-email-composer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
+
+ // Add link for plugin page.
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugins_page_links' ) );
+
+ }
+ /**
+ * Trigger Load on init.
+ */
+ public function on_init() {
+ // Remove the woocommerce call for email header.
+ if ( function_exists( 'WC' ) ) {
+ remove_action( 'woocommerce_email_header', array( WC()->mailer(), 'email_header' ) );
+ // $remove_schema = Mailtpl_Woomail_Customizer::opt( 'email_schema' );
+ // if ( true == $remove_schema ) {
+ // remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // This removes structured data from all Emails sent by WooCommerce.
+ // }
+ }
+
+ // Add our custom call for email header.
+ add_action( 'woocommerce_email_header', array( $this, 'add_email_header' ), 20, 2 );
+
+ // Use our templates instead of woocommerce.
+ add_filter( 'woocommerce_locate_template', array( $this, 'filter_locate_template' ), 10, 3 );
+
+ // Add extra placeholder support for subject and title fields.
+ add_filter( 'woocommerce_email_format_string', array( $this, 'add_extra_placeholders' ), 20, 2 );
+
+ // Hook in main text areas for customized emails.
+ add_action( 'Mailtpl_Woomailemail_details', array( $this, 'email_main_text_area' ), 10, 4 );
+
+ // Hook in main text areas for customized emails.
+ add_action( 'Mailtpl_Woomailemail_text', array( $this, 'email_main_text_area_no_order' ), 10, 1 );
+
+ // Hook in footer container.
+ add_action( 'Mailtpl_Woomailemail_footer', array( $this, 'email_footer_content' ), 100 );
+
+ // hook in email photo option.
+ add_filter( 'woocommerce_email_order_items_args', array( $this, 'add_wc_order_email_args_images' ), 10 );
+
+ // Hook for replacing {year} in email-footer.
+ add_filter( 'woocommerce_email_footer_text', array( $this, 'email_footer_replace_year' ) );
+
+ add_filter( 'woocommerce_email_setup_locale', array( $this, 'switch_to_site_locale' ) );
+
+ add_filter( 'woocommerce_email_restore_locale', array( $this, 'restore_to_user_locale' ) );
+
+ //add_filter( 'woocommerce_email_styles', array( $this, 'check_to_add_gmail_hack' ), 50, 2 );
+
+ //require_once MAILTPL_WOOMAIL_PATH . 'includes/class-kwed-cartflows-ca-email.php'; // Add CartFlows, soon.
+
+ // Forces the WordPress to use the correct language file if switched.
+ add_action( 'change_locale', array( $this, 'load_plugin_textdomain' ) );
+
+ }
+ /**
+ * Adds the filter for email hack if this filter runs.
+ *
+ * @param string $css the Email css.
+ * @param object $email the Email object.
+ * @return string the Email css.
+ */
+ public function check_to_add_gmail_hack( $css, $email = '' ) {
+ add_filter( 'woocommerce_mail_content', array( $this, 'add_gmail_hack' ), 50 );
+ return $css;
+ }
+ /**
+ * Adds a bit of css to fix a rendering issue where gmail breaks email templates.
+ *
+ * @param string $content the Email content.
+ * @return string Email content with string possibly added on.
+ */
+ public function add_gmail_hack( $content ) {
+ $responsive_check = Mailtpl_Woomail_Customizer::opt( 'responsive_mode' );
+ if ( true != $responsive_check ) {
+ $content = '' . $content;
+ }
+ remove_filter( 'woocommerce_mail_content', array( $this, 'add_gmail_hack' ), 50 );
+ return $content;
+ }
+ /**
+ * Filter callback to replace {year} in email footer
+ *
+ * @param string $string Email footer text.
+ * @return string Email footer text with any replacements done.
+ */
+ public function email_footer_replace_year( $string ) {
+ return str_replace( '{year}', date( 'Y' ), $string );
+ }
+
+ /**
+ * Add a notice about woocommerce being needed.
+ *
+ * @param array $args the order detials args.
+ */
+ public function add_wc_order_email_args_images( $args ) {
+ $product_photo = Mailtpl_Woomail_Customizer::opt( 'order_items_image' );
+ $size = Mailtpl_Woomail_Customizer::opt( 'order_items_image_size' );
+ if ( 'show' === $product_photo ) {
+ $args['show_image'] = true;
+ if ( '100x100' === $size ) {
+ $args['image_size'] = array( 100, 100 );
+ } else if ( '150x150' === $size ) {
+ $args['image_size'] = array( 150, 150 );
+ } else if ( '40x40' === $size ) {
+ $args['image_size'] = array( 40, 40 );
+ } else if ( '50x50' === $size ) {
+ $args['image_size'] = array( 50, 50 );
+ } else if ( 'woocommerce_thumbnail' === $size ) {
+ $args['image_size'] = 'woocommerce_thumbnail';
+ } else {
+ $args['image_size'] = array( 100, 50 );
+ }
+ }
+ return $args;
+ }
+ /**
+ * Add a notice about woocommerce being needed.
+ */
+ public function admin_notice_need_woocommerce() {
+ echo '';
+ echo '
' . esc_html__( 'Mailtpl Woocommerce Email Composer requires WooCommerce to be active to work', 'mailtpl-woocommerce-email-composer' ) . '
';
+ echo '
';
+ }
+ /**
+ * Set up the footer content
+ */
+ public function email_footer_content() {
+ $content_width = Mailtpl_Woomail_Customizer::opt( 'content_width' );
+ if ( empty( $content_width ) ) {
+ $content_width = '600';
+ }
+
+ $content_width = str_replace( 'px', '', $content_width );
+ $social_enable = Mailtpl_Woomail_Customizer::opt( 'footer_social_enable' );
+ $social_links = Mailtpl_Woomail_Customizer::opt( 'footer_social_repeater' );
+ $social_links = json_decode( $social_links );
+ ?>
+
+ id;
+ if ( 'customer_refunded_order' == $key ) {
+ if ( $email->partial_refund ) {
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body_partial' );
+ } else {
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body_full' );
+ }
+ } elseif ( 'customer_partially_refunded_order' == $key ) {
+ $body_text = Mailtpl_Woomail_Customizer::opt( 'customer_refunded_order_body_partial' );
+ } elseif ( 'customer_invoice' == $key ) {
+ if ( $order->has_status( 'pending' ) ) {
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body' );
+ $btn_switch = Mailtpl_Woomail_Customizer::opt( $key . '_btn_switch' );
+ if ( true == $btn_switch ) {
+ $pay_link = '' . esc_html__( 'Pay for this order', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else {
+ $pay_link = '' . esc_html__( 'Pay for this order', 'mailtpl-woocommerce-email-composer' ) . ' ';
+ }
+ $body_text = str_replace( '{invoice_pay_link}', $pay_link, $body_text );
+ } else {
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body_paid' );
+ }
+ } elseif ( 'customer_renewal_invoice' == $key ) {
+ if ( $order->has_status( 'pending' ) ) {
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body' );
+ $btn_switch = Mailtpl_Woomail_Customizer::opt( $key . '_btn_switch' );
+ if ( true == $btn_switch ) {
+ $pay_link = '' . esc_html__( 'Pay Now »', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else {
+ $pay_link = '' . esc_html__( 'Pay Now »', 'mailtpl-woocommerce-email-composer' ) . ' ';
+ }
+ $body_text = str_replace( '{invoice_pay_link}', $pay_link, $body_text );
+ } else {
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body_failed' );
+ $btn_switch = Mailtpl_Woomail_Customizer::opt( $key . '_btn_switch' );
+ if ( true == $btn_switch ) {
+ $pay_link = '' . esc_html__( 'Pay Now »', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else {
+ $pay_link = '' . esc_html__( 'Pay Now »', 'mailtpl-woocommerce-email-composer' ) . ' ';
+ }
+ $body_text = str_replace( '{invoice_pay_link}', $pay_link, $body_text );
+ }
+ } elseif ( 'customer_payment_retry' == $key ) {
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body' );
+ $btn_switch = Mailtpl_Woomail_Customizer::opt( $key . '_btn_switch' );
+ if ( true == $btn_switch ) {
+ $pay_link = '' . esc_html__( 'Pay Now »', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else {
+ $pay_link = '' . esc_html__( 'Pay Now »', 'mailtpl-woocommerce-email-composer' ) . ' ';
+ }
+ $body_text = str_replace( '{invoice_pay_link}', $pay_link, $body_text );
+ } else {
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body' );
+ }
+ $body_text = str_replace( '{site_title}', get_bloginfo( 'name', 'display' ), $body_text );
+ $body_text = str_replace( '{site_address}', wp_parse_url( home_url(), PHP_URL_HOST ), $body_text );
+ $body_text = str_replace( '{site_url}', wp_parse_url( home_url(), PHP_URL_HOST ), $body_text );
+
+ if ( $order ) {
+ if ( 0 === ( $user_id = (int) get_post_meta( $order->get_id(), '_customer_user', true ) ) ) {
+ $user_id = 'guest';
+ }
+ // Check for placeholders.
+ $body_text = str_replace( '{order_date}', wc_format_datetime( $order->get_date_created() ), $body_text );
+ $body_text = str_replace( '{order_number}', $order->get_order_number(), $body_text );
+ $body_text = str_replace( '{customer_first_name}', $order->get_billing_first_name(), $body_text );
+ $body_text = str_replace( '{customer_last_name}', $order->get_billing_last_name(), $body_text );
+ $body_text = str_replace( '{customer_full_name}', $order->get_formatted_billing_full_name(), $body_text );
+ $body_text = str_replace( '{customer_company}', $order->get_billing_company(), $body_text );
+ $body_text = str_replace( '{customer_email}', $order->get_billing_email(), $body_text );
+ $body_text = str_replace( '{customer_username}', self::get_username_from_id( $user_id ), $body_text );
+ }
+
+ $body_text = apply_filters( 'mailtpl_woomail_order_body_text', $body_text, $order, $sent_to_admin, $plain_text, $email );
+
+ // auto wrap text.
+ $body_text = wpautop( $body_text );
+
+ echo wp_kses_post( $body_text );
+
+ }
+ /**
+ * Get username from user id.
+ *
+ * @param string $id the user id.
+ * @access public
+ * @return string
+ */
+ public static function get_username_from_id( $id ) {
+ if ( empty( $id ) || 'guest' === $id ) {
+ return __( 'Guest', 'mailtpl-woocommerce-email-composer' );
+ }
+ $user = get_user_by( 'id', $id );
+ if ( is_object( $user ) ) {
+ $username = $user->user_login;
+ } else {
+ $username = __( 'Guest', 'mailtpl-woocommerce-email-composer' );
+ }
+ return $username;
+ }
+ /**
+ * Filter Subtitle for Placeholders
+ *
+ * @param string $subtitle the email subtitle.
+ * @param object $email the email object.
+ * @access public
+ * @return string
+ */
+ public static function filter_subtitle( $subtitle, $email ) {
+ // Check for placeholders.
+ $subtitle = str_replace( '{site_title}', get_bloginfo( 'name', 'display' ), $subtitle );
+ $subtitle = str_replace( '{site_address}', wp_parse_url( home_url(), PHP_URL_HOST ), $subtitle );
+ $subtitle = str_replace( '{site_url}', wp_parse_url( home_url(), PHP_URL_HOST ), $subtitle );
+ if ( is_a( $email->object, 'WP_User' ) ) {
+ $first_name = get_user_meta( $email->object->ID, 'billing_first_name', true );
+ if ( empty( $first_name ) ) {
+ // Fall back to user display name.
+ $first_name = $email->object->display_name;
+ }
+
+ $last_name = get_user_meta( $email->object->ID, 'billing_last_name', true );
+ if ( empty( $last_name ) ) {
+ // Fall back to user display name.
+ $last_name = $email->object->display_name;
+ }
+
+ $full_name = get_user_meta( $email->object->ID, 'formatted_billing_full_name', true );
+ if ( empty( $full_name ) ) {
+ // Fall back to user display name.
+ $full_name = $email->object->display_name;
+ }
+ $subtitle = str_replace( '{customer_first_name}', $first_name, $subtitle );
+ $subtitle = str_replace( '{customer_last_name}', $last_name, $subtitle );
+ $subtitle = str_replace( '{customer_full_name}', $full_name, $subtitle );
+ $subtitle = str_replace( '{customer_username}', $email->user_login, $subtitle );
+ $subtitle = str_replace( '{customer_email}', $email->object->user_email, $subtitle );
+
+ } elseif ( is_a( $email->object, 'WC_Order' ) ) {
+ if ( 0 === ( $user_id = (int) get_post_meta( $email->object->get_id(), '_customer_user', true ) ) ) {
+ $user_id = 'guest';
+ }
+ $subtitle = str_replace( '{order_date}', wc_format_datetime( $email->object->get_date_created() ), $subtitle );
+ $subtitle = str_replace( '{order_number}', $email->object->get_order_number(), $subtitle );
+ $subtitle = str_replace( '{customer_first_name}', $email->object->get_billing_first_name(), $subtitle );
+ $subtitle = str_replace( '{customer_last_name}', $email->object->get_billing_last_name(), $subtitle );
+ $subtitle = str_replace( '{customer_full_name}', $email->object->get_formatted_billing_full_name(), $subtitle );
+ $subtitle = str_replace( '{customer_company}', $email->object->get_billing_company(), $subtitle );
+ $subtitle = str_replace( '{customer_email}', $email->object->get_billing_email(), $subtitle );
+ $subtitle = str_replace( '{customer_username}', self::get_username_from_id( $user_id ), $subtitle );
+ } elseif ( is_a( $email->object, 'WC_Product' ) ) {
+ $subtitle = str_replace( '{product_title}', $email->object->get_title(), $subtitle );
+ }
+
+ return $subtitle;
+
+ }
+
+ /**
+ * Hook in main text areas for customized emails.
+ *
+ * @param object $email the email object.
+ * @access public
+ * @return void
+ */
+ public function email_main_text_area_no_order( $email ) {
+
+ // Get Email ID.
+ $key = $email->id;
+
+ $body_text = Mailtpl_Woomail_Customizer::opt( $key . '_body' );
+ // Check for placeholders.
+ $body_text = str_replace( '{site_title}', get_bloginfo( 'name', 'display' ), $body_text );
+ $body_text = str_replace( '{site_address}', wp_parse_url( home_url(), PHP_URL_HOST ), $body_text );
+ $body_text = str_replace( '{site_url}', wp_parse_url( home_url(), PHP_URL_HOST ), $body_text );
+ if ( is_a( $email->object, 'WP_User' ) ) {
+
+ $first_name = get_user_meta( $email->object->ID, 'billing_first_name', true );
+ if ( empty( $first_name ) ) {
+ $first_name = get_user_meta( $email->object->ID, 'first_name', true );
+ if ( empty( $first_name ) ) {
+ // Fall back to user display name.
+ $first_name = $email->object->display_name;
+ }
+ }
+
+ $last_name = get_user_meta( $email->object->ID, 'billing_last_name', true );
+ if ( empty( $last_name ) ) {
+ $last_name = get_user_meta( $email->object->ID, 'last_name', true );
+ if ( empty( $last_name ) ) {
+ // Fall back to user display name.
+ $last_name = $email->object->display_name;
+ }
+ }
+
+ $full_name = get_user_meta( $email->object->ID, 'formatted_billing_full_name', true );
+ if ( empty( $full_name ) ) {
+ // Fall back to user display name.
+ $full_name = $email->object->display_name;
+ }
+ $body_text = str_replace( '{customer_first_name}', $first_name, $body_text );
+ $body_text = str_replace( '{customer_last_name}', $last_name, $body_text );
+ $body_text = str_replace( '{customer_full_name}', $full_name, $body_text );
+ $body_text = str_replace( '{customer_username}', $email->user_login, $body_text );
+ $body_text = str_replace( '{customer_email}', $email->object->user_email, $body_text );
+ } elseif ( is_a( $email->object, 'WC_Product' ) ) {
+ $body_text = str_replace( '{product_title}', $email->object->get_title(), $body_text );
+ $body_text = str_replace( '{product_link}', $email->object->get_permalink(), $body_text );
+ }
+
+ $body_text = apply_filters( 'mailtpl_woomail_no_order_body_text', $body_text, $email );
+
+ // auto wrap text.
+ $body_text = wpautop( $body_text );
+
+ echo wp_kses_post( $body_text );
+
+ }
+
+ /**
+ * Filter through strings to add support for extra placeholders
+ *
+ * @param string $string string of text.
+ * @param object $email the email object.
+ * @access public
+ * @return string
+ */
+ public function add_extra_placeholders( $string, $email ) {
+
+ if ( is_a( $email->object, 'WP_User' ) ) {
+ $first_name = get_user_meta( $email->object->ID, 'billing_first_name', true );
+ if ( empty( $first_name ) ) {
+ $first_name = get_user_meta( $email->object->ID, 'first_name', true );
+ if ( empty( $first_name ) ) {
+ // Fall back to user display name.
+ $first_name = $email->object->display_name;
+ }
+ }
+
+ $last_name = get_user_meta( $email->object->ID, 'billing_last_name', true );
+ if ( empty( $last_name ) ) {
+ $last_name = get_user_meta( $email->object->ID, 'last_name', true );
+ if ( empty( $last_name ) ) {
+ // Fall back to user display name.
+ $last_name = $email->object->display_name;
+ }
+ }
+
+ $full_name = get_user_meta( $email->object->ID, 'formatted_billing_full_name', true );
+ if ( empty( $full_name ) ) {
+ // Fall back to user display name.
+ $full_name = $email->object->display_name;
+ }
+ $string = str_replace( '{customer_first_name}', $first_name, $string );
+ $string = str_replace( '{customer_last_name}', $last_name, $string );
+ $string = str_replace( '{customer_full_name}', $full_name, $string );
+ $string = str_replace( '{customer_username}', $email->user_login, $string );
+ $string = str_replace( '{customer_email}', $email->object->user_email, $string );
+
+ } else if ( is_a( $email->object, 'WC_Order' ) ) {
+ if ( 0 === ( $user_id = (int) get_post_meta( $email->object->get_id(), '_customer_user', true ) ) ) {
+ $user_id = 'guest';
+ }
+ $string = str_replace( '{customer_first_name}', $email->object->get_billing_first_name(), $string );
+ $string = str_replace( '{customer_last_name}', $email->object->get_billing_last_name(), $string );
+ $string = str_replace( '{customer_full_name}', $email->object->get_formatted_billing_full_name(), $string );
+ $string = str_replace( '{customer_company}', $email->object->get_billing_company(), $string );
+ $string = str_replace( '{customer_email}', $email->object->get_billing_email(), $string );
+ $string = str_replace( '{customer_username}', self::get_username_from_id( $user_id ), $string );
+ }
+
+ return $string;
+ }
+
+ /**
+ * Add submenu under woocommerce for email customizer
+ *
+ * @access public
+ * @return void
+ */
+
+ public function wwp_wholesale_reports_callback() {
+
+ }
+
+ /**
+ * Add submenu under woocommerce for email customizer
+ *
+ * @param array $links plugin links.
+ * @access public
+ * @return array
+ */
+ public function plugins_page_links( $links ) {
+ $settings_link = '' . __( 'Open Email Composer', 'mailtpl-woocommerce-email-composer' ) . ' ';
+ array_unshift( $links, $settings_link );
+
+ return $links;
+ }
+
+ /**
+ * Checks to see if we are opening our custom customizer preview
+ *
+ * @access public
+ * @return bool
+ */
+ public static function is_own_preview_request() {
+ return isset( $_REQUEST['mailtpl-woomail-preview'] ) && '1' === $_REQUEST['mailtpl-woomail-preview'];
+ }
+
+ /**
+ * Checks to see if we are opening our custom customizer controls
+ *
+ * @access public
+ * @return bool
+ */
+ public static function is_own_customizer_request() {
+ return isset( $_REQUEST['mailtpl-woomail-customize'] ) && '1' === $_REQUEST['mailtpl-woomail-customize'];
+ }
+
+ /**
+ * Gets the capability setting needed to edit in the email customizer
+ *
+ * @access public
+ * @return string
+ */
+ public static function get_admin_capability() {
+ // Get capability.
+ if ( is_null( self::$admin_capability ) ) {
+ self::$admin_capability = apply_filters( 'mailtpl_woomail_capability', 'manage_woocommerce' );
+ }
+
+ // Return capability.
+ return self::$admin_capability;
+ }
+
+ /**
+ * Check if user is authorized to use the email customizer
+ *
+ * @access public
+ * @return bool
+ */
+ public static function is_admin() {
+ return current_user_can( self::get_admin_capability() );
+ }
+
+ /**
+ * Hook in email header with access to the email object
+ *
+ * @param string $email_heading email heading.
+ * @param object $email the email object.
+ * @access public
+ * @return void
+ */
+ public function add_email_header( $email_heading, $email = '' ) {
+ wc_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading, 'email' => $email ) );
+ }
+
+ /**
+ * Filter in custom email templates with priority to child themes
+ *
+ * @param string $template the email template file.
+ * @param string $template_name name of email template.
+ * @param string $template_path path to email template.
+ * @access public
+ * @return string
+ */
+ public function filter_locate_template( $template, $template_name, $template_path ) {
+ // Make sure we are working with an email template.
+ if ( ! in_array( 'emails', explode( '/', $template_name ) ) ) {
+ return $template;
+ }
+ // clone template.
+ $_template = $template;
+
+ // Get the woocommerce template path if empty.
+ if ( ! $template_path ) {
+ global $woocommerce;
+ $template_path = $woocommerce->template_url;
+ }
+
+ // Get our template path.
+ $plugin_path = MAILTPL_WOOMAIL_PATH . 'templates/woo/';
+
+ // Look within passed path within the theme - this is priority.
+ $template = locate_template( array( $template_path . $template_name, $template_name ) );
+
+ // If theme isn't trying to override get the template from this plugin, if it exists.
+ if ( ! $template && file_exists( $plugin_path . $template_name ) ) {
+ $template = $plugin_path . $template_name;
+ }
+
+ // else if we still don't have a template use default.
+ if ( ! $template ) {
+ $template = $_template;
+ }
+ // Return template.
+ return $template;
+
+ }
+ /**
+ * Filter in custom email templates with priority to child themes
+ *
+ * @param string $template the email template file.
+ * @param string $template_name name of email template.
+ * @param string $template_path path to email template.
+ * @access public
+ * @return string
+ */
+ public function filter_locate_template_language( $template, $template_name, $template_path ) {
+ // Make sure we are working with an email template.
+ if ( ! in_array( 'emails', explode( '/', $template_name ) ) ) {
+ return $template;
+ }
+
+ $this->load_plugin_textdomain();
+ // Return template.
+ return $template;
+ }
+ /**
+ * Filter when email languages are set, adds in a switch if needed
+ *
+ * @access public
+ * @param bool $switch whether or not it should switch.
+ * @return bool
+ */
+ public function switch_to_site_locale( $switch ) {
+ if ( $switch ) {
+ if ( function_exists( 'switch_to_locale' ) ) {
+ add_filter( 'woocommerce_locate_template', array( $this, 'filter_locate_template_language' ), 5, 3 );
+ }
+ }
+ return $switch;
+ }
+ /**
+ * Load Localisation files.
+ */
+ public function load_plugin_textdomain() {
+ load_plugin_textdomain( 'mailtpl-woocommerce-email-composer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
+ }
+ /**
+ * Restore the locale to the default locale. Use after finished with setup_locale.
+ *
+ * @param boolean $switch whether or not it should switch.
+ * @return boolean
+ */
+ public function restore_to_user_locale( $switch ) {
+ if ( $switch ) {
+ if ( function_exists( 'restore_previous_locale' ) ) {
+ remove_filter( 'woocommerce_locate_template', array( $this, 'filter_locate_template_language' ), 5, 3 );
+ }
+ }
+ return $switch;
+ }
}
+Mailtpl_Woomail_Composer::get_instance();
/**
- * The code that runs during plugin deactivation.
- * This action is documented in includes/class-mailtpl-deactivator.php
+ * Checks if WooCommerce is enabled
*/
-function deactivate_mailtpl() {
- require_once plugin_dir_path( __FILE__ ) . 'includes/class-mailtpl-deactivator.php';
- Mailtpl_Deactivator::deactivate();
-}
+class Mailtpl_Woomail_Plugin_Check {
-register_activation_hook( __FILE__, 'activate_mailtpl' );
-register_deactivation_hook( __FILE__, 'deactivate_mailtpl' );
+ private static $active_plugins;
-/**
- * The core plugin class that is used to define internationalization,
- * admin-specific hooks, and public-facing site hooks.
- */
-require plugin_dir_path( __FILE__ ) . 'includes/class-mailtpl.php';
+ public static function init() {
+
+ self::$active_plugins = (array) get_option( 'active_plugins', array() );
+
+ if ( is_multisite() ) {
+ self::$active_plugins = array_merge( self::$active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
+ }
+ }
+ public static function active_check_woo() {
+
+ if ( ! self::$active_plugins ) {
+ self::init();
+ }
+ return in_array( 'woocommerce/woocommerce.php', self::$active_plugins ) || array_key_exists( 'woocommerce/woocommerce.php', self::$active_plugins );
+ }
+
+}
+}
/**
- * Begins execution of the plugin.
- * @since 1.0.0
+ * Checks if WooCommerce is enabled
*/
-function Mailtpl() {
+function mailtpl_woomail_is_woo_active() {
+ return Mailtpl_Woomail_Plugin_Check::active_check_woo();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- $plugin = Mailtpl::instance();
- $plugin->run();
-}
-Mailtpl();
diff --git a/includes/class-customizer-mailtplimportexport-control.php b/includes/class-customizer-mailtplimportexport-control.php
new file mode 100644
index 0000000..fb083a7
--- /dev/null
+++ b/includes/class-customizer-mailtplimportexport-control.php
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ label ); ?>
+ description ) ) : ?>
+ description; ?>
+
+
+
+
+ label ); ?>
+
+ description ) ) : ?>
+ description; ?>
+
+ input_attrs(); $this->link(); ?>>
+
+
+
+
+
+
+ NEW!
+
Free Fluid Template
+ Download Here
+
+
+
+
+
+
+
+
+
+ label ); ?>
+
+ input_attrs(); $this->link(); ?>>
+ 0
+
+ description ) ) : ?>
+ description; ?>
+
+
+ add_field_label = esc_html__( 'Add new field', 'mailtpl-woocommerce-email-composer' );
+ if ( ! empty( $args['add_field_label'] ) ) {
+ $this->add_field_label = $args['add_field_label'];
+ }
+
+ $this->boxtitle = esc_html__( 'Customizer Repeater', 'mailtpl-woocommerce-email-composer' );
+ if ( ! empty ( $args['item_name'] ) ) {
+ $this->boxtitle = $args['item_name'];
+ } elseif ( ! empty( $this->label ) ) {
+ $this->boxtitle = $this->label;
+ }
+
+ if ( ! empty( $args['customizer_repeater_image_control'] ) ) {
+ $this->customizer_repeater_image_control = $args['customizer_repeater_image_control'];
+ }
+
+ if ( ! empty( $args['customizer_repeater_icon_control'] ) ) {
+ $this->customizer_repeater_icon_control = $args['customizer_repeater_icon_control'];
+ }
+ if ( ! empty( $args['customizer_repeater_icon_color'] ) ) {
+ $this->customizer_repeater_icon_color = $args['customizer_repeater_icon_color'];
+ }
+
+ if ( ! empty( $args['customizer_repeater_title_control'] ) ) {
+ $this->customizer_repeater_title_control = $args['customizer_repeater_title_control'];
+ }
+
+ if ( ! empty( $args['customizer_repeater_link_control'] ) ) {
+ $this->customizer_repeater_link_control = $args['customizer_repeater_link_control'];
+ }
+
+ if ( ! empty( $id ) ) {
+ $this->id = $id;
+ }
+
+
+ $allowed_array1 = wp_kses_allowed_html( 'post' );
+ $allowed_array2 = array(
+ 'input' => array(
+ 'type' => array(),
+ 'class' => array(),
+ 'placeholder' => array()
+ )
+ );
+
+ $this->allowed_html = array_merge( $allowed_array1, $allowed_array2 );
+ }
+
+ /*Enqueue resources for the control*/
+ public function enqueue() {
+
+ wp_enqueue_style( 'customizer-icon-select', MAILTPL_WOOMAIL_URL . 'assets/css/customizer-icon-select.css', array(), MAILTPL_VERSION );
+
+ wp_enqueue_style( 'customizer-repeater-control', MAILTPL_WOOMAIL_URL . 'assets/css/customizer-repeater-control.css', array(), MAILTPL_VERSION );
+
+ wp_enqueue_style( 'wp-color-picker' );
+
+ wp_enqueue_script( 'customizer-repeater-control', MAILTPL_WOOMAIL_URL . 'assets/js/customizer-repeater-control.js', array('jquery', 'jquery-ui-draggable', 'wp-color-picker' ), MAILTPL_VERSION, true );
+
+ }
+ public function customizer_repeater_sanitize( $input ) {
+ $input_decoded = json_decode($input,true);
+
+ if(!empty($input_decoded)) {
+ foreach ($input_decoded as $boxk => $box ){
+ foreach ($box as $key => $value){
+
+ $input_decoded[$boxk][$key] = wp_kses_post( force_balance_tags( $value ) );
+
+ }
+ }
+ return json_encode($input_decoded);
+ }
+ return $input;
+ }
+
+
+ public function render_content() {
+
+ /*Get default options*/
+ $this_default = json_decode( $this->setting->default );
+
+ /*Get values (json format)*/
+ $values = $this->value();
+
+ /*Decode values*/
+ $json = json_decode( $values );
+
+ if ( ! is_array( $json ) ) {
+ $json = array( $values );
+ } ?>
+
+ label ); ?>
+
+ iterate_array( $this_default ); ?>
+ link() ); ?>
+ class="customizer-repeater-colector"
+ value=""/>
+ iterate_array(); ?>
+ link() ); ?>
+ class="customizer-repeater-colector"/>
+ iterate_array( $json ); ?>
+ link() ); ?>
+ class="customizer-repeater-colector" value="value() ); ?>"/>
+
+
+
+ add_field_label ); ?>
+
+
+
+
+ boxtitle ) ?>
+
+
+ id ) ) {
+ $id = $icon->id;
+ }
+ if ( ! empty( $icon->choice ) ) {
+ $choice = $icon->choice;
+ }
+ if ( ! empty( $icon->image_url ) ) {
+ $image_url = $icon->image_url;
+ }
+ if ( ! empty($icon->icon_value ) ) {
+ $icon_value = $icon->icon_value;
+ }
+ if ( ! empty( $icon->icon_color ) ) {
+ $icon_color = $icon->icon_color;
+ }
+ if ( ! empty($icon->title ) ) {
+ $title = $icon->title;
+ }
+ if ( ! empty( $icon->link ) ){
+ $link = $icon->link;
+ }
+
+ if($this->customizer_repeater_image_control == true && $this->customizer_repeater_icon_control == true) {
+ $this->icon_type_choice( $choice );
+ }
+ if($this->customizer_repeater_image_control == true){
+ $this->image_control( $image_url, $choice );
+ }
+ if ( $this->customizer_repeater_icon_control == true ){
+ $this->icon_picker_control( $icon_value, $choice );
+ }
+ if ( $this->customizer_repeater_icon_color == true ){
+ $this->icon_color_choice( $icon_color, $choice );
+ }
+ if($this->customizer_repeater_title_control==true){
+ $this->input_control(array(
+ 'label' => apply_filters('repeater_input_labels_filter', esc_html__( 'Title','mailtpl-woocommerce-email-composer' ), $this->id, 'customizer_repeater_title_control' ),
+ 'class' => 'customizer-repeater-title-control',
+ 'type' => apply_filters('customizer_repeater_input_types_filter', '', $this->id, 'customizer_repeater_title_control' ),
+ ), $title);
+ }
+ if($this->customizer_repeater_link_control){
+ $this->input_control(array(
+ 'label' => apply_filters('repeater_input_labels_filter', esc_html__( 'Link','mailtpl-woocommerce-email-composer' ), $this->id, 'customizer_repeater_link_control' ),
+ 'class' => 'customizer-repeater-link-control',
+ 'sanitize_callback' => 'esc_url_raw',
+ 'type' => apply_filters('customizer_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link_control' ),
+ ), $link);
+ }
+ ?>
+
+
+ >
+
+
+
+
+
+
+
+
+
+ boxtitle ) ?>
+
+
+ customizer_repeater_image_control == true && $this->customizer_repeater_icon_control == true ) {
+ $this->icon_type_choice();
+ }
+ if ( $this->customizer_repeater_image_control == true ) {
+ $this->image_control();
+ }
+ if ( $this->customizer_repeater_icon_control == true ) {
+ $this->icon_picker_control();
+ }
+ if ( $this->customizer_repeater_icon_color == true ) {
+ $this->icon_color_choice();
+ }
+
+ if ( $this->customizer_repeater_title_control == true ) {
+ $this->input_control( array(
+ 'label' => apply_filters('repeater_input_labels_filter', esc_html__( 'Title','mailtpl-woocommerce-email-composer' ), $this->id, 'customizer_repeater_title_control' ),
+ 'class' => 'customizer-repeater-title-control',
+ 'type' => apply_filters('customizer_repeater_input_types_filter', '', $this->id, 'customizer_repeater_title_control' ),
+ ) );
+ }
+
+ if ( $this->customizer_repeater_link_control == true ) {
+ $this->input_control( array(
+ 'label' => apply_filters('repeater_input_labels_filter', esc_html__( 'Link','mailtpl-woocommerce-email-composer' ), $this->id, 'customizer_repeater_link_control' ),
+ 'class' => 'customizer-repeater-link-control',
+ 'type' => apply_filters('customizer_repeater_input_types_filter', '', $this->id, 'customizer_repeater_link_control' ),
+ ) );
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ >
+
+
+
+
+
+
+ >
+
+
+
+
+
+ icon_list();
+ foreach( $icons as $icon ){
+ if( $value == $icon ) {
+ echo ''.$icon.' ';
+ } else {
+ echo ''.$icon.' ';
+ }
+ } ?>
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+ >
+ >
+ >
+
+
+ >
+
+
+
+
+ >
+ >
+ >
+
+
+
+
+
+ label ); ?>
+ link(); checked( $this->value() ); ?> />
+
+
+ description ) ) : ?>
+ description; ?>
+
+
+
+ * @author wpexperts
*/
class Mailtpl_Activator {
diff --git a/includes/class-mailtpl-customizer.php b/includes/class-mailtpl-customizer.php
index cdf5270..f5183d9 100755
--- a/includes/class-mailtpl-customizer.php
+++ b/includes/class-mailtpl-customizer.php
@@ -8,7 +8,7 @@
*
* @package Mailtpl
* @subpackage Mailtpl/includes
- * @author Damian Logghe
+ * @author wpexperts
*/
class Mailtpl_Customizer {
@@ -52,7 +52,7 @@ public function __construct( $plugin_name, $version ) {
public function register_customize_sections( $wp_customize ){
$wp_customize->add_panel( 'mailtpl', array(
- 'title' => __( 'Email Templates', 'email-templates' ),
+ 'title' => __( 'Wordpress Email Templates', 'email-templates' ),
'description' => __( 'Within the Email Templates customizer you can change how your WordPress Emails looks. It\'s fully compatible with WooCommerce and Easy Digital Downloads html emails', 'email-templates' ),
) );
@@ -161,7 +161,7 @@ public function capture_customizer_page( $template ){
*/
public function enqueue_scripts() {
- wp_enqueue_script( 'mailtpl-js', MAILTPL_PLUGIN_URL . '/admin/js/mailtpl-admin.js', '', $this->version, false );
+ wp_enqueue_script( 'mailtpl-js', MAILTPL_WOOMAIL_URL . '/admin/js/mailtpl-admin.js', array( 'customize-controls', 'jquery' ), $this->version, false );
}
@@ -170,8 +170,8 @@ public function enqueue_scripts() {
* @since 1.0.0
*/
public function enqueue_template_scripts(){
- wp_enqueue_script( 'mailtpl-front-js', MAILTPL_PLUGIN_URL . '/admin/js/mailtpl-public.js', array( 'jquery', 'customize-preview' ), $this->version, true );
- wp_enqueue_style( 'mailtpl-css', MAILTPL_PLUGIN_URL . '/admin/css/mailtpl-admin.css', '', $this->version, false );
+ wp_enqueue_script( 'mailtpl-front-js', MAILTPL_WOOMAIL_URL . '/admin/js/mailtpl-public.js', array( 'jquery', 'customize-preview' ), $this->version, true );
+ wp_enqueue_style( 'mailtpl-css', MAILTPL_WOOMAIL_URL . '/admin/css/mailtpl-admin.css', '', $this->version, false );
}
/**
diff --git a/includes/class-mailtpl-deactivator.php b/includes/class-mailtpl-deactivator.php
index 2270dfc..48201a9 100755
--- a/includes/class-mailtpl-deactivator.php
+++ b/includes/class-mailtpl-deactivator.php
@@ -18,7 +18,7 @@
* @since 1.0.0
* @package Mailtpl
* @subpackage Mailtpl/includes
- * @author Damian Logghe
+ * @author wpexperts
*/
class Mailtpl_Deactivator {
diff --git a/includes/class-mailtpl-i18n.php b/includes/class-mailtpl-i18n.php
index 6d476ba..f27686b 100755
--- a/includes/class-mailtpl-i18n.php
+++ b/includes/class-mailtpl-i18n.php
@@ -22,7 +22,7 @@
* @since 1.0.0
* @package Mailtpl
* @subpackage Mailtpl/includes
- * @author Damian Logghe
+ * @author wpexperts
*/
class Mailtpl_i18n {
diff --git a/includes/class-mailtpl-loader.php b/includes/class-mailtpl-loader.php
index b087e6a..1276c20 100755
--- a/includes/class-mailtpl-loader.php
+++ b/includes/class-mailtpl-loader.php
@@ -19,7 +19,7 @@
*
* @package Mailtpl
* @subpackage Mailtpl/includes
- * @author Damian Logghe
+ * @author wpexperts
*/
class Mailtpl_Loader {
diff --git a/includes/class-mailtpl-mailer.php b/includes/class-mailtpl-mailer.php
index 8732ecc..3eec84c 100755
--- a/includes/class-mailtpl-mailer.php
+++ b/includes/class-mailtpl-mailer.php
@@ -8,7 +8,7 @@
*
* @package Mailtpl
* @subpackage Mailtpl/includes
- * @author Damian Logghe
+ * @author wpexperts
*/
class Mailtpl_Mailer {
@@ -68,7 +68,7 @@ public function set_content_type($type) {
* @since 1.0.0
*/
public function send_email($args) {
-
+
do_action( 'mailtpl/send_email', $args, $this );
$temp_message = $this->add_template( apply_filters( 'mailtpl/email_content', $args['message'] ) );
$user_email = isset( $args['to'] ) ? $args['to'] : get_option( 'admin_email' );
@@ -132,6 +132,7 @@ private function add_template( $email ) {
private function replace_placeholders( $email, $user_email = '' ) {
$to_replace = apply_filters( 'emailtpl/placeholders', array(
+ '##SITEURL###' => get_option( 'siteurl' ),
'%%BLOG_URL%%' => get_option( 'siteurl' ),
'%%HOME_URL%%' => get_option( 'home' ),
'%%BLOG_NAME%%' => get_option( 'blogname' ),
diff --git a/includes/class-mailtpl-woomail-customizer.php b/includes/class-mailtpl-woomail-customizer.php
new file mode 100644
index 0000000..77ebe83
--- /dev/null
+++ b/includes/class-mailtpl-woomail-customizer.php
@@ -0,0 +1,1157 @@
+ 'email_example_slug',
+ 'email_name' => 'Email Example',
+ 'email_class' => 'Custom_WC_Email_Extend',
+ 'email_heading' => __( 'Placeholder for Heading', 'plugin' ),
+ );
+ */
+ $add_email_previews = apply_filters( 'mailtpl_woocommerce_email_previews', array() );
+ if ( ! empty( $add_email_previews ) && is_array( $add_email_previews ) ) {
+ foreach ( $add_email_previews as $email_item ) {
+ if ( isset( $email_item['email_type'] ) && ! empty( $email_item['email_type'] ) && isset( $email_item['email_name'] ) && ! empty( $email_item['email_name'] ) ) {
+ add_filter(
+ 'mailtpl_woomail_email_types',
+ function( $types ) use ( $email_item ) {
+ $types[ $email_item['email_type'] ] = $email_item['email_name'];
+ return $types;
+ }
+ );
+ }
+ if ( isset( $email_item['email_type'] ) && ! empty( $email_item['email_type'] ) && isset( $email_item['email_class'] ) && ! empty( $email_item['email_class'] ) ) {
+ add_filter(
+ 'mailtpl_woomail_email_type_class_name_array',
+ function( $types ) use ( $email_item ) {
+ $types[ $email_item['email_type'] ] = $email_item['email_class'];
+ return $types;
+ }
+ );
+ }
+ if ( isset( $email_item['email_type'] ) && ! empty( $email_item['email_type'] ) && isset( $email_item['email_heading'] ) && ! empty( $email_item['email_heading'] ) ) {
+ add_filter(
+ 'mailtpl_woomail_email_settings_default_values',
+ function( $placeholders ) use ( $email_item ) {
+ $placeholders[ $email_item['email_type'] . '_heading' ] = $email_item['email_heading'];
+ return $placeholders;
+ }
+ );
+ }
+ }
+ }
+ }
+
+ /*
+ * Unhook Divi front end.
+ *
+ * @param string $url the customizer url.
+ */
+ public function force_fix_wp_multilang( $url ) {
+ return add_query_arg( array( 'mailtpl-woomail-preview' => '1' ), home_url( '/' ) );
+ }
+ /*
+ * Unhook flatsome front end.
+ */
+ public function unhook_flatsome() {
+ // Unhook flatsome issue.
+ wp_dequeue_style( 'flatsome-customizer-preview' );
+ wp_dequeue_script( 'flatsome-customizer-frontend-js' );
+ }
+ /*
+ * Unhook lifter front end.
+ */
+ public function unhook_lifter() {
+ // Unhook LLMs issue.
+ wp_dequeue_script( 'llms' );
+ }
+ /*
+ * Unhook Divi front end.
+ */
+ public function unhook_divi() {
+ // Divi Theme issue.
+ remove_action( 'wp_footer', 'et_builder_get_modules_js_data' );
+ remove_action( 'et_customizer_footer_preview', 'et_load_social_icons' );
+ }
+ public function get_customizer_options_override_ready() {
+ foreach ( Mailtpl_Woomail_Settings::get_email_types() as $key => $value ) {
+ add_filter( 'option_woocommerce_' . $key . '_settings', array( $this, 'customizer_woo_options_override' ), 99, 2 );
+ }
+ }
+ public function customizer_woo_options_override( $value = array(), $option = '' ) {
+ if ( isset( $_POST['customized'] ) ) {
+ $post_values = json_decode( stripslashes_deep( $_POST['customized'] ), true );
+ if ( isset( $_POST['customized'] ) && ! empty( $post_values ) ) {
+ if ( is_array( $post_values ) ) {
+ foreach ( $post_values as $key => $current_value ) {
+ if ( strpos( $key, $option ) !== false ) {
+ $subkey = str_replace( $option, '', $key );
+ $subkey = str_replace( '[', '', rtrim( $subkey, ']' ) );
+ $value[ $subkey ] = $current_value;
+ }
+ }
+ }
+ }
+ }
+ return $value;
+ }
+
+ public function change_publish_button( $translation, $text ) {
+
+ if ( $text == 'Publish' ) {
+ return __( 'Save', 'mailtpl-woocommerce-email-composer' );
+ } else if ( $text == 'Published' ) {
+ return __( 'Saved', 'mailtpl-woocommerce-email-composer' );
+ }
+
+ return $translation;
+ }
+
+ /**
+ * Add customizer capability
+ *
+ * @access public
+ * @param array $capabilities
+ * @return array
+ */
+ public function add_customize_capability( $capabilities ) {
+ // Remove filter (circular reference)
+ remove_filter( 'user_has_cap', array( $this, 'add_customize_capability' ), 99 );
+
+ // Add customize capability for admin user if this is own customizer request
+ if ( Mailtpl_Woomail_Composer::is_admin() && Mailtpl_Woomail_Composer::is_own_customizer_request() ) {
+ $capabilities['customize'] = true;
+ }
+
+ // Add filter
+ add_filter( 'user_has_cap', array( $this, 'add_customize_capability' ), 99 );
+
+ // Return capabilities
+ return $capabilities;
+ }
+
+ /**
+ * Get Customizer URL
+ */
+ public static function get_customizer_url() {
+ if ( is_null( self::$customizer_url ) ) {
+ self::$customizer_url = add_query_arg(
+ array(
+ 'mailtpl-woomail-customize' => '1',
+ 'url' => urlencode( add_query_arg( array( 'mailtpl-woomail-preview' => '1' ), home_url( '/' ) ) ),
+ 'return' => urlencode( Mailtpl_Woomail_Woo::get_email_settings_page_url() ),
+ ),
+ admin_url( 'customize.php' )
+ );
+ }
+
+ return self::$customizer_url;
+ }
+
+ /**
+ * Change site name for customizer
+ *
+ * @access public
+ * @param string $name
+ * @return string
+ */
+ public function change_site_name( $name ) {
+ return __( 'WooCommerce Emails', 'mailtpl-woocommerce-email-composer' );
+ }
+
+ /**
+ * Remove unrelated components
+ *
+ * @access public
+ * @param array $components
+ * @param object $wp_customize
+ * @return array
+ */
+ public function remove_unrelated_components( $components, $wp_customize ) {
+ // Iterate over components
+ foreach ( $components as $component_key => $component ) {
+
+ // Check if current component is own component
+ if ( ! self::is_own_component( $component ) ) {
+ unset( $components[ $component_key ] );
+ }
+ }
+
+ // Return remaining components
+ return $components;
+ }
+
+ /**
+ * Remove unrelated sections
+ *
+ * @access public
+ * @param bool $active
+ * @param object $section
+ * @return bool
+ */
+ public function remove_unrelated_sections( $active, $section ) {
+ // Check if current section is own section
+ if ( ! self::is_own_section( $section->id ) ) {
+ return false;
+ }
+
+ // We can override $active completely since this runs only on own Customizer requests
+ return true;
+ }
+
+ /**
+ * Remove unrelated controls
+ *
+ * @access public
+ * @param bool $active
+ * @param object $control
+ * @return bool
+ */
+ public function remove_unrelated_controls( $active, $control ) {
+ // Check if current control belongs to own section
+ if ( ! self::is_own_section( $control->section ) ) {
+ return false;
+ }
+
+ // We can override $active completely since this runs only on own Customizer requests
+ return $active;
+ }
+
+ /**
+ * Check if current component is own component
+ *
+ * @access public
+ * @param string $component
+ * @return bool
+ */
+ public static function is_own_component( $component ) {
+ return false;
+ }
+
+ /**
+ * Check if current section is own section
+ *
+ * @access public
+ * @param string $key
+ * @return bool
+ */
+ public static function is_own_section( $key ) {
+ // Iterate over own sections
+ foreach ( Mailtpl_Woomail_Settings::get_sections() as $section_key => $section ) {
+ if ( $key === 'mailtpl_woomail_' . $section_key ) {
+ return true;
+ }
+ }
+
+ // Section not found
+ return false;
+ }
+
+ /**
+ * Enqueue Customizer scripts
+ *
+ * @access public
+ * @return void
+ */
+ public function enqueue_customizer_scripts() {
+ // Enqueue Customizer script
+ wp_enqueue_style( 'mailtpl-woomail-customizer-styles', MAILTPL_WOOMAIL_URL . '/assets/css/customizer-styles.css', MAILTPL_VERSION );
+ wp_enqueue_script( 'mailtpl-woomail-customizer-scripts', MAILTPL_WOOMAIL_URL . '/assets/js/customizer-scripts.js', array( 'jquery', 'customize-controls' ), MAILTPL_VERSION, true );
+
+ // Send variables to Javascript
+ wp_localize_script(
+ 'mailtpl-woomail-customizer-scripts',
+ 'mailtpl_woomail',
+ array(
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
+ 'customizer_url' => self::get_customizer_url(),
+ 'responsive_mode' => self::opt( 'responsive_mode' ),
+ 'labels' => array(
+ 'reset' => __( 'Reset', 'mailtpl-woocommerce-email-composer' ),
+ 'customtitle' => __( 'Woocommerce Emails', 'mailtpl-woocommerce-email-composer' ),
+ 'send_confirmation' => __( 'Are you sure you want to send an email?', 'mailtpl-woocommerce-email-composer' ),
+ 'sent' => __( 'Email Sent!', 'mailtpl-woocommerce-email-composer' ),
+ 'failed' => __( 'Email failed, make sure you have a working email server for your site.', 'mailtpl-woocommerce-email-composer' ),
+ 'reset_confirmation' => __( 'Are you sure you want to reset all changes made to your WooCommerce emails?', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ )
+ );
+ // Localize
+ wp_localize_script(
+ 'mailtpl-woomail-customizer-scripts',
+ 'KWMDIEl10n',
+ array(
+ 'emptyImport' => __( 'Please choose a file to import.', 'customizer-export-import' ),
+ 'confrim_override' => __( 'WARNING: This will override all of your current settings. Are you sure you want to do that? We suggest geting an export of your current settings incase you want to revert back.', 'customizer-export-import' ),
+ )
+ );
+
+ // Config
+ wp_localize_script(
+ 'mailtpl-woomail-customizer-scripts',
+ 'KWMDIEConfig',
+ array(
+ 'customizerURL' => admin_url( 'customize.php?mailtpl-woomail-customize=1&url=' . urlencode( add_query_arg( array( 'mailtpl-woomail-preview' => '1' ), site_url( '/' ) ) ) ),
+ 'exportNonce' => wp_create_nonce( 'mailtpl-woomail-exporting' ),
+ )
+ );
+ }
+
+ /**
+ * Add settings
+ *
+ * @access public
+ * @param object $wp_customize
+ * @return void
+ */
+ public function add_settings( $wp_customize ) {
+ // Iterate over settings
+ foreach ( Mailtpl_Woomail_Settings::get_settings() as $setting_key => $setting ) {
+
+ // Add setting
+ $wp_customize->add_setting(
+ 'mailtpl_woomail[' . $setting_key . ']',
+ array(
+ 'type' => 'option',
+ 'transport' => isset( $setting['transport'] ) ? $setting['transport'] : 'postMessage',
+ 'capability' => Mailtpl_Woomail_Composer::get_admin_capability(),
+ 'default' => isset( $setting['default'] ) ? $setting['default'] : '',
+ 'sanitize_callback' => isset( $settings['sanitize_callback'] ) ? array(
+ 'WP_Customize_' . $setting['control_type'] . 'Control',
+ $settings['sanitize_callback'],
+ ) : '',
+ )
+ );
+ }
+ // Iterate over settings
+ foreach ( Mailtpl_Woomail_Settings::get_woo_settings() as $setting_key => $setting ) {
+ // Add setting
+ $wp_customize->add_setting(
+ $setting_key,
+ array(
+ 'type' => 'option',
+ 'transport' => isset( $setting['transport'] ) ? $setting['transport'] : 'postMessage',
+ 'capability' => Mailtpl_Woomail_Composer::get_admin_capability(),
+ 'default' => isset( $setting['default'] ) ? $setting['default'] : '',
+ )
+ );
+ }
+ }
+
+ /**
+ * Add controls, sections and panels
+ *
+ * @access public
+ * @param object $wp_customize
+ * @return void
+ */
+ public function add_controls( $wp_customize ) {
+ // Iterate over settings
+ foreach ( Mailtpl_Woomail_Settings::get_settings() as $setting_key => $setting ) {
+
+ // Maybe add section
+ self::maybe_add_section( $wp_customize, $setting );
+
+ // Maybe add panel
+ self::maybe_add_panel( $wp_customize, $setting );
+
+ // Get control class name (none, color, upload, image)
+ $control_class = isset( $setting['control_type'] ) ? ucfirst( $setting['control_type'] ) . '_' : '';
+ $control_class = 'WP_Customize_' . $control_class . 'Control';
+ // Control configuration
+ $control_config = array(
+ 'label' => $setting['title'],
+ 'settings' => 'mailtpl_woomail[' . $setting_key . ']',
+ 'capability' => Mailtpl_Woomail_Composer::get_admin_capability(),
+ 'priority' => isset( $setting['priority'] ) ? $setting['priority'] : 10,
+ 'active_callback' => ( isset( $setting['active_callback'] ) ) ? array(
+ 'Mailtpl_Woomail_Customizer',
+ 'active_callback',
+ ) : '__return_true',
+ );
+
+ // Description
+ if ( ! empty( $setting['description'] ) ) {
+ $control_config['description'] = $setting['description'];
+ }
+
+ // Add control to section
+ if ( ! empty( $setting['section'] ) ) {
+ $control_config['section'] = 'mailtpl_woomail_' . $setting['section'];
+ }
+
+ // Add control to panel
+ if ( ! empty( $setting['panel'] ) ) {
+ $control_config['panel'] = 'mailtpl_woomail_' . $setting['panel'];
+ }
+
+ // Add custom field type
+ if ( ! empty( $setting['type'] ) ) {
+ $control_config['type'] = $setting['type'];
+ }
+
+ // Add select field options
+ if ( ! empty( $setting['choices'] ) ) {
+ $control_config['choices'] = $setting['choices'];
+ }
+ // Input attributese
+ if ( ! empty( $setting['input_attrs'] ) ) {
+ $control_config['input_attrs'] = $setting['input_attrs'];
+ }
+ // Add repeater controls:
+ if ( ! empty( $setting['customizer_repeater_image_control'] ) ) {
+ $control_config['customizer_repeater_image_control'] = $setting['customizer_repeater_image_control'];
+ }
+ if ( ! empty( $setting['customizer_repeater_icon_control'] ) ) {
+ $control_config['customizer_repeater_icon_control'] = $setting['customizer_repeater_icon_control'];
+ }
+ if ( ! empty( $setting['customizer_repeater_icon_color'] ) ) {
+ $control_config['customizer_repeater_icon_color'] = $setting['customizer_repeater_icon_color'];
+ }
+ if ( ! empty( $setting['customizer_repeater_title_control'] ) ) {
+ $control_config['customizer_repeater_title_control'] = $setting['customizer_repeater_title_control'];
+ }
+ if ( ! empty( $setting['customizer_repeater_link_control'] ) ) {
+ $control_config['customizer_repeater_link_control'] = $setting['customizer_repeater_link_control'];
+ }
+ // Add control
+ $wp_customize->add_control( new $control_class( $wp_customize, 'mailtpl_woomail_' . $setting_key, $control_config ) );
+ }
+ // Iterate over settings
+ foreach ( Mailtpl_Woomail_Settings::get_woo_settings() as $setting_key => $setting ) {
+
+ // Maybe add section
+ self::maybe_add_section( $wp_customize, $setting );
+
+ // Maybe add panel
+ self::maybe_add_panel( $wp_customize, $setting );
+
+ // Get control class name (none, color, upload, image)
+ $control_class = isset( $setting['control_type'] ) ? ucfirst( $setting['control_type'] ) . '_' : '';
+ $control_class = 'WP_Customize_' . $control_class . 'Control';
+
+ // Control configuration
+ $control_config = array(
+ 'label' => $setting['title'],
+ 'settings' => $setting_key,
+ 'capability' => Mailtpl_Woomail_Composer::get_admin_capability(),
+ 'priority' => isset( $setting['priority'] ) ? $setting['priority'] : 10,
+ 'active_callback' => ( isset( $setting['active_callback'] ) ) ? array(
+ 'Mailtpl_Woomail_Customizer',
+ 'active_woo_callback',
+ ) : '__return_true',
+ );
+
+ // Description
+ if ( ! empty( $setting['description'] ) ) {
+ $control_config['description'] = $setting['description'];
+ }
+
+ // Add control to section
+ if ( ! empty( $setting['section'] ) ) {
+ $control_config['section'] = 'mailtpl_woomail_' . $setting['section'];
+ }
+
+ // Add control to panel
+ if ( ! empty( $setting['panel'] ) ) {
+ $control_config['panel'] = 'mailtpl_woomail_' . $setting['panel'];
+ }
+ // Add custom field type
+ if ( ! empty( $setting['type'] ) ) {
+ $control_config['type'] = $setting['type'];
+ }
+ // Add custom field type
+ if ( ! empty( $setting['label'] ) ) {
+ $control_config['label'] = $setting['label'];
+ }
+
+ // Add select field options
+ if ( ! empty( $setting['choices'] ) ) {
+ $control_config['choices'] = $setting['choices'];
+ }
+ // Input attributese
+ if ( ! empty( $setting['input_attrs'] ) ) {
+ $control_config['input_attrs'] = $setting['input_attrs'];
+ }
+ // Add control
+ $wp_customize->add_control( new $control_class( $wp_customize, $setting_key, $control_config ) );
+ }
+ }
+ public static function active_callback( $object ) {
+ if ( ! isset( $object->setting->id ) ) {
+ return true;
+ }
+ $opt_name = explode( '[', $object->setting->id );
+ $opt_name = $opt_name[0];
+ $id = str_replace( $opt_name . '[', '', str_replace( ']', '', $object->setting->id ) );
+
+ $settings = Mailtpl_Woomail_Settings::get_settings();
+
+ if ( ! isset( $settings[ $id ] ) ) {
+ return true;
+ }
+ $field_id = $settings[ $id ]['active_callback']['id'];
+ $compare = $settings[ $id ]['active_callback']['compare'];
+ $value = $settings[ $id ]['active_callback']['value'];
+ $field_value = self::opt( $field_id );
+ switch ( $compare ) {
+ case '==':
+ case '=':
+ case 'equals':
+ case 'equal':
+ $show = ( $field_value == $value ) ? true : false;
+ break;
+
+ case '!=':
+ case 'not equal':
+ $show = ( $field_value != $value ) ? true : false;
+ break;
+ }
+ return $show;
+ }
+ public static function active_woo_callback( $object ) {
+ if ( ! isset( $object->setting->id ) ) {
+ return true;
+ }
+ $id = $object->setting->id;
+
+ $settings = Mailtpl_Woomail_Settings::get_woo_settings();
+
+ if ( ! isset( $settings[ $id ] ) ) {
+ return true;
+ }
+ $field_id = $settings[ $id ]['active_callback']['id'];
+ $compare = $settings[ $id ]['active_callback']['compare'];
+ $value = $settings[ $id ]['active_callback']['value'];
+ $field_value = self::opt( $field_id );
+ switch ( $compare ) {
+ case '==':
+ case '=':
+ case 'equals':
+ case 'equal':
+ $show = ( $field_value == $value ) ? true : false;
+ break;
+
+ case '!=':
+ case 'not equal':
+ $show = ( $field_value != $value ) ? true : false;
+ break;
+ }
+ return $show;
+ }
+ /**
+ * Maybe add section
+ *
+ * @access public
+ * @param object $wp_customize
+ * @param array $child
+ * @return void
+ */
+ public static function maybe_add_section( $wp_customize, $child ) {
+ // Get sections
+ $sections = Mailtpl_Woomail_Settings::get_sections();
+
+ // Check if section is set and exists
+ if ( ! empty( $child['section'] ) && isset( $sections[ $child['section'] ] ) ) {
+
+ // Reference current section key
+ $section_key = $child['section'];
+
+ // Check if section was not added yet
+ if ( ! in_array( $section_key, self::$sections_added, true ) ) {
+
+ // Reference current section
+ $section = $sections[ $section_key ];
+
+ // Section config
+ $section_config = array(
+ 'title' => $section['title'],
+ 'priority' => ( isset( $section['priority'] ) ? $section['priority'] : 10 ),
+ );
+
+ // Description
+ if ( ! empty( $section['description'] ) ) {
+ $section_config['description'] = $section['description'];
+ }
+
+ // Maybe add panel
+ self::maybe_add_panel( $wp_customize, $section );
+
+ // Maybe add section to panel
+ if ( ! empty( $section['panel'] ) ) {
+ $section_config['panel'] = 'mailtpl_woomail_' . $section['panel'];
+ }
+
+ // Register section
+ $wp_customize->add_section( 'mailtpl_woomail_' . $section_key, $section_config );
+
+ // Track which sections were added
+ self::$sections_added[] = $section_key;
+ }
+ }
+ }
+
+ /**
+ * Maybe add panel
+ *
+ * @access public
+ * @param object $wp_customize
+ * @param array $child
+ * @return void
+ */
+ public static function maybe_add_panel( $wp_customize, $child ) {
+ // Get panels
+ $panels = Mailtpl_Woomail_Settings::get_panels();
+ // Check if panel is set and exists
+ if ( ! empty( $child['panel'] ) && isset( $panels[ $child['panel'] ] ) ) {
+
+ // Reference current panel key
+ $panel_key = $child['panel'];
+
+ // Check if panel was not added yet
+ if ( ! in_array( $panel_key, self::$panels_added, true ) ) {
+
+ // Reference current panel
+ $panel = $panels[ $panel_key ];
+
+ // Panel config
+ $panel_config = array(
+ 'title' => $panel['title'],
+ 'priority' => ( isset( $panel['priority'] ) ? $panel['priority'] : 10 ),
+ 'capability' => Mailtpl_Woomail_Composer::get_admin_capability(),
+ );
+
+ // Panel description
+ if ( ! empty( $panel['description'] ) ) {
+ $panel_config['description'] = $panel['description'];
+ }
+
+ // Register panel
+ $wp_customize->add_panel( 'mailtpl_woomail_' . $panel_key, $panel_config );
+
+ // Track which panels were added
+ self::$panels_added[] = $panel_key;
+ }
+ }
+ }
+
+ /**
+ * Get styles string
+ *
+ * @access public
+ * @param bool $add_custom_css
+ * @return string
+ */
+ public static function get_styles_string( $add_custom_css = true ) {
+ $styles_array = array();
+ $styles = '';
+ $responsive_check = self::opt( 'responsive_mode' );
+
+ // Iterate over settings.
+ foreach ( Mailtpl_Woomail_Settings::get_settings() as $setting_key => $setting ) {
+
+ // Only add CSS properties.
+ if ( isset( $setting['live_method'] ) && $setting['live_method'] === 'css' ) {
+
+ // Iterate over selectors.
+ foreach ( $setting['selectors'] as $selector => $properties ) {
+
+ // Iterate over properties.
+ foreach ( $properties as $property ) {
+ // Add value to styles array.
+ if ( $responsive_check && 'content_width' == $setting_key ) {
+ $property = 'max-width';
+ if ( '#template_container' !== $selector && '#template_footer' !== $selector ) {
+ continue;
+ }
+ }
+ if ( ! $responsive_check && 'content_width' == $setting_key ) {
+ continue;
+ }
+ if ( 'border_width' == $setting_key ) {
+ if ( '' === self::get_stored_value( 'border_width_right' ) ) {
+ $property = 'border-width';
+ } else if ( '0' === self::get_stored_value( 'border_width' ) ) {
+ $property = 'border-top';
+ }
+ }
+ if ( 'border_width_right' == $setting_key && '0' === self::get_stored_value( 'border_width_right' ) ) {
+ $property = 'border-right';
+ }
+ if ( 'border_width_left' == $setting_key && '0' === self::get_stored_value( 'border_width_left' ) ) {
+ $property = 'border-left';
+ }
+ if ( 'border_width_bottom' == $setting_key && '0' === self::get_stored_value( 'border_width_bottom' ) ) {
+ $property = 'border-bottom';
+ }
+
+ if ( 'items_table_padding' == $setting_key && ( '.order-items-normal #body_content_inner table.td th' === $selector || '.order-items-normal #body_content_inner table.td td' === $selector ) ) {
+ if ( '' === self::get_stored_value( 'items_table_padding_left_right' ) ) {
+ $property = 'padding';
+ }
+ }
+ if ( ! $responsive_check && 'content_inner_width' == $setting_key ) {
+ continue;
+ }
+ $styles_array[ $selector ][ $property ] = self::opt( $setting_key, $selector );
+ }
+ }
+ }
+ }
+
+ // Join property names with values.
+ foreach ( $styles_array as $selector => $properties ) {
+
+ // Open selector.
+ $styles .= $selector . '{';
+
+ foreach ( $properties as $property_key => $property_value ) {
+
+ // Add property.
+ $styles .= $property_key . ':' . $property_value . ';';
+ }
+
+ // Close selector.
+ $styles .= '}';
+ }
+
+ // Add custom CSS
+ if ( $add_custom_css ) {
+ $styles .= self::opt( 'custom_css' );
+ }
+
+ // Return styles string
+ return $styles;
+ }
+
+ /**
+ * Get value for use in templates
+ *
+ * @access public
+ * @param string $key
+ * @param string $selector
+ * @return string
+ */
+ public static function opt( $key, $selector = null ) {
+ // Get raw value
+ $stored_value = self::get_stored_value( $key, Mailtpl_Woomail_Settings::get_default_value( $key ) );
+
+ // Prepare value
+ $value = self::prepare( $key, $stored_value, $selector );
+
+ // Allow developers to override.
+ return apply_filters( 'mailtpl_woomail_option_value', $value, $key, $selector, $stored_value );
+ }
+
+ /**
+ * Get value stored in database
+ *
+ * @access public
+ * @param string $key the setting key.
+ * @param string $default the setting defaut.
+ * @return string
+ */
+ public static function get_stored_value( $key, $default = '' ) {
+ // Get all stored values.
+ $stored = (array) get_option( 'mailtpl_woomail', array() );
+
+ // Check if value exists in stored values array.
+ if ( ! empty( $stored ) && isset( $stored[ $key ] ) ) {
+ return $stored[ $key ];
+ }
+
+ // Stored value not found, use default value.
+ return $default;
+ }
+ /**
+ * Prepare value for use in HTML
+ *
+ * @access public
+ * @param string $key
+ * @param string $value
+ * @param string $selector
+ * @return string
+ */
+ public static function prepare( $key, $value, $selector = null ) {
+ // Append CSS suffix to value
+ $value .= self::get_css_suffix( $key );
+
+ // Special case for shadow
+ if ( $key === 'shadow' ) {
+ $value = '0 ' . ( $value > 0 ? 1 : 0 ) . 'px ' . ( $value * 4 ) . 'px ' . $value . 'px rgba(0,0,0,0.1) !important';
+ }
+
+ // Special case for border width 0.
+ if ( $key === 'border_width_right' && '0px' === $value ) {
+ $background = get_option( 'woocommerce_email_background_color' );
+ $value = '0px solid ' . $background . ' !important';
+ }
+ if ( $key === 'border_width_left' && '0px' === $value ) {
+ $background = get_option( 'woocommerce_email_background_color' );
+ $value = '0px solid ' . $background . ' !important';
+ }
+ if ( $key === 'border_width_bottom' && '0px' === $value ) {
+ $background = get_option( 'woocommerce_email_background_color' );
+ $value = '0px solid ' . $background . ' !important';
+ }
+ if ( $key === 'border_width' && '0px' === $value ) {
+ $background = get_option( 'woocommerce_email_background_color' );
+ $value = '0px solid ' . $background . ' !important';
+ }
+
+ // Font family
+ if ( substr( $key, -11 ) === 'font_family' ) {
+ $value = isset( Mailtpl_Woomail_Settings::$font_family_mapping[ $value ] ) ? Mailtpl_Woomail_Settings::$font_family_mapping[ $value ] : $value;
+ }
+
+ // Return prepared value
+ return $value;
+ }
+
+ /**
+ * Get CSS suffix by key or all CSS suffixes
+ *
+ * @access public
+ * @param string $key
+ * @return mixed
+ */
+ public static function get_css_suffix( $key = null ) {
+ // Define CSS suffixes.
+ if ( null === self::$css_suffixes ) {
+ self::$css_suffixes = array(
+ 'email_padding' => 'px',
+ 'email_padding_bottom' => 'px',
+ 'content_padding_top' => 'px',
+ 'content_padding_bottom' => 'px',
+ 'content_padding' => 'px',
+
+ 'content_width' => 'px',
+ 'content_inner_width' => 'px',
+ 'border_width' => 'px',
+ 'border_width_right' => 'px',
+ 'border_width_bottom' => 'px',
+ 'border_width_left' => 'px',
+ 'border_radius' => 'px !important',
+
+ 'btn_border_width' => 'px',
+ 'btn_size' => 'px',
+ 'btn_left_right_padding' => 'px',
+ 'btn_top_bottom_padding' => 'px',
+ 'btn_border_radius' => 'px',
+
+ 'header_image_maxwidth' => 'px',
+ 'header_image_padding_top_bottom' => 'px',
+
+ 'header_padding_top' => 'px',
+ 'header_padding_bottom' => 'px',
+ 'header_padding_left_right' => 'px',
+ 'heading_font_size' => 'px',
+ 'heading_line_height' => 'px',
+ 'subtitle_font_size' => 'px',
+ 'subtitle_line_height' => 'px',
+
+ 'font_size' => 'px',
+ 'line_height' => 'px',
+
+ 'h2_font_size' => 'px',
+ 'h2_line_height' => 'px',
+ 'h2_separator_height' => 'px',
+ 'h2_padding_top' => 'px',
+ 'h2_margin_bottom' => 'px',
+ 'h2_padding_bottom' => 'px',
+ 'h2_margin_top' => 'px',
+ 'h3_font_size' => 'px',
+ 'h3_line_height' => 'px',
+
+ 'addresses_border_width' => 'px',
+ 'addresses_padding' => 'px',
+
+ 'footer_top_padding' => 'px',
+ 'footer_bottom_padding' => 'px',
+ 'footer_left_right_padding' => 'px',
+ 'footer_font_size' => 'px',
+ 'footer_social_title_size' => 'px',
+ 'footer_social_top_padding' => 'px',
+ 'footer_social_bottom_padding' => 'px',
+ 'footer_social_border_width' => 'px',
+
+ 'footer_credit_top_padding' => 'px',
+ 'footer_credit_bottom_padding' => 'px',
+
+ 'items_table_border_width' => 'px',
+ 'items_table_separator_width' => 'px',
+ 'items_table_padding' => 'px',
+ 'items_table_padding_left_right' => 'px',
+ );
+ }
+
+ // Return single suffix
+ if ( isset( $key ) ) {
+ return isset( self::$css_suffixes[ $key ] ) ? self::$css_suffixes[ $key ] : '';
+ }
+ // Return all suffixes for use in Javascript
+ else {
+ return self::$css_suffixes;
+ }
+ }
+
+ /**
+ * Reset to default values via Ajax request
+ *
+ * @access public
+ * @return void
+ */
+ public function ajax_send_email() {
+ // Check request
+ if ( empty( $_REQUEST['wp_customize'] ) || $_REQUEST['wp_customize'] !== 'on' || empty( $_REQUEST['action'] ) || $_REQUEST['action'] !== 'mailtpl_woomail_send_email' || empty( $_REQUEST['recipients'] ) ) {
+ exit;
+ }
+
+ // Check if user is allowed to send email
+ if ( ! Mailtpl_Woomail_Composer::is_admin() ) {
+ exit;
+ }
+
+ $recipients = wc_clean( $_REQUEST['recipients'] );
+ $content = Mailtpl_Woomail_Preview::get_preview_email( true, $recipients );
+ echo $content;
+ }
+
+
+ /**
+ * Reset to default values via Ajax request
+ *
+ * @access public
+ * @return void
+ */
+ public function ajax_reset() {
+ // Check request
+ if ( empty( $_REQUEST['wp_customize'] ) || $_REQUEST['wp_customize'] !== 'on' || empty( $_REQUEST['action'] ) || $_REQUEST['action'] !== 'mailtpl_woomail_reset' ) {
+ exit;
+ }
+
+ // Check if user is allowed to reset values
+ if ( ! Mailtpl_Woomail_Composer::is_admin() ) {
+ exit;
+ }
+ global $wp_customize;
+
+ // Reset to default values
+ self::reset( $wp_customize );
+
+ exit;
+ }
+
+ /**
+ * Reset to default values
+ *
+ * @access private
+ * @return void
+ */
+ public static function reset( $wp_customize ) {
+ update_option( 'mailtpl_woomail', array() );
+ // Load the export/import option class.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-mailtpl-woomail-import-option.php';
+ // Run through the woocommerce settings we are overriding.
+ foreach ( Mailtpl_Woomail_Settings::get_woo_settings() as $setting_key => $setting ) {
+ $option = new Mailtpl_Woomail_Import_Option(
+ $wp_customize,
+ $setting_key,
+ array(
+ 'default' => '',
+ 'type' => 'option',
+ 'capability' => Mailtpl_Woomail_Composer::get_admin_capability(),
+ )
+ );
+ if ( 'woocommerce_email_footer_text' == $setting_key ) {
+ $option->import( '{site_title}' );
+ } else if ( 'woocommerce_email_body_background_color' == $setting_key ) {
+ $option->import( '#ffffff' );
+ } else if ( 'woocommerce_email_background_color' == $setting_key ) {
+ $option->import( '#f7f7f7' );
+ } else if ( 'woocommerce_email_text_color' == $setting_key ) {
+ $option->import( '#3c3c3c' );
+ } else {
+ $option->import( '' );
+ }
+ }
+ }
+
+ /**
+ * Maybe add custom styles to default WooCommerce styles
+ *
+ * @access public
+ * @param string $styles
+ * @return string
+ */
+ public function maybe_add_custom_styles( $styles ) {
+ // Check if custom styles need to be applied.
+ if ( Mailtpl_Woomail_Composer::overwrite_options() ) {
+
+ // Add custom styles.
+ $styles .= self::get_styles_string();
+
+ // Static styles.
+ $styles .= self::get_static_styles();
+
+ } else if ( Mailtpl_Woomail_Composer::is_own_preview_request() ) {
+ // Otherwise apply some fixes for Customizer Preview.
+ $styles .= 'body { background-color: ' . get_option( 'woocommerce_email_background_color' ) . '; }';
+ $styles .= self::get_static_styles();
+ }
+
+ // Return styles.
+ return $styles;
+ }
+
+ /**
+ * Get static styles
+ *
+ * @access public
+ * @return string
+ */
+ public static function get_static_styles() {
+ return '.order-items-light table.td .td {
+ border: 0;
+}
+.order-items-light table.td {
+ border: 0;
+}
+.order-items-light tr th.td {
+ font-weight:bold;
+}
+.order-items-light tr .td {
+ text-align:center !important;
+}
+.order-items-light tr .td:first-child, .order-items-light .order-info-split-table td:first-child {
+ padding-' . ( is_rtl() ? 'right' : 'left' ) . ': 0 !important;
+ text-align: ' . ( is_rtl() ? 'right' : 'left' ) . ' !important;
+}
+.order-items-light tr .td:last-child, .order-items-light .order-info-split-table td:last-child{
+ padding-' . ( is_rtl() ? 'left' : 'right' ) . ': 0 !important;
+ text-align:' . ( is_rtl() ? 'left' : 'right' ) . ' !important;
+}
+.title-style-behind #template_container h2 {
+ border-top:0 !important;
+ border-bottom:0 !important;
+}
+.title-style-above #template_container h2 {
+ border-bottom:0 !important;
+}
+.title-style-below #template_container h2 {
+ border-top:0 !important;
+}';
+ }
+
+ }
+
+ Mailtpl_Woomail_Customizer::get_instance();
+
+}
diff --git a/includes/class-mailtpl-woomail-import-export.php b/includes/class-mailtpl-woomail-import-export.php
new file mode 100644
index 0000000..96b16f5
--- /dev/null
+++ b/includes/class-mailtpl-woomail-import-export.php
@@ -0,0 +1,362 @@
+ $template,
+ 'options' => array()
+ );
+
+ // Get options from the Customizer API.
+ $settings = $wp_customize->settings();
+
+ foreach ( $settings as $key => $setting ) {
+ if ( stristr( $key, 'mailtpl_woomail' ) || in_array( $key, self::$woo_core_options ) ) {
+ // to prevent issues we don't want to export the order id.
+ if( $key != 'mailtpl_woomail[preview_order_id]' ) {
+ $data['options'][ $key ] = $setting->value();
+ }
+ }
+ }
+
+
+ // Set the download headers.
+ header( 'Content-disposition: attachment; filename=mailtpl-woomail-Composer-export.dat' );
+ header( 'Content-Type: application/octet-stream; charset=' . $charset );
+
+ // Serialize the export data.
+ echo base64_encode( serialize( $data ) );
+
+ // Start the download.
+ die();
+ }
+ /**
+ * Imports uploaded Mailtpl woo email settings
+ *
+ * @access private
+ * @param object $wp_customize An instance of WP_Customize_Manager.
+ * @return void
+ */
+ static private function import_woomail( $wp_customize ) {
+ // Make sure we have a valid nonce.
+ if ( ! wp_verify_nonce( $_REQUEST['mailtpl-woomail-import'], 'mailtpl-woomail-importing' ) ) {
+ return;
+ }
+ // Make sure WordPress upload support is loaded.
+ if ( ! function_exists( 'wp_handle_upload' ) ) {
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
+ }
+
+ // Load the export/import option class.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-mailtpl-woomail-import-option.php';
+
+ // Setup global vars.
+ global $wp_customize;
+ global $mailtpl_woomail_import_error;
+
+ // Setup internal vars.
+ $mailtpl_woomail_import_error = false;
+ $template = 'mailtpl-woomail-Composer';
+ $overrides = array( 'test_form' => false, 'test_type' => false, 'mimes' => array('dat' => 'text/plain') );
+ $file = wp_handle_upload( $_FILES['mailtpl-woomail-import-file'], $overrides );
+
+ // Make sure we have an uploaded file.
+ if ( isset( $file['error'] ) ) {
+ $mailtpl_woomail_import_error = $file['error'];
+ return;
+ }
+ if ( ! file_exists( $file['file'] ) ) {
+ $mailtpl_woomail_import_error = __( 'Error importing settings! Please try again.', 'mailtpl-woocommerce-email-composer' );
+ return;
+ }
+
+ // Get the upload data.
+ $raw = file_get_contents( $file['file'] );
+ //$data = @unserialize( $raw );
+ // $data = self::mb_unserialize( $raw );
+ $data = unserialize( base64_decode( $raw ) );
+ if ( 'array' != gettype( $data ) || ! isset( $data['template'] ) ) {
+ $data = self::mb_unserialize( $raw );
+ }
+ // Remove the uploaded file.
+ unlink( $file['file'] );
+
+ // Data checks.
+ if ( 'array' != gettype( $data ) ) {
+ $mailtpl_woomail_import_error = __( 'Error importing settings! Please check that you uploaded an email customizer export file.', 'mailtpl-woocommerce-email-composer' );
+ return;
+ }
+ if ( ! isset( $data['template'] ) ) {
+ $mailtpl_woomail_import_error = __( 'Error importing settings! Please check that you uploaded an email customizer export file.', 'mailtpl-woocommerce-email-composer' );
+ return;
+ }
+ if ( $data['template'] != $template ) {
+ $mailtpl_woomail_import_error = __( 'Error importing settings! The settings you uploaded are not for the Mailtpl Woomail Composer.', 'mailtpl-woocommerce-email-composer' );
+ return;
+ }
+
+ // Import custom options.
+ if ( isset( $data['options'] ) ) {
+
+ foreach ( $data['options'] as $option_key => $option_value ) {
+
+ $option = new Mailtpl_Woomail_Import_Option( $wp_customize, $option_key, array(
+ 'default' => '',
+ 'type' => 'option',
+ 'capability' => Mailtpl_Woomail_Composer::get_admin_capability(),
+ ) );
+
+ $option->import( $option_value );
+ }
+ }
+
+
+ // Call the customize_save action.
+ do_action( 'customize_save', $wp_customize );
+
+ // Call the customize_save_after action.
+ do_action( 'customize_save_after', $wp_customize );
+
+ wp_redirect( Mailtpl_Woomail_Customizer::get_customizer_url() );
+
+ exit;
+ }
+ /**
+ * Mulit-byte Unserialize
+ *
+ * UTF-8 will screw up a serialized string
+ *
+ * @access private
+ * @param string
+ * @return string
+ */
+ static private function mb_unserialize( $string ) {
+ $string2 = preg_replace_callback(
+ '!s:(\d+):"(.*?)";!s',
+ function( $m ){
+ $len = strlen($m[2]);
+ $result = "s:$len:\"{$m[2]}\";";
+ return $result;
+
+ },
+ $string );
+ return @unserialize( $string2 );
+ }
+
+ /**
+ * Imports prebuilt Mailtpl woo email settings
+ *
+ * @access private
+ * @param object $wp_customize An instance of WP_Customize_Manager.
+ * @return void
+ */
+ static private function import_woomail_template( $wp_customize ) {
+ // Make sure we have a valid nonce.
+ if ( ! wp_verify_nonce( $_REQUEST['mailtpl-woomail-import-template'], 'mailtpl-woomail-importing-template' ) ) {
+ return;
+ }
+ // Load the export/import option class.
+ require_once MAILTPL_WOOMAIL_PATH . 'includes/class-mailtpl-woomail-import-option.php';
+
+ // Setup global vars.
+ global $wp_customize;
+ global $mailtpl_woomail_import_error;
+
+ // Setup internal vars.
+ $mailtpl_woomail_import_error = false;
+ $template = 'mailtpl-woomail-Composer';
+ $prebuilt = $_REQUEST['mailtpl-woomail-prebuilt-template'];
+ $raw_data = self::prebuilt( $prebuilt );
+
+ $data = @unserialize( $raw_data );
+
+
+ // Data checks.
+ if ( 'array' != gettype( $data ) ) {
+ $mailtpl_woomail_import_error = __( 'Error importing settings! The template you selected is not found.', 'mailtpl-woocommerce-email-composer' );
+ return;
+ }
+ if ( ! isset( $data['template'] ) ) {
+ $mailtpl_woomail_import_error = __( 'Error importing settings! The template you selected is not valid.', 'mailtpl-woocommerce-email-composer' );
+ return;
+ }
+ if ( $data['template'] != $template ) {
+ $mailtpl_woomail_import_error = __( 'Error importing settings! The template you selected is not valid.', 'mailtpl-woocommerce-email-composer' );
+ return;
+ }
+
+
+ // Import custom options.
+ if ( isset( $data['options'] ) ) {
+
+ foreach ( $data['options'] as $option_key => $option_value ) {
+
+ $option = new Mailtpl_Woomail_Import_Option( $wp_customize, $option_key, array(
+ 'default' => '',
+ 'type' => 'option',
+ 'capability' => Mailtpl_Woomail_Composer::get_admin_capability(),
+ ) );
+
+ $option->import( $option_value );
+ }
+ }
+
+
+ // Call the customize_save action.
+ do_action( 'customize_save', $wp_customize );
+
+ // Call the customize_save_after action.
+ //do_action( 'customize_save_after', $wp_customize );
+
+ wp_redirect( Mailtpl_Woomail_Customizer::get_customizer_url() );
+
+ exit;
+ }
+ /**
+ * Prints error scripts for the control.
+ *
+ * @since 0.1
+ * @return void
+ */
+ static public function controls_print_scripts() {
+ global $mailtpl_woomail_import_error;
+
+ if ( $mailtpl_woomail_import_error ) {
+ echo '';
+ }
+ }
+ /**
+ * Get value for prebuilt
+ *
+ * @access public
+ * @param string $key
+ * @return string
+ */
+ public static function prebuilt( $key ) {
+ if ( isset( self::$prebuilt_options[$key] ) ) {
+ $data = self::$prebuilt_options[$key];
+ } else {
+ $data = null;
+ }
+
+ // Allow developers to override with there templates
+ return apply_filters( 'mailtpl_woomail_template_data', $data, $key );
+ }
+ }
+ Mailtpl_Woomail_Import_Export::get_instance();
+}
\ No newline at end of file
diff --git a/includes/class-mailtpl-woomail-import-option.php b/includes/class-mailtpl-woomail-import-option.php
new file mode 100644
index 0000000..3242940
--- /dev/null
+++ b/includes/class-mailtpl-woomail-import-option.php
@@ -0,0 +1,24 @@
+update( $value );
+ }
+}
\ No newline at end of file
diff --git a/includes/class-mailtpl-woomail-preview.php b/includes/class-mailtpl-woomail-preview.php
new file mode 100644
index 0000000..82b9ccc
--- /dev/null
+++ b/includes/class-mailtpl-woomail-preview.php
@@ -0,0 +1,1101 @@
+ 'WC_Email_New_Order',
+ 'cancelled_order' => 'WC_Email_Cancelled_Order',
+ 'customer_processing_order' => 'WC_Email_Customer_Processing_Order',
+ 'customer_completed_order' => 'WC_Email_Customer_Completed_Order',
+ 'customer_refunded_order' => 'WC_Email_Customer_Refunded_Order',
+ 'customer_on_hold_order' => 'WC_Email_Customer_On_Hold_Order',
+ 'customer_invoice' => 'WC_Email_Customer_Invoice',
+ 'failed_order' => 'WC_Email_Failed_Order',
+ 'customer_new_account' => 'WC_Email_Customer_New_Account',
+ 'customer_note' => 'WC_Email_Customer_Note',
+ 'customer_reset_password' => 'WC_Email_Customer_Reset_Password',
+ // WooCommerce Subscriptions Plugin.
+ 'new_renewal_order' => 'WCS_Email_New_Renewal_Order',
+ 'customer_processing_renewal_order' => 'WCS_Email_Processing_Renewal_Order',
+ 'customer_completed_renewal_order' => 'WCS_Email_Completed_Renewal_Order',
+ 'customer_completed_switch_order' => 'WCS_Email_Completed_Switch_Order',
+ 'customer_renewal_invoice' => 'WCS_Email_Customer_Renewal_Invoice',
+ 'customer_payment_retry' => 'WCS_Email_Customer_Payment_Retry',
+ 'admin_payment_retry' => 'WCS_Email_Payment_Retry',
+ 'cancelled_subscription' => 'WCS_Email_Cancelled_Subscription',
+ // Woocommerce Memberships.
+ 'WC_Memberships_User_Membership_Note_Email' => 'WC_Memberships_User_Membership_Note_Email',
+ 'WC_Memberships_User_Membership_Ending_Soon_Email' => 'WC_Memberships_User_Membership_Ending_Soon_Email',
+ 'WC_Memberships_User_Membership_Ended_Email' => 'WC_Memberships_User_Membership_Ended_Email',
+ 'WC_Memberships_User_Membership_Renewal_Reminder_Email' => 'WC_Memberships_User_Membership_Renewal_Reminder_Email',
+ 'WC_Memberships_User_Membership_Activated_Email' => 'WC_Memberships_User_Membership_Activated_Email',
+ // Waitlist Plugin.
+ 'woocommerce_waitlist_mailout' => 'Pie_WCWL_Waitlist_Mailout',
+ // WC Marketplace.
+ 'vendor_new_account' => 'WC_Email_Vendor_New_Account',
+ 'admin_new_vendor' => 'WC_Email_Admin_New_Vendor_Account',
+ 'approved_vendor_new_account' => 'WC_Email_Approved_New_Vendor_Account',
+ 'rejected_vendor_new_account' => 'WC_Email_Rejected_New_Vendor_Account',
+ 'vendor_new_order' => 'WC_Email_Vendor_New_Order',
+ 'notify_shipped' => 'WC_Email_Notify_Shipped',
+ 'admin_new_vendor_product' => 'WC_Email_Vendor_New_Product_Added',
+ 'admin_added_new_product_to_vendor' => 'WC_Email_Admin_Added_New_Product_to_Vendor',
+ 'vendor_commissions_transaction' => 'WC_Email_Vendor_Commission_Transactions',
+ 'vendor_direct_bank' => 'WC_Email_Vendor_Direct_Bank',
+ 'admin_widthdrawal_request' => 'WC_Email_Admin_Widthdrawal_Request',
+ 'vendor_orders_stats_report' => 'WC_Email_Vendor_Orders_Stats_Report',
+ 'vendor_contact_widget_email' => 'WC_Email_Vendor_Contact_Widget',
+ // Germanized Emails.
+ 'customer_ekomi' => 'WC_GZD_Email_Customer_Ekomi',
+ 'customer_new_account_activation' => 'WC_GZD_Email_Customer_New_Account_Activation',
+ 'customer_paid_for_order' => 'WC_GZD_Email_Customer_Paid_For_Order',
+ 'customer_revocation' => 'WC_GZD_Email_Customer_Revocation',
+ 'customer_sepa_direct_debit_mandate' => 'WC_GZD_Email_Customer_SEPA_Direct_Debit_Mandate',
+ 'customer_trusted_shops' => 'WC_GZD_Email_Customer_Trusted_Shops',
+ // stripe Emails
+ 'failed_preorder_sca_authentication' => 'WC_Stripe_Email_Failed_Preorder_Authentication',
+ 'failed_renewal_authentication' => 'WC_Stripe_Email_Failed_Renewal_Authentication',
+ 'failed_authentication_requested' => 'WC_Stripe_Email_Failed_Authentication_Retry',
+ 'cartflows_ca_email_templates' => 'KWED_Cartflows_CA_Email',
+ // Subscriptio Email Types.
+ // 'customer_subscription_new_order' => 'Subscriptio_Email_Customer_Subscription_New_Order',
+ // 'customer_subscription_processing_order' => 'Subscriptio_Email_Customer_Subscription_Processing_Order',
+ // 'customer_subscription_completed_order' => 'Subscriptio_Email_Customer_Subscription_Completed_Order',
+ // 'customer_subscription_paused' => 'Subscriptio_Email_Customer_Subscription_Paused',
+ // 'customer_subscription_resumed' => 'Subscriptio_Email_Customer_Subscription_Resumed',
+ // 'customer_subscription_suspended' => 'Subscriptio_Email_Customer_Subscription_Suspended',
+ // 'customer_subscription_payment_overdue' => 'Subscriptio_Email_Customer_Subscription_Payment_Overdue',
+ // 'customer_subscription_payment_reminder' => 'Subscriptio_Email_Customer_Subscription_Payment_Reminder',
+ // 'customer_subscription_expired' => 'Subscriptio_Email_Customer_Subscription_Expired',
+ // 'customer_subscription_cancelled' => 'Subscriptio_Email_Customer_Subscription_Cancelled',
+ );
+ public static $email_types_order_status = array(
+ 'new_order' => 'processing',
+ 'cancelled_order' => 'cancelled',
+ 'customer_processing_order' => 'processing',
+ 'customer_completed_order' => 'completed',
+ 'customer_refunded_order' => 'refunded',
+ 'customer_on_hold_order' => 'on-hold',
+ 'customer_invoice' => 'processing',
+ 'failed_order' => 'failed',
+ 'customer_new_account' => null,
+ 'customer_note' => 'processing',
+ 'customer_reset_password' => null,
+ // WooCommerce Subscriptions Plugin.
+ 'new_renewal_order' => 'processing',
+ 'customer_processing_renewal_order' => 'processing',
+ 'customer_completed_renewal_order' => 'completed',
+ 'customer_completed_switch_order' => 'completed',
+ 'customer_renewal_invoice' => 'failed',
+ 'customer_payment_retry' => 'pending',
+ 'admin_payment_retry' => 'pending',
+ 'cancelled_subscription' => 'cancelled',
+ // Woocommerce Memberships.
+ 'WC_Memberships_User_Membership_Note_Email' => 'completed',
+ 'WC_Memberships_User_Membership_Ending_Soon_Email' => 'completed',
+ 'WC_Memberships_User_Membership_Ended_Email' => 'on-hold',
+ 'WC_Memberships_User_Membership_Renewal_Reminder_Email' => 'completed',
+ 'WC_Memberships_User_Membership_Activated_Email' => 'completed',
+ // Waitlist Plugin
+ 'woocommerce_waitlist_mailout' => null,
+ // WC Marketplace
+ 'vendor_new_account' => null,
+ 'admin_new_vendor' => null,
+ 'approved_vendor_new_account' => null,
+ 'rejected_vendor_new_account' => null,
+ 'vendor_new_order' => 'processing',
+ 'notify_shipped' => 'completed',
+ 'admin_new_vendor_product' => null,
+ 'admin_added_new_product_to_vendor' => null,
+ 'vendor_commissions_transaction' => null,
+ 'vendor_direct_bank' => null,
+ 'admin_widthdrawal_request' => null,
+ 'vendor_orders_stats_report' => null,
+ 'vendor_contact_widget_email' => null,
+ // Woo Advanced Shipment Tracking
+ 'customer_delivered_order' => 'completed',
+ // Germanized Emails.
+ 'customer_ekomi' => 'completed',
+ 'customer_new_account_activation' => null,
+ 'customer_paid_for_order' => 'completed',
+ 'customer_revocation' => null,
+ 'customer_sepa_direct_debit_mandate' => 'completed',
+ 'customer_trusted_shops' => 'completed',
+ // Stripe
+ 'failed_preorder_sca_authentication' => 'failed',
+ 'failed_renewal_authentication' => 'failed',
+ 'failed_authentication_requested' => 'failed',
+ // Subscriptio Email Types
+ // 'customer_subscription_new_order' => 'processing',
+ // 'customer_subscription_processing_order' => 'processing',
+ // 'customer_subscription_completed_order' => 'completed',
+ // 'customer_subscription_paused' => 'on-hold',
+ // 'customer_subscription_resumed' => 'completed',
+ // 'customer_subscription_suspended' => 'on-hold',
+ // 'customer_subscription_payment_overdue' => 'on-hold',
+ // 'customer_subscription_payment_reminder' => 'completed',
+ // 'customer_subscription_expired' => 'failed',
+ // 'customer_subscription_cancelled' => 'cancelled',
+ );
+ /**
+ * @var null
+ */
+ private static $instance = null;
+
+ /**
+ * Instance Control
+ */
+ public static function get_instance() {
+ if ( is_null( self::$instance ) ) {
+ self::$instance = new self();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Class constructor
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct() {
+ // Set up preview.
+ add_action( 'parse_request', array( $this, 'set_up_preview' ) );
+ }
+
+ /**
+ * Set up preview
+ *
+ * @access public
+ * @return void
+ */
+ public function set_up_preview() {
+ // Make sure this is own preview request.
+ if ( ! Mailtpl_Woomail_Composer::is_own_preview_request() ) {
+ return;
+ }
+ // Load main view.
+ include MAILTPL_WOOMAIL_PATH . 'preview.php';
+
+ // Do not load any further elements.
+ exit;
+ }
+
+ /**
+ * Get the email order status
+ *
+ * @param string $email_template the template string name.
+ */
+ public static function get_email_order_status( $email_template ) {
+ $order_status = apply_filters( 'mailtpl_woomail_email_type_order_status_array', self::$email_types_order_status );
+ if ( isset( $order_status[ $email_template ] ) ) {
+ return $order_status[ $email_template ];
+ } else {
+ return 'processing';
+ }
+ }
+ /**
+ * Get the email class name
+ *
+ * @param string $email_template the email template slug.
+ */
+ public static function get_email_class_name( $email_template ) {
+ $class_names = apply_filters( 'mailtpl_woomail_email_type_class_name_array', self::$email_types_class_names );
+ // if ( class_exists( 'WC_GZDP_Email_Customer_Invoice_Simple' ) ) {
+ // $class_names['customer_invoice'] = 'WC_GZDP_Email_Customer_Invoice_Simple';
+ // }
+ if ( isset( $class_names[ $email_template ] ) ) {
+ return $class_names[ $email_template ];
+ } else {
+ return false;
+ }
+ }
+ /**
+ * Get the email content
+ *
+ */
+ public static function get_preview_email( $send_email = false, $email_addresses = null ) {
+ // Load WooCommerce emails.
+
+ $wc_emails = WC_Emails::instance();
+
+ $emails = $wc_emails->get_emails();
+ $email_template = Mailtpl_Woomail_Customizer::opt( 'email_type' );
+ $preview_id = Mailtpl_Woomail_Customizer::opt( 'preview_order_id' );
+
+ if ( strlen( $email_template ) > 29 && 'cartflows_ca_email_templates_' === substr( $email_template, 29 ) ) {
+ $email_template = 'cartflows_ca_email_templates';
+ }
+ $email_type = self::get_email_class_name( $email_template );
+ if ( false === $email_type ) {
+ return false;
+ }
+ $order_status = self::get_email_order_status( $email_template );
+ //$order_status = self::$email_types_order_status[$email_template];
+
+ if ( 'customer_invoice' == $email_template ) {
+ $invoice_paid = Mailtpl_Woomail_Customizer::opt( 'customer_invoice_switch' );
+ if ( ! $invoice_paid ) {
+ $order_status = 'pending';
+ }
+ }
+ if ( 'customer_refunded_order' == $email_template ) {
+ $partial_preview = Mailtpl_Woomail_Customizer::opt( 'customer_refunded_order_switch' );
+ if ( ! $partial_preview ) {
+ $partial_status = true;
+ } else {
+ $partial_status = false;
+ }
+ }
+ // Reference email.
+ if ( isset( $emails[ $email_type ] ) && is_object( $emails[ $email_type ] ) ) {
+ $email = $emails[ $email_type ];
+ };
+
+ // Get an order
+ $order = self::get_wc_order_for_preview( $order_status, $preview_id );
+ self::$current_order = $order;
+
+ if ( is_object( $order ) ) {
+ // Get user ID from order, if guest get current user ID.
+ if ( 0 === ( $user_id = (int) get_post_meta( $order->get_id(), '_customer_user', true ) ) ) {
+ $user_id = get_current_user_id();
+ }
+ } else {
+ $user_id = get_current_user_id();
+ }
+ // Get user object
+ $user = get_user_by( 'id', $user_id );
+ self::$current_product_title = 'Product Title Example';
+ if ( 'woocommerce_waitlist_mailout' == $email_template ) {
+
+ $product_id = -1;
+ if ( is_object( $order ) ) {
+ $items = $order->get_items();
+ foreach ( $items as $item ) {
+ $product_id = $item['product_id'];
+ if ( null !== get_post( $product_id ) ) {
+ break;
+ }
+ }
+ }
+
+ if ( null === get_post( $product_id ) ) {
+
+ $args = array(
+ 'posts_per_page' => 1,
+ 'orderby' => 'date',
+ 'post_type' => 'product',
+ 'post_status' => 'publish',
+ );
+ $products_array = get_posts( $args );
+
+ if ( isset( $products_array[0]->ID ) ) {
+ $product_id = $products_array[0]->ID;
+ }
+ }
+ }
+ if ( isset( $email ) ) {
+ // Make sure gateways are running in case the email needs to input content from them.
+ WC()->payment_gateways();
+ // Make sure shipping is running in case the email needs to input content from it.
+ WC()->shipping();
+ switch ( $email_template ) {
+ /**
+ * WooCommerce (default transactional mails).
+ */
+ case 'new_order':
+ case 'cancelled_order':
+ case 'customer_processing_order':
+ case 'customer_completed_order':
+ case 'customer_on_hold_order':
+ case 'failed_renewal_authentication':
+ case 'failed_preorder_sca_authentication':
+ case 'failed_order':
+ $email->object = $order;
+ if ( is_object( $order ) ) {
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties
+ $email->recipient = $email->object->get_billing_email();
+ }
+ break;
+ case 'customer_invoice':
+ $email->object = $order;
+ if ( is_object( $order ) ) {
+ $email->invoice = ( function_exists( 'wc_gzdp_get_order_last_invoice' ) ? wc_gzdp_get_order_last_invoice( $order ) : null );
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties
+ $email->recipient = $email->object->get_billing_email();
+ }
+ break;
+ case 'customer_refunded_order':
+ $email->object = $order;
+ $email->partial_refund = $partial_status;
+ if ( is_object( $order ) ) {
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties
+ $email->recipient = $email->object->get_billing_email();
+ }
+ break;
+ case 'customer_new_account':
+ $email->object = $user;
+ $email->user_pass = '{user_pass}';
+ $email->user_login = stripslashes( $email->object->user_login );
+ $email->user_email = stripslashes( $email->object->user_email );
+ $email->recipient = $email->user_email;
+ $email->password_generated = true;
+ break;
+ case 'customer_note':
+ $email->object = $order;
+ $email->customer_note = __( 'Hello! This is an example note', 'mailtpl-woocommerce-email-composer' );
+ if ( is_object( $order ) ) {
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties
+ $email->recipient = $email->object->get_billing_email();
+ }
+ break;
+ case 'customer_reset_password':
+ $email->object = $user;
+ $email->user_id = $user_id;
+ $email->user_login = $user->user_login;
+ $email->user_email = stripslashes( $email->object->user_email );
+ $email->reset_key = '{{reset-key}}';
+ $email->recipient = stripslashes( $email->object->user_email );
+ break;
+ /**
+ * Woo Advanced Shipment Tracking.
+ */
+ case 'customer_delivered_order':
+ $email->object = $order;
+ if ( is_object( $order ) ) {
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties
+ $email->recipient = $email->object->get_billing_email();
+ }
+ break;
+ /**
+ * WooCommerce Subscriptions Plugin (from WooCommerce).
+ */
+ case 'new_renewal_order':
+ case 'new_switch_order':
+ case 'customer_processing_renewal_order':
+ case 'customer_completed_renewal_order':
+ case 'customer_renewal_invoice':
+ $email->object = $order;
+ if ( is_object( $order ) ) {
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties
+ $email->recipient = $email->object->get_billing_email();
+ }
+ break;
+ case 'customer_completed_switch_order':
+ $email->object = $order;
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties
+ $email->recipient = $email->object->get_billing_email();
+ $subscriptions = false;
+ if ( ! empty( $preview_id ) && 'mockup' != $preview_id ) {
+ if ( function_exists( 'wcs_get_subscriptions_for_switch_order' ) ) {
+ $subscriptions = wcs_get_subscriptions_for_switch_order( $preview_id );
+ }
+ }
+ if ( $subscriptions ) {
+ $email->subscriptions = $subscriptions;
+ } else {
+ $email->subscriptions = array();
+ }
+ break;
+ case 'cancelled_subscription':
+ $subscription = false;
+ if ( ! empty( $preview_id ) && 'mockup' != $preview_id ) {
+ if ( function_exists( 'wcs_get_subscriptions_for_order' ) ) {
+ $subscriptions_ids = wcs_get_subscriptions_for_order( $preview_id );
+ // We get the related subscription for this order.
+ if ( $subscriptions_ids ) {
+ foreach ( $subscriptions_ids as $subscription_id => $subscription_obj ) {
+ if ( $subscription_obj->order->id == $preview_id ) {
+ $subscription = $subscription_obj;
+ break; // Stop the loop).
+ }
+ }
+ }
+ }
+ }
+ if ( $subscription ) {
+ $email->object = $subscription;
+ } else {
+ $email->object = 'subscription';
+ }
+ break;
+ case 'customer_payment_retry':
+ $email->object = $order;
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties.
+ $email->recipient = $email->object->get_billing_email();
+ if ( ! empty( $preview_id ) && 'mockup' != $preview_id ) {
+ if ( WCS_Retry_Manager::is_retry_enabled() ) {
+ $retry = WCS_Retry_Manager::store()->get_last_retry_for_order( $preview_id );
+ if ( ! empty( $retry ) && is_object( $retry ) ) {
+ $email->retry = $retry;
+ $email->find['retry_time'] = '{retry_time}';
+ $email->replace['retry_time'] = wcs_get_human_time_diff( $email->retry->get_time() );
+ } else {
+ $email->object = 'retry';
+ }
+ } else {
+ $email->object = 'retry';
+ }
+ } else {
+ $email->object = 'retry';
+ }
+ break;
+ case 'admin_payment_retry':
+ $email->object = $order;
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties.
+ if ( ! empty( $preview_id ) && 'mockup' != $preview_id ) {
+ if ( WCS_Retry_Manager::is_retry_enabled() ) {
+ $retry = WCS_Retry_Manager::store()->get_last_retry_for_order( $preview_id );
+ if ( ! empty( $retry ) && is_object( $retry ) ) {
+ $email->retry = $retry;
+ $email->find['retry_time'] = '{retry_time}';
+ $email->replace['retry_time'] = wcs_get_human_time_diff( $email->retry->get_time() );
+ } else {
+ $email->object = 'retry';
+ }
+ } else {
+ $email->object = 'retry';
+ }
+ } else {
+ $email->object = 'retry';
+ }
+ break;
+ /**
+ * WooCommerce Membership.
+ */
+ case 'WC_Memberships_User_Membership_Note_Email':
+ case 'WC_Memberships_User_Membership_Ending_Soon_Email':
+ case 'WC_Memberships_User_Membership_Ended_Email':
+ case 'WC_Memberships_User_Membership_Renewal_Reminder_Email':
+ case 'WC_Memberships_User_Membership_Activated_Email':
+ if ( function_exists( 'wc_memberships_get_user_membership' ) ) {
+ $memberships = wc_memberships_get_user_active_memberships( $user_id );
+
+ if ( ! empty( $memberships ) ) {
+ $user_membership = $memberships[0];
+ self::$current_member = $user_membership;
+ $email->object = $user_membership;
+ $email_id = strtolower( $email_template );
+ $email_body = $email->object->get_plan()->get_email_content( $email_template );
+ $member_body = (string) apply_filters( "{$email_id}_email_body", $email->format_string( $email_body ), $email->object );
+
+ if ( empty( $member_body ) || ! is_string( $member_body ) || '' === trim( $member_body ) ) {
+ $member_body = $email->get_default_body();
+ }
+
+ // convert relative URLs to absolute for links href and images src attributes
+ $domain = get_home_url();
+ $replace = array();
+ $replace['/href="(?!https?:\/\/)(?!data:)(?!#)/'] = 'href="' . $domain;
+ $replace['/src="(?!https?:\/\/)(?!data:)(?!#)/'] = 'src="' . $domain;
+
+ $member_body = preg_replace( array_keys( $replace ), array_values( $replace ), $member_body );
+
+ $membership_plan = $user_membership->get_plan();
+
+ // get member data
+ $member = get_user_by( 'id', $user_membership->get_user_id() );
+ $member_name = ! empty( $member->display_name ) ? $member->display_name : '';
+ $member_first_name = ! empty( $member->first_name ) ? $member->first_name : $member_name;
+ $member_last_name = ! empty( $member->last_name ) ? $member->last_name : '';
+ $member_full_name = $member_first_name && $member_last_name ? $member_first_name . ' ' . $member->last_name : $member_name;
+
+ // membership expiry date
+ $expiration_date_timestamp = $user_membership->get_local_end_date( 'timestamp' );
+
+ // placeholders
+ $email_merge_tags = array(
+ 'member_name' => $member_name,
+ 'member_first_name' => $member_first_name,
+ 'member_last_name' => $member_last_name,
+ 'member_full_name' => $member_full_name,
+ 'membership_plan' => $membership_plan ? $membership_plan->get_name() : '',
+ 'membership_expiration_date' => date_i18n( wc_date_format(), $expiration_date_timestamp ),
+ 'membership_expiry_time_diff' => human_time_diff( current_time( 'timestamp', true ), $expiration_date_timestamp ),
+ 'membership_view_url' => esc_url( $user_membership->get_view_membership_url() ),
+ 'membership_renewal_url' => esc_url( $user_membership->get_renew_membership_url() ),
+ );
+ foreach ( $email_merge_tags as $find => $replace ) {
+ $email->find[$find] = '{' . $find . '}';
+ $email->replace[$find] = $replace;
+ $member_body = str_replace( '{' . $find . '}', $replace, $member_body );
+ }
+ } else {
+ $email->object = 'member';
+ }
+ } else {
+ $email->object = false;
+ }
+ break;
+ /**
+ * WC MarketPlace
+ */
+ case 'vendor_new_order':
+ if ( is_object( $order ) ) {
+ $order_id = $order->get_id();
+ if ( function_exists( 'get_vendor_from_an_order' ) ) {
+ if ( 1 === $order_id ) {
+ $email->object = 'vendor';
+ } else {
+ $vendors = get_vendor_from_an_order( $order_id );
+
+ if ( $vendors ) {
+ $vendor = $vendors[0];
+
+ $vendor_obj = get_wcmp_vendor_by_term( $vendor );
+ $vendor_email = $vendor_obj->user_data->user_email;
+ $vendor_id = $vendor_obj->id;
+
+ if ( $order_id && $vendor_email ) {
+ $email->object = $email->order = $order;
+ $email->find[] = '{order_date}';
+ $email->replace[] = wc_format_datetime( $email->object->get_date_created() );
+
+ $email->find[] = '{order_number}';
+ $email->replace[] = $email->object->get_order_number();
+ $email->vendor_email = $vendor_email;
+ $email->vendor_id = $vendor_id;
+ $email->recipient = $vendor_email;
+ }
+ } else {
+ $email->object = 'vendor';
+ }
+ }
+ } else {
+ $email->object = false;
+ }
+ } else {
+ $email->object = false;
+ }
+ break;
+ // /**
+ // * Subscriptio
+ // */
+ // case 'customer_subscription_new_order':
+ // case 'customer_subscription_processing_order':
+ // case 'customer_subscription_completed_order':
+ // case 'customer_subscription_paused':
+ // case 'customer_subscription_resumed':
+ // case 'customer_subscription_suspended':
+ // case 'customer_subscription_payment_overdue':
+ // case 'customer_subscription_payment_reminder':
+ // case 'customer_subscription_expired':
+ // case 'customer_subscription_cancelled':
+ // $email->object = $order;
+ // $email->find['order-date'] = '{order_date}';
+ // $email->find['order-number'] = '{order_number}';
+ // $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ // $email->replace['order-number'] = $email->object->get_order_number();
+ // // Other properties.
+ // $email->recipient = $email->object->get_billing_email();
+ // break;
+ /**
+ * WooCommerce Wait-list Plugin (from WooCommerce).
+ */
+ case 'woocommerce_waitlist_mailout':
+ $email->object = wc_get_product( $product_id );
+ $email->find[] = '{product_title}';
+ $email->replace[] = $email->object->get_title();
+ self::$current_product_title = $email->object->get_title();
+ break;
+ case 'failed_authentication_requested':
+ $email->object = $order;
+ $email->find['order-date'] = '{order_date}';
+ $email->find['order-number'] = '{order_number}';
+ if ( is_object( $order ) ) {
+ $email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
+ $email->replace['order-number'] = $email->object->get_order_number();
+ // Other properties
+ $email->recipient = $email->object->get_billing_email();
+ }
+ if ( ! empty( $preview_id ) && 'mockup' != $preview_id ) {
+ if ( class_exists( 'WCS_Retry_Manager' ) && WCS_Retry_Manager::is_retry_enabled() ) {
+ $retry = WCS_Retry_Manager::store()->get_last_retry_for_order( $preview_id );
+ if ( ! empty( $retry ) && is_object( $retry ) ) {
+ $email->retry = $retry;
+ $email->find['retry_time'] = '{retry_time}';
+ $email->replace['retry_time'] = wcs_get_human_time_diff( $email->retry->get_time() );
+ } else {
+ $email->object = 'retry';
+ }
+ } else {
+ $email->object = 'retry';
+ }
+ } else {
+ $email->object = 'retry';
+ }
+ break;
+ /**
+ * Everything else.
+ */
+ default:
+ $email->object = $order;
+ // Allow unnamed emails preview to be filtered by plugin
+ $email = apply_filters( 'Mailtpl_Woomail_Preview_email_object', $email );
+ break;
+ }
+
+ if ( true === $send_email && ! empty( $email_addresses ) ) {
+
+ self::$current_recipients = $email_addresses;
+
+ add_filter( 'woocommerce_email_recipient_' . $email->id, array( 'Mailtpl_Woomail_Preview', 'change_recipient' ), 99 );
+ $email->setup_locale();
+
+ if ( $email->get_recipient() ) {
+ $content = $email->send( $email->get_recipient(), $email->get_subject(), $email->get_content(), $email->get_headers(), $email->get_attachments() );
+ }
+ $email->restore_locale();
+
+ remove_filter( 'woocommerce_email_recipient_' . $email->id, array( 'Mailtpl_Woomail_Preview', 'change_recipient' ), 99 );
+
+ } else {
+ if ( false == $email->object ) {
+ $content = '' . __( 'This email type can not be previewed please try a different order or email type.', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else if ( 'subscription' == $email->object ) {
+ $content = '' . __( 'This email type requires that an order containing a subscription be selected as the preview order.', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else if ( 'retry' == $email->object ) {
+ $content = '' . __( 'To generate a preview of this email type you must choose an order containing a subscription which has also failed to auto renew as the preview order in the settings.', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else if ( 'vendor' == $email->object ) {
+ $content = '' . __( 'This email type requires that an order containing a vendor purchase be selected as the preview order.', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else if ( 'member' == $email->object ) {
+ $content = '' . __( 'This email type requires that an order containing a user who has an active membership be selected as the preview order.', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else if ( 'WC_Memberships_User_Membership_Ending_Soon_Email' === $email_template || 'WC_Memberships_User_Membership_Renewal_Reminder_Email' === $email_template || 'WC_Memberships_User_Membership_Activated_Email' === $email_template || 'WC_Memberships_User_Membership_Ended_Email' === $email_template ) {
+ $args = array(
+ 'user_membership' => $email->object,
+ 'email' => $email,
+ 'email_heading' => $email->get_heading(),
+ 'email_body' => $member_body,
+ 'sent_to_admin' => false,
+ );
+ ob_start();
+
+ wc_get_template( $email->template_html, $args );
+
+ $content = ob_get_clean();
+ $content = $email->style_inline( $content );
+ $content = apply_filters( 'woocommerce_mail_content', $content );
+
+ if ( 'plain' === $email->email_type ) {
+ $content = '' . str_replace( "\n", ' ', $content ) . '
';
+ }
+ } else {
+ // Get email content and apply styles.
+ $content = $email->get_content();
+ $content = $email->style_inline( $content );
+ $content = apply_filters( 'woocommerce_mail_content', $content );
+
+ if ( 'plain' === $email->email_type ) {
+ $content = '' . str_replace( "\n", ' ', $content ) . '
';
+ }
+ }
+ }
+ } else {
+ $content = false;
+ }
+
+ return $content;
+ }
+
+ /**
+ * Change Recipient to a custom one.
+ *
+ * @access public
+ * @return string
+ */
+ public static function change_recipient( $recipient ) {
+
+ if ( ! empty( self::$current_recipients ) ) {
+ $recipient = self::$current_recipients;
+ } else {
+ // Don't send if not set
+ $recipient = '';
+ }
+ return $recipient;
+ }
+ /**
+ * Print preview email
+ *
+ * @access public
+ * @return void
+ */
+ public static function print_preview_email() {
+
+ $content = self::get_preview_email();
+ if ( false == $content ) {
+ echo __( 'An error occurred trying to load this email type. Make sure this email type is enabled or please try another type.', 'mailtpl-woocommerce-email-composer' );
+ } elseif ( ! empty( $content ) ) {
+ // Print email content
+
+ echo $content;
+ // Print live preview scripts in footer
+ add_action( 'wp_footer', array( 'Mailtpl_Woomail_Preview', 'print_live_preview_scripts' ), 99 );
+ }
+ }
+
+ /**
+ * Send preview email
+ *
+ * @access public
+ * @return void
+ */
+ public static function send_preview_email() {
+ $content = self::get_preview_email();
+ if ( ! empty( $content ) ) {
+ // Print email content
+ echo $content;
+ }
+ }
+
+ /**
+ * Get WooCommerce order for preview
+ *
+ * @access public
+ * @param string $order_status
+ * @return object
+ */
+ public static function get_wc_order_for_preview( $order_status = null, $order_id = null ) {
+ if ( ! empty( $order_id ) && 'mockup' != $order_id ) {
+ return wc_get_order( $order_id );
+ } else {
+ // Use mockup order
+
+ // Instantiate order object
+ $order = new WC_Order();
+
+ // Other order properties
+ $order->set_props( array(
+ 'id' => 1,
+ 'status' => ( null === $order_status ? 'processing' : $order_status ),
+ 'billing_first_name' => 'Sherlock',
+ 'billing_last_name' => 'Holmes',
+ 'billing_company' => 'Detectives Ltd.',
+ 'billing_address_1' => '221B Baker Street',
+ 'billing_city' => 'London',
+ 'billing_postcode' => 'NW1 6XE',
+ 'billing_country' => 'GB',
+ 'billing_email' => 'support@wpexperts.io',
+ 'billing_phone' => '02123123123',
+ 'date_created' => date( 'Y-m-d H:i:s' ),
+ 'total' => 24.90,
+ ) );
+
+ // Item #1
+ $order_item = new WC_Order_Item_Product();
+ $order_item->set_props( array(
+ 'name' => 'A Study in Scarlet',
+ 'subtotal' => '9.95',
+ 'sku' => 'kwd_ex_1',
+ ) );
+ $order->add_item( $order_item );
+
+ // Item #2
+ $order_item = new WC_Order_Item_Product();
+ $order_item->set_props( array(
+ 'name' => 'The Hound of the Baskervilles',
+ 'subtotal' => '14.95',
+ 'sku' => 'kwd_ex_2',
+ ) );
+ $order->add_item( $order_item );
+
+ // Return mockup order
+ return $order;
+ }
+
+ }
+
+ /**
+ * Print live preview scripts
+ *
+ * @access public
+ * @return void
+ */
+ public static function print_live_preview_scripts() {
+
+ $responsive_check = Mailtpl_Woomail_Customizer::opt( 'responsive_mode' );
+ // Open container
+ $scripts = '';
+ }
+
+ }
+
+ Mailtpl_Woomail_Preview::get_instance();
+
+}
diff --git a/includes/class-mailtpl-woomail-settings.php b/includes/class-mailtpl-woomail-settings.php
new file mode 100644
index 0000000..15137e0
--- /dev/null
+++ b/includes/class-mailtpl-woomail-settings.php
@@ -0,0 +1,3236 @@
+ '"Helvetica Neue", Helvetica, Roboto, Arial, sans-serif',
+ 'arial' => 'Arial, Helvetica, sans-serif',
+ 'arial_black' => '"Arial Black", Gadget, sans-serif',
+ 'courier' => '"Courier New", Courier, monospace',
+ 'impact' => 'Impact, Charcoal, sans-serif',
+ 'lucida' => '"Lucida Sans Unicode", "Lucida Grande", sans-serif',
+ 'palatino' => '"Palatino Linotype", "Book Antiqua", Palatino, serif',
+ 'georgia' => 'Georgia, serif',
+ );
+
+ /**
+ * Get our prebuilt tempaltes.
+ *
+ * @var array
+ */
+ public static $prebuilt_templates_mapping = array(
+ 'kt_full' => 'assets/images/kt_full_template.jpg',
+ 'kt_skinny' => 'assets/images/kt_skinny_template.jpg',
+ 'kt_flat' => 'assets/images/kt_flat_template.jpg',
+ );
+ /**
+ * Get our customizer panels
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_panels() {
+ // Define panels.
+ if ( is_null( self::$panels ) ) {
+ self::$panels = array(
+ // Header.
+ 'header' => array(
+ 'title' => __( 'Header', 'mailtpl-woocommerce-email-composer' ),
+ 'priority' => 20,
+ ),
+
+ // Content.
+ 'content' => array(
+ 'title' => __( 'Content', 'mailtpl-woocommerce-email-composer' ),
+ 'priority' => 30,
+ ),
+
+ // Footer.
+ 'footer' => array(
+ 'title' => __( 'Footer', 'mailtpl-woocommerce-email-composer' ),
+ 'priority' => 40,
+ ),
+
+ );
+ }
+
+ // Return panels.
+ return self::$panels;
+ }
+
+ /**
+ * Get our Customizer sections
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_sections() {
+ // Define sections.
+ if ( is_null( self::$sections ) ) {
+ self::$sections = array(
+ // Text and Type.
+ 'mtype' => array(
+ 'title' => __( 'Email Type and Text', 'mailtpl-woocommerce-email-composer' ),
+ 'priority' => 10,
+ ),
+ // Container.
+ 'container' => array(
+ 'title' => __( 'Container', 'mailtpl-woocommerce-email-composer' ),
+ 'priority' => 15,
+ ),
+
+ // Header Style.
+ 'header_style' => array(
+ 'title' => __( 'Header Style', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'header',
+ 'priority' => 20,
+ ),
+
+ // Header Image.
+ 'header_image' => array(
+ 'title' => __( 'Header Image', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'header',
+ 'priority' => 20,
+ ),
+
+ // Heading.
+ 'heading' => array(
+ 'title' => __( 'Heading', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'header',
+ 'priority' => 30,
+ ),
+
+ // Footer Style.
+ 'footer_style' => array(
+ 'title' => __( 'Footer Style', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'footer',
+ 'priority' => 40,
+ ),
+ // Footer social.
+ 'footer_social' => array(
+ 'title' => __( 'Footer Social', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'footer',
+ 'priority' => 50,
+ ),
+ // Footer Content.
+ 'footer_content' => array(
+ 'title' => __( 'Footer Credit Content', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'footer',
+ 'priority' => 60,
+ ),
+ // Content Container.
+ 'content_container' => array(
+ 'title' => __( 'Content Container', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'content',
+ 'priority' => 5,
+ ),
+ // Heading Style.
+ 'headings_style' => array(
+ 'title' => __( 'Content Headings Style', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'content',
+ 'priority' => 8,
+ ),
+ // Text Style.
+ 'text_style' => array(
+ 'title' => __( 'Content Text Style', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'content',
+ 'priority' => 10,
+ ),
+ // Items Table.
+ 'items_table' => array(
+ 'title' => __( 'Order Items', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'content',
+ 'priority' => 10,
+ ),
+ // Items Table.
+ 'addresses' => array(
+ 'title' => __( 'Addresses', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'content',
+ 'priority' => 10,
+ ),
+ // Text input.
+ 'text_input' => array(
+ 'title' => __( 'Text Copy', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'content',
+ 'priority' => 5,
+ ),
+ // Button Styles.
+ 'btn_styles' => array(
+ 'title' => __( 'Button Styles', 'mailtpl-woocommerce-email-composer' ),
+ 'panel' => 'content',
+ 'priority' => 10,
+ ),
+ // Custom Styles.
+ 'custom_styles' => array(
+ 'title' => __( 'Custom Styles', 'mailtpl-woocommerce-email-composer' ),
+ 'priority' => 80,
+ ),
+ // Import_export.
+ 'import_export' => array(
+ 'title' => __( 'Import Export', 'mailtpl-woocommerce-email-composer' ),
+ 'priority' => 90,
+ ),
+ // Send Email.
+ 'send_email' => array(
+ 'title' => __( 'Send Preview Email', 'mailtpl-woocommerce-email-composer' ),
+ 'priority' => 100,
+ ),
+ );
+ }
+ // Return sections.
+ return self::$sections;
+ }
+
+ /**
+ * Get woocommerce settings that the plugin will allow editing of
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_woo_settings() {
+
+ if ( is_null( self::$woo_settings ) ) {
+ $base_options = array();
+
+ // Email header image.
+ $base_options['woocommerce_email_header_image'] = array(
+ 'title' => __( 'Header Image', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'image',
+ 'section' => 'header_image',
+ 'default' => self::get_default_value( 'header_image' ),
+ 'original' => '',
+ 'priority' => 5,
+ 'transport' => 'refresh',
+ 'selectors' => array(
+ '#template_header_image img',
+ ),
+ );
+ // Email background color.
+ $base_options['woocommerce_email_background_color'] = array(
+ 'title' => __( 'Container Background color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'container',
+ 'control_type' => 'color',
+ 'priority' => 5,
+ 'default' => self::get_default_value( 'body_background_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'body' => array( 'background-color' ),
+ '#wrapper' => array( 'background-color' ),
+ ),
+ );
+ // Email text color.
+ $base_options['woocommerce_email_text_color'] = array(
+ 'title' => __( 'Content Text color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'text_style',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'text_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner' => array( 'color' ),
+ '.td' => array( 'color' ),
+ '.text' => array( 'color' ),
+ 'address' => array( 'color' ),
+ ),
+ );
+ // Email body background color.
+ $base_options['woocommerce_email_body_background_color'] = array(
+ 'title' => __( 'Content Background color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'content_container',
+ 'control_type' => 'color',
+ 'priority' => 5,
+ 'default' => self::get_default_value( 'background_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content' => array( 'background-color' ),
+ '#template_container' => array( 'background-color' ),
+ 'h2 .separator-bubble' => array( 'background-color' ),
+ ),
+ );
+ // Footer Content Footer text.
+ $base_options['woocommerce_email_footer_text'] = array(
+ 'title' => __( 'Footer text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'footer_content',
+ 'default' => self::get_default_value( 'footer_content_text' ),
+ 'original' => '',
+ 'live_method' => 'replace',
+ 'selectors' => array(
+ '#template_footer #credit',
+ ),
+ );
+ $email_text = array();
+ foreach ( self::get_email_types() as $key => $value ) {
+ // Email recipients Text.
+ if ( 'cancelled_order' == $key || 'new_order' == $key || 'failed_order' == $key ) {
+ $email_text[ 'woocommerce_' . $key . '_settings[recipient]' ] = array(
+ 'title' => __( 'Recipient(s)', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'description' => sprintf( __( 'Enter recipients (comma separated) for this email. Defaults to %s.', 'mailtpl-woocommerce-email-composer' ), '' . esc_attr( get_option( 'admin_email' ) ) . '
' ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ }
+ if ( 'customer_refunded_order' == $key ) {
+ // Email Subject.
+ $email_text[ 'woocommerce_' . $key . '_settings[subject_full]' ] = array(
+ 'title' => __( 'Full refund subject', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_subject_full' ),
+ ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Subject.
+ $email_text[ 'woocommerce_' . $key . '_settings[subject_partial]' ] = array(
+ 'title' => __( 'Partial refund subject', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_subject_partial' ),
+ ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Header Text.
+ $email_text[ 'woocommerce_' . $key . '_settings[heading_full]' ] = array(
+ 'title' => __( 'Full refund Heading Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_heading_full' ),
+ ),
+ 'live_method' => 'replace',
+ 'selectors' => array(
+ '#header_wrapper h1',
+ ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Header Text.
+ $email_text[ 'woocommerce_' . $key . '_settings[heading_partial]' ] = array(
+ 'title' => __( 'Partial refund Heading Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_heading_partial' ),
+ ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ if ( version_compare( WC_VERSION, '3.7', '>' ) ) {
+ $email_text[ 'woocommerce_' . $key . '_settings[additional_content]' ] = array(
+ 'title' => __( 'Additional content', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'priority' => 20,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_additional_content' ),
+ ),
+ 'transport' => 'refresh',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ }
+ } else {
+ // Email Subject.
+ $email_text[ 'woocommerce_' . $key . '_settings[subject]' ] = array(
+ 'title' => __( 'Subject Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_subject' ),
+ ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ if ( 'customer_invoice' == $key ) {
+ $email_text[ 'woocommerce_' . $key . '_settings[subject_paid]' ] = array(
+ 'title' => __( 'Subject (paid) Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_subject_paid' ),
+ ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ }
+ // Email Header Text.
+ $email_text[ 'woocommerce_' . $key . '_settings[heading]' ] = array(
+ 'title' => __( 'Heading Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_heading' ),
+ ),
+ 'live_method' => 'replace',
+ 'selectors' => array( '#header_wrapper h1' ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ if ( 'customer_invoice' == $key ) {
+ $email_text[ 'woocommerce_' . $key . '_settings[heading_paid]' ] = array(
+ 'title' => __( 'Heading (paid) Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'priority' => 5,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_heading_paid' ),
+ ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ 'live_method' => 'replace',
+ 'selectors' => array( '#header_wrapper h1' ),
+ );
+ }
+ if ( version_compare( WC_VERSION, '3.7', '>' ) ) {
+ $email_text[ 'woocommerce_' . $key . '_settings[additional_content]' ] = array(
+ 'title' => __( 'Additional content', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'priority' => 20,
+ 'default' => '',
+ 'input_attrs' => array(
+ 'placeholder' => self::get_default_value( $key . '_additional_content' ),
+ ),
+ 'transport' => 'refresh',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ }
+ }
+ }
+ self::$woo_settings = array_merge( $base_options, $email_text );
+ }
+ return self::$woo_settings;
+ }
+
+ /**
+ * Get our extra settings
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_settings() {
+ // Define settings
+ if ( is_null( self::$settings ) ) {
+ // Main Base options.
+ $mainoptions = array(
+ // Email template
+ 'email_load_template' => array(
+ 'title' => __( 'Template_load', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'template',
+ 'control_type' => 'mailtpltemplateload',
+ 'choices' => self::get_email_templates(),
+ 'default' => 'kt_full',
+ 'transport' => 'refresh',
+ ),
+ // Preview Order Id.
+ 'preview_order_id' => array(
+ 'title' => __( 'Preview Order', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'mtype',
+ 'type' => 'select',
+ 'priority' => 1,
+ 'choices' => self::get_order_ids(),
+ 'default' => self::get_default_value( 'preview_order_id' ),
+ 'transport' => 'refresh',
+ ),
+ // Email Type.
+ 'email_type' => array(
+ 'title' => __( 'Email Type', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'mtype',
+ 'type' => 'select',
+ 'priority' => 2,
+ 'choices' => self::get_email_types(),
+ 'default' => self::get_default_value( 'email_type' ),
+ 'transport' => 'refresh',
+ ),
+ // Placeholder Info.
+ 'email_text_info' => array(
+ 'title' => __( 'Available placeholders', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'mtype',
+ 'control_type' => 'kwdinfoblock',
+ 'priority' => 50,
+ 'description' => '{site_title}, {order_date}, {order_number}, {customer_first_name}, {customer_last_name}, {customer_full_name}, {customer_username}, {customer_email}
',
+ ),
+ // // Placeholder Info.
+ // 'email_schema' => array(
+ // 'title' => __( 'Disable Email Schema', 'mailtpl-woocommerce-email-composer' ),
+ // 'section' => 'mtype',
+ // 'control_type' => 'toggleswitch',
+ // 'default' => self::get_default_value( 'email_schema' ),
+ // 'priority' => 60,
+ // 'description' => __( 'Some inboxes seem to have trouble with woocommerce default schema code added.', 'mailtpl-woocommerce-email-composer' ),
+ // ),
+ );
+ $extra_email_text = array();
+
+ // Get the Extra Text area settings.
+ foreach ( self::get_customized_email_types() as $key => $value ) {
+ // Email Subtitle Text
+ $extra_email_text[ $key . '_subtitle' ] = array(
+ 'title' => __( 'Subtitle Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'text',
+ 'section' => 'mtype',
+ 'default' => '',
+ 'original' => '',
+ 'live_method' => 'replace',
+ 'selectors' => array(
+ '#header_wrapper .subtitle',
+ ),
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ if ( 'customer_new_account' == $key ) {
+ $extra_email_text[ $key . '_account_section' ] = array(
+ 'title' => __( 'Show account section', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_account_section' ),
+ 'original' => '',
+ 'priority' => 3,
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ $extra_email_text[ $key . '_btn_switch' ] = array(
+ 'title' => __( 'Switch account link to button', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_btn_switch' ),
+ 'original' => '',
+ 'priority' => 3,
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ }
+ if ( 'customer_refunded_order' == $key ) {
+ // Email preview switch
+ $extra_email_text[ $key . '_switch' ] = array(
+ 'title' => __( 'Switch off for Partial Refund Preview', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_switch' ),
+ 'original' => '',
+ 'priority' => 3,
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text
+ $extra_email_text[ $key . '_body_full' ] = array(
+ 'title' => __( 'Body Full Refund Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body_full' ),
+ 'original' => '',
+ 'transport' => 'refresh',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text
+ $extra_email_text[ $key . '_body_partial' ] = array(
+ 'title' => __( 'Body Partial Refund Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body_partial' ),
+ 'original' => '',
+ 'transport' => 'refresh',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ } else if ( 'customer_invoice' == $key ) {
+ // Email preview switch
+ $extra_email_text[ $key . '_switch' ] = array(
+ 'title' => __( 'Switch off for unpaid preview', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_switch' ),
+ 'original' => '',
+ 'priority' => 3,
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email preview switch.
+ $extra_email_text[ $key . '_btn_switch' ] = array(
+ 'title' => __( 'Make "Pay for this Order" a button', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_btn_switch' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text
+ $extra_email_text[ $key . '_body_paid' ] = array(
+ 'title' => __( 'Body Invoice Paid Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body_paid' ),
+ 'original' => '',
+ 'transport' => 'refresh',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text
+ $extra_email_text[ $key . '_body' ] = array(
+ 'title' => __( 'Body Invoice Pending Payment Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ } else if ( 'customer_payment_retry' == $key ) {
+ // Override content.
+ $extra_email_text[ $key . '_override' ] = array(
+ 'title' => __( 'Override Static Email Content with Custom Body Text?', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_override' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Button Switch.
+ $extra_email_text[ $key . '_btn_switch' ] = array(
+ 'title' => __( 'Make "Pay now" a button', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_btn_switch' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text.
+ $extra_email_text[ $key . '_body' ] = array(
+ 'title' => __( 'Body Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ } else if ( 'admin_payment_retry' == $key ) {
+ // Override content.
+ $extra_email_text[ $key . '_override' ] = array(
+ 'title' => __( 'Override Static Email Content with Custom Body Text?', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_override' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text.
+ $extra_email_text[ $key . '_body' ] = array(
+ 'title' => __( 'Body Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ } else if ( 'customer_renewal_invoice' == $key ) {
+ // Button Switch.
+ $extra_email_text[ $key . '_btn_switch' ] = array(
+ 'title' => __( 'Make "Pay Now" a button', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_btn_switch' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text
+ $extra_email_text[ $key . '_body_failed' ] = array(
+ 'title' => __( 'Body Invoice Failed Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body_failed' ),
+ 'original' => '',
+ 'transport' => 'refresh',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text
+ $extra_email_text[ $key . '_body' ] = array(
+ 'title' => __( 'Body Invoice Pending Payment Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ } else if ( 'customer_reset_password' == $key ) {
+ // Email preview switch.
+ $extra_email_text[ $key . '_btn_switch' ] = array(
+ 'title' => __( 'Make "reset your password" a button', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_switch' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ // Email Body Text
+ $extra_email_text[ $key . '_body' ] = array(
+ 'title' => __( 'Body Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body' ),
+ 'original' => '',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ } else {
+ // Email Body Text.
+ $extra_email_text[ $key . '_body' ] = array(
+ 'title' => __( 'Body Text', 'mailtpl-woocommerce-email-composer' ),
+ 'type' => 'textarea',
+ 'section' => 'mtype',
+ 'default' => self::get_default_value( $key . '_body' ),
+ 'original' => '',
+ 'transport' => 'refresh',
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ }
+ if ( 'woocommerce_waitlist_mailout' == $key ) {
+ $extra_email_text[ $key . '_hide_content' ] = array(
+ 'title' => __( 'Remove Normal Content Output', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'mtype',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( $key . '_hide_content' ),
+ 'original' => '',
+ 'priority' => 3,
+ 'active_callback' => array(
+ 'id' => 'email_type',
+ 'compare' => '==',
+ 'value' => $key,
+ ),
+ );
+ }
+ }
+ $main = array(
+ /*
+ CONTAINER STUFF */
+ // Email width.
+ 'content_width' => array(
+ 'title' => __( 'Content Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => self::get_default_value( 'content_width' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_container' => array( 'width' ),
+ '#template_header' => array( 'width' ),
+ '#template_header_image' => array( 'width' ),
+ '#template_body' => array( 'width' ),
+ '#template_footer' => array( 'width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 2,
+ 'min' => 350,
+ 'max' => 1500,
+ ),
+ ),
+ 'responsive_mode' => array(
+ 'title' => __( 'Enable Fluid Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'container',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( 'responsive_mode' ),
+ ),
+ 'content_inner_width' => array(
+ 'title' => __( 'Content Inner Max Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => self::get_default_value( 'content_width' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_container #template_header' => array( 'max-width' ),
+ '#template_container #template_header_image' => array( 'max-width' ),
+ '#template_container #template_body' => array( 'max-width' ),
+ '#template_container #template_footer' => array( 'max-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 2,
+ 'min' => 350,
+ 'max' => 1500,
+ ),
+ 'active_callback' => array(
+ 'id' => 'responsive_mode',
+ 'compare' => '==',
+ 'value' => true,
+ ),
+ ),
+ // Border radius
+ 'border_radius' => array(
+ 'title' => __( 'Border radius', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => self::get_default_value( 'border_radius' ),
+ 'live_method' => 'css',
+ 'description' => __( 'Warning: most desktop email clients do not yet support this.', 'mailtpl-woocommerce-email-composer' ),
+ 'selectors' => array(
+ '#template_container' => array( 'border-radius' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 100,
+ ),
+ ),
+ // Border Width.
+ 'border_width' => array(
+ 'title' => __( 'Border Top Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => self::get_default_value( 'border_width' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'body #template_container' => array( 'border-top-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 20,
+ ),
+ ),
+ // Border Width.
+ 'border_width_right' => array(
+ 'title' => __( 'Border Right Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => str_replace( 'px', '', Mailtpl_Woomail_Customizer::opt( 'border_width' ) ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'body #template_container' => array( 'border-right-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 20,
+ ),
+ ),
+ // Border Width.
+ 'border_width_bottom' => array(
+ 'title' => __( 'Border Bottom Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => str_replace( 'px', '', Mailtpl_Woomail_Customizer::opt( 'border_width' ) ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'body #template_container' => array( 'border-bottom-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 20,
+ ),
+ ),
+ // Border Width.
+ 'border_width_left' => array(
+ 'title' => __( 'Border Left Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => str_replace( 'px', '', Mailtpl_Woomail_Customizer::opt( 'border_width' ) ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'body #template_container' => array( 'border-left-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 20,
+ ),
+ ),
+ // Border Color.
+ 'border_color' => array(
+ 'title' => __( 'Border color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'container',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'border_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'body #template_container' => array( 'border-color' ),
+ ),
+ ),
+ // Shadow
+ 'shadow' => array(
+ 'title' => __( 'Shadow', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'description' => __( 'Warning: most email clients do not yet support this.', 'mailtpl-woocommerce-email-composer' ),
+ 'default' => self::get_default_value( 'shadow' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'body #template_container' => array( 'box-shadow' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 20,
+ ),
+ ),
+ // Email Top Padding
+ 'email_padding' => array(
+ 'title' => __( 'Container Top Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => self::get_default_value( 'email_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#wrapper' => array( 'padding-top' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 250,
+ ),
+ ),
+ // Email Top Padding
+ 'email_padding_bottom' => array(
+ 'title' => __( 'Container Botom Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'container',
+ 'default' => self::get_default_value( 'email_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#wrapper' => array( 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 250,
+ ),
+ ),
+ /**
+ * HEADER IMAGE OPTIONS
+ */
+ 'header_image_link' => array(
+ 'title' => __( 'Make Image link to website?', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'header_image',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( 'header_image_link' ),
+ ),
+ // Header Image Width.
+ 'header_image_placement' => array(
+ 'title' => __( 'Header Image Placement', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'header_image',
+ 'default' => self::get_default_value( 'header_image_placement' ),
+ 'transport' => 'refresh',
+ 'type' => 'select',
+ 'choices' => array(
+ 'outside' => __( 'Outside Body Container', 'mailtpl-woocommerce-email-composer' ),
+ 'inside' => __( 'Inside Body Container', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ ),
+ // Image Align.
+ 'header_image_align' => array(
+ 'title' => __( 'Image Align', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'header_image',
+ 'default' => self::get_default_value( 'header_image_align' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_image_aligns(),
+ 'selectors' => array(
+ '#template_header_image_table td' => array( 'text-align' ),
+ ),
+ ),
+ // Image Maxwidth
+ 'header_image_maxwidth' => array(
+ 'title' => __( 'Image Max Width', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'header_image',
+ 'default' => self::get_default_value( 'header_image_maxwidth' ),
+ 'live_method' => 'css',
+ 'control_type' => 'rangevalue',
+ 'selectors' => array(
+ '#template_header_image img' => array( 'width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 10,
+ 'max' => 1200,
+ ),
+ ),
+ 'header_image_background_color' => array(
+ 'title' => __( 'Background color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'header_image',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'header_image_background_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header_image_container' => array( 'background-color' ),
+ ),
+ ),
+ // Header Padding top/bottom.
+ 'header_image_padding_top_bottom' => array(
+ 'title' => __( 'Padding top/bottom', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'header_image',
+ 'default' => self::get_default_value( 'header_image_padding_top_bottom' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header_image_table td' => array( 'padding-top', 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Header background color.
+ 'header_background_color' => array(
+ 'title' => __( 'Background color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'header_style',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'header_background_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header' => array( 'background-color' ),
+ ),
+ ),
+ // Header Text align
+ 'header_text_align' => array(
+ 'title' => __( 'Text align', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'header_style',
+ 'default' => self::get_default_value( 'header_text_align' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_text_aligns(),
+ 'selectors' => array(
+ '#header_wrapper h1' => array( 'text-align' ),
+ '#header_wrapper' => array( 'text-align' ),
+ ),
+ ),
+
+ // Header Padding top/bottom.
+ 'header_padding_top' => array(
+ 'title' => __( 'Padding Top', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'header_style',
+ 'default' => self::get_default_value( 'header_padding_top_bottom' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#header_wrapper' => array( 'padding-top' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Header Padding top/bottom
+ 'header_padding_bottom' => array(
+ 'title' => __( 'Padding Bottom', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'header_style',
+ 'default' => self::get_default_value( 'header_padding_top_bottom' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#header_wrapper' => array( 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+
+ // Header Padding left/right
+ 'header_padding_left_right' => array(
+ 'title' => __( 'Padding left/right', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'header_style',
+ 'default' => self::get_default_value( 'header_padding_left_right' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#header_wrapper' => array( 'padding-left', 'padding-right' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Heading Font size
+ 'heading_font_size' => array(
+ 'title' => __( 'Heading Font size', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'heading_font_size' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header h1' => array( 'font-size' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 10,
+ 'max' => 75,
+ ),
+ ),
+ // heading Line Height
+ 'heading_line_height' => array(
+ 'title' => __( 'Heading Line Height', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'heading_line_height' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header h1' => array( 'line-height' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 10,
+ 'max' => 125,
+ ),
+ ),
+ // Heading Font family
+ 'heading_font_family' => array(
+ 'title' => __( 'Heading Font family', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'heading_font_family' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_font_families(),
+ 'selectors' => array(
+ '#template_header h1' => array( 'font-family' ),
+ ),
+ ),
+ // Heading Font style
+ 'heading_font_style' => array(
+ 'title' => __( 'Heading Font Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'heading_font_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'normal' => __( 'Normal', 'mailtpl-woocommerce-email-composer' ),
+ 'italic' => __( 'Italic', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '#template_header h1' => array( 'font-style' ),
+ ),
+ ),
+ // Heading Font weight
+ 'heading_font_weight' => array(
+ 'title' => __( 'Heading Font weight', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'heading_font_weight' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header h1' => array( 'font-weight' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 100,
+ 'min' => 100,
+ 'max' => 900,
+ ),
+ ),
+ // Heading Color
+ 'heading_color' => array(
+ 'title' => __( 'Heading Text color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'heading',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'heading_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header' => array( 'color' ),
+ '#template_header h1' => array( 'color' ),
+ ),
+ ),
+ // Subtitle Info
+ 'subtitle_fontt_info' => array(
+ 'title' => __( 'Subtitle Settings', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'heading',
+ 'control_type' => 'kwdinfoblock',
+ 'description' => '',
+ ),
+ // Subtitle placement
+ 'subtitle_placement' => array(
+ 'title' => __( 'Subtitle Placement', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'subtitle_placement' ),
+ 'transport' => 'refresh',
+ 'type' => 'select',
+ 'choices' => array(
+ 'below' => __( 'Below Heading', 'mailtpl-woocommerce-email-composer' ),
+ 'above' => __( 'Above Heading', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ ),
+
+ // Subtitle Font size
+ 'subtitle_font_size' => array(
+ 'title' => __( 'Subtitle Font Size', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'subtitle_font_size' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header .subtitle' => array( 'font-size' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 10,
+ 'max' => 75,
+ ),
+ ),
+ // Subtitle Line Height
+ 'subtitle_line_height' => array(
+ 'title' => __( 'Subtitle Line Height', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'subtitle_line_height' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header .subtitle' => array( 'line-height' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 10,
+ 'max' => 125,
+ ),
+ ),
+ // Subtitle Font family.
+ 'subtitle_font_family' => array(
+ 'title' => __( 'Subtitle Font Family', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'subtitle_font_family' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_font_families(),
+ 'selectors' => array(
+ '#template_header .subtitle' => array( 'font-family' ),
+ ),
+ ),
+ // Subtitle Font style
+ 'subtitle_font_style' => array(
+ 'title' => __( 'Subtitle Font Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'subtitle_font_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'normal' => __( 'Normal', 'mailtpl-woocommerce-email-composer' ),
+ 'italic' => __( 'Italic', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '#template_header .subtitle' => array( 'font-style' ),
+ ),
+ ),
+
+ // Subtitle Font weight
+ 'subtitle_font_weight' => array(
+ 'title' => __( 'Subtitle Font weight', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'heading',
+ 'default' => self::get_default_value( 'subtitle_font_weight' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header .subtitle' => array( 'font-weight' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 100,
+ 'min' => 100,
+ 'max' => 900,
+ ),
+ ),
+
+ // Subtitle Color
+ 'subtitle_color' => array(
+ 'title' => __( 'Subtitle Text color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'heading',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'subtitle_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_header .subtitle' => array( 'color' ),
+ ),
+ ),
+
+ // Content padding top
+ 'content_padding_top' => array(
+ 'title' => __( 'Padding Top', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'content_container',
+ 'default' => self::get_default_value( 'content_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content' => array( 'padding-top' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Content padding
+ 'content_padding_bottom' => array(
+ 'title' => __( 'Padding Bottom', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'content_container',
+ 'default' => self::get_default_value( 'content_padding_bottom' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content' => array( 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Content padding
+ 'content_padding' => array(
+ 'title' => __( 'Padding Left/Right', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'content_container',
+ 'default' => self::get_default_value( 'content_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content > table > tbody > tr > td' => array( 'padding-left', 'padding-right' ),
+ '#body_content > table > tr > td' => array( 'padding-left', 'padding-right' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // TEXT STYLE
+ // Font size
+ 'font_size' => array(
+ 'title' => __( 'Font Size', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'text_style',
+ 'default' => self::get_default_value( 'font_size' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner' => array( 'font-size' ),
+ 'img' => array( 'font-size' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 8,
+ 'max' => 30,
+ ),
+ ),
+ // Line Height
+ 'line_height' => array(
+ 'title' => __( 'Line Height', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'text_style',
+ 'default' => self::get_default_value( 'line_height' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner' => array( 'line-height' ),
+ 'img' => array( 'line-height' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 10,
+ 'max' => 90,
+ ),
+ ),
+ // Font family
+ 'font_family' => array(
+ 'title' => __( 'Font Family', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'text_style',
+ 'default' => self::get_default_value( 'font_family' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_font_families(),
+ 'selectors' => array(
+ '#body_content_inner' => array( 'font-family' ),
+ '#body_content_inner .td' => array( 'font-family' ),
+ '.text' => array( 'font-family' ),
+ ),
+ ),
+ // Font weight.
+ 'font_weight' => array(
+ 'title' => __( 'Font weight', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'text_style',
+ 'default' => self::get_default_value( 'font_weight' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner' => array( 'font-weight' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 100,
+ 'min' => 100,
+ 'max' => 900,
+ ),
+ ),
+ // Link color.
+ 'link_color' => array(
+ 'title' => __( 'Link Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'text_style',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'link_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a' => array( 'color' ),
+ '.link' => array( 'color' ),
+ '.btn' => array( 'background-color' ),
+ ),
+ ),
+ // H2 TEXT STYLE.
+ // Font size.
+ 'h2_font_size' => array(
+ 'title' => __( 'H2 Font Size', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_font_size' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h2' => array( 'font-size' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 8,
+ 'max' => 50,
+ ),
+ ),
+ // h2 Line Height.
+ 'h2_line_height' => array(
+ 'title' => __( 'H2 Line Height', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_line_height' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h2' => array( 'line-height' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 10,
+ 'max' => 90,
+ ),
+ ),
+ // h2 padding top.
+ 'h2_padding_top' => array(
+ 'title' => __( 'H2 Padding Top', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_padding_top' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h2' => array( 'padding-top' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 60,
+ ),
+ ),
+ // h2 padding bottom.
+ 'h2_padding_bottom' => array(
+ 'title' => __( 'H2 Padding Bottom', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_padding_bottom' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h2' => array( 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 60,
+ ),
+ ),
+ // h2 margin top.
+ 'h2_margin_top' => array(
+ 'title' => __( 'H2 Margin Top', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_margin_top' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h2' => array( 'margin-top' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 60,
+ ),
+ ),
+ // h2 margin bottom.
+ 'h2_margin_bottom' => array(
+ 'title' => __( 'H2 Margin Bottom', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_margin_bottom' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h2' => array( 'margin-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 60,
+ ),
+ ),
+ // h2 Font family.
+ 'h2_font_family' => array(
+ 'title' => __( 'H2 Font Family', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_font_family' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_font_families(),
+ 'selectors' => array(
+ '#template_body h2' => array( 'font-family' ),
+ '#template_body h2 a' => array( 'font-family' ),
+ ),
+ ),
+ // h2 Font style.
+ 'h2_font_style' => array(
+ 'title' => __( 'H2 Font Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_font_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'normal' => __( 'Normal', 'mailtpl-woocommerce-email-composer' ),
+ 'italic' => __( 'Italic', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '#template_body h2' => array( 'font-style' ),
+ '#template_body h2 a' => array( 'font-style' ),
+ ),
+ ),
+ // h2 Font weight.
+ 'h2_font_weight' => array(
+ 'title' => __( 'H2 Font weight', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_font_weight' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h2' => array( 'font-weight' ),
+ '#template_body h2 a' => array( 'font-weight' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 100,
+ 'min' => 100,
+ 'max' => 900,
+ ),
+ ),
+ // h2 text transform.
+ 'h2_text_transform' => array(
+ 'title' => __( 'H2 Text Transform', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_text_transform' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'none' => __( 'None', 'mailtpl-woocommerce-email-composer' ),
+ 'uppercase' => __( 'Uppercase', 'mailtpl-woocommerce-email-composer' ),
+ 'lowercase' => __( 'Lowercase', 'mailtpl-woocommerce-email-composer' ),
+ 'capitalize' => __( 'Capitalize', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '#template_body h2' => array( 'text-transform' ),
+ ),
+ ),
+ // H2 color.
+ 'h2_color' => array(
+ 'title' => __( 'H2 Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'h2_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h2' => array( 'color' ),
+ '#template_body h2 a' => array( 'color' ),
+ ),
+ ),
+ // h2 text align.
+ 'h2_text_align' => array(
+ 'title' => __( 'H2 Text Align', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_text_align' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_text_aligns(),
+ 'selectors' => array(
+ '#template_body h2' => array( 'text-align' ),
+ ),
+ ),
+ // h2 style.
+ 'h2_style' => array(
+ 'title' => __( 'H2 Separator', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_style' ),
+ 'transport' => 'refresh',
+ 'type' => 'select',
+ 'choices' => array(
+ 'none' => __( 'None', 'mailtpl-woocommerce-email-composer' ),
+ 'below' => __( 'Separator below', 'mailtpl-woocommerce-email-composer' ),
+ 'above' => __( 'Separator above', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ ),
+ // separator height.
+ 'h2_separator_height' => array(
+ 'title' => __( 'H2 Separator height', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'control_type' => 'rangevalue',
+ 'default' => self::get_default_value( 'h2_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 30,
+ ),
+ 'selectors' => array(
+ '.title-style-below #template_body h2' => array( 'border-bottom-width' ),
+ '.title-style-above #template_body h2' => array( 'border-top-width' ),
+ ),
+ ),
+ // h2 style
+ 'h2_separator_style' => array(
+ 'title' => __( 'H2 Separator Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'solid' => __( 'Solid', 'mailtpl-woocommerce-email-composer' ),
+ 'double' => __( 'Double', 'mailtpl-woocommerce-email-composer' ),
+ 'groove' => __( 'Groove', 'mailtpl-woocommerce-email-composer' ),
+ 'dotted' => __( 'Dotted', 'mailtpl-woocommerce-email-composer' ),
+ 'dashed' => __( 'Dashed', 'mailtpl-woocommerce-email-composer' ),
+ 'ridge' => __( 'Ridge', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '.title-style-below #template_body h2' => array( 'border-bottom-style' ),
+ '.title-style-above #template_body h2' => array( 'border-top-style' ),
+ ),
+ ),
+ // separator color
+ 'h2_separator_color' => array(
+ 'title' => __( 'H2 Separator Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'h2_separator_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '.title-style-below #template_body h2' => array( 'border-bottom-color' ),
+ '.title-style-above #template_body h2' => array( 'border-top-color' ),
+ ),
+ ),
+ // H3 TEXT STYLE
+ // h3 Info
+ 'h3_font_info' => array(
+ 'title' => __( 'H3 Settings', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'control_type' => 'kwdinfoblock',
+ 'description' => '',
+ ),
+ // Font size
+ 'h3_font_size' => array(
+ 'title' => __( 'H3 Font Size', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h3_font_size' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h3' => array( 'font-size' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 8,
+ 'max' => 30,
+ ),
+ ),
+ // h3 Line Height.
+ 'h3_line_height' => array(
+ 'title' => __( 'H3 Line Height', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_line_height' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h3' => array( 'line-height' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 10,
+ 'max' => 90,
+ ),
+ ),
+ // h3 Font family.
+ 'h3_font_family' => array(
+ 'title' => __( 'H3 Font Family', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h2_font_family' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_font_families(),
+ 'selectors' => array(
+ '#template_body h3' => array( 'font-family' ),
+ ),
+ ),
+ // h3 Font style.
+ 'h3_font_style' => array(
+ 'title' => __( 'H3 Font Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h3_font_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'normal' => __( 'Normal', 'mailtpl-woocommerce-email-composer' ),
+ 'italic' => __( 'Italic', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '#template_body h3' => array( 'font-style' ),
+ ),
+ ),
+ // h3 Font weight.
+ 'h3_font_weight' => array(
+ 'title' => __( 'H3 Font weight', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'headings_style',
+ 'default' => self::get_default_value( 'h3_font_weight' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h3' => array( 'font-weight' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 100,
+ 'min' => 100,
+ 'max' => 900,
+ ),
+ ),
+ // H3 color.
+ 'h3_color' => array(
+ 'title' => __( 'H3 Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'headings_style',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'h3_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_body h3' => array( 'color' ),
+ ),
+ ),
+ // Order ITEMS.
+ 'order_items_style' => array(
+ 'title' => __( 'Order Table Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'items_table',
+ 'default' => self::get_default_value( 'order_items_style' ),
+ 'transport' => 'refresh',
+ 'type' => 'select',
+ 'choices' => array(
+ 'normal' => __( 'Normal', 'mailtpl-woocommerce-email-composer' ),
+ 'light' => __( 'Light', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ ),
+ // Order ITEMS Image.
+ 'order_items_image' => array(
+ 'title' => __( 'Product Image Option', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'items_table',
+ 'default' => self::get_default_value( 'order_items_image' ),
+ 'transport' => 'refresh',
+ 'type' => 'select',
+ 'choices' => array(
+ 'normal' => __( 'Do not show', 'mailtpl-woocommerce-email-composer' ),
+ 'show' => __( 'Show', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ ),
+ // Order ITEMS Image size.
+ 'order_items_image_size' => array(
+ 'title' => __( 'Product Image Size', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'items_table',
+ 'default' => self::get_default_value( 'order_items_image_size' ),
+ 'transport' => 'refresh',
+ 'type' => 'select',
+ 'choices' => array(
+ '40x40' => __( '40x40', 'mailtpl-woocommerce-email-composer' ),
+ '50x50' => __( '50x50', 'mailtpl-woocommerce-email-composer' ),
+ '100x50' => __( '100x50', 'mailtpl-woocommerce-email-composer' ),
+ '100x100' => __( '100x100', 'mailtpl-woocommerce-email-composer' ),
+ '150x150' => __( '150x150', 'mailtpl-woocommerce-email-composer' ),
+ 'woocommerce_thumbnail' => __( 'Woocommerce Thumbnail', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ ),
+ // Items table Background color.
+ 'items_table_background_color' => array(
+ 'title' => __( 'Order Table Background color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'items_table',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'items_table_background_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner table.td' => array( 'background-color' ),
+ ),
+ ),
+ // Items table Background color.
+ 'items_table_background_odd_color' => array(
+ 'title' => __( 'Order Table Background Odd Row Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'items_table',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'items_table_background_odd_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner table.td tbody tr:nth-child(even)' => array( 'background-color' ),
+ '#body_content_inner table.td thead tr' => array( 'background-color' ),
+ '#body_content_inner table.td tfoot tr:nth-child(odd)' => array( 'background-color' ),
+ ),
+ ),
+
+ // Items table Padding.
+ 'items_table_padding' => array(
+ 'title' => __( 'Padding Top and Bottom', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'items_table',
+ 'default' => self::get_default_value( 'items_table_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '.order-items-normal #body_content_inner table.td th' => array( 'padding-top', 'padding-bottom' ),
+ '.order-items-normal #body_content_inner table.td td' => array( 'padding-top', 'padding-bottom' ),
+ '.order-items-light #body_content_inner table.td th' => array( 'padding-top', 'padding-bottom' ),
+ '.order-items-light #body_content_inner table.td td' => array( 'padding-top', 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 50,
+ ),
+ ),
+ // Items table Padding Left and Right.
+ 'items_table_padding_left_right' => array(
+ 'title' => __( 'Padding Left and Right', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'items_table',
+ 'default' => str_replace( 'px', '', Mailtpl_Woomail_Customizer::opt( 'items_table_padding' ) ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '.order-items-normal #body_content_inner table.td th' => array( 'padding-left', 'padding-right' ),
+ '.order-items-normal #body_content_inner table.td td' => array( 'padding-left', 'padding-right' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 50,
+ ),
+ ),
+
+ // Items table Border width
+ 'items_table_border_width' => array(
+ 'title' => __( 'Border Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'items_table',
+ 'default' => self::get_default_value( 'items_table_border_width' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '.order-items-normal #body_content_inner .td' => array( 'border-width' ),
+ '.order-items-light #body_content_inner table.td .td' => array( 'border-bottom-width' ),
+ '.order-items-light #body_content_inner table.td' => array( 'border-top-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 10,
+ ),
+ ),
+
+ // Items table Border color
+ 'items_table_border_color' => array(
+ 'title' => __( 'Border Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'items_table',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'items_table_border_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner .td' => array( 'border-color' ),
+ ),
+ ),
+ // tems table border style
+ 'items_table_border_style' => array(
+ 'title' => __( 'Border Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'items_table',
+ 'default' => self::get_default_value( 'items_table_border_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'solid' => __( 'Solid', 'mailtpl-woocommerce-email-composer' ),
+ 'double' => __( 'Double', 'mailtpl-woocommerce-email-composer' ),
+ 'groove' => __( 'Groove', 'mailtpl-woocommerce-email-composer' ),
+ 'dotted' => __( 'Dotted', 'mailtpl-woocommerce-email-composer' ),
+ 'dashed' => __( 'Dashed', 'mailtpl-woocommerce-email-composer' ),
+ 'ridge' => __( 'Ridge', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '.order-items-normal #body_content_inner .td' => array( 'border-style' ),
+ '.order-items-light #body_content_inner table.td .td' => array( 'border-bottom-style' ),
+ '.order-items-light #body_content_inner table.td' => array( 'border-top-style' ),
+ ),
+ ),
+ // Order ITEMS
+ 'order_heading_style' => array(
+ 'title' => __( 'Order Table Heading Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'items_table',
+ 'default' => self::get_default_value( 'order_heading_style' ),
+ 'transport' => 'refresh',
+ 'type' => 'select',
+ 'choices' => array(
+ 'normal' => __( 'Normal', 'mailtpl-woocommerce-email-composer' ),
+ 'split' => __( 'Split', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ ),
+ 'notes_outside_table' => array(
+ 'title' => __( 'Enable Order Notes to be moved below table.', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'items_table',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( 'notes_outside_table' ),
+ 'active_callback' => array(
+ 'id' => 'responsive_mode',
+ 'compare' => '==',
+ 'value' => false,
+ ),
+ ),
+ // addresses Background color
+ 'addresses_background_color' => array(
+ 'title' => __( 'Address Box Background color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'addresses',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'addresses_background_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner .address-td' => array( 'background-color' ),
+ ),
+ ),
+ // addresses Padding
+ 'addresses_padding' => array(
+ 'title' => __( 'Address Box Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'addresses',
+ 'default' => self::get_default_value( 'addresses_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner .address-td' => array( 'padding' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 100,
+ ),
+ ),
+ // addresses Border width
+ 'addresses_border_width' => array(
+ 'title' => __( 'Address Box Border Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'addresses',
+ 'default' => self::get_default_value( 'addresses_border_width' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner .address-td' => array( 'border-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 10,
+ ),
+ ),
+ // addresses Border color
+ 'addresses_border_color' => array(
+ 'title' => __( 'Address Box Border Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'addresses',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'addresses_border_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner .address-td' => array( 'border-color' ),
+ ),
+ ),
+ // h2 style
+ 'addresses_border_style' => array(
+ 'title' => __( 'Address Box Border Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'addresses',
+ 'default' => self::get_default_value( 'addresses_border_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'solid' => __( 'Solid', 'mailtpl-woocommerce-email-composer' ),
+ 'double' => __( 'Double', 'mailtpl-woocommerce-email-composer' ),
+ 'groove' => __( 'Groove', 'mailtpl-woocommerce-email-composer' ),
+ 'dotted' => __( 'Dotted', 'mailtpl-woocommerce-email-composer' ),
+ 'dashed' => __( 'Dashed', 'mailtpl-woocommerce-email-composer' ),
+ 'ridge' => __( 'Ridge', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '#body_content_inner .address-td' => array( 'border-style' ),
+ ),
+ ),
+ // addresses color
+ 'addresses_text_color' => array(
+ 'title' => __( 'Address Box Text Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'addresses',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'addresses_text_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#body_content_inner .address-td' => array( 'color' ),
+ ),
+ ),
+ // addresses text align
+ 'addresses_text_align' => array(
+ 'title' => __( 'Address Box Text Align', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'addresses',
+ 'default' => self::get_default_value( 'addresses_text_align' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_text_aligns(),
+ 'selectors' => array(
+ '#body_content_inner .address-td' => array( 'text-align' ),
+ ),
+ ),
+ // Footer Background Width
+ 'footer_background_placement' => array(
+ 'title' => __( 'Footer Background Placement', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_style',
+ 'default' => self::get_default_value( 'footer_background_placement' ),
+ 'transport' => 'refresh',
+ 'type' => 'select',
+ 'choices' => array(
+ 'inside' => __( 'Inside Body Container', 'mailtpl-woocommerce-email-composer' ),
+ 'outside' => __( 'Outside Body Container', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ ),
+ // Footer Background Color
+ 'footer_background_color' => array(
+ 'title' => __( 'Footer Background Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_style',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'footer_background_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer_container' => array( 'background-color' ),
+ '.gmail-app-fix' => array( 'background-color' ),
+ ),
+ ),
+ // Footer Top Padding
+ 'footer_top_padding' => array(
+ 'title' => __( 'Top Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_style',
+ 'default' => self::get_default_value( 'footer_top_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #template_footer_inside' => array( 'padding-top' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Footer Bottom Padding
+ 'footer_bottom_padding' => array(
+ 'title' => __( 'Bottom Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_style',
+ 'default' => self::get_default_value( 'footer_bottom_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #template_footer_inside' => array( 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Footer left and right Padding
+ 'footer_left_right_padding' => array(
+ 'title' => __( 'Left/Right Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_style',
+ 'default' => self::get_default_value( 'footer_left_right_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #template_footer_inside' => array( 'padding-left', 'padding-right' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ 'footer_social_enable' => array(
+ 'title' => __( 'Enable Social Section', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'toggleswitch',
+ 'section' => 'footer_social',
+ 'transport' => 'refresh',
+ 'default' => self::get_default_value( 'footer_social_enable' ),
+ ),
+ // Footer social repeater
+ 'footer_social_repeater' => array(
+ 'title' => __( 'Footer Social Options', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'repeater',
+ 'transport' => 'refresh',
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'social_options' ),
+ 'customizer_repeater_image_control' => true,
+ 'customizer_repeater_icon_control' => true,
+ 'customizer_repeater_icon_color' => true,
+ 'customizer_repeater_title_control' => true,
+ 'customizer_repeater_link_control' => true,
+ 'santitize_callback' => 'customizer_repeater_sanitize',
+ ),
+ // Footer Social Title Color
+ 'footer_social_title_color' => array(
+ 'title' => __( 'Footer Social Title Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'footer_social_title_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer a.ft-social-link' => array( 'color' ),
+ ),
+ 'control_type' => 'color',
+ ),
+ // Footer Social Title Font size
+ 'footer_social_title_size' => array(
+ 'title' => __( 'Footer Social Title Font Size', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'footer_social_title_font_size' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer .ft-social-title' => array( 'font-size' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 8,
+ 'max' => 30,
+ ),
+ ),
+ // Footer Social Title Font family
+ 'footer_social_title_font_family' => array(
+ 'title' => __( 'Footer Social Title Font Family', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'footer_social_title_font_family' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_font_families(),
+ 'selectors' => array(
+ '#template_footer a.ft-social-link' => array( 'font-family' ),
+ ),
+ ),
+ // Footer Social Title Font weight
+ 'footer_social_title_font_weight' => array(
+ 'title' => __( 'Footer Social Title Font Weight', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'footer_social_title_font_weight' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer .ft-social-title' => array( 'font-weight' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 100,
+ 'min' => 100,
+ 'max' => 900,
+ ),
+ ),
+ // Footer Social Top Padding
+ 'footer_social_top_padding' => array(
+ 'title' => __( 'Top Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'footer_social_top_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #footersocial td' => array( 'padding-top' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Footer Social Bottom Padding
+ 'footer_social_bottom_padding' => array(
+ 'title' => __( 'Bottom Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'footer_social_bottom_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #footersocial td' => array( 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Footer Social Bottom Border width
+ 'footer_social_border_width' => array(
+ 'title' => __( 'Footer Social Bottom Border Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'footer_social_border_width' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#footersocial' => array( 'border-bottom-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 10,
+ ),
+ ),
+ // Footer Social Bottom Bordercolor
+ 'footer_social_border_color' => array(
+ 'title' => __( 'Footer Social Bottom Border Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_social',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'footer_social_border_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#footersocial' => array( 'border-bottom-color' ),
+ ),
+ ),
+ // Footer Social Bottom Border style
+ 'footer_social_border_style' => array(
+ 'title' => __( 'Footer Social Bottom Border Style', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_social',
+ 'default' => self::get_default_value( 'footer_social_border_style' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => array(
+ 'solid' => __( 'Solid', 'mailtpl-woocommerce-email-composer' ),
+ 'double' => __( 'Double', 'mailtpl-woocommerce-email-composer' ),
+ 'groove' => __( 'Groove', 'mailtpl-woocommerce-email-composer' ),
+ 'dotted' => __( 'Dotted', 'mailtpl-woocommerce-email-composer' ),
+ 'dashed' => __( 'Dashed', 'mailtpl-woocommerce-email-composer' ),
+ 'ridge' => __( 'Ridge', 'mailtpl-woocommerce-email-composer' ),
+ ),
+ 'selectors' => array(
+ '#footersocial' => array( 'border-bottom-style' ),
+ ),
+ ),
+ // Footer Text align
+ 'footer_text_align' => array(
+ 'title' => __( 'Text Align', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_content',
+ 'default' => self::get_default_value( 'footer_text_align' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_text_aligns(),
+ 'selectors' => array(
+ '#template_footer #credit' => array( 'text-align' ),
+ ),
+ ),
+
+ // Footer Font size
+ 'footer_font_size' => array(
+ 'title' => __( 'Font Size', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_content',
+ 'default' => self::get_default_value( 'footer_font_size' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #credit' => array( 'font-size' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 8,
+ 'max' => 30,
+ ),
+ ),
+ // Footer Font family
+ 'footer_font_family' => array(
+ 'title' => __( 'Font Family', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_content',
+ 'default' => self::get_default_value( 'footer_font_family' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_font_families(),
+ 'selectors' => array(
+ '#template_footer #credit' => array( 'font-family' ),
+ ),
+ ),
+
+ // Footer Font weight
+ 'footer_font_weight' => array(
+ 'title' => __( 'Font weight', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_content',
+ 'default' => self::get_default_value( 'footer_font_weight' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #credit' => array( 'font-weight' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 100,
+ 'min' => 100,
+ 'max' => 900,
+ ),
+ ),
+
+ // Footer Color
+ 'footer_color' => array(
+ 'title' => __( 'Text Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'footer_content',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'footer_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #credit' => array( 'color' ),
+ '#template_footer #credit p' => array( 'color' ),
+ '#template_footer #credit a' => array( 'color' ),
+ ),
+ ),
+ // Footer credit Top Padding
+ 'footer_credit_top_padding' => array(
+ 'title' => __( 'Top Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_content',
+ 'default' => self::get_default_value( 'footer_credit_top_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #credit' => array( 'padding-top' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Footer credit Bottom Padding
+ 'footer_credit_bottom_padding' => array(
+ 'title' => __( 'Bottom Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'footer_content',
+ 'default' => self::get_default_value( 'footer_credit_bottom_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ '#template_footer #credit' => array( 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Button Color.
+ 'btn_color' => array(
+ 'title' => __( 'Button Text Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a.btn' => array( 'color' ),
+ ),
+ 'control_type' => 'color',
+ ),
+ // Button Text Size.
+ 'btn_size' => array(
+ 'title' => __( 'Button Font Size', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_size' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a.btn' => array( 'font-size' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 8,
+ 'max' => 30,
+ ),
+ ),
+ // Button Font Family
+ 'btn_font_family' => array(
+ 'title' => __( 'Button Font Family', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_font_family' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_font_families(),
+ 'selectors' => array(
+ 'a.btn' => array( 'font-family' ),
+ ),
+ ),
+ // Button Font weight.
+ 'btn_font_weight' => array(
+ 'title' => __( 'Button Font Weight', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_font_weight' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a.btn' => array( 'font-weight' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 100,
+ 'min' => 100,
+ 'max' => 900,
+ ),
+ ),
+ // Button Background Color.
+ 'btn_bg_color' => array(
+ 'title' => __( 'Button Background Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_bg_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a.btn' => array( 'background' ),
+ ),
+ 'control_type' => 'color',
+ ),
+ // Button Top and bottom Padding.
+ 'btn_top_bottom_padding' => array(
+ 'title' => __( 'Top and Bottom Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_top_bottom_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a.btn' => array( 'padding-top', 'padding-bottom' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Button Left and Right Padding.
+ 'btn_left_right_padding' => array(
+ 'title' => __( 'Left and Right Padding', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_left_right_padding' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a.btn' => array( 'padding-left', 'padding-right' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 150,
+ ),
+ ),
+ // Button Border Width.
+ 'btn_border_width' => array(
+ 'title' => __( 'Button Border Width', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_border_width' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a.btn' => array( 'border-width' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 10,
+ ),
+ ),
+ // Border radius
+ 'btn_border_radius' => array(
+ 'title' => __( 'Border radius', 'mailtpl-woocommerce-email-composer' ),
+ 'control_type' => 'rangevalue',
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_border_radius' ),
+ 'live_method' => 'css',
+ 'description' => __( 'Warning: most desktop email clients do not yet support this.', 'mailtpl-woocommerce-email-composer' ),
+ 'selectors' => array(
+ 'a.btn' => array( 'border-radius' ),
+ ),
+ 'input_attrs' => array(
+ 'step' => 1,
+ 'min' => 0,
+ 'max' => 100,
+ ),
+ ),
+ // Button Bordercolor
+ 'btn_border_color' => array(
+ 'title' => __( 'Button Border Color', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'btn_styles',
+ 'control_type' => 'color',
+ 'default' => self::get_default_value( 'btn_border_color' ),
+ 'live_method' => 'css',
+ 'selectors' => array(
+ 'a.btn' => array( 'border-color' ),
+ ),
+ ),
+ // Button Text align
+ 'btn_text_align' => array(
+ 'title' => __( 'Button Align', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'btn_styles',
+ 'default' => self::get_default_value( 'btn_text_align' ),
+ 'live_method' => 'css',
+ 'type' => 'select',
+ 'choices' => self::get_text_aligns(),
+ 'selectors' => array(
+ '#body_content_inner .btn-container' => array( 'text-align' ),
+ ),
+ ),
+ 'custom_css' => array(
+ 'title' => __( 'Custom CSS', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'custom_styles',
+ 'default' => '',
+ 'type' => 'textarea',
+ 'live_method' => 'replace',
+ 'original' => '',
+ 'selectors' => array(
+ 'style#Mailtpl_Woomailcustom_css',
+ ),
+ ),
+ 'import_export' => array(
+ 'title' => __( 'Import Export', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'import_export',
+ 'default' => '',
+ 'control_type' => 'kwdimportexport',
+ ),
+ 'email_recipient' => array(
+ 'title' => __( 'Preview Email Recipient', 'mailtpl-woocommerce-email-composer' ),
+ 'description' => __( 'Enter recipients (comma separated) for preview emails', 'mailtpl-woocommerce-email-composer' ),
+ 'section' => 'send_email',
+ 'default' => self::get_default_value( 'email_recipient' ),
+ 'control_type' => 'kwdsendemail',
+ ),
+ );
+ $mainoptions = array_merge( $mainoptions, $main );
+ self::$settings = array_merge( $extra_email_text, $mainoptions );
+
+ }
+
+ // Return settings
+ return self::$settings;
+ }
+ /**
+ * Get default values
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_default_values() {
+ // Define default values
+ if ( is_null( self::$default_values ) ) {
+ $default_values = array(
+ 'preview_order_id' => 'mockup',
+ 'email_type' => 'new_order',
+ 'email_templates' => 'default',
+ 'body_background_color' => '#fdfdfd',
+ 'border_radius' => '3',
+ 'border_width' => '1',
+ 'border_color' => '#dedede',
+ 'responsive_mode' => false,
+ 'shadow' => '1',
+ 'content_width' => '600',
+ 'email_padding' => '70',
+ 'background_color' => '#ffffff',
+ 'header_image_maxwidth' => '300',
+ 'header_image_align' => 'center',
+ 'header_image_background_color' => 'transparent',
+ 'header_image_padding_top_bottom' => '0',
+ 'header_image_placement' => 'outside',
+ 'woocommerce_waitlist_mailout_body' => __( 'Hi There,', 'mailtpl-woocommerce-email-composer' ),
+ 'woocommerce_waitlist_mailout_heading' => __( '{product_title} is now back in stock at {site_title}', 'mailtpl-woocommerce-email-composer' ),
+ 'woocommerce_waitlist_mailout_subject' => __( 'A product you are waiting for is back in stock', 'mailtpl-woocommerce-email-composer' ),
+ 'new_renewal_order_heading' => __( 'New customer order', 'mailtpl-woocommerce-email-composer' ),
+ 'new_renewal_order_subject' => __( '[{site_title}] New customer order ({order_number}) - {order_date}', 'mailtpl-woocommerce-email-composer' ),
+ 'new_renewal_order_body' => __( 'You have received a subscription renewal order from {customer_full_name}. Their order is as follows:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_renewal_order_heading' => __( 'Thank you for your order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_renewal_order_subject' => __( 'Your {site_title} order receipt from {order_date}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_renewal_order_body' => __( 'Your subscription renewal order has been received and is now being processed. Your order details are shown below for your reference:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_renewal_order_heading' => __( 'Your order is complete', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_renewal_order_subject' => __( 'Your {site_title} order from {order_date} is complete', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_renewal_order_body' => __( 'Hi there. Your subscription renewal order with {site_title} has been completed. Your order details are shown below for your reference:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_switch_order_heading' => __( 'Your order is complete', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_switch_order_subject' => __( 'Your {site_title} order from {order_date} is complete', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_switch_order_body' => __( 'Hi there. You have successfully changed your subscription items on {site_title}. Your new order and subscription details are shown below for your reference:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_renewal_invoice_heading' => __( 'Invoice for order {order_number}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_renewal_invoice_subject' => __( 'Invoice for order {order_number}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_renewal_invoice_body' => __( 'An invoice has been created for you to renew your subscription with {site_title}. To pay for this invoice please use the following link: {invoice_pay_link}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_renewal_invoice_btn_switch' => false,
+ 'customer_renewal_invoice_body_failed' => __( 'The automatic payment to renew your subscription with {site_title} has failed. To reactivate the subscription, please login and pay for the renewal from your account page: {invoice_pay_link}', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_subscription_heading' => __( 'Subscription Cancelled', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_subscription_subject' => __( '[{site_title}] Subscription Cancelled', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_subscription_body' => __( 'A subscription belonging to {customer_full_name} has been cancelled. Their subscription\'s details are as follows:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_payment_retry_heading' => __( 'Automatic payment failed for order {order_number}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_payment_retry_subject' => __( 'Automatic payment failed for {order_number}, we will retry {retry_time}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_payment_retry_body' => '',
+ 'customer_payment_retry_override' => false,
+ 'customer_payment_retry_btn_switch' => false,
+ 'admin_payment_retry_heading' => __( 'Automatic renewal payment failed', 'mailtpl-woocommerce-email-composer' ),
+ 'admin_payment_retry_subject' => __( '[{site_title}] Automatic payment failed for {order_number}, retry scheduled to run {retry_time}', 'mailtpl-woocommerce-email-composer' ),
+ 'admin_payment_retry_body' => '',
+ 'admin_payment_retry_override' => false,
+ 'new_order_heading' => __( 'New customer order', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_order_heading' => __( 'Cancelled order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_order_heading' => __( 'Thank you for your order', 'mailtpl-woocommerce-email-composer' ),
+ 'new_order_additional_content' => __( 'Congratulations on the sale!', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_order_additional_content' => __( 'Thanks for using {site_address}!', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_order_additional_content' => __( 'Thanks for shopping with us.', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order_additional_content' => __( 'We hope to see you again soon.', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_on_hold_order_additional_content' => __( 'We look forward to fulfilling your order soon.', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_new_account_additional_content' => __( 'We look forward to seeing you soon.', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_reset_password_additional_content' => __( 'Thanks for reading.', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_order_heading' => __( 'Your order is complete', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order_heading_full' => __( 'Order {order_number} details', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order_heading_partial' => __( 'Your order has been partially refunded', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_on_hold_order_heading' => __( 'Thank you for your order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_invoice_heading' => __( 'Invoice for order {order_number}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_invoice_heading_paid' => __( 'Your order details', 'mailtpl-woocommerce-email-composer' ),
+ 'failed_order_heading' => __( 'Failed order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_new_account_heading' => __( 'Welcome to {site_title}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_note_heading' => __( 'A note has been added to your order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_reset_password_heading' => __( 'Password reset instructions', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_reset_password_btn_switch' => false,
+ 'new_order_subject' => __( '[{site_title}] New customer order ({order_number}) - {order_date}', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_order_subject' => __( '[{site_title}] Cancelled order ({order_number})', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_order_subject' => __( 'Your {site_title} order receipt from {order_date}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_order_subject' => __( 'Your {site_title} order from {order_date} is complete', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order_subject_full' => __( 'Your {site_title} order from {order_date} has been refunded', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order_subject_partial' => __( 'Your {site_title} order from {order_date} has been partially refunded', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_on_hold_order_subject' => __( 'Your {site_title} order receipt from {order_date}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_invoice_subject' => __( 'Invoice for order {order_number}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_invoice_subject_paid' => __( 'Your {site_title} order from {order_date}', 'mailtpl-woocommerce-email-composer' ),
+ 'failed_order_subject' => __( '[{site_title}] Failed order ({order_number})', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_new_account_subject' => __( 'Your account on {site_title}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_note_subject' => __( 'Note added to your {site_title} order from {order_date}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_reset_password_subject' => __( 'Password reset for {site_title}', 'mailtpl-woocommerce-email-composer' ),
+ 'new_order_body' => __( 'You have received an order from {customer_full_name}. The order is as follows:', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_order_body' => __( 'The order {order_number} from {customer_full_name} has been cancelled. The order was as follows:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_order_body' => __( 'Your order has been received and is now being processed. Your order details are shown below for your reference:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_order_body' => __( 'Hi there. Your recent order on {site_title} has been completed. Your order details are shown below for your reference:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order_switch' => true,
+ 'customer_refunded_order_body_full' => __( 'Hi there. Your order on {site_title} has been refunded.', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order_body_partial' => __( 'Hi there. Your order on {site_title} has been partially refunded.', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_on_hold_order_body' => __( 'Your order is on-hold until we confirm payment has been received. Your order details are shown below for your reference:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_invoice_switch' => true,
+ 'customer_invoice_btn_switch' => false,
+ 'customer_invoice_body' => __( 'An order has been created for you on {site_title}. {invoice_pay_link}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_invoice_body_paid' => '',
+ 'failed_order_body' => __( 'Payment for order {order_number} from {customer_full_name} has failed. The order was as follows:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_new_account_btn_switch' => false,
+ 'customer_new_account_account_section' => true,
+ 'customer_new_account_body' => __( 'Thanks for creating an account on {site_title}. Your username is {customer_username}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_note_body' => __( 'Hello, a note has just been added to your order:', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_reset_password_body' => __(
+ 'Someone requested that the password be reset for the following account:
+
+Username: {customer_username}
+
+If this was a mistake, just ignore this email and nothing will happen.
+
+To reset your password, visit the following address:',
+ 'mailtpl-woocommerce-email-composer'
+ ),
+ 'WC_Memberships_User_Membership_Ended_Email_heading' => __( 'Renew your {membership_plan}', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Ended_Email_subject' => __( 'Your {site_title} membership has expired', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Activated_Email_heading' => __( 'You can now access {membership_plan}', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Activated_Email_subject' => __( 'Your {site_title} membership is now active!', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Ending_Soon_Email_heading' => __( 'An update about your {membership_plan}', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Ending_Soon_Email_subject' => __( 'Your {site_title} membership ends soon!', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Note_Email_heading' => __( 'A note has been added about your membership', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Note_Email_subject' => __( 'Note added to your {site_title} membership', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Renewal_Reminder_Email_heading' => __( 'You can renew your {membership_plan}', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Renewal_Reminder_Email_subject' => __( 'Renew your {site_title} membership!', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_delivered_order_heading' => __( 'Thanks for shopping with us', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_delivered_order_subject' => __( 'Your {site_title} order is now delivered', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_delivered_order_body' => __(
+ 'Hi {customer_full_name}
+ Your {site_title} order has been marked delivered on our side.',
+ 'mailtpl-woocommerce-email-composer'
+ ),
+ 'header_background_color' => get_option( 'woocommerce_email_base_color' ),
+ 'header_text_align' => 'left',
+ 'header_padding_top_bottom' => '36',
+ 'header_padding_left_right' => '48',
+ 'heading_font_size' => '30',
+ 'heading_line_height' => '40',
+ 'heading_font_family' => 'helvetica',
+ 'heading_font_style' => 'normal',
+ 'heading_color' => '#ffffff',
+ 'heading_font_weight' => '300',
+ 'subtitle_placement' => 'below',
+ 'subtitle_font_size' => '18',
+ 'subtitle_line_height' => '24',
+ 'subtitle_font_family' => 'helvetica',
+ 'subtitle_font_style' => 'normal',
+ 'subtitle_color' => '#ffffff',
+ 'subtitle_font_weight' => '300',
+ 'content_padding' => '48',
+ 'content_padding_bottom' => '0',
+ 'text_color' => '#737373',
+ 'font_family' => 'helvetica',
+ 'font_size' => '14',
+ 'line_height' => '24',
+ 'font_weight' => '400',
+ 'link_color' => get_option( 'woocommerce_email_base_color' ),
+ 'h2_font_size' => '18',
+ 'h2_line_height' => '26',
+ 'h2_font_family' => 'helvetica',
+ 'h3_font_style' => 'normal',
+ 'h2_color' => get_option( 'woocommerce_email_base_color' ),
+ 'h2_font_weight' => '700',
+ 'h2_margin_bottom' => '18',
+ 'h2_padding_top' => '0',
+ 'h2_margin_top' => '0',
+ 'h2_padding_bottom' => '0',
+ 'h2_text_transform' => 'none',
+ 'h2_separator_color' => get_option( 'woocommerce_email_base_color' ),
+ 'h2_separator_height' => '1',
+ 'h2_separator_style' => 'solid',
+ 'h3_font_size' => '16',
+ 'h3_line_height' => '20',
+ 'h3_font_family' => 'helvetica',
+ 'h3_font_style' => 'normal',
+ 'h3_color' => '#787878',
+ 'h3_font_weight' => '500',
+ 'btn_border_width' => '0',
+ 'btn_border_radius' => '4',
+ 'btn_border_color' => '#dedede',
+ 'btn_font_family' => 'helvetica',
+ 'btn_color' => '#ffffff',
+ 'btn_font_weight' => '600',
+ 'btn_left_right_padding' => '8',
+ 'btn_top_bottom_padding' => '10',
+ 'btn_size' => '16',
+ 'order_items_style' => 'normal',
+ 'order_items_image' => 'normal',
+ 'order_items_image_size' => '100x50',
+ 'items_table_border_width' => '1',
+ 'items_table_border_color' => '#e4e4e4',
+ 'items_table_border_style' => 'solid',
+ 'items_table_background_color' => '',
+ 'items_table_background_odd_color' => '',
+ 'items_table_padding' => '12',
+ 'order_heading_style' => 'normal',
+ 'notes_outside_table' => false,
+ 'addresses_padding' => '12',
+ 'addresses_border_width' => '1',
+ 'addresses_border_color' => '#e5e5e5',
+ 'addresses_border_style' => 'solid',
+ 'addresses_background_color' => '',
+ 'addresses_text_color' => '#8f8f8f',
+ 'addresses_text_align' => 'left',
+ 'footer_background_placement' => 'inside',
+ 'footer_background_color' => '',
+ 'footer_top_padding' => '0',
+ 'footer_bottom_padding' => '48',
+ 'footer_left_right_padding' => '48',
+ 'footer_social_enable' => true,
+ 'footer_social_title_color' => '#000000',
+ 'footer_social_title_font_family' => 'helvetica',
+ 'footer_social_title_font_size' => '18',
+ 'footer_social_title_font_weight' => '400',
+ 'footer_social_top_padding' => '0',
+ 'footer_social_bottom_padding' => '0',
+ 'footer_social_border_width' => '0',
+ 'footer_social_border_color' => '#dddddd',
+ 'footer_social_border_style' => 'solid',
+ 'footer_text_align' => 'center',
+ 'footer_font_size' => '12',
+ 'footer_font_family' => 'helvetica',
+ 'footer_color' => '#555555',
+ 'footer_font_weight' => '400',
+ 'footer_credit_bottom_padding' => '0',
+ 'footer_credit_top_padding' => '0',
+ 'items_table_border_width' => '1',
+ 'items_table_border_color' => '#e4e4e4',
+ 'footer_content_text' => get_option( 'woocommerce_email_footer_text', '' ),
+ 'email_recipient' => get_option( 'admin_email' ),
+ 'customer_ekomi_heading' => _x( 'Please rate your Order', 'ekomi', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_new_account_activation_heading' => __( 'Account activation {site_title}', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_paid_for_order_heading' => __( 'Payment received', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_revocation_heading' => __( 'Your revocation', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_sepa_direct_debit_mandate' => __( 'SEPA Direct Debit Mandate', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_trusted_shops' => _x( 'Please rate your Order', 'trusted-shops', 'mailtpl-woocommerce-email-composer' ),
+ 'woocommerce_waitlist_mailout_hide_content' => false,
+ 'header_image_link' => true,
+ 'email_schema' => false,
+ );
+ self::$default_values = apply_filters( 'mailtpl_woomail_email_settings_default_values', $default_values );
+ }
+
+ // Return default values.
+ return self::$default_values;
+ }
+
+ /**
+ * Get default values
+ *
+ * @access public
+ * @param string $key the setting key.
+ * @return string
+ */
+ public static function get_default_value( $key ) {
+ // Get default values.
+ $default_values = self::get_default_values();
+
+ // Check if such key exists and return default value.
+ return isset( $default_values[ $key ] ) ? $default_values[ $key ] : '';
+ }
+
+ /**
+ * Get border styles
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_border_styles() {
+ return array(
+ 'none' => __( 'none', 'mailtpl-woocommerce-email-composer' ),
+ 'hidden' => __( 'hidden', 'mailtpl-woocommerce-email-composer' ),
+ 'dotted' => __( 'dotted', 'mailtpl-woocommerce-email-composer' ),
+ 'dashed' => __( 'dashed', 'mailtpl-woocommerce-email-composer' ),
+ 'solid' => __( 'solid', 'mailtpl-woocommerce-email-composer' ),
+ 'double' => __( 'double', 'mailtpl-woocommerce-email-composer' ),
+ 'groove' => __( 'groove', 'mailtpl-woocommerce-email-composer' ),
+ 'ridge' => __( 'ridge', 'mailtpl-woocommerce-email-composer' ),
+ 'inset' => __( 'inset', 'mailtpl-woocommerce-email-composer' ),
+ 'outset' => __( 'outset', 'mailtpl-woocommerce-email-composer' ),
+ );
+ }
+
+ /**
+ * Get text align options
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_text_aligns() {
+ return array(
+ 'left' => __( 'Left', 'mailtpl-woocommerce-email-composer' ),
+ 'center' => __( 'Center', 'mailtpl-woocommerce-email-composer' ),
+ 'right' => __( 'Right', 'mailtpl-woocommerce-email-composer' ),
+ 'justify' => __( 'Justify', 'mailtpl-woocommerce-email-composer' ),
+ );
+ }
+ /**
+ * Get image align options
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_image_aligns() {
+ return array(
+ 'left' => __( 'Left', 'mailtpl-woocommerce-email-composer' ),
+ 'center' => __( 'Center', 'mailtpl-woocommerce-email-composer' ),
+ 'right' => __( 'Right', 'mailtpl-woocommerce-email-composer' ),
+ );
+ }
+ /**
+ * Get Order Ids
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_order_ids() {
+ if ( is_null( self::$order_ids ) ) {
+ $order_array = array();
+ $order_array['mockup'] = __( 'Mockup Order', 'mailtpl-woocommerce-email-composer' );
+ $orders = new WP_Query(
+ array(
+ 'post_type' => 'shop_order',
+ 'post_status' => array_keys( wc_get_order_statuses() ),
+ 'posts_per_page' => 20,
+ )
+ );
+ if ( $orders->posts ) {
+ foreach ( $orders->posts as $order ) {
+ // Get order object.
+ $order_object = new WC_Order( $order->ID );
+ $order_array[ $order_object->get_id() ] = $order_object->get_id() . ' - ' . $order_object->get_billing_first_name() . ' ' . $order_object->get_billing_last_name();
+ }
+ }
+ self::$order_ids = $order_array;
+ }
+ return self::$order_ids;
+ }
+ /**
+ * Get font families
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_font_families() {
+ return apply_filters( 'mailtpl_woomail_email_font_families', self::$font_family_mapping );
+ }
+
+ /**
+ * Get Email Types
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_email_types() {
+ if ( is_null( self::$email_types ) ) {
+ $types = array(
+ 'new_order' => __( 'New Order', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_order' => __( 'Cancelled Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_order' => __( 'Customer Processing Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_order' => __( 'Customer Completed Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order' => __( 'Customer Refunded Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_on_hold_order' => __( 'Customer On Hold Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_invoice' => __( 'Customer Invoice', 'mailtpl-woocommerce-email-composer' ),
+ 'failed_order' => __( 'Failed Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_new_account' => __( 'Customer New Account', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_note' => __( 'Customer Note', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_reset_password' => __( 'Customer Reset Password', 'mailtpl-woocommerce-email-composer' ),
+ );
+ if ( class_exists( 'WC_Subscriptions' ) ) {
+ $types = array_merge( $types, array(
+ 'new_renewal_order' => __( 'New Renewal Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_renewal_order' => __( 'Customer Processing Renewal Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_renewal_order' => __( 'Customer Completed Renewal Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_switch_order' => __( 'Customer Completed Switch Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_renewal_invoice' => __( 'Customer Renewal Invoice', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_subscription' => __( 'Cancelled Subscription', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_payment_retry' => __( 'Customer Payment Retry', 'mailtpl-woocommerce-email-composer' ),
+ 'admin_payment_retry' => __( 'Payment Retry', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+ if ( class_exists( 'WC_Memberships' ) ) {
+ $types = array_merge( $types, array(
+ 'WC_Memberships_User_Membership_Note_Email' => __( 'User Membership Note', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Ending_Soon_Email' => __( 'User Membership Ending Soon', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Ended_Email' => __( 'User Membership Ended', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Renewal_Reminder_Email' => __( 'User Membership Renewal Reminder', 'mailtpl-woocommerce-email-composer' ),
+ 'WC_Memberships_User_Membership_Activated_Email' => __( 'User Membership Activated', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+ if ( class_exists( 'WCMp' ) ) {
+ $types = array_merge( $types, array(
+ 'vendor_new_account' => __( 'New Vendor Account', 'mailtpl-woocommerce-email-composer' ),
+ 'admin_new_vendor' => __( 'Admin New Vendor Account', 'mailtpl-woocommerce-email-composer' ),
+ 'approved_vendor_new_account' => __( 'Approved Vendor Account', 'mailtpl-woocommerce-email-composer' ),
+ 'rejected_vendor_new_account' => __( 'Rejected Vendor Account', 'mailtpl-woocommerce-email-composer' ),
+ 'vendor_new_order' => __( 'Vendor New order', 'mailtpl-woocommerce-email-composer' ),
+ 'notify_shipped' => __( 'Notify as Shipped.', 'mailtpl-woocommerce-email-composer' ),
+ 'admin_new_vendor_product' => __( 'New Vendor Product', 'mailtpl-woocommerce-email-composer' ),
+ 'admin_added_new_product_to_vendor' => __( 'New Vendor Product By Admin', 'mailtpl-woocommerce-email-composer' ),
+ 'vendor_commissions_transaction' => __( 'Transactions (for Vendor)', 'mailtpl-woocommerce-email-composer' ),
+ 'vendor_direct_bank' => __( 'Commission Paid (for Vendor) by BAC', 'mailtpl-woocommerce-email-composer' ),
+ 'admin_widthdrawal_request' => __( 'Withdrawal request to Admin from Vendor by BAC', 'mailtpl-woocommerce-email-composer' ),
+ 'vendor_orders_stats_report' => __( 'Vendor orders stats report', 'mailtpl-woocommerce-email-composer' ),
+ 'vendor_contact_widget_email' => __( 'Vendor Contact Email', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+ if ( class_exists( 'WooCommerce_Germanized' ) ) {
+ $types = array_merge( $types, array(
+ 'customer_ekomi' => __( 'eKomi Review Reminder', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_new_account_activation' => __( 'New account activation', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_paid_for_order' => __( 'Paid for order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_revocation' => __( 'Revocation', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_trusted_shops' => __( 'Trusted Shops Review Reminder', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+ if ( class_exists( 'WooCommerce_Waitlist_Plugin' ) ) {
+ $types = array_merge( $types, array(
+ 'woocommerce_waitlist_mailout' => __( 'Waitlist Mailout', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+ if ( class_exists( 'WC_Stripe' ) ) {
+ $types = array_merge( $types, array(
+ 'failed_renewal_authentication' => __( 'Failed Subscription Renewal SCA Authentication', 'mailtpl-woocommerce-email-composer' ),
+ 'failed_preorder_sca_authentication' => __( 'Pre-order Payment Action Needed', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+ if ( class_exists( 'WC_Stripe' ) && class_exists( 'WC_Subscriptions' ) ) {
+ $types = array_merge( $types, array(
+ 'failed_authentication_requested' => __( 'Payment Authentication Requested Email', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+ // if ( class_exists( 'Cartflows_Ca_Email_Templates' ) ) {
+ // $email_tmpl = Cartflows_Ca_Email_Templates::get_instance();
+ // $templates = $email_tmpl->fetch_all_active_templates();
+ // if ( ! empty( $templates ) ) {
+ // $emails = array();
+ // foreach ( $templates as $key => $value ) {
+ // $emails['cartflows_ca_email_templates_' . $value->id] = 'CA: ' . $value->template_name;
+ // }
+ // $types = array_merge( $types, $emails );
+ // }
+ // }
+ self::$email_types = apply_filters( 'mailtpl_woomail_email_types', $types );
+ }
+
+ return self::$email_types;
+ }
+
+ /**
+ * Get Email Types
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_customized_email_types() {
+ if ( is_null( self::$customized_email_types ) ) {
+ $types = array(
+ 'new_order' => __( 'New Order', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_order' => __( 'Cancelled Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_order' => __( 'Customer Processing Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_order' => __( 'Customer Completed Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_refunded_order' => __( 'Customer Refunded Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_on_hold_order' => __( 'Customer On Hold Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_invoice' => __( 'Customer Invoice', 'mailtpl-woocommerce-email-composer' ),
+ 'failed_order' => __( 'Failed Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_new_account' => __( 'Customer New Account', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_note' => __( 'Customer Note', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_reset_password' => __( 'Customer Reset Password', 'mailtpl-woocommerce-email-composer' ),
+ );
+ if ( class_exists( 'WC_Subscriptions' ) ) {
+ $types = array_merge( $types, array(
+ 'new_renewal_order' => __( 'New Renewal Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_processing_renewal_order' => __( 'Customer Processing Renewal Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_renewal_order' => __( 'Customer Completed Renewal Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_completed_switch_order' => __( 'Customer Completed Switch Order', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_renewal_invoice' => __( 'Customer Renewal Invoice', 'mailtpl-woocommerce-email-composer' ),
+ 'cancelled_subscription' => __( 'Cancelled Subscription', 'mailtpl-woocommerce-email-composer' ),
+ 'customer_payment_retry' => __( 'Customer Payment Retry', 'mailtpl-woocommerce-email-composer' ),
+ 'admin_payment_retry' => __( 'Payment Retry', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+ if ( class_exists( 'WooCommerce_Waitlist_Plugin' ) ) {
+ $types = array_merge( $types, array(
+ 'woocommerce_waitlist_mailout' => __( 'Waitlist Mailout', 'mailtpl-woocommerce-email-composer' ),
+ ) );
+ }
+
+ self::$customized_email_types = apply_filters( 'mailtpl_woomail_customized_email_types', $types );
+ }
+
+ return self::$customized_email_types;
+ }
+
+ /**
+ * Get Email Templates
+ *
+ * @access public
+ * @return array
+ */
+ public static function get_email_templates() {
+ return apply_filters( 'mailtpl_woomail_prebuilt_email_templates_settings', self::$prebuilt_templates_mapping );
+ }
+ }
+}
diff --git a/includes/class-mailtpl-woomail-woo.php b/includes/class-mailtpl-woomail-woo.php
new file mode 100644
index 0000000..b53ee29
--- /dev/null
+++ b/includes/class-mailtpl-woomail-woo.php
@@ -0,0 +1,127 @@
+ 'mailtpl_woomail',
+ 'type' => 'title',
+ 'title' => __('Woocommerce Email Composer', 'mailtpl-woocommerce-email-composer'),
+ );
+
+ // Add Open Composer button
+ $settings[] = array(
+ 'id' => 'mailtpl_woomail_open_customizer_button',
+ 'type' => 'mailtpl_woomail_open_customizer_button',
+ );
+
+ // Close section
+ $settings[] = array(
+ 'id' => 'mailtpl_woomail',
+ 'type' => 'sectionend',
+ );
+
+ // Return remaining settings
+ return $settings;
+
+ }
+
+ /**
+ * Print Open Composer button
+ *
+ * @access public
+ * @param array $options settings options.
+ * @return void
+ */
+ public function print_open_customizer_button( $options ) {
+ ?>
+
+
+
+
+
+
+
+
+
+
+ Email Templates plugin by wpexpertsio .', 'mailtpl-woocommerce-email-composer' ), 'https://wordpress.org/plugins/email-templates/', 'https://wpexperts.io/' ); ?>
+
+
+
+ * @author wpexperts
*/
class Mailtpl {
-
+
public $customizer;
public $admin;
public $mailer;
@@ -126,7 +126,7 @@ public function __construct() {
* Create an instance of the loader which will be used to register the hooks
* with WordPress.
*
- * @since 1.0.0
+ * @since 1.0.0
* @access private
*/
private function load_dependencies() {
@@ -171,7 +171,7 @@ private function define_hooks() {
$this->admin = new Mailtpl_Admin( $this->get_plugin_name(), $this->get_version() );
$this->customizer = new Mailtpl_Customizer( $this->get_plugin_name(), $this->get_version() );
$this->mailer = new Mailtpl_Mailer( $this->get_plugin_name(), $this->get_version() );
-
+
$this->loader->add_action( 'admin_menu', $this->admin, 'add_menu_link' );
$this->loader->add_action( 'admin_enqueue_scripts', $this->admin, 'wp_pointers', 1000 );
$this->loader->add_action( 'mailtpl/admin_pointers-plugins', $this->admin, 'add_wp_pointer' );
@@ -189,6 +189,8 @@ private function define_hooks() {
$this->loader->add_action( 'customize_panel_active', $this->customizer, 'remove_other_panels', 10, 2 );
$this->loader->add_action( 'template_include', $this->customizer, 'capture_customizer_page', 30000 );
}
+
+ add_action( 'woocommerce_email_header', array( $this, 'add_email_header' ) );
$this->loader->add_filter( 'wp_mail', $this->mailer, 'send_email', 100 );
$this->loader->add_action( 'wp_ajax_mailtpl_send_email', $this->mailer, 'send_test_email' );
@@ -199,7 +201,7 @@ private function define_hooks() {
$this->loader->add_filter( 'mailtpl/email_content', $this->mailer, 'clean_retrieve_password' );
$this->loader->add_filter('gform_html_message_template_pre_send_email',$this->mailer, 'gform_template');
-
+
if( isset( $_GET['mailtpl_display'] ) ) {
$this->loader->add_action( 'customize_controls_enqueue_scripts', $this->customizer, 'enqueue_scripts' );
$this->loader->add_action( 'customize_preview_init', $this->customizer, 'enqueue_template_scripts', 99 );
@@ -208,6 +210,11 @@ private function define_hooks() {
}
}
+ public function add_email_header( $ins ) {
+ remove_filter( 'wp_mail', array( $this->mailer, 'send_email'), 100 );
+ remove_action( 'wp_ajax_mailtpl_send_email', array( $this->mailer, 'send_test_email') );
+ }
+
/**
* Run the loader to execute all of the hooks with WordPress.
@@ -286,4 +293,4 @@ public static function defaults() {
'custom_css' => '',
));
}
-}
+}
diff --git a/index.php b/index.php
index e71af0e..4e6c07c 100755
--- a/index.php
+++ b/index.php
@@ -1 +1,3 @@
-
\ No newline at end of file
diff --git a/preview.php b/preview.php
new file mode 100644
index 0000000..ba9ce78
--- /dev/null
+++ b/preview.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/wcmp/vendor-new-order.php b/templates/wcmp/vendor-new-order.php
new file mode 100644
index 0000000..afecf35
--- /dev/null
+++ b/templates/wcmp/vendor-new-order.php
@@ -0,0 +1,107 @@
+
+
+get_billing_first_name() . ' ' . $order->get_billing_last_name() ); ?>
+
+
+
+
+
+ term_id); ?>
+
+
+
+ term_id); ?>
+
+
+
+ vendor_order_item_table( $order, $vendor->term_id );
+ ?>
+
+
+id)) {
+ ?>
+
+ wcmp_vendor_get_order_item_totals($order, $vendor->term_id);
+ if ($totals) {
+ foreach ($totals as $total_key => $total) {
+ ?>
+
+
+
+
+ id)) {
+ ?>
+
+ get_billing_email()) { ?>
+ get_billing_first_name() . ' ' . $order->get_billing_last_name(); ?>
+ get_billing_email(); ?>
+
+ get_billing_phone()) { ?>
+ get_billing_phone(); ?>
+ id)) {
+ ?>
+
+
+
+
+ get_formatted_billing_address(); ?>
+
+
+
+
+
+id)) { ?>
+ get_formatted_shipping_address())) { ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/woo/emails/admin-cancelled-order.php b/templates/woo/emails/admin-cancelled-order.php
new file mode 100644
index 0000000..0f4eacb
--- /dev/null
+++ b/templates/woo/emails/admin-cancelled-order.php
@@ -0,0 +1,68 @@
+
diff --git a/templates/woo/emails/admin-payment-retry.php b/templates/woo/emails/admin-payment-retry.php
new file mode 100644
index 0000000..93b90af
--- /dev/null
+++ b/templates/woo/emails/admin-payment-retry.php
@@ -0,0 +1,68 @@
+
+ get_order_number(), $order->get_formatted_billing_full_name(), wcs_get_human_time_diff( $retry->get_time() ) ) ); ?>
+
+
+
+
+
+
+
+
+ #get_order_number() ); ?>
+
+
+
+ get_formatted_order_total() ); ?>
+
+
+
+
+
+
+ get_time( 'last_order_date_created', 'site' );
+ if ( ! empty( $last_order_time_created ) ) {
+ echo esc_html( date_i18n( wc_date_format(), $last_order_time_created ) );
+ } else {
+ esc_html_e( '-', 'mailtpl-woocommerce-email-composer' );
+ }
+ ?>
+
+
+
+
+ get_time( 'end', 'site' ) ) ); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #get_order_number() ); ?>
+
+
+ get_formatted_order_total() ); ?>
+
+
+ get_time( 'last_order_date_created', 'site' );
+ if ( ! empty( $last_order_time_created ) ) {
+ echo esc_html( date_i18n( wc_date_format(), $last_order_time_created ) );
+ } else {
+ esc_html_e( '-', 'mailtpl-woocommerce-email-composer' );
+ }
+ ?>
+
+
+ get_time( 'end', 'site' ) ) ); ?>
+
+
+
+
+
+
diff --git a/templates/woo/emails/customer-completed-order.php b/templates/woo/emails/customer-completed-order.php
new file mode 100644
index 0000000..84c26d4
--- /dev/null
+++ b/templates/woo/emails/customer-completed-order.php
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/woo/emails/customer-completed-switch-order.php b/templates/woo/emails/customer-completed-switch-order.php
new file mode 100644
index 0000000..4fc1830
--- /dev/null
+++ b/templates/woo/emails/customer-completed-switch-order.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/woo/emails/customer-invoice.php b/templates/woo/emails/customer-invoice.php
new file mode 100644
index 0000000..88001a0
--- /dev/null
+++ b/templates/woo/emails/customer-invoice.php
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+ ' . esc_html( $user_pass ) . '' ); ?>
+
+
+' . esc_html__( 'You can access your account area to view your orders and change your password.', 'mailtpl-woocommerce-email-composer' ) . ' ';
+ echo '' . esc_html__( 'View Account', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else {
+ ?>
+
+
+
+
+
+
+
+
+
+ get_time() ) ), array( 'a' => array( 'href' => true ) ) );
+ ?>
+
+ ' . esc_html__( 'To reactivate the subscription now, you can also login and pay for the renewal from your account page:', 'mailtpl-woocommerce-email-composer' ) . '';
+ echo '' . esc_html__( 'Pay Now »', 'mailtpl-woocommerce-email-composer' ) . '
';
+ } else {
+ ?>
+
+ get_checkout_payment_url() ) . '">', '' ), array( 'a' => array( 'href' => true ) ) );
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/woo/emails/customer-refunded-order.php b/templates/woo/emails/customer-refunded-order.php
new file mode 100644
index 0000000..ac38760
--- /dev/null
+++ b/templates/woo/emails/customer-refunded-order.php
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
diff --git a/templates/woo/emails/customer-reset-password.php b/templates/woo/emails/customer-reset-password.php
new file mode 100644
index 0000000..ab091eb
--- /dev/null
+++ b/templates/woo/emails/customer-reset-password.php
@@ -0,0 +1,59 @@
+' . esc_html__( 'Reset Password', 'mailtpl-woocommerce-email-composer' ) . ' ';
+} else {
+ ?>
+
+
+
+
+
+
+
diff --git a/templates/woo/emails/email-addresses.php b/templates/woo/emails/email-addresses.php
new file mode 100644
index 0000000..0ee9731
--- /dev/null
+++ b/templates/woo/emails/email-addresses.php
@@ -0,0 +1,131 @@
+get_formatted_billing_address();
+$shipping = $order->get_formatted_shipping_address();
+$responsive_check = Mailtpl_Woomail_Customizer::opt( 'responsive_mode' );
+if ( true == $responsive_check ) {
+ ?>
+
+
+
+
+
+
+
+
+
+
+ get_billing_phone() ) :
+ ?>
+ get_billing_phone() ); ?>
+
+ get_billing_email() ) : ?>
+ get_billing_email() ); ?>
+
+
+
+
+
+
+
+ needs_shipping_address() && $shipping ) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ get_billing_phone() ) :
+ ?>
+ get_billing_phone() ); ?>
+
+ get_billing_email() ) : ?>
+ get_billing_email() ); ?>
+
+
+
+
+
+
+ needs_shipping_address() && $shipping ) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/woo/emails/email-downloads.php b/templates/woo/emails/email-downloads.php
new file mode 100644
index 0000000..6dce02a
--- /dev/null
+++ b/templates/woo/emails/email-downloads.php
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+ $column_name ) : ?>
+
+
+
+
+
+
+
+ $column_name ) : ?>
+
+
+
+
+
+
+
+ ' . esc_html__( 'Expires: Never', 'mailtpl-woocommerce-email-composer' ) . ' ';
+ }
+ }
+ break;
+ case 'download-expires':
+ if ( ! empty( $download['access_expires'] ) ) {
+ ?>
+
+
+
+
+
+
+
diff --git a/templates/woo/emails/email-footer.php b/templates/woo/emails/email-footer.php
new file mode 100644
index 0000000..8abdaf5
--- /dev/null
+++ b/templates/woo/emails/email-footer.php
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+