Newsletter - Version 7.0.4

Version Description

  • Redesigned drag and drop composer
  • NEW! Save drag and drop composed newsletters as templates to reuse easily
  • Redesigned dashboard
  • Several bug and fixes
Download this release

Release Info

Developer satollo
Plugin Icon 128x128 Newsletter
Version 7.0.4
Comparing to
See all releases

Code changes from version 7.0.3 to 7.0.4

Files changed (122) hide show
  1. admin.css +45 -13
  2. admin.js +1 -2
  3. admin.min.css +1 -1
  4. css/dashboard.css +271 -0
  5. css/dashboard.min.css +1 -0
  6. emails/blocks/canspam/_icon.png +0 -0
  7. emails/blocks/canspam/block.php +49 -43
  8. emails/blocks/canspam/icon.png +0 -0
  9. emails/blocks/canspam/options.php +10 -2
  10. emails/blocks/cta/_icon.png +0 -0
  11. emails/blocks/cta/block.php +27 -38
  12. emails/blocks/cta/icon.png +0 -0
  13. emails/blocks/cta/options.php +10 -7
  14. emails/blocks/footer/_icon.png +0 -0
  15. emails/blocks/footer/block.php +18 -11
  16. emails/blocks/footer/icon.png +0 -0
  17. emails/blocks/footer/options.php +9 -3
  18. emails/blocks/giphy/_icon.png +0 -0
  19. emails/blocks/giphy/block.php +37 -37
  20. emails/blocks/giphy/icon.png +0 -0
  21. emails/blocks/header/_icon.png +0 -0
  22. emails/blocks/header/block.php +97 -89
  23. emails/blocks/header/icon.png +0 -0
  24. emails/blocks/header/options.php +22 -16
  25. emails/blocks/heading/_icon.png +0 -0
  26. emails/blocks/heading/block.php +27 -22
  27. emails/blocks/heading/icon.png +0 -0
  28. emails/blocks/heading/options.php +2 -2
  29. emails/blocks/hero/_icon.png +0 -0
  30. emails/blocks/hero/block-full.php +11 -7
  31. emails/blocks/hero/block-left.php +12 -11
  32. emails/blocks/hero/block-right.php +12 -11
  33. emails/blocks/hero/block.php +31 -21
  34. emails/blocks/hero/icon.png +0 -0
  35. emails/blocks/hero/options.php +9 -9
  36. emails/blocks/hero/style.css +2 -7
  37. emails/blocks/hero/style.min.css +1 -0
  38. emails/blocks/html/_icon.png +0 -0
  39. emails/blocks/html/block.php +41 -41
  40. emails/blocks/html/icon.png +0 -0
  41. emails/blocks/image/_icon.png +0 -0
  42. emails/blocks/image/block.php +26 -12
  43. emails/blocks/image/icon.png +0 -0
  44. emails/blocks/image/options.php +14 -4
  45. emails/blocks/posts/_icon.png +0 -0
  46. emails/blocks/posts/block.php +57 -38
  47. emails/blocks/posts/icon.png +0 -0
  48. emails/blocks/posts/layout-big-image.php +54 -25
  49. emails/blocks/posts/layout-full-post.php +125 -0
  50. emails/blocks/posts/layout-one-2.php +162 -0
  51. emails/blocks/posts/layout-one.php +58 -26
  52. emails/blocks/posts/layout-two.php +215 -171
  53. emails/blocks/posts/options.php +63 -40
  54. emails/blocks/posts/style.min.css +1 -0
  55. emails/blocks/preheader/_icon.png +0 -0
  56. emails/blocks/preheader/block.php +66 -60
  57. emails/blocks/preheader/icon.png +0 -0
  58. emails/blocks/preheader/options.php +10 -10
  59. emails/blocks/separator/_icon.png +0 -0
  60. emails/blocks/separator/block.php +31 -31
  61. emails/blocks/separator/icon.png +0 -0
  62. emails/blocks/social/_icon.png +0 -0
  63. emails/blocks/social/block.php +125 -125
  64. emails/blocks/social/icon.png +0 -0
  65. emails/blocks/text/_icon.png +0 -0
  66. emails/blocks/text/block.php +18 -15
  67. emails/blocks/text/icon.png +0 -0
  68. emails/blocks/text/options.php +16 -11
  69. emails/composer.php +51 -8
  70. emails/emails.php +367 -86
  71. emails/images/_rawhtml.png +0 -0
  72. emails/images/automated.png +0 -0
  73. emails/images/autoresponder.png +0 -0
  74. emails/images/html.png +0 -0
  75. emails/images/rawhtml.png +0 -0
  76. emails/index.php +2 -1
  77. emails/presets/announcement/icon.png +0 -0
  78. emails/presets/blank-icon.png +0 -0
  79. emails/presets/blank/icon.png +0 -0
  80. emails/presets/blank/preset.json +0 -4
  81. emails/presets/cta/icon.png +0 -0
  82. emails/presets/default-icon.png +0 -0
  83. emails/presets/invite/icon.png +0 -0
  84. emails/presets/posts/icon.png +0 -0
  85. emails/presets/product/icon.png +0 -0
  86. emails/presets/sales/icon.png +0 -0
  87. emails/presets/simple/icon.png +0 -0
  88. emails/presets/tour/icon.png +0 -0
  89. emails/theme.php +14 -35
  90. emails/themes/default/theme.php +2 -2
  91. emails/tnp-composer/_css/newsletter-builder-v2.css +207 -81
  92. emails/tnp-composer/_css/newsletter-builder-v2.min.css +1 -0
  93. emails/tnp-composer/_css/tnp-modal.css +103 -0
  94. emails/tnp-composer/_css/tnp-toast.css +131 -0
  95. emails/tnp-composer/_scripts/modal.js +202 -0
  96. emails/tnp-composer/_scripts/newsletter-builder-v2.js +487 -191
  97. emails/tnp-composer/_scripts/newsletter-builder-v2.min.js +14 -12
  98. emails/tnp-composer/_scripts/tnp-toast.js +138 -0
  99. emails/tnp-composer/css/newsletter.css +19 -0
  100. emails/tnp-composer/css/newsletter.min.css +1 -1
  101. emails/tnp-composer/index-v2.php +50 -15
  102. images/subject/android.png +0 -0
  103. images/subject/gmail.png +0 -0
  104. images/subject/iphone.png +0 -0
  105. includes/addon.php +8 -0
  106. includes/composer.php +125 -24
  107. includes/controls.php +86 -46
  108. includes/fields.php +88 -30
  109. includes/helper.php +0 -3
  110. main/images/dashboard/forms.png +0 -0
  111. main/images/dashboard/lists.png +0 -0
  112. main/images/dashboard/videos.png +0 -0
  113. main/index.php +260 -338
  114. plugin.php +3 -2
  115. readme.txt +18 -3
  116. style.css +1 -1
  117. subscription/subscription.php +1 -1
  118. tnp-header.php +1 -1
  119. unsubscription/unsubscription.php +217 -217
  120. vendor/spectrum/LICENSE +20 -0
  121. vendor/spectrum/spectrum.min.css +1 -1
  122. vendor/spectrum/spectrum.min.js +1 -1
admin.css CHANGED
@@ -25,6 +25,38 @@
25
  margin-left: -15px;
26
  }*/
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  .row:before,
29
  .row:after {
30
  display: table;
@@ -386,6 +418,18 @@
386
  width: auto;
387
  }
388
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  table.clicks td {
390
  border: 1px solid #666;
391
  padding: 2px;
@@ -723,7 +767,6 @@ p.description {
723
  }
724
 
725
  .tnp-theme-preview .tnp-theme-html {
726
- height: 250px;
727
  width: auto;
728
  }
729
 
@@ -2285,17 +2328,6 @@ span.tnp-email-status-sent {
2285
  white-space: nowrap;
2286
  }
2287
 
2288
-
2289
- /* Composer/themes choice panel */
2290
-
2291
- .tnp-themes-new {
2292
- border-bottom: 2px solid #243342;
2293
- margin-bottom: 30px;
2294
- padding-bottom: 30px;
2295
- }
2296
-
2297
-
2298
-
2299
  /* Schedule buttons styles */
2300
 
2301
  #tnp-schedule-button {
@@ -2476,4 +2508,4 @@ span.tnp-email-status-sent {
2476
  .sp-replacer {
2477
  width: 30px!important;
2478
  height: 30px!important;
2479
- }
25
  margin-left: -15px;
26
  }*/
27
 
28
+ .container {
29
+ width: 100%;
30
+ padding-right: 1rem;
31
+ padding-left: 1rem;
32
+ margin-right: auto;
33
+ margin-left: auto;
34
+ }
35
+
36
+ @media (min-width: 576px) {
37
+ .container {
38
+ max-width: 540px;
39
+ }
40
+ }
41
+
42
+ @media (min-width: 768px) {
43
+ .container {
44
+ max-width: 720px;
45
+ }
46
+ }
47
+
48
+ @media (min-width: 992px) {
49
+ .container {
50
+ max-width: 960px;
51
+ }
52
+ }
53
+
54
+ @media (min-width: 1200px) {
55
+ .container {
56
+ max-width: 1140px;
57
+ }
58
+ }
59
+
60
  .row:before,
61
  .row:after {
62
  display: table;
418
  width: auto;
419
  }
420
 
421
+ #tnp-body td .tnp-tabs {
422
+
423
+ }
424
+
425
+ #tnp-body td .tnp-tabs .ui-widget-header {
426
+ background-color: #ddd;
427
+ }
428
+
429
+ #tnp-body td .tnp-tabs .ui-tabs-anchor {
430
+ color: #000;
431
+ }
432
+
433
  table.clicks td {
434
  border: 1px solid #666;
435
  padding: 2px;
767
  }
768
 
769
  .tnp-theme-preview .tnp-theme-html {
 
770
  width: auto;
771
  }
772
 
2328
  white-space: nowrap;
2329
  }
2330
 
 
 
 
 
 
 
 
 
 
 
 
2331
  /* Schedule buttons styles */
2332
 
2333
  #tnp-schedule-button {
2508
  .sp-replacer {
2509
  width: 30px!important;
2510
  height: 30px!important;
2511
+ }
admin.js CHANGED
@@ -142,7 +142,6 @@ window.onload = function () {
142
  * https://seballot.github.io/spectrum/
143
  */
144
  function tnp_controls_init() {
145
- console.log('Controls init');
146
  jQuery(".tnpf-color").spectrum({
147
  type: 'color',
148
  allowEmpty: true,
@@ -183,4 +182,4 @@ function tnp_fields_media_mini_remove(name) {
183
  $field.val("");
184
  $field.trigger("change");
185
  document.getElementById(name + "_img").src = "";
186
- }
142
  * https://seballot.github.io/spectrum/
143
  */
144
  function tnp_controls_init() {
 
145
  jQuery(".tnpf-color").spectrum({
146
  type: 'color',
147
  allowEmpty: true,
182
  $field.val("");
183
  $field.trigger("change");
184
  document.getElementById(name + "_img").src = "";
185
+ }
admin.min.css CHANGED
@@ -1 +1 @@
1
- #tnp-wrap *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#tnp-wrap .iris-picker,#tnp-wrap .iris-picker *{-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#tnp-wrap *:before,#tnp-wrap *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}@media all and (max-width:1100px){.col-md-12{width:100%}.col-md-11{width:100%}.col-md-10{width:100%}.col-md-9{width:100%}.col-md-8{width:100%}.col-md-7{width:100%}.col-md-6{width:100%}.col-md-5{width:100%}.col-md-4{width:100%}.col-md-3{width:100%}.col-md-2{width:100%}.col-md-1{width:100%}}.tnp-row-padded{width:90%;margin:0 auto;display:flex;justify-content:space-between}.tnp-col-3-boxed{width:30%;border:1px solid #3c414c;padding:0 0 30px 0;border-radius:10px}.tnp-margin-top{margin-top:80px}#tnp-wrap,#tnp-header,#tnp-body p,#tnp-body td,#tnp-body td p,#tnp-body input,#tnp-body select,#tnp-body textarea{font-family:soleil,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#tnp-body h1,#tnp-body h2,#tnp-body h3,#tnp-body h4{font-family:soleil,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#tnp-promotion-bar{background-color:#ff5f65;color:ddd;padding:10px 0;text-align:center;font-size:16px}#tnp-promotion-bar a{color:#fff;font-weight:normal;text-decoration:none}#tnp-header{text-align:left;font-size:12px;color:#fff;font-family:soleil,sans-serif}#tnp-header input{font-size:12px}#tnp-header a{text-decoration:none;color:white;letter-spacing:.1em}#tnp-header a:hover{color:#fff}.error a,.error a:hover{color:#000!important}.updated a,.updated a:hover{color:#000!important}.tnp-error{border-left:5px solid #d00;background-color:#fff;padding:15px;margin:15px 0;font-size:1.2em;line-height:1.5em}.tnp-warning{border-left:5px solid #ffb900;background-color:#fff;padding:15px;margin:15px 0;font-size:1.2em;line-height:1.5em}.tnp-message{border-left:5px solid #46b450;background-color:#fff;padding:15px;margin:15px 0;font-size:1.2em;line-height:1.5em}#tnp-body h1,#tnp-body h2,#tnp-body h3,#tnp-body h4,#tnp-body p{color:#fff}#tnp-body a,#tnp-body a:active{color:#2980b9}#tnp-body a:hover{color:#3498db}#tnp-body .tnp-submit{margin-bottom:10px}#tnp-body .button,#tnp-body .button:visited,#tnp-body .button:hover,#tnp-body .button:active,#tnp-body .button:focus,#tnp-body .button-primary,#tnp-body .button-primary:visited,#tnp-body .button-primary:hover,#tnp-body .button-secondary,#tnp-body .button-secondary:visited,#tnp-body .button-secondary:hover{color:#fff;background-color:#3498db;text-shadow:none;width:auto}#tnp-body span.wp-media-buttons-icon:before{color:#fff}#tnp-body .tnp-button{color:#fff;background-color:#3498db;text-shadow:none}#tnp-body .button-primary.tnp-button-white,#tnp-body .tnp-button.tnp-button-white{color:#444!important;background-color:#fff!important;box-shadow:none!important;-webkit-box-shadow:none!important;width:auto}#tnp-body .form-table h1,#tnp-body .form-table h2,#tnp-body .form-table h4,#tnp-body .form-table h3{color:#444}#tnp-body tbody th,#tnp-body td,#tnp-body td p,#tnp-body td .button,#tnp-body td .button:visited,#tnp-body td .button:hover,#tnp-body td .button:active,#tnp-body td .button:focus{color:#444}#tnp-body td a,#tnp-body td a:visited{color:#27ae60}#tnp-body .form-table{background-color:#fff;border:1px solid #ecf0f1;margin-top:2em;border-spacing:4px;border-collapse:separate}#tnp-body .form-table th{text-align:right;font-weight:bold;max-width:200px;color:#000;background-color:#ecf0f1;vertical-align:middle}#tnp-body .form-table th small{font-weight:normal}#tnp-body .form-table textarea{width:100%}#tnp-body .form-table table{border-collapse:collapse}#tnp-body .form-table table td,.form-table table th{padding:5px;font-size:.9em;font-weight:normal;border:1px solid #eee}#tnp-body .form-table table thead th{text-align:left;font-weight:bold}#tnp-body .widefat{width:90%}#tnp-body .widefat th{text-align:left}#tnp-body .widefat thead{background-color:#3498db;font-family:soleil,sans-serif;color:#fff!important}#tnp-body .widefat thead tr th{color:#fff!important}#tnp-body .widefat td,.widefat th{vertical-align:middle}.tnp-newsletters-list tbody tr{height:70px}.widefat tr:nth-child(even){background-color:#f4faff}#tnp-body #tabs h1,#tnp-body #tabs h2,#tnp-body #tabs h3,#tnp-body #tabs h4,#tnp-body #tabs p,#tnp-body #tabs td,#tnp-body #tabs th,#tnp-body #tabs input,#tnp-body #tabs select,#tnp-body #tabs textarea,#tnp-body #tabs a{color:#444}#tnp-body #tabs .button,#tnp-body #tabs .button:visited,#tnp-body #tabs .button:hover,#tnp-body #tabs .button-primary,#tnp-body #tabs .button-primary:visited,#tnp-body #tabs .button-primary:hover,#tnp-body #tabs .button-secondary,#tnp-body #tabs .button-secondary:visited,#tnp-body #tabs .button-secondary:hover{color:#fff;width:auto}table.clicks td{border:1px solid #666;padding:2px;font-size:10px}table.clicks{border-collapse:collapse}.grid{border-collapse:collapse}.grid td,.grid th{padding:10px;border:1px solid #ddd;margin:0}.grid th{background-color:#aaa}.tnp-checkboxes label{display:block;float:left;width:220px;border:1px solid #ccc;background-color:#f4f4f4;margin-bottom:5px;padding:5px;white-space:nowrap;margin-right:5px}.tnp-buttons{padding:10px}.newsletter-checkbox-group,.nl-checkbox-group{float:left;margin-right:5px;border:1px solid #ccc;background-color:#f4f4f4;margin-bottom:5px;padding:5px;white-space:nowrap;overflow:hidden}.newsletter-checkboxes-item{float:left;margin-right:5px;border:1px solid #ddd;border-radius:3px;background-color:#f4f4f4;width:150px;margin-bottom:5px;padding:3px;white-space:nowrap;overflow:hidden}.newsletter-checkboxes-item input{vertical-align:text-bottom}.newsletter-checkboxes-item label{display:inline}.newsletter-preferences-item{float:left;margin-right:5px;border:1px solid #ccc;background-color:#f4f4f4;width:250px;margin-bottom:5px;padding:5px;white-space:nowrap;overflow:hidden}.newsletter-preferences-item label{display:inline}.form-table td .nl-checkbox-group label{display:inline}.tnp-notice{padding:15px;margin:10px 0;padding-right:70px;position:relative;border:1px solid #eee;background-color:#fff;color:#444;font-size:13px;border-left:5px solid #27ae60}.tnp-notice a{color:#0073aa;text-decoration:none;font-weight:bold}.tnp-notice a.tnp-dismiss{display:block;position:absolute;right:10px;top:13px;font-size:25px;text-decoration:none;color:#666}.tnp-notice input[type=email]{margin:10px 5px 5px;width:250px;border:0;box-shadow:none;background-color:#ecf0f1;padding:8px}.tnp-notice input[type=submit]{border:0;box-shadow:none;background-color:#27ae60;padding:8px;font-family:soleil,sans-serif;font-size:13px;color:#fff;cursor:pointer}.newsletter-message{background-color:#efe;border-color:#393;border-radius:5px;border-style:solid;border-width:3px;padding:.6em;margin-bottom:.6em}.newsletter-error-span{color:#f00;font-weight:bold}.newsletter-error{background-color:#fee;border-color:#933;border-radius:5px;border-style:solid;border-width:2px;padding:.6em;margin-bottom:.6em}.newsletter-error strong,.newsletter-message strong{font-weight:bold}#newsletter-warnings{background-color:#ffebe8;border-color:#C00;border-radius:3px;border-style:solid;border-width:1px;padding:.6em;margin-bottom:.6em}.newsletter-buttons{margin-top:1em;margin-bottom:1em}.tnp-paginator{margin-top:10px;margin-bottom:5px}.newsletter-option-grid th{text-align:right;width:auto;border:0;padding:3px;font-weight:normal;vertical-align:top;padding-right:15px}.newsletter-option-grid td{border:0;padding:3px;vertical-align:top}.newsletter-box{border:1px solid #ddd;padding:10px;background-color:#fafafa;margin-bottom:15px}.newsletter-box h3{margin-top:0}.newsletter-textarea-preview{border:1px solid #ddd}.tnp-tab-notice{background-color:#fff;border:1px solid #eee;border-left:3px solid gray;padding:10px;margin:10px 0;color:#444}.tnp-tab-warning{background-color:#fff;border:1px solid #eee;border-left:3px solid orange;padding:10px;margin:10px 0;color:#444}.tnp-tab-success{background-color:#fff;border:1px solid #eee;border-left:3px solid green;padding:10px;margin:10px 0;color:#444}.tnp-tab-error{background-color:#fff;border:1px solid #eee;border-left:3px solid red;padding:10px;margin:10px 0;color:#444}.tnp-tip{margin-top:5px}.tip-button{padding:0 5px;color:#fd5f65;text-transform:uppercase;letter-spacing:.2em;font-size:10px;border:1px red solid}.tip-content{font-weight:500;font-size:11px;color:#999}p.description{font-size:12px!important}.tnp-theme-preview{display:inline-block;text-align:center}.tnp-theme-preview p{font-family:soleil;font-size:13px;letter-spacing:.2em;color:#fff}.tnp-theme-preview img:hover{box-shadow:3px 3px 8px 2px #293848}.tnp-theme-preview img{border-radius:10px;height:190px;width:auto}.tnp-theme-preview .tnp-theme-composer{height:250px;width:auto}.tnp-theme-preview .tnp-theme-html{height:250px;width:auto}.tnp-header-logo{margin-left:10px}.wp-core-ui .button-primary{background-color:#2b2f3a;color:#fff;width:auto}#tnp-body{padding:10px;background-color:#28313c}.tnp-darkbg{background-color:#34495e!important}#tnp-body h3{margin-top:25px;clear:both;margin-bottom:10px}.tnp-body-lite{background-color:#f1f1f1!important}#tnp-heading{padding:10px;margin-bottom:10px;border-radius:5px}#tnp-heading a{color:#fff;border-bottom:1px solid #fff;text-decoration:none}#tnp-heading a:hover{color:#27ae60;border-bottom:1px solid #27ae60}#tnp-heading div p{color:#565656}#tnp-heading h2{color:#fff;font-family:soleil,sans-serif;letter-spacing:.1rem;font-size:1.1rem;line-height:1.8rem;text-transform:uppercase;vertical-align:middle;font-weight:700;padding:0;margin:0;margin-bottom:15px}#tnp-heading h3{color:#27ae60;font-family:soleil,sans-serif;letter-spacing:.1rem;font-size:.8rem;line-height:1.8rem;text-transform:uppercase;vertical-align:middle;font-weight:700;padding:0;margin:0}#tnp-heading p{margin:0;color:#ccc}#tnp-heading .notice p{margin:.5em 0;padding:2px}#tnp-heading .tnp-btn-h1{color:#fff;background-color:#3498db;border-radius:3px;padding:6px 11px;text-decoration:none;text-transform:capitalize;font-family:soleil,sans-serif;margin-left:10px;font-size:.75rem;font-weight:300;border:0}#tnp-heading .tnp-btn-h1:hover{color:#fff;background-color:#5dade2;-webkit-transition:background-color .25s linear;transition:background-color .25s linear;-webkit-font-smoothing:subpixel-antialiased;border:0;color:#fff}.metabox-holder{width:100%}.postbox{border:0}.postbox h3 a{float:right}#dashboard-widgets .postbox-container{width:33.333%}#tnp-body .postbox p{color:#000}#dashboard-widgets .postbox-container .postbox h3{font-family:soleil,sans-serif;letter-spacing:.05rem;background-color:#415b76;color:#fff;margin:0;padding:9px}#dashboard-widgets .postbox-container h3 a{color:white;text-decoration:none;margin-left:5px;padding:2px 8px;background-color:#26c281;border-radius:2px;font-weight:300;text-transform:capitalize;font-size:.8rem}#dashboard-widgets .postbox-container h3 a:hover{color:white;text-decoration:none;margin-left:5px;background-color:#2ecc71}.postbox-container i{margin-right:3px}#tnp-dash-newsletters tr td:last-of-type{width:80px;text-align:right}#tnp-dash-subscribers tr td:last-of-type{width:80px;text-align:right}#tnp-dash-subscribers tr td:first-of-type{width:250px;overflow:hidden}#tnp-dash-subscribers table{table-layout:fixed}#tnp-dash-documentation .inside div{margin-top:10px}#tnp-dash-documentation .inside a{text-decoration:none;color:#fff;display:block;font-family:soleil,sans-serif;padding:5px 10px}#tnp-footer{margin-top:10px;padding:20px 10px 10px 40px;background-color:#28313c;font-family:soleil,sans-serif}#tnp-footer div{width:33%;display:inline-block}#tnp-footer a{color:#fff;text-decoration:none}#tnp-footer a:hover{color:#bdc3c7}#tnp-footer input[type="submit"]{background-color:#2ecc71;border:0;padding:5px;color:#fff}#tnp-footer form{white-space:nowrap}#tnp-footer li{display:inline;margin-left:15px;padding:2px 5px;border-left:3px solid #2ecc71}#wpwrap{background-color:#222b36!important}#dashboard-widgets .button{border:0;background:0;box-shadow:none;color:#322c39}#dashboard-widgets .button:hover{background-color:#ecf0f1}.wp-core-ui .button-secondary,.wp-core-ui .button-primary{background-color:#3498db;border:0;box-shadow:none;color:#fff;font-family:soleil,sans-serif;margin:0 2px;width:auto}.wp-core-ui .button-secondary,.wp-core-ui .button,.wp-core-ui .button-primary{background-color:#3498db;box-shadow:none;color:#fff;font-family:soleil,sans-serif;margin:0 2px}.wp-core-ui .button-secondary:hover,.wp-core-ui .button:hover,.wp-core-ui .button-primary:hover{background-color:#5dade2;color:#fff;width:auto}span.wp-media-buttons-icon:before{color:#fff}.tnp-paginator [value="Go"]{background-color:#27ae60}.tnp-paginator [value="Go"]:hover{background-color:#2ecc71}.notice-dismiss{padding:3px}.tnp-paginator{color:#fff;font-family:soleil,sans-serif;margin:10px 0}.tnp-paginator .button-secondary{padding:5px;line-height:normal;height:auto;font-size:12px;height:25px;border:0;border-radius:3px;vertical-align:baseline}.tnp-paginator [value="Go"]{background-color:#27ae60!important}.tnp-paginator [value="Go"]:hover{background-color:#2ecc71!important}.tnp-paginator input{background-color:#2c3e50;border:0;border-radius:3px;color:#fff;padding:5px;line-height:normal;font-size:12px;height:25px}.tnp-subscribers-search{color:#fff;font-family:soleil,sans-serif;background-color:#2c3e50;padding:20px;border-radius:5px;margin-bottom:20px;display:inline-block}.tnp-subscribers-search select{margin-left:5px;padding:0;line-height:inherit}.tnp-video-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden}.tnp-video-container iframe,.tnp-video-container object,.tnp-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%}.bg-white{background-color:#FFF}.orange{background-color:#f39c12}.blue{background-color:#2980b9}.purple{background-color:#8e44ad}.notice a{color:#27ae60!important;text-decoration:underline!important}.tnp-chart{border:1px solid #eee;width:100%}.tnp-db-table{width:auto;background-color:#fff}.tnp-db-table thead{border-bottom:1px solid #eee}.tnp-db-table th{font-weight:bold}.tnp-db-table td,.tnp-db-table th{padding:3px;font-family:monospace;border:0}.tnp-main-status h3,.tnp-main-status h4{color:#fff}#tnp-status-table .tnp-ok{font-weight:bold;color:white;font-size:14px;background-color:#27ae60;padding:2px 10px;border-radius:10px;display:inline-block;width:75px;text-align:center}#tnp-status-table .tnp-ko{font-weight:bold;color:white;font-size:14px;background-color:#e74c41;padding:2px 10px;border-radius:10px;display:inline-block;width:75px;text-align:center}#tnp-status-table .tnp-maybe{font-weight:bold;color:white;font-size:14px;background-color:#f1c40f;padding:2px 10px;border-radius:10px;display:inline-block;width:75px;text-align:center}.tnp-main-status .tnp-log-files li{padding-left:15px}.tnp-main-status .tnp-log-files li,.tnp-main-status .tnp-log-files li a{color:#fff}.tnp-main-status .tnp-log-files .tnp-log-size{font-style:italic}table.widefat{border:0;box-shadow:none}#tnp-status-table tbody tr:nth-child(2n+1){background-color:#ecf0f1;border-radius:2px;margin:5px}#tnp-parameters-table tbody tr:nth-child(2n+1){background-color:#ecf0f1;border-radius:2px;margin:5px}#tnp-body .ui-widget{font-family:soleil,sans-serif}#tnp-body #tabs{background-color:transparent;border:0!important;padding:0;margin:0}#tnp-body #tabs .ui-widget-header{background:#28313c;border:0}#tnp-body #tabs .ui-tabs-panel{padding:15px!important;background-color:#fff}#tnp-body #tabs a.ui-tabs-anchor,#tnp-body #tabs a.ui-tabs-anchor:visited{color:#444}#tnp-body .ui-tabs .ui-tabs-nav{padding:0}#tnp-body .ui-tabs .ui-tabs-nav li a{font-size:14px}#tnp-body #tabs .ui-tabs{border-color:#28313c;background-color:#28313c;border:0}#tnp-body #tabs .ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0 0;background-color:#f2f2f2}#tnp-body #tabs .ui-tabs .ui-tabs-panel{padding:1em 0;background-color:#f2f2f2;margin:0;border:0}#tnp-body .ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{background:#fff!important;font-weight:normal;font-family:soleil,sans-serif}#tnp-body .ui-widget-content{background:#fff}#tnp-body .ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:0;background:#ecf0f1;font-family:soleil,sans-serif}.tnp-extension-premium-box,.tnp-extension-free-box,.tnp-integration-box{width:300px;height:220px;background-color:#222b36;text-align:center;margin:20px;float:left;position:relative}.tnp-extension-premium-box:hover,.tnp-extension-free-box:hover,.tnp-integration-box:hover{background-color:#232c35;box-shadow:1px 1px 15px #222b36}.tnp-extension-premium-box p,.tnp-extension-free-box p,.tnp-integration-box p{padding:5px 10px;color:#72777c;font-size:14px;margin-top:0}.tnp-extension-premium-box h3{font-family:soleil,sans-serif;padding:5px 8px!important;border-radius:3px;display:inline-block;font-size:16px;color:#fff;margin-bottom:0!important;margin-top:25px!important;font-weight:300;width:auto!important;border-bottom:none!important}.tnp-extension-free-box h3{font-family:soleil,sans-serif;padding:5px 8px!important;border-radius:3px;display:inline-block;font-size:16px;color:#fff;margin-bottom:0!important;margin-top:25px!important;font-weight:300;width:auto!important;border-bottom:none!important}.tnp-integration-box h3{font-family:soleil,sans-serif;padding:5px 8px!important;border-radius:3px;display:inline-block;font-size:16px;color:#fff;margin-bottom:0!important;margin-top:25px!important;font-weight:300;width:auto!important;border-bottom:none!important}.tnp-extension-premium-action{bottom:0;position:absolute;width:100%;padding:12px;font-family:soleil,sans-serif}.tnp-extension-free-action{bottom:0;position:absolute;width:100%;padding:12px;font-family:soleil,sans-serif}.tnp-integration-action{bottom:0;position:absolute;width:100%;padding:12px;font-family:soleil,sans-serif}.tnp-extension-premium-action span{color:#27ae60}.tnp-extension-free-action span{color:#27ae60}.tnp-integration-action span{color:#27ae60}.tnp-extension-activate{color:#1abc9c;padding:5px 8px;text-decoration:none;cursor:pointer}.tnp-extension-install{color:#2980b9;padding:5px 8px;text-decoration:none;cursor:pointer}.tnp-extension-buy{color:#f1c40f;padding:5px 8px;text-decoration:none;cursor:pointer}#tnp-body a.tnp-extension-details{color:#999;padding:5px 8px;text-decoration:none;cursor:pointer}.tnp-extension-free{color:#d35400;padding:5px 8px;text-decoration:none;cursor:pointer;position:relative}img.tnp-extensions-free-badge{position:absolute;display:block;right:0;top:0;width:70px}.tnp-extensions-image img{margin:25px 0 -10px}#tnp-subscribe-overlay{height:100vh;width:100vw;z-index:10000;display:none;background-image:url(images/modal-background.png);background-repeat:repeat;position:fixed;top:0;left:-20px}#tnp-subscribe-modal{width:600px;background-color:rgba(255,255,255,1);margin-right:auto;margin-left:auto;margin-top:100px;-webkit-box-shadow:0 0 20px 0 rgba(0,0,0,0.5);-moz-box-shadow:0 0 20px 0 rgba(0,0,0,0.5);box-shadow:0 0 20px 0 rgba(0,0,0,0.5);padding:25px;background-color:#1d2b38;text-align:center}#tnp-subscribe-modal img{width:30%}#tnp-subscribe-title{font-size:20px;margin-top:30px;margin-bottom:30px;line-height:30px;color:white;font-weight:200}#tnp-subscribe-email-wrapper{margin:20px}#tnp-subscribe-email-wrapper input{border:0;background-color:#223242;color:white}#tnp-subscribe-email{font-size:24px;box-sizing:border-box;width:100%;padding:10px;text-align:center}#tnp-subscribe-submit-wrapper{margin-bottom:20px}#tnp-subscribe-submit{font-size:24px;background-color:#219050;color:#fff;padding:10px 35px;border:0;font-size:17px;letter-spacing:2px}#tnp-subscribe-no-thanks{color:#666;margin-top:20px;margin-bottom:20px}#tnp-body div.tnp-emails-theme-options{background-color:#fff;padding:10px;margin-top:14px}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:0;background:#ecf0f1;font-family:soleil,sans-serif}.cd-slider-wrapper{position:relative;width:100%;height:90vh;overflow:hidden;margin:0 auto}.cd-slider-wrapper .cd-slider,.cd-slider-wrapper .cd-slider>li{height:100%;width:100%}.tnp-logo-big{width:300px}.tnp-row{display:table-row}.tnp-third{width:33%;float:left}.tnp-welcome-confirm-button{color:#fff;padding:10px 30px;background-color:#2ecc71;font-weight:700;font-size:15px;box-shadow:0 20px 38px rgba(0,0,0,0.16);text-decoration:none;display:inline-block;text-align:center;margin:20px auto 0}.tnp-welcome-confirm-button:hover{box-shadow:0 0 38px rgba(0,0,0,0.16);color:#fff}.tnp-welcome-confirm-button:visited{color:#fff;text-decoration:none}.tnp-welcome-link-button{color:#fff;padding:10px 30px;background-color:#3498db;font-weight:700;font-size:15px;box-shadow:0 20px 38px rgba(0,0,0,0.16);text-decoration:none}.tnp-welcome-link-button:hover{box-shadow:0 0 38px rgba(0,0,0,0.16);color:#fff}.tnp-welcome-link-button:visited{color:#fff;text-decoration:none}#tnp-welcome input[type="text"],#tnp-welcome input[type="email"]{max-width:90%}.tnp-welcome-next{background-color:#2ecc71;padding:10px 20px;color:white;text-decoration:none;font-weight:600;font-size:16px;margin:0 10px;box-shadow:0 10px 30px rgba(0,0,0,0.16);width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;display:flex;align-items:center}.tnp-welcome-next:hover{box-shadow:0 0 38px rgba(0,0,0,0.16);color:#fff}.tnp-welcome-next:visited{color:#fff;text-decoration:none}.tnp-welcome-prev{background-color:#3498db;padding:10px 20px;color:white;text-decoration:none;font-weight:600;font-size:16px;margin:0 0 0 10px;box-shadow:0 10px 30px rgba(0,0,0,0.16);width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;display:flex;align-items:center}.tnp-welcome-prev:hover{box-shadow:0 0 38px rgba(0,0,0,0.16);color:#fff}.tnp-welcome-prev:visited{color:#fff;text-decoration:none}.tnp-welcome-next svg{margin-left:10px}.tnp-welcome-prev svg{margin-right:10px}.cd-slider input{width:250px;height:40px;border:1px solid #6c7280;background:#454a56;color:white;color:white;padding:0 10px}.cd-slider>li{position:absolute;top:0;left:0;opacity:0;display:table;background-position:center center;background-repeat:no-repeat;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.cd-slider>li.visible{position:relative;z-index:2;opacity:1}.cd-slider>li:first-of-type{background-color:#2b313a}.cd-slider>li:nth-of-type(2){background-color:#2b313a}.cd-slider>li:nth-of-type(3){background-color:#2b313a}.cd-slider>li:nth-of-type(4){background-color:#2b313a}.cd-slider>li:first-of-type,.cd-slider>li:nth-of-type(2),.cd-slider>li:nth-of-type(3),.cd-slider>li:nth-of-type(4){background-size:cover}.cd-slider>li>div{display:table-cell;vertical-align:middle;text-align:center}.cd-slider>li h2,.cd-slider>li p{text-shadow:0 1px 3px rgba(0,0,0,0.1);line-height:1.2;margin:0 auto 14px;color:#fff;width:90%;max-width:320px}.cd-slider>li h2{font-size:40px}.cd-slider>li p{font-size:18px;line-height:26px;text-align:left;color:#b8c3c9;margin:40px auto}.cd-slider>li .cd-btn{display:inline-block;padding:1.2em 1.4em;margin-top:.8em;background-color:rgba(0,0,0,0.6);border-radius:.25em;font-size:1.3rem;font-weight:700;letter-spacing:1px;color:#fff;text-transform:uppercase;-webkit-transition:background-color .2s;-moz-transition:background-color .2s;transition:background-color .2s}.no-touch .cd-slider>li .cd-btn:hover{background-color:rgba(0,0,0,0.8)}@media only screen and (min-width:768px){.cd-slider>li h2,.cd-slider>li p{max-width:520px}.cd-slider>li h2{font-size:40px}.cd-slider>li p{font-size:18px;line-height:26px;text-align:left;color:#b8c3c9;margin:40px auto}}@media only screen and (min-width:1170px){.cd-slider>li h2,.cd-slider>li p{margin-bottom:20px}.cd-slider>li h2{font-size:40px}.cd-slider>li p{font-size:18px;line-height:26px;text-align:center;color:#b8c3c9;margin:30px auto}}.cd-slider-navigation{position:relative;bottom:110px;z-index:3;display:flex;justify-content:center}.cd-svg-cover{position:absolute;z-index:1;left:0;top:0;height:100%;width:100%;opacity:0}.cd-svg-cover path{fill:#ed6a6a}.cd-svg-cover.is-animating{z-index:4;opacity:1;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;transition:opacity .6s}.switch{position:relative;display:inline-block;width:60px;height:34px}.switch input{display:none}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.4s;transition:.4s}.slider:before{position:absolute;content:"";height:26px;width:26px;left:4px;bottom:4px;background-color:white;-webkit-transition:.4s;transition:.4s}input:checked+.slider{background-color:#2196f3}input:focus+.slider{box-shadow:0 0 1px #2196f3}input:checked+.slider:before{-webkit-transform:translateX(26px);-ms-transform:translateX(26px);transform:translateX(26px)}.slider.round{border-radius:34px}.slider.round:before{border-radius:50%}#tnp-body div.tnp-emails-theme-options table.form-table{margin:0}#tnp-body div.tnp-emails-theme-options h3{color:#000}.tnp-emails-edit #options-subject{font-size:16px;display:inline-block;margin:20px 0;width:auto;border-radius:4px;padding:5px 10px}.tnp-suggest-button{font-family:soleil,sans-serif;margin-left:8px;border-radius:3px;background-color:#2980b9;padding:10px 15px 8px;font-size:14px;color:#fff!important;text-decoration:none}.tnp-suggest-button:hover{background-color:#3f8dbf}.tnp-popup-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.8);z-index:10000}.tnp-popup{width:40vw;height:66vh;overflow:auto;margin:100px auto 0 auto;background-color:#181818;padding:20px;position:relative}.tnp-popup-close{display:block;position:absolute;top:5px;right:5px;background-color:#181818;color:#fff;font-size:40px;padding:10px;text-align:right;cursor:pointer}.tnp-subjects-header{font-size:16px;color:#fff;padding:0 70px 20px 20px;font-family:soleil,sans-serif;border-bottom:1px solid #282828}#tnp-edit-subjects-list{padding:0 70px 20px 20px}#tnp-edit-subjects-list a{padding:5px}#tnp-edit-subjects-list svg{margin:0 10px 0 0;vertical-align:middle}.tnp-subject-category{color:#565656;margin:25px 0 10px 0;font-size:12px;text-transform:uppercase;letter-spacing:.1em}#tnp-edit-emoji-list{font-size:28px}#tnp-edit-emoji-list a{display:inline-block;margin-right:5px;margin-bottom:5px}.tnp-list-conditions p{margin:0 10px}.tnp-lists .tnp-notes{margin:0;font-size:.9em}iframe.tnp-editor-preview-mobile{box-sizing:border-box;background-color:#fff;border:1px solid #bbb;box-shadow:1px 1px 10px #777;border-radius:10px;padding:5px;width:320px;height:500px;float:left}iframe.tnp-editor-preview-desktop{box-sizing:border-box;background-color:#fff;border:1px solid #bbb;border-radius:10px;box-shadow:1px 1px 10px #777;padding:15px;width:650px;margin-right:20px;height:500px;float:left}#tnp-license-control{border-left:5px solid #27ae60;display:inline-block;padding:15px 20px;margin-left:-10px;margin-top:15px;border-radius:2px;background-color:#fff}#tnp-license-control form{margin-bottom:10px;margin-top:10px}#tnp-license-control form input{padding-left:10px}#tnp-license-control a{border-bottom:0;color:#27ae60}#tnp-nl-status{width:100%;background:#fffafa;padding:15px 25px 15px 25px;border-left:10px solid #27ae60;border-radius:0 5px 5px 0}#tnp-nl-status p{font-size:17px}.tnp-nl-status-row{margin:10px 0}.tnp-nl-status-title{font-size:26px;line-height:32px;margin:5px 0 0 0;color:#3498db;font-weight:900;vertical-align:middle}.tnp-nl-status-title-value{font-size:13px;line-height:32px;margin:0 0 0 5px;color:#fff;background-color:#95a5a6;border-radius:4px;text-transform:uppercase;letter-spacing:1px;vertical-align:sub}.tnp-nl-status-schedule-targeting{font-size:15px;color:#34495e}.tnp-nl-status-schedule-value{font-size:15px;color:#34495e}.tnp-status-header #options-subject{width:calc(100% - 150px)}.tnp-one-third{width:40%;display:inline-block;vertical-align:top}.tnp-two-thirds{width:59%;display:inline-block;vertical-align:top}.tnp-progress{display:flex;height:1.5rem;overflow:hidden;font-size:.75rem;background-color:#c9cccf;border-radius:.25rem;margin:0;min-width:100px}.tnp-progress-bar{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;color:#fff;text-align:center;white-space:nowrap;background-color:#007bff;transition:width .6s ease}.tnp-progress.sent .tnp-progress-bar{background-color:green}.tnp-progress-numbers{text-align:center;color:#666}.tnp-progress-date{color:#666;font-style:italic}span.tnp-email-status-new{background-color:#8e44ad;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}span.tnp-email-status-paused{background-color:#95a5a6;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}span.tnp-email-status-sending{background-color:#27ae60;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}span.tnp-email-status-scheduled{background-color:#e67e22;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}span.tnp-email-status-sent{background-color:#95a5a6;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}.tnp-themes-new{border-bottom:2px solid #243342;margin-bottom:30px;padding-bottom:30px}#tnp-schedule-button{background-color:#e67e22!important}#tnp-schedule-button:hover{background-color:#ec913f!important}.tnp-button-cancel{background-color:#e74c3c!important}.tnpc-preview{margin-top:10px}.tnpc-preview .fake-browser-ui iframe{width:700px}.tnpc-preview .fake-mobile-browser-ui iframe{width:320px}.fake-browser-ui{padding:30px 0 0;border-radius:3px;border-bottom:10px solid #ccc;background:#ddd;display:inline-block;position:relative;line-height:0;vertical-align:top;margin-left:20px}.fake-mobile-browser-ui{padding:30px 10px 37px;border-radius:10px;border-bottom:10px solid #ccc;background:#ddd;display:inline-block;position:relative;line-height:0;margin-left:30px}.fake-browser-ui .frame{display:block;height:25px;position:absolute;top:12px;left:8px}.fake-mobile-browser-ui .frame{display:block;height:25px;margin-top:10px}.fake-browser-ui span{height:12px;width:12px;border-radius:8px;background-color:#eee;border:1px solid #dadada;float:left;margin:0 0 0 4px}.fake-mobile-browser-ui span{height:50px;width:50px;border-radius:60px;background-color:#eee;border:2px solid #ccc;display:block;margin:auto}.fake-browser-ui .bt-1{background-color:#ed594a}.fake-browser-ui .bt-2{background-color:#fdd800}.fake-browser-ui .bt-3{background-color:#5ac05a}#tnp-promo{text-align:left;background-color:#222b36;margin:20px;border-radius:5px;padding:20px 40px}#tnp-promo .tnp-promo-how-to{width:50%;padding:5px 20px;margin-top:30px;margin-bottom:30px;border-left:2px solid #f1c40f}#tnp-promo .tnp-promo-how-to h3{color:#ecf0f1;margin:0;line-height:36px}#tnp-promo .tnp-promo-how-to p{color:#ecf0f1;margin:0;font-size:16px;line-height:26px}#tnp-promo .tnp-promo-buttons{margin:50px 0}#tnp-promo .tnp-promo-button{background:#27ae60;text-decoration:none;color:white;padding:15px 20px;font-size:15px;border-radius:2px}#tnp-promo .tnp-promo-button:hover{background:#2ecc71;color:white}#tnp-promo .tnp-promo-button i{margin-right:3px}#tnp-body td a.tnp-table-link,#tnp-body td a.tnp-table-link:visited{color:#444}#tnp-body td a.tnp-table-link:hover{color:#3498db}.text-left{text-align:left}.tab-min-height{min-height:500px}.tnp-control-all-languages-notice{padding:15px;border:1px dashed #999}.sp-dd{display:none}.sp-replacer{width:30px!important;height:30px!important}
1
+ #tnp-wrap *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#tnp-wrap .iris-picker,#tnp-wrap .iris-picker *{-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#tnp-wrap *:before,#tnp-wrap *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.container{width:100%;padding-right:1rem;padding-left:1rem;margin-right:auto;margin-left:auto}@media(min-width:576px){.container{max-width:540px}}@media(min-width:768px){.container{max-width:720px}}@media(min-width:992px){.container{max-width:960px}}@media(min-width:1200px){.container{max-width:1140px}}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}@media all and (max-width:1100px){.col-md-12{width:100%}.col-md-11{width:100%}.col-md-10{width:100%}.col-md-9{width:100%}.col-md-8{width:100%}.col-md-7{width:100%}.col-md-6{width:100%}.col-md-5{width:100%}.col-md-4{width:100%}.col-md-3{width:100%}.col-md-2{width:100%}.col-md-1{width:100%}}.tnp-row-padded{width:90%;margin:0 auto;display:flex;justify-content:space-between}.tnp-col-3-boxed{width:30%;border:1px solid #3c414c;padding:0 0 30px 0;border-radius:10px}.tnp-margin-top{margin-top:80px}#tnp-wrap,#tnp-header,#tnp-body p,#tnp-body td,#tnp-body td p,#tnp-body input,#tnp-body select,#tnp-body textarea{font-family:soleil,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#tnp-body h1,#tnp-body h2,#tnp-body h3,#tnp-body h4{font-family:soleil,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#tnp-promotion-bar{background-color:#ff5f65;color:ddd;padding:10px 0;text-align:center;font-size:16px}#tnp-promotion-bar a{color:#fff;font-weight:normal;text-decoration:none}#tnp-header{text-align:left;font-size:12px;color:#fff;font-family:soleil,sans-serif}#tnp-header input{font-size:12px}#tnp-header a{text-decoration:none;color:white;letter-spacing:.1em}#tnp-header a:hover{color:#fff}.error a,.error a:hover{color:#000!important}.updated a,.updated a:hover{color:#000!important}.tnp-error{border-left:5px solid #d00;background-color:#fff;padding:15px;margin:15px 0;font-size:1.2em;line-height:1.5em}.tnp-warning{border-left:5px solid #ffb900;background-color:#fff;padding:15px;margin:15px 0;font-size:1.2em;line-height:1.5em}.tnp-message{border-left:5px solid #46b450;background-color:#fff;padding:15px;margin:15px 0;font-size:1.2em;line-height:1.5em}#tnp-body h1,#tnp-body h2,#tnp-body h3,#tnp-body h4,#tnp-body p{color:#fff}#tnp-body a,#tnp-body a:active{color:#2980b9}#tnp-body a:hover{color:#3498db}#tnp-body .tnp-submit{margin-bottom:10px}#tnp-body .button,#tnp-body .button:visited,#tnp-body .button:hover,#tnp-body .button:active,#tnp-body .button:focus,#tnp-body .button-primary,#tnp-body .button-primary:visited,#tnp-body .button-primary:hover,#tnp-body .button-secondary,#tnp-body .button-secondary:visited,#tnp-body .button-secondary:hover{color:#fff;background-color:#3498db;text-shadow:none;width:auto}#tnp-body span.wp-media-buttons-icon:before{color:#fff}#tnp-body .tnp-button{color:#fff;background-color:#3498db;text-shadow:none}#tnp-body .button-primary.tnp-button-white,#tnp-body .tnp-button.tnp-button-white{color:#444!important;background-color:#fff!important;box-shadow:none!important;-webkit-box-shadow:none!important;width:auto}#tnp-body .form-table h1,#tnp-body .form-table h2,#tnp-body .form-table h4,#tnp-body .form-table h3{color:#444}#tnp-body tbody th,#tnp-body td,#tnp-body td p,#tnp-body td .button,#tnp-body td .button:visited,#tnp-body td .button:hover,#tnp-body td .button:active,#tnp-body td .button:focus{color:#444}#tnp-body td a,#tnp-body td a:visited{color:#27ae60}#tnp-body .form-table{background-color:#fff;border:1px solid #ecf0f1;margin-top:2em;border-spacing:4px;border-collapse:separate}#tnp-body .form-table th{text-align:right;font-weight:bold;max-width:200px;color:#000;background-color:#ecf0f1;vertical-align:middle}#tnp-body .form-table th small{font-weight:normal}#tnp-body .form-table textarea{width:100%}#tnp-body .form-table table{border-collapse:collapse}#tnp-body .form-table table td,.form-table table th{padding:5px;font-size:.9em;font-weight:normal;border:1px solid #eee}#tnp-body .form-table table thead th{text-align:left;font-weight:bold}#tnp-body .widefat{width:90%}#tnp-body .widefat th{text-align:left}#tnp-body .widefat thead{background-color:#3498db;font-family:soleil,sans-serif;color:#fff!important}#tnp-body .widefat thead tr th{color:#fff!important}#tnp-body .widefat td,.widefat th{vertical-align:middle}.tnp-newsletters-list tbody tr{height:70px}.widefat tr:nth-child(even){background-color:#f4faff}#tnp-body #tabs h1,#tnp-body #tabs h2,#tnp-body #tabs h3,#tnp-body #tabs h4,#tnp-body #tabs p,#tnp-body #tabs td,#tnp-body #tabs th,#tnp-body #tabs input,#tnp-body #tabs select,#tnp-body #tabs textarea,#tnp-body #tabs a{color:#444}#tnp-body #tabs .button,#tnp-body #tabs .button:visited,#tnp-body #tabs .button:hover,#tnp-body #tabs .button-primary,#tnp-body #tabs .button-primary:visited,#tnp-body #tabs .button-primary:hover,#tnp-body #tabs .button-secondary,#tnp-body #tabs .button-secondary:visited,#tnp-body #tabs .button-secondary:hover{color:#fff;width:auto}#tnp-body td .tnp-tabs .ui-widget-header{background-color:#ddd}#tnp-body td .tnp-tabs .ui-tabs-anchor{color:#000}table.clicks td{border:1px solid #666;padding:2px;font-size:10px}table.clicks{border-collapse:collapse}.grid{border-collapse:collapse}.grid td,.grid th{padding:10px;border:1px solid #ddd;margin:0}.grid th{background-color:#aaa}.tnp-checkboxes label{display:block;float:left;width:220px;border:1px solid #ccc;background-color:#f4f4f4;margin-bottom:5px;padding:5px;white-space:nowrap;margin-right:5px}.tnp-buttons{padding:10px}.newsletter-checkbox-group,.nl-checkbox-group{float:left;margin-right:5px;border:1px solid #ccc;background-color:#f4f4f4;margin-bottom:5px;padding:5px;white-space:nowrap;overflow:hidden}.newsletter-checkboxes-item{float:left;margin-right:5px;border:1px solid #ddd;border-radius:3px;background-color:#f4f4f4;width:150px;margin-bottom:5px;padding:3px;white-space:nowrap;overflow:hidden}.newsletter-checkboxes-item input{vertical-align:text-bottom}.newsletter-checkboxes-item label{display:inline}.newsletter-preferences-item{float:left;margin-right:5px;border:1px solid #ccc;background-color:#f4f4f4;width:250px;margin-bottom:5px;padding:5px;white-space:nowrap;overflow:hidden}.newsletter-preferences-item label{display:inline}.form-table td .nl-checkbox-group label{display:inline}.tnp-notice{padding:15px;margin:10px 0;padding-right:70px;position:relative;border:1px solid #eee;background-color:#fff;color:#444;font-size:13px;border-left:5px solid #27ae60}.tnp-notice a{color:#0073aa;text-decoration:none;font-weight:bold}.tnp-notice a.tnp-dismiss{display:block;position:absolute;right:10px;top:13px;font-size:25px;text-decoration:none;color:#666}.tnp-notice input[type=email]{margin:10px 5px 5px;width:250px;border:0;box-shadow:none;background-color:#ecf0f1;padding:8px}.tnp-notice input[type=submit]{border:0;box-shadow:none;background-color:#27ae60;padding:8px;font-family:soleil,sans-serif;font-size:13px;color:#fff;cursor:pointer}.newsletter-message{background-color:#efe;border-color:#393;border-radius:5px;border-style:solid;border-width:3px;padding:.6em;margin-bottom:.6em}.newsletter-error-span{color:#f00;font-weight:bold}.newsletter-error{background-color:#fee;border-color:#933;border-radius:5px;border-style:solid;border-width:2px;padding:.6em;margin-bottom:.6em}.newsletter-error strong,.newsletter-message strong{font-weight:bold}#newsletter-warnings{background-color:#ffebe8;border-color:#C00;border-radius:3px;border-style:solid;border-width:1px;padding:.6em;margin-bottom:.6em}.newsletter-buttons{margin-top:1em;margin-bottom:1em}.tnp-paginator{margin-top:10px;margin-bottom:5px}.newsletter-option-grid th{text-align:right;width:auto;border:0;padding:3px;font-weight:normal;vertical-align:top;padding-right:15px}.newsletter-option-grid td{border:0;padding:3px;vertical-align:top}.newsletter-box{border:1px solid #ddd;padding:10px;background-color:#fafafa;margin-bottom:15px}.newsletter-box h3{margin-top:0}.newsletter-textarea-preview{border:1px solid #ddd}.tnp-tab-notice{background-color:#fff;border:1px solid #eee;border-left:3px solid gray;padding:10px;margin:10px 0;color:#444}.tnp-tab-warning{background-color:#fff;border:1px solid #eee;border-left:3px solid orange;padding:10px;margin:10px 0;color:#444}.tnp-tab-success{background-color:#fff;border:1px solid #eee;border-left:3px solid green;padding:10px;margin:10px 0;color:#444}.tnp-tab-error{background-color:#fff;border:1px solid #eee;border-left:3px solid red;padding:10px;margin:10px 0;color:#444}.tnp-tip{margin-top:5px}.tip-button{padding:0 5px;color:#fd5f65;text-transform:uppercase;letter-spacing:.2em;font-size:10px;border:1px red solid}.tip-content{font-weight:500;font-size:11px;color:#999}p.description{font-size:12px!important}.tnp-theme-preview{display:inline-block;text-align:center}.tnp-theme-preview p{font-family:soleil;font-size:13px;letter-spacing:.2em;color:#fff}.tnp-theme-preview img:hover{box-shadow:3px 3px 8px 2px #293848}.tnp-theme-preview img{border-radius:10px;height:190px;width:auto}.tnp-theme-preview .tnp-theme-composer{height:250px;width:auto}.tnp-theme-preview .tnp-theme-html{height:250px;width:auto}.tnp-header-logo{margin-left:10px}.wp-core-ui .button-primary{background-color:#2b2f3a;color:#fff;width:auto}#tnp-body{padding:10px;background-color:#28313c}.tnp-darkbg{background-color:#34495e!important}#tnp-body h3{margin-top:25px;clear:both;margin-bottom:10px}.tnp-body-lite{background-color:#f1f1f1!important}#tnp-heading{padding:10px;margin-bottom:10px;border-radius:5px}#tnp-heading a{color:#fff;border-bottom:1px solid #fff;text-decoration:none}#tnp-heading a:hover{color:#27ae60;border-bottom:1px solid #27ae60}#tnp-heading div p{color:#565656}#tnp-heading h2{color:#fff;font-family:soleil,sans-serif;letter-spacing:.1rem;font-size:1.1rem;line-height:1.8rem;text-transform:uppercase;vertical-align:middle;font-weight:700;padding:0;margin:0;margin-bottom:15px}#tnp-heading h3{color:#27ae60;font-family:soleil,sans-serif;letter-spacing:.1rem;font-size:.8rem;line-height:1.8rem;text-transform:uppercase;vertical-align:middle;font-weight:700;padding:0;margin:0}#tnp-heading p{margin:0;color:#ccc}#tnp-heading .notice p{margin:.5em 0;padding:2px}#tnp-heading .tnp-btn-h1{color:#fff;background-color:#3498db;border-radius:3px;padding:6px 11px;text-decoration:none;text-transform:capitalize;font-family:soleil,sans-serif;margin-left:10px;font-size:.75rem;font-weight:300;border:0}#tnp-heading .tnp-btn-h1:hover{color:#fff;background-color:#5dade2;-webkit-transition:background-color .25s linear;transition:background-color .25s linear;-webkit-font-smoothing:subpixel-antialiased;border:0;color:#fff}.metabox-holder{width:100%}.postbox{border:0}.postbox h3 a{float:right}#dashboard-widgets .postbox-container{width:33.333%}#tnp-body .postbox p{color:#000}#dashboard-widgets .postbox-container .postbox h3{font-family:soleil,sans-serif;letter-spacing:.05rem;background-color:#415b76;color:#fff;margin:0;padding:9px}#dashboard-widgets .postbox-container h3 a{color:white;text-decoration:none;margin-left:5px;padding:2px 8px;background-color:#26c281;border-radius:2px;font-weight:300;text-transform:capitalize;font-size:.8rem}#dashboard-widgets .postbox-container h3 a:hover{color:white;text-decoration:none;margin-left:5px;background-color:#2ecc71}.postbox-container i{margin-right:3px}#tnp-dash-newsletters tr td:last-of-type{width:80px;text-align:right}#tnp-dash-subscribers tr td:last-of-type{width:80px;text-align:right}#tnp-dash-subscribers tr td:first-of-type{width:250px;overflow:hidden}#tnp-dash-subscribers table{table-layout:fixed}#tnp-dash-documentation .inside div{margin-top:10px}#tnp-dash-documentation .inside a{text-decoration:none;color:#fff;display:block;font-family:soleil,sans-serif;padding:5px 10px}#tnp-footer{margin-top:10px;padding:20px 10px 10px 40px;background-color:#28313c;font-family:soleil,sans-serif}#tnp-footer div{width:33%;display:inline-block}#tnp-footer a{color:#fff;text-decoration:none}#tnp-footer a:hover{color:#bdc3c7}#tnp-footer input[type="submit"]{background-color:#2ecc71;border:0;padding:5px;color:#fff}#tnp-footer form{white-space:nowrap}#tnp-footer li{display:inline;margin-left:15px;padding:2px 5px;border-left:3px solid #2ecc71}#wpwrap{background-color:#222b36!important}#dashboard-widgets .button{border:0;background:0;box-shadow:none;color:#322c39}#dashboard-widgets .button:hover{background-color:#ecf0f1}.wp-core-ui .button-secondary,.wp-core-ui .button-primary{background-color:#3498db;border:0;box-shadow:none;color:#fff;font-family:soleil,sans-serif;margin:0 2px;width:auto}.wp-core-ui .button-secondary,.wp-core-ui .button,.wp-core-ui .button-primary{background-color:#3498db;box-shadow:none;color:#fff;font-family:soleil,sans-serif;margin:0 2px}.wp-core-ui .button-secondary:hover,.wp-core-ui .button:hover,.wp-core-ui .button-primary:hover{background-color:#5dade2;color:#fff;width:auto}span.wp-media-buttons-icon:before{color:#fff}.tnp-paginator [value="Go"]{background-color:#27ae60}.tnp-paginator [value="Go"]:hover{background-color:#2ecc71}.notice-dismiss{padding:3px}.tnp-paginator{color:#fff;font-family:soleil,sans-serif;margin:10px 0}.tnp-paginator .button-secondary{padding:5px;line-height:normal;height:auto;font-size:12px;height:25px;border:0;border-radius:3px;vertical-align:baseline}.tnp-paginator [value="Go"]{background-color:#27ae60!important}.tnp-paginator [value="Go"]:hover{background-color:#2ecc71!important}.tnp-paginator input{background-color:#2c3e50;border:0;border-radius:3px;color:#fff;padding:5px;line-height:normal;font-size:12px;height:25px}.tnp-subscribers-search{color:#fff;font-family:soleil,sans-serif;background-color:#2c3e50;padding:20px;border-radius:5px;margin-bottom:20px;display:inline-block}.tnp-subscribers-search select{margin-left:5px;padding:0;line-height:inherit}.tnp-video-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden}.tnp-video-container iframe,.tnp-video-container object,.tnp-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%}.bg-white{background-color:#FFF}.orange{background-color:#f39c12}.blue{background-color:#2980b9}.purple{background-color:#8e44ad}.notice a{color:#27ae60!important;text-decoration:underline!important}.tnp-chart{border:1px solid #eee;width:100%}.tnp-db-table{width:auto;background-color:#fff}.tnp-db-table thead{border-bottom:1px solid #eee}.tnp-db-table th{font-weight:bold}.tnp-db-table td,.tnp-db-table th{padding:3px;font-family:monospace;border:0}.tnp-main-status h3,.tnp-main-status h4{color:#fff}#tnp-status-table .tnp-ok{font-weight:bold;color:white;font-size:14px;background-color:#27ae60;padding:2px 10px;border-radius:10px;display:inline-block;width:75px;text-align:center}#tnp-status-table .tnp-ko{font-weight:bold;color:white;font-size:14px;background-color:#e74c41;padding:2px 10px;border-radius:10px;display:inline-block;width:75px;text-align:center}#tnp-status-table .tnp-maybe{font-weight:bold;color:white;font-size:14px;background-color:#f1c40f;padding:2px 10px;border-radius:10px;display:inline-block;width:75px;text-align:center}.tnp-main-status .tnp-log-files li{padding-left:15px}.tnp-main-status .tnp-log-files li,.tnp-main-status .tnp-log-files li a{color:#fff}.tnp-main-status .tnp-log-files .tnp-log-size{font-style:italic}table.widefat{border:0;box-shadow:none}#tnp-status-table tbody tr:nth-child(2n+1){background-color:#ecf0f1;border-radius:2px;margin:5px}#tnp-parameters-table tbody tr:nth-child(2n+1){background-color:#ecf0f1;border-radius:2px;margin:5px}#tnp-body .ui-widget{font-family:soleil,sans-serif}#tnp-body #tabs{background-color:transparent;border:0!important;padding:0;margin:0}#tnp-body #tabs .ui-widget-header{background:#28313c;border:0}#tnp-body #tabs .ui-tabs-panel{padding:15px!important;background-color:#fff}#tnp-body #tabs a.ui-tabs-anchor,#tnp-body #tabs a.ui-tabs-anchor:visited{color:#444}#tnp-body .ui-tabs .ui-tabs-nav{padding:0}#tnp-body .ui-tabs .ui-tabs-nav li a{font-size:14px}#tnp-body #tabs .ui-tabs{border-color:#28313c;background-color:#28313c;border:0}#tnp-body #tabs .ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0 0;background-color:#f2f2f2}#tnp-body #tabs .ui-tabs .ui-tabs-panel{padding:1em 0;background-color:#f2f2f2;margin:0;border:0}#tnp-body .ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{background:#fff!important;font-weight:normal;font-family:soleil,sans-serif}#tnp-body .ui-widget-content{background:#fff}#tnp-body .ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:0;background:#ecf0f1;font-family:soleil,sans-serif}.tnp-extension-premium-box,.tnp-extension-free-box,.tnp-integration-box{width:300px;height:220px;background-color:#222b36;text-align:center;margin:20px;float:left;position:relative}.tnp-extension-premium-box:hover,.tnp-extension-free-box:hover,.tnp-integration-box:hover{background-color:#232c35;box-shadow:1px 1px 15px #222b36}.tnp-extension-premium-box p,.tnp-extension-free-box p,.tnp-integration-box p{padding:5px 10px;color:#72777c;font-size:14px;margin-top:0}.tnp-extension-premium-box h3{font-family:soleil,sans-serif;padding:5px 8px!important;border-radius:3px;display:inline-block;font-size:16px;color:#fff;margin-bottom:0!important;margin-top:25px!important;font-weight:300;width:auto!important;border-bottom:none!important}.tnp-extension-free-box h3{font-family:soleil,sans-serif;padding:5px 8px!important;border-radius:3px;display:inline-block;font-size:16px;color:#fff;margin-bottom:0!important;margin-top:25px!important;font-weight:300;width:auto!important;border-bottom:none!important}.tnp-integration-box h3{font-family:soleil,sans-serif;padding:5px 8px!important;border-radius:3px;display:inline-block;font-size:16px;color:#fff;margin-bottom:0!important;margin-top:25px!important;font-weight:300;width:auto!important;border-bottom:none!important}.tnp-extension-premium-action{bottom:0;position:absolute;width:100%;padding:12px;font-family:soleil,sans-serif}.tnp-extension-free-action{bottom:0;position:absolute;width:100%;padding:12px;font-family:soleil,sans-serif}.tnp-integration-action{bottom:0;position:absolute;width:100%;padding:12px;font-family:soleil,sans-serif}.tnp-extension-premium-action span{color:#27ae60}.tnp-extension-free-action span{color:#27ae60}.tnp-integration-action span{color:#27ae60}.tnp-extension-activate{color:#1abc9c;padding:5px 8px;text-decoration:none;cursor:pointer}.tnp-extension-install{color:#2980b9;padding:5px 8px;text-decoration:none;cursor:pointer}.tnp-extension-buy{color:#f1c40f;padding:5px 8px;text-decoration:none;cursor:pointer}#tnp-body a.tnp-extension-details{color:#999;padding:5px 8px;text-decoration:none;cursor:pointer}.tnp-extension-free{color:#d35400;padding:5px 8px;text-decoration:none;cursor:pointer;position:relative}img.tnp-extensions-free-badge{position:absolute;display:block;right:0;top:0;width:70px}.tnp-extensions-image img{margin:25px 0 -10px}#tnp-subscribe-overlay{height:100vh;width:100vw;z-index:10000;display:none;background-image:url(images/modal-background.png);background-repeat:repeat;position:fixed;top:0;left:-20px}#tnp-subscribe-modal{width:600px;background-color:rgba(255,255,255,1);margin-right:auto;margin-left:auto;margin-top:100px;-webkit-box-shadow:0 0 20px 0 rgba(0,0,0,0.5);-moz-box-shadow:0 0 20px 0 rgba(0,0,0,0.5);box-shadow:0 0 20px 0 rgba(0,0,0,0.5);padding:25px;background-color:#1d2b38;text-align:center}#tnp-subscribe-modal img{width:30%}#tnp-subscribe-title{font-size:20px;margin-top:30px;margin-bottom:30px;line-height:30px;color:white;font-weight:200}#tnp-subscribe-email-wrapper{margin:20px}#tnp-subscribe-email-wrapper input{border:0;background-color:#223242;color:white}#tnp-subscribe-email{font-size:24px;box-sizing:border-box;width:100%;padding:10px;text-align:center}#tnp-subscribe-submit-wrapper{margin-bottom:20px}#tnp-subscribe-submit{font-size:24px;background-color:#219050;color:#fff;padding:10px 35px;border:0;font-size:17px;letter-spacing:2px}#tnp-subscribe-no-thanks{color:#666;margin-top:20px;margin-bottom:20px}#tnp-body div.tnp-emails-theme-options{background-color:#fff;padding:10px;margin-top:14px}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:0;background:#ecf0f1;font-family:soleil,sans-serif}.cd-slider-wrapper{position:relative;width:100%;height:90vh;overflow:hidden;margin:0 auto}.cd-slider-wrapper .cd-slider,.cd-slider-wrapper .cd-slider>li{height:100%;width:100%}.tnp-logo-big{width:300px}.tnp-row{display:table-row}.tnp-third{width:33%;float:left}.tnp-welcome-confirm-button{color:#fff;padding:10px 30px;background-color:#2ecc71;font-weight:700;font-size:15px;box-shadow:0 20px 38px rgba(0,0,0,0.16);text-decoration:none;display:inline-block;text-align:center;margin:20px auto 0}.tnp-welcome-confirm-button:hover{box-shadow:0 0 38px rgba(0,0,0,0.16);color:#fff}.tnp-welcome-confirm-button:visited{color:#fff;text-decoration:none}.tnp-welcome-link-button{color:#fff;padding:10px 30px;background-color:#3498db;font-weight:700;font-size:15px;box-shadow:0 20px 38px rgba(0,0,0,0.16);text-decoration:none}.tnp-welcome-link-button:hover{box-shadow:0 0 38px rgba(0,0,0,0.16);color:#fff}.tnp-welcome-link-button:visited{color:#fff;text-decoration:none}#tnp-welcome input[type="text"],#tnp-welcome input[type="email"]{max-width:90%}.tnp-welcome-next{background-color:#2ecc71;padding:10px 20px;color:white;text-decoration:none;font-weight:600;font-size:16px;margin:0 10px;box-shadow:0 10px 30px rgba(0,0,0,0.16);width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;display:flex;align-items:center}.tnp-welcome-next:hover{box-shadow:0 0 38px rgba(0,0,0,0.16);color:#fff}.tnp-welcome-next:visited{color:#fff;text-decoration:none}.tnp-welcome-prev{background-color:#3498db;padding:10px 20px;color:white;text-decoration:none;font-weight:600;font-size:16px;margin:0 0 0 10px;box-shadow:0 10px 30px rgba(0,0,0,0.16);width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;display:flex;align-items:center}.tnp-welcome-prev:hover{box-shadow:0 0 38px rgba(0,0,0,0.16);color:#fff}.tnp-welcome-prev:visited{color:#fff;text-decoration:none}.tnp-welcome-next svg{margin-left:10px}.tnp-welcome-prev svg{margin-right:10px}.cd-slider input{width:250px;height:40px;border:1px solid #6c7280;background:#454a56;color:white;color:white;padding:0 10px}.cd-slider>li{position:absolute;top:0;left:0;opacity:0;display:table;background-position:center center;background-repeat:no-repeat;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.cd-slider>li.visible{position:relative;z-index:2;opacity:1}.cd-slider>li:first-of-type{background-color:#2b313a}.cd-slider>li:nth-of-type(2){background-color:#2b313a}.cd-slider>li:nth-of-type(3){background-color:#2b313a}.cd-slider>li:nth-of-type(4){background-color:#2b313a}.cd-slider>li:first-of-type,.cd-slider>li:nth-of-type(2),.cd-slider>li:nth-of-type(3),.cd-slider>li:nth-of-type(4){background-size:cover}.cd-slider>li>div{display:table-cell;vertical-align:middle;text-align:center}.cd-slider>li h2,.cd-slider>li p{text-shadow:0 1px 3px rgba(0,0,0,0.1);line-height:1.2;margin:0 auto 14px;color:#fff;width:90%;max-width:320px}.cd-slider>li h2{font-size:40px}.cd-slider>li p{font-size:18px;line-height:26px;text-align:left;color:#b8c3c9;margin:40px auto}.cd-slider>li .cd-btn{display:inline-block;padding:1.2em 1.4em;margin-top:.8em;background-color:rgba(0,0,0,0.6);border-radius:.25em;font-size:1.3rem;font-weight:700;letter-spacing:1px;color:#fff;text-transform:uppercase;-webkit-transition:background-color .2s;-moz-transition:background-color .2s;transition:background-color .2s}.no-touch .cd-slider>li .cd-btn:hover{background-color:rgba(0,0,0,0.8)}@media only screen and (min-width:768px){.cd-slider>li h2,.cd-slider>li p{max-width:520px}.cd-slider>li h2{font-size:40px}.cd-slider>li p{font-size:18px;line-height:26px;text-align:left;color:#b8c3c9;margin:40px auto}}@media only screen and (min-width:1170px){.cd-slider>li h2,.cd-slider>li p{margin-bottom:20px}.cd-slider>li h2{font-size:40px}.cd-slider>li p{font-size:18px;line-height:26px;text-align:center;color:#b8c3c9;margin:30px auto}}.cd-slider-navigation{position:relative;bottom:110px;z-index:3;display:flex;justify-content:center}.cd-svg-cover{position:absolute;z-index:1;left:0;top:0;height:100%;width:100%;opacity:0}.cd-svg-cover path{fill:#ed6a6a}.cd-svg-cover.is-animating{z-index:4;opacity:1;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;transition:opacity .6s}.switch{position:relative;display:inline-block;width:60px;height:34px}.switch input{display:none}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.4s;transition:.4s}.slider:before{position:absolute;content:"";height:26px;width:26px;left:4px;bottom:4px;background-color:white;-webkit-transition:.4s;transition:.4s}input:checked+.slider{background-color:#2196f3}input:focus+.slider{box-shadow:0 0 1px #2196f3}input:checked+.slider:before{-webkit-transform:translateX(26px);-ms-transform:translateX(26px);transform:translateX(26px)}.slider.round{border-radius:34px}.slider.round:before{border-radius:50%}#tnp-body div.tnp-emails-theme-options table.form-table{margin:0}#tnp-body div.tnp-emails-theme-options h3{color:#000}.tnp-emails-edit #options-subject{font-size:16px;display:inline-block;margin:20px 0;width:auto;border-radius:4px;padding:5px 10px}.tnp-suggest-button{font-family:soleil,sans-serif;margin-left:8px;border-radius:3px;background-color:#2980b9;padding:10px 15px 8px;font-size:14px;color:#fff!important;text-decoration:none}.tnp-suggest-button:hover{background-color:#3f8dbf}.tnp-popup-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.8);z-index:10000}.tnp-popup{width:40vw;height:66vh;overflow:auto;margin:100px auto 0 auto;background-color:#181818;padding:20px;position:relative}.tnp-popup-close{display:block;position:absolute;top:5px;right:5px;background-color:#181818;color:#fff;font-size:40px;padding:10px;text-align:right;cursor:pointer}.tnp-subjects-header{font-size:16px;color:#fff;padding:0 70px 20px 20px;font-family:soleil,sans-serif;border-bottom:1px solid #282828}#tnp-edit-subjects-list{padding:0 70px 20px 20px}#tnp-edit-subjects-list a{padding:5px}#tnp-edit-subjects-list svg{margin:0 10px 0 0;vertical-align:middle}.tnp-subject-category{color:#565656;margin:25px 0 10px 0;font-size:12px;text-transform:uppercase;letter-spacing:.1em}#tnp-edit-emoji-list{font-size:28px}#tnp-edit-emoji-list a{display:inline-block;margin-right:5px;margin-bottom:5px}.tnp-list-conditions p{margin:0 10px}.tnp-lists .tnp-notes{margin:0;font-size:.9em}iframe.tnp-editor-preview-mobile{box-sizing:border-box;background-color:#fff;border:1px solid #bbb;box-shadow:1px 1px 10px #777;border-radius:10px;padding:5px;width:320px;height:500px;float:left}iframe.tnp-editor-preview-desktop{box-sizing:border-box;background-color:#fff;border:1px solid #bbb;border-radius:10px;box-shadow:1px 1px 10px #777;padding:15px;width:650px;margin-right:20px;height:500px;float:left}#tnp-license-control{border-left:5px solid #27ae60;display:inline-block;padding:15px 20px;margin-left:-10px;margin-top:15px;border-radius:2px;background-color:#fff}#tnp-license-control form{margin-bottom:10px;margin-top:10px}#tnp-license-control form input{padding-left:10px}#tnp-license-control a{border-bottom:0;color:#27ae60}#tnp-nl-status{width:100%;background:#fffafa;padding:15px 25px 15px 25px;border-left:10px solid #27ae60;border-radius:0 5px 5px 0}#tnp-nl-status p{font-size:17px}.tnp-nl-status-row{margin:10px 0}.tnp-nl-status-title{font-size:26px;line-height:32px;margin:5px 0 0 0;color:#3498db;font-weight:900;vertical-align:middle}.tnp-nl-status-title-value{font-size:13px;line-height:32px;margin:0 0 0 5px;color:#fff;background-color:#95a5a6;border-radius:4px;text-transform:uppercase;letter-spacing:1px;vertical-align:sub}.tnp-nl-status-schedule-targeting{font-size:15px;color:#34495e}.tnp-nl-status-schedule-value{font-size:15px;color:#34495e}.tnp-status-header #options-subject{width:calc(100% - 150px)}.tnp-one-third{width:40%;display:inline-block;vertical-align:top}.tnp-two-thirds{width:59%;display:inline-block;vertical-align:top}.tnp-progress{display:flex;height:1.5rem;overflow:hidden;font-size:.75rem;background-color:#c9cccf;border-radius:.25rem;margin:0;min-width:100px}.tnp-progress-bar{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;color:#fff;text-align:center;white-space:nowrap;background-color:#007bff;transition:width .6s ease}.tnp-progress.sent .tnp-progress-bar{background-color:green}.tnp-progress-numbers{text-align:center;color:#666}.tnp-progress-date{color:#666;font-style:italic}span.tnp-email-status-new{background-color:#8e44ad;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}span.tnp-email-status-paused{background-color:#95a5a6;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}span.tnp-email-status-sending{background-color:#27ae60;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}span.tnp-email-status-scheduled{background-color:#e67e22;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}span.tnp-email-status-sent{background-color:#95a5a6;padding:2px 10px;border-radius:4px;color:#fff;white-space:nowrap}#tnp-schedule-button{background-color:#e67e22!important}#tnp-schedule-button:hover{background-color:#ec913f!important}.tnp-button-cancel{background-color:#e74c3c!important}.tnpc-preview{margin-top:10px}.tnpc-preview .fake-browser-ui iframe{width:700px}.tnpc-preview .fake-mobile-browser-ui iframe{width:320px}.fake-browser-ui{padding:30px 0 0;border-radius:3px;border-bottom:10px solid #ccc;background:#ddd;display:inline-block;position:relative;line-height:0;vertical-align:top;margin-left:20px}.fake-mobile-browser-ui{padding:30px 10px 37px;border-radius:10px;border-bottom:10px solid #ccc;background:#ddd;display:inline-block;position:relative;line-height:0;margin-left:30px}.fake-browser-ui .frame{display:block;height:25px;position:absolute;top:12px;left:8px}.fake-mobile-browser-ui .frame{display:block;height:25px;margin-top:10px}.fake-browser-ui span{height:12px;width:12px;border-radius:8px;background-color:#eee;border:1px solid #dadada;float:left;margin:0 0 0 4px}.fake-mobile-browser-ui span{height:50px;width:50px;border-radius:60px;background-color:#eee;border:2px solid #ccc;display:block;margin:auto}.fake-browser-ui .bt-1{background-color:#ed594a}.fake-browser-ui .bt-2{background-color:#fdd800}.fake-browser-ui .bt-3{background-color:#5ac05a}#tnp-promo{text-align:left;background-color:#222b36;margin:20px;border-radius:5px;padding:20px 40px}#tnp-promo .tnp-promo-how-to{width:50%;padding:5px 20px;margin-top:30px;margin-bottom:30px;border-left:2px solid #f1c40f}#tnp-promo .tnp-promo-how-to h3{color:#ecf0f1;margin:0;line-height:36px}#tnp-promo .tnp-promo-how-to p{color:#ecf0f1;margin:0;font-size:16px;line-height:26px}#tnp-promo .tnp-promo-buttons{margin:50px 0}#tnp-promo .tnp-promo-button{background:#27ae60;text-decoration:none;color:white;padding:15px 20px;font-size:15px;border-radius:2px}#tnp-promo .tnp-promo-button:hover{background:#2ecc71;color:white}#tnp-promo .tnp-promo-button i{margin-right:3px}#tnp-body td a.tnp-table-link,#tnp-body td a.tnp-table-link:visited{color:#444}#tnp-body td a.tnp-table-link:hover{color:#3498db}.text-left{text-align:left}.tab-min-height{min-height:500px}.tnp-control-all-languages-notice{padding:15px;border:1px dashed #999}.sp-dd{display:none}.sp-replacer{width:30px!important;height:30px!important}
css/dashboard.css ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #tnp-body #tnp-dashboard .tnp-widget p {
2
+ margin: 0 0 10px 0;
3
+ padding: 0;
4
+ }
5
+
6
+ #tnp-dashboard .row .tnp-widget {
7
+ min-height: 350px;
8
+ padding: 0;
9
+ text-align: center;
10
+ }
11
+
12
+ /* The widget title */
13
+
14
+ #tnp-dashboard h3 {
15
+ letter-spacing: 0.05rem;
16
+ background-color: #415b76;
17
+ color: #fff;
18
+ margin: 0;
19
+ padding: 9px;
20
+ }
21
+
22
+
23
+ #tnp-dashboard h3 a {
24
+ color: white;
25
+ text-decoration: none;
26
+ margin-left: 5px;
27
+ padding: 2px 8px;
28
+ background-color: #26C281;
29
+ border-radius: 2px;
30
+ font-weight: 300;
31
+ text-transform: capitalize;
32
+ font-size: 0.8rem;
33
+ float: right;
34
+ }
35
+
36
+ #tnp-dashboard h3 a:hover {
37
+ color: white;
38
+ text-decoration: none;
39
+ margin-left: 5px;
40
+ background-color: #2ECC71;
41
+ }
42
+
43
+
44
+ /* The widget inner content */
45
+
46
+ #tnp-dashboard .tnp-widget .tnp-inner {
47
+ padding: 15px;
48
+ }
49
+
50
+
51
+ /* One or more buttons in a row */
52
+ #tnp-dashboard .tnp-cta {
53
+ text-align: center;
54
+ margin-bottom: 15px;
55
+ }
56
+
57
+ #tnp-dashboard .tnp-cta a {
58
+ display: inline-block;
59
+ padding: 10px;
60
+ color: #fff;
61
+ background-color: green;
62
+ text-decoration: none;
63
+ }
64
+
65
+ #tnp-dashboard .tnp-cta a:hover {
66
+ color: #fff;
67
+ }
68
+
69
+
70
+ #tnp-dashboard .tnp-widget img {
71
+ max-width: 80%!important;
72
+ display: block;
73
+ margin: 0 auto;
74
+ }
75
+
76
+ #tnp-dashboard .tnp-widget table {
77
+ max-width: 100%;
78
+ width: 100%;
79
+ margin: 0;
80
+ box-sizing: border-box;
81
+ }
82
+
83
+ #tnp-dashboard .tnp-widget table td,
84
+ #tnp-dashboard .tnp-widget table th
85
+ {
86
+ text-align: left;
87
+ }
88
+
89
+ /* Bottoni usati all'interno delle tabelle, magari con la sola icona */
90
+ #tnp-dashboard .tnp-widget table .button-primary {
91
+ min-width: 40px;
92
+ text-align: center;
93
+ display: inline-block;
94
+ }
95
+
96
+ #tnp-dashboard .tnp-widget .tnp-canvas {
97
+ position: relative;
98
+ }
99
+
100
+ /* Tnp Dashboard with Flexbox - Redesign */
101
+
102
+ #wpfooter {
103
+ position: relative;
104
+ }
105
+
106
+ #tnp-heading h1 {
107
+ color: #fff;
108
+ font-family: soleil, sans-serif;
109
+ font-weight: 900;
110
+ }
111
+
112
+ .tnp-dashboard {
113
+ background-color: #f2f5f9;
114
+ color: #222222;
115
+ }
116
+
117
+ .tnp-dashboard .tnp-cards-container {
118
+ background-color: #28313c;
119
+ }
120
+
121
+ /* Row Break Helper */
122
+
123
+ .break {
124
+ flex-basis: 100%;
125
+ height: 0;
126
+ }
127
+
128
+ .tnp-dashboard .tnp-card {
129
+ flex: 1 0;
130
+ align-content: flex-start;
131
+ margin: 15px;
132
+ font-family: soleil, sans-serif;
133
+ border-radius: 15px;
134
+ background-color: #232D3B;
135
+ -webkit-box-shadow: 1px 1px 7px 0px rgb(0 0 0 / 15%);
136
+ -moz-box-shadow: 1px 1px 7px 0px rgba(0, 0, 0, 0.15);
137
+ box-shadow: 1px 1px 7px 0px rgb(0 0 0 / 15%);
138
+ padding: 15px;
139
+ color: #FFF;
140
+ display: flex;
141
+ flex-wrap: wrap;
142
+ position: relative;
143
+ }
144
+
145
+ .tnp-dashboard .tnp-card a, .tnp-dashboard .tnp-card a:active {
146
+ text-decoration: none;
147
+ color: inherit !important;
148
+ }
149
+
150
+
151
+ .tnp-dashboard .tnp-card .tnp-card-title {
152
+ flex-basis: 80%;
153
+ font-weight: 900;
154
+ margin: 0px 0px 30px;
155
+ font-size: 17px;
156
+ }
157
+
158
+ .tnp-dashboard .tnp-card .tnp-card-upper-buttons {
159
+ flex-basis: 10%;
160
+ font-weight: 900;
161
+ margin: 0px 0px 10px;
162
+ font-size: 15px;
163
+ }
164
+
165
+ .tnp-dashboard .tnp-card .tnp-card-description {
166
+ font-size: 12px;
167
+ line-height: 16px;
168
+ font-weight: 500;
169
+ margin: 0px 0px 20px;
170
+ }
171
+
172
+ .tnp-dashboard .tnp-card .tnp-card-content {
173
+ width: 100%;
174
+ }
175
+
176
+ .tnp-dashboard .tnp-card .tnp-card-button-container {
177
+ margin-top: 40px;
178
+ }
179
+
180
+ .tnp-dashboard .tnp-card .tnp-card-button-container a {
181
+ position: absolute;
182
+ padding: 7px 15px;
183
+ font-size: 14px;
184
+ font-weight: 500;
185
+ color: #FFF !important;
186
+ background-color: #2980b9;
187
+ border-radius: 4px;
188
+ text-decoration: none;
189
+ bottom: 15px;
190
+ left: auto;
191
+ -webkit-transform: none;
192
+ transform: none;
193
+ }
194
+
195
+ .tnp-dashboard .tnp-card .tnp-card-button-container a:hover {
196
+ background-color: #2980b9e6;
197
+ }
198
+
199
+ .tnp-dashboard .tnp-card .tnp-card-newsletter-list {
200
+ display: flex;
201
+ margin: 10px 0px;
202
+ align-items: center;
203
+ background-color: #263240;
204
+ border-radius: 5px;
205
+ padding: 10px 10px;
206
+ }
207
+
208
+ .tnp-dashboard .tnp-card .tnp-card-newsletters-subject {
209
+ flex-basis: 50%;
210
+ margin-right: 10px;
211
+ }
212
+
213
+ .tnp-dashboard .tnp-card .tnp-card-newsletters-status {
214
+ flex-basis: 10%;
215
+ margin-right: 10px;
216
+ }
217
+
218
+ .tnp-dashboard .tnp-card .tnp-card-newsletters-progress {
219
+ flex-basis: 30%;
220
+ margin-right: 10px;
221
+ }
222
+
223
+ .tnp-dashboard .tnp-card .tnp-card-newsletters-action {
224
+ flex-basis: 5%;
225
+ margin-left: auto;
226
+ }
227
+
228
+ .tnp-dashboard .tnp-card .tnp-card-newsletters-subscriber-email {
229
+ flex-basis: 40%;
230
+ margin-right: 10px;
231
+ }
232
+
233
+ .tnp-dashboard .tnp-card .tnp-card-newsletters-subscriber-name {
234
+ flex-basis: 30%;
235
+ margin-right: 10px;
236
+ }
237
+
238
+ .tnp-dashboard .tnp-card .tnp-card-newsletters-subscriber-status {
239
+ flex-basis: 20%;
240
+ margin-right: 10px;
241
+ }
242
+
243
+ .tnp-dashboard .tnp-card .tnp-card-documentation-index {
244
+ background-color: #2a3544;
245
+ padding: 15px 20px 17px 5px;
246
+ border-radius: 15px;
247
+ font-size: 15px;
248
+ margin: 10px;
249
+ }
250
+
251
+ .tnp-dashboard .tnp-card .tnp-card-documentation-index svg {
252
+ margin: 0px 10px;
253
+ vertical-align: text-bottom;
254
+ fill: #fff;
255
+ stroke: #fff;
256
+ }
257
+
258
+ .tnp-dashboard .tnp-card .tnp-card-documentation-index:hover {
259
+ animation: ease-in 4s;
260
+ background-color: #323e4e;
261
+ }
262
+
263
+ .tnp-card .tnp-canvas {
264
+ width: 100%;
265
+ }
266
+
267
+ /* CSS Gradients */
268
+
269
+ .tnp-mimosa {
270
+ background-color: #fd7278;
271
+ }
css/dashboard.min.css ADDED
@@ -0,0 +1 @@
 
1
+ #tnp-body #tnp-dashboard .tnp-widget p{margin:0 0 10px 0;padding:0}#tnp-dashboard .row .tnp-widget{min-height:350px;padding:0;text-align:center}#tnp-dashboard h3{letter-spacing:.05rem;background-color:#415b76;color:#fff;margin:0;padding:9px}#tnp-dashboard h3 a{color:white;text-decoration:none;margin-left:5px;padding:2px 8px;background-color:#26c281;border-radius:2px;font-weight:300;text-transform:capitalize;font-size:.8rem;float:right}#tnp-dashboard h3 a:hover{color:white;text-decoration:none;margin-left:5px;background-color:#2ecc71}#tnp-dashboard .tnp-widget .tnp-inner{padding:15px}#tnp-dashboard .tnp-cta{text-align:center;margin-bottom:15px}#tnp-dashboard .tnp-cta a{display:inline-block;padding:10px;color:#fff;background-color:green;text-decoration:none}#tnp-dashboard .tnp-cta a:hover{color:#fff}#tnp-dashboard .tnp-widget img{max-width:80%!important;display:block;margin:0 auto}#tnp-dashboard .tnp-widget table{max-width:100%;width:100%;margin:0;box-sizing:border-box}#tnp-dashboard .tnp-widget table td,#tnp-dashboard .tnp-widget table th{text-align:left}#tnp-dashboard .tnp-widget table .button-primary{min-width:40px;text-align:center;display:inline-block}#tnp-dashboard .tnp-widget .tnp-canvas{position:relative}
emails/blocks/canspam/_icon.png ADDED
Binary file
emails/blocks/canspam/block.php CHANGED
@@ -1,43 +1,49 @@
1
- <?php
2
- /*
3
- * Name: Company Info
4
- * Section: footer
5
- * Description: Company Info for Can-Spam act requirements
6
- */
7
-
8
- $default_options = array(
9
- 'block_background' => '#ffffff',
10
- 'font_family' => $font_family,
11
- 'font_size' => 13,
12
- 'font_color' => '#999999',
13
- 'font_weight' => 'normal',
14
- 'block_padding_top' => 15,
15
- 'block_padding_bottom' => 15,
16
- 'block_padding_left' => 15,
17
- 'block_padding_right' => 15,
18
- 'title'=>$info['footer_title'],
19
- 'address'=>$info['footer_contact'],
20
- 'copyright'=>$info['footer_legal'],
21
-
22
- );
23
- $options = array_merge($default_options, $options);
24
- ?>
25
-
26
- <style>
27
- .canspam-text {
28
- padding: 10px;
29
- text-align: center;
30
- font-size: <?php echo $options['font_size'] ?>px;
31
- font-family: <?php echo $options['font_family'] ?>;
32
- font-weight: <?php echo $options['font_weight'] ?>;
33
- color: <?php echo $options['font_color'] ?>;
34
- }
35
- </style>
36
-
37
- <div inline-class="canspam-text">
38
- <strong><?php echo esc_html($options['title']) ?></strong>
39
- <br>
40
- <?php echo esc_html($options['address']) ?>
41
- <br>
42
- <em><?php echo esc_html($options['copyright']) ?></em>
43
- </div>
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Name: Company Info
4
+ * Section: footer
5
+ * Description: Company Info for Can-Spam act requirements
6
+ */
7
+
8
+ $default_options = array(
9
+ 'font_family' => '',
10
+ 'font_size' => 14,
11
+ 'font_color' => '',
12
+ 'font_weight' => '',
13
+ 'block_padding_top' => 15,
14
+ 'block_padding_bottom' => 15,
15
+ 'block_padding_left' => 15,
16
+ 'block_padding_right' => 15,
17
+ 'block_background' => '',
18
+ 'title' => $info['footer_title'],
19
+ 'address' => $info['footer_contact'],
20
+ 'copyright' => $info['footer_legal'],
21
+ );
22
+
23
+ $options = array_merge($default_options, $options);
24
+
25
+ $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
26
+ $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
27
+ $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
28
+ $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
29
+
30
+ ?>
31
+
32
+ <style>
33
+ .canspam-text {
34
+ padding: 10px;
35
+ text-align: center;
36
+ font-size: <?php echo $text_font_size ?>px;
37
+ font-family: <?php echo $text_font_family ?>;
38
+ font-weight: <?php echo $text_font_weight ?>;
39
+ color: <?php echo $text_font_color?>;
40
+ }
41
+ </style>
42
+
43
+ <div inline-class="canspam-text">
44
+ <strong><?php echo esc_html($options['title']) ?></strong>
45
+ <br>
46
+ <?php echo esc_html($options['address']) ?>
47
+ <br>
48
+ <em><?php echo esc_html($options['copyright']) ?></em>
49
+ </div>
emails/blocks/canspam/icon.png CHANGED
Binary file
emails/blocks/canspam/options.php CHANGED
@@ -3,7 +3,15 @@
3
  /* @var $fields NewsletterFields */
4
  ?>
5
 
6
- <p>Company data can be globally set on company info panel.</p>
 
 
7
 
8
- <?php $fields->font() ?>
 
 
 
 
9
  <?php $fields->block_commons() ?>
 
 
3
  /* @var $fields NewsletterFields */
4
  ?>
5
 
6
+ <p>
7
+ <?php echo sprintf( __( 'Company data can be globally set on <a href="%s" target="_blank">company info panel</a>.', 'newsletter' ), '?page=newsletter_main_info' ); ?>
8
+ </p>
9
 
10
+ <?php $fields->font( 'font', __( 'Text', 'newsletter' ), [
11
+ 'family_default' => true,
12
+ 'size_default' => true,
13
+ 'weight_default' => true
14
+ ] ) ?>
15
  <?php $fields->block_commons() ?>
16
+
17
+
emails/blocks/cta/_icon.png ADDED
Binary file
emails/blocks/cta/block.php CHANGED
@@ -6,17 +6,18 @@
6
  */
7
 
8
  $default_options = array(
9
- 'text' => 'Call to action',
10
- 'background' => '#256F9C',
11
- 'font_color' => '#ffffff',
12
- 'url' => home_url(),
13
- 'font_family' => $font_family,
14
- 'font_size' => 20,
15
- 'font_weight' => 'bold',
16
- 'block_background' => '#ffffff',
17
- 'width' => '200',
18
  'block_padding_top' => 20,
19
  'block_padding_bottom' => 20,
 
20
  );
21
 
22
  $options = array_merge($default_options, $options);
@@ -25,45 +26,33 @@ if (!empty($options['schema'])) {
25
  if ($options['schema'] === 'dark') {
26
  $options['block_background'] = '#000000';
27
  $options['font_color'] = '#ffffff';
28
- $options['background'] = '#96969C';
29
  }
30
-
31
  if ($options['schema'] === 'bright') {
32
  $options['block_background'] = '#ffffff';
33
  $options['font_color'] = '#ffffff';
34
- $options['background'] = '#256F9C';
35
  }
36
  }
 
 
 
 
 
 
 
 
 
37
  ?>
38
- <style>
39
- .cta-button {
40
- font-size: <?php echo $options['font_size'] ?>px;
41
- font-family: <?php echo $options['font_family'] ?>;
42
- font-weight: <?php echo $options['font_weight'] ?>;
43
- color: <?php echo $options['font_color'] ?>;
44
- text-decoration: none;
45
- background-color: <?php echo $options['background'] ?>;
46
- line-height: normal;
47
- border-top: 15px solid <?php echo $options['background'] ?>;
48
- border-bottom: 15px solid <?php echo $options['background'] ?>;
49
- border-left: 25px solid <?php echo $options['background'] ?>;
50
- border-right: 25px solid <?php echo $options['background'] ?>;
51
- width: <?php echo $options['width'] ?>px;
52
- max-width: 100%;
53
- box-sizing: border-box;
54
- border-radius: 3px;
55
- -webkit-border-radius: 3px;
56
- -moz-border-radius: 3px;
57
- display: inline-block;
58
- }
59
- </style>
60
 
61
- <a href="<?php echo $options['url'] ?>" target="_blank" rel="noopener" inline-class="cta-button"><?php echo $options['text'] ?></a>
 
62
 
63
  <div itemscope="" itemtype="http://schema.org/EmailMessage">
64
  <div itemprop="potentialAction" itemscope="" itemtype="http://schema.org/ViewAction">
65
- <meta itemprop="url" content="<?php echo esc_attr($options['url']) ?>" />
66
- <meta itemprop="name" content="<?php echo esc_attr($options['text']) ?>" />
67
  </div>
68
- <meta itemprop="description" content="<?php echo esc_attr($options['text']) ?>" />
69
  </div>
6
  */
7
 
8
  $default_options = array(
9
+ 'button_label' => 'Call to action',
10
+ 'button_url' => home_url(),
11
+ 'button_font_family' => '',
12
+ 'button_font_size' => '',
13
+ 'button_font_weight' => '',
14
+ 'button_font_color' => '',
15
+ 'button_background' => '',
16
+ 'block_background' => '',
17
+ 'button_width' => '200',
18
  'block_padding_top' => 20,
19
  'block_padding_bottom' => 20,
20
+ 'schema' => ''
21
  );
22
 
23
  $options = array_merge($default_options, $options);
26
  if ($options['schema'] === 'dark') {
27
  $options['block_background'] = '#000000';
28
  $options['font_color'] = '#ffffff';
29
+ $options['button_background'] = '#96969C';
30
  }
31
+
32
  if ($options['schema'] === 'bright') {
33
  $options['block_background'] = '#ffffff';
34
  $options['font_color'] = '#ffffff';
35
+ $options['button_background'] = '#256F9C';
36
  }
37
  }
38
+
39
+ // Cloned since we need to set the general options
40
+ $button_options = $options;
41
+
42
+ $button_options['button_font_family'] = empty( $options['button_font_family'] ) ? $global_button_font_family : $options['button_font_family'];
43
+ $button_options['button_font_size'] = empty( $options['button_font_size'] ) ? $global_button_font_size : $options['button_font_size'];
44
+ $button_options['button_font_color'] = empty( $options['button_font_color'] ) ? $global_button_font_color : $options['button_font_color'];
45
+ $button_options['button_font_weight'] = empty( $options['button_font_weight'] ) ? $global_button_font_weight : $options['button_font_weight'];
46
+ $button_options['button_background'] = empty( $options['button_background'] ) ? $global_button_background_color : $options['button_background'];
47
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
+
50
+ <?php echo TNP_Composer::button($button_options); ?>
51
 
52
  <div itemscope="" itemtype="http://schema.org/EmailMessage">
53
  <div itemprop="potentialAction" itemscope="" itemtype="http://schema.org/ViewAction">
54
+ <meta itemprop="url" content="<?php echo esc_attr($options['button_url']) ?>" />
55
+ <meta itemprop="name" content="<?php echo esc_attr($options['button_label']) ?>" />
56
  </div>
57
+ <meta itemprop="description" content="<?php echo esc_attr($options['button_label']) ?>" />
58
  </div>
emails/blocks/cta/icon.png CHANGED
Binary file
emails/blocks/cta/options.php CHANGED
@@ -1,21 +1,24 @@
1
  <?php
2
  /* @var $fields NewsletterFields */
3
-
4
- $fields->controls->data['schema'] = '';
5
  ?>
6
 
7
  <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark'), ['after-rendering' => 'reload']) ?>
8
 
 
 
 
 
 
 
9
  <div class="tnp-field-row">
10
  <div class="tnp-field-col-2">
11
- <?php $fields->text('text', 'Button label') ?>
12
  </div>
13
  <div class="tnp-field-col-2">
14
- <?php $fields->url('url', 'Button URL') ?>
15
  </div>
 
16
  </div>
17
- <?php $fields->font('font', '') ?>
18
- <?php $fields->color('background', 'Button background') ?>
19
- <?php $fields->size('width', __('Width', 'newsletter')) ?>
20
 
21
  <?php $fields->block_commons() ?>
1
  <?php
2
  /* @var $fields NewsletterFields */
 
 
3
  ?>
4
 
5
  <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark'), ['after-rendering' => 'reload']) ?>
6
 
7
+ <?php $fields->button( 'button', 'Button layout', [
8
+ 'family_default' => true,
9
+ 'size_default' => true,
10
+ 'weight_default' => true
11
+ ] ) ?>
12
+
13
  <div class="tnp-field-row">
14
  <div class="tnp-field-col-2">
15
+ <?php $fields->size('button_width', __('Width', 'newsletter')) ?>
16
  </div>
17
  <div class="tnp-field-col-2">
18
+ <?php $fields->select('button_align', 'Alignment', ['center' => __('Center'), 'left' => __('Left'), 'right' => __('Right')]) ?>
19
  </div>
20
+
21
  </div>
22
+
 
 
23
 
24
  <?php $fields->block_commons() ?>
emails/blocks/footer/_icon.png ADDED
Binary file
emails/blocks/footer/block.php CHANGED
@@ -8,29 +8,36 @@
8
  $default_options = array(
9
  'view' => 'View online',
10
  'profile' => 'Modify your subscription',
11
- 'block_background' => '#ffffff',
12
- 'font_family' => $font_family,
13
- 'font_size' => 13,
14
- 'font_color' => '#444444',
15
- 'font_weight' => 'normal',
16
  'block_padding_left' => 15,
17
  'block_padding_right' => 15,
18
  'block_padding_bottom' => 15,
19
- 'block_padding_top' => 15
 
 
20
  );
21
  $options = array_merge($default_options, $options);
 
 
 
 
 
 
22
  ?>
23
  <style>
24
  .footer-text {
25
- font-size: <?php echo $options['font_size'] ?>px;
26
- font-family: <?php echo $options['font_family'] ?>;
27
- font-weight: <?php echo $options['font_weight'] ?>;
28
- color: <?php echo $options['font_color'] ?>;
29
  text-decoration: none;
30
  }
31
  </style>
32
 
33
- <a inline-class="footer-text" href="{profile_url}" target="_blank"><?php echo esc_html($options['profile']) ?></a>
34
 
35
  <span inline-class="footer-text">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>
36
 
8
  $default_options = array(
9
  'view' => 'View online',
10
  'profile' => 'Modify your subscription',
11
+ 'font_family' => '',
12
+ 'font_size' => 14,
13
+ 'font_color' => '',
14
+ 'font_weight' => '',
 
15
  'block_padding_left' => 15,
16
  'block_padding_right' => 15,
17
  'block_padding_bottom' => 15,
18
+ 'block_padding_top' => 15,
19
+ 'block_background' => '',
20
+ 'url' => 'profile'
21
  );
22
  $options = array_merge($default_options, $options);
23
+
24
+ $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
25
+ $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
26
+ $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
27
+ $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
28
+
29
  ?>
30
  <style>
31
  .footer-text {
32
+ font-family: <?php echo $text_font_family ?>;
33
+ font-size: <?php echo $text_font_size ?>px;
34
+ font-weight: <?php echo $text_font_weight ?>;
35
+ color: <?php echo $text_font_color ?>;
36
  text-decoration: none;
37
  }
38
  </style>
39
 
40
+ <a inline-class="footer-text" href="<?php if ($options['url'] == 'unsubscription') echo '{unsubscription_url}'; else echo '{profile_url}' ?>" target="_blank"><?php echo esc_html($options['profile']) ?></a>
41
 
42
  <span inline-class="footer-text">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>
43
 
emails/blocks/footer/icon.png CHANGED
Binary file
emails/blocks/footer/options.php CHANGED
@@ -3,9 +3,15 @@
3
  ?>
4
 
5
 
6
- <?php $fields->text('view', 'View online label') ?>
7
- <?php $fields->text('profile', 'Subscription details label') ?>
8
 
9
- <?php $fields->font() ?>
 
 
 
 
 
 
10
 
11
  <?php $fields->block_commons() ?>
3
  ?>
4
 
5
 
6
+ <?php $fields->text('view', __('View online label','newsletter')) ?>
7
+ <?php $fields->text('profile', __('Subscription details label','newsletter')) ?>
8
 
9
+ <?php $fields->select('url', '', array('profile'=>__('Use profile link','newsletter'), 'unsubscription' => __('Use unsubscription link','newsletter'))) ?>
10
+
11
+ <?php $fields->font( 'font', __( 'Text', 'newsletter' ), [
12
+ 'family_default' => true,
13
+ 'size_default' => true,
14
+ 'weight_default' => true
15
+ ] ) ?>
16
 
17
  <?php $fields->block_commons() ?>
emails/blocks/giphy/_icon.png ADDED
Binary file
emails/blocks/giphy/block.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
- /*
3
- * Name: Giphy
4
- * Section: content
5
- * Description: Add a Giphy image
6
- *
7
- */
8
-
9
- /* @var $options array */
10
- /* @var $wpdb wpdb */
11
-
12
- $default_options = array(
13
- 'view'=>'View online',
14
- 'text'=>'Few words summary',
15
- 'block_background'=>'#ffffff',
16
- 'font_family'=>$font_family,
17
- 'font_size'=>13,
18
- 'color'=>'#999999',
19
- 'block_padding_top'=>15,
20
- 'block_padding_bottom'=>15,
21
- 'block_padding_left'=>0,
22
- 'block_padding_right'=>0,
23
- 'giphy_url' => ''
24
- );
25
-
26
- $options = array_merge($default_options, $options);
27
-
28
- ?>
29
-
30
- <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
31
- <tr>
32
- <td width="100%" valign="top" align="center">
33
- <img src="<?php echo $options['giphy_url'] ?>" style="max-width: 100%!important; height: auto!important;" />
34
- </td>
35
- </tr>
36
- </table>
37
-
1
+ <?php
2
+ /*
3
+ * Name: Giphy
4
+ * Section: content
5
+ * Description: Add a Giphy image
6
+ *
7
+ */
8
+
9
+ /* @var $options array */
10
+ /* @var $wpdb wpdb */
11
+
12
+ $default_options = array(
13
+ 'view'=>'View online',
14
+ 'text'=>'Few words summary',
15
+ 'font_family'=>$font_family,
16
+ 'font_size'=>13,
17
+ 'color'=>'#999999',
18
+ 'block_padding_top'=>15,
19
+ 'block_padding_bottom'=>15,
20
+ 'block_padding_left'=>0,
21
+ 'block_padding_right'=>0,
22
+ 'block_background'=>'',
23
+ 'giphy_url' => ''
24
+ );
25
+
26
+ $options = array_merge($default_options, $options);
27
+
28
+ ?>
29
+
30
+ <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
31
+ <tr>
32
+ <td width="100%" valign="top" align="center">
33
+ <img src="<?php echo $options['giphy_url'] ?>" style="max-width: 100%!important; height: auto!important;" />
34
+ </td>
35
+ </tr>
36
+ </table>
37
+
emails/blocks/giphy/icon.png CHANGED
Binary file
emails/blocks/header/_icon.png ADDED
Binary file
emails/blocks/header/block.php CHANGED
@@ -1,89 +1,97 @@
1
- <?php
2
- /*
3
- * Name: Header
4
- * Section: header
5
- * Description: Default header with company info
6
- */
7
-
8
- $default_options = array(
9
- 'font_family' => $font_family,
10
- 'font_size' => 14,
11
- 'font_color' => '#444444',
12
- 'font_weight' => 'normal',
13
- 'block_background' => '#ffffff',
14
- 'block_padding_top' => 15,
15
- 'block_padding_bottom' => 15,
16
- 'block_padding_left' => 15,
17
- 'block_padding_right' => 15,
18
- 'layout' => ''
19
- );
20
- $options = array_merge($default_options, $options);
21
-
22
- if (empty($info['header_logo']['id'])) {
23
- $media = false;
24
- } else {
25
- $media = tnp_resize($info['header_logo']['id'], array(200, 80));
26
- if ($media) {
27
- $media->alt = $info['header_title'];
28
- $media->link = home_url();
29
- }
30
- }
31
-
32
- $empty = !$media && empty($info['header_sub']) && empty($info['header_title']);
33
-
34
- if ($empty) {
35
- echo '<p>Please, set your company info.</p>';
36
- } elseif ($options['layout'] === 'logo') {
37
- include __DIR__ . '/layout-logo.php';
38
- return;
39
- }
40
- ?>
41
-
42
- <style>
43
- .header-text {
44
- padding: 10px;
45
- font-size: <?php echo $options['font_size'] ?>px;
46
- font-family: <?php echo $options['font_family'] ?>;
47
- font-weight: <?php echo $options['font_weight'] ?>;
48
- color: <?php echo $options['font_color'] ?>;
49
- text-decoration: none;
50
- line-height: normal;
51
- }
52
- .header-title {
53
- font-size: <?php echo $options['font_size'] * 1.2 ?>px;
54
- font-family: <?php echo $options['font_family'] ?>;
55
- font-weight: <?php echo $options['font_weight'] ?>;
56
- color: <?php echo $options['font_color'] ?>;
57
- text-decoration: none;
58
- line-height: normal;
59
- }
60
- .header-logo {
61
- font-family: <?php echo $options['font_family'] ?>;
62
- line-height: normal;
63
- font-weight: <?php echo $options['font_weight'] ?>;
64
- color: <?php echo $options['font_color'] ?>;
65
- }
66
- .header-logo-img {
67
- display: inline-block;
68
- max-width: 100%!important;
69
- }
70
- </style>
71
-
72
- <table border="0" cellpadding="0" cellspacing="0" width="100%" class="header-table">
73
- <tr>
74
- <td align="left" width="50%" inline-class="header-logo" class="header-logo-global">
75
- <?php if ($media) { ?>
76
- <a href="<?php echo home_url() ?>" target="_blank">
77
- <img alt="<?php echo esc_attr($media->alt) ?>" src="<?php echo $media->url ?>" width="<?php echo $media->width ?>" height="<?php echo $media->height ?>" inline-class="header-logo-img" border="0">
78
- </a>
79
- <?php } else { ?>
80
- <a href="<?php echo home_url() ?>" target="_blank" inline-class="header-title">
81
- <?php echo esc_attr($info['header_title']) ?>
82
- </a>
83
- <?php } ?>
84
- </td>
85
- <td width="50%" align="right" class="mobile-hide" inline-class="header-text">
86
- <?php echo esc_html($info['header_sub']) ?>
87
- </td>
88
- </tr>
89
- </table>
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Name: Header
4
+ * Section: header
5
+ * Description: Default header with company info
6
+ */
7
+
8
+ $default_options = array(
9
+ 'font_family' => '',
10
+ 'font_size' => 14,
11
+ 'font_color' => '',
12
+ 'font_weight' => '',
13
+ 'block_padding_top' => 15,
14
+ 'block_padding_bottom' => 15,
15
+ 'block_padding_left' => 15,
16
+ 'block_padding_right' => 15,
17
+ 'block_background' => '',
18
+ 'layout' => ''
19
+ );
20
+ $options = array_merge($default_options, $options);
21
+
22
+ $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
23
+ $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
24
+ $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
25
+ $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
26
+
27
+ if (empty($info['header_logo']['id'])) {
28
+ $media = false;
29
+ } else {
30
+ $media = tnp_resize($info['header_logo']['id'], array(200, 80));
31
+ if ($media) {
32
+ $media->alt = $info['header_title'];
33
+ $media->link = home_url();
34
+ }
35
+ }
36
+
37
+ $empty = !$media && empty($info['header_sub']) && empty($info['header_title']);
38
+
39
+ if ($empty) {
40
+ echo '<p>Please, set your company info.</p>';
41
+ } elseif ($options['layout'] === 'logo') {
42
+ include __DIR__ . '/layout-logo.php';
43
+ return;
44
+ }
45
+ ?>
46
+
47
+ <style>
48
+ .header-text {
49
+ font-family: <?php echo $text_font_family ?>;
50
+ font-size: <?php echo $text_font_size ?>px;
51
+ font-weight: <?php echo $text_font_weight ?>;
52
+ color: <?php echo $text_font_color ?>;
53
+ text-decoration: none;
54
+ line-height: normal;
55
+ padding: 10px;
56
+ }
57
+
58
+ .header-title {
59
+ font-family: <?php echo $text_font_family ?>;
60
+ font-size: <?php echo $text_font_size * 1.2 ?>px;
61
+ font-weight: <?php echo $text_font_weight ?>;
62
+ color: <?php echo $text_font_color ?>;
63
+ text-decoration: none;
64
+ line-height: normal;
65
+ }
66
+
67
+ .header-logo {
68
+ font-family: <?php echo $text_font_family ?>;
69
+ font-weight: <?php echo $text_font_weight ?>;
70
+ color: <?php echo $text_font_color ?>;
71
+ line-height: normal;
72
+ }
73
+
74
+ .header-logo-img {
75
+ display: inline-block;
76
+ max-width: 100% !important;
77
+ }
78
+ </style>
79
+
80
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" class="header-table">
81
+ <tr>
82
+ <td align="left" width="50%" inline-class="header-logo" class="header-logo-global">
83
+ <?php if ($media) { ?>
84
+ <a href="<?php echo home_url() ?>" target="_blank">
85
+ <img alt="<?php echo esc_attr($media->alt) ?>" src="<?php echo $media->url ?>" width="<?php echo $media->width ?>" height="<?php echo $media->height ?>" inline-class="header-logo-img" border="0">
86
+ </a>
87
+ <?php } else { ?>
88
+ <a href="<?php echo home_url() ?>" target="_blank" inline-class="header-title">
89
+ <?php echo esc_attr($info['header_title']) ?>
90
+ </a>
91
+ <?php } ?>
92
+ </td>
93
+ <td width="50%" align="right" class="mobile-hide" inline-class="header-text">
94
+ <?php echo esc_html($info['header_sub']) ?>
95
+ </td>
96
+ </tr>
97
+ </table>
emails/blocks/header/icon.png CHANGED
Binary file
emails/blocks/header/options.php CHANGED
@@ -1,16 +1,22 @@
1
- <?php
2
-
3
- /* @var $options array contains all the options the current block we're ediging contains */
4
- /* @var $controls NewsletterControls */
5
- /* @var $controls NewsletterFields */
6
- ?>
7
-
8
- <p>This block uses the <a href="?page=newsletter_main_info" target="_blank">global company info</a>.</p>
9
-
10
- <?php
11
- $fields->select('layout', __('Layout', 'newsletter'), ['' => __('Default', 'newsletter'), 'logo' => __('Only the logo', 'newsletter')])
12
- ?>
13
-
14
- <?php $fields->font() ?>
15
-
16
- <?php $fields->block_commons() ?>
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* @var $options array contains all the options the current block we're ediging contains */
4
+ /* @var $controls NewsletterControls */
5
+ /* @var $controls NewsletterFields */
6
+ ?>
7
+
8
+ <p>
9
+ <?php echo sprintf( __( 'Company data can be globally set on <a href="%s" target="_blank">company info panel</a>.', 'newsletter' ), '?page=newsletter_main_info' ); ?>
10
+ </p>
11
+
12
+ <?php
13
+ $fields->select('layout', __('Layout', 'newsletter'), ['' => __('Default', 'newsletter'), 'logo' => __('Only the logo', 'newsletter')])
14
+ ?>
15
+
16
+ <?php $fields->font( 'font', __( 'Text', 'newsletter' ), [
17
+ 'family_default' => true,
18
+ 'size_default' => true,
19
+ 'weight_default' => true
20
+ ] ) ?>
21
+
22
+ <?php $fields->block_commons() ?>
emails/blocks/heading/_icon.png ADDED
Binary file
emails/blocks/heading/block.php CHANGED
@@ -6,31 +6,36 @@
6
  */
7
 
8
  $default_options = array(
9
- 'text' => 'An Awesome Title',
10
- 'align' => 'center',
11
- 'block_background' => '#ffffff',
12
- 'font_family' => $font_family,
13
- 'font_size' => 30,
14
- 'font_color' => '#444444',
15
- 'font_weight' => 'normal',
16
- 'block_padding_left' => 15,
17
- 'block_padding_right' => 15,
18
- 'block_padding_bottom' => 15,
19
- 'block_padding_top' => 15
20
  );
21
  $options = array_merge($default_options, $options);
22
 
 
 
 
 
 
23
  if (!empty($options['schema'])) {
24
  if ($options['schema'] === 'dark') {
25
  $options['block_background'] = '#000000';
26
  $options['font_color'] = '#ffffff';
27
  }
28
-
29
  if ($options['schema'] === 'bright') {
30
  $options['block_background'] = '#ffffff';
31
  $options['font_color'] = '#444444';
32
  }
33
-
34
  if ($options['schema'] === 'red') {
35
  $options['block_background'] = '#c00000';
36
  $options['font_color'] = '#ffffff';
@@ -39,18 +44,18 @@ if (!empty($options['schema'])) {
39
  ?>
40
 
41
  <style>
42
- .heading-text-inline {
43
- padding: 10px;
44
- text-align: <?php echo $options['align'] ?>;
45
- font-size: <?php echo $options['font_size'] ?>px;
46
- font-family: <?php echo $options['font_family'] ?>;
47
- font-weight: <?php echo $options['font_weight'] ?>;
48
- color: <?php echo $options['font_color'] ?>;
49
- line-height: normal!important;
50
  letter-spacing: normal;
51
  }
52
  </style>
53
 
54
- <div inline-class="heading-text-inline">
55
  <?php echo $options['text'] ?>
56
  </div>
6
  */
7
 
8
  $default_options = array(
9
+ 'text' => 'An Awesome Title',
10
+ 'align' => 'center',
11
+ 'block_background' => '',
12
+ 'font_family' => '',
13
+ 'font_size' => '',
14
+ 'font_color' => '',
15
+ 'font_weight' => '',
16
+ 'block_padding_left' => 15,
17
+ 'block_padding_right' => 15,
18
+ 'block_padding_bottom' => 15,
19
+ 'block_padding_top' => 15
20
  );
21
  $options = array_merge($default_options, $options);
22
 
23
+ $title_font_family = empty( $options['font_family'] ) ? $global_title_font_family : $options['font_family'];
24
+ $title_font_size = empty( $options['font_size'] ) ? $global_title_font_size : $options['font_size'];
25
+ $title_font_color = empty( $options['font_color'] ) ? $global_title_font_color : $options['font_color'];
26
+ $title_font_weight = empty( $options['font_weight'] ) ? $global_title_font_weight : $options['font_weight'];
27
+
28
  if (!empty($options['schema'])) {
29
  if ($options['schema'] === 'dark') {
30
  $options['block_background'] = '#000000';
31
  $options['font_color'] = '#ffffff';
32
  }
33
+
34
  if ($options['schema'] === 'bright') {
35
  $options['block_background'] = '#ffffff';
36
  $options['font_color'] = '#444444';
37
  }
38
+
39
  if ($options['schema'] === 'red') {
40
  $options['block_background'] = '#c00000';
41
  $options['font_color'] = '#ffffff';
44
  ?>
45
 
46
  <style>
47
+ .title {
48
+ padding: 0;
49
+ text-align: <?php echo $options['align'] ?>;
50
+ font-size: <?php echo $title_font_size ?>px;
51
+ font-family: <?php echo $title_font_family ?>;
52
+ font-weight: <?php echo $title_font_weight ?>;
53
+ color: <?php echo $title_font_color ?>;
54
+ line-height: normal !important;
55
  letter-spacing: normal;
56
  }
57
  </style>
58
 
59
+ <div inline-class="title">
60
  <?php echo $options['text'] ?>
61
  </div>
emails/blocks/heading/icon.png CHANGED
Binary file
emails/blocks/heading/options.php CHANGED
@@ -7,8 +7,8 @@ $fields->controls->data['schema'] = '';
7
  <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark', 'red' => 'Red'), ['after-rendering' => 'reload']) ?>
8
 
9
  <?php $fields->text('text', __('Text', 'newsletter')) ?>
10
- <?php $fields->font('font', false) ?>
11
- <?php $fields->select('align', 'Alignment', array('center'=>'Center', 'left'=>'Left', 'right'=>'Right')) ?>
12
 
13
 
14
  <?php $fields->block_commons() ?>
7
  <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark', 'red' => 'Red'), ['after-rendering' => 'reload']) ?>
8
 
9
  <?php $fields->text('text', __('Text', 'newsletter')) ?>
10
+ <?php $fields->font('font', false, ['family_default'=>true, 'size_default'=>true, 'weight_default'=>true]) ?>
11
+ <?php $fields->select('align', 'Alignment', array('center'=>__('Center'), 'left'=>__('Left'), 'right'=>__('Right'))) ?>
12
 
13
 
14
  <?php $fields->block_commons() ?>
emails/blocks/hero/_icon.png ADDED
Binary file
emails/blocks/hero/block-full.php CHANGED
@@ -1,27 +1,31 @@
1
  <style>
2
  /* Styles which will be removed and injected in the replacing the matching "inline-class" attribute */
3
  .title {
4
- font-size: <?php echo $title_font_size ?>px;
5
- color: <?php echo $title_font_color ?>;
6
  font-family: <?php echo $title_font_family ?>;
 
7
  font-weight: <?php echo $title_font_weight ?>;
 
8
  line-height: normal;
9
  margin: 0;
10
  }
 
11
  .text {
 
 
 
 
12
  padding: 20px 0 0 0;
13
- font-size: <?php echo $font_size ?>px;
14
  line-height: 150%;
15
- color: <?php echo $font_color ?>;
16
- font-family: <?php echo $font_family ?>;
17
  margin: 0;
18
  }
 
19
  .image {
20
  max-width: 100%!important;
21
  display: inline-block;
22
  border: 0px;
23
  margin: 0;
24
  }
 
25
  .image-a {
26
  display: block;
27
  }
@@ -29,7 +33,7 @@
29
 
30
  <!-- layout: full -->
31
 
32
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
33
  <?php if ($media) { ?>
34
  <tr>
35
  <td class="padding-copy tnpc-row-edit" align="center" style="text-align: center; line-height: 0; padding-bottom: 20px;">
@@ -52,7 +56,7 @@
52
  <tr>
53
  <td align="center">
54
  <br>
55
- <?php echo tnpc_button($options) ?>
56
  </td>
57
  </tr>
58
  </table>
1
  <style>
2
  /* Styles which will be removed and injected in the replacing the matching "inline-class" attribute */
3
  .title {
 
 
4
  font-family: <?php echo $title_font_family ?>;
5
+ font-size: <?php echo $title_font_size ?>px;
6
  font-weight: <?php echo $title_font_weight ?>;
7
+ color: <?php echo $title_font_color ?>;
8
  line-height: normal;
9
  margin: 0;
10
  }
11
+
12
  .text {
13
+ font-family: <?php echo $text_font_family ?>;
14
+ font-size: <?php echo $text_font_size ?>px;
15
+ font-weight: <?php echo $text_font_weight ?>;
16
+ color: <?php echo $text_font_color ?>;
17
  padding: 20px 0 0 0;
 
18
  line-height: 150%;
 
 
19
  margin: 0;
20
  }
21
+
22
  .image {
23
  max-width: 100%!important;
24
  display: inline-block;
25
  border: 0px;
26
  margin: 0;
27
  }
28
+
29
  .image-a {
30
  display: block;
31
  }
33
 
34
  <!-- layout: full -->
35
 
36
+ <table width="100%" class="responsive" border="0" cellspacing="0" cellpadding="0">
37
  <?php if ($media) { ?>
38
  <tr>
39
  <td class="padding-copy tnpc-row-edit" align="center" style="text-align: center; line-height: 0; padding-bottom: 20px;">
56
  <tr>
57
  <td align="center">
58
  <br>
59
+ <?php echo TNP_Composer::button($options2) ?>
60
  </td>
61
  </tr>
62
  </table>
emails/blocks/hero/block-left.php CHANGED
@@ -1,25 +1,25 @@
1
  <style>
2
  /* Styles which will be removed and injected in the replacing the matching "inline-class" attribute */
3
  .title {
4
- font-size: <?php echo $title_font_size ?>px;
5
- color: <?php echo $title_font_color ?>;
6
- padding-top: 0;
7
  font-family: <?php echo $title_font_family ?>;
 
8
  font-weight: <?php echo $title_font_weight ?>;
 
9
  margin: 0;
10
  text-align: center;
11
  line-height: normal;
12
  }
13
  .text {
 
 
 
 
14
  padding: 20px 0 0 0;
15
- font-size: <?php echo $font_size ?>px;
16
  line-height: 150%;
17
- color: <?php echo $font_color ?>;
18
- font-family: <?php echo $font_family ?>;
19
- font-weight: <?php echo $font_weight ?>;
20
  margin: 0;
21
  text-align: center;
22
  }
 
23
  .image {
24
  max-width: 100%!important;
25
  display: block;
@@ -27,6 +27,7 @@
27
  .image-a {
28
  display: block;
29
  }
 
30
  .button {
31
  padding-top: 15px;
32
  }
@@ -34,7 +35,7 @@
34
 
35
  <!-- layout: left -->
36
 
37
- <table width="50%" align="left" class="hero-table" border="0" cellspacing="0" cellpadding="0">
38
  <tr>
39
  <td align="center" valign="top">
40
  <?php echo TNP_Composer::image( $media, [ 'class' => 'image', 'link-class' => 'image-a' ] ); ?>
@@ -42,9 +43,9 @@
42
  </tr>
43
  </table>
44
 
45
- <table width="49%" align="right" class="hero-table hero-table-right" border="0" cellspacing="0" cellpadding="0">
46
  <tr>
47
- <td align="center" inline-class="title">
48
  <span><?php echo $options['title'] ?></span>
49
  </td>
50
  </tr>
@@ -56,7 +57,7 @@
56
 
57
  <tr>
58
  <td align="center" inline-class="button">
59
- <?php echo tnpc_button($options) ?>
60
  </td>
61
  </tr>
62
 
1
  <style>
2
  /* Styles which will be removed and injected in the replacing the matching "inline-class" attribute */
3
  .title {
 
 
 
4
  font-family: <?php echo $title_font_family ?>;
5
+ font-size: <?php echo $title_font_size ?>px;
6
  font-weight: <?php echo $title_font_weight ?>;
7
+ color: <?php echo $title_font_color ?>;
8
  margin: 0;
9
  text-align: center;
10
  line-height: normal;
11
  }
12
  .text {
13
+ font-family: <?php echo $text_font_family ?>;
14
+ font-size: <?php echo $text_font_size ?>px;
15
+ font-weight: <?php echo $text_font_weight ?>;
16
+ color: <?php echo $text_font_color ?>;
17
  padding: 20px 0 0 0;
 
18
  line-height: 150%;
 
 
 
19
  margin: 0;
20
  text-align: center;
21
  }
22
+
23
  .image {
24
  max-width: 100%!important;
25
  display: block;
27
  .image-a {
28
  display: block;
29
  }
30
+
31
  .button {
32
  padding-top: 15px;
33
  }
35
 
36
  <!-- layout: left -->
37
 
38
+ <table width="49%" align="left" class="responsive" border="0" cellspacing="0" cellpadding="0">
39
  <tr>
40
  <td align="center" valign="top">
41
  <?php echo TNP_Composer::image( $media, [ 'class' => 'image', 'link-class' => 'image-a' ] ); ?>
43
  </tr>
44
  </table>
45
 
46
+ <table width="49%" align="right" class="responsive" border="0" cellspacing="0" cellpadding="0">
47
  <tr>
48
+ <td align="center" inline-class="title" class="hero-title">
49
  <span><?php echo $options['title'] ?></span>
50
  </td>
51
  </tr>
57
 
58
  <tr>
59
  <td align="center" inline-class="button">
60
+ <?php echo TNP_Composer::button($options2) ?>
61
  </td>
62
  </tr>
63
 
emails/blocks/hero/block-right.php CHANGED
@@ -1,25 +1,25 @@
1
  <style>
2
  /* Styles which will be removed and injected in the replacing the matching "inline-class" attribute */
3
  .title {
4
- font-size: <?php echo $title_font_size ?>px;
5
- color: <?php echo $title_font_color ?>;
6
- padding-top: 0;
7
  font-family: <?php echo $title_font_family ?>;
 
8
  font-weight: <?php echo $title_font_weight ?>;
 
9
  line-height: normal;
10
  margin: 0;
11
  text-align: center;
12
  }
13
  .text {
 
 
 
 
14
  padding: 20px 0 0 0;
15
- font-size: <?php echo $font_size ?>px;
16
  line-height: 150%;
17
- color: <?php echo $font_color ?>;
18
- font-family: <?php echo $font_family ?>;
19
- font-weight: <?php echo $font_weight ?>;
20
  text-align: center;
21
  margin: 0;
22
  }
 
23
  .image {
24
  max-width: 100%!important;
25
  display: block;
@@ -27,6 +27,7 @@
27
  .image-a {
28
  display: block;
29
  }
 
30
  .button {
31
  padding-top: 15px;
32
  }
@@ -36,7 +37,7 @@
36
 
37
  <div dir="rtl">
38
 
39
- <table width="50%" align="right" class="hero-table" border="0" cellspacing="0" cellpadding="0">
40
  <tr>
41
  <td align="center" valign="top" dir="ltr">
42
  <?php echo TNP_Composer::image( $media, [ 'class' => 'image', 'link-class' => 'image-a' ] ); ?>
@@ -44,9 +45,9 @@
44
  </tr>
45
  </table>
46
 
47
- <table width="49%" align="left" class="hero-table hero-table-right" border="0" cellspacing="0" cellpadding="0">
48
  <tr>
49
- <td align="center" inline-class="title" dir="ltr">
50
  <?php echo $options['title'] ?>
51
  </td>
52
  </tr>
@@ -57,7 +58,7 @@
57
  </tr>
58
  <tr>
59
  <td align="center" inline-class="button" dir="ltr">
60
- <?php echo tnpc_button($options) ?>
61
  </td>
62
  </tr>
63
  </table>
1
  <style>
2
  /* Styles which will be removed and injected in the replacing the matching "inline-class" attribute */
3
  .title {
 
 
 
4
  font-family: <?php echo $title_font_family ?>;
5
+ font-size: <?php echo $title_font_size ?>px;
6
  font-weight: <?php echo $title_font_weight ?>;
7
+ color: <?php echo $title_font_color ?>;
8
  line-height: normal;
9
  margin: 0;
10
  text-align: center;
11
  }
12
  .text {
13
+ font-family: <?php echo $text_font_family ?>;
14
+ font-size: <?php echo $text_font_size ?>px;
15
+ font-weight: <?php echo $text_font_weight ?>;
16
+ color: <?php echo $text_font_color ?>;
17
  padding: 20px 0 0 0;
 
18
  line-height: 150%;
 
 
 
19
  text-align: center;
20
  margin: 0;
21
  }
22
+
23
  .image {
24
  max-width: 100%!important;
25
  display: block;
27
  .image-a {
28
  display: block;
29
  }
30
+
31
  .button {
32
  padding-top: 15px;
33
  }
37
 
38
  <div dir="rtl">
39
 
40
+ <table width="49%" align="right" class="responsive" border="0" cellspacing="0" cellpadding="0">
41
  <tr>
42
  <td align="center" valign="top" dir="ltr">
43
  <?php echo TNP_Composer::image( $media, [ 'class' => 'image', 'link-class' => 'image-a' ] ); ?>
45
  </tr>
46
  </table>
47
 
48
+ <table width="49%" align="left" class="responsive" border="0" cellspacing="0" cellpadding="0">
49
  <tr>
50
+ <td align="center" inline-class="title" class="hero-title" dir="ltr">
51
  <?php echo $options['title'] ?>
52
  </td>
53
  </tr>
58
  </tr>
59
  <tr>
60
  <td align="center" inline-class="button" dir="ltr">
61
+ <?php echo TNP_Composer::button($options2) ?>
62
  </td>
63
  </tr>
64
  </table>
emails/blocks/hero/block.php CHANGED
@@ -12,15 +12,14 @@
12
  $defaults = array(
13
  'title' => 'An Awesome Title',
14
  'text' => 'This is just a simple text you should change',
15
- 'font_family' => 'Helvetica, Arial, sans-serif',
16
- 'font_size' => 18,
17
- 'font_weight' => 'normal',
18
- 'font_color' => '#000000',
19
- 'title_font_family' => 'Helvetica, Arial, sans-serif',
20
- 'title_font_size' => '32',
21
- 'title_font_weight' => 'bold',
22
- 'title_font_color' => '#000000',
23
- 'block_background' => '#ffffff',
24
  'layout' => 'full',
25
  'button_url' => '',
26
  'button_font_family' => 'Helvetica, Arial, sans-serif',
@@ -28,11 +27,12 @@ $defaults = array(
28
  'button_font_color' => '#ffffff',
29
  'button_font_weight' => 'bold',
30
  'button_font_size' => 20,
31
- 'button_background' => '#256F9C',
32
  'block_padding_top' => 30,
33
  'block_padding_bottom' => 30,
34
- 'block_padding_left' => 15,
35
- 'block_padding_right' => 15
 
36
  );
37
 
38
  $options = array_merge($defaults, $options);
@@ -63,18 +63,21 @@ if ($layout == 'full') {
63
  $options = array_merge(array('block_padding_left' => 15, 'block_padding_right' => 15), $options);
64
  }
65
 
66
- $font_family = $options['font_family'];
67
- $font_size = $options['font_size'];
68
- $font_weight = $options['font_weight'];
69
- $font_color = $options['font_color'];
70
 
71
- $title_font_family = $options['title_font_family'];
72
- $title_font_size = $options['title_font_size'];
73
- $title_font_weight = $options['title_font_weight'];
74
- $title_font_color = $options['title_font_color'];
75
 
76
  $layout = $options['layout'];
77
 
 
 
 
78
  if (!empty($options['image']['id'])) {
79
  if ($layout == 'full') {
80
  $media = tnp_resize_2x($options['image']['id'], array(600, 0));
@@ -89,7 +92,14 @@ if (!empty($options['image']['id'])) {
89
  }
90
  }
91
  if ($media) {
92
- $media->alt = $options['title'];
 
 
 
 
 
 
 
93
  $media->link = $options['button_url'];
94
  }
95
  } else {
12
  $defaults = array(
13
  'title' => 'An Awesome Title',
14
  'text' => 'This is just a simple text you should change',
15
+ 'font_family' => '',
16
+ 'font_size' => '',
17
+ 'font_weight' => '',
18
+ 'font_color' => '',
19
+ 'title_font_family' => '',
20
+ 'title_font_size' => '',
21
+ 'title_font_weight' => '',
22
+ 'title_font_color' => '',
 
23
  'layout' => 'full',
24
  'button_url' => '',
25
  'button_font_family' => 'Helvetica, Arial, sans-serif',
27
  'button_font_color' => '#ffffff',
28
  'button_font_weight' => 'bold',
29
  'button_font_size' => 20,
30
+ 'button_background' => '',
31
  'block_padding_top' => 30,
32
  'block_padding_bottom' => 30,
33
+ 'block_padding_left' => 0,
34
+ 'block_padding_right' => 0,
35
+ 'block_background' => '',
36
  );
37
 
38
  $options = array_merge($defaults, $options);
63
  $options = array_merge(array('block_padding_left' => 15, 'block_padding_right' => 15), $options);
64
  }
65
 
66
+ $title_font_family = empty( $options['title_font_family'] ) ? $global_title_font_family : $options['title_font_family'];
67
+ $title_font_size = empty( $options['title_font_size'] ) ? $global_title_font_size : $options['title_font_size'];
68
+ $title_font_color = empty( $options['title_font_color'] ) ? $global_title_font_color : $options['title_font_color'];
69
+ $title_font_weight = empty( $options['title_font_weight'] ) ? $global_title_font_weight : $options['title_font_weight'];
70
 
71
+ $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
72
+ $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
73
+ $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
74
+ $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
75
 
76
  $layout = $options['layout'];
77
 
78
+ $options2['button_background'] = empty($options['button_background'])?$composer['color']:$options['button_background'];
79
+ $options2['button_font_family'] = empty($options['button_font_family'])?$composer['font_family']:$options['button_font_family'];
80
+
81
  if (!empty($options['image']['id'])) {
82
  if ($layout == 'full') {
83
  $media = tnp_resize_2x($options['image']['id'], array(600, 0));
92
  }
93
  }
94
  if ($media) {
95
+ if (!empty($options['image_alt'])) {
96
+ $media->alt = $options['image_alt'];
97
+ } else if (!empty($options['title'])) {
98
+ $media->alt = $options['title'];
99
+ } else {
100
+ $alt_texts = array('picture', 'image', 'pic', 'photo');
101
+ $media->alt = $alt_texts[array_rand($alt_texts)];
102
+ }
103
  $media->link = $options['button_url'];
104
  }
105
  } else {
emails/blocks/hero/icon.png CHANGED
Binary file
emails/blocks/hero/options.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  * @var $options array contains all the options the current block we're ediging contains
4
- * @var $controls NewsletterControls
5
  */
6
  /* @var $fields NewsletterFields */
7
 
@@ -9,26 +9,26 @@ $fields->controls->data['schema'] = '';
9
  ?>
10
 
11
  <div class="tnp-field-row">
12
- <div class="tnp-field-col-2">
13
- <?php $fields->select('layout', __('Layout', 'newsletter'), array('full' => 'Full', 'left' => 'Image left', 'right' => 'Image right'))?>
14
- </div>
15
  <div class="tnp-field-col-2">
16
- <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark'), ['after-rendering'=>'reload'])?>
 
 
 
17
  </div>
18
  </div>
19
 
20
  <?php $fields->text('title', __('Title', 'newsletter')) ?>
21
 
22
- <?php $fields->font('title_font', '')?>
23
 
24
- <?php $fields->media('image', __('Image', 'newsletter'))?>
25
 
26
 
27
 
28
  <?php $fields->textarea('text', __('Text', 'newsletter')) ?>
29
- <?php $fields->font('font', '')?>
30
 
31
- <?php $fields->button('button', __('Button', 'newsletter'), ['weight'=>true])?>
32
 
33
  <?php $fields->block_commons() ?>
34
 
1
  <?php
2
  /*
3
  * @var $options array contains all the options the current block we're ediging contains
4
+ * @var $controls NewsletterControls
5
  */
6
  /* @var $fields NewsletterFields */
7
 
9
  ?>
10
 
11
  <div class="tnp-field-row">
 
 
 
12
  <div class="tnp-field-col-2">
13
+ <?php $fields->select('layout', __('Layout', 'newsletter'), array('full' => 'Full', 'left' => 'Image left', 'right' => 'Image right')) ?>
14
+ </div>
15
+ <div class="tnp-field-col-2">
16
+ <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark'), ['after-rendering' => 'reload']) ?>
17
  </div>
18
  </div>
19
 
20
  <?php $fields->text('title', __('Title', 'newsletter')) ?>
21
 
22
+ <?php $fields->font('title_font', '', ['family_default'=>true, 'size_default'=>true, 'weight_default'=>true]) ?>
23
 
24
+ <?php $fields->media('image', __('Image', 'newsletter'), array('alt' => true)) ?>
25
 
26
 
27
 
28
  <?php $fields->textarea('text', __('Text', 'newsletter')) ?>
29
+ <?php $fields->font( 'font', '', [ 'family_default' => true, 'size_default' => true, 'weight_default' => true ] ) ?>
30
 
31
+ <?php $fields->button('button', __('Button', 'newsletter'), ['weight' => true]) ?>
32
 
33
  <?php $fields->block_commons() ?>
34
 
emails/blocks/hero/style.css CHANGED
@@ -1,10 +1,5 @@
1
  @media all and (max-width: 525px) {
2
- .hero-table {
3
- width: 100%!important;
4
- max-width: 100%!important;
5
- }
6
-
7
- .hero-table-right {
8
- margin-top: 20px;
9
  }
10
  }
1
  @media all and (max-width: 525px) {
2
+ .hero-title {
3
+ padding-top: 15px;
 
 
 
 
 
4
  }
5
  }
emails/blocks/hero/style.min.css ADDED
@@ -0,0 +1 @@
 
1
+ @media all and (max-width:525px){.hero-title{padding-top:15px}}
emails/blocks/html/_icon.png ADDED
Binary file
emails/blocks/html/block.php CHANGED
@@ -1,41 +1,41 @@
1
- <?php
2
- /*
3
- * Name: Html
4
- * Section: content
5
- * Description: Free HTML block
6
- *
7
- */
8
-
9
- /* @var $options array */
10
- /* @var $wpdb wpdb */
11
-
12
- $default_options = array(
13
- 'html'=>'<p style="font-size: 16px; font-family: Helvetica, Arial, sans-serif">This is a piece of nice html code. You can use any tag, but be aware that email readers do not render everything.<p>',
14
- 'block_padding_left' => 15,
15
- 'block_padding_right' => 15,
16
- 'block_padding_top' => 20,
17
- 'block_padding_bottom' => 20,
18
- 'block_background' => '#ffffff',
19
- 'font_family' => 'Helvetica, Arial, sans-serif',
20
- 'font_size' => 16,
21
- 'font_color' => '#000'
22
- );
23
-
24
- $options = array_merge($default_options, $options);
25
-
26
- ?>
27
- <style>
28
- .html-td {
29
- font-family: <?php echo $options['font_family']?>;
30
- font-size: <?php echo $options['font_size']?>px;
31
- color: <?php echo $options['font_color']?>;
32
- }
33
- </style>
34
- <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
35
- <tr>
36
- <td width="100%" valign="top" align="center" inline-class="html-td" class="html-td-global">
37
- <?php echo $options['html'] ?>
38
- </td>
39
- </tr>
40
- </table>
41
-
1
+ <?php
2
+ /*
3
+ * Name: Html
4
+ * Section: content
5
+ * Description: Free HTML block
6
+ *
7
+ */
8
+
9
+ /* @var $options array */
10
+ /* @var $wpdb wpdb */
11
+
12
+ $default_options = array(
13
+ 'html'=>'<p style="font-size: 16px; font-family: Helvetica, Arial, sans-serif">This is a piece of nice html code. You can use any tag, but be aware that email readers do not render everything.<p>',
14
+ 'block_padding_left' => 15,
15
+ 'block_padding_right' => 15,
16
+ 'block_padding_top' => 20,
17
+ 'block_padding_bottom' => 20,
18
+ 'block_background' => '',
19
+ 'font_family' => 'Helvetica, Arial, sans-serif',
20
+ 'font_size' => 16,
21
+ 'font_color' => '#000'
22
+ );
23
+
24
+ $options = array_merge($default_options, $options);
25
+
26
+ ?>
27
+ <style>
28
+ .html-td {
29
+ font-family: <?php echo $options['font_family']?>;
30
+ font-size: <?php echo $options['font_size']?>px;
31
+ color: <?php echo $options['font_color']?>;
32
+ }
33
+ </style>
34
+ <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
35
+ <tr>
36
+ <td width="100%" valign="top" align="center" inline-class="html-td" class="html-td-global">
37
+ <?php echo $options['html'] ?>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+
emails/blocks/html/icon.png CHANGED
Binary file
emails/blocks/image/_icon.png ADDED
Binary file
emails/blocks/image/block.php CHANGED
@@ -12,7 +12,7 @@ $defaults = array(
12
  'image' => '',
13
  'url' => '',
14
  'width' => 0,
15
- 'block_background' => '#ffffff',
16
  'block_padding_left' => 0,
17
  'block_padding_right' => 0,
18
  'block_padding_bottom' => 15,
@@ -21,18 +21,22 @@ $defaults = array(
21
 
22
  $options = array_merge($defaults, $options);
23
 
24
- $alt = '';
25
  if (empty($options['image']['id'])) {
26
- $media = new TNP_Media();
27
- // A placeholder can be set by a preset and it is kept indefinitely
28
- if (!empty($options['placeholder'])) {
29
- $media->url = $options['placeholder'];
30
- $media->width = 600;
31
- $media->height = 250;
32
  } else {
33
- $media->url = 'https://source.unsplash.com/1200x500/daily';
34
- $media->width = 600;
35
- $media->height = 250;
 
 
 
 
 
 
 
 
36
  }
37
  } else {
38
  $media = tnp_resize_2x($options['image']['id'], array(600, 0));
@@ -41,14 +45,22 @@ if (empty($options['image']['id'])) {
41
  echo 'The selected media file cannot be processed';
42
  return;
43
  }
44
- $media->alt = $options['image_alt'];
45
  }
46
 
47
  if (!empty($options['width'])) {
48
  $media->set_width($options['width']);
49
  }
50
  $media->link = $options['url'];
 
 
 
51
  $image_class_name = 'image';
 
 
 
 
 
 
52
  ?>
53
  <style>
54
  .<?php echo $image_class_name ?> {
@@ -58,7 +70,9 @@ $image_class_name = 'image';
58
  width: <?php echo $media->width ?>px;
59
  line-height: 0;
60
  margin: 0 auto;
 
61
  }
62
  </style>
63
 
64
  <?php echo TNP_Composer::image( $media, [ 'class' => $image_class_name ] ); ?>
 
12
  'image' => '',
13
  'url' => '',
14
  'width' => 0,
15
+ 'block_background' => '',
16
  'block_padding_left' => 0,
17
  'block_padding_right' => 0,
18
  'block_padding_bottom' => 15,
21
 
22
  $options = array_merge($defaults, $options);
23
 
 
24
  if (empty($options['image']['id'])) {
25
+ if (!empty($options['image-url'])) {
26
+ $media = new TNP_Media();
27
+ $media->url = $options['image-url'];
 
 
 
28
  } else {
29
+ $media = new TNP_Media();
30
+ // A placeholder can be set by a preset and it is kept indefinitely
31
+ if (!empty($options['placeholder'])) {
32
+ $media->url = $options['placeholder'];
33
+ $media->width = 600;
34
+ $media->height = 250;
35
+ } else {
36
+ $media->url = 'https://source.unsplash.com/1200x500/daily';
37
+ $media->width = 600;
38
+ $media->height = 250;
39
+ }
40
  }
41
  } else {
42
  $media = tnp_resize_2x($options['image']['id'], array(600, 0));
45
  echo 'The selected media file cannot be processed';
46
  return;
47
  }
 
48
  }
49
 
50
  if (!empty($options['width'])) {
51
  $media->set_width($options['width']);
52
  }
53
  $media->link = $options['url'];
54
+ if (!empty($options['image-alt'])) {
55
+ $media->alt = $options['image-alt'];
56
+ }
57
  $image_class_name = 'image';
58
+
59
+ $img_align = '';
60
+ if (in_array($options['img_align'], array('left', 'right'))) {
61
+ $img_align = 'float: ' . $options['img_align'] .';';
62
+ }
63
+
64
  ?>
65
  <style>
66
  .<?php echo $image_class_name ?> {
70
  width: <?php echo $media->width ?>px;
71
  line-height: 0;
72
  margin: 0 auto;
73
+ <?php echo $img_align ?>
74
  }
75
  </style>
76
 
77
  <?php echo TNP_Composer::image( $media, [ 'class' => $image_class_name ] ); ?>
78
+
emails/blocks/image/icon.png CHANGED
Binary file
emails/blocks/image/options.php CHANGED
@@ -1,14 +1,24 @@
1
  <?php
2
-
3
  /* @var $options array contains all the options the current block we're ediging contains */
4
  /* @var $controls NewsletterControls */
5
  /* @var $fields NewsletterFields */
6
  ?>
7
 
8
  <?php $controls->hidden('placeholder') ?>
9
- <?php $fields->media('image', null, array('alt'=>true)) ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- <?php $fields->url('url', 'URL') ?>
12
- <?php $fields->size('width', 'Width') ?>
13
  <?php $fields->block_commons() ?>
14
 
1
  <?php
 
2
  /* @var $options array contains all the options the current block we're ediging contains */
3
  /* @var $controls NewsletterControls */
4
  /* @var $fields NewsletterFields */
5
  ?>
6
 
7
  <?php $controls->hidden('placeholder') ?>
8
+ <?php $fields->media('image', 'Choose an image', array('alt' => false)) ?>
9
+ <?php $fields->url('image-url', 'or direct image src URL
10
+ <br>(like <strong>personalized images</strong> and <strong>countdowns</strong> from <a href="https://niftyimages.com/" target="_blank">niftyimages.com</a>)') ?>
11
+ <?php $fields->text('image-alt', 'Alternative text') ?>
12
+ <?php $fields->url('url', __('Link URL', 'newsletter')) ?>
13
+
14
+ <div class="tnp-field-row">
15
+ <div class="tnp-field-col-2">
16
+ <?php $fields->size('width', __('Width', 'newsletter')) ?>
17
+ </div>
18
+ <div class="tnp-field-col-2">
19
+ <?php $fields->select('img_align', __('Image align', 'newsletter'), ['center' => __('Center', 'newsletter'), 'left' => __('Left', 'newsletter'), 'right' => __('Right')]) ?>
20
+ </div>
21
+ </div>
22
 
 
 
23
  <?php $fields->block_commons() ?>
24
 
emails/blocks/posts/_icon.png ADDED
Binary file
emails/blocks/posts/block.php CHANGED
@@ -12,35 +12,37 @@
12
  $defaults = array(
13
  'title' => 'Last news',
14
  'color' => '#999999',
15
- 'font_family' => 'Helvetica, Arial, sans-serif',
16
- 'font_size' => '16',
17
- 'font_color' => '#333333',
18
- 'title_font_family' => 'Helvetica, Arial, sans-serif',
19
- 'title_font_size' => '25',
20
- 'title_font_color' => '#333333',
21
- 'title_font_weight' => 'normal',
 
22
  'max' => 4,
23
- 'button_label' => __('Read more...', 'newsletter'),
24
  'categories' => '',
25
  'tags' => '',
26
- 'block_background' => '#ffffff',
27
  'layout' => 'one',
28
  'language' => '',
29
- 'button_background' => '#256F9C',
30
- 'button_font_color' => '#ffffff',
31
- 'button_font_family' => 'Helvetica, Arial, sans-serif',
32
- 'button_font_size' => 16,
 
 
33
  'block_padding_left' => 15,
34
  'block_padding_right' => 15,
35
  'block_padding_top' => 15,
36
  'block_padding_bottom' => 15,
37
- 'button_font_weight' => 'normal',
38
  'excerpt_length' => 30,
39
  'post_offset' => 0,
40
  'automated_include' => 'new',
41
  'inline_edits' => [],
42
  'automated_no_contents' => 'No new posts by now!',
43
- 'automated' => '1'
 
44
  );
45
 
46
  // Backward compatibility
@@ -50,16 +52,6 @@ if (isset($options['automated_required'])) {
50
 
51
  $options = array_merge($defaults, $options);
52
 
53
- $font_family = $options['font_family'];
54
- $font_size = $options['font_size'];
55
- $excerpt_length = $options['excerpt_length'];
56
-
57
- $title_font_family = $options['title_font_family'];
58
- $title_font_size = $options['title_font_size'];
59
- $title_font_weight = $options['title_font_weight'];
60
-
61
- $show_image = !empty($options['show_image']);
62
-
63
  $filters = array();
64
 
65
  $options['max'] = (int) $options['max'];
@@ -76,8 +68,8 @@ if (!empty($options['categories'])) {
76
 
77
  if (!empty($options['tags'])) {
78
  $tags = explode(',', $options['tags']);
79
- $tags = array_unique(array_map('sanitize_title', $tags));
80
- $filters['tag'] = $tags;
81
  }
82
 
83
  if ($context['type'] != 'automated') {
@@ -120,20 +112,47 @@ if ($posts) {
120
  }
121
 
122
  $current_language = Newsletter::instance()->get_current_language();
123
- Newsletter::instance()->switch_language($options['language']);
124
-
125
- $alternative = plugins_url('newsletter') . '/emails/blocks/posts/images/blank.png';
126
- $alternative_2 = plugins_url('newsletter') . '/emails/blocks/posts/images/blank-240x160.png';
127
 
128
  remove_all_filters('excerpt_more');
129
 
130
- if ($options['layout'] == 'one') {
131
- include __DIR__ . '/layout-one.php';
132
- } else if ($options['layout'] == 'two') {
133
- include __DIR__ . '/layout-two.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  } else {
135
- include __DIR__ . '/layout-big-image.php';
136
  }
137
 
138
- Newsletter::instance()->switch_language($options['language']);
139
-
12
  $defaults = array(
13
  'title' => 'Last news',
14
  'color' => '#999999',
15
+ 'font_family' => '',
16
+ 'font_size' => '',
17
+ 'font_color' => '',
18
+ 'title_weight' => '',
19
+ 'title_font_family' => '',
20
+ 'title_font_size' => '',
21
+ 'title_font_color' => '',
22
+ 'title_font_weight' => '',
23
  'max' => 4,
 
24
  'categories' => '',
25
  'tags' => '',
 
26
  'layout' => 'one',
27
  'language' => '',
28
+ 'button_label' => __('Read more...', 'newsletter'),
29
+ 'button_background' => '',
30
+ 'button_font_color' => '',
31
+ 'button_font_family' => '',
32
+ 'button_font_size' => '',
33
+ 'button_font_weight' => '',
34
  'block_padding_left' => 15,
35
  'block_padding_right' => 15,
36
  'block_padding_top' => 15,
37
  'block_padding_bottom' => 15,
38
+ 'block_background' => '',
39
  'excerpt_length' => 30,
40
  'post_offset' => 0,
41
  'automated_include' => 'new',
42
  'inline_edits' => [],
43
  'automated_no_contents' => 'No new posts by now!',
44
+ 'automated' => '1',
45
+ 'show_read_more_button' => true,
46
  );
47
 
48
  // Backward compatibility
52
 
53
  $options = array_merge($defaults, $options);
54
 
 
 
 
 
 
 
 
 
 
 
55
  $filters = array();
56
 
57
  $options['max'] = (int) $options['max'];
68
 
69
  if (!empty($options['tags'])) {
70
  $tags = explode(',', $options['tags']);
71
+ // It's ok even as array
72
+ $filters['tag'] = array_unique(array_map('sanitize_title', $tags));
73
  }
74
 
75
  if ($context['type'] != 'automated') {
112
  }
113
 
114
  $current_language = Newsletter::instance()->get_current_language();
115
+ Newsletter::instance()->switch_language($current_language);
 
 
 
116
 
117
  remove_all_filters('excerpt_more');
118
 
119
+ $image_placeholder_url = plugins_url( 'newsletter' ) . '/emails/blocks/posts/images/blank-240x160.png';
120
+
121
+ $excerpt_length = $options['excerpt_length'];
122
+
123
+ $show_image = ! empty( $options['show_image'] );
124
+ $show_date = ! empty( $options['show_date'] );
125
+ $show_author = ! empty( $options['show_author'] );
126
+
127
+ $title_font_family = empty( $options['title_font_family'] ) ? $global_title_font_family : $options['title_font_family'];
128
+ $title_font_size = empty( $options['title_font_size'] ) ? $global_title_font_size : $options['title_font_size'];
129
+ $title_font_color = empty( $options['title_font_color'] ) ? $global_title_font_color : $options['title_font_color'];
130
+ $title_font_weight = empty( $options['title_font_weight'] ) ? $global_title_font_weight : $options['title_font_weight'];
131
+
132
+ $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
133
+ $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
134
+ $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
135
+ $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
136
+
137
+ $button_options = $options;
138
+ $button_options['button_font_family'] = empty( $options['button_font_family'] ) ? $global_button_font_family : $options['button_font_family'];
139
+ $button_options['button_font_size'] = empty( $options['button_font_size'] ) ? $global_button_font_size : $options['button_font_size'];
140
+ $button_options['button_font_color'] = empty( $options['button_font_color'] ) ? $global_button_font_color : $options['button_font_color'];
141
+ $button_options['button_font_weight'] = empty( $options['button_font_weight'] ) ? $global_button_font_weight : $options['button_font_weight'];
142
+ $button_options['button_background'] = empty( $options['button_background'] ) ? $global_button_background_color : $options['button_background'];
143
+
144
+ $show_read_more_button = (bool) $options['show_read_more_button'];
145
+
146
+ if ( $options['layout'] == 'one' ) {
147
+ include __DIR__ . '/layout-one.php';
148
+ } else if ( $options['layout'] == 'one-2' ) {
149
+ include __DIR__ . '/layout-one-2.php';
150
+ } else if ( $options['layout'] == 'two' ) {
151
+ include __DIR__ . '/layout-two.php';
152
+ } else if ( $options['layout'] == 'full-post' ) {
153
+ include __DIR__ . '/layout-full-post.php';
154
  } else {
155
+ include __DIR__ . '/layout-big-image.php';
156
  }
157
 
158
+ Newsletter::instance()->switch_language( $options['language'] );
 
emails/blocks/posts/icon.png CHANGED
Binary file
emails/blocks/posts/layout-big-image.php CHANGED
@@ -2,36 +2,49 @@
2
  $size = ['width' => 600, 'height' => 0];
3
  ?>
4
  <style>
5
- .post-date {
6
- padding: 0 0 5px 0;
7
- font-size: 13px;
8
- font-family: <?php echo $font_family ?>;
9
- font-weight: normal;
10
- color: #aaaaaa;
11
- }
12
-
13
  .post-title {
14
- padding: 0 0 5px 0;
15
- font-size: <?php echo $title_font_size ?>px;
16
  font-family: <?php echo $title_font_family ?>;
 
17
  font-weight: <?php echo $title_font_weight ?>;
18
- color: <?php echo $options['title_font_color'] ?>;
19
  line-height: normal;
 
20
  }
21
 
22
  .post-excerpt {
23
- padding: 10px 0 15px 0;
24
- font-family: <?php echo $font_family ?>;
25
- color: <?php echo $options['font_color'] ?>;
26
- font-size: <?php echo $font_size ?>px;
27
  line-height: 1.5em;
 
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  </style>
30
 
31
 
32
  <?php foreach ($posts as $post) { ?>
 
33
  <?php
34
  $url = tnp_post_permalink($post);
 
 
35
  $media = null;
36
  if ($show_image) {
37
  $media = tnp_composer_block_posts_get_media($post, $size);
@@ -40,10 +53,15 @@ $size = ['width' => 600, 'height' => 0];
40
  $media->link = $url;
41
  }
42
  }
43
- $options['button_url'] = $url;
44
- ?>
45
-
46
 
 
 
 
 
 
 
 
 
47
 
48
  <?php if ($media) { ?>
49
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom: 20px">
@@ -61,13 +79,22 @@ $size = ['width' => 600, 'height' => 0];
61
 
62
  <!-- ARTICLE -->
63
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
64
- <?php if (!empty($options['show_date'])) { ?>
65
  <tr>
66
  <td align="<?php echo $align_left ?>" inline-class="post-date">
67
  <?php echo tnp_post_date($post) ?>
68
  </td>
69
  </tr>
70
  <?php } ?>
 
 
 
 
 
 
 
 
 
71
  <tr>
72
  <td align="<?php echo $align_left ?>"
73
  inline-class="post-title"
@@ -92,12 +119,14 @@ $size = ['width' => 600, 'height' => 0];
92
  ?>
93
  </td>
94
  </tr>
95
- <tr>
96
- <td align="<?php echo $align_left ?>" align="center">
97
- <?php echo TNP_Composer::button($options) ?>
98
- <br><br>
99
- </td>
100
- </tr>
 
 
101
  </table>
102
 
103
  </td>
2
  $size = ['width' => 600, 'height' => 0];
3
  ?>
4
  <style>
 
 
 
 
 
 
 
 
5
  .post-title {
 
 
6
  font-family: <?php echo $title_font_family ?>;
7
+ font-size: <?php echo $title_font_size ?>px;
8
  font-weight: <?php echo $title_font_weight ?>;
9
+ color: <?php echo $title_font_color ?>;
10
  line-height: normal;
11
+ padding: 0 0 5px 0;
12
  }
13
 
14
  .post-excerpt {
15
+ font-family: <?php echo $text_font_family ?>;
16
+ font-size: <?php echo $text_font_size ?>px;
17
+ font-weight: <?php echo $text_font_weight ?>;
18
+ color: <?php echo $text_font_color ?>;
19
  line-height: 1.5em;
20
+ padding: 10px 0 15px 0;
21
  }
22
+
23
+ .post-date {
24
+ font-family: <?php echo $text_font_family ?>;
25
+ color: <?php echo $text_font_color ?>;
26
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
27
+ font-weight: normal;
28
+ padding: 0 0 5px 0;
29
+ }
30
+
31
+ .post-author {
32
+ font-family: <?php echo $text_font_family ?>;
33
+ color: <?php echo $text_font_color ?>;
34
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
35
+ font-weight: normal;
36
+ padding: 0 0 5px 0;
37
+ }
38
+
39
  </style>
40
 
41
 
42
  <?php foreach ($posts as $post) { ?>
43
+
44
  <?php
45
  $url = tnp_post_permalink($post);
46
+ $options['button_url'] = $url;
47
+
48
  $media = null;
49
  if ($show_image) {
50
  $media = tnp_composer_block_posts_get_media($post, $size);
53
  $media->link = $url;
54
  }
55
  }
 
 
 
56
 
57
+ $author = '';
58
+ if ($show_author) {
59
+ $author_object = get_user_by('id', $post->post_author);
60
+ if ($author_object) {
61
+ $author = $author_object->display_name;
62
+ }
63
+ }
64
+ ?>
65
 
66
  <?php if ($media) { ?>
67
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom: 20px">
79
 
80
  <!-- ARTICLE -->
81
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
82
+ <?php if ($show_date) { ?>
83
  <tr>
84
  <td align="<?php echo $align_left ?>" inline-class="post-date">
85
  <?php echo tnp_post_date($post) ?>
86
  </td>
87
  </tr>
88
  <?php } ?>
89
+
90
+ <?php if ($show_author) { ?>
91
+ <tr>
92
+ <td align="<?php echo $align_left ?>" inline-class="post-author">
93
+ <?php echo $author ?>
94
+ </td>
95
+ </tr>
96
+ <?php } ?>
97
+
98
  <tr>
99
  <td align="<?php echo $align_left ?>"
100
  inline-class="post-title"
119
  ?>
120
  </td>
121
  </tr>
122
+ <?php if ($show_read_more_button) { ?>
123
+ <tr>
124
+ <td align="<?php echo $align_left ?>">
125
+ <?php echo TNP_Composer::button( array_merge( $button_options, [ 'button_url' => $url ] ) ) ?>
126
+ <br><br>
127
+ </td>
128
+ </tr>
129
+ <?php } ?>
130
  </table>
131
 
132
  </td>
emails/blocks/posts/layout-full-post.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .title {
3
+ font-family: <?php echo $title_font_family ?>;
4
+ font-size: <?php echo $title_font_size ?>px;
5
+ font-weight: <?php echo $title_font_weight ?>;
6
+ color: <?php echo $title_font_color ?>;
7
+ line-height: normal;
8
+ margin: 0;
9
+ padding-bottom: 20px;
10
+ }
11
+
12
+ .paragraph {
13
+ font-family: <?php echo $text_font_family ?>;
14
+ font-size: <?php echo $text_font_size ?>px;
15
+ font-weight: <?php echo $text_font_weight ?>;
16
+ color: <?php echo $text_font_color ?>;
17
+ line-height: 1.5em;
18
+ text-align: left;
19
+ }
20
+
21
+ .post-date {
22
+ font-family: <?php echo $text_font_family ?>;
23
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
24
+ font-weight: <?php echo $text_font_weight ?>;
25
+ color: <?php echo $text_font_color ?>;
26
+ line-height: normal;
27
+ padding-bottom: 10px;
28
+ text-align: center;
29
+ }
30
+
31
+ .post-author {
32
+ font-family: <?php echo $text_font_family ?>;
33
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
34
+ font-weight: <?php echo $text_font_weight ?>;
35
+ color: <?php echo $text_font_color ?>;
36
+ line-height: normal;
37
+ padding-bottom: 10px;
38
+ text-align: center;
39
+ }
40
+
41
+ .post-button {
42
+ padding: 15px 0;
43
+ }
44
+
45
+ </style>
46
+
47
+ <?php foreach ( $posts as $post ) : ?>
48
+
49
+ <?php
50
+ $size = [ 'width' => 600, 'height' => 0 ];
51
+ $url = tnp_post_permalink( $post );
52
+
53
+ $media = null;
54
+ if ( $show_image ) {
55
+ $media = tnp_composer_block_posts_get_media( $post, $size );
56
+ if ( $media ) {
57
+ $media->link = $url;
58
+ }
59
+ }
60
+
61
+ $author = '';
62
+ if ( $show_author ) {
63
+ $author_object = get_user_by( 'id', $post->post_author );
64
+ if ( $author_object ) {
65
+ $author = $author_object->display_name;
66
+ }
67
+ }
68
+
69
+ ?>
70
+
71
+
72
+ <table border="0" cellpadding="0" align="center" cellspacing="0" width="100%" class="responsive-table">
73
+ <tr>
74
+ <td inline-class="title">
75
+ <?php echo $post->post_title ?>
76
+ </td>
77
+ </tr>
78
+
79
+ <?php if ( $show_date ) { ?>
80
+ <tr>
81
+ <td inline-class="post-date">
82
+ <?php echo tnp_post_date( $post ) ?>
83
+ </td>
84
+ </tr>
85
+ <?php } ?>
86
+
87
+ <?php if ( $show_author ) { ?>
88
+ <tr>
89
+ <td inline-class="post-author">
90
+ <?php echo $author ?>
91
+ </td>
92
+ </tr>
93
+ <?php } ?>
94
+
95
+ <tr>
96
+ <td>
97
+
98
+ <?php if ( $media ) { ?>
99
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom: 20px">
100
+ <tr>
101
+ <td align="center">
102
+ <?php echo TNP_Composer::image( $media ) ?>
103
+ </td>
104
+ </tr>
105
+ </table>
106
+ <?php } ?>
107
+
108
+ </td>
109
+ </tr>
110
+ <tr>
111
+ <td>
112
+ <?php echo TNP_Composer::post_content( $post ) ?>
113
+ </td>
114
+ </tr>
115
+ <?php if ($show_read_more_button) { ?>
116
+ <tr>
117
+ <td align="center" inline-class="post-button">
118
+ <?php $button_options['button_url'] = $url; ?>
119
+ <?php echo TNP_Composer::button( $button_options ) ?>
120
+ </td>
121
+ </tr>
122
+ <?php } ?>
123
+ </table>
124
+
125
+ <?php endforeach; ?>
emails/blocks/posts/layout-one-2.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $size = ['width' => 600, 'height' => 0];
3
+ ?>
4
+ <style>
5
+ .post-title {
6
+ font-family: <?php echo $title_font_family ?>;
7
+ font-size: <?php echo $title_font_size ?>px;
8
+ font-weight: <?php echo $title_font_weight ?>;
9
+ color: <?php echo $title_font_color ?>;
10
+ line-height: normal;
11
+ padding: 0 0 10px 0;
12
+ }
13
+
14
+ .post-excerpt {
15
+ font-family: <?php echo $text_font_family ?>;
16
+ font-size: <?php echo $text_font_size ?>px;
17
+ font-weight: <?php echo $text_font_weight ?>;
18
+ color: <?php echo $text_font_color ?>;
19
+ line-height: 1.5em;
20
+ padding: 0 0 15px 0;
21
+ text-decoration: none;
22
+ }
23
+
24
+ .readmore {
25
+ font-family: <?php echo $text_font_family ?>;
26
+ font-size: <?php echo $text_font_size ?>px;
27
+ font-weight: <?php echo $text_font_weight ?>;
28
+ color: <?php echo $text_font_color ?>;
29
+ line-height: 1.5em;
30
+ text-decoration: none;
31
+ }
32
+
33
+ .post-date {
34
+ font-family: <?php echo $text_font_family ?>;
35
+ color: <?php echo $text_font_color ?>;
36
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
37
+ font-weight: normal;
38
+ padding: 0 0 5px 0;
39
+ }
40
+
41
+ .post-author {
42
+ font-family: <?php echo $text_font_family ?>;
43
+ color: <?php echo $text_font_color ?>;
44
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
45
+ font-weight: normal;
46
+ padding: 0 0 5px 0;
47
+ }
48
+ </style>
49
+
50
+
51
+ <table border="0" cellpadding="0" cellspacing="0" width="100%" class="responsive-table">
52
+
53
+ <?php foreach ($posts as $post) { ?>
54
+ <?php
55
+ $url = tnp_post_permalink($post);
56
+ $options['button_url'] = $url;
57
+
58
+ $media = null;
59
+ if ($show_image) {
60
+ $media = tnp_composer_block_posts_get_media($post, $size);
61
+ if ($media) {
62
+ $media->link = $url;
63
+ $media->set_width(250);
64
+ }
65
+ }
66
+
67
+ $author = '';
68
+ if ($show_author) {
69
+ $author_object = get_user_by('id', $post->post_author);
70
+ if ($author_object) {
71
+ $author = $author_object->display_name;
72
+ }
73
+ }
74
+
75
+ ?>
76
+
77
+ <tr>
78
+ <td align="<?php echo $align_left ?>"
79
+ inline-class="post-title"
80
+ class="tnpc-row-edit tnpc-inline-editable"
81
+ data-type="title" data-id="<?php echo $post->ID ?>" dir="<?php echo $dir ?>">
82
+ <?php
83
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $post->ID) ?
84
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $post->ID) :
85
+ tnp_post_title($post)
86
+ ?>
87
+ </td>
88
+ </tr>
89
+
90
+ <tr>
91
+
92
+ <td valign="top" style="padding: 20px 0 0 0;" class="td-1">
93
+
94
+
95
+
96
+ <?php if ($media) { ?>
97
+ <table width="40%" cellpadding="0" cellspacing="0" border="0" align="left" class="responsive" style="margin-bottom: 20px">
98
+ <tr>
99
+ <td>
100
+ <?php echo TNP_Composer::image($media, ['class'=>'responsive']) ?>
101
+ </td>
102
+ </tr>
103
+ </table>
104
+ <?php } ?>
105
+
106
+ <table width="<?php echo $media ? '57%' : '100%' ?>" cellpadding="0" cellspacing="0" border="0" class="responsive-table" align="right">
107
+ <tr>
108
+ <td>
109
+
110
+ <!-- ARTICLE -->
111
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
112
+ <?php if ($show_date) { ?>
113
+ <tr>
114
+ <td align="<?php echo $align_left ?>" inline-class="post-date">
115
+ <?php echo tnp_post_date($post) ?>
116
+ </td>
117
+ </tr>
118
+ <?php } ?>
119
+
120
+ <?php if ($show_author) { ?>
121
+ <tr>
122
+ <td align="<?php echo $align_left ?>" inline-class="post-author">
123
+ <?php echo $author ?>
124
+ </td>
125
+ </tr>
126
+ <?php } ?>
127
+
128
+ <tr>
129
+ <td align="<?php echo $align_left ?>"
130
+ inline-class="post-excerpt"
131
+
132
+ data-id="<?php echo $post->ID ?>" dir="<?php echo $dir ?>">
133
+ <a href="<?php $url ?>" inline-class="post-excerpt" class="tnpc-row-edit tnpc-inline-editable" data-type="text">
134
+ <?php
135
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $post->ID) ?
136
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $post->ID) :
137
+ tnp_post_excerpt($post, $excerpt_length)
138
+ ?>
139
+ </a>
140
+ </td>
141
+ </tr>
142
+ <?php if ($show_read_more_button) { ?>
143
+ <tr>
144
+ <td align="<?php echo $align_left ?>" class="padding">
145
+ <?php $button_options['button_url'] = $url; ?>
146
+ <?php echo TNP_Composer::button( $button_options ) ?>
147
+ <br><br>
148
+ </td>
149
+ </tr>
150
+ <?php } ?>
151
+ </table>
152
+
153
+ </td>
154
+ </tr>
155
+ </table>
156
+
157
+ </td>
158
+ </tr>
159
+
160
+ <?php } ?>
161
+
162
+ </table>
emails/blocks/posts/layout-one.php CHANGED
@@ -1,30 +1,39 @@
1
  <?php
2
- $size = ['width' => 300, 'height' => 0];
3
  ?>
4
  <style>
5
- .post-date {
6
- padding: 0 0 5px 0;
7
- font-size: 13px;
8
- font-family: <?php echo $font_family ?>;
9
- font-weight: normal;
10
- color: #aaaaaa;
11
- }
12
-
13
  .post-title {
14
- padding: 0 0 5px 0;
15
- font-size: <?php echo $title_font_size ?>px;
16
  font-family: <?php echo $title_font_family ?>;
 
17
  font-weight: <?php echo $title_font_weight ?>;
18
- color: <?php echo $options['title_font_color'] ?>;
19
  line-height: normal;
 
20
  }
21
 
22
  .post-excerpt {
23
- padding: 10px 0 15px 0;
24
- font-family: <?php echo $font_family ?>;
25
- color: <?php echo $options['font_color'] ?>;
26
- font-size: <?php echo $font_size ?>px;
27
  line-height: 1.5em;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
  </style>
30
 
@@ -34,15 +43,25 @@ $size = ['width' => 300, 'height' => 0];
34
  <?php foreach ($posts as $post) { ?>
35
  <?php
36
  $url = tnp_post_permalink($post);
 
 
37
  $media = null;
38
  if ($show_image) {
39
  $media = tnp_composer_block_posts_get_media($post, $size);
40
  if ($media) {
41
  $media->link = $url;
42
- $media->set_width(105);
43
  }
44
  }
45
- $options['button_url'] = $url;
 
 
 
 
 
 
 
 
46
  ?>
47
 
48
  <tr>
@@ -50,7 +69,7 @@ $size = ['width' => 300, 'height' => 0];
50
  <td valign="top" style="padding: 20px 0 0 0;" class="td-1">
51
 
52
  <?php if ($media) { ?>
53
- <table width="20%" cellpadding="0" cellspacing="0" border="0" align="left" class="1-column" style="margin-bottom: 20px">
54
  <tr>
55
  <td>
56
  <?php echo TNP_Composer::image($media) ?>
@@ -59,19 +78,28 @@ $size = ['width' => 300, 'height' => 0];
59
  </table>
60
  <?php } ?>
61
 
62
- <table width="<?php echo $media ? '78%' : '100%' ?>" cellpadding="0" cellspacing="0" border="0" class="responsive-table" align="right">
63
  <tr>
64
  <td>
65
 
66
  <!-- ARTICLE -->
67
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
68
- <?php if (!empty($options['show_date'])) { ?>
69
  <tr>
70
  <td align="<?php echo $align_left ?>" inline-class="post-date">
71
  <?php echo tnp_post_date($post) ?>
72
  </td>
73
  </tr>
74
  <?php } ?>
 
 
 
 
 
 
 
 
 
75
  <tr>
76
  <td align="<?php echo $align_left ?>"
77
  inline-class="post-title"
@@ -96,11 +124,15 @@ $size = ['width' => 300, 'height' => 0];
96
  ?>
97
  </td>
98
  </tr>
99
- <tr>
100
- <td align="<?php echo $align_left ?>" class="padding">
101
- <?php echo TNP_Composer::button($options) ?>
102
- </td>
103
- </tr>
 
 
 
 
104
  </table>
105
 
106
  </td>
1
  <?php
2
+ $size = ['width' => 600, 'height' => 0];
3
  ?>
4
  <style>
 
 
 
 
 
 
 
 
5
  .post-title {
 
 
6
  font-family: <?php echo $title_font_family ?>;
7
+ font-size: <?php echo $title_font_size ?>px;
8
  font-weight: <?php echo $title_font_weight ?>;
9
+ color: <?php echo $title_font_color ?>;
10
  line-height: normal;
11
+ padding: 0 0 5px 0;
12
  }
13
 
14
  .post-excerpt {
15
+ font-family: <?php echo $text_font_family ?>;
16
+ font-size: <?php echo $text_font_size ?>px;
17
+ font-weight: <?php echo $text_font_weight ?>;
18
+ color: <?php echo $text_font_color ?>;
19
  line-height: 1.5em;
20
+ padding: 10px 0 15px 0;
21
+ }
22
+
23
+ .post-date {
24
+ font-family: <?php echo $text_font_family ?>;
25
+ color: <?php echo $text_font_color ?>;
26
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
27
+ font-weight: normal;
28
+ padding: 0 0 5px 0;
29
+ }
30
+
31
+ .post-author {
32
+ font-family: <?php echo $text_font_family ?>;
33
+ color: <?php echo $text_font_color ?>;
34
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
35
+ font-weight: normal;
36
+ padding: 0 0 5px 0;
37
  }
38
  </style>
39
 
43
  <?php foreach ($posts as $post) { ?>
44
  <?php
45
  $url = tnp_post_permalink($post);
46
+ $options['button_url'] = $url;
47
+
48
  $media = null;
49
  if ($show_image) {
50
  $media = tnp_composer_block_posts_get_media($post, $size);
51
  if ($media) {
52
  $media->link = $url;
53
+ $media->set_width(250);
54
  }
55
  }
56
+
57
+ $author = '';
58
+ if ($show_author) {
59
+ $author_object = get_user_by('id', $post->post_author);
60
+ if ($author_object) {
61
+ $author = $author_object->display_name;
62
+ }
63
+ }
64
+
65
  ?>
66
 
67
  <tr>
69
  <td valign="top" style="padding: 20px 0 0 0;" class="td-1">
70
 
71
  <?php if ($media) { ?>
72
+ <table width="40%" cellpadding="0" cellspacing="0" border="0" align="left" class="1-column" style="margin-bottom: 20px">
73
  <tr>
74
  <td>
75
  <?php echo TNP_Composer::image($media) ?>
78
  </table>
79
  <?php } ?>
80
 
81
+ <table width="<?php echo $media ? '57%' : '100%' ?>" cellpadding="0" cellspacing="0" border="0" class="responsive-table" align="right">
82
  <tr>
83
  <td>
84
 
85
  <!-- ARTICLE -->
86
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
87
+ <?php if ($show_date) { ?>
88
  <tr>
89
  <td align="<?php echo $align_left ?>" inline-class="post-date">
90
  <?php echo tnp_post_date($post) ?>
91
  </td>
92
  </tr>
93
  <?php } ?>
94
+
95
+ <?php if ($show_author) { ?>
96
+ <tr>
97
+ <td align="<?php echo $align_left ?>" inline-class="post-author">
98
+ <?php echo $author ?>
99
+ </td>
100
+ </tr>
101
+ <?php } ?>
102
+
103
  <tr>
104
  <td align="<?php echo $align_left ?>"
105
  inline-class="post-title"
124
  ?>
125
  </td>
126
  </tr>
127
+ <?php if ($show_read_more_button) { ?>
128
+ <tr>
129
+ <td align="<?php echo $align_left ?>" class="padding">
130
+ <?php $button_options['button_url'] = $url; ?>
131
+ <?php echo TNP_Composer::button( $button_options ) ?>
132
+ <br><br>
133
+ </td>
134
+ </tr>
135
+ <?php } ?>
136
  </table>
137
 
138
  </td>
emails/blocks/posts/layout-two.php CHANGED
@@ -1,171 +1,215 @@
1
- <?php
2
- $size = array('width' => 240, 'height' => 160, "crop" => true);
3
- ?>
4
- <style>
5
- .post-date {
6
- padding: 10px 0 0 15px;
7
- font-size: 13px;
8
- font-family: <?php echo $font_family ?>;
9
- font-weight: normal;
10
- color: #aaaaaa;
11
- }
12
- .post-title {
13
- padding: 15px 0 0 0;
14
- font-family: <?php echo $title_font_family ?>;
15
- color: <?php echo $options['title_font_color'] ?>;
16
- font-size: <?php echo $title_font_size ?>px;
17
- font-weight: <?php echo $title_font_weight ?>;
18
- line-height: 1.3em;
19
- }
20
- .post-excerpt {
21
- padding: 5px 0 0 0;
22
- font-family: <?php echo $font_family ?>;
23
- color: <?php echo $options['font_color'] ?>;
24
- font-size: <?php echo $font_size ?>px;
25
- line-height: 1.4em;
26
- }
27
- </style>
28
-
29
- <!-- TWO COLUMNS -->
30
- <table cellspacing="0" cellpadding="0" border="0" width="100%">
31
-
32
- <?php foreach (array_chunk($posts, 2) AS $row) { ?>
33
- <?php
34
- $media = null;
35
- if ($show_image) {
36
- $media = tnp_composer_block_posts_get_media($row[0], $size, $alternative_2);
37
- $media->link = tnp_post_permalink($row[0]);
38
- }
39
- $options['button_url'] = tnp_post_permalink($row[0]);
40
- ?>
41
- <tr>
42
- <td valign="top" style="padding: 10px;" class="mobile-wrapper two-columns">
43
-
44
- <!-- LEFT COLUMN -->
45
- <table cellpadding="0" cellspacing="0" border="0" width="47%" align="left" class="responsive-table">
46
- <tr>
47
- <td style="padding: 20px 0 40px 0;">
48
- <table cellpadding="0" cellspacing="0" border="0" width="100%">
49
- <?php if ($media) { ?>
50
- <tr>
51
- <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
52
- <?php echo TNP_Composer::image($media) ?>
53
- </td>
54
- </tr>
55
- <?php } ?>
56
- <tr>
57
- <td align="center"
58
- inline-class="post-title"
59
- class="tnpc-row-edit tnpc-inline-editable"
60
- data-type="title" data-id="<?php echo $row[0]->ID ?>">
61
- <?php
62
- echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $row[0]->ID) ?
63
- TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $row[0]->ID) :
64
- tnp_post_title($row[0])
65
- ?>
66
- </td>
67
- </tr>
68
- <?php if (!empty($options['show_date'])) { ?>
69
- <tr>
70
- <td align="center" inline-class="post-date">
71
- <?php echo tnp_post_date($row[0]) ?>
72
- </td>
73
- </tr>
74
- <?php } ?>
75
- <tr>
76
- <td align="center"
77
- inline-class="post-excerpt"
78
- class="tnpc-row-edit tnpc-inline-editable"
79
- data-type="text" data-id="<?php echo $row[0]->ID ?>">
80
- <?php
81
- echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $row[0]->ID) ?
82
- TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $row[0]->ID) :
83
- tnp_post_excerpt($row[0], $excerpt_length)
84
- ?>
85
- </td>
86
- </tr>
87
- <tr>
88
- <td align="center">
89
- <br>
90
- <?php echo TNP_Composer::button($options) ?>
91
- </td>
92
- </tr>
93
- </table>
94
- </td>
95
- </tr>
96
- </table>
97
-
98
- <?php
99
- if (!isset($row[1])) {
100
- continue;
101
- }
102
- $media = null;
103
- if ($show_image) {
104
- $media = tnp_composer_block_posts_get_media($row[1], $size, $alternative_2);
105
- $media->link = tnp_post_permalink($row[1]);
106
- }
107
- $options['button_url'] = tnp_post_permalink($row[1]);
108
- ?>
109
- <!-- RIGHT COLUMN -->
110
- <table cellpadding="0" cellspacing="0" border="0" width="47%" align="right" class="responsive-table">
111
- <tr>
112
- <td style="padding: 20px 0 40px 0;">
113
- <table cellpadding="0" cellspacing="0" border="0" width="100%">
114
- <?php if ($media) { ?>
115
-
116
- <tr>
117
- <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
118
- <?php echo TNP_Composer::image($media) ?>
119
- </td>
120
- </tr>
121
- <?php } ?>
122
- <tr>
123
- <td align="center"
124
- inline-class="post-title"
125
- class="tnpc-row-edit tnpc-inline-editable"
126
- data-type="title" data-id="<?php echo $row[1]->ID ?>">
127
- <?php
128
- echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $row[1]->ID) ?
129
- TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $row[1]->ID) :
130
- tnp_post_title($row[1])
131
- ?>
132
- </td>
133
- </tr>
134
- <?php if (!empty($options['show_date'])) { ?>
135
- <tr>
136
- <td align="center" inline-class="post-date">
137
- <?php echo tnp_post_date($row[1]) ?>
138
- </td>
139
- </tr>
140
- <?php } ?>
141
- <tr>
142
- <td align="center"
143
- inline-class="post-excerpt"
144
- class="tnpc-row-edit tnpc-inline-editable"
145
- data-type="text" data-id="<?php echo $row[1]->ID ?>">
146
- <?php
147
- echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $row[1]->ID) ?
148
- TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $row[1]->ID) :
149
- tnp_post_excerpt($row[1], $excerpt_length)
150
- ?>
151
- </td>
152
- </tr>
153
- <tr>
154
- <td align="center">
155
- <br>
156
- <?php echo TNP_Composer::button($options) ?>
157
- </td>
158
- </tr>
159
- </table>
160
- </td>
161
- </tr>
162
- </table>
163
-
164
-
165
- </td>
166
- </tr>
167
-
168
- <?php } ?>
169
-
170
- </table>
171
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $size = array('width' => 240, 'height' => 160, "crop" => true);
3
+ ?>
4
+ <style>
5
+ .post-title {
6
+ font-family: <?php echo $title_font_family ?>;
7
+ font-size: <?php echo $title_font_size ?>px;
8
+ font-weight: <?php echo $title_font_weight ?>;
9
+ color: <?php echo $title_font_color ?>;
10
+ line-height: 1.3em;
11
+ padding: 15px 0 0 0;
12
+ }
13
+
14
+ .post-excerpt {
15
+ font-family: <?php echo $text_font_family ?>;
16
+ font-size: <?php echo $text_font_size ?>px;
17
+ font-weight: <?php echo $text_font_weight ?>;
18
+ color: <?php echo $text_font_color ?>;
19
+ line-height: 1.4em;
20
+ padding: 5px 0 0 0;
21
+ }
22
+
23
+ .post-date {
24
+ font-family: <?php echo $text_font_family ?>;
25
+ color: <?php echo $text_font_color ?>;
26
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
27
+ font-weight: normal;
28
+ padding: 10px 0 0 15px;
29
+ }
30
+
31
+ .post-author {
32
+ font-family: <?php echo $text_font_family ?>;
33
+ color: <?php echo $text_font_color ?>;
34
+ font-size: <?php echo round($text_font_size * 0.8) ?>px;
35
+ font-weight: normal;
36
+ padding: 0 0 5px 0;
37
+ }
38
+ </style>
39
+
40
+ <!-- TWO COLUMNS -->
41
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
42
+
43
+ <?php foreach (array_chunk($posts, 2) AS $row) { ?>
44
+ <?php
45
+ $media = null;
46
+ if ($show_image) {
47
+ $media = tnp_composer_block_posts_get_media($row[0], $size, $image_placeholder_url);
48
+ $media->link = tnp_post_permalink($row[0]);
49
+ }
50
+
51
+ $author = '';
52
+ if ($show_author) {
53
+ $author_object = get_user_by('id', $post->post_author);
54
+ if ($author_object) {
55
+ $author = $author_object->display_name;
56
+ }
57
+ }
58
+
59
+ $options['button_url'] = tnp_post_permalink($row[0]);
60
+ ?>
61
+ <tr>
62
+ <td valign="top" style="padding: 10px;" class="mobile-wrapper two-columns">
63
+
64
+ <!-- LEFT COLUMN -->
65
+ <table cellpadding="0" cellspacing="0" border="0" width="47%" align="left" class="responsive-table">
66
+ <tr>
67
+ <td style="padding: 20px 0 40px 0;">
68
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
69
+ <?php if ($media) { ?>
70
+ <tr>
71
+ <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
72
+ <?php echo TNP_Composer::image($media) ?>
73
+ </td>
74
+ </tr>
75
+ <?php } ?>
76
+ <tr>
77
+ <td align="center"
78
+ inline-class="post-title"
79
+ class="tnpc-row-edit tnpc-inline-editable"
80
+ data-type="title" data-id="<?php echo $row[0]->ID ?>">
81
+ <?php
82
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $row[0]->ID) ?
83
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $row[0]->ID) :
84
+ tnp_post_title($row[0])
85
+ ?>
86
+ </td>
87
+ </tr>
88
+ <?php if ($show_date) { ?>
89
+ <tr>
90
+ <td align="center" inline-class="post-date">
91
+ <?php echo tnp_post_date($row[0]) ?>
92
+ </td>
93
+ </tr>
94
+ <?php } ?>
95
+
96
+ <?php if ($show_author) { ?>
97
+ <tr>
98
+ <td align="center" inline-class="post-author">
99
+ <?php echo $author ?>
100
+ </td>
101
+ </tr>
102
+ <?php } ?>
103
+
104
+ <tr>
105
+ <td align="center"
106
+ inline-class="post-excerpt"
107
+ class="tnpc-row-edit tnpc-inline-editable"
108
+ data-type="text" data-id="<?php echo $row[0]->ID ?>">
109
+ <?php
110
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $row[0]->ID) ?
111
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $row[0]->ID) :
112
+ tnp_post_excerpt($row[0], $excerpt_length)
113
+ ?>
114
+ </td>
115
+ </tr>
116
+ <?php if ($show_read_more_button) { ?>
117
+ <tr>
118
+ <td align="center">
119
+ <?php $button_options['button_url'] = $options['button_url']; ?>
120
+ <?php echo TNP_Composer::button( $button_options ) ?>
121
+ <br><br>
122
+ </td>
123
+ </tr>
124
+ <?php } ?>
125
+ </table>
126
+ </td>
127
+ </tr>
128
+ </table>
129
+
130
+ <?php
131
+ if (!isset($row[1])) {
132
+ continue;
133
+ }
134
+ $media = null;
135
+ if ($show_image) {
136
+ $media = tnp_composer_block_posts_get_media($row[1], $size, $image_placeholder_url);
137
+ $media->link = tnp_post_permalink($row[1]);
138
+ }
139
+ $options['button_url'] = tnp_post_permalink($row[1]);
140
+ ?>
141
+ <!-- RIGHT COLUMN -->
142
+ <table cellpadding="0" cellspacing="0" border="0" width="47%" align="right" class="responsive-table">
143
+ <tr>
144
+ <td style="padding: 20px 0 40px 0;">
145
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
146
+ <?php if ($media) { ?>
147
+
148
+ <tr>
149
+ <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
150
+ <?php echo TNP_Composer::image($media) ?>
151
+ </td>
152
+ </tr>
153
+ <?php } ?>
154
+ <tr>
155
+ <td align="center"
156
+ inline-class="post-title"
157
+ class="tnpc-row-edit tnpc-inline-editable"
158
+ data-type="title" data-id="<?php echo $row[1]->ID ?>">
159
+ <?php
160
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $row[1]->ID) ?
161
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $row[1]->ID) :
162
+ tnp_post_title($row[1])
163
+ ?>
164
+ </td>
165
+ </tr>
166
+ <?php if ($show_date) { ?>
167
+ <tr>
168
+ <td align="center" inline-class="post-date">
169
+ <?php echo tnp_post_date($row[1]) ?>
170
+ </td>
171
+ </tr>
172
+ <?php } ?>
173
+
174
+ <?php if ($show_author) { ?>
175
+ <tr>
176
+ <td align="center" inline-class="post-author">
177
+ <?php echo $author ?>
178
+ </td>
179
+ </tr>
180
+ <?php } ?>
181
+
182
+ <tr>
183
+ <td align="center"
184
+ inline-class="post-excerpt"
185
+ class="tnpc-row-edit tnpc-inline-editable"
186
+ data-type="text" data-id="<?php echo $row[1]->ID ?>">
187
+ <?php
188
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $row[1]->ID) ?
189
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $row[1]->ID) :
190
+ tnp_post_excerpt($row[1], $excerpt_length)
191
+ ?>
192
+ </td>
193
+ </tr>
194
+ <?php if ($show_read_more_button) { ?>
195
+ <tr>
196
+ <td align="center">
197
+ <?php $button_options['button_url'] = $options['button_url']; ?>
198
+ <?php echo TNP_Composer::button( $button_options ) ?>
199
+ <br><br>
200
+ </td>
201
+ </tr>
202
+ <?php } ?>
203
+ </table>
204
+ </td>
205
+ </tr>
206
+ </table>
207
+
208
+
209
+ </td>
210
+ </tr>
211
+
212
+ <?php } ?>
213
+
214
+ </table>
215
+
emails/blocks/posts/options.php CHANGED
@@ -16,73 +16,96 @@ if (class_exists('NewsletterExtensions')) {
16
 
17
  <?php $fields->select('automated_disabled', '', ['' => 'Check for new posts since last newsletter', '1' => 'Do not check for new posts']) ?>
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <div class="tnp-field-row">
 
20
  <div class="tnp-field-col-2">
21
- <?php
22
- $fields->select('automated_include', __('If there are new posts', 'newsletter'),
23
- [
24
- 'new' => __('Include only new posts', 'newsletter'),
25
- 'max' => __('Include specified max posts', 'newsletter')
26
- ],
27
- ['description' => ''])
28
- ?>
 
29
  </div>
30
  <div class="tnp-field-col-2">
31
- <?php
32
- $fields->select('automated', __('If there are not new posts', 'newsletter'),
33
- [
34
- '' => 'Show the message below',
35
- '1' => 'Do not send the newsletter',
36
- '2' => 'Remove this block'
37
- ],
38
- ['description' => ''])
39
- ?>
40
- <?php $fields->text('automated_no_contents', null, ['placeholder'=>'No new posts message']) ?>
41
  </div>
42
  </div>
43
 
44
-
45
-
46
- <?php } ?>
47
-
48
-
49
- <?php $fields->select('layout', __('Layout', 'newsletter'), array('one' => __('One column', 'newsletter'),
50
- 'two' => __('Two columns', 'newsletter'),
51
- 'big-image' => __('One column, big image', 'newsletter'))) ?>
52
-
53
- <?php $fields->font('title_font', __('Title font', 'newsletter')) ?>
54
-
55
- <?php $fields->number('excerpt_length', __('Excerpt words', 'newsletter'), array('min' => 0)); ?>
56
-
57
- <?php $fields->font('font', __('Excerpt font', 'newsletter')) ?>
58
-
59
  <div class="tnp-field-row">
60
- <label class="tnp-row-label"><?php _e('Dates and images', 'newsletter') ?></label>
61
  <div class="tnp-field-col-2">
62
- <?php $fields->checkbox('show_image', __('Show image', 'newsletter')) ?>
63
  </div>
64
  <div class="tnp-field-col-2">
65
- <?php $fields->checkbox('show_date', __('Show date', 'newsletter')) ?>
66
  </div>
67
  <div style="clear: both"></div>
68
  </div>
69
 
70
  <div class="tnp-field-row">
71
  <div class="tnp-field-col-2">
72
- <?php $fields->select_number('max', __('Max posts', 'newsletter'), 1, 40); ?>
73
  </div>
74
  <div class="tnp-field-col-2">
75
- <?php $fields->select_number('post_offset', __('Posts offset', 'newsletter'), 0, 20); ?>
76
  </div>
77
  </div>
78
 
79
- <?php $fields->language(); ?>
 
 
 
 
 
 
 
 
80
 
81
- <?php $fields->button('button', 'Button', array('url' => false)) ?>
82
 
83
  <?php $fields->section(__('Filters', 'newsletter')) ?>
84
  <?php $fields->categories(); ?>
85
  <?php $fields->text('tags', __('Tags', 'newsletter'), ['description' => __('Comma separated')]); ?>
86
 
 
 
 
 
 
 
 
 
 
 
87
  <?php $fields->block_commons() ?>
88
 
16
 
17
  <?php $fields->select('automated_disabled', '', ['' => 'Check for new posts since last newsletter', '1' => 'Do not check for new posts']) ?>
18
 
19
+ <div class="tnp-field-row">
20
+ <div class="tnp-field-col-2">
21
+ <?php
22
+ $fields->select('automated_include', __('If there are new posts', 'newsletter'),
23
+ [
24
+ 'new' => __('Include only new posts', 'newsletter'),
25
+ 'max' => __('Include specified max posts', 'newsletter')
26
+ ],
27
+ ['description' => ''])
28
+ ?>
29
+ </div>
30
+ <div class="tnp-field-col-2">
31
+ <?php
32
+ $fields->select('automated', __('If there are not new posts', 'newsletter'),
33
+ [
34
+ '' => 'Show the message below',
35
+ '1' => 'Do not send the newsletter',
36
+ '2' => 'Remove this block'
37
+ ],
38
+ ['description' => ''])
39
+ ?>
40
+ <?php $fields->text('automated_no_contents', null, ['placeholder'=>'No new posts message']) ?>
41
+ </div>
42
+ </div>
43
+
44
+ <?php } ?>
45
+
46
  <div class="tnp-field-row">
47
+ <label class="tnp-row-label"><?php _e( 'Layout', 'newsletter' ) ?></label>
48
  <div class="tnp-field-col-2">
49
+ <?php $fields->select( 'layout', '',
50
+ array(
51
+ 'one' => __( 'One column', 'newsletter' ),
52
+ 'one-2' => __( 'One column variant', 'newsletter' ),
53
+ 'two' => __( 'Two columns', 'newsletter' ),
54
+ 'big-image' => __( 'One column, big image', 'newsletter' ),
55
+ 'full-post' => __( 'Full post', 'newsletter' )
56
+ ) )
57
+ ?>
58
  </div>
59
  <div class="tnp-field-col-2">
60
+ <?php $fields->checkbox( 'show_image', __( 'Show image', 'newsletter' ) ) ?>
 
 
 
 
 
 
 
 
 
61
  </div>
62
  </div>
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  <div class="tnp-field-row">
65
+ <label class="tnp-row-label"><?php _e('Post info', 'newsletter') ?></label>
66
  <div class="tnp-field-col-2">
67
+ <?php $fields->checkbox('show_date', __('Show date', 'newsletter')) ?>
68
  </div>
69
  <div class="tnp-field-col-2">
70
+ <?php $fields->checkbox('show_author', __('Show author', 'newsletter')) ?>
71
  </div>
72
  <div style="clear: both"></div>
73
  </div>
74
 
75
  <div class="tnp-field-row">
76
  <div class="tnp-field-col-2">
77
+ <?php $fields->select_number('max', __('Max posts', 'newsletter'), 1, 40); ?>
78
  </div>
79
  <div class="tnp-field-col-2">
80
+ <?php $fields->select_number('post_offset', __('Posts offset', 'newsletter'), 0, 20); ?>
81
  </div>
82
  </div>
83
 
84
+ <div class="tnp-field-row">
85
+ <div class="tnp-field-col-2">
86
+ <?php $fields->number( 'excerpt_length', __( 'Excerpt words', 'newsletter' ), array( 'min' => 0 ) ); ?>
87
+ </div>
88
+ <div class="tnp-field-col-2">
89
+ <?php $fields->yesno( 'show_read_more_button', 'Show read more button' ) ?>
90
+ </div>
91
+ <div style="clear: both"></div>
92
+ </div>
93
 
94
+ <?php $fields->language(); ?>
95
 
96
  <?php $fields->section(__('Filters', 'newsletter')) ?>
97
  <?php $fields->categories(); ?>
98
  <?php $fields->text('tags', __('Tags', 'newsletter'), ['description' => __('Comma separated')]); ?>
99
 
100
+ <?php $fields->section(__('Styles', 'newsletter')) ?>
101
+ <?php $fields->font( 'title_font', __( 'Title font', 'newsletter' ), ['family_default'=>true, 'size_default'=>true, 'weight_default'=>true] ) ?>
102
+ <?php $fields->font( 'font', __( 'Excerpt font', 'newsletter' ), ['family_default'=>true, 'size_default'=>true, 'weight_default'=>true] ) ?>
103
+ <?php $fields->button( 'button', __( 'Read more button', 'newsletter' ), [
104
+ 'url' => false,
105
+ 'family_default' => true,
106
+ 'size_default' => true,
107
+ 'weight_default' => true
108
+ ] ) ?>
109
+
110
  <?php $fields->block_commons() ?>
111
 
emails/blocks/posts/style.min.css ADDED
@@ -0,0 +1 @@
 
1
+ @media(max-width:525px){.posts-1-column{width:100%!important}.posts-1-image{width:100%!important;display:block}}
emails/blocks/preheader/_icon.png ADDED
Binary file
emails/blocks/preheader/block.php CHANGED
@@ -1,60 +1,66 @@
1
- <?php
2
- /*
3
- * Name: Preheader
4
- * Section: header
5
- * Description: Preheader
6
- *
7
- */
8
-
9
- /* @var $options array */
10
- /* @var $wpdb wpdb */
11
-
12
- $default_options = array(
13
- 'view' => 'View online',
14
- 'text' => 'Few words summary',
15
- 'block_background' => '#ffffff',
16
- 'font_family' => $font_family,
17
- 'font_size' => 13,
18
- 'font_color' => '#999999',
19
- 'font_weight' => 'normal',
20
- 'block_padding_left'=>15,
21
- 'block_padding_right'=>15,
22
- 'block_padding_bottom'=>15,
23
- 'block_padding_top'=>15
24
- );
25
-
26
- $options = array_merge($default_options, $options);
27
- ?>
28
- <style>
29
- .preheader-table {
30
- width: 100%!important
31
- border: 0;
32
- border-collapse: collapse;
33
- }
34
- .preheader-link {
35
- padding: 10px;
36
- font-size: <?php echo $options['font_size'] ?>px;
37
- font-family: <?php echo $options['font_family'] ?>;
38
- font-weight: <?php echo $options['font_weight'] ?>;
39
- color: <?php echo $options['font_color'] ?>;
40
- }
41
- .preheader-view-link {
42
- font-size: <?php echo $options['font_size'] ?>px;
43
- font-family: <?php echo $options['font_family'] ?>;
44
- font-weight: <?php echo $options['font_weight'] ?>;
45
- color: <?php echo $options['font_color'] ?>;
46
- text-decoration: none;
47
- }
48
- </style>
49
-
50
- <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0" inline-class="preheader-table">
51
- <tr>
52
- <td class="preheader-link" width="50%" valign="top" align="left">
53
- <?php echo $options['text'] ?>
54
- </td>
55
- <td class="preheader-link" width="50%" valign="top" align="right">
56
- <a href="{email_url}" target="_blank" rel="noopener" class="preheader-view-link"><?php echo $options['view'] ?></a>
57
- </td>
58
- </tr>
59
- </table>
60
-
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Name: Preheader
4
+ * Section: header
5
+ * Description: Preheader
6
+ *
7
+ */
8
+
9
+ /* @var $options array */
10
+ /* @var $wpdb wpdb */
11
+
12
+ $default_options = array(
13
+ 'view' => 'View online',
14
+ 'text' => 'Few words summary',
15
+ 'font_family' => '',
16
+ 'font_size' => 14,
17
+ 'font_color' => '',
18
+ 'font_weight' => '',
19
+ 'block_padding_left'=>15,
20
+ 'block_padding_right'=>15,
21
+ 'block_padding_bottom'=>15,
22
+ 'block_padding_top'=>15,
23
+ 'block_background' => '',
24
+ );
25
+
26
+ $options = array_merge($default_options, $options);
27
+
28
+ $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
29
+ $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
30
+ $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
31
+ $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
32
+
33
+ ?>
34
+ <style>
35
+ .preheader-table {
36
+ width: 100%!important
37
+ border: 0;
38
+ border-collapse: collapse;
39
+ }
40
+ .preheader-link {
41
+ font-family: <?php echo $text_font_family ?>;
42
+ font-size: <?php echo $text_font_size ?>px;
43
+ font-weight: <?php echo $text_font_weight ?>;
44
+ color: <?php echo $text_font_color ?>;
45
+ padding: 10px;
46
+ }
47
+ .preheader-view-link {
48
+ font-family: <?php echo $text_font_family ?>;
49
+ font-size: <?php echo $text_font_size ?>px;
50
+ font-weight: <?php echo $text_font_weight ?>;
51
+ color: <?php echo $text_font_color ?>;
52
+ text-decoration: none;
53
+ }
54
+ </style>
55
+
56
+ <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0" inline-class="preheader-table">
57
+ <tr>
58
+ <td class="preheader-link" width="50%" valign="top" align="left">
59
+ <?php echo $options['text'] ?>
60
+ </td>
61
+ <td class="preheader-link" width="50%" valign="top" align="right">
62
+ <a href="{email_url}" target="_blank" rel="noopener" class="preheader-view-link"><?php echo $options['view'] ?></a>
63
+ </td>
64
+ </tr>
65
+ </table>
66
+
emails/blocks/preheader/icon.png CHANGED
Binary file
emails/blocks/preheader/options.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- /* @var $fields NewsletterFields */
4
- ?>
5
-
6
- <?php $fields->text('text', __('Text', 'newsletter')) ?>
7
- <?php $fields->text('view', __('View online', 'newsletter')) ?>
8
- <?php $fields->font('font') ?>
9
-
10
- <?php $fields->block_commons() ?>
1
+ <?php
2
+
3
+ /* @var $fields NewsletterFields */
4
+ ?>
5
+
6
+ <?php $fields->text('text', __('Text', 'newsletter')) ?>
7
+ <?php $fields->text('view', __('View online', 'newsletter')) ?>
8
+ <?php $fields->font( 'font', __('Font', 'newsletter'), [ 'family_default' => true, 'size_default' => true, 'weight_default' => true ] ) ?>
9
+
10
+ <?php $fields->block_commons() ?>
emails/blocks/separator/_icon.png ADDED
Binary file
emails/blocks/separator/block.php CHANGED
@@ -1,31 +1,31 @@
1
- <?php
2
- /*
3
- * Name: Separator
4
- * Section: content
5
- * Description: Separator
6
- *
7
- */
8
-
9
- /* @var $options array */
10
-
11
- $default_options = array(
12
- 'color'=>'#dddddd',
13
- 'height'=>1,
14
- 'block_padding_top'=>20,
15
- 'block_padding_bottom'=>20,
16
- 'block_padding_right'=>20,
17
- 'block_padding_left'=>20,
18
- 'block_background'=>'#ffffff'
19
-
20
- );
21
-
22
- $options = array_merge($default_options, $options);
23
-
24
- ?>
25
-
26
-
27
- <table border="0" cellpadding="0" align="center" cellspacing="0" width="100%">
28
- <tr>
29
- <td style="border-bottom: <?php echo $options['height'] ?>px solid <?php echo $options['color'] ?>;"></td>
30
- </tr>
31
- </table>
1
+ <?php
2
+ /*
3
+ * Name: Separator
4
+ * Section: content
5
+ * Description: Separator
6
+ *
7
+ */
8
+
9
+ /* @var $options array */
10
+
11
+ $default_options = array(
12
+ 'color'=>'#dddddd',
13
+ 'height'=>1,
14
+ 'block_padding_top'=>20,
15
+ 'block_padding_bottom'=>20,
16
+ 'block_padding_right'=>20,
17
+ 'block_padding_left'=>20,
18
+ 'block_background'=>''
19
+
20
+ );
21
+
22
+ $options = array_merge($default_options, $options);
23
+
24
+ ?>
25
+
26
+
27
+ <table border="0" cellpadding="0" align="center" cellspacing="0" width="100%">
28
+ <tr>
29
+ <td style="border-bottom: <?php echo $options['height'] ?>px solid <?php echo $options['color'] ?>;"></td>
30
+ </tr>
31
+ </table>
emails/blocks/separator/icon.png CHANGED
Binary file
emails/blocks/social/_icon.png ADDED
Binary file
emails/blocks/social/block.php CHANGED
@@ -1,125 +1,125 @@
1
- <?php
2
- /*
3
- * Name: Social links
4
- * Section: footer
5
- * Description: Link with icons to social profiles
6
- *
7
- */
8
-
9
- /* @var $options array */
10
- /* @var $wpdb wpdb */
11
-
12
- $default_options = array(
13
- 'block_padding_left' => 15,
14
- 'block_padding_right' => 15,
15
- 'block_padding_bottom' => 15,
16
- 'block_padding_top' => 15,
17
- 'block_background'=> '#ffffff'
18
- );
19
- $options = array_merge($default_options, $options);
20
-
21
- $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
22
- $configured = false;
23
- ?>
24
-
25
-
26
- <table border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table">
27
- <tr>
28
- <td align="center">
29
- <?php
30
- if (!empty($block_options['facebook_url'])) {
31
- $configured = true;
32
- ?>
33
- <span class="tnpc-row-edit" data-type="image">
34
- <a href="<?php echo esc_url($block_options['facebook_url']) ?>"><img src="<?php echo $social_icon_url ?>/facebook.png" alt="Facebook"></a>
35
- </span>
36
- <?php } ?>
37
- <?php
38
- if (!empty($block_options['twitter_url'])) {
39
- $configured = true;
40
- ?>
41
- <span class="tnpc-row-edit" data-type="image">
42
- <a href="<?php echo esc_url($block_options['twitter_url']) ?>"><img src="<?php echo $social_icon_url ?>/twitter.png" alt="Twitter"></a>
43
- </span>
44
- <?php } ?>
45
- <?php
46
- if (!empty($block_options['pinterest_url'])) {
47
- $configured = true;
48
- ?>
49
- <span class="tnpc-row-edit" data-type="image">
50
- <a href="<?php echo esc_url($block_options['pinterest_url']) ?>"><img src="<?php echo $social_icon_url ?>/pinterest.png" alt="Pinterest"></a>
51
- </span>
52
- <?php } ?>
53
- <?php
54
- if (!empty($block_options['linkedin_url'])) {
55
- $configured = true;
56
- ?>
57
- <span class="tnpc-row-edit" data-type="image">
58
- <a href="<?php echo esc_url($block_options['linkedin_url']) ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png" alt="LinkedIn"></a>
59
- </span>
60
- <?php } ?>
61
- <?php
62
- if (!empty($block_options['tumblr_url'])) {
63
- $configured = true;
64
- ?>
65
- <span class="tnpc-row-edit" data-type="image">
66
- <a href="<?php echo esc_url($block_options['tumblr_url']) ?>"><img src="<?php echo $social_icon_url ?>/tumblr.png" alt="Tumblr"></a>
67
- </span>
68
- <?php } ?>
69
- <?php
70
- if (!empty($block_options['youtube_url'])) {
71
- $configured = true;
72
- ?>
73
- <span class="tnpc-row-edit" data-type="image">
74
- <a href="<?php echo esc_url($block_options['youtube_url']) ?>"><img src="<?php echo $social_icon_url ?>/youtube.png" alt="Youtube"></a>
75
- </span>
76
- <?php } ?>
77
- <?php
78
- if (!empty($block_options['soundcloud_url'])) {
79
- $configured = true;
80
- ?>
81
- <span class="tnpc-row-edit" data-type="image">
82
- <a href="<?php echo esc_url($block_options['soundcloud_url']) ?>"><img src="<?php echo $social_icon_url ?>/soundcloud.png" alt="SoundCloud"></a>
83
- </span>
84
- <?php } ?>
85
- <?php
86
- if (!empty($block_options['instagram_url'])) {
87
- $configured = true;
88
- ?>
89
- <span class="tnpc-row-edit" data-type="image">
90
- <a href="<?php echo esc_url($block_options['instagram_url']) ?>"><img src="<?php echo $social_icon_url ?>/instagram.png" alt="Instagram"></a>
91
- </span>
92
- <?php } ?>
93
- <?php
94
- if (!empty($block_options['vimeo_url'])) {
95
- $configured = true;
96
- ?>
97
- <span class="tnpc-row-edit" data-type="image">
98
- <a href="<?php echo esc_url($block_options['vimeo_url']) ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png" alt="Vimeo"></a>
99
- </span>
100
- <?php } ?>
101
- <?php
102
- if (!empty($block_options['telegram_url'])) {
103
- $configured = true;
104
- ?>
105
- <span class="tnpc-row-edit" data-type="image">
106
- <a href="<?php echo esc_url($block_options['telegram_url']) ?>"><img src="<?php echo $social_icon_url ?>/telegram.png" alt="Telegram"></a>
107
- </span>
108
- <?php } ?>
109
- <?php
110
- if (!empty($block_options['vk_url'])) {
111
- $configured = true;
112
- ?>
113
- <span class="tnpc-row-edit" data-type="image">
114
- <a href="<?php echo esc_url($block_options['vk_url']) ?>"><img src="<?php echo $social_icon_url ?>/vk.png" alt="VK"></a>
115
- </span>
116
- <?php } ?>
117
- <?php if (!$configured) { ?>
118
- <p>Configure your social links in the <a href="?page=newsletter_main_info">Social configuration section</a>.<br/>
119
- Then remove and add again this block.</p>
120
- <?php } ?>
121
- </td>
122
- </tr>
123
- </table>
124
-
125
-
1
+ <?php
2
+ /*
3
+ * Name: Social links
4
+ * Section: footer
5
+ * Description: Link with icons to social profiles
6
+ *
7
+ */
8
+
9
+ /* @var $options array */
10
+ /* @var $wpdb wpdb */
11
+
12
+ $default_options = array(
13
+ 'block_padding_left' => 15,
14
+ 'block_padding_right' => 15,
15
+ 'block_padding_bottom' => 15,
16
+ 'block_padding_top' => 15,
17
+ 'block_background'=> ''
18
+ );
19
+ $options = array_merge($default_options, $options);
20
+
21
+ $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
22
+ $configured = false;
23
+ ?>
24
+
25
+
26
+ <table border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table">
27
+ <tr>
28
+ <td align="center">
29
+ <?php
30
+ if (!empty($block_options['facebook_url'])) {
31
+ $configured = true;
32
+ ?>
33
+ <span class="tnpc-row-edit" data-type="image">
34
+ <a href="<?php echo esc_url($block_options['facebook_url']) ?>"><img src="<?php echo $social_icon_url ?>/facebook.png" alt="Facebook"></a>
35
+ </span>
36
+ <?php } ?>
37
+ <?php
38
+ if (!empty($block_options['twitter_url'])) {
39
+ $configured = true;
40
+ ?>
41
+ <span class="tnpc-row-edit" data-type="image">
42
+ <a href="<?php echo esc_url($block_options['twitter_url']) ?>"><img src="<?php echo $social_icon_url ?>/twitter.png" alt="Twitter"></a>
43
+ </span>
44
+ <?php } ?>
45
+ <?php
46
+ if (!empty($block_options['pinterest_url'])) {
47
+ $configured = true;
48
+ ?>
49
+ <span class="tnpc-row-edit" data-type="image">
50
+ <a href="<?php echo esc_url($block_options['pinterest_url']) ?>"><img src="<?php echo $social_icon_url ?>/pinterest.png" alt="Pinterest"></a>
51
+ </span>
52
+ <?php } ?>
53
+ <?php
54
+ if (!empty($block_options['linkedin_url'])) {
55
+ $configured = true;
56
+ ?>
57
+ <span class="tnpc-row-edit" data-type="image">
58
+ <a href="<?php echo esc_url($block_options['linkedin_url']) ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png" alt="LinkedIn"></a>
59
+ </span>
60
+ <?php } ?>
61
+ <?php
62
+ if (!empty($block_options['tumblr_url'])) {
63
+ $configured = true;
64
+ ?>
65
+ <span class="tnpc-row-edit" data-type="image">
66
+ <a href="<?php echo esc_url($block_options['tumblr_url']) ?>"><img src="<?php echo $social_icon_url ?>/tumblr.png" alt="Tumblr"></a>
67
+ </span>
68
+ <?php } ?>
69
+ <?php
70
+ if (!empty($block_options['youtube_url'])) {
71
+ $configured = true;
72
+ ?>
73
+ <span class="tnpc-row-edit" data-type="image">
74
+ <a href="<?php echo esc_url($block_options['youtube_url']) ?>"><img src="<?php echo $social_icon_url ?>/youtube.png" alt="Youtube"></a>
75
+ </span>
76
+ <?php } ?>
77
+ <?php
78
+ if (!empty($block_options['soundcloud_url'])) {
79
+ $configured = true;
80
+ ?>
81
+ <span class="tnpc-row-edit" data-type="image">
82
+ <a href="<?php echo esc_url($block_options['soundcloud_url']) ?>"><img src="<?php echo $social_icon_url ?>/soundcloud.png" alt="SoundCloud"></a>
83
+ </span>
84
+ <?php } ?>
85
+ <?php
86
+ if (!empty($block_options['instagram_url'])) {
87
+ $configured = true;
88
+ ?>
89
+ <span class="tnpc-row-edit" data-type="image">
90
+ <a href="<?php echo esc_url($block_options['instagram_url']) ?>"><img src="<?php echo $social_icon_url ?>/instagram.png" alt="Instagram"></a>
91
+ </span>
92
+ <?php } ?>
93
+ <?php
94
+ if (!empty($block_options['vimeo_url'])) {
95
+ $configured = true;
96
+ ?>
97
+ <span class="tnpc-row-edit" data-type="image">
98
+ <a href="<?php echo esc_url($block_options['vimeo_url']) ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png" alt="Vimeo"></a>
99
+ </span>
100
+ <?php } ?>
101
+ <?php
102
+ if (!empty($block_options['telegram_url'])) {
103
+ $configured = true;
104
+ ?>
105
+ <span class="tnpc-row-edit" data-type="image">
106
+ <a href="<?php echo esc_url($block_options['telegram_url']) ?>"><img src="<?php echo $social_icon_url ?>/telegram.png" alt="Telegram"></a>
107
+ </span>
108
+ <?php } ?>
109
+ <?php
110
+ if (!empty($block_options['vk_url'])) {
111
+ $configured = true;
112
+ ?>
113
+ <span class="tnpc-row-edit" data-type="image">
114
+ <a href="<?php echo esc_url($block_options['vk_url']) ?>"><img src="<?php echo $social_icon_url ?>/vk.png" alt="VK"></a>
115
+ </span>
116
+ <?php } ?>
117
+ <?php if (!$configured) { ?>
118
+ <p>Configure your social links in the <a href="?page=newsletter_main_info">Social configuration section</a>.<br/>
119
+ Then remove and add again this block.</p>
120
+ <?php } ?>
121
+ </td>
122
+ </tr>
123
+ </table>
124
+
125
+
emails/blocks/social/icon.png CHANGED
Binary file
emails/blocks/text/_icon.png ADDED
Binary file
emails/blocks/text/block.php CHANGED
@@ -3,21 +3,21 @@
3
  * Name: Text
4
  * Section: content
5
  * Description: Free text block
6
- *
7
  */
8
 
9
  /* @var $options array */
10
 
11
  $default_options = array(
12
- 'html'=>'<p style="text-align: left; font-size: 16px; font-family: Arial">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vitae sodales nulla, nec blandit velit. Morbi feugiat imperdiet augue, vel mattis augue sagittis rutrum. Sed.</p>',
13
- 'font_family'=>'Helvetica, Arial, sans-serif',
14
- 'font_size'=>16,
15
- 'font_color'=>'#000000',
16
  'block_padding_left'=>15,
17
  'block_padding_right'=>15,
18
  'block_padding_top' => 20,
19
  'block_padding_bottom' => 20,
20
- 'block_background'=>'#ffffff'
21
  );
22
 
23
  $options = array_merge($default_options, $options);
@@ -26,22 +26,25 @@ $options['html'] = str_replace('<p>', '<p style="">', $options['html']);
26
  $style = 'font-family: ' . $options['font_family'] . ';font-size: ' . $options['font_size'] . 'px; color: <?php echo $options['font_color']?>;
27
  $options['html'] = str_replace('<p', '<p inline-class="text-p"', $options['html']);
28
  */
 
 
 
 
 
 
29
  ?>
30
  <style>
31
- .text-td {
32
- font-family: <?php echo $options['font_family']?>;
33
- font-size: <?php echo $options['font_size']?>px;
34
- color: <?php echo $options['font_color']?>;
 
35
  line-height: 1.5;
36
  }
37
- .text-p {
38
- font-family: <?php echo $options['font_family']?>;
39
- font-size: <?php echo $options['font_size']?>px;
40
- }
41
  </style>
42
  <table width="100%" style="width: 100%!important" border="0" cellpadding="0" cellspacing="0">
43
  <tr>
44
- <td width="100%" valign="top" align="left" class="text-td">
45
  <?php echo $options['html'] ?>
46
  </td>
47
  </tr>
3
  * Name: Text
4
  * Section: content
5
  * Description: Free text block
6
+ *
7
  */
8
 
9
  /* @var $options array */
10
 
11
  $default_options = array(
12
+ 'html'=>'<p style="text-align: left; margin: 0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vitae sodales nulla, nec blandit velit. Morbi feugiat imperdiet augue, vel mattis augue sagittis rutrum. Sed.</p>',
13
+ 'font_family'=>'',
14
+ 'font_size'=>'',
15
+ 'font_color'=>'',
16
  'block_padding_left'=>15,
17
  'block_padding_right'=>15,
18
  'block_padding_top' => 20,
19
  'block_padding_bottom' => 20,
20
+ 'block_background'=>''
21
  );
22
 
23
  $options = array_merge($default_options, $options);
26
  $style = 'font-family: ' . $options['font_family'] . ';font-size: ' . $options['font_size'] . 'px; color: <?php echo $options['font_color']?>;
27
  $options['html'] = str_replace('<p', '<p inline-class="text-p"', $options['html']);
28
  */
29
+
30
+ $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
31
+ $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
32
+ $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
33
+ $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
34
+
35
  ?>
36
  <style>
37
+ .text {
38
+ font-family: <?php echo $text_font_family ?>;
39
+ font-size: <?php echo $text_font_size ?>px;
40
+ font-weight: <?php echo $text_font_weight ?>;
41
+ color: <?php echo $text_font_color ?>;
42
  line-height: 1.5;
43
  }
 
 
 
 
44
  </style>
45
  <table width="100%" style="width: 100%!important" border="0" cellpadding="0" cellspacing="0">
46
  <tr>
47
+ <td width="100%" valign="top" align="left" inline-class="text">
48
  <?php echo $options['html'] ?>
49
  </td>
50
  </tr>
emails/blocks/text/icon.png CHANGED
Binary file
emails/blocks/text/options.php CHANGED
@@ -1,11 +1,16 @@
1
- <?php
2
- /*
3
- * @var $options array contains all the options the current block we're ediging contains
4
- * @var $controls NewsletterControls
5
- */
6
- /* @var $fields NewsletterFields */
7
- ?>
8
-
9
- <?php //$fields->font() ?>
10
- <?php $fields->wp_editor('html', 'Content') ?>
11
- <?php $fields->block_commons() ?>
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * @var $options array contains all the options the current block we're ediging contains
4
+ * @var $controls NewsletterControls
5
+ */
6
+ /* @var $fields NewsletterFields */
7
+ ?>
8
+
9
+ <?php //$fields->font() ?>
10
+ <?php $fields->wp_editor( 'html', 'Content', [
11
+ 'text_font_family' => $composer['text_font_family'],
12
+ 'text_font_size' => $composer['text_font_size'],
13
+ 'text_font_weight' => $composer['text_font_weight'],
14
+ 'text_font_color' => $composer['text_font_color'],
15
+ ] ) ?>
16
+ <?php $fields->block_commons() ?>
emails/composer.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  defined('ABSPATH') || exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
@@ -12,20 +13,57 @@ include NEWSLETTER_INCLUDES_DIR . '/codemirror.php';
12
 
13
  if ($controls->is_action()) {
14
 
15
- if (empty($_GET['id'])) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  // Create a new email
18
  $email = new stdClass();
19
  $email->status = 'new';
20
  $email->track = Newsletter::instance()->options['track'];
21
  $email->token = $module->get_token();
22
- $email->message_text = "This email requires a modern e-mail reader but you can view the email online here:\n{email_url}.\nThank you, " . wp_specialchars_decode(get_option('blogname'), ENT_QUOTES) .
23
  "\nTo change your subscription follow: {profile_url}.";
24
  $email->editor = NewsletterEmails::EDITOR_COMPOSER;
25
  $email->type = 'message';
26
  $email->send_on = time();
27
  $email->query = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
28
-
29
  TNP_Composer::update_email($email, $controls);
30
 
31
  $email = Newsletter::instance()->save_email($email);
@@ -34,7 +72,7 @@ if ($controls->is_action()) {
34
  $email = Newsletter::instance()->get_email($_GET['id']);
35
  TNP_Composer::update_email($email, $controls);
36
  $email = Newsletter::instance()->save_email($email);
37
-
38
  }
39
 
40
  $controls->add_message_saved();
@@ -55,14 +93,17 @@ if ($controls->is_action()) {
55
  return;
56
  } else {
57
 
58
- if (!empty($_GET['id'])) {
59
- $email = Newsletter::instance()->get_email((int) $_GET['id']);
60
-
61
- }
62
  }
63
 
64
  if (isset($email)) {
65
  TNP_Composer::prepare_controls($controls, $email);
 
 
 
66
  }
67
  ?>
68
 
@@ -88,6 +129,8 @@ if (isset($email)) {
88
 
89
  <?php $controls->composer_fields_v2(); ?>
90
 
 
 
91
  <?php $controls->button_confirm('reset', __('Back to last save', 'newsletter'), 'Are you sure?'); ?>
92
  <?php $controls->button('save', __('Save', 'newsletter'), 'tnpc_save(this.form); this.form.submit();'); ?>
93
  <?php $controls->button('preview', __('Next', 'newsletter') . ' &raquo;', 'tnpc_save(this.form); this.form.submit();'); ?>
1
  <?php
2
+ /* @var $this NewsletterEmails */
3
  defined('ABSPATH') || exit;
4
 
5
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
13
 
14
  if ($controls->is_action()) {
15
 
16
+ if ( $controls->is_action( 'save_preset' ) ) {
17
+ // Create new preset email
18
+ $email = new stdClass();
19
+ TNP_Composer::update_email( $email, $controls );
20
+ $email->type = NewsletterEmails::PRESET_EMAIL_TYPE;
21
+ $email->editor = NewsletterEmails::EDITOR_COMPOSER;
22
+ $email->subject = $module->sanitize_preset_name( $controls->data['subject'] );
23
+ $email->message = $controls->data['message'];
24
+
25
+ $email = Newsletter::instance()->save_email( $email );
26
+
27
+ $redirect = $module->get_admin_page_url( 'composer' );
28
+ $controls->js_redirect( $redirect );
29
+
30
+ return;
31
+ }
32
+
33
+ if ( $controls->is_action( 'update_preset' ) && ! empty( $_POST['preset_id'] ) ) {
34
+
35
+ $email = Newsletter::instance()->get_email( (int) $_POST['preset_id'] );
36
+ TNP_Composer::update_email( $email, $controls );
37
+
38
+ if ( $email->subject != sanitize_text_field($controls->data['subject']) ) {
39
+ $email->subject = $module->sanitize_preset_name( $controls->data['subject'] );
40
+ }
41
+
42
+ $email->message = $controls->data['message'];
43
+
44
+ $email = Newsletter::instance()->save_email( $email );
45
+
46
+ $redirect = $module->get_admin_page_url( 'composer' );
47
+ $controls->js_redirect( $redirect );
48
+
49
+ return;
50
+ }
51
+
52
+
53
+ if (empty($_GET['id'])) {
54
 
55
  // Create a new email
56
  $email = new stdClass();
57
  $email->status = 'new';
58
  $email->track = Newsletter::instance()->options['track'];
59
  $email->token = $module->get_token();
60
+ $email->message_text = "This email requires a modern e-mail reader but you can view the email online here:\n{email_url}.\nThank you, " . wp_specialchars_decode(get_option('blogname'), ENT_QUOTES) .
61
  "\nTo change your subscription follow: {profile_url}.";
62
  $email->editor = NewsletterEmails::EDITOR_COMPOSER;
63
  $email->type = 'message';
64
  $email->send_on = time();
65
  $email->query = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
66
+
67
  TNP_Composer::update_email($email, $controls);
68
 
69
  $email = Newsletter::instance()->save_email($email);
72
  $email = Newsletter::instance()->get_email($_GET['id']);
73
  TNP_Composer::update_email($email, $controls);
74
  $email = Newsletter::instance()->save_email($email);
75
+
76
  }
77
 
78
  $controls->add_message_saved();
93
  return;
94
  } else {
95
 
96
+ if ( ! empty( $_GET['id'] ) ) {
97
+ $email = Newsletter::instance()->get_email( (int) $_GET['id'] );
98
+ }
99
+
100
  }
101
 
102
  if (isset($email)) {
103
  TNP_Composer::prepare_controls($controls, $email);
104
+ } else {
105
+ //Add default global styles to controls data
106
+ $controls->data = array_merge( TNP_Composer::get_global_style_defaults(), empty( $controls->data ) ? [] : $controls->data );
107
  }
108
  ?>
109
 
129
 
130
  <?php $controls->composer_fields_v2(); ?>
131
 
132
+ <?php $controls->button('update_preset', __('Update preset', 'newsletter'), 'tnpc_update_preset(this.form)', 'update-preset-button'); ?>
133
+ <?php $controls->button('save_preset', __('Save as preset', 'newsletter'), 'tnpc_save_preset(this.form)', 'save-preset-button'); ?>
134
  <?php $controls->button_confirm('reset', __('Back to last save', 'newsletter'), 'Are you sure?'); ?>
135
  <?php $controls->button('save', __('Save', 'newsletter'), 'tnpc_save(this.form); this.form.submit();'); ?>
136
  <?php $controls->button('preview', __('Next', 'newsletter') . ' &raquo;', 'tnpc_save(this.form); this.form.submit();'); ?>
emails/emails.php CHANGED
@@ -2,7 +2,8 @@
2
 
3
  defined('ABSPATH') || exit;
4
 
5
- class NewsletterEmails extends NewsletterModule {
 
6
 
7
  static $instance;
8
 
@@ -11,21 +12,25 @@ class NewsletterEmails extends NewsletterModule {
11
  const EDITOR_TINYMCE = 0;
12
 
13
  static $PRESETS_LIST;
 
 
14
  // Cache
15
  var $blocks = null;
16
 
17
  /**
18
  * @return NewsletterEmails
19
  */
20
- static function instance() {
 
21
  if (self::$instance == null) {
22
  self::$instance = new NewsletterEmails();
23
  }
24
  return self::$instance;
25
  }
26
 
27
- function __construct() {
28
- self::$PRESETS_LIST = array("cta", "invite", "announcement", "posts", "sales", "product", "tour", "simple", "blank");
 
29
  $this->themes = new NewsletterThemes('emails');
30
  parent::__construct('emails', '1.1.5');
31
  add_action('newsletter_action', array($this, 'hook_newsletter_action'), 13, 3);
@@ -36,6 +41,8 @@ class NewsletterEmails extends NewsletterModule {
36
  add_action('wp_ajax_tnpc_css', array($this, 'tnpc_css_callback'));
37
  add_action('wp_ajax_tnpc_options', array($this, 'hook_wp_ajax_tnpc_options'));
38
  add_action('wp_ajax_tnpc_presets', array($this, 'hook_wp_ajax_tnpc_presets'));
 
 
39
 
40
  // Thank you to plugins which add the WP editor on other admin plugin pages...
41
  if (isset($_GET['page']) && $_GET['page'] == 'newsletter_emails_edit') {
@@ -45,7 +52,8 @@ class NewsletterEmails extends NewsletterModule {
45
  }
46
  }
47
 
48
- function options_decode($options) {
 
49
 
50
  // Start compatibility
51
  if (is_string($options) && strpos($options, 'options[') !== false) {
@@ -71,11 +79,13 @@ class NewsletterEmails extends NewsletterModule {
71
  *
72
  * @param array $options Options array
73
  */
74
- function options_encode($options) {
 
75
  return base64_encode(json_encode($options, JSON_HEX_TAG | JSON_HEX_AMP));
76
  }
77
 
78
- function hook_wp_ajax_tnpc_options() {
 
79
  global $wpdb;
80
 
81
  // TODO: Uniform to use id everywhere
@@ -90,7 +100,9 @@ class NewsletterEmails extends NewsletterModule {
90
  if (!class_exists('NewsletterControls')) {
91
  include NEWSLETTER_INCLUDES_DIR . '/controls.php';
92
  }
 
93
  $options = $this->options_decode(stripslashes_deep($_REQUEST['options']));
 
94
 
95
  $context = array('type' => '');
96
  if (isset($_REQUEST['context_type'])) {
@@ -123,40 +135,160 @@ class NewsletterEmails extends NewsletterModule {
123
  *
124
  * @return string
125
  */
126
- function hook_wp_ajax_tnpc_presets() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
- $content = "";
129
 
130
- if (!empty($_REQUEST['id'])) {
131
 
132
- // Preset render
133
- $preset = $this->get_preset($_REQUEST['id']);
134
 
135
  foreach ($preset->blocks as $item) {
136
- $this->render_block($item->block, true, (array) $item->options);
 
 
137
  }
 
138
  } else {
139
 
140
- $content = "<div class='clear tnpc-presets-title'>" . __('Choose a preset:', 'newsletter') . "</div>";
 
 
141
 
142
- foreach (self::$PRESETS_LIST as $id) {
143
 
144
- $preset = $this->get_preset($id);
145
 
146
- $content .= "<div class='tnpc-preset' onclick='tnpc_load_preset(\"$id\")'>";
147
- $content .= "<img src='$preset->icon' title='$preset->name' />";
148
- $content .= "<span class='tnpc-preset-label'>$preset->name</span>";
149
- $content .= '</div>';
150
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
- $content .= '<div class="clear"></div>';
153
- echo $content;
154
  }
155
 
156
- die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
158
 
159
- function has_dynamic_blocks($theme) {
 
160
  preg_match_all('/data-json="(.*?)"/m', $theme, $matches, PREG_PATTERN_ORDER);
161
  foreach ($matches[1] as $match) {
162
  $a = html_entity_decode($match, ENT_QUOTES, 'UTF-8');
@@ -185,7 +317,8 @@ class NewsletterEmails extends NewsletterModule {
185
  * @param TNP_Email $email (Rinominare)
186
  * @return string
187
  */
188
- function regenerate($email, $context = array()) {
 
189
 
190
  // Cannot be removed due to compatibility issues with old Automated versions
191
  if (is_object($email)) {
@@ -264,20 +397,24 @@ class NewsletterEmails extends NewsletterModule {
264
  return array('body' => $result, 'subject' => $subject);
265
  }
266
 
267
- function remove_block_data($text) {
 
268
  // TODO: Lavorare!
269
  return $text;
270
  }
271
 
272
- static function get_outlook_wrapper_open($width = 600) {
 
273
  return '<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '" style="vertical-align:top;width:' . $width . 'px;"><![endif]-->';
274
  }
275
 
276
- static function get_outlook_wrapper_close() {
277
- echo "<!--[if mso | IE]></td></tr></table><![endif]-->";
 
278
  }
279
-
280
- function hook_safe_style_css($rules) {
 
281
  $rules[] = 'display';
282
  return $rules;
283
  }
@@ -289,22 +426,55 @@ class NewsletterEmails extends NewsletterModule {
289
  * @param type $wrapper
290
  * @param type $options
291
  */
292
- function render_block($block_id = null, $wrapper = false, $options = array(), $context = array()) {
 
293
  static $kses_style_filter = false;
294
-
295
  include_once NEWSLETTER_INCLUDES_DIR . '/helper.php';
296
 
 
 
 
 
 
 
 
 
 
 
 
297
  $width = 600;
298
  $font_family = 'Helvetica, Arial, sans-serif';
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  $info = Newsletter::instance()->get_options('info');
301
 
 
 
 
 
302
  // Just in case...
303
  if (!is_array($options)) {
304
  $options = array();
305
  }
306
-
307
-
308
  add_filter('safe_style_css', [$this, 'hook_safe_style_css']);
309
  $options = wp_kses_post_deep($options);
310
  remove_filter('safe_style_css', [$this, 'hook_safe_style_css']);
@@ -337,10 +507,9 @@ class NewsletterEmails extends NewsletterModule {
337
 
338
  $out = array('subject' => '', 'return_empty_message' => false, 'stop' => false, 'skip' => false);
339
 
340
- $dir = is_rtl()?'rtl':'ltr';
341
- $align_left = is_rtl()?'right':'left';
342
- $align_right = is_rtl()?'left':'right';
343
-
344
 
345
  ob_start();
346
  $logger = $this->logger;
@@ -356,7 +525,7 @@ class NewsletterEmails extends NewsletterModule {
356
  'block_padding_bottom' => 0,
357
  'block_padding_right' => 0,
358
  'block_padding_left' => 0,
359
- 'block_background' => '#ffffff',
360
  'block_background_2' => ''
361
  );
362
 
@@ -371,10 +540,12 @@ class NewsletterEmails extends NewsletterModule {
371
  // Requited for the server side parsing and rendering
372
  $options['block_id'] = $block_id;
373
 
374
- $options['block_padding_top'] = (int) str_replace('px', '', $options['block_padding_top']);
375
- $options['block_padding_bottom'] = (int) str_replace('px', '', $options['block_padding_bottom']);
376
- $options['block_padding_right'] = (int) str_replace('px', '', $options['block_padding_right']);
377
- $options['block_padding_left'] = (int) str_replace('px', '', $options['block_padding_left']);
 
 
378
 
379
  // Internal TD wrapper
380
  $style = 'text-align: center; ';
@@ -383,14 +554,12 @@ class NewsletterEmails extends NewsletterModule {
383
  $style .= 'padding-left: ' . $options['block_padding_left'] . 'px; ';
384
  $style .= 'padding-right: ' . $options['block_padding_right'] . 'px; ';
385
  $style .= 'padding-bottom: ' . $options['block_padding_bottom'] . 'px; ';
386
- $style .= 'background-color: ' . $options['block_background'] . ';';
387
 
388
  if (isset($options['block_background_gradient'])) {
389
- $style .= 'background: linear-gradient(180deg, ' . $options['block_background'] . ' 0%, ' . $options['block_background_2'] . ' 100%);';
390
  }
391
 
392
-
393
-
394
  $data = $this->options_encode($options);
395
  // First time block creation wrapper
396
  if ($wrapper) {
@@ -404,7 +573,7 @@ class NewsletterEmails extends NewsletterModule {
404
 
405
  echo '<table type="options" data-json="', esc_attr($data), '" class="tnpc-block-content" border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
406
  echo "<tr>";
407
- echo '<td align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">';
408
 
409
  //echo "<!-- block generated content -->\n";
410
  echo trim($content);
@@ -428,7 +597,8 @@ class NewsletterEmails extends NewsletterModule {
428
  * @param type $block_id
429
  * @param type $wrapper
430
  */
431
- function tnpc_render_callback() {
 
432
  if (!check_ajax_referer('save')) {
433
  $this->dienow('Expired request');
434
  }
@@ -437,11 +607,71 @@ class NewsletterEmails extends NewsletterModule {
437
  $wrapper = isset($_POST['full']);
438
  $options = $this->restore_options_from_request();
439
 
440
- $this->render_block($block_id, $wrapper, $options);
441
  wp_die();
442
  }
443
 
444
- function tnpc_preview_callback() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
  $email = Newsletter::instance()->get_email($_REQUEST['id'], ARRAY_A);
446
 
447
  if (empty($email)) {
@@ -454,17 +684,22 @@ class NewsletterEmails extends NewsletterModule {
454
  wp_die();
455
  }
456
 
457
- function tnpc_css_callback() {
 
458
  include NEWSLETTER_DIR . '/emails/tnp-composer/css/newsletter.css';
459
  wp_die();
460
  }
461
 
462
  /** Returns the correct admin page to edit the newsletter with the correct editor. */
463
- function get_editor_url($email_id, $editor_type) {
 
464
  switch ($editor_type) {
465
- case NewsletterEmails::EDITOR_COMPOSER: return admin_url("admin.php") . '?page=newsletter_emails_composer&id=' . $email_id;
466
- case NewsletterEmails::EDITOR_HTML: return admin_url("admin.php") . '?page=newsletter_emails_editorhtml&id=' . $email_id;
467
- case NewsletterEmails::EDITOR_TINYMCE: return admin_url("admin.php") . '?page=newsletter_emails_editortinymce&id=' . $email_id;
 
 
 
468
  }
469
  }
470
 
@@ -474,7 +709,8 @@ class NewsletterEmails extends NewsletterModule {
474
  *
475
  * @param TNP_Email $email
476
  */
477
- function get_edit_button($email) {
 
478
 
479
  $editor_type = $this->get_editor_type($email);
480
  if ($email->status == 'new') {
@@ -493,14 +729,20 @@ class NewsletterEmails extends NewsletterModule {
493
  $icon_class = 'edit';
494
  break;
495
  }
 
 
 
496
 
497
- return '<a class="button-primary" href="' . $edit_url . '">' .
 
498
  '<i class="fas fa-' . $icon_class . '"></i> ' . __('Edit', 'newsletter') . '</a>';
 
499
  }
500
 
501
  /** Returns the correct editor type for the provided newsletter. Contains backward compatibility code. */
502
- function get_editor_type($email) {
503
- $email = (object) $email;
 
504
  $editor_type = $email->editor;
505
 
506
  // Backward compatibility
@@ -514,14 +756,15 @@ class NewsletterEmails extends NewsletterModule {
514
  }
515
 
516
  /**
517
- *
518
- * @global wpdb $wpdb
519
  * @param type $action
520
  * @param type $user
521
  * @param type $email
522
  * @return type
 
523
  */
524
- function hook_newsletter_action($action, $user, $email) {
 
525
  global $wpdb;
526
 
527
  switch ($action) {
@@ -569,7 +812,7 @@ class NewsletterEmails extends NewsletterModule {
569
  break;
570
 
571
  case 'emails-css':
572
- $email_id = (int) $_GET['id'];
573
 
574
  $body = Newsletter::instance()->get_email_field($email_id, 'message');
575
 
@@ -641,7 +884,6 @@ class NewsletterEmails extends NewsletterModule {
641
  break;
642
 
643
 
644
-
645
  case 'emails-create':
646
  // Newsletter from themes are created on frontend context because sometime WP themes change the way the content,
647
  // excerpt, thumbnail are extracted.
@@ -706,7 +948,8 @@ class NewsletterEmails extends NewsletterModule {
706
  }
707
  }
708
 
709
- function admin_menu() {
 
710
  $this->add_menu_page('index', 'Newsletters');
711
  $this->add_admin_page('list', 'Email List');
712
  $this->add_admin_page('new', 'Email New');
@@ -724,7 +967,8 @@ class NewsletterEmails extends NewsletterModule {
724
  * @param string $dir
725
  * @return array | WP_Error
726
  */
727
- function build_block($dir) {
 
728
  $file = basename($dir);
729
  $block_id = sanitize_key($file);
730
  $full_file = $dir . '/block.php';
@@ -759,7 +1003,8 @@ class NewsletterEmails extends NewsletterModule {
759
  * @param type $dir
760
  * @return type
761
  */
762
- function scan_blocks_dir($dir) {
 
763
 
764
  if (!is_dir($dir)) {
765
  return array();
@@ -791,7 +1036,8 @@ class NewsletterEmails extends NewsletterModule {
791
  *
792
  * @return array
793
  */
794
- function get_blocks() {
 
795
 
796
  if (!is_null($this->blocks)) {
797
  return $this->blocks;
@@ -839,7 +1085,8 @@ class NewsletterEmails extends NewsletterModule {
839
  * @param string $id
840
  * @return array
841
  */
842
- function get_block($id) {
 
843
  switch ($id) {
844
  case 'content-03-text.block':
845
  $id = 'text';
@@ -866,9 +1113,11 @@ class NewsletterEmails extends NewsletterModule {
866
  case 'content-06-posts.block':
867
  $id = 'posts';
868
  break;
869
- case 'content-04-cta.block': $id = 'cta';
 
870
  break;
871
- case 'content-01-hero.block': $id = 'hero';
 
872
  break;
873
  // case 'content-02-heading.block': $id = '/plugins/newsletter/emails/blocks/heading';
874
  // break;
@@ -885,7 +1134,8 @@ class NewsletterEmails extends NewsletterModule {
885
  return $blocks[$id];
886
  }
887
 
888
- function scan_presets_dir($dir = null) {
 
889
 
890
  if (is_null($dir)) {
891
  $dir = __DIR__ . '/presets';
@@ -920,7 +1170,8 @@ class NewsletterEmails extends NewsletterModule {
920
  return $list;
921
  }
922
 
923
- function get_preset($id, $dir = null) {
 
924
 
925
  if (is_null($dir)) {
926
  $dir = __DIR__ . '/presets';
@@ -935,12 +1186,13 @@ class NewsletterEmails extends NewsletterModule {
935
  $json_content = file_get_contents("$dir/$id/preset.json");
936
  $json_content = str_replace("{placeholder_base_url}", plugins_url('newsletter') . '/emails/presets', $json_content);
937
  $json = json_decode($json_content);
938
- $json->icon = NEWSLETTER_URL . "/emails/presets/$id/icon.png";
939
 
940
  return $json;
941
  }
942
 
943
- function get_composer_css() {
 
944
  $css = file_get_contents(__DIR__ . '/tnp-composer/css/newsletter.css');
945
  $blocks = $this->get_blocks();
946
  foreach ($blocks as $block) {
@@ -960,7 +1212,8 @@ class NewsletterEmails extends NewsletterModule {
960
  * @param TNP_Email $email Could be any object with the TNP_Email attributes
961
  * @param NewsletterControls $controls
962
  */
963
- function send_test_email($email, $controls) {
 
964
  if (!$email) {
965
  $controls->errors = __('Newsletter should be saved before send a test', 'newsletter');
966
  return;
@@ -975,8 +1228,8 @@ class NewsletterEmails extends NewsletterModule {
975
  $users = NewsletterUsers::instance()->get_test_users();
976
  if (count($users) == 0) {
977
  $controls->errors = '' . __('There are no test subscribers to send to', 'newsletter') .
978
- '. <a href="https://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank"><strong>' .
979
- __('Read more', 'newsletter') . '</strong></a>.';
980
  } else {
981
  $r = Newsletter::instance()->send($email, $users, true);
982
  $emails = array();
@@ -996,14 +1249,15 @@ class NewsletterEmails extends NewsletterModule {
996
  $controls->messages .= ' ' . implode(', ', $emails);
997
  $controls->messages .= '.<br>';
998
  $controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/subscribers#test" target="_blank"><strong>' .
999
- __('Read more about test subscribers', 'newsletter') . '</strong></a>.<br>';
1000
  $controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank"><strong>' . __('Read more about delivery issues', 'newsletter') . '</strong></a>.';
1001
  }
1002
  }
1003
  $email->subject = $original_subject;
1004
  }
1005
 
1006
- function restore_options_from_request() {
 
1007
 
1008
  if (isset($_POST['options']) && is_array($_POST['options'])) {
1009
  // Get all block options
@@ -1011,9 +1265,9 @@ class NewsletterEmails extends NewsletterModule {
1011
 
1012
  // Deserialize inline edits when
1013
  // render is preformed on saving block options
1014
- if ( isset( $options['inline_edits'] ) && ! is_array( $options['inline_edits'] ) ) {
1015
- $options['inline_edits'] = $this->options_decode( $options['inline_edits'] );
1016
- }
1017
 
1018
  // Restore inline edits from data-json
1019
  // coming from inline editing
@@ -1046,6 +1300,33 @@ class NewsletterEmails extends NewsletterModule {
1046
  return array();
1047
  }
1048
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1049
  }
1050
 
1051
  NewsletterEmails::instance();
2
 
3
  defined('ABSPATH') || exit;
4
 
5
+ class NewsletterEmails extends NewsletterModule
6
+ {
7
 
8
  static $instance;
9
 
12
  const EDITOR_TINYMCE = 0;
13
 
14
  static $PRESETS_LIST;
15
+ const PRESET_EMAIL_TYPE = 'composer_template';
16
+
17
  // Cache
18
  var $blocks = null;
19
 
20
  /**
21
  * @return NewsletterEmails
22
  */
23
+ static function instance()
24
+ {
25
  if (self::$instance == null) {
26
  self::$instance = new NewsletterEmails();
27
  }
28
  return self::$instance;
29
  }
30
 
31
+ function __construct()
32
+ {
33
+ self::$PRESETS_LIST = array("cta", "invite", "announcement", "posts", "sales", "product", "tour", "simple");
34
  $this->themes = new NewsletterThemes('emails');
35
  parent::__construct('emails', '1.1.5');
36
  add_action('newsletter_action', array($this, 'hook_newsletter_action'), 13, 3);
41
  add_action('wp_ajax_tnpc_css', array($this, 'tnpc_css_callback'));
42
  add_action('wp_ajax_tnpc_options', array($this, 'hook_wp_ajax_tnpc_options'));
43
  add_action('wp_ajax_tnpc_presets', array($this, 'hook_wp_ajax_tnpc_presets'));
44
+ add_action('wp_ajax_tnpc_delete_preset', array($this, 'hook_wp_ajax_tnpc_delete_preset'));
45
+ add_action('wp_ajax_tnpc_regenerate_email', array($this, 'hook_wp_ajax_tnpc_regenerate_email'));
46
 
47
  // Thank you to plugins which add the WP editor on other admin plugin pages...
48
  if (isset($_GET['page']) && $_GET['page'] == 'newsletter_emails_edit') {
52
  }
53
  }
54
 
55
+ function options_decode($options)
56
+ {
57
 
58
  // Start compatibility
59
  if (is_string($options) && strpos($options, 'options[') !== false) {
79
  *
80
  * @param array $options Options array
81
  */
82
+ function options_encode($options)
83
+ {
84
  return base64_encode(json_encode($options, JSON_HEX_TAG | JSON_HEX_AMP));
85
  }
86
 
87
+ function hook_wp_ajax_tnpc_options()
88
+ {
89
  global $wpdb;
90
 
91
  // TODO: Uniform to use id everywhere
100
  if (!class_exists('NewsletterControls')) {
101
  include NEWSLETTER_INCLUDES_DIR . '/controls.php';
102
  }
103
+
104
  $options = $this->options_decode(stripslashes_deep($_REQUEST['options']));
105
+ $composer = isset($_POST['composer']) ? $_POST['composer'] : [];
106
 
107
  $context = array('type' => '');
108
  if (isset($_REQUEST['context_type'])) {
135
  *
136
  * @return string
137
  */
138
+ public function hook_wp_ajax_tnpc_presets()
139
+ {
140
+
141
+ if ($this->is_loading_preset_content_request()) {
142
+
143
+ $preset_id = $_REQUEST['id'];
144
+ $response = $this->get_preset_content($preset_id);
145
+
146
+ } else {
147
+
148
+ $response = $this->get_all_preset();
149
+
150
+ }
151
+
152
+ echo $response;
153
+ die();
154
+ }
155
+
156
+ private function is_loading_preset_content_request()
157
+ {
158
+ return !empty($_REQUEST['id']);
159
+ }
160
+
161
+ private function get_preset_content($preset_id)
162
+ {
163
 
164
+ $content = '';
165
 
166
+ if ($this->is_a_tnp_default_preset($preset_id)) {
167
 
168
+ // Get preset from file
169
+ $preset = $this->get_preset_from_file($preset_id);
170
 
171
  foreach ($preset->blocks as $item) {
172
+ ob_start();
173
+ $this->render_block($item->block, true, (array)$item->options);
174
+ $content .= trim(ob_get_clean());
175
  }
176
+
177
  } else {
178
 
179
+ // Get preset from db
180
+ $preset_email = $this->get_email(intval($_REQUEST['id']));
181
+ $content = $preset_email->message;
182
 
183
+ }
184
 
185
+ return $content;
186
 
187
+ }
188
+
189
+ private function is_a_tnp_default_preset($preset_id)
190
+ {
191
+ return in_array($preset_id, self::$PRESETS_LIST);
192
+ }
193
+
194
+ private function get_all_preset()
195
+ {
196
+
197
+ $content = "<div class='tnpc-preset-container'>";
198
+ $content .= "<div class='tnpc-preset-legacy-themes'><a href='" . $this->get_admin_page_url('theme') . "'>" . __('Looking for legacy themes?', 'newsletter') . "</a></div>";
199
+
200
+ // LOAD USER PRESETS
201
+ $user_preset_list = $this->get_emails(self::PRESET_EMAIL_TYPE);
202
+
203
+ foreach ($user_preset_list as $user_preset) {
204
+
205
+ $default_icon_url = NEWSLETTER_URL . "/emails/presets/default-icon.png?ver=2";
206
+ $preset_name = $user_preset->subject;
207
+ $delete_preset_text = __('Delete', 'newsletter');
208
+ $edit_preset_text = __('Edit', 'newsletter');
209
+
210
+ // esc_js() assumes the string will be in single quote (arghhh!!!)
211
+ $onclick_edit = 'tnpc_edit_preset(' . ((int)$user_preset->id) . ', \'' . esc_js($preset_name) . '\', event)';
212
+ $onclick_delete = 'tnpc_delete_preset(' . ((int)$user_preset->id) . ', \'' . esc_js($preset_name) . '\', event)';
213
+ $onclick_load = 'tnpc_load_preset(' . ((int)$user_preset->id) . ', \'' . esc_js($preset_name) . '\', event)';
214
+
215
+ $content .= "<div class='tnpc-preset' onclick='" . esc_attr($onclick_load) . "'>\n";
216
+ $content .= "<img src='$default_icon_url' title='" . esc_attr($preset_name) . "' alt='" . esc_attr($preset_name) . "'>\n";
217
+ $content .= "<span class='tnpc-preset-label'>" . esc_html($user_preset->subject) . "</span>\n";
218
+ $content .= "<span class='tnpc-delete-preset' onclick='" . esc_attr($onclick_delete) . "' title='" . esc_attr($delete_preset_text) . "'><i class='fas fa-times'></i></span>\n";
219
+ $content .= "<span class='tnpc-edit-preset' onclick='" . esc_attr($onclick_edit) . "' title='" . esc_attr($edit_preset_text) . "'><i class='fas fa-pencil-alt'></i></span>\n";
220
+ $content .= "</div>";
221
 
 
 
222
  }
223
 
224
+ // LOAD TNP PRESETS
225
+ foreach (self::$PRESETS_LIST as $id) {
226
+ $preset = $this->get_preset_from_file($id);
227
+ $preset_name = esc_html($preset->name);
228
+ $content .= "<div class='tnpc-preset' onclick='tnpc_load_preset(\"$id\")'>";
229
+ $content .= "<img src='$preset->icon' title='$preset_name' alt='$preset_name'/>";
230
+ $content .= "<span class='tnpc-preset-label'>$preset_name</span>";
231
+ $content .= "</div>";
232
+ }
233
+
234
+ // Automated spot
235
+ $content .= "<div class='tnpc-preset'>";
236
+ if (class_exists('NewsletterAutomated')) {
237
+ $content .= "<a href='?page=newsletter_automated_index'>";
238
+ } else {
239
+ $content .= "<a href='https://www.thenewsletterplugin.com/automated?utm_source=plugin&utm_campaign=automated&utm_medium=composer'>";
240
+ }
241
+ $content .= "<img src='" . plugins_url('newsletter') . "/emails/images/automated.png' title='Automated addon' alt='Automated'/>";
242
+ $content .= "<span class='tnpc-preset-label'>Daily, weekly and monthly newsletters</span></a>";
243
+ $content .= "</div>";
244
+
245
+ // Autoresponder spot
246
+ $content .= "<div class='tnpc-preset'>";
247
+ if (class_exists('NewsletterAutoresponder')) {
248
+ $content .= "<a href='?page=newsletter_autoresponder_index'>";
249
+ } else {
250
+ $content .= "<a href='https://www.thenewsletterplugin.com/autoresponder?utm_source=plugin&utm_campaign=autoresponder&utm_medium=composer' target='_blank'>";
251
+ }
252
+ $content .= "<img src='" . plugins_url('newsletter') . "/emails/images/autoresponder.png' title='Autoresponder addon' alt='Autoresponder'/>";
253
+ $content .= "<span class='tnpc-preset-label'>Autoresponders</span></a>";
254
+ $content .= "</div>";
255
+
256
+ // RAW HTML
257
+ $content .= "<div class='tnpc-preset tnpc-preset-html' onclick='location.href=\"" . wp_nonce_url('admin.php?page=newsletter_emails_new&id=rawhtml', 'newsletter-new') . "\"'>";
258
+ $content .= "<img src='" . plugins_url('newsletter') . "/emails/images/rawhtml.png' title='RAW HTML' alt='RAW'/>";
259
+ $content .= "<span class='tnpc-preset-label'>Raw HTML</span>";
260
+ $content .= "</div>";
261
+
262
+ $content .= "<div class='clear'></div>";
263
+ $content .= "</div>";;
264
+
265
+ return $content;
266
+
267
+ }
268
+
269
+ /**
270
+ * Check if the preset name exists and adds an incremental suffix if the name exists.
271
+ *
272
+ * @param string $name
273
+ *
274
+ * @return string
275
+ */
276
+ public function sanitize_preset_name($name)
277
+ {
278
+ global $wpdb;
279
+
280
+ $name = empty($name) ? __('Empty name preset', 'newsletter') : $name;
281
+ $name = sanitize_text_field($name);
282
+ $type = self::PRESET_EMAIL_TYPE;
283
+ $count = (int)$wpdb->get_var("SELECT COUNT(*) FROM " . NEWSLETTER_EMAILS_TABLE . " WHERE type='$type' and subject='$name'");
284
+
285
+ $name = $count > 0 ? $name . " - " . ($count + 1) : $name;
286
+
287
+ return $name;
288
  }
289
 
290
+ function has_dynamic_blocks($theme)
291
+ {
292
  preg_match_all('/data-json="(.*?)"/m', $theme, $matches, PREG_PATTERN_ORDER);
293
  foreach ($matches[1] as $match) {
294
  $a = html_entity_decode($match, ENT_QUOTES, 'UTF-8');
317
  * @param TNP_Email $email (Rinominare)
318
  * @return string
319
  */
320
+ function regenerate($email, $context = array())
321
+ {
322
 
323
  // Cannot be removed due to compatibility issues with old Automated versions
324
  if (is_object($email)) {
397
  return array('body' => $result, 'subject' => $subject);
398
  }
399
 
400
+ function remove_block_data($text)
401
+ {
402
  // TODO: Lavorare!
403
  return $text;
404
  }
405
 
406
+ static function get_outlook_wrapper_open($width = 600)
407
+ {
408
  return '<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '" style="vertical-align:top;width:' . $width . 'px;"><![endif]-->';
409
  }
410
 
411
+ static function get_outlook_wrapper_close()
412
+ {
413
+ return "<!--[if mso | IE]></td></tr></table><![endif]-->";
414
  }
415
+
416
+ function hook_safe_style_css($rules)
417
+ {
418
  $rules[] = 'display';
419
  return $rules;
420
  }
426
  * @param type $wrapper
427
  * @param type $options
428
  */
429
+ function render_block($block_id = null, $wrapper = false, $options = [], $context = [], $composer = [])
430
+ {
431
  static $kses_style_filter = false;
 
432
  include_once NEWSLETTER_INCLUDES_DIR . '/helper.php';
433
 
434
+ //Remove 'options_composer_' prefix
435
+ $composer_defaults = [];
436
+ foreach (TNP_Composer::get_global_style_defaults() as $global_option_name => $global_option) {
437
+ $composer_defaults[str_replace('options_composer_', '', $global_option_name)] = $global_option;
438
+ }
439
+ $composer = array_merge($composer_defaults, $composer);
440
+
441
+ // ========================================================= //
442
+ // =============== GLOBAL VARIABLES ================== //
443
+ // ========================================================= //
444
+
445
  $width = 600;
446
  $font_family = 'Helvetica, Arial, sans-serif';
447
 
448
+ $global_title_font_family = $composer['title_font_family'];
449
+ $global_title_font_size = $composer['title_font_size'];
450
+ $global_title_font_color = $composer['title_font_color'];
451
+ $global_title_font_weight = $composer['title_font_weight'];
452
+
453
+ $global_text_font_family = $composer['text_font_family'];
454
+ $global_text_font_size = $composer['text_font_size'];
455
+ $global_text_font_color = $composer['text_font_color'];
456
+ $global_text_font_weight = $composer['text_font_weight'];
457
+
458
+ $global_button_font_family = $composer['button_font_family'];
459
+ $global_button_font_size = $composer['button_font_size'];
460
+ $global_button_font_color = $composer['button_font_color'];
461
+ $global_button_font_weight = $composer['button_font_weight'];
462
+ $global_button_background_color = $composer['button_background_color'];
463
+
464
+ $global_block_background = $composer['block_background'];
465
+
466
  $info = Newsletter::instance()->get_options('info');
467
 
468
+ // ============================================================= //
469
+ // =============== END GLOBAL VARIABLES ================== //
470
+ // ============================================================= //
471
+
472
  // Just in case...
473
  if (!is_array($options)) {
474
  $options = array();
475
  }
476
+
477
+
478
  add_filter('safe_style_css', [$this, 'hook_safe_style_css']);
479
  $options = wp_kses_post_deep($options);
480
  remove_filter('safe_style_css', [$this, 'hook_safe_style_css']);
507
 
508
  $out = array('subject' => '', 'return_empty_message' => false, 'stop' => false, 'skip' => false);
509
 
510
+ $dir = is_rtl() ? 'rtl' : 'ltr';
511
+ $align_left = is_rtl() ? 'right' : 'left';
512
+ $align_right = is_rtl() ? 'left' : 'right';
 
513
 
514
  ob_start();
515
  $logger = $this->logger;
525
  'block_padding_bottom' => 0,
526
  'block_padding_right' => 0,
527
  'block_padding_left' => 0,
528
+ 'block_background' => '',
529
  'block_background_2' => ''
530
  );
531
 
540
  // Requited for the server side parsing and rendering
541
  $options['block_id'] = $block_id;
542
 
543
+ $options['block_padding_top'] = (int)str_replace('px', '', $options['block_padding_top']);
544
+ $options['block_padding_bottom'] = (int)str_replace('px', '', $options['block_padding_bottom']);
545
+ $options['block_padding_right'] = (int)str_replace('px', '', $options['block_padding_right']);
546
+ $options['block_padding_left'] = (int)str_replace('px', '', $options['block_padding_left']);
547
+
548
+ $block_background = empty($options['block_background']) ? $global_block_background : $options['block_background'];
549
 
550
  // Internal TD wrapper
551
  $style = 'text-align: center; ';
554
  $style .= 'padding-left: ' . $options['block_padding_left'] . 'px; ';
555
  $style .= 'padding-right: ' . $options['block_padding_right'] . 'px; ';
556
  $style .= 'padding-bottom: ' . $options['block_padding_bottom'] . 'px; ';
557
+ $style .= 'background-color: ' . $block_background . ';';
558
 
559
  if (isset($options['block_background_gradient'])) {
560
+ $style .= 'background: linear-gradient(180deg, ' . $block_background . ' 0%, ' . $options['block_background_2'] . ' 100%);';
561
  }
562
 
 
 
563
  $data = $this->options_encode($options);
564
  // First time block creation wrapper
565
  if ($wrapper) {
573
 
574
  echo '<table type="options" data-json="', esc_attr($data), '" class="tnpc-block-content" border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
575
  echo "<tr>";
576
+ echo '<td align="center" style="', $style, '" bgcolor="', $block_background, '" width="100%">';
577
 
578
  //echo "<!-- block generated content -->\n";
579
  echo trim($content);
597
  * @param type $block_id
598
  * @param type $wrapper
599
  */
600
+ function tnpc_render_callback()
601
+ {
602
  if (!check_ajax_referer('save')) {
603
  $this->dienow('Expired request');
604
  }
607
  $wrapper = isset($_POST['full']);
608
  $options = $this->restore_options_from_request();
609
 
610
+ $this->render_block($block_id, $wrapper, $options, [], $_POST['composer']);
611
  wp_die();
612
  }
613
 
614
+ function hook_wp_ajax_tnpc_regenerate_email()
615
+ {
616
+
617
+ $content = stripslashes($_POST['content']);
618
+ $global_options = $_POST['composer'];
619
+
620
+ $regenerated_content = $this->regenerate_email_blocks($content, $global_options);
621
+
622
+ wp_send_json_success([
623
+ 'content' => $regenerated_content,
624
+ 'message' => __('Successfully updated', 'newsletter')
625
+ ]);
626
+
627
+ }
628
+
629
+ private function regenerate_email_blocks($content, $global_options)
630
+ {
631
+
632
+ $raw_block_options = $this->extract_encoded_blocks_options($content);
633
+
634
+ $regenerated_content = '';
635
+
636
+ foreach ($raw_block_options as $raw_block_option) {
637
+
638
+ /* $a = html_entity_decode( $raw_block_option, ENT_QUOTES, 'UTF-8' );
639
+ $block_options = $this->options_decode( $a );*/
640
+
641
+ $block_options = $this->options_decode($raw_block_option);
642
+
643
+ $block = $this->get_block($block_options['block_id']);
644
+ if (!$block) {
645
+ $this->logger->debug('Unable to load the block ' . $block_options['block_id']);
646
+ }
647
+
648
+ ob_start();
649
+ $this->render_block($block_options['block_id'], true, $block_options, [], $global_options);
650
+ $block_html = ob_get_clean();
651
+
652
+ $regenerated_content .= $block_html;
653
+ }
654
+
655
+ return $regenerated_content;
656
+
657
+ }
658
+
659
+ /**
660
+ * @param string $html_email_content Email html content
661
+ *
662
+ * @return string[] Encoded options of email blocks
663
+ */
664
+ private function extract_encoded_blocks_options($html_email_content)
665
+ {
666
+
667
+ preg_match_all('/data-json="(.*?)"/m', $html_email_content, $raw_block_options, PREG_PATTERN_ORDER);
668
+
669
+ return $raw_block_options[1];
670
+
671
+ }
672
+
673
+ function tnpc_preview_callback()
674
+ {
675
  $email = Newsletter::instance()->get_email($_REQUEST['id'], ARRAY_A);
676
 
677
  if (empty($email)) {
684
  wp_die();
685
  }
686
 
687
+ function tnpc_css_callback()
688
+ {
689
  include NEWSLETTER_DIR . '/emails/tnp-composer/css/newsletter.css';
690
  wp_die();
691
  }
692
 
693
  /** Returns the correct admin page to edit the newsletter with the correct editor. */
694
+ function get_editor_url($email_id, $editor_type)
695
+ {
696
  switch ($editor_type) {
697
+ case NewsletterEmails::EDITOR_COMPOSER:
698
+ return admin_url("admin.php") . '?page=newsletter_emails_composer&id=' . $email_id;
699
+ case NewsletterEmails::EDITOR_HTML:
700
+ return admin_url("admin.php") . '?page=newsletter_emails_editorhtml&id=' . $email_id;
701
+ case NewsletterEmails::EDITOR_TINYMCE:
702
+ return admin_url("admin.php") . '?page=newsletter_emails_editortinymce&id=' . $email_id;
703
  }
704
  }
705
 
709
  *
710
  * @param TNP_Email $email
711
  */
712
+ function get_edit_button($email, $only_icon = false)
713
+ {
714
 
715
  $editor_type = $this->get_editor_type($email);
716
  if ($email->status == 'new') {
729
  $icon_class = 'edit';
730
  break;
731
  }
732
+ if ($only_icon) {
733
+ return '<a class="button-primary" href="' . $edit_url . '" title="' . esc_attr__('Edit', 'newsletter') . '">' .
734
+ '<i class="fas fa-' . $icon_class . '"></i></a>';
735
 
736
+ } else {
737
+ return '<a class="button-primary" href="' . $edit_url . '" title="' . esc_attr__('Edit', 'newsletter') . '">' .
738
  '<i class="fas fa-' . $icon_class . '"></i> ' . __('Edit', 'newsletter') . '</a>';
739
+ }
740
  }
741
 
742
  /** Returns the correct editor type for the provided newsletter. Contains backward compatibility code. */
743
+ function get_editor_type($email)
744
+ {
745
+ $email = (object)$email;
746
  $editor_type = $email->editor;
747
 
748
  // Backward compatibility
756
  }
757
 
758
  /**
759
+ *
 
760
  * @param type $action
761
  * @param type $user
762
  * @param type $email
763
  * @return type
764
+ * @global wpdb $wpdb
765
  */
766
+ function hook_newsletter_action($action, $user, $email)
767
+ {
768
  global $wpdb;
769
 
770
  switch ($action) {
812
  break;
813
 
814
  case 'emails-css':
815
+ $email_id = (int)$_GET['id'];
816
 
817
  $body = Newsletter::instance()->get_email_field($email_id, 'message');
818
 
884
  break;
885
 
886
 
 
887
  case 'emails-create':
888
  // Newsletter from themes are created on frontend context because sometime WP themes change the way the content,
889
  // excerpt, thumbnail are extracted.
948
  }
949
  }
950
 
951
+ function admin_menu()
952
+ {
953
  $this->add_menu_page('index', 'Newsletters');
954
  $this->add_admin_page('list', 'Email List');
955
  $this->add_admin_page('new', 'Email New');
967
  * @param string $dir
968
  * @return array | WP_Error
969
  */
970
+ function build_block($dir)
971
+ {
972
  $file = basename($dir);
973
  $block_id = sanitize_key($file);
974
  $full_file = $dir . '/block.php';
1003
  * @param type $dir
1004
  * @return type
1005
  */
1006
+ function scan_blocks_dir($dir)
1007
+ {
1008
 
1009
  if (!is_dir($dir)) {
1010
  return array();
1036
  *
1037
  * @return array
1038
  */
1039
+ function get_blocks()
1040
+ {
1041
 
1042
  if (!is_null($this->blocks)) {
1043
  return $this->blocks;
1085
  * @param string $id
1086
  * @return array
1087
  */
1088
+ function get_block($id)
1089
+ {
1090
  switch ($id) {
1091
  case 'content-03-text.block':
1092
  $id = 'text';
1113
  case 'content-06-posts.block':
1114
  $id = 'posts';
1115
  break;
1116
+ case 'content-04-cta.block':
1117
+ $id = 'cta';
1118
  break;
1119
+ case 'content-01-hero.block':
1120
+ $id = 'hero';
1121
  break;
1122
  // case 'content-02-heading.block': $id = '/plugins/newsletter/emails/blocks/heading';
1123
  // break;
1134
  return $blocks[$id];
1135
  }
1136
 
1137
+ function scan_presets_dir($dir = null)
1138
+ {
1139
 
1140
  if (is_null($dir)) {
1141
  $dir = __DIR__ . '/presets';
1170
  return $list;
1171
  }
1172
 
1173
+ function get_preset_from_file($id, $dir = null)
1174
+ {
1175
 
1176
  if (is_null($dir)) {
1177
  $dir = __DIR__ . '/presets';
1186
  $json_content = file_get_contents("$dir/$id/preset.json");
1187
  $json_content = str_replace("{placeholder_base_url}", plugins_url('newsletter') . '/emails/presets', $json_content);
1188
  $json = json_decode($json_content);
1189
+ $json->icon = NEWSLETTER_URL . "/emails/presets/$id/icon.png?ver=2";
1190
 
1191
  return $json;
1192
  }
1193
 
1194
+ function get_composer_css()
1195
+ {
1196
  $css = file_get_contents(__DIR__ . '/tnp-composer/css/newsletter.css');
1197
  $blocks = $this->get_blocks();
1198
  foreach ($blocks as $block) {
1212
  * @param TNP_Email $email Could be any object with the TNP_Email attributes
1213
  * @param NewsletterControls $controls
1214
  */
1215
+ function send_test_email($email, $controls)
1216
+ {
1217
  if (!$email) {
1218
  $controls->errors = __('Newsletter should be saved before send a test', 'newsletter');
1219
  return;
1228
  $users = NewsletterUsers::instance()->get_test_users();
1229
  if (count($users) == 0) {
1230
  $controls->errors = '' . __('There are no test subscribers to send to', 'newsletter') .
1231
+ '. <a href="https://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank"><strong>' .
1232
+ __('Read more', 'newsletter') . '</strong></a>.';
1233
  } else {
1234
  $r = Newsletter::instance()->send($email, $users, true);
1235
  $emails = array();
1249
  $controls->messages .= ' ' . implode(', ', $emails);
1250
  $controls->messages .= '.<br>';
1251
  $controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/subscribers#test" target="_blank"><strong>' .
1252
+ __('Read more about test subscribers', 'newsletter') . '</strong></a>.<br>';
1253
  $controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank"><strong>' . __('Read more about delivery issues', 'newsletter') . '</strong></a>.';
1254
  }
1255
  }
1256
  $email->subject = $original_subject;
1257
  }
1258
 
1259
+ function restore_options_from_request()
1260
+ {
1261
 
1262
  if (isset($_POST['options']) && is_array($_POST['options'])) {
1263
  // Get all block options
1265
 
1266
  // Deserialize inline edits when
1267
  // render is preformed on saving block options
1268
+ if (isset($options['inline_edits']) && !is_array($options['inline_edits'])) {
1269
+ $options['inline_edits'] = $this->options_decode($options['inline_edits']);
1270
+ }
1271
 
1272
  // Restore inline edits from data-json
1273
  // coming from inline editing
1300
  return array();
1301
  }
1302
 
1303
+ public function hook_wp_ajax_tnpc_delete_preset()
1304
+ {
1305
+
1306
+ if (!wp_verify_nonce($_POST['_wpnonce'], 'preset')) {
1307
+ wp_send_json_error('Expired request');
1308
+ }
1309
+
1310
+ $preset_id = (int)$_REQUEST['presetId'];
1311
+
1312
+ $newsletter = Newsletter::instance();
1313
+
1314
+ if ($preset_id > 0) {
1315
+ $preset = $newsletter->get_email($preset_id);
1316
+
1317
+ if ($preset && $preset->type === self::PRESET_EMAIL_TYPE) {
1318
+ Newsletter::instance()->delete_email($preset_id);
1319
+ wp_send_json_success();
1320
+ } else {
1321
+ wp_send_json_error(__('Is not a preset!', 'newsletter'));
1322
+ }
1323
+
1324
+ } else {
1325
+ wp_send_json_error();
1326
+ }
1327
+
1328
+ }
1329
+
1330
  }
1331
 
1332
  NewsletterEmails::instance();
emails/images/_rawhtml.png ADDED
Binary file
emails/images/automated.png CHANGED
Binary file
emails/images/autoresponder.png ADDED
Binary file
emails/images/html.png DELETED
Binary file
emails/images/rawhtml.png ADDED
Binary file
emails/index.php CHANGED
@@ -53,7 +53,8 @@ $emails = $pagination_controller->get_items();
53
  <form method="post" action="">
54
  <?php $controls->init(); ?>
55
 
56
- <a href="<?php echo $this->get_admin_page_url('theme'); ?>" class="button-primary"><?php _e('New newsletter', 'newsletter') ?></a>
 
57
  <?php $controls->button_confirm('delete_selected', __('Delete selected newsletters', 'newsletter')); ?>
58
 
59
  <?php $pagination_controller->display_paginator(); ?>
53
  <form method="post" action="">
54
  <?php $controls->init(); ?>
55
 
56
+ <a href="<?php echo $this->get_admin_page_url('composer'); ?>" class="button-primary"><?php _e('New newsletter', 'newsletter') ?></a>
57
+
58
  <?php $controls->button_confirm('delete_selected', __('Delete selected newsletters', 'newsletter')); ?>
59
 
60
  <?php $pagination_controller->display_paginator(); ?>
emails/presets/announcement/icon.png CHANGED
Binary file
emails/presets/blank-icon.png ADDED
Binary file
emails/presets/blank/icon.png DELETED
Binary file
emails/presets/blank/preset.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Start with an empty project",
3
- "blocks": []
4
- }
 
 
 
 
emails/presets/cta/icon.png CHANGED
Binary file
emails/presets/default-icon.png ADDED
Binary file
emails/presets/invite/icon.png CHANGED
Binary file
emails/presets/posts/icon.png CHANGED
Binary file
emails/presets/product/icon.png CHANGED
Binary file
emails/presets/sales/icon.png CHANGED
Binary file
emails/presets/simple/icon.png CHANGED
Binary file
emails/presets/tour/icon.png CHANGED
Binary file
emails/theme.php CHANGED
@@ -16,12 +16,14 @@ if ($controls->data == null) {
16
  $controls->data = $module->get_options();
17
  }
18
 
19
- function newsletter_emails_update_options($options) {
 
20
  add_option('newsletter_emails', '', null, 'no');
21
  update_option('newsletter_emails', $options);
22
  }
23
 
24
- function newsletter_emails_update_theme_options($theme, $options) {
 
25
  $x = strrpos($theme, '/');
26
  if ($x !== false) {
27
  $theme = substr($theme, $x + 1);
@@ -30,12 +32,14 @@ function newsletter_emails_update_theme_options($theme, $options) {
30
  update_option('newsletter_emails_' . $theme, $options);
31
  }
32
 
33
- function newsletter_emails_get_options() {
 
34
  $options = get_option('newsletter_emails', array());
35
  return $options;
36
  }
37
 
38
- function newsletter_emails_get_theme_options($theme) {
 
39
  $x = strrpos($theme, '/');
40
  if ($x !== false) {
41
  $theme = substr($theme, $x + 1);
@@ -60,47 +64,22 @@ $themes = $module->themes->get_all_with_data();
60
 
61
  <div id="tnp-heading">
62
 
63
- <h2><?php _e('Select a theme', 'newsletter') ?>
64
- <a class="tnp-btn-h1" href="https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-themes" target="_blank">Custom themes</a>
65
- </h2>
66
 
67
  </div>
68
- <div id="tnp-body" class="tnp-darkbg">
69
 
70
  <form method="post" id="newsletter-form" action="<?php echo $module->get_admin_page_url('new'); ?>">
71
  <?php $controls->init(); ?>
72
  <?php $controls->hidden('theme'); ?>
73
 
74
- <div class="tnp-themes-new">
75
-
76
- <div class="tnp-theme-preview">
77
- <p><?php echo _e('Responsive Drag & Drop Composer', 'newsletter') ?></p>
78
- <a href="<?php echo $module->get_admin_page_url('composer'); ?>" style="margin-right: 20px; margin-bottom: 20px">
79
- <img class="tnp-theme-composer" src="<?php echo plugins_url('newsletter') . '/emails/images/composer.gif' ?>">
80
- </a>
81
- </div>
82
-
83
- <div class="tnp-theme-preview">
84
- <p>&lt;&gt; Raw HTML</p>
85
- <a href="<?php echo wp_nonce_url('admin.php?page=newsletter_emails_new&id=rawhtml', 'newsletter-new') ?>" style="margin-right: 20px; margin-bottom: 20px">
86
- <img class="tnp-theme-html" src="<?php echo plugins_url('newsletter') . '/emails/images/html.png' ?>">
87
- </a>
88
- </div>
89
-
90
- <div class="tnp-theme-preview">
91
- <p>Automatic</p>
92
- <a href="https://www.thenewsletterplugin.com/automated?utm_source=plugin&utm_campaign=automated&utm_medium=themes" style="margin-right: 20px; margin-bottom: 20px">
93
- <img class="tnp-theme-html" src="<?php echo plugins_url('newsletter') . '/emails/images/automated.png' ?>">
94
- </a>
95
- </div>
96
-
97
- </div>
98
- <h2>Classic Themes</h2>
99
-
100
  <?php foreach ($themes as $id => $data) { ?>
101
  <div class="tnp-theme-preview">
102
  <p><?php echo esc_html($data['name']) ?></p>
103
- <a href="<?php echo wp_nonce_url('admin.php?page=newsletter_emails_new&id=' . urlencode($id), 'newsletter-new') ?>" style="margin-right: 20px; margin-bottom: 20px">
 
104
  <img src="<?php echo esc_attr($data['screenshot']) ?>">
105
  </a>
106
  </div>
16
  $controls->data = $module->get_options();
17
  }
18
 
19
+ function newsletter_emails_update_options($options)
20
+ {
21
  add_option('newsletter_emails', '', null, 'no');
22
  update_option('newsletter_emails', $options);
23
  }
24
 
25
+ function newsletter_emails_update_theme_options($theme, $options)
26
+ {
27
  $x = strrpos($theme, '/');
28
  if ($x !== false) {
29
  $theme = substr($theme, $x + 1);
32
  update_option('newsletter_emails_' . $theme, $options);
33
  }
34
 
35
+ function newsletter_emails_get_options()
36
+ {
37
  $options = get_option('newsletter_emails', array());
38
  return $options;
39
  }
40
 
41
+ function newsletter_emails_get_theme_options($theme)
42
+ {
43
  $x = strrpos($theme, '/');
44
  if ($x !== false) {
45
  $theme = substr($theme, $x + 1);
64
 
65
  <div id="tnp-heading">
66
 
67
+ <h2><?php _e('Legacy themes', 'newsletter') ?></h2>
68
+
69
+ <?php echo $controls->page_help('https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-themes') ?>
70
 
71
  </div>
72
+ <div id="tnp-body">
73
 
74
  <form method="post" id="newsletter-form" action="<?php echo $module->get_admin_page_url('new'); ?>">
75
  <?php $controls->init(); ?>
76
  <?php $controls->hidden('theme'); ?>
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  <?php foreach ($themes as $id => $data) { ?>
79
  <div class="tnp-theme-preview">
80
  <p><?php echo esc_html($data['name']) ?></p>
81
+ <a href="<?php echo wp_nonce_url('admin.php?page=newsletter_emails_new&id=' . urlencode($id), 'newsletter-new') ?>"
82
+ style="margin-right: 20px; margin-bottom: 20px">
83
  <img src="<?php echo esc_attr($data['screenshot']) ?>">
84
  </a>
85
  </div>
emails/themes/default/theme.php CHANGED
@@ -65,7 +65,7 @@ if (isset($theme_options['theme_posts'])) {
65
  * {
66
  line-height: normal;
67
  }
68
- h1, h2, h3, h4 {
69
  line-height: normal;
70
  }
71
  a {
@@ -224,4 +224,4 @@ if (isset($theme_options['theme_posts'])) {
224
  </div>
225
 
226
  </body>
227
- </html>
65
  * {
66
  line-height: normal;
67
  }
68
+ h1, h2, h3, h4, h5 {
69
  line-height: normal;
70
  }
71
  a {
224
  </div>
225
 
226
  </body>
227
+ </html>
emails/tnp-composer/_css/newsletter-builder-v2.css CHANGED
@@ -1,7 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .tnp-composer-heading {
2
  background-color: #0073aa;
3
- border-radius: 0px !important;
4
- border-top: 5px solid #ffffff;
 
 
 
 
 
5
  }
6
 
7
  .tnp-composer-heading h2 {
@@ -26,26 +121,6 @@
26
  vertical-align: middle;
27
  }
28
 
29
- #newsletter-builder {
30
- position: relative;
31
- overflow: hidden;
32
- width: 100%;
33
- background-color: #FFFFFF;
34
- }
35
-
36
- .tnp-builder-column {
37
- overflow: auto;
38
- height: 85vh;
39
- float: left;
40
- }
41
-
42
- #newsletter-builder-sidebar {
43
- z-index: 1;
44
- width: 33.33%;
45
- background-color: #ECF0F1;
46
- position: relative;
47
- }
48
-
49
  #newsletter-builder-sidebar h4 {
50
  /* margin: 5px; */
51
  /* text-align: center; */
@@ -118,26 +193,17 @@
118
  /* cursor: pointer;*/
119
  }
120
 
121
- #newsletter-builder-area {
122
- background-color: #fff;
123
- width: 66.66%;
124
- box-sizing: border-box;
125
- padding-left: 50px;
126
- padding-right: 50px;
127
- padding-top: 10px;
128
- }
129
-
130
-
131
-
132
  #newsletter-builder-area-center-frame-content {
133
  /*float: left;*/
134
  /*width: 730px;*/
135
  /*background-color: rgba(153,153,153,1);*/
136
  min-height: 50px;
137
  padding-bottom: 75px;
138
- background-color: #ECF0F1;
139
  padding-top: 30px;
140
  /*border: 1px dashed #eee;*/
 
 
141
  }
142
 
143
  #newsletter-mobile-preview-area {
@@ -195,12 +261,12 @@ iframe#tnpc-mobile-preview {
195
  -moz-transition: all 0.5s;
196
  -o-transition: all 0.5s;
197
  transition: all 0.5s;
198
- opacity: 0;
199
  text-align: center;
200
  font-size: 18px;
201
  }
202
  .tnpc-row-delete i, .tnpc-row-edit-block i, .tnpc-row-clone i {
203
- line-height: 30px;
204
  }
205
  .tnpc-row-delete:hover {
206
  background-color: #E74C3C;
@@ -234,7 +300,7 @@ iframe#tnpc-mobile-preview {
234
 
235
  .tnpc-row-edit {
236
  position: relative;
237
- }
238
  .tnpc-row-edit-hover {
239
  height: 100%;
240
  width: 100%;
@@ -344,7 +410,7 @@ iframe#tnpc-mobile-preview {
344
  .tnpc-edit-box-content-field-input:focus {
345
  -webkit-box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
346
  -moz-box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
347
- box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
348
  }
349
  .tnpc-edit-box-content-field-textarea {
350
  /*float: left;*/
@@ -365,7 +431,7 @@ iframe#tnpc-mobile-preview {
365
  .tnpc-edit-box-content-field-textarea:focus {
366
  -webkit-box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
367
  -moz-box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
368
- box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
369
  }
370
  .tnpc-edit-box-content-icons {
371
  /*float: left;*/
@@ -594,8 +660,9 @@ iframe#tnpc-mobile-preview {
594
 
595
  /* Main container */
596
  #tnpc-block-options {
597
- height: 100vh;
598
  z-index: 10;
 
599
  display: none;
600
  position: absolute;
601
  top: 0px;
@@ -606,11 +673,21 @@ iframe#tnpc-mobile-preview {
606
  padding: 0;
607
  }
608
 
 
 
 
 
 
 
 
 
 
 
609
  /* Form */
610
- form#tnpc-block-options-form {
611
  background-color: #fff;
612
  padding: 15px;
613
- margin-top: 50px;
614
  }
615
 
616
  #tnpc-block-options-form, #tnpc-block-options-form p {
@@ -650,7 +727,7 @@ form#tnpc-block-options-form {
650
  margin: 0px;
651
  border-collapse: separate!important;
652
  border-spacing: 1px!important;
653
- }
654
 
655
  #tnpc-block-options-form table.form-table table.tnp-button-colors {
656
  border: 0;
@@ -661,34 +738,12 @@ form#tnpc-block-options-form {
661
  padding-top: 0;
662
  }
663
 
664
- /* Save and cancel button container */
665
- #tnpc-block-options-buttons {
666
- padding: 20px;
667
- text-align: right;
668
- background-color: #ecf0f1;
669
- width: 31%;
670
- position: fixed;
671
- height: 70px;
672
- border-bottom: 1px solid #ffffff;
673
- z-index: 9999999;
674
- }
675
 
676
- #tnpc-block-options-save{
677
- }
678
-
679
- #tnpc-block-options-save:hover {
680
- }
681
-
682
- #tnpc-block-options-cancel{
683
- }
684
-
685
- #tnpc-block-options-cancel:hover {
686
- }
687
 
688
 
689
  /* Style the tab */
690
  .tnpc-tabs {
691
- overflow: hidden;
692
  background-color: #fff;
693
  font-family: Montserrat, sans-serif;
694
  }
@@ -741,11 +796,18 @@ form#tnpc-block-options-form {
741
  margin-top: 5px !important;
742
  }
743
 
744
- /* Style Subject Area */
745
- /* No influenza anche il contenuto della mail */
746
- #newsletter-builder-area p {
747
- /*background-color: #ECF0F1;
748
- padding: 15px;*/
 
 
 
 
 
 
 
749
  }
750
 
751
  /* Global Options elements style */
@@ -765,39 +827,92 @@ form#tnpc-block-options-form {
765
  }
766
 
767
  /* Presets */
 
 
 
 
 
768
 
769
- .tnpc-presets-title {
770
- padding: 0px 20px 25px;
771
- font-size: 21px;
772
- margin-bottom: 30px;
773
- color: #484848;
774
- border-bottom: 3px solid white;
775
  }
776
 
 
777
  .tnpc-preset {
778
  float: left;
779
  margin: 15px;
780
  cursor: pointer;
781
  width: 150px;
782
- height: 263px;
783
  background: white;
784
  border-radius: 8px;
785
- box-shadow: 0 0 2px 0px #dee3e4;
786
  position: relative;
 
 
 
 
 
 
 
 
 
787
  }
788
 
789
  .tnpc-preset:hover {
790
  box-shadow: 0 0 8px 8px #dee3e4;
791
  }
792
 
 
 
 
 
 
 
793
  .tnpc-preset-label {
794
  position: absolute;
795
- top: 200px;
796
  left: 50%;
797
- text-align: center;
798
  transform: translate(-50%, -50%);
799
  font-size: 14px;
800
  width: 80%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
801
  }
802
 
803
  .tnpc-inline-editable {
@@ -891,3 +1006,14 @@ form#tnpc-block-options-form {
891
  .tnpc-inline-editable-form-actions span:first-child {
892
  margin-right: 5px;
893
  }
 
 
 
 
 
 
 
 
 
 
 
1
+ #wpbody-content {
2
+ padding-bottom: 15px;
3
+ }
4
+
5
+ .tnp-emails-composer {
6
+ margin: 15px 15px 0 0;
7
+ }
8
+
9
+
10
+ /* Contains the newsletter editing area and the tools */
11
+ #newsletter-builder {
12
+ height: calc(100vh - 120px);
13
+ display: flex;
14
+ flex-flow: row;
15
+ position: relative;
16
+ overflow: hidden;
17
+ box-sizing: border-box;
18
+ max-width: 1280px;
19
+ margin: 0 auto;
20
+ }
21
+
22
+ /* Contains the newsletter editing area */
23
+ #newsletter-builder-area {
24
+ display: flex;
25
+ flex-flow: column;
26
+
27
+ background-color: #fff;
28
+ width: 800px;
29
+ box-sizing: border-box;
30
+ border-radius: 3px;
31
+ overflow: hidden;
32
+ float: left;
33
+
34
+ position: relative;
35
+ }
36
+
37
+ /* Contains the tools */
38
+ #newsletter-builder-sidebar {
39
+ display: flex;
40
+ flex-flow: column;
41
+ width: 450px;
42
+ background-color: #ECF0F1;
43
+ margin-left: 20px;
44
+ overflow-y: scroll;
45
+ /* Needed for block options form */
46
+ position: relative;
47
+ border-radius: 3px;
48
+ }
49
+
50
+ #tnpc-subject-wrap {
51
+ border-bottom: 1px solid #ccc;
52
+ padding-bottom: 20px;
53
+ padding-top: 20px;
54
+ padding-left: 20px
55
+ }
56
+
57
+ #tnpc-subject-wrap th {
58
+ color: #999;
59
+ font-size: 14px;
60
+ font-weight: normal!important;
61
+ text-align: right;
62
+ padding-right: 10px;
63
+ padding-bottom: 10px;
64
+ vertical-align: middle;
65
+ }
66
+
67
+ #tnpc-subject-wrap td {
68
+ color: #000;
69
+ font-size: 14px;
70
+ font-weight: normal!important;
71
+ text-align: left;
72
+ padding-right: 10px;
73
+ padding-bottom: 10px;
74
+ vertical-align: middle;
75
+ }
76
+
77
+ #tnpc-subject {
78
+ }
79
+
80
+ #tnpc-subject input[type=text]{
81
+ width: 550px;
82
+ font-size: 16px;
83
+ margin-right: 15px;
84
+ border: 1px solid #ddd;
85
+ }
86
+
87
+ #tnpc-subject i {
88
+ font-size: 18px;
89
+ }
90
+
91
  .tnp-composer-heading {
92
  background-color: #0073aa;
93
+ border-radius: 3px !important;
94
+ position: fixed;
95
+ bottom: 0;
96
+ right: 0;
97
+ left: 56px;
98
+ z-index: 1000;
99
+ margin: 0 15px 10px 0;
100
  }
101
 
102
  .tnp-composer-heading h2 {
121
  vertical-align: middle;
122
  }
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  #newsletter-builder-sidebar h4 {
125
  /* margin: 5px; */
126
  /* text-align: center; */
193
  /* cursor: pointer;*/
194
  }
195
 
 
 
 
 
 
 
 
 
 
 
 
196
  #newsletter-builder-area-center-frame-content {
197
  /*float: left;*/
198
  /*width: 730px;*/
199
  /*background-color: rgba(153,153,153,1);*/
200
  min-height: 50px;
201
  padding-bottom: 75px;
202
+ /*background-color: #ECF0F1;*/
203
  padding-top: 30px;
204
  /*border: 1px dashed #eee;*/
205
+ overflow-y: scroll;
206
+ /*max-height: 600px;*/
207
  }
208
 
209
  #newsletter-mobile-preview-area {
261
  -moz-transition: all 0.5s;
262
  -o-transition: all 0.5s;
263
  transition: all 0.5s;
264
+ opacity: 0;
265
  text-align: center;
266
  font-size: 18px;
267
  }
268
  .tnpc-row-delete i, .tnpc-row-edit-block i, .tnpc-row-clone i {
269
+ line-height: 30px;
270
  }
271
  .tnpc-row-delete:hover {
272
  background-color: #E74C3C;
300
 
301
  .tnpc-row-edit {
302
  position: relative;
303
+ }
304
  .tnpc-row-edit-hover {
305
  height: 100%;
306
  width: 100%;
410
  .tnpc-edit-box-content-field-input:focus {
411
  -webkit-box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
412
  -moz-box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
413
+ box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
414
  }
415
  .tnpc-edit-box-content-field-textarea {
416
  /*float: left;*/
431
  .tnpc-edit-box-content-field-textarea:focus {
432
  -webkit-box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
433
  -moz-box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
434
+ box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.2);
435
  }
436
  .tnpc-edit-box-content-icons {
437
  /*float: left;*/
660
 
661
  /* Main container */
662
  #tnpc-block-options {
663
+ /*height: 100vh;*/
664
  z-index: 10;
665
+ flex-flow: column;
666
  display: none;
667
  position: absolute;
668
  top: 0px;
673
  padding: 0;
674
  }
675
 
676
+ /* Save and cancel button container */
677
+ #tnpc-block-options-buttons {
678
+ padding: 20px;
679
+ text-align: right;
680
+ background-color: #ecf0f1;
681
+ height: 70px;
682
+ border-bottom: 1px solid #ffffff;
683
+ }
684
+
685
+
686
  /* Form */
687
+ #tnpc-block-options-form {
688
  background-color: #fff;
689
  padding: 15px;
690
+ margin-top: 0;
691
  }
692
 
693
  #tnpc-block-options-form, #tnpc-block-options-form p {
727
  margin: 0px;
728
  border-collapse: separate!important;
729
  border-spacing: 1px!important;
730
+ }
731
 
732
  #tnpc-block-options-form table.form-table table.tnp-button-colors {
733
  border: 0;
738
  padding-top: 0;
739
  }
740
 
 
 
 
 
 
 
 
 
 
 
 
741
 
 
 
 
 
 
 
 
 
 
 
 
742
 
743
 
744
  /* Style the tab */
745
  .tnpc-tabs {
746
+ /*overflow: hidden;*/
747
  background-color: #fff;
748
  font-family: Montserrat, sans-serif;
749
  }
796
  margin-top: 5px !important;
797
  }
798
 
799
+ #newsletter-builder-area ul {
800
+ display: block;
801
+ list-style-type: disc;
802
+ margin-block-start: 1em;
803
+ margin-block-end: 1em;
804
+ margin-inline-start: 0;
805
+ margin-inline-end: 0;
806
+ padding-inline-start: 40px;
807
+ }
808
+
809
+ #newsletter-builder-area ul li {
810
+ margin-bottom: 0;
811
  }
812
 
813
  /* Global Options elements style */
827
  }
828
 
829
  /* Presets */
830
+ .tnpc-preset-container {
831
+ max-width: 720px;
832
+ margin: 0 auto;
833
+ position: relative;
834
+ }
835
 
836
+ .tnpc-preset-legacy-themes {
837
+ position: absolute;
838
+ top: -15px;
839
+ left: 15px;
 
 
840
  }
841
 
842
+
843
  .tnpc-preset {
844
  float: left;
845
  margin: 15px;
846
  cursor: pointer;
847
  width: 150px;
848
+ height: 200px;
849
  background: white;
850
  border-radius: 8px;
851
+ box-shadow: 0 0 2px 0 #dee3e4;
852
  position: relative;
853
+ text-align: center;
854
+ }
855
+
856
+ .tnpc-preset-html {
857
+ background-color: #5397d5;
858
+ }
859
+
860
+ .tnpc-preset-html span {
861
+ color: #fff;
862
  }
863
 
864
  .tnpc-preset:hover {
865
  box-shadow: 0 0 8px 8px #dee3e4;
866
  }
867
 
868
+ .tnpc-preset img {
869
+ width: 50px;
870
+ height: 50px;
871
+ margin-top: 50px;
872
+ }
873
+
874
  .tnpc-preset-label {
875
  position: absolute;
876
+ top: 150px;
877
  left: 50%;
 
878
  transform: translate(-50%, -50%);
879
  font-size: 14px;
880
  width: 80%;
881
+ font-family: soleil, sans-serif;
882
+ color: #2f3241;
883
+ font-weight: 200;
884
+ }
885
+
886
+ .tnpc-delete-preset {
887
+ position: absolute;
888
+ top: 0;
889
+ right: 0;
890
+ display: flex;
891
+ align-items: center;
892
+ justify-content: center;
893
+ width: 20px;
894
+ height: 20px;
895
+ background-color: #8B0000;
896
+ color: #FFF;
897
+ font-weight: bold;
898
+ border-radius: 0 8px 0 8px;
899
+ z-index: 100;
900
+ }
901
+
902
+ .tnpc-edit-preset {
903
+ position: absolute;
904
+ top: 0;
905
+ left: 0;
906
+ display: flex;
907
+ align-items: center;
908
+ justify-content: center;
909
+ width: 20px;
910
+ height: 20px;
911
+ background-color: #3498DB;
912
+ color: #FFF;
913
+ font-weight: bold;
914
+ border-radius: 8px 0 8px 0;
915
+ z-index: 100;
916
  }
917
 
918
  .tnpc-inline-editable {
1006
  .tnpc-inline-editable-form-actions span:first-child {
1007
  margin-right: 5px;
1008
  }
1009
+
1010
+ #update-preset-button {
1011
+ display: none;
1012
+ }
1013
+
1014
+ #newsletter-builder-area-center-frame-content p {
1015
+ font-size: inherit;
1016
+ font-weight: inherit;
1017
+ font-family: inherit;
1018
+ color: inherit;
1019
+ }
emails/tnp-composer/_css/newsletter-builder-v2.min.css ADDED
@@ -0,0 +1 @@
 
1
+ #wpbody-content{padding-bottom:15px}#newsletter-builder{height:calc(100vh - 120px);display:flex;flex-flow:row;position:relative;overflow:hidden;box-sizing:border-box}#newsletter-builder-area{display:flex;flex-flow:column;background-color:#fff;width:800px;box-sizing:border-box;border-radius:10px;overflow:hidden;float:left}#newsletter-builder-sidebar{display:flex;flex-flow:column;width:450px;background-color:#ecf0f1;margin-left:20px;overflow-y:scroll;position:relative}#tnpc-subject-wrap{border-bottom:1px solid #ccc;padding-bottom:20px;padding-top:20px;padding-left:20px}#tnpc-subject-wrap th{color:#999;font-size:14px;font-weight:normal!important;text-align:right;padding-right:10px;padding-bottom:10px;vertical-align:middle}#tnpc-subject-wrap td{color:#000;font-size:14px;font-weight:normal!important;text-align:left;padding-right:10px;padding-bottom:10px;vertical-align:middle}#tnpc-subject input[type=text]{width:550px;font-size:16px;margin-right:15px;border:1px solid #ddd}#tnpc-subject i{font-size:18px}.tnp-composer-heading{background-color:#0073aa;border-radius:0!important;position:fixed;bottom:0;right:0;left:56px;z-index:1000}.tnp-composer-heading h2{display:inline-block;margin-left:30px!important;text-transform:none!important;font-weight:400!important}.tnp-composer-heading a{display:inline-block;margin-left:30px}.tnp-composer-heading form{display:inline-block;margin-left:30px}.tnp-composer-heading img{width:50px;vertical-align:middle}#newsletter-builder-sidebar h4{color:#868686;font-family:Montserrat,sans-serif;font-weight:300;border-bottom:1px solid #fff;padding-bottom:10px}#newsletter-builder-sidebar .newsletter-sidebar-add-buttons img{width:150px;height:auto}.newsletter-sidebar-add-buttons{border-radius:4px;padding:5px;margin:5px}.tnp-body-lite{background-color:#fff!important}.newsletter-sidebar-buttons-content-tab{margin:1px;position:relative;display:inline-block}.newsletter-sidebar-buttons-content-tab:hover{cursor:move}.newsletter-sidebar-buttons-content-tab:hover img{opacity:.8}.newsletter-sidebar-buttons-content-tab:hover .newsletter-sidebar-buttons-content-tab-add{opacity:.5}.newsletter-sidebar-buttons-content-tab-add{height:100%;width:100%;background-color:rgba(70,70,70,1);position:absolute;left:0;top:0;-webkit-transition:all .5s;-moz-transition:all .5s;-o-transition:all .5s;transition:all .5s;z-index:2;opacity:0;text-align:center;line-height:inherit;color:white}.newsletter-sidebar-buttons-content-tab-add:hover{background-color:rgba(0,0,0,1)}#newsletter-builder-area-center-frame-content{min-height:50px;padding-bottom:75px;background-color:#ecf0f1;padding-top:30px;overflow-y:scroll}#newsletter-mobile-preview-area{margin-left:30px;box-sizing:border-box;margin-top:30px;text-align:center;border:1px solid #ddd;border-radius:10px;padding-left:10px;padding-right:10px;padding-top:10px}#newsletter-mobile-preview-area input{width:100px}iframe#tnpc-mobile-preview{height:550px;box-sizing:border-box;width:320px;border-radius:10px;margin-top:20px;margin-left:20px;background-color:#f6f8fd}.tnpc-row{-webkit-transition:box-shadow .5s;-moz-transition:box-shadow .5s;-o-transition:box-shadow .5s;transition:box-shadow .5s;position:relative}.tnpc-row:hover{cursor:move;-webkit-box-shadow:0 0 20px 0 rgba(0,0,0,0.2);-moz-box-shadow:0 0 20px 0 rgba(0,0,0,0.2);box-shadow:0 0 20px 0 rgba(0,0,0,0.2)}.tnpc-row.ui-sortable-helper{max-width:700px!important}.tnpc-row-delete,.tnpc-row-edit-block,.tnpc-row-clone{height:30px;width:30px;top:0;background-color:rgba(255,255,255,0.5);z-index:5;position:absolute;color:rgba(102,102,102,1);-webkit-transition:all .5s;-moz-transition:all .5s;-o-transition:all .5s;transition:all .5s;opacity:0;text-align:center;font-size:18px}.tnpc-row-delete i,.tnpc-row-edit-block i,.tnpc-row-clone i{line-height:30px}.tnpc-row-delete:hover{background-color:#e74c3c;cursor:pointer;color:rgba(255,255,255,1)}.tnpc-row:hover .tnpc-row-delete,.tnpc-row:hover .tnpc-row-edit-block,.tnpc-row:hover .tnpc-row-clone{opacity:1}.tnpc-row-delete{right:0;z-index:5}.tnpc-row-edit-block{right:60px}.tnpc-row-edit-block:hover{background-color:#e0e0e0;cursor:pointer;color:rgba(0,0,0,1)}.tnpc-row-clone{right:30px}.tnpc-row-clone:hover{background-color:#e0e0e0;cursor:pointer;color:rgba(0,0,0,1)}.tnpc-row-edit{position:relative}.tnpc-row-edit-hover{height:100%;width:100%;background-color:rgba(63,141,191,0.8);position:absolute;left:0;top:0;cursor:default;-webkit-transition:all .5s;-moz-transition:all .5s;-o-transition:all .5s;transition:all .5s}.tnpc-row-edit-hover i{position:absolute;height:30px;width:30px;line-height:30px;left:50%;top:50%;text-align:center;margin-top:-15px;margin-left:-15px;color:rgba(255,255,255,1);-webkit-transition:all .5s;-moz-transition:all .5s;-o-transition:all .5s;transition:all .5s;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;font-size:16px}.tnpc-row-edit-hover i:hover{background-color:rgba(0,0,0,0.5);cursor:pointer}.tnpc-drop-here{padding:10px;text-align:center}.tnpc-edit{height:100vh;width:100vw;z-index:10;display:none;position:absolute;top:0;left:0}.tnpc-edit-box-title{width:100%;font-size:29px;color:#666;font-weight:300;margin-bottom:40px}.tnpc-edit-box-content{width:100%;margin-top:10px}.tnpc-edit-box-content-text{width:100%;font-size:15px;color:#666;font-weight:600;margin:15px 0 10px;text-transform:uppercase}.tnpc-edit-box-content-text span{font-size:11px;color:#95a5a6;background-color:#d3eadc;padding:2px 5px;text-transform:none;border-radius:5px}.tnpc-edit-box-content-field{width:100%}.tnpc-edit-box-content-field-input{height:33px;width:380px;border:none!important;outline:0;font-family:inherit;padding-right:10px;font-size:15px;-webkit-transition:all .5s;-moz-transition:all .5s;-o-transition:all .5s;transition:all .5s;color:rgba(102,102,102,1);margin-bottom:10px}.tnpc-edit-box-content-field-input:focus{-webkit-box-shadow:inset 0 0 10px 0 rgba(0,0,0,0.2);-moz-box-shadow:inset 0 0 10px 0 rgba(0,0,0,0.2);box-shadow:inset 0 0 10px 0 rgba(0,0,0,0.2)}.tnpc-edit-box-content-field-textarea{height:180px;width:380px;border:1px solid rgba(204,204,204,1);outline:0;font-family:inherit;font-size:15px;-webkit-transition:all .5s;-moz-transition:all .5s;-o-transition:all .5s;transition:all .5s;color:rgba(102,102,102,1);resize:none;padding:10px}.tnpc-edit-box-content-field-textarea:focus{-webkit-box-shadow:inset 0 0 10px 0 rgba(0,0,0,0.2);-moz-box-shadow:inset 0 0 10px 0 rgba(0,0,0,0.2);box-shadow:inset 0 0 10px 0 rgba(0,0,0,0.2)}.tnpc-edit-box-content-icons{height:388px;width:388px;border:1px solid rgba(204,204,204,1);margin-top:15px;overflow-y:scroll}.tnpc-edit-box-content-icons i{line-height:50px;background-color:rgba(225,225,225,1);height:50px;width:50px;margin-top:10px;margin-left:10px;text-align:center;-webkit-transition:all .5s;-moz-transition:all .5s;-o-transition:all .5s;transition:all .5s;font-size:28px;color:rgba(51,51,51,1)}.tnpc-edit-box-content-icons i:hover{cursor:pointer;background-color:rgba(153,153,153,1);-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;color:rgba(0,0,0,1)}.tnpc-edit-box-buttons{margin-top:10px;text-align:right;margin-right:10px}.tnpc-edit-box-buttons-save{height:35px;text-align:right;line-height:35px;color:#27ae60;font-weight:600;font-size:15px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-transition:background .5s;-moz-transition:background .5s;-o-transition:background .5s;transition:background .5s;cursor:pointer;display:inline-block}.tnpc-edit-box-buttons-save:hover{color:#2ecc71}.tnpc-edit-box-buttons-cancel{height:35px;text-align:right;line-height:35px;color:#666;font-weight:normal;font-size:15px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-transition:background .5s;-moz-transition:background .5s;-o-transition:background .5s;transition:background .5s;cursor:pointer;display:inline-block;margin-right:25px}.tnpc-edit-box-buttons-cancel:hover{color:#e74c3c}.tnpc-edit-box-content-field .iris-square{margin-right:10px}.tnpc-edit-box-content-field .iris-picker .iris-slider{height:100%!important}.tnpc-subject a{font-family:Source Sans Pro;font-weight:700;text-transform:uppercase;text-decoration:none;background-color:#3498db;color:white;padding:2px 10px;border-radius:10px;font-size:13px;letter-spacing:.1em}.tnpc-preview{margin-top:10px}.tnpc-preview .fake-browser-ui iframe{width:700px}.tnpc-preview .fake-mobile-browser-ui iframe{width:320px}.fake-browser-ui{padding:30px 0 0;border-radius:3px;border-bottom:10px solid #ccc;background:#ddd;display:inline-block;position:relative;line-height:0;vertical-align:top;margin-left:20px}.fake-mobile-browser-ui{padding:30px 10px 37px;border-radius:10px;border-bottom:10px solid #ccc;background:#ddd;display:inline-block;position:relative;line-height:0;margin-left:30px}.fake-browser-ui .frame{display:block;height:25px;position:absolute;top:12px;left:8px}.fake-mobile-browser-ui .frame{display:block;height:25px;margin-top:10px}.fake-browser-ui span{height:12px;width:12px;border-radius:8px;background-color:#eee;border:1px solid #dadada;float:left;margin:0 0 0 4px}.fake-mobile-browser-ui span{height:50px;width:50px;border-radius:60px;background-color:#eee;border:2px solid #ccc;display:block;margin:auto}.fake-browser-ui .bt-1{background-color:#ed594a}.fake-browser-ui .bt-2{background-color:#fdd800}.fake-browser-ui .bt-3{background-color:#5ac05a}#tnpc-html-editor{height:600px;border-top:20px solid #323232;border-radius:8px}.tnp-select2-option img{height:15px;margin-right:5px;vertical-align:middle;background-color:rgba(234,234,234,0.25);padding:10px;border-radius:5px}#tnpc-block-options{z-index:10;flex-flow:column;display:none;position:absolute;top:0;left:0;bottom:0;right:0;background-color:#ecf0f1;padding:0}#tnpc-block-options-buttons{padding:20px;text-align:right;background-color:#ecf0f1;height:70px;border-bottom:1px solid #fff}#tnpc-block-options-form{background-color:#fff;padding:15px;margin-top:0;overflow-y:scroll}#tnpc-block-options-form,#tnpc-block-options-form p{color:#444;background-color:#ecf0f1!important}#tnpc-block-options-form h3{color:#000}#tnpc-block-options-form table.form-table th{width:100%;vertical-align:top;float:left;font-weight:normal;text-transform:uppercase;font-size:13px;padding-top:10px;padding-bottom:5px;padding-left:0;padding-right:0}#tnpc-block-options-form table.form-table td{float:left;padding:0;margin:0;border:0;width:100%}#tnpc-block-options-form table.form-table{margin:0;border-collapse:separate!important;border-spacing:1px!important}#tnpc-block-options-form table.form-table table.tnp-button-colors{border:0;border-collapse:collapse}#tnpc-block-options-form table.form-table table.tnp-button-colors td{border:0;padding-top:0}.tnpc-tabs{background-color:#fff;font-family:Montserrat,sans-serif}.tnpc-tabs button{background-color:inherit;float:left;border:0;outline:0;cursor:pointer;padding:14px 16px;transition:.3s;color:#6a8ba0}.tnpc-tabs button:hover{background-color:#ddd}.tnpc-tabs button.active{background-color:#ecf0f1;color:#3498db}.tabcontent{display:none;padding:6px 12px;border-top:0}.tnpc-controls{text-align:right}.tnpc-logo{float:left}.tnpc-logo p{font-family:Montserrat,Sans-serif;color:#fff!important;font-size:16px;margin-left:20px!important;margin-top:5px!important}#tnpc-general-options select{box-shadow:none;border-radius:0;border:0;margin-right:5px}.tnpc-block-options-warning{background-color:#def9e9;padding:10px 15px}.tnpc-presets-title{padding:0 20px 25px;font-size:21px;margin-bottom:30px;color:#484848;border-bottom:3px solid white}.tnpc-preset{float:left;margin:15px;cursor:pointer;width:150px;height:263px;background:white;border-radius:8px;box-shadow:0 0 2px 0 #dee3e4;position:relative}.tnpc-preset:hover{box-shadow:0 0 8px 8px #dee3e4}.tnpc-preset-label{position:absolute;top:200px;left:50%;text-align:center;transform:translate(-50%,-50%);font-size:14px;width:80%}.tnpc-inline-editable{cursor:text}.tnpc-inline-editable{cursor:text;position:relative}.tnpc-inline-editable:hover{color:#EEE!important}.tnpc-inline-editable:hover:after{content:'';cursor:pointer;position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.2);opacity:1;border-radius:2px}.tnpc-inline-editable:hover:before{content:'\f464';font-family:dashicons;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;width:32px;height:32px;font-size:32px;line-height:32px;color:#333}.tnpc-inline-editable-form{position:relative;margin-top:25px}.tnpc-inline-editable-form textarea,.tnpc-inline-editable-form input{width:95%;margin-left:20px}.two-columns .tnpc-inline-editable-form-actions{right:0}.tnpc-inline-editable-form input{padding:5px;font-size:25px;font-family:Helvetica,Arial,sans-serif;font-weight:normal;color:#333;line-height:normal}.tnpc-inline-editable-form-actions{position:absolute;top:-25px;right:5px;display:flex;align-items:center;flex-wrap:wrap}.tnpc-inline-editable-form-actions button{background:0;padding:0;border:0}.tnpc-inline-editable-form-actions span{display:block;font-size:25px;color:#333;cursor:pointer}.tnpc-inline-editable-form-actions span:first-child{margin-right:5px}
emails/tnp-composer/_css/tnp-modal.css ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .tnp-modal {
2
+ display: none; /* Hidden by default */
3
+ position: fixed; /* Stay in place */
4
+ z-index: 100000; /* Sit on top */
5
+ left: 0;
6
+ top: 0;
7
+ width: 100%; /* Full width */
8
+ height: 100%; /* Full height */
9
+ overflow: auto; /* Enable scroll if needed */
10
+ }
11
+
12
+ .tnp-modal.open {
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ background-color: rgba(0, 0, 0, 0);
17
+ animation: modal-in .4s ease-out forwards;
18
+ }
19
+
20
+ @keyframes modal-in {
21
+ 100% {
22
+ background-color: rgba(0, 0, 0, 0.3);
23
+ }
24
+ }
25
+
26
+ .tnp-modal.on-close {
27
+ background-color: rgba(0, 0, 0, 0);
28
+ transition: background-color .4s ease-out;
29
+ }
30
+
31
+ .tnp-modal-container {
32
+ position: relative;
33
+
34
+ padding: 50px;
35
+ border-radius: 3px;
36
+ background-color: white;
37
+ width: 400px;
38
+ min-height: 100px;
39
+ max-height: 400px;
40
+ overflow-y: auto;
41
+ animation: modal-fadein .4s ease-out forwards;
42
+ }
43
+
44
+ .tnp-modal-container.on-close {
45
+ animation: modal-fadeout .4s ease-in forwards;
46
+ }
47
+
48
+ @keyframes modal-fadein {
49
+ 0% {
50
+ opacity: 0;
51
+ transform: translateY(-100%);
52
+ }
53
+
54
+ 100% {
55
+ opacity: 1;
56
+ transform: translateY(0);
57
+ }
58
+ }
59
+
60
+ @keyframes modal-fadeout {
61
+ 0% {
62
+ opacity: 1;
63
+ transform: translateY(0);
64
+ }
65
+
66
+ 20% {
67
+ transform: translateY(50px);
68
+ }
69
+
70
+ 100% {
71
+ opacity: 0;
72
+ transform: translateY(-100%);
73
+ }
74
+ }
75
+
76
+ .tnp-modal-close {
77
+ position: absolute;
78
+ cursor: pointer;
79
+ right: 0;
80
+ top: 0;
81
+ font-weight: bold;
82
+ padding: 10px;
83
+ font-size: 40px;
84
+ }
85
+
86
+ .tnp-modal-confirm {
87
+ margin: 10px 0 0 0;
88
+ }
89
+
90
+ .tnp-modal-confirm button {
91
+ float: right;
92
+ }
93
+
94
+ .tnp-modal .button-danger {
95
+ background-color: darkred;
96
+ color: #ffffff;
97
+ text-shadow: none;
98
+ width: auto;
99
+ }
100
+
101
+ .tnp-modal .button-danger:hover {
102
+ background-color: darkred;
103
+ }
emails/tnp-composer/_css/tnp-toast.css ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .tnp-toast-main-wrapper {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ box-sizing: border-box;
6
+ height: 100%;
7
+ width: 100%;
8
+ z-index: 9991;
9
+ pointer-events: none;
10
+
11
+ display: flex;
12
+ flex-direction: column;
13
+
14
+ }
15
+
16
+ .tnp-toast-main-wrapper .notification {
17
+ display: block;
18
+ overflow: hidden;
19
+ pointer-events: auto;
20
+ box-shadow: 0 3px 7px 0 rgba(0, 0, 0, .25);
21
+ position: relative;
22
+ padding: 15px;
23
+ padding-left: 20px;
24
+ border-radius: 2px;
25
+ max-width: 300px;
26
+ transform: translateY(25%);
27
+ box-sizing: border-box;
28
+ flex-shrink: 0;
29
+ font-weight: bold;
30
+ animation: .4s ease-in forwards;
31
+ background-color: #FFF;
32
+ }
33
+
34
+ .tnp-toast-main-wrapper .notification:after {
35
+ content: ' ';
36
+ position: absolute;
37
+ left: 0;
38
+ top: 0;
39
+ width: 5px;
40
+ height: 100%;
41
+ }
42
+
43
+ .tnp-toast-main-wrapper .notification.push-up {
44
+ animation-name: notification-fadeinup;
45
+ }
46
+
47
+ .tnp-toast-main-wrapper .notification.push-down {
48
+ animation-name: notification-fadeindown;
49
+ }
50
+
51
+ .tnp-toast-main-wrapper .notification.pop-down {
52
+ transform: translateY(0);
53
+ animation: notification-fadeoutdown .4s forwards;
54
+ animation-delay: .25s;
55
+ }
56
+
57
+ .tnp-toast-main-wrapper .notification.pop-up {
58
+ transform: translateY(0);
59
+ animation: notification-fadeoutup .4s forwards;
60
+ animation-delay: .25s;
61
+ }
62
+
63
+ .tnp-toast-main-wrapper .notification.top-to-bottom {
64
+ margin-bottom: 20px;
65
+ }
66
+
67
+ .tnp-toast-main-wrapper .notification.bottom-to-top {
68
+ margin-top: 20px;
69
+ }
70
+
71
+ .tnp-toast-main-wrapper .notification.notification-success:after {
72
+ background-color: #46b450;
73
+ }
74
+
75
+ .tnp-toast-main-wrapper .notification.notification-error:after {
76
+ background-color: #dd0000;
77
+ }
78
+
79
+ .tnp-toast-main-wrapper .notification.notification-info:after {
80
+ background-color: #0073aa;
81
+ }
82
+
83
+ .tnp-toast-main-wrapper .notification.notification-warning:after {
84
+ background-color: #ffb900;
85
+ }
86
+
87
+ @keyframes notification-fadeinup {
88
+ 0% {
89
+ opacity: 0;
90
+ transform: translateY(25%);
91
+ }
92
+
93
+ 100% {
94
+ opacity: 1;
95
+ transform: translateY(0);
96
+ }
97
+ }
98
+
99
+ @keyframes notification-fadeoutdown {
100
+ 100% {
101
+ opacity: 1;
102
+ transform: translateY(0);
103
+ }
104
+ 100% {
105
+ opacity: 0;
106
+ transform: translateY(25%);
107
+ }
108
+ }
109
+
110
+ @keyframes notification-fadeindown {
111
+ 0% {
112
+ opacity: 0;
113
+ transform: translateY(-25%);
114
+ }
115
+
116
+ 100% {
117
+ opacity: 1;
118
+ transform: translateY(0);
119
+ }
120
+ }
121
+
122
+ @keyframes notification-fadeoutup {
123
+ 100% {
124
+ opacity: 1;
125
+ transform: translateY(0);
126
+ }
127
+ 100% {
128
+ opacity: 0;
129
+ transform: translateY(-25%);
130
+ }
131
+ }
emails/tnp-composer/_scripts/modal.js ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const TNPModal = function (options) {
2
+ 'use strict'
3
+
4
+ const _options = {
5
+ title: '',
6
+ content: '',
7
+ contentSelector: '',
8
+ showClose: true,
9
+ onClose: null,
10
+ closeWhenClickOutside: true,
11
+ confirmText: 'CONFIRM',
12
+ confirmClassName: 'button',
13
+ showConfirm: false,
14
+ onConfirm: null,
15
+ clickConfirmOnPressEnter: false,
16
+ style: null,
17
+ ...options
18
+ };
19
+
20
+ let _modalElement = null;
21
+ let _modalContainer = null;
22
+ let _closeElement = null;
23
+ let _contentElement = null;
24
+ let _isClosing = false;
25
+
26
+ const open = () => {
27
+ if (_modalElement === null) {
28
+ //render element
29
+ _render();
30
+ }
31
+ return _contentElement;
32
+ }
33
+
34
+ const close = () => {
35
+
36
+ if (!_isClosing) {
37
+ _modalElement.addEventListener('animationend', function () {
38
+ document.body.removeChild(_modalElement);
39
+ destroyDOMElements();
40
+ _isClosing = false;
41
+ });
42
+
43
+ _modalContainer.className = _modalContainer.className + ' on-close';
44
+ _modalElement.className = _modalElement.className + ' on-close';
45
+
46
+ if (_options.onClose) {
47
+ _options.onClose();
48
+ }
49
+ _isClosing = true;
50
+ }
51
+
52
+ }
53
+
54
+ const destroyDOMElements = () => {
55
+ if (_contentElement) {
56
+ _contentElement.style.display = 'none';
57
+ document.body.appendChild(_contentElement);
58
+ }
59
+ _modalElement = null;
60
+ _modalContainer = null;
61
+ _closeElement = null;
62
+ _contentElement = null;
63
+ }
64
+
65
+ const onConfirm = () => {
66
+
67
+ if (_options.onConfirm) {
68
+ _options.onConfirm();
69
+ }
70
+
71
+ close();
72
+ }
73
+
74
+ const _addTitle = (title) => {
75
+ const titleElement = document.createElement('h2');
76
+ titleElement.className = 'tnp-modal-title';
77
+ titleElement.innerText = title;
78
+
79
+ _modalContainer.appendChild(titleElement);
80
+ }
81
+
82
+ const _addCloseButton = () => {
83
+ const closeEl = document.createElement('div');
84
+ closeEl.className = 'tnp-modal-close';
85
+ closeEl.innerText = '×';
86
+
87
+ _modalContainer.appendChild(closeEl);
88
+
89
+ closeEl.addEventListener('click', function (e) {
90
+ e.stopPropagation();
91
+ close();
92
+ });
93
+ }
94
+
95
+ const _render = () => {
96
+
97
+ _modalContainer = document.createElement('div');
98
+ _modalContainer.className = 'tnp-modal-container';
99
+
100
+ if (_options.title && _options.title.length > 0) {
101
+
102
+ _addTitle(_options.title);
103
+
104
+ }
105
+
106
+ if (_options.content && _options.content.length > 0) {
107
+
108
+ _contentElement = document.createElement('div');
109
+ _contentElement.className = 'tnp-modal-content';
110
+ _contentElement.innerHTML = _options.content;
111
+ _modalContainer.appendChild(_contentElement);
112
+
113
+ } else if (_options.contentSelector && _options.contentSelector.length > 0) {
114
+
115
+ _contentElement = document.querySelector(_options.contentSelector);
116
+ _contentElement.style.display = _contentElement.style.display === 'none' ? 'block' : _contentElement.style.display;
117
+ _modalContainer.appendChild(_contentElement);
118
+
119
+ } else {
120
+
121
+ _contentElement = document.createElement('div');
122
+ _contentElement.className = 'tnp-modal-content';
123
+ _modalContainer.appendChild(_contentElement);
124
+
125
+ }
126
+
127
+ if (_options.showClose) {
128
+ _addCloseButton();
129
+ }
130
+
131
+ if (_options.showConfirm) {
132
+
133
+ const confirmContainerEl = document.createElement('div');
134
+ confirmContainerEl.className = 'tnp-modal-confirm';
135
+
136
+ const confirmEl = document.createElement('button');
137
+ confirmEl.className = _options.confirmClassName || 'button-secondary';
138
+ confirmEl.innerText = _options.confirmText || 'CONFIRM';
139
+
140
+ confirmEl.addEventListener('click', onConfirm);
141
+
142
+ if (_options.clickConfirmOnPressEnter) {
143
+ document.addEventListener('keyup', function (event) {
144
+ if (event.key === 'Enter') {
145
+ event.preventDefault();
146
+ confirmEl.click();
147
+ }
148
+ })
149
+ }
150
+
151
+ confirmContainerEl.appendChild(confirmEl);
152
+ _modalContainer.appendChild(confirmContainerEl);
153
+
154
+ }
155
+
156
+ if (_options.style) {
157
+ for (const _styleProperty in _options.style) {
158
+ if (_modalContainer.style && typeof (_modalContainer.style[_styleProperty]) !== "undefined") {
159
+ _modalContainer.style[_styleProperty] = _options.style[_styleProperty];
160
+ }
161
+ }
162
+ }
163
+
164
+ if (_options.backgroundColor) {
165
+ _modalContainer.style.backgroundColor = _options.backgroundColor;
166
+ }
167
+
168
+ if (_options.height) {
169
+ _modalContainer.style.height = _options.backgroundColor;
170
+ }
171
+
172
+
173
+ _modalElement = document.createElement('div');
174
+ _modalElement.className = 'tnp-modal open';
175
+
176
+ if (_options.closeWhenClickOutside) {
177
+ //Close modal if clicked outside modal
178
+ _modalElement.addEventListener('click', function (event) {
179
+ if (!event.target.closest('.' + _modalContainer.className)) {
180
+ close();
181
+ }
182
+ });
183
+ }
184
+
185
+ _modalElement.appendChild(_modalContainer);
186
+ document.body.appendChild(_modalElement);
187
+
188
+ }
189
+
190
+ if (_options.triggerSelector && _options.triggerSelector.length > 0) {
191
+ const _triggerElement = document.querySelector(_options.triggerSelector);
192
+ _triggerElement.addEventListener('click', open);
193
+ }
194
+
195
+ return {
196
+ open,
197
+ close
198
+ }
199
+
200
+ };
201
+
202
+ window.TNPModal = TNPModal;
emails/tnp-composer/_scripts/newsletter-builder-v2.js CHANGED
@@ -7,8 +7,7 @@ jQuery.fn.add_delete = function () {
7
  // delete row
8
  jQuery.fn.perform_delete = function () {
9
  this.click(function () {
10
- // hide block edit form
11
- jQuery("#tnpc-block-options").hide();
12
  // remove block
13
  jQuery(this).parent().remove();
14
  tnpc_mobile_preview();
@@ -21,15 +20,7 @@ jQuery.fn.add_block_edit = function () {
21
  this.find('.tnpc-row-edit-block').perform_block_edit();
22
  }
23
 
24
- // add clone button
25
- jQuery.fn.add_block_clone = function () {
26
- this.append('<div class="tnpc-row-clone" title="Clone"><img src="' + TNP_PLUGIN_URL + '/emails/tnp-composer/_assets/copy.png" width="32"></div>');
27
- this.find('.tnpc-row-clone').perform_clone();
28
- }
29
-
30
- let start_options = null;
31
- let container = null;
32
-
33
  jQuery.fn.perform_block_edit = function () {
34
 
35
  jQuery(".tnpc-row-edit-block").click(function (e) {
@@ -42,30 +33,35 @@ jQuery.fn.perform_block_edit = function () {
42
 
43
  target = jQuery(this).parent().find('.edit-block');
44
 
45
- jQuery("#tnpc-edit-block .bgcolor").val(target.css("background-color"));
46
- jQuery("#tnpc-edit-block .font").val(target.css("font-family"));
47
-
48
  // The row container which is a global variable and used later after the options save
49
  container = jQuery(this).closest("table");
50
 
51
  if (container.hasClass('tnpc-row-block')) {
52
 
53
- jQuery("#tnpc-block-options").fadeIn(500);
 
54
  var options = container.find(".tnpc-block-content").attr("data-json");
 
55
  // Compatibility
56
  if (!options) {
57
  options = target.attr("data-options");
58
  }
59
 
60
- jQuery("#tnpc-block-options-form").load(ajaxurl, {
61
  action: "tnpc_options",
62
  id: container.data("id"),
63
  context_type: tnp_context_type,
64
  options: options
65
- }, function () {
 
 
 
 
 
66
  console.log('Block form options loaded');
67
- start_options = jQuery("#tnpc-block-options-form").serialize();
68
- //tnp_controls_init();
 
69
  });
70
 
71
  } else {
@@ -76,6 +72,13 @@ jQuery.fn.perform_block_edit = function () {
76
 
77
  };
78
 
 
 
 
 
 
 
 
79
  jQuery.fn.perform_clone = function () {
80
 
81
  jQuery(".tnpc-row-clone").click(function (e) {
@@ -87,7 +90,7 @@ jQuery.fn.perform_clone = function () {
87
  e.preventDefault();
88
 
89
  // hide block edit form
90
- jQuery("#tnpc-block-options").hide();
91
 
92
  // find the row
93
  let row = jQuery(this).closest('.tnpc-row');
@@ -109,12 +112,11 @@ jQuery.fn.perform_clone = function () {
109
  });
110
  };
111
 
 
 
112
 
113
  jQuery(function () {
114
 
115
- // collapse wp menu
116
- jQuery('body').addClass('folded');
117
-
118
  // open blocks tab
119
  document.getElementById("defaultOpen").click();
120
 
@@ -139,20 +141,44 @@ jQuery(function () {
139
  // ======================== //
140
  _setBuilderAreaBackgroundColor(document.getElementById('options-options_composer_background').value);
141
 
142
- jQuery('#options-options_composer_background').on('change', function (e) {
143
- _setBuilderAreaBackgroundColor(e.target.value);
144
- });
145
-
146
  function _setBuilderAreaBackgroundColor(color) {
147
  jQuery('#newsletter-builder-area-center-frame-content').css('background-color', color);
148
  }
 
 
 
149
  // ======================== //
150
  // == BACKGROUND COLOR == //
151
  // ======================== //
152
 
153
  });
154
 
155
- function start_composer() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
  //Drag & Drop
158
  jQuery("#newsletter-builder-area-center-frame-content").sortable({
@@ -170,15 +196,18 @@ function start_composer() {
170
  loading_row = jQuery('<div style="text-align: center; padding: 20px; background-color: #d4d5d6; color: #52BE7F;"><i class="fa fa-cog fa-2x fa-spin" /></div>');
171
  ui.item.before(loading_row);
172
  ui.item.remove();
173
- var data = {
174
- 'action': 'tnpc_render',
175
- 'b': ui.item.data("id"),
176
- 'full': 1,
177
- '_wpnonce': tnp_nonce
178
- };
 
 
 
179
  jQuery.post(ajaxurl, data, function (response) {
180
 
181
- new_row = jQuery(response);
182
  // ui.item.before(new_row);
183
  // ui.item.remove();
184
  loading_row.before(new_row);
@@ -224,11 +253,25 @@ function start_composer() {
224
  }
225
  });
226
 
 
 
 
 
 
 
 
 
 
 
227
  // Closes the block options layer (without saving)
228
  jQuery("#tnpc-block-options-cancel").click(function () {
229
- jQuery(this).parent().parent().fadeOut(500);
 
 
 
 
230
  jQuery.post(ajaxurl, start_options, function (response) {
231
- target.html(response);
232
  jQuery("#tnpc-block-options-form").html("");
233
  });
234
  });
@@ -236,6 +279,9 @@ function start_composer() {
236
  // Fires the save event for block options
237
  jQuery("#tnpc-block-options-save").click(function (e) {
238
  e.preventDefault();
 
 
 
239
  // fix for Codemirror
240
  if (typeof templateEditor !== 'undefined') {
241
  templateEditor.save();
@@ -244,40 +290,66 @@ function start_composer() {
244
  if (window.tinymce)
245
  window.tinymce.triggerSave();
246
 
247
- jQuery("#tnpc-block-options").fadeOut(500);
 
 
248
 
249
- var data = jQuery("#tnpc-block-options-form").serialize();
250
 
251
  jQuery.post(ajaxurl, data, function (response) {
252
- target.html(response);
253
  tnpc_mobile_preview();
254
- //target.attr("data-options", options);
255
- //target.find(".tnpc-row-edit").hover_edit();
256
  jQuery("#tnpc-block-options-form").html("");
257
  });
258
  });
259
 
260
  // live preview from block options *** EXPERIMENTAL ***
261
  jQuery('#tnpc-block-options-form').change(function (event) {
262
- var data = jQuery("#tnpc-block-options-form").serialize();
 
 
 
 
 
 
263
  jQuery.post(ajaxurl, data, function (response) {
264
- target.html(response);
265
  if (event.target.dataset.afterRendering === 'reload') {
266
- container.find(".tnpc-row-edit-block").click();
267
  }
268
  }).fail(function () {
269
  alert("Block rendering failed");
270
  });
271
 
272
-
273
  });
274
 
275
- jQuery(".tnpc-row").add_delete();
276
- jQuery(".tnpc-row").add_block_edit();
277
- jQuery(".tnpc-row").add_block_clone();
278
 
 
279
 
280
- tnpc_mobile_preview();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
  }
283
 
@@ -299,15 +371,7 @@ function tnpc_mobile_preview() {
299
 
300
  function tnpc_save(form) {
301
 
302
- jQuery("#newsletter-preloaded-export").html(jQuery("#newsletter-builder-area-center-frame-content").html());
303
-
304
- jQuery("#newsletter-preloaded-export .tnpc-row-delete").remove();
305
- jQuery("#newsletter-preloaded-export .tnpc-row-edit-block").remove();
306
- jQuery("#newsletter-preloaded-export .tnpc-row-clone").remove();
307
- jQuery("#newsletter-preloaded-export .tnpc-row").removeClass("ui-draggable");
308
- jQuery('#newsletter-preloaded-export #sortable-helper').remove();
309
-
310
- form.elements["options[message]"].value = jQuery("#newsletter-preloaded-export").html();
311
  if (document.getElementById("options-title")) {
312
  form.elements["options[subject]"].value = jQuery('#options-title').val();
313
  } else {
@@ -318,14 +382,33 @@ function tnpc_save(form) {
318
  //Copy "Global styles" form inputs into main form
319
  tnpc_copy_form(global_form, form);
320
 
321
- jQuery("#newsletter-preloaded-export").html(' ');
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  }
323
 
324
  function tnpc_copy_form(source, dest) {
325
  for (var i = 0; i < source.elements.length; i++) {
326
- var clonedEl = source.elements[i].cloneNode();
327
- clonedEl.style.display = 'none';
328
- dest.appendChild(clonedEl);
 
 
 
 
 
 
329
  }
330
  }
331
 
@@ -358,195 +441,408 @@ function openTab(evt, tabName) {
358
  evt.currentTarget.className += " active";
359
  }
360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
 
362
  function tnpc_show_presets() {
363
 
364
- jQuery('.tnpc-controls input').attr('disabled', true);
365
- jQuery('#newsletter-builder-area-center-frame-content').load(ajaxurl, {
 
 
 
366
  action: "tnpc_presets",
367
  });
368
 
369
  }
370
 
371
- function tnpc_load_preset(id) {
 
 
372
 
373
  jQuery('#newsletter-builder-area-center-frame-content').load(ajaxurl, {
374
  action: "tnpc_presets",
375
  id: id
376
  }, function () {
377
  start_composer();
378
- jQuery('.tnpc-controls input').attr('disabled', false);
 
 
 
 
 
 
 
 
379
  });
380
 
381
  }
382
 
383
- function tnpc_scratch() {
384
 
385
- jQuery('#newsletter-builder-area-center-frame-content').html(" ");
386
- start_composer();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
 
388
  }
389
 
390
- function tnpc_reload_options(e) {
391
- e.preventDefault();
392
- let options = jQuery("#tnpc-block-options-form").serializeArray();
393
- for (let i = 0; i < options.length; i++) {
394
- if (options[i].name === 'action') {
395
- options[i].value = 'tnpc_options';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  }
397
  }
398
 
399
- jQuery("#tnpc-block-options-form").load(ajaxurl, options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  }
401
 
 
 
 
 
402
  jQuery(document).ready(function () {
 
403
 
404
  var TNPInlineEditor = (function () {
405
 
406
- var className = 'tnpc-inline-editable';
407
- var newInputName = 'new_name';
408
- var activeInlineElements = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
 
410
- function init() {
411
- // find all inline editable elements
412
- jQuery('#newsletter-builder-area-center-frame-content').on('click', '.' + className, function (e) {
 
 
413
  removeAllActiveElements();
 
 
414
 
415
- var originalEl = jQuery(this).hide();
416
- var newEl = jQuery(getEditableComponent(this.innerText.trim(), this.dataset.id, this.dataset.type)).insertAfter(this);
417
 
418
- activeInlineElements.push({'originalEl': originalEl, 'newEl': newEl});
 
 
419
 
420
- //Add submit event listener for newly created block
421
- jQuery('.tnpc-inline-editable-form-' + this.dataset.type + this.dataset.id).on('submit', function (e) {
422
- submit(e, newEl, jQuery(originalEl));
423
- });
424
 
425
- //Add close event listener for newly created block
426
- jQuery('.tnpc-inline-editable-form-actions .tnpc-dismiss-' + this.dataset.type + this.dataset.id).on('click', function (e) {
427
- removeAllActiveElements();
428
- });
429
 
430
- });
431
 
432
- // Close all created elements if clicked outside
433
- jQuery('#newsletter-builder-area-center-frame-content').on('click', function (e) {
434
- if (activeInlineElements.length > 0
435
- && !jQuery(e.target).hasClass(className)
436
- && jQuery(e.target).closest('.tnpc-inline-editable-container').length === 0) {
437
- removeAllActiveElements();
438
- }
439
- });
440
 
 
 
 
 
 
 
 
 
 
441
  }
442
 
443
- function removeAllActiveElements() {
444
- activeInlineElements.forEach(function (obj) {
445
- obj.originalEl.show();
 
 
 
 
 
 
 
 
 
 
 
 
 
446
 
447
- obj.newEl.off();
448
- obj.newEl.remove();
449
- });
450
 
451
- activeInlineElements = []
452
- }
 
453
 
454
- function getEditableComponent(value, id, type) {
455
 
456
- var element = '';
 
457
 
458
- switch (type) {
459
- case 'text': {
460
- element = "<textarea name='" + newInputName + "' class='" + className + "-textarea' rows='5'>" + value + "</textarea>";
461
- break;
462
- }
463
- case 'title': {
464
- element = "<textarea name='" + newInputName + "' class='" + className + "-textarea' rows='2'>" + value + "</textarea>";
465
- break;
466
- }
467
- }
468
 
469
- var component = "<td>";
470
- component += "<form class='tnpc-inline-editable-form tnpc-inline-editable-form-" + type + id + "'>";
471
- component += "<input type='hidden' name='id' value='" + id + "'>";
472
- component += "<input type='hidden' name='type' value='" + type + "'>";
473
- component += "<input type='hidden' name='old_value' value='" + value + "'>";
474
- component += "<div class='tnpc-inline-editable-container'>";
475
- component += element;
476
- component += "<div class='tnpc-inline-editable-form-actions'>";
477
- component += "<button type='submit'><span class='dashicons dashicons-yes-alt' title='save'></span></button>";
478
- component += "<span class='dashicons dashicons-dismiss tnpc-dismiss-" + type + id + "' title='close'></span>";
479
- component += "</div>";
480
- component += "</div>";
481
- component += "</form>";
482
- component += "</td>";
483
- return component;
484
- }
485
 
486
- function submit(e, elementToDeleteAfterSubmit, elementToShow) {
487
- e.preventDefault();
 
488
 
489
- var id = elementToDeleteAfterSubmit.find('form input[name=id]').val();
490
- var type = elementToDeleteAfterSubmit.find('form input[name=type]').val();
491
- var newValue = elementToDeleteAfterSubmit.find('form [name="' + newInputName + '"]').val();
 
 
 
 
 
 
 
 
 
 
 
 
492
 
493
- ajax_render_block(elementToShow, type, id, newValue);
494
 
495
- elementToDeleteAfterSubmit.remove();
496
- elementToShow.show();
497
 
498
- }
 
499
 
500
- function ajax_render_block(inlineElement, type, postId, newContent) {
501
-
502
- var target = inlineElement.closest('.edit-block');
503
- var container = target.closest('table');
504
- var blockContent = target.children('.tnpc-block-content');
505
-
506
- if (container.hasClass('tnpc-row-block')) {
507
- var data = {
508
- 'action': 'tnpc_render',
509
- 'b': container.data('id'),
510
- 'full': 1,
511
- '_wpnonce': tnp_nonce,
512
- 'options': {
513
- 'inline_edits': [{
514
- 'type': type,
515
- 'post_id': postId,
516
- 'content': newContent
517
- }]
518
- },
519
- 'encoded_options': blockContent.data('json')
520
- };
521
-
522
- jQuery.post(ajaxurl, data, function (response) {
523
- new_row = jQuery(response);
524
-
525
- target.before(new_row);
526
- target.remove();
527
-
528
- new_row.add_delete();
529
- new_row.add_block_edit();
530
- new_row.add_block_clone();
531
-
532
- if (new_row.hasClass('tnpc-row-block')) {
533
- new_row.find(".tnpc-row-edit-block").click();
534
- }
535
- tnpc_mobile_preview();
536
-
537
- }).fail(function () {
538
- alert("Block rendering failed.");
539
- });
540
 
541
- }
 
 
 
 
 
 
 
 
 
542
 
543
  }
544
 
545
- return {init: init};
546
  }
547
 
548
- )();
 
549
 
550
  TNPInlineEditor.init();
551
 
552
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  // delete row
8
  jQuery.fn.perform_delete = function () {
9
  this.click(function () {
10
+ tnpc_hide_block_options();
 
11
  // remove block
12
  jQuery(this).parent().remove();
13
  tnpc_mobile_preview();
20
  this.find('.tnpc-row-edit-block').perform_block_edit();
21
  }
22
 
23
+ // edit block
 
 
 
 
 
 
 
 
24
  jQuery.fn.perform_block_edit = function () {
25
 
26
  jQuery(".tnpc-row-edit-block").click(function (e) {
33
 
34
  target = jQuery(this).parent().find('.edit-block');
35
 
 
 
 
36
  // The row container which is a global variable and used later after the options save
37
  container = jQuery(this).closest("table");
38
 
39
  if (container.hasClass('tnpc-row-block')) {
40
 
41
+ tnpc_show_block_options();
42
+
43
  var options = container.find(".tnpc-block-content").attr("data-json");
44
+
45
  // Compatibility
46
  if (!options) {
47
  options = target.attr("data-options");
48
  }
49
 
50
+ var data = {
51
  action: "tnpc_options",
52
  id: container.data("id"),
53
  context_type: tnp_context_type,
54
  options: options
55
+ };
56
+
57
+ tnpc_add_global_options(data);
58
+
59
+ builderAreaHelper.lock();
60
+ jQuery("#tnpc-block-options-form").load(ajaxurl, data , function () {
61
  console.log('Block form options loaded');
62
+ start_options = jQuery("#tnpc-block-options-form").serializeArray();
63
+ tnpc_add_global_options(start_options);
64
+ builderAreaHelper.unlock();
65
  });
66
 
67
  } else {
72
 
73
  };
74
 
75
+ // add clone button
76
+ jQuery.fn.add_block_clone = function () {
77
+ this.append('<div class="tnpc-row-clone" title="Clone"><img src="' + TNP_PLUGIN_URL + '/emails/tnp-composer/_assets/copy.png" width="32"></div>');
78
+ this.find('.tnpc-row-clone').perform_clone();
79
+ }
80
+
81
+ // clone block
82
  jQuery.fn.perform_clone = function () {
83
 
84
  jQuery(".tnpc-row-clone").click(function (e) {
90
  e.preventDefault();
91
 
92
  // hide block edit form
93
+ tnpc_hide_block_options();
94
 
95
  // find the row
96
  let row = jQuery(this).closest('.tnpc-row');
112
  });
113
  };
114
 
115
+ let start_options = null;
116
+ let container = null;
117
 
118
  jQuery(function () {
119
 
 
 
 
120
  // open blocks tab
121
  document.getElementById("defaultOpen").click();
122
 
141
  // ======================== //
142
  _setBuilderAreaBackgroundColor(document.getElementById('options-options_composer_background').value);
143
 
 
 
 
 
144
  function _setBuilderAreaBackgroundColor(color) {
145
  jQuery('#newsletter-builder-area-center-frame-content').css('background-color', color);
146
  }
147
+
148
+ window._setBuilderAreaBackgroundColor = _setBuilderAreaBackgroundColor; //BAD STUFF!!!
149
+
150
  // ======================== //
151
  // == BACKGROUND COLOR == //
152
  // ======================== //
153
 
154
  });
155
 
156
+ function BuilderAreaHelper() {
157
+
158
+ var _builderAreaEl = document.querySelector('#newsletter-builder-area');
159
+ var _overlayEl = document.createElement('div');
160
+ _overlayEl.style.zIndex = 99999;
161
+ _overlayEl.style.position = 'absolute';
162
+ _overlayEl.style.top = 0;
163
+ _overlayEl.style.left = 0;
164
+ _overlayEl.style.width = '100%';
165
+ _overlayEl.style.height = '100%';
166
+
167
+ this.lock = function () {
168
+ console.log('Lock builder area');
169
+ _builderAreaEl.appendChild(_overlayEl);
170
+ }
171
+
172
+ this.unlock = function () {
173
+ console.log('Unlock builder area');
174
+ _builderAreaEl.removeChild(_overlayEl);
175
+ }
176
+
177
+ }
178
+
179
+ let builderAreaHelper = new BuilderAreaHelper();
180
+
181
+ function init_builder_area() {
182
 
183
  //Drag & Drop
184
  jQuery("#newsletter-builder-area-center-frame-content").sortable({
196
  loading_row = jQuery('<div style="text-align: center; padding: 20px; background-color: #d4d5d6; color: #52BE7F;"><i class="fa fa-cog fa-2x fa-spin" /></div>');
197
  ui.item.before(loading_row);
198
  ui.item.remove();
199
+ var data = new Array(
200
+ {"name": 'action', "value": 'tnpc_render'},
201
+ {"name": 'b', "value": ui.item.data("id")},
202
+ {"name": 'full', "value": 1},
203
+ {"name": '_wpnonce', "value": tnp_nonce}
204
+ );
205
+
206
+ tnpc_add_global_options(data);
207
+
208
  jQuery.post(ajaxurl, data, function (response) {
209
 
210
+ var new_row = jQuery(response);
211
  // ui.item.before(new_row);
212
  // ui.item.remove();
213
  loading_row.before(new_row);
253
  }
254
  });
255
 
256
+ jQuery(".tnpc-row").add_delete();
257
+ jQuery(".tnpc-row").add_block_edit();
258
+ jQuery(".tnpc-row").add_block_clone();
259
+
260
+ }
261
+
262
+ function start_composer() {
263
+
264
+ init_builder_area();
265
+
266
  // Closes the block options layer (without saving)
267
  jQuery("#tnpc-block-options-cancel").click(function () {
268
+
269
+ tnpc_hide_block_options();
270
+
271
+ var _target = target;
272
+
273
  jQuery.post(ajaxurl, start_options, function (response) {
274
+ _target.html(response);
275
  jQuery("#tnpc-block-options-form").html("");
276
  });
277
  });
279
  // Fires the save event for block options
280
  jQuery("#tnpc-block-options-save").click(function (e) {
281
  e.preventDefault();
282
+
283
+ var _target = target;
284
+
285
  // fix for Codemirror
286
  if (typeof templateEditor !== 'undefined') {
287
  templateEditor.save();
290
  if (window.tinymce)
291
  window.tinymce.triggerSave();
292
 
293
+ var data = jQuery("#tnpc-block-options-form").serializeArray();
294
+
295
+ tnpc_add_global_options(data);
296
 
297
+ tnpc_hide_block_options();
298
 
299
  jQuery.post(ajaxurl, data, function (response) {
300
+ _target.html(response);
301
  tnpc_mobile_preview();
 
 
302
  jQuery("#tnpc-block-options-form").html("");
303
  });
304
  });
305
 
306
  // live preview from block options *** EXPERIMENTAL ***
307
  jQuery('#tnpc-block-options-form').change(function (event) {
308
+ var data = jQuery("#tnpc-block-options-form").serializeArray();
309
+
310
+ var _container = container;
311
+ var _target = target;
312
+
313
+ tnpc_add_global_options(data);
314
+
315
  jQuery.post(ajaxurl, data, function (response) {
316
+ _target.html(response);
317
  if (event.target.dataset.afterRendering === 'reload') {
318
+ _container.find(".tnpc-row-edit-block").click();
319
  }
320
  }).fail(function () {
321
  alert("Block rendering failed");
322
  });
323
 
 
324
  });
325
 
326
+ tnpc_mobile_preview();
 
 
327
 
328
+ }
329
 
330
+ function tnpc_show_block_options() {
331
+
332
+ const animationDuration = 500;
333
+
334
+ jQuery("#tnpc-blocks").fadeOut(animationDuration);
335
+ jQuery("#tnpc-global-styles").fadeOut(animationDuration);
336
+ jQuery("#tnpc-mobile-tab").fadeOut(animationDuration);
337
+ jQuery("#tnpc-test-tab").fadeOut(animationDuration);
338
+
339
+ jQuery("#tnpc-block-options").fadeIn(animationDuration);
340
+
341
+ }
342
+
343
+ function tnpc_hide_block_options() {
344
+
345
+ const animationDuration = 500;
346
+
347
+ jQuery("#tnpc-block-options").fadeOut(animationDuration);
348
+
349
+ var $activeTab = jQuery(".tnpc-tabs .tablinks.active");
350
+ jQuery('#' + $activeTab.data('tabId')).fadeIn(animationDuration);
351
+
352
+ jQuery("#tnpc-block-options-form").html('');
353
 
354
  }
355
 
371
 
372
  function tnpc_save(form) {
373
 
374
+ form.elements["options[message]"].value = tnpc_get_email_content_from_builder_area();
 
 
 
 
 
 
 
 
375
  if (document.getElementById("options-title")) {
376
  form.elements["options[subject]"].value = jQuery('#options-title').val();
377
  } else {
382
  //Copy "Global styles" form inputs into main form
383
  tnpc_copy_form(global_form, form);
384
 
385
+ }
386
+
387
+ function tnpc_get_email_content_from_builder_area() {
388
+
389
+ var $elMessage = jQuery("#newsletter-builder-area-center-frame-content").clone();
390
+
391
+ $elMessage.find('.tnpc-row-delete').remove();
392
+ $elMessage.find('.tnpc-row-edit-block').remove();
393
+ $elMessage.find('.tnpc-row-clone').remove();
394
+ $elMessage.find('.tnpc-row').removeClass('ui-draggable');
395
+ $elMessage.find('#sortable-helper').remove();
396
+
397
+ return $elMessage.html();
398
+
399
  }
400
 
401
  function tnpc_copy_form(source, dest) {
402
  for (var i = 0; i < source.elements.length; i++) {
403
+ var field = document.createElement("input");
404
+ field.type = "hidden";
405
+ field.name = source.elements[i].name;
406
+ field.value = source.elements[i].value;
407
+
408
+ // Non clona le select!
409
+ //var clonedEl = source.elements[i].cloneNode();
410
+ //clonedEl.style.display = 'none';
411
+ dest.appendChild(field);
412
  }
413
  }
414
 
441
  evt.currentTarget.className += " active";
442
  }
443
 
444
+ function tnpc_scratch() {
445
+
446
+ jQuery('#newsletter-builder-area-center-frame-content').html(" ");
447
+ init_builder_area();
448
+
449
+ }
450
+
451
+ function tnpc_reload_options(e) {
452
+ e.preventDefault();
453
+ let options = jQuery("#tnpc-block-options-form").serializeArray();
454
+ for (let i = 0; i < options.length; i++) {
455
+ if (options[i].name === 'action') {
456
+ options[i].value = 'tnpc_options';
457
+ }
458
+ }
459
+
460
+ jQuery("#tnpc-block-options-form").load(ajaxurl, options);
461
+ }
462
+
463
+ function tnpc_add_global_options(data) {
464
+ let globalOptions = jQuery("#tnpc-global-styles-form").serializeArray();
465
+ for (let i = 0; i < globalOptions.length; i++) {
466
+ globalOptions[i].name = globalOptions[i].name.replace("[options_", "[").replace("options[", "composer[").replace("composer_", "");
467
+ if (Array.isArray(data)) {
468
+ data.push(globalOptions[i]);
469
+ } else {
470
+ //Inline edit data format is object not array
471
+ data[globalOptions[i].name] = globalOptions[i].value;
472
+ }
473
+ }
474
+ }
475
+
476
+ // ==================================================== //
477
+ // ================= PRESET ===================== //
478
+ // ==================================================== //
479
+
480
+ //TODO non va bene tenere nel global space variabili che altri potrebbero accidentalmente modificare/usare
481
+ // ma questo è un test
482
+ const toastBottom = new TnpToast({duration: 5000, position: 'bottom right', wrapperPadding: '70px 20px'});
483
+
484
+ //TODO - spostare gestione dei preset in contesto privato ma aggiungendo comunque a window le funzioni triggerate da html (load_preset, delete_preset,...) per mantenere compatibilità?
485
+ const presetListModal = new TNPModal({
486
+ closeWhenClickOutside: true,
487
+ showClose: true,
488
+ style: {
489
+ backgroundColor: '#ECF0F1',
490
+ height: '400px',
491
+ width: '740px',
492
+ },
493
+ onClose: function () {
494
+ start_composer();
495
+ //Enable buttons
496
+ jQuery('.tnpc-controls input[type=button]').attr('disabled', false);
497
+ }
498
+ });
499
 
500
  function tnpc_show_presets() {
501
 
502
+ jQuery('.tnpc-controls input[type=button]').attr('disabled', true);
503
+
504
+ const elModalContent = presetListModal.open();
505
+
506
+ jQuery(elModalContent).load(ajaxurl, {
507
  action: "tnpc_presets",
508
  });
509
 
510
  }
511
 
512
+ function tnpc_load_preset(id, subject, isEditMode) {
513
+
514
+ presetListModal.close();
515
 
516
  jQuery('#newsletter-builder-area-center-frame-content').load(ajaxurl, {
517
  action: "tnpc_presets",
518
  id: id
519
  }, function () {
520
  start_composer();
521
+
522
+ if (!isEditMode) {
523
+ //Enable buttons
524
+ jQuery('.tnpc-controls input[type=button]').attr('disabled', false);
525
+ }
526
+
527
+ if (subject && subject.length > 0) {
528
+ jQuery('#options-title').val(tnpc_remove_double_quotes_escape_from(subject));
529
+ }
530
  });
531
 
532
  }
533
 
534
+ function tnpc_save_preset(form) {
535
 
536
+ const presetName = tnpc_remove_double_quotes_from(document.querySelector('#options-title').value);
537
+
538
+ const presetNameModal = new TNPModal({
539
+ title: 'Choose a preset name',
540
+ content: '<input type="text" id="preset_name" style="width: 100%" placeholder="Preset name" value="' + presetName + '"/>',
541
+ showConfirm: true,
542
+ clickConfirmOnPressEnter: true,
543
+ onConfirm: function () {
544
+ const inputEl = document.querySelector('#preset_name');
545
+ document.querySelector('#options-title').value = inputEl.value;
546
+ tnpc_save(form);
547
+ form.submit();
548
+ }
549
+ });
550
+
551
+ presetNameModal.open();
552
 
553
  }
554
 
555
+ function tnpc_delete_preset(presetId, name, event) {
556
+ event.stopPropagation();
557
+
558
+ const presetDeleteModal = new TNPModal({
559
+ title: `Are you sure to delete "${name}" preset?`,
560
+ confirmText: 'DELETE PRESET',
561
+ confirmClassName: 'button-secondary button-danger',
562
+ showConfirm: true,
563
+ onConfirm: function () {
564
+
565
+ const wrapperPresetEl = event.target.closest(".tnpc-preset");
566
+
567
+ jQuery.ajax({
568
+ type: 'POST',
569
+ dataType: 'json',
570
+ url: ajaxurl,
571
+ data: {
572
+ action: 'tnpc_delete_preset',
573
+ _wpnonce: tnp_preset_nonce,
574
+ presetId: presetId
575
+ },
576
+ success: function (response) {
577
+ if (response.success) {
578
+ wrapperPresetEl.parentNode.removeChild(wrapperPresetEl);
579
+ toastBottom.success('Preset successfully deleted!');
580
+ }
581
+ }
582
+ });
583
+
584
+ }
585
+ });
586
+
587
+ presetDeleteModal.open();
588
+
589
+ }
590
+
591
+ function tnpc_edit_preset(presetId, name, event) {
592
+ event.stopPropagation();
593
+ tnpc_load_preset(presetId, name, true);
594
+
595
+ //DISABLE BUTTON AND SHOW UPDATE BUTTON
596
+ const composerForm = document.querySelector('#tnpc-form');
597
+ const buttons = composerForm.querySelectorAll('input[type=button]');
598
+ const updatePresetButton = composerForm.querySelector('#update-preset-button');
599
+
600
+ for (btn of buttons) {
601
+ if (btn.id && btn.id === 'save-preset-button') {
602
+ btn.style.display = 'none';
603
+ updatePresetButton.style.display = 'inline';
604
+ updatePresetButton.disabled = false;
605
+ } else {
606
+ btn.disabled = true;
607
  }
608
  }
609
 
610
+ //Add preset id hidden field
611
+ const presetIdfield = document.createElement("input");
612
+ presetIdfield.type = "hidden";
613
+ presetIdfield.name = "preset_id";
614
+ presetIdfield.value = presetId;
615
+ composerForm.appendChild(presetIdfield);
616
+
617
+ }
618
+
619
+ function tnpc_remove_double_quotes_escape_from(str) {
620
+ return str.replace(/\\"/g, '"');
621
+ }
622
+
623
+ function tnpc_remove_double_quotes_from(str) {
624
+ return str.replace(/['"]+/g, '');
625
+ }
626
+
627
+ function tnpc_update_preset(form) {
628
+
629
+ const presetName = tnpc_remove_double_quotes_from(document.querySelector('#options-title').value);
630
+
631
+ const presetNameModal = new TNPModal({
632
+ title: 'Choose a preset name',
633
+ content: '<input type="text" id="preset_name" style="width: 100%" placeholder="Preset name" value="' + presetName + '"/>',
634
+ showConfirm: true,
635
+ clickConfirmOnPressEnter: true,
636
+ onConfirm: function () {
637
+ const inputEl = document.querySelector('#preset_name');
638
+ document.querySelector('#options-title').value = inputEl.value;
639
+ tnpc_save(form);
640
+ form.submit();
641
+ }
642
+ });
643
+
644
+ presetNameModal.open();
645
+
646
  }
647
 
648
+ // ========================================================= //
649
+ // ================= PRESET FINE ===================== //
650
+ // ========================================================= //
651
+
652
  jQuery(document).ready(function () {
653
+ 'use strict'
654
 
655
  var TNPInlineEditor = (function () {
656
 
657
+ var className = 'tnpc-inline-editable';
658
+ var newInputName = 'new_name';
659
+ var activeInlineElements = [];
660
+
661
+ function init() {
662
+ // find all inline editable elements
663
+ jQuery('#newsletter-builder-area-center-frame-content').on('click', '.' + className, function (e) {
664
+ e.preventDefault();
665
+ removeAllActiveElements();
666
+
667
+ var originalEl = jQuery(this).hide();
668
+ var newEl = jQuery(getEditableComponent(this.innerText.trim(), this.dataset.id, this.dataset.type, originalEl)).insertAfter(this);
669
+
670
+ activeInlineElements.push({'originalEl': originalEl, 'newEl': newEl});
671
+
672
+ //Add submit event listener for newly created block
673
+ jQuery('.tnpc-inline-editable-form-' + this.dataset.type + this.dataset.id).on('submit', function (e) {
674
+ submit(e, newEl, jQuery(originalEl));
675
+ });
676
+
677
+ //Add close event listener for newly created block
678
+ jQuery('.tnpc-inline-editable-form-actions .tnpc-dismiss-' + this.dataset.type + this.dataset.id).on('click', function (e) {
679
+ removeAllActiveElements();
680
+ });
681
+
682
+ });
683
 
684
+ // Close all created elements if clicked outside
685
+ jQuery('#newsletter-builder-area-center-frame-content').on('click', function (e) {
686
+ if (activeInlineElements.length > 0
687
+ && !jQuery(e.target).hasClass(className)
688
+ && jQuery(e.target).closest('.tnpc-inline-editable-container').length === 0) {
689
  removeAllActiveElements();
690
+ }
691
+ });
692
 
693
+ }
 
694
 
695
+ function removeAllActiveElements() {
696
+ activeInlineElements.forEach(function (obj) {
697
+ obj.originalEl.show();
698
 
699
+ obj.newEl.off();
700
+ obj.newEl.remove();
701
+ });
 
702
 
703
+ activeInlineElements = []
704
+ }
 
 
705
 
706
+ function getEditableComponent(value, id, type, originalEl) {
707
 
708
+ var element = '';
709
+
710
+ //COPY FONT STYLE FROM ORIGINAL ELEMENT
711
+ var fontFamily = originalEl.css('font-family');
712
+ var fontSize = originalEl.css('font-size');
713
+ var styleAttr = "style='font-family:" + fontFamily + ";font-size:" + fontSize + ";'";
 
 
714
 
715
+ switch (type) {
716
+ case 'text': {
717
+ element = "<textarea name='" + newInputName + "' class='" + className + "-textarea' rows='5' " + styleAttr + ">" + value + "</textarea>";
718
+ break;
719
+ }
720
+ case 'title': {
721
+ element = "<textarea name='" + newInputName + "' class='" + className + "-textarea' rows='2'" + styleAttr + ">" + value + "</textarea>";
722
+ break;
723
+ }
724
  }
725
 
726
+ var component = "<td>";
727
+ component += "<form class='tnpc-inline-editable-form tnpc-inline-editable-form-" + type + id + "'>";
728
+ component += "<input type='hidden' name='id' value='" + id + "'>";
729
+ component += "<input type='hidden' name='type' value='" + type + "'>";
730
+ component += "<input type='hidden' name='old_value' value='" + value + "'>";
731
+ component += "<div class='tnpc-inline-editable-container'>";
732
+ component += element;
733
+ component += "<div class='tnpc-inline-editable-form-actions'>";
734
+ component += "<button type='submit'><span class='dashicons dashicons-yes-alt' title='save'></span></button>";
735
+ component += "<span class='dashicons dashicons-dismiss tnpc-dismiss-" + type + id + "' title='close'></span>";
736
+ component += "</div>";
737
+ component += "</div>";
738
+ component += "</form>";
739
+ component += "</td>";
740
+ return component;
741
+ }
742
 
743
+ function submit(e, elementToDeleteAfterSubmit, elementToShow) {
744
+ e.preventDefault();
 
745
 
746
+ var id = elementToDeleteAfterSubmit.find('form input[name=id]').val();
747
+ var type = elementToDeleteAfterSubmit.find('form input[name=type]').val();
748
+ var newValue = elementToDeleteAfterSubmit.find('form [name="' + newInputName + '"]').val();
749
 
750
+ ajax_render_block(elementToShow, type, id, newValue);
751
 
752
+ elementToDeleteAfterSubmit.remove();
753
+ elementToShow.show();
754
 
755
+ }
 
 
 
 
 
 
 
 
 
756
 
757
+ function ajax_render_block(inlineElement, type, postId, newContent) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
758
 
759
+ var target = inlineElement.closest('.edit-block');
760
+ var container = target.closest('table');
761
+ var blockContent = target.children('.tnpc-block-content');
762
 
763
+ if (container.hasClass('tnpc-row-block')) {
764
+ var data = {
765
+ 'action': 'tnpc_render',
766
+ 'b': container.data('id'),
767
+ 'full': 1,
768
+ '_wpnonce': tnp_nonce,
769
+ 'options': {
770
+ 'inline_edits': [{
771
+ 'type': type,
772
+ 'post_id': postId,
773
+ 'content': newContent
774
+ }]
775
+ },
776
+ 'encoded_options': blockContent.data('json')
777
+ };
778
 
779
+ tnpc_add_global_options(data);
780
 
781
+ jQuery.post(ajaxurl, data, function (response) {
782
+ var new_row = jQuery(response);
783
 
784
+ container.before(new_row);
785
+ container.remove();
786
 
787
+ new_row.add_delete();
788
+ new_row.add_block_edit();
789
+ new_row.add_block_clone();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
 
791
+ //Force reload options
792
+ if (new_row.hasClass('tnpc-row-block')) {
793
+ new_row.find(".tnpc-row-edit-block").click();
794
+ }
795
+
796
+ tnpc_mobile_preview();
797
+
798
+ }).fail(function () {
799
+ alert("Block rendering failed.");
800
+ });
801
 
802
  }
803
 
 
804
  }
805
 
806
+ return {init};
807
+ })();
808
 
809
  TNPInlineEditor.init();
810
 
811
  });
812
+
813
+ // =================================================== //
814
+ // =============== GLOBAL STYLE ================== //
815
+ // =================================================== //
816
+
817
+ (function globalStyleIIFE() {
818
+
819
+ var _elTrigger = document.querySelector('#tnpc-global-styles-form [name="apply"]');
820
+
821
+ _elTrigger.addEventListener('click', function (e) {
822
+ e.preventDefault();
823
+
824
+ var data = {
825
+ 'action': 'tnpc_regenerate_email',
826
+ 'content': tnpc_get_email_content_from_builder_area(),
827
+ '_wpnonce': tnp_nonce,
828
+ };
829
+
830
+ tnpc_add_global_options(data);
831
+
832
+ jQuery.post(ajaxurl, data, function (response) {
833
+ if (response && response.success) {
834
+ jQuery('#newsletter-builder-area-center-frame-content').html(response.data.content);
835
+ //Change background color of builder area
836
+ _setBuilderAreaBackgroundColor(document.getElementById('options-options_composer_background').value);
837
+ init_builder_area();
838
+ tnpc_mobile_preview();
839
+
840
+ toastBottom.success(response.data.message);
841
+ } else {
842
+ toastBottom.error(response.data.message);
843
+ }
844
+ });
845
+
846
+ });
847
+
848
+ })();
emails/tnp-composer/_scripts/newsletter-builder-v2.min.js CHANGED
@@ -1,24 +1,26 @@
1
  jQuery.fn.add_delete=function(){this.append('<div class="tnpc-row-delete" title="Delete"><img src="'+TNP_PLUGIN_URL+'/emails/tnp-composer/_assets/delete.png" width="32"></div>');this.find(".tnpc-row-delete").perform_delete()};jQuery.fn.perform_delete=function(){this.click(function(){jQuery("#tnpc-block-options").hide();jQuery(this).parent().remove();tnpc_mobile_preview()})};
2
  jQuery.fn.add_block_edit=function(){this.append('<div class="tnpc-row-edit-block" title="Edit"><img src="'+TNP_PLUGIN_URL+'/emails/tnp-composer/_assets/edit.png" width="32"></div>');this.find(".tnpc-row-edit-block").perform_block_edit()};jQuery.fn.add_block_clone=function(){this.append('<div class="tnpc-row-clone" title="Clone"><img src="'+TNP_PLUGIN_URL+'/emails/tnp-composer/_assets/copy.png" width="32"></div>');this.find(".tnpc-row-clone").perform_clone()};let start_options=null,container=null;
3
- jQuery.fn.perform_block_edit=function(){jQuery(".tnpc-row-edit-block").click(function(a){a.preventDefault()});this.click(function(a){a.preventDefault();target=jQuery(this).parent().find(".edit-block");jQuery("#tnpc-edit-block .bgcolor").val(target.css("background-color"));jQuery("#tnpc-edit-block .font").val(target.css("font-family"));jQuery(".bgcolor").wpColorPicker().iris("color",target.css("background-color"));container=jQuery(this).closest("table");container.hasClass("tnpc-row-block")?(jQuery("#tnpc-block-options").fadeIn(500),
4
- (a=container.find(".tnpc-block-content").attr("data-json"))||(a=target.attr("data-options")),jQuery("#tnpc-block-options-form").load(ajaxurl,{action:"tnpc_options",id:container.data("id"),context_type:tnp_context_type,options:a},function(){start_options=jQuery("#tnpc-block-options-form").serialize();tnp_controls_init()})):alert("This is deprecated block version and cannot be edited. Please replace it with a new one.")})};
5
  jQuery.fn.perform_clone=function(){jQuery(".tnpc-row-clone").click(function(a){a.preventDefault()});this.click(function(a){a.preventDefault();jQuery("#tnpc-block-options").hide();a=jQuery(this).closest(".tnpc-row");let b=a.clone();b.find(".tnpc-row-delete").remove();b.find(".tnpc-row-edit-block").remove();b.find(".tnpc-row-clone").remove();b.add_delete();b.add_block_edit();b.add_block_clone();b.insertAfter(a);tnpc_mobile_preview()})};
6
  jQuery(function(){function a(a){jQuery("#newsletter-builder-area-center-frame-content").css("background-color",a)}jQuery("body").addClass("folded");document.getElementById("defaultOpen").click();var b=jQuery('input[name="message"]').val();b||(b=jQuery('input[name="options[message]"]').val());b?(jQuery("#newsletter-builder-area-center-frame-content").html(b),start_composer()):tnpc_show_presets();jQuery("#options-title").val(jQuery('#tnpc-form input[name="options[subject]"]').val());a(document.getElementById("options-options_composer_background").value);
7
  jQuery("#options-options_composer_background").on("change",function(b){a(b.target.value)})});
8
  function start_composer(){jQuery("#newsletter-builder-area-center-frame-content").sortable({revert:!1,placeholder:"placeholder",forcePlaceholderSize:!0,opacity:.6,tolerance:"pointer",helper:function(a){return jQuery(document.getElementById("sortable-helper")).clone()},update:function(a,b){"draggable-helper"==b.item.attr("id")?(loading_row=jQuery('<div style="text-align: center; padding: 20px; background-color: #d4d5d6; color: #52BE7F;"><i class="fa fa-cog fa-2x fa-spin" /></div>'),b.item.before(loading_row),
9
- b.item.remove(),a={action:"tnpc_render",b:b.item.data("id"),full:1,_wpnonce:tnp_nonce},jQuery.post(ajaxurl,a,function(a){new_row=jQuery(a);loading_row.before(new_row);loading_row.remove();new_row.add_delete();new_row.add_block_edit();new_row.add_block_clone();new_row.hasClass("tnpc-row-block")&&new_row.find(".tnpc-row-edit-block").click();tnpc_mobile_preview()}).fail(function(){alert("Block rendering failed.");loading_row.remove()})):tnpc_mobile_preview()}});jQuery(".newsletter-sidebar-buttons-content-tab").draggable({connectToSortable:"#newsletter-builder-area-center-frame-content",
10
- helper:function(a){var b=jQuery(document.getElementById("draggable-helper")).clone();b.attr("data-id",a.currentTarget.dataset.id);b.html(a.currentTarget.dataset.name);return b},revert:!1,start:function(){jQuery(".tnpc-row").length||jQuery("#newsletter-builder-area-center-frame-content").append('<div class="tnpc-drop-here">Drag&Drop blocks here!</div>')},stop:function(a,b){jQuery(".tnpc-drop-here").remove()}});jQuery("#tnpc-block-options-cancel").click(function(){jQuery(this).parent().parent().fadeOut(500);
11
- jQuery.post(ajaxurl,start_options,function(a){target.html(a);jQuery("#tnpc-block-options-form").html("")})});jQuery("#tnpc-block-options-save").click(function(a){a.preventDefault();"undefined"!==typeof templateEditor&&templateEditor.save();window.tinymce&&window.tinymce.triggerSave();jQuery("#tnpc-block-options").fadeOut(500);a=jQuery("#tnpc-block-options-form").serialize();jQuery.post(ajaxurl,a,function(a){target.html(a);tnpc_mobile_preview();jQuery("#tnpc-block-options-form").html("")})});jQuery("#tnpc-block-options-form").change(function(a){var b=
12
- jQuery("#tnpc-block-options-form").serialize();jQuery.post(ajaxurl,b,function(b){target.html(b);"reload"===a.target.dataset.afterRendering&&container.find(".tnpc-row-edit-block").click()}).fail(function(){alert("Block rendering failed")})});jQuery(".tnpc-row").add_delete();jQuery(".tnpc-row").add_block_edit();jQuery(".tnpc-row").add_block_clone();tnpc_mobile_preview()}
 
13
  function tnpc_mobile_preview(){var a=document.getElementById("tnpc-mobile-preview").contentWindow.document;a.open();a.write("<!DOCTYPE html>\n<html>\n<head>\n");a.write("<link rel='stylesheet' href='"+TNP_HOME_URL+"?na=emails-composer-css&ver="+Math.random()+"' type='text/css'>");a.write("<style>.tnpc-row-delete, .tnpc-row-edit-block, .tnpc-row-clone { display: none; }</style>");a.write("<style>body::-webkit-scrollbar {width: 0px;background: transparent;}</style>");a.write("<style>body{scrollbar-width: none; -ms-overflow-style: none;}</style>");
14
  a.write("</head>\n<body style='margin: 0; padding: 0;'><div style='width: 320px!important'>");a.write(jQuery("#newsletter-builder-area-center-frame-content").html());a.write("</div>\n</body>\n</html>");a.close()}
15
  function tnpc_save(a){jQuery("#newsletter-preloaded-export").html(jQuery("#newsletter-builder-area-center-frame-content").html());jQuery("#newsletter-preloaded-export .tnpc-row-delete").remove();jQuery("#newsletter-preloaded-export .tnpc-row-edit-block").remove();jQuery("#newsletter-preloaded-export .tnpc-row-clone").remove();jQuery("#newsletter-preloaded-export .tnpc-row").removeClass("ui-draggable");jQuery("#newsletter-preloaded-export #sortable-helper").remove();a.elements["options[message]"].value=
16
- jQuery("#newsletter-preloaded-export").html();document.getElementById("options-title")?a.elements["options[subject]"].value=jQuery("#options-title").val():a.elements["options[subject]"].value="";var b=document.getElementById("tnpc-global-styles-form");tnpc_copy_form(b,a);jQuery("#newsletter-preloaded-export").html(" ")}function tnpc_copy_form(a,b){for(var c=0;c<a.elements.length;c++){var d=a.elements[c].cloneNode();d.style.display="none";b.appendChild(d)}}
17
- function tnpc_test(){let a=document.getElementById("tnpc-form");tnpc_save(a);a.act.value="test";a.submit()}function openTab(a,b){a.preventDefault();var c;var d=document.getElementsByClassName("tabcontent");for(c=0;c<d.length;c++)d[c].style.display="none";d=document.getElementsByClassName("tablinks");for(c=0;c<d.length;c++)d[c].className=d[c].className.replace(" active","");document.getElementById(b).style.display="block";a.currentTarget.className+=" active"}
 
18
  function tnpc_show_presets(){jQuery(".tnpc-controls input").attr("disabled",!0);jQuery("#newsletter-builder-area-center-frame-content").load(ajaxurl,{action:"tnpc_presets"})}function tnpc_load_preset(a){jQuery("#newsletter-builder-area-center-frame-content").load(ajaxurl,{action:"tnpc_presets",id:a},function(){start_composer();jQuery(".tnpc-controls input").attr("disabled",!1)})}function tnpc_scratch(){jQuery("#newsletter-builder-area-center-frame-content").html(" ");start_composer()}
19
- function tnpc_reload_options(a){a.preventDefault();a=jQuery("#tnpc-block-options-form").serializeArray();for(let b=0;b<a.length;b++)"action"===a[b].name&&(a[b].value="tnpc_options");jQuery("#tnpc-block-options-form").load(ajaxurl,a)}
20
  jQuery(document).ready(function(){(function(){function a(){d.forEach(function(a){a.originalEl.show();a.newEl.off();a.newEl.remove()});d=[]}function b(a,b,c){var d="";switch(c){case "text":d="<textarea name='new_name' class='tnpc-inline-editable-textarea' rows='5'>"+a+"</textarea>";break;case "title":d="<textarea name='new_name' class='tnpc-inline-editable-textarea' rows='2'>"+a+"</textarea>"}var e="<td>"+("<form class='tnpc-inline-editable-form tnpc-inline-editable-form-"+c+b+"'>")+("<input type='hidden' name='id' value='"+
21
  b+"'>")+("<input type='hidden' name='type' value='"+c+"'>");e+="<input type='hidden' name='old_value' value='"+a+"'>";e+="<div class='tnpc-inline-editable-container'>";e+=d;e+="<div class='tnpc-inline-editable-form-actions'>";e+="<button type='submit'><span class='dashicons dashicons-yes-alt' title='save'></span></button>";e=e+("<span class='dashicons dashicons-dismiss tnpc-dismiss-"+c+b+"' title='close'></span>")+"</div></div>";e+="</form>";return e+="</td>"}function c(a,b,c,d){var e=a.closest(".edit-block");
22
- a=e.closest("table");var f=e.children(".tnpc-block-content");a.hasClass("tnpc-row-block")&&(b={action:"tnpc_render",b:a.data("id"),full:1,_wpnonce:tnp_nonce,options:{inline_edits:[{type:b,post_id:c,content:d}]},encoded_options:f.data("json")},jQuery.post(ajaxurl,b,function(a){new_row=jQuery(a);e.before(new_row);e.remove();new_row.add_delete();new_row.add_block_edit();new_row.add_block_clone();new_row.hasClass("tnpc-row-block")&&new_row.find(".tnpc-row-edit-block").click();tnpc_mobile_preview()}).fail(function(){alert("Block rendering failed.")}))}
23
- var d=[];return{init:function(){jQuery("#newsletter-builder-area-center-frame-content").on("click",".tnpc-inline-editable",function(g){a();var h=jQuery(this).hide(),f=jQuery(b(this.innerText.trim(),this.dataset.id,this.dataset.type)).insertAfter(this);d.push({originalEl:h,newEl:f});jQuery(".tnpc-inline-editable-form-"+this.dataset.type+this.dataset.id).on("submit",function(a){var b=jQuery(h);a.preventDefault();a=f.find("form input[name=id]").val();var d=f.find("form input[name=type]").val(),g=f.find('form [name="new_name"]').val();
24
- c(b,d,a,g);f.remove();b.show()});jQuery(".tnpc-inline-editable-form-actions .tnpc-dismiss-"+this.dataset.type+this.dataset.id).on("click",function(b){a()})});jQuery("#newsletter-builder-area-center-frame-content").on("click",function(b){0<d.length&&!jQuery(b.target).hasClass("tnpc-inline-editable")&&0===jQuery(b.target).closest(".tnpc-inline-editable-container").length&&a()})}}})().init()});
1
  jQuery.fn.add_delete=function(){this.append('<div class="tnpc-row-delete" title="Delete"><img src="'+TNP_PLUGIN_URL+'/emails/tnp-composer/_assets/delete.png" width="32"></div>');this.find(".tnpc-row-delete").perform_delete()};jQuery.fn.perform_delete=function(){this.click(function(){jQuery("#tnpc-block-options").hide();jQuery(this).parent().remove();tnpc_mobile_preview()})};
2
  jQuery.fn.add_block_edit=function(){this.append('<div class="tnpc-row-edit-block" title="Edit"><img src="'+TNP_PLUGIN_URL+'/emails/tnp-composer/_assets/edit.png" width="32"></div>');this.find(".tnpc-row-edit-block").perform_block_edit()};jQuery.fn.add_block_clone=function(){this.append('<div class="tnpc-row-clone" title="Clone"><img src="'+TNP_PLUGIN_URL+'/emails/tnp-composer/_assets/copy.png" width="32"></div>');this.find(".tnpc-row-clone").perform_clone()};let start_options=null,container=null;
3
+ jQuery.fn.perform_block_edit=function(){jQuery(".tnpc-row-edit-block").click(function(a){a.preventDefault()});this.click(function(a){a.preventDefault();target=jQuery(this).parent().find(".edit-block");container=jQuery(this).closest("table");container.hasClass("tnpc-row-block")?(jQuery("#newsletter-builder-sidebar").css("overflow-y","hidden"),jQuery("#tnpc-block-options").css("display","flex"),(a=container.find(".tnpc-block-content").attr("data-json"))||(a=target.attr("data-options")),jQuery("#tnpc-block-options-form").load(ajaxurl,
4
+ {action:"tnpc_options",id:container.data("id"),context_type:tnp_context_type,options:a},function(){start_options=jQuery("#tnpc-block-options-form").serialize();tnp_controls_init();start_options=jQuery("#tnpc-block-options-form").serializeArray();tnpc_add_global_options(start_options)})):alert("This is deprecated block version and cannot be edited. Please replace it with a new one.")})};
5
  jQuery.fn.perform_clone=function(){jQuery(".tnpc-row-clone").click(function(a){a.preventDefault()});this.click(function(a){a.preventDefault();jQuery("#tnpc-block-options").hide();a=jQuery(this).closest(".tnpc-row");let b=a.clone();b.find(".tnpc-row-delete").remove();b.find(".tnpc-row-edit-block").remove();b.find(".tnpc-row-clone").remove();b.add_delete();b.add_block_edit();b.add_block_clone();b.insertAfter(a);tnpc_mobile_preview()})};
6
  jQuery(function(){function a(a){jQuery("#newsletter-builder-area-center-frame-content").css("background-color",a)}jQuery("body").addClass("folded");document.getElementById("defaultOpen").click();var b=jQuery('input[name="message"]').val();b||(b=jQuery('input[name="options[message]"]').val());b?(jQuery("#newsletter-builder-area-center-frame-content").html(b),start_composer()):tnpc_show_presets();jQuery("#options-title").val(jQuery('#tnpc-form input[name="options[subject]"]').val());a(document.getElementById("options-options_composer_background").value);
7
  jQuery("#options-options_composer_background").on("change",function(b){a(b.target.value)})});
8
  function start_composer(){jQuery("#newsletter-builder-area-center-frame-content").sortable({revert:!1,placeholder:"placeholder",forcePlaceholderSize:!0,opacity:.6,tolerance:"pointer",helper:function(a){return jQuery(document.getElementById("sortable-helper")).clone()},update:function(a,b){"draggable-helper"==b.item.attr("id")?(loading_row=jQuery('<div style="text-align: center; padding: 20px; background-color: #d4d5d6; color: #52BE7F;"><i class="fa fa-cog fa-2x fa-spin" /></div>'),b.item.before(loading_row),
9
+ b.item.remove(),a=[{name:"action",value:"tnpc_render"},{name:"b",value:b.item.data("id")},{name:"full",value:1},{name:"_wpnonce",value:tnp_nonce}],tnpc_add_global_options(a),console.log(a),jQuery.post(ajaxurl,a,function(a){new_row=jQuery(a);loading_row.before(new_row);loading_row.remove();new_row.add_delete();new_row.add_block_edit();new_row.add_block_clone();new_row.hasClass("tnpc-row-block")&&new_row.find(".tnpc-row-edit-block").click();tnpc_mobile_preview()}).fail(function(){alert("Block rendering failed.");
10
+ loading_row.remove()})):tnpc_mobile_preview()}});jQuery(".newsletter-sidebar-buttons-content-tab").draggable({connectToSortable:"#newsletter-builder-area-center-frame-content",helper:function(a){var b=jQuery(document.getElementById("draggable-helper")).clone();b.attr("data-id",a.currentTarget.dataset.id);b.html(a.currentTarget.dataset.name);return b},revert:!1,start:function(){jQuery(".tnpc-row").length||jQuery("#newsletter-builder-area-center-frame-content").append('<div class="tnpc-drop-here">Drag&Drop blocks here!</div>')},
11
+ stop:function(a,b){jQuery(".tnpc-drop-here").remove()}});jQuery("#tnpc-block-options-cancel").click(function(){jQuery(this).parent().parent().fadeOut(500);jQuery("#newsletter-builder-sidebar").css("overflow-y","auto");jQuery.post(ajaxurl,start_options,function(a){target.html(a);jQuery("#tnpc-block-options-form").html("")})});jQuery("#tnpc-block-options-save").click(function(a){a.preventDefault();jQuery("#newsletter-builder-sidebar").css("overflow-y","auto");"undefined"!==typeof templateEditor&&templateEditor.save();
12
+ window.tinymce&&window.tinymce.triggerSave();jQuery("#tnpc-block-options").fadeOut(500);a=jQuery("#tnpc-block-options-form").serializeArray();tnpc_add_global_options(a);jQuery.post(ajaxurl,a,function(a){target.html(a);tnpc_mobile_preview();jQuery("#tnpc-block-options-form").html("")})});jQuery("#tnpc-block-options-form").change(function(a){var b=jQuery("#tnpc-block-options-form").serializeArray();tnpc_add_global_options(b);jQuery.post(ajaxurl,b,function(b){target.html(b);"reload"===a.target.dataset.afterRendering&&
13
+ container.find(".tnpc-row-edit-block").click()}).fail(function(){alert("Block rendering failed")})});jQuery(".tnpc-row").add_delete();jQuery(".tnpc-row").add_block_edit();jQuery(".tnpc-row").add_block_clone();tnpc_mobile_preview()}
14
  function tnpc_mobile_preview(){var a=document.getElementById("tnpc-mobile-preview").contentWindow.document;a.open();a.write("<!DOCTYPE html>\n<html>\n<head>\n");a.write("<link rel='stylesheet' href='"+TNP_HOME_URL+"?na=emails-composer-css&ver="+Math.random()+"' type='text/css'>");a.write("<style>.tnpc-row-delete, .tnpc-row-edit-block, .tnpc-row-clone { display: none; }</style>");a.write("<style>body::-webkit-scrollbar {width: 0px;background: transparent;}</style>");a.write("<style>body{scrollbar-width: none; -ms-overflow-style: none;}</style>");
15
  a.write("</head>\n<body style='margin: 0; padding: 0;'><div style='width: 320px!important'>");a.write(jQuery("#newsletter-builder-area-center-frame-content").html());a.write("</div>\n</body>\n</html>");a.close()}
16
  function tnpc_save(a){jQuery("#newsletter-preloaded-export").html(jQuery("#newsletter-builder-area-center-frame-content").html());jQuery("#newsletter-preloaded-export .tnpc-row-delete").remove();jQuery("#newsletter-preloaded-export .tnpc-row-edit-block").remove();jQuery("#newsletter-preloaded-export .tnpc-row-clone").remove();jQuery("#newsletter-preloaded-export .tnpc-row").removeClass("ui-draggable");jQuery("#newsletter-preloaded-export #sortable-helper").remove();a.elements["options[message]"].value=
17
+ jQuery("#newsletter-preloaded-export").html();document.getElementById("options-title")?a.elements["options[subject]"].value=jQuery("#options-title").val():a.elements["options[subject]"].value="";var b=document.getElementById("tnpc-global-styles-form");tnpc_copy_form(b,a);jQuery("#newsletter-preloaded-export").html(" ")}
18
+ function tnpc_copy_form(a,b){for(var c=0;c<a.elements.length;c++){var d=document.createElement("input");d.type="hidden";d.name=a.elements[c].name;d.value=a.elements[c].value;b.appendChild(d)}}function tnpc_test(){let a=document.getElementById("tnpc-form");tnpc_save(a);a.act.value="test";a.submit()}
19
+ function openTab(a,b){a.preventDefault();var c;var d=document.getElementsByClassName("tabcontent");for(c=0;c<d.length;c++)d[c].style.display="none";d=document.getElementsByClassName("tablinks");for(c=0;c<d.length;c++)d[c].className=d[c].className.replace(" active","");document.getElementById(b).style.display="block";a.currentTarget.className+=" active"}
20
  function tnpc_show_presets(){jQuery(".tnpc-controls input").attr("disabled",!0);jQuery("#newsletter-builder-area-center-frame-content").load(ajaxurl,{action:"tnpc_presets"})}function tnpc_load_preset(a){jQuery("#newsletter-builder-area-center-frame-content").load(ajaxurl,{action:"tnpc_presets",id:a},function(){start_composer();jQuery(".tnpc-controls input").attr("disabled",!1)})}function tnpc_scratch(){jQuery("#newsletter-builder-area-center-frame-content").html(" ");start_composer()}
21
+ function tnpc_reload_options(a){a.preventDefault();a=jQuery("#tnpc-block-options-form").serializeArray();for(let b=0;b<a.length;b++)"action"===a[b].name&&(a[b].value="tnpc_options");jQuery("#tnpc-block-options-form").load(ajaxurl,a)}function tnpc_add_global_options(a){let b=jQuery("#tnpc-global-styles-form").serializeArray();for(let c=0;c<b.length;c++)b[c].name=b[c].name.replace("[options_","[").replace("options[","composer[").replace("composer_",""),a.push(b[c])}
22
  jQuery(document).ready(function(){(function(){function a(){d.forEach(function(a){a.originalEl.show();a.newEl.off();a.newEl.remove()});d=[]}function b(a,b,c){var d="";switch(c){case "text":d="<textarea name='new_name' class='tnpc-inline-editable-textarea' rows='5'>"+a+"</textarea>";break;case "title":d="<textarea name='new_name' class='tnpc-inline-editable-textarea' rows='2'>"+a+"</textarea>"}var e="<td>"+("<form class='tnpc-inline-editable-form tnpc-inline-editable-form-"+c+b+"'>")+("<input type='hidden' name='id' value='"+
23
  b+"'>")+("<input type='hidden' name='type' value='"+c+"'>");e+="<input type='hidden' name='old_value' value='"+a+"'>";e+="<div class='tnpc-inline-editable-container'>";e+=d;e+="<div class='tnpc-inline-editable-form-actions'>";e+="<button type='submit'><span class='dashicons dashicons-yes-alt' title='save'></span></button>";e=e+("<span class='dashicons dashicons-dismiss tnpc-dismiss-"+c+b+"' title='close'></span>")+"</div></div>";e+="</form>";return e+="</td>"}function c(a,b,c,d){var e=a.closest(".edit-block");
24
+ a=e.closest("table");var f=e.children(".tnpc-block-content");a.hasClass("tnpc-row-block")&&(b={action:"tnpc_render",b:a.data("id"),full:1,_wpnonce:tnp_nonce,options:{inline_edits:[{type:b,post_id:c,content:d}]},encoded_options:f.data("json")},tnpc_add_global_options(b),jQuery.post(ajaxurl,b,function(a){new_row=jQuery(a);e.before(new_row);e.remove();new_row.add_delete();new_row.add_block_edit();new_row.add_block_clone();new_row.hasClass("tnpc-row-block")&&new_row.find(".tnpc-row-edit-block").click();
25
+ tnpc_mobile_preview()}).fail(function(){alert("Block rendering failed.")}))}var d=[];return{init:function(){jQuery("#newsletter-builder-area-center-frame-content").on("click",".tnpc-inline-editable",function(g){g.preventDefault();a();var h=jQuery(this).hide(),f=jQuery(b(this.innerText.trim(),this.dataset.id,this.dataset.type)).insertAfter(this);d.push({originalEl:h,newEl:f});jQuery(".tnpc-inline-editable-form-"+this.dataset.type+this.dataset.id).on("submit",function(a){var b=jQuery(h);a.preventDefault();
26
+ a=f.find("form input[name=id]").val();var d=f.find("form input[name=type]").val(),g=f.find('form [name="new_name"]').val();c(b,d,a,g);f.remove();b.show()});jQuery(".tnpc-inline-editable-form-actions .tnpc-dismiss-"+this.dataset.type+this.dataset.id).on("click",function(b){a()})});jQuery("#newsletter-builder-area-center-frame-content").on("click",function(b){0<d.length&&!jQuery(b.target).hasClass("tnpc-inline-editable")&&0===jQuery(b.target).closest(".tnpc-inline-editable-container").length&&a()})}}})().init()});
emails/tnp-composer/_scripts/tnp-toast.js ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const TnpToast = (function () { //Module pattern mi permette di rendere private le DEFAULT_OPTIONS e funzione di _render
2
+ 'use strict';
3
+
4
+ const DEFAULT_OPTIONS = {
5
+ duration: 2000,
6
+ position: 'bottom right',
7
+ wrapperPadding: '20px'
8
+ };
9
+
10
+ //Constructor function (mi permette di creare uno scope)
11
+ function TnpToast(options) {
12
+
13
+ this._options = Object.assign({}, DEFAULT_OPTIONS, options);
14
+ this._mainWrapperElement = null;
15
+
16
+ this._render = function (message, type) {
17
+
18
+ if (!this._mainWrapperElement) {
19
+ this._createMainWrapper();
20
+ }
21
+
22
+ const columnDirection = this._getNotificationColumnDirectionClassName();
23
+
24
+ const notificationElement = document.createElement('div');
25
+ notificationElement.className = `notification notification-${type} ${columnDirection}` + ' ' + this._getNotificationShowAnimationClassName();
26
+ notificationElement.append(message);
27
+
28
+ this._mainWrapperElement.appendChild(notificationElement);
29
+
30
+ setTimeout(() => {
31
+ this._removeNotification(notificationElement)
32
+ }, this._options.duration);
33
+
34
+ }
35
+
36
+ this._removeNotification = function (notificationElement) {
37
+ notificationElement.className = notificationElement.className + ' ' + this._getNotificationRemoveAnimationClassName();
38
+ setTimeout(() => {
39
+ this._mainWrapperElement.removeChild(notificationElement);
40
+ }, 1000);
41
+ }
42
+
43
+ this._createMainWrapper = function () {
44
+ this._mainWrapperElement = document.createElement('div');
45
+ this._mainWrapperElement.className = 'tnp-toast-main-wrapper';
46
+ this._mainWrapperElement.style.padding = this._options.wrapperPadding;
47
+
48
+ const alignments = this._getFlexboxAlignments();
49
+ for (let alignmentProperty of Object.keys(alignments)) {
50
+ this._mainWrapperElement.style[alignmentProperty] = alignments[alignmentProperty];
51
+ }
52
+
53
+ const columnDirection = this._getNotificationColumnDirectionClassName();
54
+ if (columnDirection === 'top-to-bottom') {
55
+ this._mainWrapperElement.style.flexDirection = 'column-reverse';
56
+ }
57
+
58
+ document.body.appendChild(this._mainWrapperElement);
59
+ }
60
+
61
+ this._getFlexboxAlignments = function () {
62
+ const position = this._options.position;
63
+ const spatialPositions = position.split(' ');
64
+ const flexAlignments = {}
65
+ for (let pos of spatialPositions) {
66
+ if (pos === 'top') {
67
+ flexAlignments.justifyContent = 'flex-end'; //poi aggiungo flex-direction: column-reverse;
68
+ } else if (pos === 'bottom') {
69
+ flexAlignments.justifyContent = 'flex-end';
70
+ } else if (pos === 'left') {
71
+ flexAlignments.alignItems = 'flex-start';
72
+ } else if (pos === 'right') {
73
+ flexAlignments.alignItems = 'flex-end';
74
+ }
75
+ }
76
+ return flexAlignments;
77
+ }
78
+
79
+ this._getNotificationColumnDirectionClassName = function () {
80
+ const position = this._options.position;
81
+
82
+ return position.includes('top') ? 'top-to-bottom' : 'bottom-to-top';
83
+ }
84
+
85
+ this._getNotificationShowAnimationClassName = function () {
86
+ const position = this._options.position;
87
+
88
+ return position.includes('top') ? 'push-down' : 'push-up';
89
+ }
90
+
91
+ this._getNotificationRemoveAnimationClassName = function () {
92
+ const position = this._options.position;
93
+
94
+ return position.includes('top') ? 'pop-up' : 'pop-down';
95
+ }
96
+
97
+ }
98
+
99
+ TnpToast.prototype.error = function (message) {
100
+ this._render(message, 'error');
101
+ }
102
+
103
+ TnpToast.prototype.success = function (message) {
104
+ this._render(message, 'success');
105
+ }
106
+
107
+ TnpToast.prototype.info = function (message) {
108
+ this._render(message, 'info');
109
+ }
110
+
111
+ TnpToast.prototype.warning = function (message) {
112
+ this._render(message, 'warning');
113
+ }
114
+
115
+ return TnpToast;
116
+
117
+ })();
118
+
119
+ window.TnpToast = TnpToast;
120
+
121
+ /*
122
+ //ESEMPIO UTILIZZO API TnpToast
123
+
124
+ const toastTop = new TnpToast({duration: 5000, position: 'bottom right', wrapperPadding: '70px 20px'});
125
+
126
+ setTimeout(function () {
127
+ toastTop.info('messaggio di info');
128
+ }, 3000);
129
+
130
+ setTimeout(function () {
131
+ toastTop.error('messaggio di errore');
132
+ }, 5000);
133
+
134
+ */
135
+
136
+
137
+
138
+
emails/tnp-composer/css/newsletter.css CHANGED
@@ -55,6 +55,25 @@ img.aligncenter{display:block;margin:0 auto;}
55
  width:100%!important;
56
  max-width: 100%!important;
57
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
  /* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */
60
  td[class="padding"]{
55
  width:100%!important;
56
  max-width: 100%!important;
57
  }
58
+
59
+ table[class="responsive"]{
60
+ width:100%!important;
61
+ max-width: 100%!important;
62
+ }
63
+
64
+ img.responsive {
65
+ width:100%!important;
66
+ max-width: 100%!important;
67
+ }
68
+
69
+ .block {
70
+ display: block;
71
+ }
72
+
73
+ td[class="responsive"]{
74
+ width:100%!important;
75
+ max-width: 100%!important;
76
+ }
77
 
78
  /* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */
79
  td[class="padding"]{
emails/tnp-composer/css/newsletter.min.css CHANGED
@@ -1 +1 @@
1
- #outlook a{padding:0}.ReadMsgBody{width:100%}.ExternalClass{width:100%}.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div{line-height:100%}body,table,td,a{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}table,td{mso-table-lspace:0;mso-table-rspace:0}img{-ms-interpolation-mode:bicubic}body{margin:0;padding:0;height:100%!important;margin:0;padding:0;width:100%!important}img{border:0;height:auto;line-height:100%;outline:0;text-decoration:none;max-width:100%!important}table{border-collapse:collapse!important}img.aligncenter{display:block;margin:0 auto}@media all and (max-width:525px){table[class="wrapper"]{width:100%!important}table[class="mobile-full-width"]{width:100%!important}img[class="mobile-full-width"]{width:100%!important;display:block}td[class="logo"]{text-align:left;padding:20px 0 20px 0!important}td[class="logo"] img{margin:0 auto!important}td[class="mobile-hide"]{display:none}img[class="mobile-hide"]{display:none!important}img[class="img-max"]{max-width:100%!important;height:auto!important}table[class="responsive-table"]{width:100%!important;max-width:100%!important}td[class="padding"]{padding:10px 5% 15px 5%!important}td[class="padding-copy"]{padding:10px 5% 10px 5%!important;text-align:center}td[class="padding-meta"]{padding:30px 5% 0 5%!important;text-align:center}td[class="no-pad"]{padding:0 0 20px 0!important}td[class="no-padding"]{padding:0!important}td[class="section-padding"]{padding:50px 15px 50px 15px!important}td[class="section-padding-bottom-image"]{padding:50px 15px 0 15px!important}td[class="mobile-wrapper"]{padding:10px 5% 15px 5%!important}td[class="responsive"]{display:block;width:100%!important}table[class="mobile-button-container"]{margin:0 auto;width:100%!important}a[class="mobile-button"]{width:80%!important;padding:15px!important;border:0!important;font-size:16px!important}}
1
+ #outlook a{padding:0}.ReadMsgBody{width:100%}.ExternalClass{width:100%}.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div{line-height:100%}body,table,td,a{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}table,td{mso-table-lspace:0;mso-table-rspace:0}img{-ms-interpolation-mode:bicubic}body{margin:0;padding:0;height:100%!important;margin:0;padding:0;width:100%!important}img{border:0;height:auto;line-height:100%;outline:0;text-decoration:none;max-width:100%!important}table{border-collapse:collapse!important}img.aligncenter{display:block;margin:0 auto}@media all and (max-width:525px){table[class="wrapper"]{width:100%!important}table[class="mobile-full-width"]{width:100%!important}img[class="mobile-full-width"]{width:100%!important;display:block}td[class="logo"]{text-align:left;padding:20px 0 20px 0!important}td[class="logo"] img{margin:0 auto!important}td[class="mobile-hide"]{display:none}img[class="mobile-hide"]{display:none!important}img[class="img-max"]{max-width:100%!important;height:auto!important}table[class="responsive-table"]{width:100%!important;max-width:100%!important}table[class="responsive"]{width:100%!important;max-width:100%!important}img.responsive{width:100%!important;max-width:100%!important}.block{display:block}td[class="responsive"]{width:100%!important;max-width:100%!important}td[class="padding"]{padding:10px 5% 15px 5%!important}td[class="padding-copy"]{padding:10px 5% 10px 5%!important;text-align:center}td[class="padding-meta"]{padding:30px 5% 0 5%!important;text-align:center}td[class="no-pad"]{padding:0 0 20px 0!important}td[class="no-padding"]{padding:0!important}td[class="section-padding"]{padding:50px 15px 50px 15px!important}td[class="section-padding-bottom-image"]{padding:50px 15px 0 15px!important}td[class="mobile-wrapper"]{padding:10px 5% 15px 5%!important}table[class="mobile-button-container"]{margin:0 auto;width:100%!important}a[class="mobile-button"]{width:80%!important;padding:15px!important;border:0!important;font-size:16px!important}}
emails/tnp-composer/index-v2.php CHANGED
@@ -2,7 +2,6 @@
2
  /**
3
  * This file is included by NewsletterControls to create the composer.
4
  */
5
-
6
  /* @var $this NewsletterControls */
7
 
8
  defined('ABSPATH') || exit;
@@ -26,6 +25,10 @@ $block_options = get_option('newsletter_main');
26
 
27
  $fields = new NewsletterFields($controls);
28
  ?>
 
 
 
 
29
  <style>
30
  .placeholder {
31
  border: 3px dashed #ddd!important;
@@ -43,16 +46,29 @@ $fields = new NewsletterFields($controls);
43
  <style>
44
  <?php echo NewsletterEmails::instance()->get_composer_css(); ?>
45
  </style>
46
-
47
  <div id="newsletter-builder">
48
 
49
  <div id="newsletter-builder-area" class="tnp-builder-column">
50
 
51
  <?php if ($tnpc_show_subject) { ?>
52
- <p>
53
- <?php $this->text('title', 60, 'Newsletter subject'); ?>
54
- <a href="#" class="tnp-suggest-button" onclick="tnp_suggest_subject(); return false;"><?php _e('Get ideas', 'newsletter') ?></a>
55
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  <?php } ?>
57
 
58
  <div id="newsletter-builder-area-center-frame-content">
@@ -62,14 +78,14 @@ $fields = new NewsletterFields($controls);
62
  </div>
63
  </div>
64
 
65
- <div id="newsletter-builder-sidebar" class="tnp-builder-column">
66
 
67
  <div class="tnpc-tabs">
68
- <button class="tablinks" onclick="openTab(event, 'tnpc-blocks')" id="defaultOpen"><?php _e('Blocks', 'newsletter') ?></button>
69
- <button class="tablinks" onclick="openTab(event, 'tnpc-global-styles')"><?php _e('Global Styles', 'newsletter') ?></button>
70
- <button class="tablinks" onclick="openTab(event, 'tnpc-mobile-tab')"><i class="fas fa-mobile"></i> <?php _e('Mobile Preview', 'newsletter') ?></button>
71
  <?php if ($show_test) { ?>
72
- <button class="tablinks" onclick="openTab(event, 'tnpc-test-tab')"><i class="fas fa-paper-plane"></i> <?php _e('Test', 'newsletter') ?></button>
73
  <?php } ?>
74
 
75
  </div>
@@ -91,8 +107,25 @@ $fields = new NewsletterFields($controls);
91
 
92
  <form id="tnpc-global-styles-form">
93
 
94
- <?php $fields->color( 'options_composer_background', __( 'Background color', 'newsletter' ), [ 'default' => '#FFFFFF' ] ) ?>
95
- <?php $fields->text( 'options_preheader', __( 'Snippet', 'newsletter' ), ['description'=>'Short content preview shown by Gmail']) ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  </form>
98
 
@@ -127,7 +160,6 @@ $fields = new NewsletterFields($controls);
127
  <span id="tnpc-block-options-save" class="button-primary"><?php _e("Apply", "newsletter") ?></span>
128
  </div>
129
  <form id="tnpc-block-options-form" onsubmit="return false;"></form>
130
-
131
  </div>
132
 
133
  </div>
@@ -147,8 +179,11 @@ $fields = new NewsletterFields($controls);
147
  TNP_PLUGIN_URL = "<?php echo esc_js(NEWSLETTER_URL) ?>";
148
  TNP_HOME_URL = "<?php echo esc_js(home_url('/', is_ssl() ? 'https' : 'http')) ?>";
149
  tnp_context_type = "<?php echo esc_js($context_type) ?>";
150
- tnp_nonce = '<?php echo esc_js(wp_create_nonce('save'))?>';
 
151
  </script>
 
 
152
  <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/newsletter-builder-v2.js?ver=<?php echo time() ?>"></script>
153
 
154
  <?php include NEWSLETTER_DIR . '/emails/subjects.php'; ?>
2
  /**
3
  * This file is included by NewsletterControls to create the composer.
4
  */
 
5
  /* @var $this NewsletterControls */
6
 
7
  defined('ABSPATH') || exit;
25
 
26
  $fields = new NewsletterFields($controls);
27
  ?>
28
+ <script type="text/javascript">
29
+ // collapse wp menu
30
+ document.body.classList.add('folded');
31
+ </script>
32
  <style>
33
  .placeholder {
34
  border: 3px dashed #ddd!important;
46
  <style>
47
  <?php echo NewsletterEmails::instance()->get_composer_css(); ?>
48
  </style>
 
49
  <div id="newsletter-builder">
50
 
51
  <div id="newsletter-builder-area" class="tnp-builder-column">
52
 
53
  <?php if ($tnpc_show_subject) { ?>
54
+ <div id="tnpc-subject-wrap">
55
+ <table role="presentation" style="width: 100%">
56
+ <tr>
57
+ <th>From</th>
58
+ <td style="text-align: left"><?php echo esc_html(Newsletter::instance()->options['sender_email']) ?></td>
59
+ </tr>
60
+ <tr>
61
+ <th>Subject</th>
62
+ <td style="text-align: left">
63
+ <div id="tnpc-subject">
64
+ <?php $this->subject('title'); ?>
65
+ </div>
66
+ </td>
67
+
68
+ </tr>
69
+ </table>
70
+
71
+ </div>
72
  <?php } ?>
73
 
74
  <div id="newsletter-builder-area-center-frame-content">
78
  </div>
79
  </div>
80
 
81
+ <div id="newsletter-builder-sidebar">
82
 
83
  <div class="tnpc-tabs">
84
+ <button class="tablinks" onclick="openTab(event, 'tnpc-blocks')" data-tab-id='tnpc-blocks' id="defaultOpen"><?php _e('Blocks', 'newsletter') ?></button>
85
+ <button class="tablinks" onclick="openTab(event, 'tnpc-global-styles')" data-tab-id='tnpc-global-styles'><?php _e('Settings', 'newsletter') ?></button>
86
+ <button class="tablinks" onclick="openTab(event, 'tnpc-mobile-tab')" data-tab-id='tnpc-mobile-tab'><i class="fas fa-mobile"></i> <?php _e('Mobile', 'newsletter') ?></button>
87
  <?php if ($show_test) { ?>
88
+ <button class="tablinks" onclick="openTab(event, 'tnpc-test-tab')" data-tab-id='tnpc-test-tab'><i class="fas fa-paper-plane"></i> <?php _e('Test', 'newsletter') ?></button>
89
  <?php } ?>
90
 
91
  </div>
107
 
108
  <form id="tnpc-global-styles-form">
109
 
110
+ <?php //$fields->section('Colors') ?>
111
+
112
+ <div class="tnp-field-row">
113
+ <div class="tnp-field-col-2">
114
+ <?php $fields->color('options_composer_background', __('Main background', 'newsletter')) ?>
115
+ </div>
116
+ <div class="tnp-field-col-2">
117
+ <?php $fields->color('options_composer_block_background', 'Blocks background') ?>
118
+ </div>
119
+ </div>
120
+
121
+ <?php //$fields->section('Fonts are applied to new blocks or when refreshed') ?>
122
+ <?php $fields->font( 'options_composer_title_font', __( 'Titles font', 'newsletter' ) ) ?>
123
+ <?php $fields->font( 'options_composer_text_font', __( 'Text font', 'newsletter' ) ) ?>
124
+ <?php $fields->button_style( 'options_composer_button', __( 'Button style', 'newsletter' ) ); ?>
125
+
126
+ <?php $fields->textarea('options_preheader', __('Snippet', 'newsletter'), ['description'=>'Show by some email clients as excerpt', 'height'=>'70']) ?>
127
+
128
+ <button class="button-secondary" name="apply"><?php _e("Apply", 'newsletter') ?></button>
129
 
130
  </form>
131
 
160
  <span id="tnpc-block-options-save" class="button-primary"><?php _e("Apply", "newsletter") ?></span>
161
  </div>
162
  <form id="tnpc-block-options-form" onsubmit="return false;"></form>
 
163
  </div>
164
 
165
  </div>
179
  TNP_PLUGIN_URL = "<?php echo esc_js(NEWSLETTER_URL) ?>";
180
  TNP_HOME_URL = "<?php echo esc_js(home_url('/', is_ssl() ? 'https' : 'http')) ?>";
181
  tnp_context_type = "<?php echo esc_js($context_type) ?>";
182
+ tnp_nonce = '<?php echo esc_js(wp_create_nonce('save')) ?>';
183
+ tnp_preset_nonce = '<?php echo esc_js(wp_create_nonce('preset')) ?>';
184
  </script>
185
+ <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/modal.js?ver=<?php echo time() ?>"></script>
186
+ <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/tnp-toast.js?ver=<?php echo time() ?>"></script>
187
  <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/newsletter-builder-v2.js?ver=<?php echo time() ?>"></script>
188
 
189
  <?php include NEWSLETTER_DIR . '/emails/subjects.php'; ?>
images/subject/android.png ADDED
Binary file
images/subject/gmail.png ADDED
Binary file
images/subject/iphone.png ADDED
Binary file
includes/addon.php CHANGED
@@ -55,6 +55,14 @@ class NewsletterAddon {
55
  function is_allowed() {
56
  return Newsletter::instance()->is_allowed();
57
  }
 
 
 
 
 
 
 
 
58
 
59
  /**
60
  * General logger for this add-on.
55
  function is_allowed() {
56
  return Newsletter::instance()->is_allowed();
57
  }
58
+
59
+ function get_languages() {
60
+ return Newsletter::instance()->get_languages();
61
+ }
62
+
63
+ function is_multilanguage() {
64
+ return Newsletter::instance()->is_multilanguage();
65
+ }
66
 
67
  /**
68
  * General logger for this add-on.
includes/composer.php CHANGED
@@ -91,24 +91,24 @@ class TNP_Composer {
91
  $open .= "\n</style>\n";
92
  $open .= "</head>\n";
93
  $open .= '<body style="margin: 0; padding: 0;" dir="' . (is_rtl() ? 'rtl' : 'ltr') . '">';
94
- $open .= "\n";
95
- $open .= self::get_html_preheader( $email );
96
 
97
  return $open;
98
  }
99
 
100
- static private function get_html_preheader( $email ) {
101
 
102
- if ( empty ( $email->options['preheader'] ) ) {
103
- return "";
104
- }
105
 
106
- $preheader_text = $email->options['preheader'];
107
- $html = "<div style=\"display:none;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;\">$preheader_text</div>";
108
- $html .= "\n";
109
 
110
- return $html;
111
- }
112
 
113
  static function get_html_close($email) {
114
  return "</body>\n</html>";
@@ -219,6 +219,7 @@ class TNP_Composer {
219
  * @param TNP_Email $email
220
  */
221
  static function prepare_controls($controls, $email) {
 
222
  foreach ($email->options as $name => $value) {
223
  //if (strpos($name, 'composer_') === 0) {
224
  $controls->data['options_' . $name] = $value;
@@ -227,6 +228,9 @@ class TNP_Composer {
227
 
228
  $controls->data['message'] = TNP_Composer::unwrap_email($email->message);
229
  $controls->data['subject'] = $email->subject;
 
 
 
230
  }
231
 
232
  /**
@@ -288,6 +292,7 @@ class TNP_Composer {
288
  * @return string
289
  */
290
  static function button($options, $prefix = 'button') {
 
291
  $defaults = [
292
  $prefix . '_url' => '#',
293
  $prefix . '_font_family' => 'Helvetica, Arial, sans-serif',
@@ -296,11 +301,19 @@ class TNP_Composer {
296
  $prefix . '_font_weight' => 'bold',
297
  $prefix . '_font_size' => 20,
298
  $prefix . '_background' => '#256F9C',
 
299
  ];
300
 
301
- $options = array_merge($defaults, $options);
302
 
303
- $b = '<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse:separate;line-height:100%;">';
 
 
 
 
 
 
 
304
  $b .= '<tr>';
305
  $b .= '<td align="center" bgcolor="' . $options[$prefix . '_background'] . '" role="presentation" style="border:none;border-radius:3px;cursor:auto;mso-padding-alt:10px 25px;background:' . $options[$prefix . '_background'] . '" valign="middle">';
306
  $b .= '<a href="' . $options[$prefix . '_url'] . '"';
@@ -353,9 +366,12 @@ class TNP_Composer {
353
 
354
  if ( $media ) {
355
  $b .= '<img src="' . $media->url . '" width="' . $media->width . '"'
356
- . ' height="' . $media->height . '"'
357
  . ' alt="' . esc_attr( $media->alt ) . '"'
358
- . ' border="0" ' . $styling . '>';
 
 
 
359
  }
360
 
361
  if ($media->link) {
@@ -401,6 +417,58 @@ class TNP_Composer {
401
  return false;
402
  }
403
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  }
405
 
406
  /**
@@ -589,19 +657,52 @@ class TNP_Composer_Grid_Cell {
589
  cellspacing='0'
590
  width='TNP_WIDTH_PH'
591
  align='left'
 
592
  class='responsive-table'>
593
  <tbody>
594
- <tr>
595
- <td border='0'
596
- style='padding: 20px 10px 40px;'
597
- align='TNP_ALIGN_PH'
598
- valign='TNP_VALIGN_PH'
599
- class='TNP_CLASS_PH'>
600
- TNP_COLUMN_CONTENT_PH
601
- </td>
602
- </tr>
603
  </tbody>
604
  </table>";
605
  }
606
 
607
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  $open .= "\n</style>\n";
92
  $open .= "</head>\n";
93
  $open .= '<body style="margin: 0; padding: 0;" dir="' . (is_rtl() ? 'rtl' : 'ltr') . '">';
94
+ $open .= "\n";
95
+ $open .= self::get_html_preheader($email);
96
 
97
  return $open;
98
  }
99
 
100
+ static private function get_html_preheader($email) {
101
 
102
+ if (empty($email->options['preheader'])) {
103
+ return "";
104
+ }
105
 
106
+ $preheader_text = $email->options['preheader'];
107
+ $html = "<div style=\"display:none;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;\">$preheader_text</div>";
108
+ $html .= "\n";
109
 
110
+ return $html;
111
+ }
112
 
113
  static function get_html_close($email) {
114
  return "</body>\n</html>";
219
  * @param TNP_Email $email
220
  */
221
  static function prepare_controls($controls, $email) {
222
+
223
  foreach ($email->options as $name => $value) {
224
  //if (strpos($name, 'composer_') === 0) {
225
  $controls->data['options_' . $name] = $value;
228
 
229
  $controls->data['message'] = TNP_Composer::unwrap_email($email->message);
230
  $controls->data['subject'] = $email->subject;
231
+
232
+ $controls->data = array_merge( TNP_Composer::get_global_style_defaults(), $controls->data );
233
+
234
  }
235
 
236
  /**
292
  * @return string
293
  */
294
  static function button($options, $prefix = 'button') {
295
+
296
  $defaults = [
297
  $prefix . '_url' => '#',
298
  $prefix . '_font_family' => 'Helvetica, Arial, sans-serif',
301
  $prefix . '_font_weight' => 'bold',
302
  $prefix . '_font_size' => 20,
303
  $prefix . '_background' => '#256F9C',
304
+ $prefix . '_align' => 'center'
305
  ];
306
 
307
+ $options = array_merge($defaults, array_filter($options));
308
 
309
+ $b = '<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse:separate;line-height:100%;"';
310
+ if (!empty($options[$prefix . '_align'])) {
311
+ $b .= ' align="' . esc_attr($options[$prefix . '_align']) . '"';
312
+ }
313
+ if (!empty($options[$prefix . '_width'])) {
314
+ $b .= ' width="' . esc_attr($options[$prefix . '_width']) . '"';
315
+ }
316
+ $b .= '>';
317
  $b .= '<tr>';
318
  $b .= '<td align="center" bgcolor="' . $options[$prefix . '_background'] . '" role="presentation" style="border:none;border-radius:3px;cursor:auto;mso-padding-alt:10px 25px;background:' . $options[$prefix . '_background'] . '" valign="middle">';
319
  $b .= '<a href="' . $options[$prefix . '_url'] . '"';
366
 
367
  if ( $media ) {
368
  $b .= '<img src="' . $media->url . '" width="' . $media->width . '"'
369
+ . ' height="auto"'
370
  . ' alt="' . esc_attr( $media->alt ) . '"'
371
+ . ' border="0" '
372
+ . $styling
373
+ . ' class="responsive" '
374
+ . '>';
375
  }
376
 
377
  if ($media->link) {
417
  return false;
418
  }
419
 
420
+ static function post_content($post) {
421
+ $content = $post->post_content;
422
+ $content = wpautop( $content );
423
+ if ( true || $options['enable shortcodes'] ) {
424
+ remove_shortcode( 'gallery' );
425
+ add_shortcode( 'gallery', 'tnp_gallery_shortcode' );
426
+ $content = do_shortcode( $content );
427
+ }
428
+ $content = str_replace( '<p>', '<p class="paragraph">', $content );
429
+
430
+ $selected_images = array();
431
+ if ( preg_match_all( '/<img [^>]+>/', $content, $matches ) ) {
432
+ foreach ( $matches[0] as $image ) {
433
+ if ( preg_match( '/wp-image-([0-9]+)/i', $image, $class_id ) && ( $attachment_id = absint( $class_id[1] ) ) ) {
434
+ $selected_images[ $image ] = $attachment_id;
435
+ }
436
+ }
437
+ }
438
+
439
+ foreach ( $selected_images as $image => $attachment_id ) {
440
+ $src = tnp_media_resize( $attachment_id, array( 600, 0 ) );
441
+ if ( is_wp_error( $src ) ) {
442
+ continue;
443
+ }
444
+ $content = str_replace( $image, '<img src="' . $src . '" width="600" style="max-width: 100%">', $content );
445
+ }
446
+
447
+ return $content;
448
+ }
449
+
450
+ static function get_global_style_defaults() {
451
+ return [
452
+ 'options_composer_title_font_family' => 'Verdana, Geneva, sans-serif',
453
+ 'options_composer_title_font_size' => 36,
454
+ 'options_composer_title_font_weight' => 'bold',
455
+ 'options_composer_title_font_color' => '#222222',
456
+
457
+ 'options_composer_text_font_family' => 'Verdana, Geneva, sans-serif',
458
+ 'options_composer_text_font_size' => 16,
459
+ 'options_composer_text_font_weight' => 'normal',
460
+ 'options_composer_text_font_color' => '#222222',
461
+
462
+ 'options_composer_button_font_family' => 'Verdana, Geneva, sans-serif',
463
+ 'options_composer_button_font_size' => 16,
464
+ 'options_composer_button_font_weight' => 'bold',
465
+ 'options_composer_button_font_color' => '#FFFFFF',
466
+ 'options_composer_button_background_color' => '#256F9C',
467
+
468
+ 'options_composer_background' => '#FFFFFF',
469
+ 'options_composer_block_background' => '#FFFFFF',
470
+ ];
471
+ }
472
  }
473
 
474
  /**
657
  cellspacing='0'
658
  width='TNP_WIDTH_PH'
659
  align='left'
660
+ style='table-layout: fixed;'
661
  class='responsive-table'>
662
  <tbody>
663
+ <tr>
664
+ <td border='0'
665
+ style='padding: 20px 10px 40px;'
666
+ align='TNP_ALIGN_PH'
667
+ valign='TNP_VALIGN_PH'
668
+ class='TNP_CLASS_PH'>
669
+ TNP_COLUMN_CONTENT_PH
670
+ </td>
671
+ </tr>
672
  </tbody>
673
  </table>";
674
  }
675
 
676
  }
677
+
678
+ class TNP_Composer_Component_Factory {
679
+
680
+ private $options;
681
+
682
+ /**
683
+ * TNP_Composer_Component_Factory constructor.
684
+ *
685
+ * @param Controller$controller
686
+ */
687
+ public function __construct($controller) {
688
+ }
689
+
690
+ function heading() {
691
+ }
692
+
693
+ function paragraph() {
694
+
695
+ }
696
+
697
+ function link() {
698
+
699
+ }
700
+
701
+ function button() {
702
+ }
703
+
704
+ function image() {
705
+
706
+ }
707
+
708
+ }
includes/controls.php CHANGED
@@ -10,10 +10,12 @@ class NewsletterControls {
10
  var $action = false;
11
  var $button_data = '';
12
  var $errors = '';
 
13
  /**
14
  * @var string
15
  */
16
  var $messages = '';
 
17
  /**
18
  * @var array
19
  */
@@ -299,7 +301,7 @@ class NewsletterControls {
299
  // GMT 0 and then we subtract the GMT offset (the example date and time on GMT+2 happens
300
  // "before").
301
 
302
- $time = gmmktime((int)$_REQUEST[$name . '_hour'], 0, 0, (int)$_REQUEST[$name . '_month'], (int)$_REQUEST[$name . '_day'], (int)$_REQUEST[$name . '_year']);
303
  $time -= get_option('gmt_offset') * 3600;
304
  $this->data[$name] = $time;
305
  }
@@ -427,7 +429,7 @@ class NewsletterControls {
427
  }
428
  $this->warnings[] = 'You are configuring the language <strong>' . $newsletter->get_language_label($current_language) . '</strong>. Switch to "all languages" to see all options.';
429
  }
430
-
431
  function switch_to_all_languages_notice() {
432
  echo '<div class="tnp-control-all-languages-notice">';
433
  _e('Switch the administration side to "all languages" to set these options', 'newsletter');
@@ -697,9 +699,9 @@ class NewsletterControls {
697
 
698
  foreach ($options as $key => $data) {
699
  echo '<option value="' . esc_attr($key) . '"';
700
- if ( is_array( $value ) && in_array( $key, $value ) || ( ! is_null( $value ) && $value == $key ) ) {
701
- echo ' selected';
702
- }
703
  echo '>' . esc_html($data) . '</option>';
704
  }
705
 
@@ -816,11 +818,12 @@ class NewsletterControls {
816
  echo '<input name="options[', esc_attr($name), ']" id="options-', esc_attr($name), '" type="hidden" value="', esc_attr($value), '">';
817
  }
818
 
819
- function button($action, $label, $function = null) {
 
820
  if ($function != null) {
821
- echo '<input class="button-secondary" type="button" value="' . esc_attr($label) . '" onclick="this.form.act.value=\'' . esc_attr($action) . '\';' . esc_html($function) . '"/>';
822
  } else {
823
- echo '<input class="button-secondary" type="submit" value="' . esc_attr($label) . '" onclick="this.form.act.value=\'' . esc_attr($action) . '\';return true;"/>';
824
  }
825
  }
826
 
@@ -879,10 +882,10 @@ class NewsletterControls {
879
  echo '>';
880
  echo '<i class="fas fa-copy"></i>';
881
  if (is_null($label)) {
882
- echo ' ', esc_html(__('Duplicate', 'newsletter'));
883
  } else {
884
  if (!empty($label)) {
885
- echo ' ' , $label;
886
  }
887
  }
888
  echo '</button>';
@@ -898,10 +901,10 @@ class NewsletterControls {
898
  echo '>';
899
  echo '<i class="fas fa-vial"></i>';
900
  if (is_null($label)) {
901
- echo ' ', esc_html(__('Run a test', 'newsletter'));
902
  } else {
903
  if (!empty($label)) {
904
- echo ' ' , $label;
905
  }
906
  }
907
  echo '</button>';
@@ -921,10 +924,10 @@ class NewsletterControls {
921
  echo '>';
922
  echo '<i class="fas fa-times"></i>';
923
  if (is_null($label)) {
924
- echo ' ' , esc_html(__('Delete', 'newsletter'));
925
  } else {
926
  if (!empty($label)) {
927
- echo ' ' , $label;
928
  }
929
  }
930
  echo '</button>';
@@ -1211,7 +1214,7 @@ class NewsletterControls {
1211
  $lists = $this->get_list_options($empty_label);
1212
  $this->select($name, $lists);
1213
  }
1214
-
1215
  function public_lists_select($name = 'list', $empty_label = null) {
1216
  $lists = $this->get_public_list_options($empty_label);
1217
  $this->select($name, $lists);
@@ -1233,7 +1236,7 @@ class NewsletterControls {
1233
  }
1234
  return $lists;
1235
  }
1236
-
1237
  function get_public_list_options($empty_label = null) {
1238
  $objs = Newsletter::instance()->get_lists_public();
1239
  $lists = array();
@@ -1244,7 +1247,7 @@ class NewsletterControls {
1244
  $lists['' . $list->id] = '(' . $list->id . ') ' . esc_html($list->name);
1245
  }
1246
  return $lists;
1247
- }
1248
 
1249
  function date($name) {
1250
  $this->hidden($name);
@@ -1285,7 +1288,7 @@ class NewsletterControls {
1285
 
1286
  /**
1287
  * Creates a set of fields to collect a date and sends back the triplet year, month and day.
1288
- *
1289
  * @param string $name
1290
  */
1291
  function date2($name) {
@@ -1326,13 +1329,13 @@ class NewsletterControls {
1326
  }
1327
  echo '</select>';
1328
  }
1329
-
1330
  /**
1331
  * Date and time (hour) selector. Timestamp stored.
1332
  */
1333
  function datetime($name) {
1334
  echo '<input type="hidden" name="tnp_fields[' . esc_attr($name) . ']" value="datetime">';
1335
- $value = (int)$this->get_value($name);
1336
  if (empty($value)) {
1337
  $value = time();
1338
  }
@@ -1417,6 +1420,8 @@ tnp_controls_init();
1417
  jQuery.cookie("' . $cookie_name . '", ui.newTab.index(),{expires: 1});
1418
  }
1419
  });
 
 
1420
  });
1421
  function newsletter_media(name) {
1422
  var tnp_uploader = wp.media({
@@ -1526,23 +1531,34 @@ tnp_controls_init();
1526
  * @param array $attrs
1527
  */
1528
  function css_font($name = 'font', $attrs = array()) {
1529
- $default = ['color' => true, 'weight' => true];
 
 
 
 
 
 
1530
  $attrs = array_merge($default, $attrs);
1531
- $this->css_font_family($name . '_family');
1532
- $this->css_font_size($name . '_size');
1533
- if ($attrs['weight']) {
1534
- $this->css_font_weight($name . '_weight');
1535
  }
1536
- if ($attrs['color']) {
 
 
 
1537
  $this->color($name . '_color');
1538
  }
1539
  }
1540
 
1541
- function css_font_size($name = 'font_size') {
1542
  $value = $this->get_value($name);
1543
 
1544
  echo '<select class="tnpf-font-size" id="options-', esc_attr($name), '" name="options[', esc_attr($name), ']">';
1545
- for ($i = 8; $i < 50; $i++) {
 
 
 
1546
  echo '<option value="' . $i . '"';
1547
  if ($value == $i) {
1548
  echo ' selected';
@@ -1552,12 +1568,15 @@ tnp_controls_init();
1552
  echo '</select>';
1553
  }
1554
 
1555
- function css_font_weight($name = 'font_weight') {
1556
  $value = $this->get_value($name);
1557
 
1558
  $fonts = array('normal' => 'Normal', 'bold' => 'Bold');
1559
 
1560
  echo '<select class="tnpf-font-weight" id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
 
 
 
1561
  foreach ($fonts as $key => $font) {
1562
  echo '<option value="', esc_attr($key), '"';
1563
  if ($value == $key) {
@@ -1568,18 +1587,23 @@ tnp_controls_init();
1568
  echo '</select>';
1569
  }
1570
 
1571
- function css_font_family($name = 'font_family') {
1572
  $value = $this->get_value($name);
1573
 
1574
- $fonts = array('Helvetica, Arial, sans-serif'=>'Helvetica, Arial',
1575
- 'Arial Black, Gadget, sans-serif'=>'Arial Black, Gadget',
1576
- 'Garamond, serif'=>'Garamond',
1577
- 'Courier, monospace'=>'Courier',
1578
- 'Comic Sans MS, cursive'=>'Comic Sans MS',
1579
- 'Impact, Charcoal, sans-serif'=>'Impact, Charcoal',
1580
- 'Tahoma, Geneva, sans-serif'=>'Tahoma, Geneva',
1581
- 'Times New Roman, Times, serif'=>'Times New Roman',
1582
- 'Verdana, Geneva, sans-serif'=>'Verdana, Geneva');
 
 
 
 
 
1583
 
1584
  echo '<select class="tnpf-font-family" id="options-', esc_attr($name), '" name="options[', esc_attr($name), ']">';
1585
  foreach ($fonts as $font=>$label) {
@@ -1744,13 +1768,12 @@ tnp_controls_init();
1744
 
1745
  static function delta_time($delta = 0) {
1746
  $seconds = $delta % 60;
1747
- $minutes = floor(($delta/60) % 60);
1748
- $hours = floor(($delta/(60*60)) % 24);
1749
- $days = floor($delta / (24*60*60));
1750
 
1751
 
1752
  return $days . ' day(s), ' . $hours . ' hour(s), ' . $minutes . ' minute(s)';
1753
-
1754
  }
1755
 
1756
  /**
@@ -1772,10 +1795,11 @@ tnp_controls_init();
1772
  $url = 'https://www.thenewsletterplugin.com' . $url;
1773
  }
1774
  echo '<a href="', $url, '" target="_blank" style="text-decoration: none" title="' . esc_attr(__('Read more', 'newsletter')) . '"><i class="fas fa-question-circle"></i>';
1775
- if ($text) echo '&nbsp;', $text;
 
1776
  echo '</a>';
1777
  }
1778
-
1779
  static function field_label($label, $help_url = false) {
1780
  echo $label;
1781
  if ($help_url) {
@@ -1894,9 +1918,25 @@ tnp_controls_init();
1894
  global $tnpc_show_subject;
1895
  $tnpc_show_subject = $show_subject;
1896
 
1897
- wp_enqueue_style('tnpc-style', plugins_url('newsletter') . '/emails/tnp-composer/_css/newsletter-builder-v2.css', array(), time());
 
 
 
1898
  $controls = $this;
1899
  include NEWSLETTER_DIR . '/emails/tnp-composer/index-v2.php';
1900
  }
1901
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1902
  }
10
  var $action = false;
11
  var $button_data = '';
12
  var $errors = '';
13
+
14
  /**
15
  * @var string
16
  */
17
  var $messages = '';
18
+
19
  /**
20
  * @var array
21
  */
301
  // GMT 0 and then we subtract the GMT offset (the example date and time on GMT+2 happens
302
  // "before").
303
 
304
+ $time = gmmktime((int) $_REQUEST[$name . '_hour'], 0, 0, (int) $_REQUEST[$name . '_month'], (int) $_REQUEST[$name . '_day'], (int) $_REQUEST[$name . '_year']);
305
  $time -= get_option('gmt_offset') * 3600;
306
  $this->data[$name] = $time;
307
  }
429
  }
430
  $this->warnings[] = 'You are configuring the language <strong>' . $newsletter->get_language_label($current_language) . '</strong>. Switch to "all languages" to see all options.';
431
  }
432
+
433
  function switch_to_all_languages_notice() {
434
  echo '<div class="tnp-control-all-languages-notice">';
435
  _e('Switch the administration side to "all languages" to set these options', 'newsletter');
699
 
700
  foreach ($options as $key => $data) {
701
  echo '<option value="' . esc_attr($key) . '"';
702
+ if (is_array($value) && in_array($key, $value) || (!is_null($value) && $value == $key )) {
703
+ echo ' selected';
704
+ }
705
  echo '>' . esc_html($data) . '</option>';
706
  }
707
 
818
  echo '<input name="options[', esc_attr($name), ']" id="options-', esc_attr($name), '" type="hidden" value="', esc_attr($value), '">';
819
  }
820
 
821
+ function button( $action, $label, $function = null, $id = '' ) {
822
+ $id = ! empty( $id ) ? " id=\"$id\" " : '';
823
  if ($function != null) {
824
+ echo '<input ' . $id . ' class="button-secondary" type="button" value="' . esc_attr($label) . '" onclick="this.form.act.value=\'' . esc_attr($action) . '\';' . esc_html($function) . '"/>';
825
  } else {
826
+ echo '<input ' . $id . ' class="button-secondary" type="submit" value="' . esc_attr($label) . '" onclick="this.form.act.value=\'' . esc_attr($action) . '\';return true;"/>';
827
  }
828
  }
829
 
882
  echo '>';
883
  echo '<i class="fas fa-copy"></i>';
884
  if (is_null($label)) {
885
+ echo ' ', esc_html(__('Duplicate', 'newsletter'));
886
  } else {
887
  if (!empty($label)) {
888
+ echo ' ', $label;
889
  }
890
  }
891
  echo '</button>';
901
  echo '>';
902
  echo '<i class="fas fa-vial"></i>';
903
  if (is_null($label)) {
904
+ echo ' ', esc_html(__('Run a test', 'newsletter'));
905
  } else {
906
  if (!empty($label)) {
907
+ echo ' ', $label;
908
  }
909
  }
910
  echo '</button>';
924
  echo '>';
925
  echo '<i class="fas fa-times"></i>';
926
  if (is_null($label)) {
927
+ echo ' ', esc_html(__('Delete', 'newsletter'));
928
  } else {
929
  if (!empty($label)) {
930
+ echo ' ', $label;
931
  }
932
  }
933
  echo '</button>';
1214
  $lists = $this->get_list_options($empty_label);
1215
  $this->select($name, $lists);
1216
  }
1217
+
1218
  function public_lists_select($name = 'list', $empty_label = null) {
1219
  $lists = $this->get_public_list_options($empty_label);
1220
  $this->select($name, $lists);
1236
  }
1237
  return $lists;
1238
  }
1239
+
1240
  function get_public_list_options($empty_label = null) {
1241
  $objs = Newsletter::instance()->get_lists_public();
1242
  $lists = array();
1247
  $lists['' . $list->id] = '(' . $list->id . ') ' . esc_html($list->name);
1248
  }
1249
  return $lists;
1250
+ }
1251
 
1252
  function date($name) {
1253
  $this->hidden($name);
1288
 
1289
  /**
1290
  * Creates a set of fields to collect a date and sends back the triplet year, month and day.
1291
+ *
1292
  * @param string $name
1293
  */
1294
  function date2($name) {
1329
  }
1330
  echo '</select>';
1331
  }
1332
+
1333
  /**
1334
  * Date and time (hour) selector. Timestamp stored.
1335
  */
1336
  function datetime($name) {
1337
  echo '<input type="hidden" name="tnp_fields[' . esc_attr($name) . ']" value="datetime">';
1338
+ $value = (int) $this->get_value($name);
1339
  if (empty($value)) {
1340
  $value = time();
1341
  }
1420
  jQuery.cookie("' . $cookie_name . '", ui.newTab.index(),{expires: 1});
1421
  }
1422
  });
1423
+ jQuery(".tnp-tabs").tabs({});
1424
+
1425
  });
1426
  function newsletter_media(name) {
1427
  var tnp_uploader = wp.media({
1531
  * @param array $attrs
1532
  */
1533
  function css_font($name = 'font', $attrs = array()) {
1534
+ $default = [
1535
+ 'color' => true,
1536
+ 'weight' => true,
1537
+ 'hide_size' => false,
1538
+ 'hide_weight' => false,
1539
+ 'hide_color' => false,
1540
+ ];
1541
  $attrs = array_merge($default, $attrs);
1542
+ $this->css_font_family($name . '_family', !empty($attrs['family_default']));
1543
+ if (!$attrs['hide_size']) {
1544
+ $this->css_font_size($name . '_size', !empty($attrs['size_default']));
 
1545
  }
1546
+ if ($attrs['weight'] && !$attrs['hide_weight']) {
1547
+ $this->css_font_weight($name . '_weight', !empty($attrs['weight_default']));
1548
+ }
1549
+ if ($attrs['color'] && !$attrs['hide_color']) {
1550
  $this->color($name . '_color');
1551
  }
1552
  }
1553
 
1554
+ function css_font_size($name = 'font_size', $show_empty_option = false) {
1555
  $value = $this->get_value($name);
1556
 
1557
  echo '<select class="tnpf-font-size" id="options-', esc_attr($name), '" name="options[', esc_attr($name), ']">';
1558
+ if ( $show_empty_option ) {
1559
+ echo "<option value=''>-</option>";
1560
+ }
1561
+ for ($i = 8; $i <= 50; $i++) {
1562
  echo '<option value="' . $i . '"';
1563
  if ($value == $i) {
1564
  echo ' selected';
1568
  echo '</select>';
1569
  }
1570
 
1571
+ function css_font_weight($name = 'font_weight', $show_empty_option = false) {
1572
  $value = $this->get_value($name);
1573
 
1574
  $fonts = array('normal' => 'Normal', 'bold' => 'Bold');
1575
 
1576
  echo '<select class="tnpf-font-weight" id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
1577
+ if ( $show_empty_option ) {
1578
+ echo "<option value=''>-</option>";
1579
+ }
1580
  foreach ($fonts as $key => $font) {
1581
  echo '<option value="', esc_attr($key), '"';
1582
  if ($value == $key) {
1587
  echo '</select>';
1588
  }
1589
 
1590
+ function css_font_family($name = 'font_family', $show_empty_option = false) {
1591
  $value = $this->get_value($name);
1592
 
1593
+ $fonts = [];
1594
+ if ($show_empty_option) {
1595
+ $fonts[''] = 'Default';
1596
+ }
1597
+
1598
+ $fonts = array_merge($fonts, ['Helvetica, Arial, sans-serif' => 'Helvetica, Arial',
1599
+ 'Arial Black, Gadget, sans-serif' => 'Arial Black, Gadget',
1600
+ 'Garamond, serif' => 'Garamond',
1601
+ 'Courier, monospace' => 'Courier',
1602
+ 'Comic Sans MS, cursive' => 'Comic Sans MS',
1603
+ 'Impact, Charcoal, sans-serif' => 'Impact, Charcoal',
1604
+ 'Tahoma, Geneva, sans-serif' => 'Tahoma, Geneva',
1605
+ 'Times New Roman, Times, serif' => 'Times New Roman',
1606
+ 'Verdana, Geneva, sans-serif' => 'Verdana, Geneva']);
1607
 
1608
  echo '<select class="tnpf-font-family" id="options-', esc_attr($name), '" name="options[', esc_attr($name), ']">';
1609
  foreach ($fonts as $font=>$label) {
1768
 
1769
  static function delta_time($delta = 0) {
1770
  $seconds = $delta % 60;
1771
+ $minutes = floor(($delta / 60) % 60);
1772
+ $hours = floor(($delta / (60 * 60)) % 24);
1773
+ $days = floor($delta / (24 * 60 * 60));
1774
 
1775
 
1776
  return $days . ' day(s), ' . $hours . ' hour(s), ' . $minutes . ' minute(s)';
 
1777
  }
1778
 
1779
  /**
1795
  $url = 'https://www.thenewsletterplugin.com' . $url;
1796
  }
1797
  echo '<a href="', $url, '" target="_blank" style="text-decoration: none" title="' . esc_attr(__('Read more', 'newsletter')) . '"><i class="fas fa-question-circle"></i>';
1798
+ if ($text)
1799
+ echo '&nbsp;', $text;
1800
  echo '</a>';
1801
  }
1802
+
1803
  static function field_label($label, $help_url = false) {
1804
  echo $label;
1805
  if ($help_url) {
1918
  global $tnpc_show_subject;
1919
  $tnpc_show_subject = $show_subject;
1920
 
1921
+ echo "<link href='" . plugins_url( 'newsletter' ) . "/emails/tnp-composer/_css/newsletter-builder-v2.css?ver=" . NEWSLETTER_VERSION . "' rel='stylesheet' type='text/css'>";
1922
+
1923
+ wp_enqueue_style('tnp-modal-style', plugins_url('newsletter') . '/emails/tnp-composer/_css/tnp-modal.css', array(), NEWSLETTER_VERSION);
1924
+ wp_enqueue_style('tnp-toast-style', plugins_url('newsletter') . '/emails/tnp-composer/_css/tnp-toast.css', array(), NEWSLETTER_VERSION);
1925
  $controls = $this;
1926
  include NEWSLETTER_DIR . '/emails/tnp-composer/index-v2.php';
1927
  }
1928
 
1929
+ function subject($name) {
1930
+ $value = $this->get_value($name);
1931
+ echo '<div style="position: relative"><input size="80" id="options-', esc_attr($name), '" style="font-size: 14px; font-family: monospace;" name="options[' . esc_attr($name) . ']" type="text" placeholder="" value="';
1932
+ echo esc_attr($value);
1933
+ echo '">';
1934
+ echo '&nbsp;<i class="far fa-lightbulb" onclick="tnp_suggest_subject()"></i>';
1935
+
1936
+ // echo '<img src="', NEWSLETTER_URL, '/images/subject/android.png" style="position: absolute; left: 330px; top: 22px; display: block">';
1937
+ // echo '<img src="', NEWSLETTER_URL, '/images/subject/iphone.png" style="position: absolute; left: 380px; top: 22px; display: block">';
1938
+ // echo '<img src="', NEWSLETTER_URL, '/images/subject/gmail.png" style="position: absolute; left: 400px; top: 22px; display: block">';
1939
+ echo '</div>';
1940
+ }
1941
+
1942
  }
includes/fields.php CHANGED
@@ -43,7 +43,7 @@ class NewsletterFields {
43
 
44
  /**
45
  * Adds some empty basic atributes to avoid the isset() checking.
46
- *
47
  * @param array $attrs
48
  * @return array
49
  */
@@ -52,7 +52,7 @@ class NewsletterFields {
52
  }
53
 
54
  /** Adds some basic attributes and the provided default ones.
55
- *
56
  * @param array $attrs
57
  * @param array $defaults
58
  * @return array
@@ -63,7 +63,7 @@ class NewsletterFields {
63
 
64
  /**
65
  * A form section title.
66
- *
67
  * @param string $title
68
  */
69
  public function section($title = '') {
@@ -83,8 +83,8 @@ class NewsletterFields {
83
  $this->_close();
84
  }
85
 
86
- /** General Input field with default type = text
87
- *
88
  * Attributes:
89
  * - label_after (default: none): small text ti be displayed after the text field
90
  * - min (default: none): minimum number of characters
@@ -133,10 +133,10 @@ class NewsletterFields {
133
 
134
  /**
135
  * A set of text fields, named $name_1, $name_2, ...
136
- *
137
  * Attributes:
138
  * - label_after: a label to show after the field column
139
- *
140
  * @param type $name
141
  * @param type $label
142
  * @param type $count
@@ -163,10 +163,10 @@ class NewsletterFields {
163
  }
164
 
165
  public function textarea($name, $label = '', $attrs = []) {
166
- $attrs = $this->_merge_attrs($attrs);
167
  $this->_open();
168
  $this->_label($label);
169
- $this->controls->textarea_fixed($name, '100%', '150');
170
  $this->_description($attrs);
171
  $this->_close();
172
  }
@@ -192,8 +192,14 @@ class NewsletterFields {
192
  echo '</textarea>';
193
 
194
  if (version_compare($wp_version, '4.8', '>=')) {
195
- echo '<script>wp.editor.remove("options-', $name, '");';
196
- echo 'wp.editor.initialize("options-', $name, '", { tinymce: {content_style: "body {background-color: #f4f4f4;}", toolbar1: "undo redo | formatselect fontselect fontsizeselect | bold italic forecolor backcolor | link unlink | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | wp_add_media | charmap | rtl ltr", fontsize_formats: "11px 12px 14px 16px 18px 24px 36px 48px", plugins: "link textcolor colorpicker lists wordpress charmap directionality", default_link_target: "_blank", relative_urls : false, convert_urls: false}});</script>';
 
 
 
 
 
 
197
  }
198
  $this->_description($attrs);
199
  $this->_close();
@@ -202,7 +208,7 @@ class NewsletterFields {
202
  /**
203
  * Attributes:
204
  * - realod: when true is forces a submit of the form (used to change the form fields or values for example when changing layout or color scheme)
205
- *
206
  * @param type $name
207
  * @param type $label
208
  * @param type $options
@@ -259,7 +265,7 @@ class NewsletterFields {
259
 
260
  /**
261
  * General field to collect an element dimension in pixels
262
- *
263
  * Attributes:
264
  * - size: field width in pixels
265
  */
@@ -278,7 +284,7 @@ class NewsletterFields {
278
  }
279
 
280
  /**
281
- * Collects a color in HEX format with a picker.
282
  */
283
  public function color($name, $label, $attrs = []) {
284
  $this->_open('tnp-color');
@@ -290,14 +296,24 @@ class NewsletterFields {
290
 
291
  /**
292
  * Configuration for a simple button with label and color
293
- *
294
  * Attributes:
295
  * - weight: if true (default) shows the font weight selector
296
  * - url_paceholder: the placeholder for the URL field
297
  * - url: if true (default) shows the URL field (sometime the URL is produced elsewhere, for example on post list)
298
  */
299
  public function button($name, $label = '', $attrs = []) {
300
- $attrs = $this->_merge_attrs($attrs, ['placeholder' => 'Label...', 'url_placeholder' => 'https://...', 'url' => true, 'weight' => true]);
 
 
 
 
 
 
 
 
 
 
301
  $this->_open('tnp-button');
302
  $this->_label($label);
303
  $value = $this->controls->get_value($name . '_label');
@@ -318,14 +334,29 @@ class NewsletterFields {
318
  }
319
  echo '<div style="clear: both"></div>';
320
  echo '</div>';
321
- $this->controls->css_font($name . '_font', ['weight' => $attrs['weight']]);
322
- $this->controls->color($name . '_background');
 
 
 
 
 
323
  $this->_close();
324
  }
325
 
 
 
 
 
 
 
 
 
 
 
326
  /**
327
  * URL input field
328
- *
329
  * @param string $name
330
  * @param string $label
331
  * @param array $attrs
@@ -341,7 +372,7 @@ class NewsletterFields {
341
 
342
  /**
343
  * Provides a list of custom post types.
344
- *
345
  * @param string $name
346
  * @param string $label
347
  * @param array $attrs
@@ -354,13 +385,15 @@ class NewsletterFields {
354
  $this->_open('tnp-post-type');
355
  $this->_label($label);
356
 
357
- $options = ['post' => 'Standard post'];
 
358
  foreach ($post_types as $post_type) {
359
  if ($post_type->name == 'post' || $post_type->name == 'page' || $post_type->name == 'attachment') {
360
  continue;
361
  }
362
  $options[$post_type->name] = $post_type->labels->name;
363
  }
 
364
  $value = $this->controls->get_value($name);
365
 
366
  echo '<select id="', $this->_id($name), '" name="options[' . esc_attr($name) . ']" onchange="tnpc_reload_options(event); return false;">';
@@ -416,10 +449,10 @@ class NewsletterFields {
416
  }
417
 
418
  function lists($name, $label, $attrs = []) {
419
- $attrs = $this->_merge_attrs($attrs);
420
  $this->_open();
421
  $this->_label($label);
422
- $lists = $this->controls->get_list_options($empty_label);
423
  $this->controls->select($name, $lists);
424
  $this->_description($attrs);
425
  $this->_close();
@@ -428,7 +461,7 @@ class NewsletterFields {
428
  /**
429
  * Media selector using the WP media library (for images and files.
430
  * The field to use it the {$name}_id which contains the media id.
431
- *
432
  * Attributes:
433
  * - alt: if true shows the alternate text field for the "alt" attribute
434
  * - layout: if set to "mini" the controls is shown as a mini selector, no labels
@@ -524,7 +557,7 @@ class NewsletterFields {
524
 
525
  /**
526
  * Shows a language selector only if the blog is multilanguage.
527
- *
528
  * @param string $name
529
  * @param string $label
530
  * @param array $attrs
@@ -547,20 +580,46 @@ class NewsletterFields {
547
  /**
548
  * Collects font details for a text: family, color, size and weight to be used
549
  * directly on CSS rules. Size is a pure number.
550
- *
551
  * Attributes:
 
 
 
 
 
552
  *
553
  * @param type $name
554
  * @param type $label
555
- * @param type $attrs
556
  */
557
  public function font($name = 'font', $label = 'Font', $attrs = []) {
558
  $attrs = $this->_merge_base_attrs($attrs);
559
- $attrs = array_merge(array('hide_family' => false, 'hide_color' => false, 'hide_size' => false), $attrs);
 
 
 
 
 
 
 
 
 
560
 
561
  $this->_open('tnp-font');
562
  $this->_label($label);
563
- $this->controls->css_font($name);
 
 
 
 
 
 
 
 
 
 
 
 
564
  $this->_description($attrs);
565
  $this->_close();
566
  }
@@ -617,7 +676,6 @@ class NewsletterFields {
617
  }
618
 
619
  public function block_commons() {
620
- $this->separator();
621
 
622
  $this->_open('tnp-block-commons');
623
  $this->_label('Padding and background');
43
 
44
  /**
45
  * Adds some empty basic atributes to avoid the isset() checking.
46
+ *
47
  * @param array $attrs
48
  * @return array
49
  */
52
  }
53
 
54
  /** Adds some basic attributes and the provided default ones.
55
+ *
56
  * @param array $attrs
57
  * @param array $defaults
58
  * @return array
63
 
64
  /**
65
  * A form section title.
66
+ *
67
  * @param string $title
68
  */
69
  public function section($title = '') {
83
  $this->_close();
84
  }
85
 
86
+ /** General Input field with default type = text
87
+ *
88
  * Attributes:
89
  * - label_after (default: none): small text ti be displayed after the text field
90
  * - min (default: none): minimum number of characters
133
 
134
  /**
135
  * A set of text fields, named $name_1, $name_2, ...
136
+ *
137
  * Attributes:
138
  * - label_after: a label to show after the field column
139
+ *
140
  * @param type $name
141
  * @param type $label
142
  * @param type $count
163
  }
164
 
165
  public function textarea($name, $label = '', $attrs = []) {
166
+ $attrs = $this->_merge_attrs($attrs, ['width'=>'100%', 'height'=>'150']);
167
  $this->_open();
168
  $this->_label($label);
169
+ $this->controls->textarea_fixed($name, $attrs['width'], $attrs['height']);
170
  $this->_description($attrs);
171
  $this->_close();
172
  }
192
  echo '</textarea>';
193
 
194
  if (version_compare($wp_version, '4.8', '>=')) {
195
+
196
+ $paragraph_style = " p { font-family: ${attrs['text_font_family']}; font-size: ${attrs['text_font_size']}px; font-weight: ${attrs['text_font_weight']}; color: ${attrs['text_font_color']}; line-height: 1.5em; }";
197
+ $content_style = $paragraph_style;
198
+
199
+ echo '<script>';
200
+ echo 'wp.editor.remove("options-', $name, '");';
201
+ echo 'wp.editor.initialize("options-', $name, '", { tinymce: {content_style: "' . $content_style . '", toolbar1: "undo redo | formatselect fontselect fontsizeselect | bold italic forecolor backcolor | link unlink | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | wp_add_media | charmap | rtl ltr", fontsize_formats: "11px 12px 14px 16px 18px 24px 36px 48px", plugins: "link textcolor colorpicker lists wordpress charmap directionality", default_link_target: "_blank", relative_urls : false, convert_urls: false, keep_styles: true }});';
202
+ echo '</script>';
203
  }
204
  $this->_description($attrs);
205
  $this->_close();
208
  /**
209
  * Attributes:
210
  * - realod: when true is forces a submit of the form (used to change the form fields or values for example when changing layout or color scheme)
211
+ *
212
  * @param type $name
213
  * @param type $label
214
  * @param type $options
265
 
266
  /**
267
  * General field to collect an element dimension in pixels
268
+ *
269
  * Attributes:
270
  * - size: field width in pixels
271
  */
284
  }
285
 
286
  /**
287
+ * Collects a color in HEX format with a picker.
288
  */
289
  public function color($name, $label, $attrs = []) {
290
  $this->_open('tnp-color');
296
 
297
  /**
298
  * Configuration for a simple button with label and color
299
+ *
300
  * Attributes:
301
  * - weight: if true (default) shows the font weight selector
302
  * - url_paceholder: the placeholder for the URL field
303
  * - url: if true (default) shows the URL field (sometime the URL is produced elsewhere, for example on post list)
304
  */
305
  public function button($name, $label = '', $attrs = []) {
306
+ $attrs = $this->_merge_attrs( $attrs,
307
+ [
308
+ 'placeholder' => 'Label...',
309
+ 'url_placeholder' => 'https://...',
310
+ 'url' => true,
311
+ 'weight' => true,
312
+ 'family_default' => false,
313
+ 'size_default' => false,
314
+ 'weight_default' => false,
315
+ ] );
316
+
317
  $this->_open('tnp-button');
318
  $this->_label($label);
319
  $value = $this->controls->get_value($name . '_label');
334
  }
335
  echo '<div style="clear: both"></div>';
336
  echo '</div>';
337
+ $this->controls->css_font( $name . '_font', [
338
+ 'weight' => $attrs['weight'],
339
+ 'family_default' => $attrs['family_default'],
340
+ 'size_default' => $attrs['size_default'],
341
+ 'weight_default' => $attrs['weight_default']
342
+ ] );
343
+ $this->controls->color( $name . '_background' );
344
  $this->_close();
345
  }
346
 
347
+ public function button_style( $name, $label = '' ) {
348
+
349
+ $this->_open( 'tnp-font' );
350
+ $this->_label( $label );
351
+ $this->controls->css_font( $name . '_font' );
352
+ $this->controls->color( $name . '_background_color' );
353
+ $this->_close();
354
+
355
+ }
356
+
357
  /**
358
  * URL input field
359
+ *
360
  * @param string $name
361
  * @param string $label
362
  * @param array $attrs
372
 
373
  /**
374
  * Provides a list of custom post types.
375
+ *
376
  * @param string $name
377
  * @param string $label
378
  * @param array $attrs
385
  $this->_open('tnp-post-type');
386
  $this->_label($label);
387
 
388
+ $options = ['post' => 'Standard posts', 'page' => 'Pages'];
389
+
390
  foreach ($post_types as $post_type) {
391
  if ($post_type->name == 'post' || $post_type->name == 'page' || $post_type->name == 'attachment') {
392
  continue;
393
  }
394
  $options[$post_type->name] = $post_type->labels->name;
395
  }
396
+
397
  $value = $this->controls->get_value($name);
398
 
399
  echo '<select id="', $this->_id($name), '" name="options[' . esc_attr($name) . ']" onchange="tnpc_reload_options(event); return false;">';
449
  }
450
 
451
  function lists($name, $label, $attrs = []) {
452
+ $attrs = $this->_merge_attrs($attrs, ['empty_label'=>null]);
453
  $this->_open();
454
  $this->_label($label);
455
+ $lists = $this->controls->get_list_options($attrs['empty_label']);
456
  $this->controls->select($name, $lists);
457
  $this->_description($attrs);
458
  $this->_close();
461
  /**
462
  * Media selector using the WP media library (for images and files.
463
  * The field to use it the {$name}_id which contains the media id.
464
+ *
465
  * Attributes:
466
  * - alt: if true shows the alternate text field for the "alt" attribute
467
  * - layout: if set to "mini" the controls is shown as a mini selector, no labels
557
 
558
  /**
559
  * Shows a language selector only if the blog is multilanguage.
560
+ *
561
  * @param string $name
562
  * @param string $label
563
  * @param array $attrs
580
  /**
581
  * Collects font details for a text: family, color, size and weight to be used
582
  * directly on CSS rules. Size is a pure number.
583
+ *
584
  * Attributes:
585
+ * - family: true|false enable or not the font family field
586
+ * - family_default: true|false enables the default entry with an empty key value
587
+ * - color: true|false enable or not the color field
588
+ * - weight: true|false enable or not the weight field
589
+ * - size: true|false enable or not the size selection
590
  *
591
  * @param type $name
592
  * @param type $label
593
+ * @param array $attrs
594
  */
595
  public function font($name = 'font', $label = 'Font', $attrs = []) {
596
  $attrs = $this->_merge_base_attrs($attrs);
597
+ $attrs = array_merge( [
598
+ 'hide_family' => false,
599
+ 'family' => true,
600
+ 'color' => true,
601
+ 'size' => true,
602
+ 'weight' => true,
603
+ 'family_default' => false,
604
+ 'size_default' => false,
605
+ 'weight_default' => false,
606
+ ], $attrs );
607
 
608
  $this->_open('tnp-font');
609
  $this->_label($label);
610
+
611
+ $this->controls->css_font_family($name . '_family', !empty($attrs['family_default']));
612
+
613
+ if ($attrs['size']) {
614
+ $this->controls->css_font_size($name . '_size', !empty($attrs['size_default']));
615
+ }
616
+ if ($attrs['weight']) {
617
+ $this->controls->css_font_weight($name . '_weight', !empty($attrs['weight_default']));
618
+ }
619
+ if ($attrs['color']) {
620
+ $this->controls->color($name . '_color');
621
+ }
622
+
623
  $this->_description($attrs);
624
  $this->_close();
625
  }
676
  }
677
 
678
  public function block_commons() {
 
679
 
680
  $this->_open('tnp-block-commons');
681
  $this->_label('Padding and background');
includes/helper.php CHANGED
@@ -299,9 +299,6 @@ function tnp_resize_2x($media_id, $size) {
299
  return $media;
300
  }
301
 
302
- //TODO creare funzione che quando fa il resize fa anche il resize
303
- // al doppio della risoluzione e salva url del file in TNP_Media->url2x o urls ??
304
-
305
  /**
306
  * Get media for "posts" composer block
307
  *
299
  return $media;
300
  }
301
 
 
 
 
302
  /**
303
  * Get media for "posts" composer block
304
  *
main/images/dashboard/forms.png ADDED
Binary file
main/images/dashboard/lists.png ADDED
Binary file
main/images/dashboard/videos.png ADDED
Binary file
main/index.php CHANGED
@@ -1,392 +1,314 @@
1
  <?php
2
- defined('ABSPATH') || exit;
 
 
3
 
4
  include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
 
7
- wp_enqueue_script( 'tnp-chart' );
8
 
9
- if ( $controls->is_action( 'feed_enable' ) ) {
10
- delete_option( 'newsletter_feed_demo_disable' );
11
- $controls->messages = 'Feed by Mail demo panels enabled. On next page reload it will show up.';
12
  }
13
 
14
- if ( $controls->is_action( 'feed_disable' ) ) {
15
- update_option( 'newsletter_feed_demo_disable', 1 );
16
- $controls->messages = 'Feed by Mail demo panel disabled. On next page reload it will disappear.';
17
  }
18
 
19
  $emails_module = NewsletterEmails::instance();
20
  $statistics_module = NewsletterStatistics::instance();
21
- $emails = $wpdb->get_results( "select * from " . NEWSLETTER_EMAILS_TABLE . " where type='message' order by id desc limit 5" );
22
 
23
  $users_module = NewsletterUsers::instance();
24
- $query = "select * from " . NEWSLETTER_USERS_TABLE . " order by id desc";
25
- $query .= " limit 10";
26
- $subscribers = $wpdb->get_results( $query );
27
 
28
  // Retrieves the last standard newsletter
29
  $last_email = $wpdb->get_row(
30
- $wpdb->prepare( "select * from " . NEWSLETTER_EMAILS_TABLE . " where type='message' and status in ('sent', 'sending') and send_on<%d order by id desc limit 1", time() ) );
31
 
32
- if ( $last_email ) {
33
  $report = $statistics_module->get_statistics($last_email);
34
- $last_email_sent = $report->total;
35
- $last_email_opened = $report->open_count;
36
- $last_email_notopened = $last_email_sent - $last_email_opened;
37
- $last_email_clicked = $report->click_count;
38
- $last_email_opened -= $last_email_clicked;
39
-
40
- $overall_sent = $wpdb->get_var( "select sum(sent) from " . NEWSLETTER_EMAILS_TABLE . " where type='message' and status in ('sent', 'sending')" );
41
-
42
- $overall_opened = $wpdb->get_var( "select count(distinct user_id,email_id) from " . NEWSLETTER_STATS_TABLE );
43
- $overall_notopened = $overall_sent - $overall_opened;
44
- $overall_clicked = $wpdb->get_var( "select count(distinct user_id,email_id) from " . NEWSLETTER_STATS_TABLE . " where url<>''" );
45
- $overall_opened -= $overall_clicked;
46
  } else {
47
- $last_email_opened = 500;
48
- $last_email_notopened = 400;
49
- $last_email_clicked = 200;
50
 
51
- $overall_opened = 500;
52
- $overall_notopened = 400;
53
- $overall_clicked = 200;
54
  }
55
 
56
- $months = $wpdb->get_results( "select count(*) as c, concat(year(created), '-', date_format(created, '%m')) as d "
57
- . "from " . NEWSLETTER_USERS_TABLE . " where status='C' "
58
- . "group by concat(year(created), '-', date_format(created, '%m')) order by d desc limit 12" );
59
  $values = array();
60
  $labels = array();
61
- foreach ( $months as $month ) {
62
- $values[] = (int) $month->c;
63
- $labels[] = date( "M y", date_create_from_format( "Y-m", $month->d )->getTimestamp() );
64
  }
65
- $values = array_reverse( $values );
66
- $labels = array_reverse( $labels );
 
 
67
  ?>
68
 
69
  <div class="wrap" id="tnp-wrap">
70
 
71
- <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
72
-
73
- <div id="tnp-heading">
74
-
75
- <h2><?php _e( 'Dashboard', 'newsletter' ) ?></h2>
76
- <p><?php _e( 'Your powerful control panel', 'newsletter' ) ?></p>
77
-
78
- </div>
79
 
80
  <div id="tnp-body" class="tnp-main-index">
81
- <div id="dashboard-widgets-wrap">
82
- <div id="dashboard-widgets" class="metabox-holder">
83
- <div id="postbox-container-1" class="postbox-container">
84
- <div id="normal-sortables" class="meta-box-sortables ui-sortable">
85
-
86
- <!-- START Statistics -->
87
- <div id="tnp-dash-statistics" class="postbox">
88
- <h3><?php _e( 'Statistics', 'newsletter' ) ?>
89
- <a href="<?php echo NewsletterStatistics::instance()->get_index_url() ?>">
90
- <i class="fas fa-chart-bar"></i> <?php _e( 'Statistics', 'newsletter' ) ?>
91
- </a>
92
- </h3>
93
- <div class="inside">
94
-
95
- <?php if ( ! $last_email ) { ?>
96
- <p style="text-align: center">
97
- <?php _e( 'These charts are only for example:<br>create and send your first newsletter to have real statistics!', 'newsletter' ) ?>
98
- </p>
99
- <?php } ?>
100
-
101
- <div class="row tnp-row-pie-charts">
102
- <div class="col-md-6">
103
- <canvas id="tnp-rates1-chart"></canvas>
104
- <p style="text-align: center"><?php _e( 'Last Newsletter', 'newsletter' ) ?></p>
105
- </div>
106
- <div class="col-md-6">
107
- <canvas id="tnp-rates2-chart"></canvas>
108
- <p style="text-align: center"><?php _e( 'Overall', 'newsletter' ) ?></p>
109
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  </div>
111
-
112
- <script type="text/javascript">
113
-
114
- var rates1 = {
115
- labels: [
116
- "Not opened",
117
- "Opened",
118
- "Clicked"
119
- ],
120
- datasets: [
121
- {
122
- data: [<?php echo $last_email_notopened; ?>, <?php echo $last_email_opened; ?>, <?php echo $last_email_clicked ?>],
123
- backgroundColor: [
124
- "#ECF0F1",
125
- "#E67E22",
126
- "#27AE60"
127
- ],
128
- hoverBackgroundColor: [
129
- "#ECF0F1",
130
- "#E67E22",
131
- "#27AE60"
132
- ]
133
- }]
134
- };
135
-
136
- var rates2 = {
137
- labels: [
138
- "Not opened",
139
- "Opened",
140
- "Clicked"
141
- ],
142
- datasets: [
143
- {
144
- data: [<?php echo $overall_notopened; ?>, <?php echo $overall_opened; ?>, <?php echo $overall_clicked ?>],
145
- backgroundColor: [
146
- "#ECF0F1",
147
- "#E67E22",
148
- "#27AE60"
149
- ],
150
- hoverBackgroundColor: [
151
- "#ECF0F1",
152
- "#E67E22",
153
- "#27AE60"
154
- ]
155
- }]
156
- };
157
-
158
-
159
- jQuery(document).ready(function ($) {
160
- ctx1 = $('#tnp-rates1-chart').get(0).getContext("2d");
161
- ctx2 = $('#tnp-rates2-chart').get(0).getContext("2d");
162
- myPieChart1 = new Chart(ctx1, {
163
- type: 'doughnut',
164
- data: rates1,
165
- options: {legend: {display: false, labels: {boxWidth: 10}}}
166
- });
167
- myPieChart2 = new Chart(ctx2, {
168
- type: 'doughnut',
169
- data: rates2,
170
- options: {legend: {display: false, labels: {boxWidth: 10}}}
171
- });
172
- });
173
- </script>
174
-
175
  </div>
176
- </div>
177
- <!-- END Statistics -->
178
-
179
-
180
- <!-- START Statistics -->
181
- <div id="tnp-dash-statistics" class="postbox">
182
- <h3><?php _e( 'Subscriptions', 'newsletter' ) ?></h3>
183
- <div class="inside">
184
 
 
 
 
 
 
185
 
186
- <div id="canvas-holder">
187
- <canvas id="tnp-events-chart-canvas"></canvas>
 
 
188
  </div>
189
 
190
- <script type="text/javascript">
191
- var events_data = {
192
- labels: <?php echo json_encode( $labels ) ?>,
193
- datasets: [
194
- {
195
- label: "<?php _e( 'Subscriptions', 'newsletter' ) ?>",
196
- fill: true,
197
- strokeColor: "#27AE60",
198
- backgroundColor: "#ECF0F1",
199
- borderColor: "#27AE60",
200
- pointBorderColor: "#27AE60",
201
- pointBackgroundColor: "#ECF0F1",
202
- data: <?php echo json_encode( $values ) ?>
203
- }
204
- ]
205
- };
206
-
207
- jQuery(document).ready(function ($) {
208
- ctxe = $('#tnp-events-chart-canvas').get(0).getContext("2d");
209
- eventsLineChart = new Chart(ctxe, {
210
- type: 'line', data: events_data,
211
- options: {
212
- scales: {
213
- xAxes: [{
214
- type: "category",
215
- "id": "x-axis-1",
216
- gridLines: {display: false},
217
- ticks: {fontFamily: "Source Sans Pro"}
218
- }],
219
- yAxes: [
220
- {
221
- type: "linear",
222
- "id": "y-axis-1",
223
- gridLines: {display: false},
224
- ticks: {fontFamily: "Source Sans Pro"}
225
- },
226
- ]
227
- },
228
- }
229
- });
230
- });
231
- </script>
232
-
233
- </div>
234
- </div>
235
- <!-- END Statistics -->
236
-
237
- <!-- START Documentation -->
238
- <div id="tnp-dash-documentation" class="postbox">
239
- <h3><?php _e( 'Documentation', 'newsletter' ) ?>
240
- <a href="https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-documentation"
241
- target="_blank">
242
- <i class="fas fa-life-ring"></i> <?php _e( 'Read all', 'newsletter' ) ?>
243
- </a>
244
- </h3>
245
- <div class="inside">
246
- <!-- <div class="tnp-video-container">
247
- <iframe width="480" height="360"
248
- src="https://www.youtube.com/embed/JaxK7XwqvVI?rel=0" frameborder="0"
249
- allowfullscreen></iframe>
250
- </div> -->
251
- <div>
252
- <a class="orange"
253
- href="https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-documentation/email-sending-issues"
254
- target="_blank">
255
- <i class="fas fa-exclamation-triangle"></i> <?php _e( 'Problem sending messages? Start here!', 'newsletter' ) ?>
256
- </a>
257
  </div>
258
-
259
- <div>
260
- <a class="blue" href="https://www.thenewsletterplugin.com/support/video-tutorials"
261
- target="_blank">
262
- <i class="fas fa-youtube-play"></i> <?php _e( 'All Video Tutorials', 'newsletter' ) ?>
263
- </a>
264
  </div>
265
- <div>
266
- <a class="purple"
267
- href="https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-preferences"
268
- target="_blank">
269
- <i class="fas fa-question-circle"></i> <?php _e( 'Learn how to segment your suscribers', 'newsletter' ) ?>
270
- </a>
 
 
 
 
271
  </div>
272
  </div>
273
- </div>
274
- <!-- END Documentation -->
275
- </div>
 
 
 
 
 
 
 
 
 
276
  </div>
277
 
278
- <div id="postbox-container-2" class="postbox-container">
279
- <div id="side-sortables" class="meta-box-sortables ui-sortable">
280
- <!-- START Newsletters -->
281
- <div id="tnp-dash-newsletters" class="postbox">
282
- <h3><?php _e( 'Newsletters', 'newsletter' ) ?>
283
- <a href="<?php echo $emails_module->get_admin_page_url( 'index' ); ?>">
284
- <i class="fas fa-list"></i> <?php _e( 'List', 'newsletter' ) ?>
285
- </a>
286
- <a href="<?php echo $emails_module->get_admin_page_url( 'theme' ); ?>">
287
- <i class="fas fa-plus-square"></i> <?php _e( 'New', 'newsletter' ) ?>
288
- </a>
289
- </h3>
290
- <div class="inside">
291
- <table width="100%">
292
- <?php
293
- foreach ( $emails as &$email ) { ?>
294
- <tr>
295
- <td><?php
296
- if ( $email->subject ) {
297
- echo htmlspecialchars( $email->subject );
298
- } else {
299
- echo "Newsletter #" . $email->id;
300
- }
301
- ?>
302
- </td>
303
- <td>
304
- <?php $emails_module->show_email_status_label( $email ) ?>
305
- </td>
306
- <td>
307
- <?php $emails_module->show_email_progress_bar( $email, array( 'scheduled' => true ) ) ?>
308
- </td>
309
- <td style="white-space:nowrap"><?php if ($email->status == 'sent') {
310
- echo '<a class="button-primary" href="' . $statistics_module->get_statistics_url($email->id) . '"><i class="fas fa-chart-bar"></i> ' . __('Statistics', 'newsletter') . '</a>';
311
- } else {
312
- echo $emails_module->get_edit_button($email);
313
- } ?></td>
314
- </tr>
315
- <?php } ?>
316
- </table>
317
- </div>
318
- </div>
319
- <!-- END Newsletters -->
320
- <?php if ( empty( Newsletter::instance()->options['contract_key'] ) ) { ?>
321
- <!-- START Premium -->
322
- <div id="tnp-dash-premium" class="postbox">
323
- <h3><?php _e( 'Premium', 'newsletter' ) ?>
324
- <a href="https://www.thenewsletterplugin.com/extensions" target="_blank">
325
- <i class="fas fa-trophy"></i> <?php _e( 'Buy', 'newsletter' ) ?>
326
- </a>
327
- </h3>
328
- <div class="inside">
329
- <div>
330
- <a href="https://www.thenewsletterplugin.com/extensions" target="_blank">
331
- <img style="width: 100%;"
332
- src="https://cdn.thenewsletterplugin.com/dashboard01.gif">
333
- </a>
334
- </div>
335
- <div>
336
- <a href="https://www.thenewsletterplugin.com/extensions" target="_blank">
337
- <img style="width: 100%;"
338
- src="https://cdn.thenewsletterplugin.com/dashboard02.png">
339
- </a>
340
- </div>
341
- </div>
342
- </div>
343
- <!-- END Premium -->
344
- <?php } ?>
345
  </div>
346
- </div>
347
- <div id="postbox-container-3" class="postbox-container">
348
- <div id="column3-sortables" class="meta-box-sortables ui-sortable">
349
- <!-- START Subscribers -->
350
- <div id="tnp-dash-subscribers" class="postbox">
351
- <h3><?php _e( 'Last Subscribers', 'newsletter' ) ?>
352
- <a href="<?php echo $users_module->get_admin_page_url( 'index' ); ?>">
353
- <i class="fas fa-users"></i> <?php _e( 'List', 'newsletter' ) ?>
354
- </a>
355
- <a href="<?php echo $users_module->get_admin_page_url( 'new' ); ?>">
356
- <i class="fas fa-user-plus"></i> <?php _e( 'New', 'newsletter' ) ?>
357
- </a>
358
- </h3>
359
- <div class="inside">
360
- <table width="100%">
361
- <?php foreach ( $subscribers as $s ) { ?>
362
- <tr>
363
- <td><?php echo esc_html( $s->email ) ?><br>
364
- <?php echo esc_html( $s->name ) ?> <?php echo esc_html( $s->surname ) ?>
365
- </td>
366
- <td><?php echo $emails_module->get_user_status_label( $s ) ?></td>
367
- <td style="white-space:nowrap">
368
- <a class="button-primary tnp-button-white"
369
- title="<?php _e( 'Edit', 'newsletter' ) ?>"
370
- href="<?php echo $users_module->get_admin_page_url( 'edit' ); ?>&amp;id=<?php echo $s->id; ?>"><i
371
- class="fas fa-edit"></i></a>
372
- <a title="<?php _e( 'Profile', 'newsletter' ) ?>"
373
- href="<?php echo home_url( '/' ) ?>?na=p&nk=<?php echo $s->id . '-' . $s->token; ?>"
374
- class="button-primary tnp-button-white" target="_blank"><i
375
- class="fas fa-user"></i></a>
376
- </td>
377
- </tr>
378
- <?php } ?>
379
- </table>
380
- </div>
381
- </div>
382
- <!-- END Subscribers -->
383
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  </div>
385
  </div>
386
  </div>
387
 
388
  </div>
389
 
390
- <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
391
 
392
  </div>
1
  <?php
2
+ /* @var $this Newsletter */
3
+
4
+ defined('ABSPATH') || exit;
5
 
6
  include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
7
  $controls = new NewsletterControls();
8
 
9
+ wp_enqueue_script('tnp-chart');
10
 
11
+ if ($controls->is_action('feed_enable')) {
12
+ delete_option('newsletter_feed_demo_disable');
13
+ $controls->messages = 'Feed by Mail demo panels enabled. On next page reload it will show up.';
14
  }
15
 
16
+ if ($controls->is_action('feed_disable')) {
17
+ update_option('newsletter_feed_demo_disable', 1);
18
+ $controls->messages = 'Feed by Mail demo panel disabled. On next page reload it will disappear.';
19
  }
20
 
21
  $emails_module = NewsletterEmails::instance();
22
  $statistics_module = NewsletterStatistics::instance();
23
+ $emails = $wpdb->get_results("select * from " . NEWSLETTER_EMAILS_TABLE . " where type='message' order by id desc limit 5");
24
 
25
  $users_module = NewsletterUsers::instance();
26
+ $query = "select * from " . NEWSLETTER_USERS_TABLE . " order by id desc limit 5";
27
+ $subscribers = $wpdb->get_results($query);
 
28
 
29
  // Retrieves the last standard newsletter
30
  $last_email = $wpdb->get_row(
31
+ $wpdb->prepare("select * from " . NEWSLETTER_EMAILS_TABLE . " where type='message' and status in ('sent', 'sending') and send_on<%d order by id desc limit 1", time()));
32
 
33
+ if ($last_email) {
34
  $report = $statistics_module->get_statistics($last_email);
35
+ $last_email_sent = $report->total;
36
+ $last_email_opened = $report->open_count;
37
+ $last_email_notopened = $last_email_sent - $last_email_opened;
38
+ $last_email_clicked = $report->click_count;
39
+ $last_email_opened -= $last_email_clicked;
40
+
41
+ $overall_sent = $wpdb->get_var("select sum(sent) from " . NEWSLETTER_EMAILS_TABLE . " where type='message' and status in ('sent', 'sending')");
42
+
43
+ $overall_opened = $wpdb->get_var("select count(distinct user_id,email_id) from " . NEWSLETTER_STATS_TABLE);
44
+ $overall_notopened = $overall_sent - $overall_opened;
45
+ $overall_clicked = $wpdb->get_var("select count(distinct user_id,email_id) from " . NEWSLETTER_STATS_TABLE . " where url<>''");
46
+ $overall_opened -= $overall_clicked;
47
  } else {
48
+ $last_email_opened = 500;
49
+ $last_email_notopened = 400;
50
+ $last_email_clicked = 200;
51
 
52
+ $overall_opened = 500;
53
+ $overall_notopened = 400;
54
+ $overall_clicked = 200;
55
  }
56
 
57
+ $months = $wpdb->get_results("select count(*) as c, concat(year(created), '-', date_format(created, '%m')) as d "
58
+ . "from " . NEWSLETTER_USERS_TABLE . " where status='C' "
59
+ . "group by concat(year(created), '-', date_format(created, '%m')) order by d desc limit 12");
60
  $values = array();
61
  $labels = array();
62
+ foreach ($months as $month) {
63
+ $values[] = (int) $month->c;
64
+ $labels[] = date("M y", date_create_from_format("Y-m", $month->d)->getTimestamp());
65
  }
66
+ $values = array_reverse($values);
67
+ $labels = array_reverse($labels);
68
+
69
+ $lists = $this->get_lists();
70
  ?>
71
 
72
  <div class="wrap" id="tnp-wrap">
73
 
74
+ <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
 
 
 
 
 
 
 
75
 
76
  <div id="tnp-body" class="tnp-main-index">
77
+ <div class="tnp-dashboard">
78
+ <div class="tnp-cards-container">
79
+ <div class="tnp-card tnp-mimosa">
80
+ <div class="tnp-card-title">Forms</div>
81
+ <div class="tnp-card-description">Setup the form fields and labels.</div>
82
+ <div class="tnp-card-button-container">
83
+ <a href="?page=newsletter_subscription_profile">Edit forms</a>
84
+ </div>
85
+ </div>
86
+ <div class="tnp-card">
87
+ <div class="tnp-card-title">Lists</div>
88
+ <div class="tnp-card-description">You have <?php echo count($lists) ?> lists.</div>
89
+ <div class="tnp-card-button-container">
90
+ <a href="?page=newsletter_subscription_lists">Manage</a>
91
+ </div>
92
+ </div>
93
+ <div class="tnp-card">
94
+ <div class="tnp-card-title">Delivery</div>
95
+ <div class="tnp-card-description">Change the delivery speed, sender name and return path.</div>
96
+ <div class="tnp-card-button-container">
97
+ <a href="?page=newsletter_main_main">Change the delivery settings</a>
98
+ </div>
99
+ </div>
100
+ <div class="tnp-card">
101
+ <div class="tnp-card-title">Personal Info</div>
102
+ <div class="tnp-card-description">Set your company name, address, socials.</div>
103
+ <div class="tnp-card-button-container">
104
+ <a href="?page=newsletter_main_info">Edit your info</a>
105
+ </div>
106
+ </div>
107
+ </div>
108
+ <div class="tnp-cards-container">
109
+ <div class="tnp-card">
110
+ <div class="tnp-card-title">Newsletters</div>
111
+ <div class="tnp-card-upper-buttons"><a href="?page=newsletter_emails_composer"><?php _e('New', 'newsletter') ?></a></div>
112
+ <div class="tnp-card-upper-buttons"><a href="?page=newsletter_emails_index"><?php _e('List', 'newsletter') ?></a></div>
113
+ <div class="tnp-card-content">
114
+ <?php foreach ($emails as $email) { ?>
115
+ <div class="tnp-card-newsletter-list">
116
+ <?php
117
+ $subject = $email->subject ? $email->subject : "Newsletter #" . $email->id;
118
+ ?>
119
+ <div class="tnp-card-newsletters-subject">
120
+ <?php echo esc_html($subject) ?>
121
+ </div>
122
+ <div class="tnp-card-newsletters-status">
123
+ <?php $emails_module->show_email_status_label($email) ?>
124
+ </div>
125
+ <div class="tnp-card-newsletters-progress">
126
+ <?php $emails_module->show_email_progress_bar($email, array('scheduled' => true)) ?>
127
+ </div>
128
+ <div class="tnp-card-newsletters-action">
129
+ <?php
130
+ if ($email->status == 'sent') {
131
+ echo '<a class="button-primary" href="' . $statistics_module->get_statistics_url($email->id) . '"><i class="fas fa-chart-bar"></i></a>';
132
+ } else {
133
+ echo $emails_module->get_edit_button($email, true);
134
+ }
135
+ ?>
136
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  </div>
138
+ <?php } ?>
139
+ </div>
140
+ </div>
 
 
 
 
 
141
 
142
+ <div class="tnp-card">
143
+ <div class="tnp-card-title">Last Subscribers</div>
144
+ <div class="tnp-card-upper-buttons"><a href="<?php echo $users_module->get_admin_page_url('new'); ?>"><?php _e('New', 'newsletter') ?></a></div>
145
+ <div class="tnp-card-upper-buttons"><a href="<?php echo $users_module->get_admin_page_url('index'); ?>"><?php _e('List', 'newsletter') ?></a></div>
146
+ <div class="tnp-card-content">
147
 
148
+ <?php foreach ($subscribers as $s) { ?>
149
+ <div class="tnp-card-newsletter-list">
150
+ <div class="tnp-card-newsletters-subscriber-email">
151
+ <?php echo esc_html($s->email) ?>
152
  </div>
153
 
154
+ <div class="tnp-card-newsletters-subscriber-name">
155
+ <?php echo esc_html($s->name) ?> <?php echo esc_html($s->surname) ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  </div>
157
+ <div class="tnp-card-newsletters-subscriber-status">
158
+ <?php echo $emails_module->get_user_status_label($s) ?>
 
 
 
 
159
  </div>
160
+ <div class="tnp-card-newsletters-action">
161
+ <a class="button-primary"
162
+ title="<?php _e('Edit', 'newsletter') ?>"
163
+ href="<?php echo $users_module->get_admin_page_url('edit'); ?>&amp;id=<?php echo $s->id; ?>"><i
164
+ class="fas fa-edit"></i></a>
165
+ <!--
166
+ <a title="<?php _e('Profile', 'newsletter') ?>"
167
+ href="<?php echo home_url('/') ?>?na=p&nk=<?php echo $s->id . '-' . $s->token; ?>"
168
+ class="button-primary" target="_blank"><i
169
+ class="fas fa-user"></i></a>-->
170
  </div>
171
  </div>
172
+ <?php } ?>
173
+
174
+
175
+
176
+ </div>
177
+ </div>
178
+ </div>
179
+ <div class="tnp-cards-container">
180
+ <div class="tnp-card">
181
+ <div class="tnp-card-title"><?php _e('Subscriptions', 'newsletter') ?></div>
182
+ <div class="tnp-canvas">
183
+ <canvas id="tnp-events-chart-canvas" height="300"></canvas>
184
  </div>
185
 
186
+ <script type="text/javascript">
187
+ var events_data = {
188
+ labels: <?php echo json_encode($labels) ?>,
189
+ datasets: [
190
+ {
191
+ label: "<?php _e('Subscriptions', 'newsletter') ?>",
192
+ fill: true,
193
+ strokeColor: "#27AE60",
194
+ backgroundColor: "#293544",
195
+ borderColor: "#27AE60",
196
+ pointBorderColor: "#27AE60",
197
+ pointBackgroundColor: "#ECF0F1",
198
+ data: <?php echo json_encode($values) ?>
199
+ }
200
+ ]
201
+ };
202
+
203
+ jQuery(document).ready(function ($) {
204
+ ctxe = $('#tnp-events-chart-canvas').get(0).getContext("2d");
205
+ eventsLineChart = new Chart(ctxe, {
206
+ type: 'line', data: events_data,
207
+ options: {
208
+ maintainAspectRatio: false,
209
+ xresponsive: true,
210
+ scales: {
211
+ xAxes: [{
212
+ type: "category",
213
+ "id": "x-axis-1",
214
+ gridLines: {display: false},
215
+ ticks: {fontFamily: "soleil"}
216
+ }],
217
+ yAxes: [
218
+ {
219
+ type: "linear",
220
+ "id": "y-axis-1",
221
+ gridLines: {display: false},
222
+ ticks: {fontFamily: "soleil"}
223
+ },
224
+ ]
225
+ },
226
+ }
227
+ });
228
+ });
229
+ </script>
230
+ </div>
231
+ <div class="tnp-card">
232
+ <div class="tnp-card-title"><?php _e('Documentation', 'newsletter') ?></div>
233
+ <div class="break"></div>
234
+ <a href="https://www.thenewsletterplugin.com/documentation/installation/">
235
+ <div class="tnp-card-documentation-index">
236
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
237
+ Installation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  </div>
239
+ </a>
240
+ <a href="https://www.thenewsletterplugin.com/documentation/subscription/">
241
+ <div class="tnp-card-documentation-index">
242
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
243
+ Subscription
244
+ </div>
245
+ </a>
246
+ <a href="https://www.thenewsletterplugin.com/category/tips">
247
+ <div class="tnp-card-documentation-index">
248
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
249
+ Tips & Tricks
250
+ </div>
251
+ </a>
252
+ <a href="https://www.thenewsletterplugin.com/documentation/subscribers-and-management/">
253
+ <div class="tnp-card-documentation-index">
254
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
255
+ Subscribers and management
256
+ </div>
257
+ </a>
258
+ <a href="https://www.thenewsletterplugin.com/documentation/newsletters/newsletters-module/">
259
+ <div class="tnp-card-documentation-index">
260
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
261
+ Creating Newsletters
262
+ </div>
263
+ </a>
264
+ <a href="https://www.thenewsletterplugin.com/documentation/addons/">
265
+ <div class="tnp-card-documentation-index">
266
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
267
+ Premium Addons
268
+ </div>
269
+ </a>
270
+ <a href="https://www.thenewsletterplugin.com/documentation/customization/">
271
+ <div class="tnp-card-documentation-index">
272
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
273
+ Customization
 
 
274
  </div>
275
+ </a>
276
+ <a href="https://www.thenewsletterplugin.com/documentation/delivery-and-spam/">
277
+ <div class="tnp-card-documentation-index">
278
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
279
+ Delivery and spam
280
+ </div>
281
+ </a>
282
+ <a href="https://www.thenewsletterplugin.com/documentation/developers/">
283
+ <div class="tnp-card-documentation-index">
284
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="20" height="20"><title>saved items</title><g class="nc-icon-wrapper" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" ><path d="M37,4h3a4,4,0,0,1,4,4V40a4,4,0,0,1-4,4H8a4,4,0,0,1-4-4V8A4,4,0,0,1,8,4h3" fill="none" stroke-miterlimit="10"/> <polygon points="32 24 24 18 16 24 16 4 32 4 32 24" fill="none" stroke-miterlimit="10" data-color="color-2"/></g></svg>
285
+ Developers & Advanced Topics
286
+ </div>
287
+ </a>
288
+ </div>
289
+ </div>
290
+ <div class="tnp-cards-container">
291
+ <div class="tnp-card" style="align-self: flex-start">
292
+ <div class="tnp-card-title"><?php _e('Developers', 'newsletter') ?></div>
293
+ <div class="tnp-card-description">Extending Newsletter by yourself? There is something for you as well!</div>
294
+ <div class="tnp-card-button-container">
295
+ <a href="https://www.thenewsletterplugin.com/documentation/developers/">Developer's love 💛</a>
296
+ </div>
297
+ </div>
298
+ <div class="tnp-card">
299
+ <div class="tnp-card-title"><?php _e('Video Tutorials', 'newsletter') ?></div>
300
+ <div class="tnp-card-description">We have some videos to help gest the most from Newsletter.</div>
301
+ <div class="tnp-card-video">
302
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/zmVmW84Bw9A" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
303
+ </div>
304
+ <div class="tnp-card-button-container">
305
+ <a href="?https://www.thenewsletterplugin.com/video-tutorials">See the videos</a>
306
  </div>
307
  </div>
308
  </div>
309
 
310
  </div>
311
 
312
+ <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
313
 
314
  </div>
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
- Version: 7.0.3
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -35,7 +35,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
35
  return;
36
  }
37
 
38
- define('NEWSLETTER_VERSION', '7.0.3');
39
 
40
  global $newsletter, $wpdb;
41
 
@@ -523,6 +523,7 @@ class Newsletter extends NewsletterModule {
523
  wp_enqueue_style('tnp-admin-fontawesome', $newsletter_url . '/vendor/fa/css/all.min.css', [], NEWSLETTER_VERSION);
524
  wp_enqueue_style('tnp-admin-jquery-ui', $newsletter_url . '/vendor/jquery-ui/jquery-ui.min.css', [], NEWSLETTER_VERSION);
525
  wp_enqueue_style('tnp-admin-dropdown', $newsletter_url . '/css/dropdown.css', [], NEWSLETTER_VERSION);
 
526
  wp_enqueue_style('tnp-admin-fields', $newsletter_url . '/css/fields.css', [], NEWSLETTER_VERSION);
527
  wp_enqueue_style('tnp-admin-widgets', $newsletter_url . '/css/widgets.css', [], NEWSLETTER_VERSION);
528
  wp_enqueue_style('tnp-admin', $newsletter_url . '/admin.css',
4
  Plugin Name: Newsletter
5
  Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
+ Version: 7.0.4
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
35
  return;
36
  }
37
 
38
+ define('NEWSLETTER_VERSION', '7.0.4');
39
 
40
  global $newsletter, $wpdb;
41
 
523
  wp_enqueue_style('tnp-admin-fontawesome', $newsletter_url . '/vendor/fa/css/all.min.css', [], NEWSLETTER_VERSION);
524
  wp_enqueue_style('tnp-admin-jquery-ui', $newsletter_url . '/vendor/jquery-ui/jquery-ui.min.css', [], NEWSLETTER_VERSION);
525
  wp_enqueue_style('tnp-admin-dropdown', $newsletter_url . '/css/dropdown.css', [], NEWSLETTER_VERSION);
526
+ wp_enqueue_style('tnp-admin-dashboard', $newsletter_url . '/css/dashboard.css', [], NEWSLETTER_VERSION);
527
  wp_enqueue_style('tnp-admin-fields', $newsletter_url . '/css/fields.css', [], NEWSLETTER_VERSION);
528
  wp_enqueue_style('tnp-admin-widgets', $newsletter_url . '/css/widgets.css', [], NEWSLETTER_VERSION);
529
  wp_enqueue_style('tnp-admin', $newsletter_url . '/admin.css',
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Newsletter ===
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
- Tested up to: 5.6
5
- Stable tag: 7.0.3
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
  License: GPLv2 or later
@@ -118,13 +118,23 @@ Thank you, The Newsletter Team
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
 
 
121
  = 7.0.3 =
122
 
 
 
123
  * New media selector for blocks
124
  * Minor fixes
125
  * Updated codemirror
126
  * Updated default theme
127
  * Fixed tag filter on posts block (when tags have parathesis or like)
 
128
 
129
  = 7.0.2 =
130
 
@@ -138,7 +148,7 @@ Thank you, The Newsletter Team
138
 
139
  * Added multiple newsletter selection for deletion
140
  * Added text part on welcome and activation email
141
- * Added the attribute "show_form" to "newsletter" shortcode
142
  * Added filter on subscriber saving (from external systems) with wrong list field values
143
  * Added index.html on log folder
144
 
@@ -175,6 +185,11 @@ Thank you, The Newsletter Team
175
  * Added Telegram and VK icon on social block component
176
 
177
  = 6.9.5 =
 
 
 
 
 
178
 
179
  * Added pagination on newsletters page table
180
  * Changed label text for empty language in edit user page
1
  === Newsletter ===
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
+ Tested up to: 5.6.2
5
+ Stable tag: 7.0.4
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
  License: GPLv2 or later
118
 
119
  == Changelog ==
120
 
121
+ = 7.0.4 =
122
+
123
+ * Redesigned drag and drop composer
124
+ * NEW! Save drag and drop composed newsletters as templates to reuse easily
125
+ * Redesigned dashboard
126
+ * Several bug and fixes
127
+
128
  = 7.0.3 =
129
 
130
+ * Option to choose between unsubscription and profile link in the footer block
131
+ * Direct image src URL for image block
132
  * New media selector for blocks
133
  * Minor fixes
134
  * Updated codemirror
135
  * Updated default theme
136
  * Fixed tag filter on posts block (when tags have parathesis or like)
137
+ * Fixed composer visualization of bullet points
138
 
139
  = 7.0.2 =
140
 
148
 
149
  * Added multiple newsletter selection for deletion
150
  * Added text part on welcome and activation email
151
+ * Added the attribute "show_form" to "newsletter" shortcode
152
  * Added filter on subscriber saving (from external systems) with wrong list field values
153
  * Added index.html on log folder
154
 
185
  * Added Telegram and VK icon on social block component
186
 
187
  = 6.9.5 =
188
+ * Added new posts block layout
189
+ * Improved the mobile version of hero block
190
+ * Added title and text global fonts
191
+
192
+ = NEXT =
193
 
194
  * Added pagination on newsletters page table
195
  * Changed label text for empty language in edit user page
style.css CHANGED
@@ -1,7 +1,7 @@
1
  /*
2
 
3
  THIS FILE IS OVERWRITTEN EVERY TIME YOU UPDATE THE PLUGIN.
4
- USE THE CUSOTM CSS OPTION IN THE SUBSCRIPTION SETTING PANEL FOR YOUR
5
  CUSTOM CSS RULES.
6
 
7
  */
1
  /*
2
 
3
  THIS FILE IS OVERWRITTEN EVERY TIME YOU UPDATE THE PLUGIN.
4
+ USE THE CUSTOM CSS OPTION IN THE SUBSCRIPTION SETTING PANEL FOR YOUR
5
  CUSTOM CSS RULES.
6
 
7
  */
subscription/subscription.php CHANGED
@@ -1032,7 +1032,7 @@ class NewsletterSubscription extends NewsletterModule {
1032
 
1033
  $options = $this->get_options('', $language);
1034
  $message = [];
1035
- $message['html'] = $options[$type . '_message'];
1036
  $message['text'] = $this->get_text_message($type);
1037
  if ($user->status == Newsletter::STATUS_NOT_CONFIRMED) {
1038
  $message['html'] = $this->add_microdata($message['html']);
1032
 
1033
  $options = $this->get_options('', $language);
1034
  $message = [];
1035
+ $message['html'] = do_shortcode( $options[ $type . '_message' ] );
1036
  $message['text'] = $this->get_text_message($type);
1037
  if ($user->status == Newsletter::STATUS_NOT_CONFIRMED) {
1038
  $message['html'] = $this->add_microdata($message['html']);
tnp-header.php CHANGED
@@ -108,7 +108,7 @@ $warning |= empty($status_options['mail']);
108
  <li>
109
  <a href="#"><i class="fas fa-newspaper"></i> <?php _e('Newsletters', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
110
  <ul>
111
- <li><a href="?page=newsletter_emails_theme"><i class="fas fa-plus"></i> <?php _e('Create newsletter', 'newsletter') ?>
112
  <small><?php _e('Start your new campaign', 'newsletter') ?></small></a></li>
113
  <li><a href="?page=newsletter_emails_index"><i class="fas fa-newspaper"></i> <?php _e('Newsletters', 'newsletter') ?>
114
  <small><?php _e('The classic "write & send" newsletters', 'newsletter') ?></small></a></li>
108
  <li>
109
  <a href="#"><i class="fas fa-newspaper"></i> <?php _e('Newsletters', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
110
  <ul>
111
+ <li><a href="?page=newsletter_emails_composer"><i class="fas fa-plus"></i> <?php _e('Create newsletter', 'newsletter') ?>
112
  <small><?php _e('Start your new campaign', 'newsletter') ?></small></a></li>
113
  <li><a href="?page=newsletter_emails_index"><i class="fas fa-newspaper"></i> <?php _e('Newsletters', 'newsletter') ?>
114
  <small><?php _e('The classic "write & send" newsletters', 'newsletter') ?></small></a></li>
unsubscription/unsubscription.php CHANGED
@@ -1,217 +1,217 @@
1
- <?php
2
-
3
- defined('ABSPATH') || exit;
4
-
5
- class NewsletterUnsubscription extends NewsletterModule {
6
-
7
- static $instance;
8
-
9
- /**
10
- * @return NewsletterUnsubscription
11
- */
12
- static function instance() {
13
- if (self::$instance == null) {
14
- self::$instance = new NewsletterUnsubscription();
15
- }
16
- return self::$instance;
17
- }
18
-
19
- function __construct() {
20
- parent::__construct('unsubscription', '1.0.3');
21
-
22
- add_filter('newsletter_replace', array($this, 'hook_newsletter_replace'), 10, 4);
23
- add_filter('newsletter_page_text', array($this, 'hook_newsletter_page_text'), 10, 3);
24
- add_filter('newsletter_message_headers', array($this, 'hook_add_unsubscribe_headers_to_email'), 10, 3);
25
-
26
- add_action('newsletter_action', array($this, 'hook_newsletter_action'), 11, 3);
27
- }
28
-
29
- function hook_newsletter_action($action, $user, $email) {
30
-
31
- if (in_array($action, ['u', 'uc', 'lu', 'reactivate'])) {
32
- if (!$user) {
33
- $this->dienow(__('Subscriber not found', 'newsletter'), 'Already deleted or using the wrong subscriber key in the URL', 404);
34
- }
35
- }
36
-
37
- switch ($action) {
38
- case 'u':
39
- $url = $this->build_message_url(null, 'unsubscribe', $user, $email);
40
- wp_redirect($url);
41
- die();
42
- break;
43
-
44
- case 'lu': //Left for backwards compatibility, could be removed after some time
45
- case 'uc':
46
- if (isset($_POST['List-Unsubscribe']) && 'One-Click' === $_POST['List-Unsubscribe']) {
47
- $this->unsubscribe($user, $email);
48
- } else if ($this->antibot_form_check()) {
49
- $this->unsubscribe($user, $email);
50
- $url = $this->build_message_url(null, 'unsubscribed', $user, $email);
51
- wp_redirect($url);
52
- } else {
53
- $this->request_to_antibot_form('Unsubscribe');
54
- }
55
- die();
56
- break;
57
-
58
- case 'reactivate':
59
- if ($this->antibot_form_check()) {
60
- $this->reactivate($user);
61
- $url = $this->build_message_url(null, 'reactivated', $user);
62
- wp_redirect($url);
63
- } else {
64
- $this->request_to_antibot_form('Reactivate');
65
- }
66
- die();
67
- break;
68
- }
69
- }
70
-
71
- /**
72
- * Unsubscribes the subscriber from the request. Die on subscriber extraction failure.
73
- *
74
- * @return TNP_User
75
- */
76
- function unsubscribe($user, $email = null) {
77
- global $wpdb;
78
-
79
- if ($user->status == TNP_User::STATUS_UNSUBSCRIBED) {
80
- return $user;
81
- }
82
-
83
- $this->refresh_user_token($user);
84
- $this->set_user_status($user, TNP_User::STATUS_UNSUBSCRIBED);
85
-
86
- $this->add_user_log($user, 'unsubscribe');
87
-
88
- do_action('newsletter_user_unsubscribed', $user);
89
-
90
- if ($email) {
91
- $wpdb->update(NEWSLETTER_USERS_TABLE, array('unsub_email_id' => (int) $email->id, 'unsub_time' => time()), array('id' => $user->id));
92
- }
93
-
94
- $this->send_unsubscribed_email($user);
95
-
96
- $this->notify_admin_on_unsubscription($user);
97
-
98
- return $user;
99
- }
100
-
101
- function send_unsubscribed_email($user, $force = false) {
102
- $options = $this->get_options('', $this->get_user_language($user));
103
- if (!$force && !empty($options['unsubscribed_disabled'])) {
104
- return true;
105
- }
106
-
107
- $message = $options['unsubscribed_message'];
108
- $subject = $options['unsubscribed_subject'];
109
-
110
- return NewsletterSubscription::instance()->mail($user, $subject, $message);
111
- }
112
-
113
- function notify_admin_on_unsubscription($user) {
114
-
115
- if (empty($this->options['notify_admin_on_unsubscription'])) {
116
- return;
117
- }
118
-
119
- $message = $this->generate_admin_notification_message($user);
120
- $email = trim(get_option('admin_email'));
121
- $subject = $this->generate_admin_notification_subject('New cancellation');
122
-
123
- Newsletter::instance()->mail($email, $subject, array('html' => $message));
124
- }
125
-
126
- /**
127
- * Reactivate the subscriber extracted from the request setting his status
128
- * to confirmed and logging. No email are sent. Dies on subscriber extraction failure.
129
- *
130
- * @return TNP_User
131
- */
132
- function reactivate($user = null) {
133
- // For compatibility, to be removed
134
- if (!$user) {
135
- $user = $this->get_user_from_request(true);
136
- }
137
- $this->set_user_status($user, TNP_User::STATUS_CONFIRMED);
138
- $this->add_user_log($user, 'reactivate');
139
- do_action('newsletter_user_reactivated', $user);
140
- }
141
-
142
- function hook_newsletter_replace($text, $user, $email, $html = true) {
143
-
144
- if ($user) {
145
- $text = $this->replace_url($text, 'unsubscription_confirm_url', $this->build_action_url('uc', $user, $email));
146
- $text = $this->replace_url($text, 'unsubscription_url', $this->build_action_url('u', $user, $email));
147
- $text = $this->replace_url($text, 'reactivate_url', $this->build_action_url('reactivate', $user, $email));
148
- } else {
149
- $text = $this->replace_url($text, 'unsubscription_confirm_url', $this->build_action_url('nul'));
150
- $text = $this->replace_url($text, 'unsubscription_url', $this->build_action_url('nul'));
151
- }
152
-
153
- return $text;
154
- }
155
-
156
- function hook_newsletter_page_text($text, $key, $user = null) {
157
-
158
- $options = $this->get_options('', $this->get_current_language($user));
159
- if ($key == 'unsubscribe') {
160
- if (!$user) {
161
- return 'Subscriber not found.';
162
- }
163
- return $options['unsubscribe_text'];
164
- }
165
- if ($key == 'unsubscribed') {
166
- if (!$user) {
167
- return $options['error_text'];
168
- }
169
- return $options['unsubscribed_text'];
170
- }
171
- if ($key == 'reactivated') {
172
- if (!$user) {
173
- return $options['error_text'];
174
- }
175
- return $options['reactivated_text'];
176
- }
177
- if ($key == 'unsubscription_error') {
178
- return $options['error_text'];
179
- }
180
- return $text;
181
- }
182
-
183
- function admin_menu() {
184
- $this->add_admin_page('index', 'Unsubscribe');
185
- }
186
-
187
- /**
188
- * @param array $headers
189
- * @param TNP_Email $email
190
- * @param TNP_User $user
191
- *
192
- * @return array
193
- */
194
- function hook_add_unsubscribe_headers_to_email($headers, $email, $user) {
195
-
196
- if (isset($this->options['disable_unsubscribe_headers']) && $this->options['disable_unsubscribe_headers'] == 1) {
197
- return $headers;
198
- }
199
-
200
- $list_unsubscribe_values = [];
201
- if (!empty($this->options['list_unsubscribe_mailto_header'])) {
202
- $unsubscribe_address = $this->options['list_unsubscribe_mailto_header'];
203
- $list_unsubscribe_values[] = "<mailto:$unsubscribe_address?subject=unsubscribe>";
204
- }
205
-
206
- $unsubscribe_action_url = $this->build_action_url('uc', $user, $email);
207
- $list_unsubscribe_values[] = "<$unsubscribe_action_url>";
208
-
209
- $headers['List-Unsubscribe'] = implode(', ', $list_unsubscribe_values);
210
- $headers['List-Unsubscribe-Post'] = 'List-Unsubscribe=One-Click';
211
-
212
- return $headers;
213
- }
214
-
215
- }
216
-
217
- NewsletterUnsubscription::instance();
1
+ <?php
2
+
3
+ defined('ABSPATH') || exit;
4
+
5
+ class NewsletterUnsubscription extends NewsletterModule {
6
+
7
+ static $instance;
8
+
9
+ /**
10
+ * @return NewsletterUnsubscription
11
+ */
12
+ static function instance() {
13
+ if (self::$instance == null) {
14
+ self::$instance = new NewsletterUnsubscription();
15
+ }
16
+ return self::$instance;
17
+ }
18
+
19
+ function __construct() {
20
+ parent::__construct('unsubscription', '1.0.3');
21
+
22
+ add_filter('newsletter_replace', array($this, 'hook_newsletter_replace'), 10, 4);
23
+ add_filter('newsletter_page_text', array($this, 'hook_newsletter_page_text'), 10, 3);
24
+ add_filter('newsletter_message_headers', array($this, 'hook_add_unsubscribe_headers_to_email'), 10, 3);
25
+
26
+ add_action('newsletter_action', array($this, 'hook_newsletter_action'), 11, 3);
27
+ }
28
+
29
+ function hook_newsletter_action($action, $user, $email) {
30
+
31
+ if (in_array($action, ['u', 'uc', 'lu', 'reactivate'])) {
32
+ if (!$user) {
33
+ $this->dienow(__('Subscriber not found', 'newsletter'), 'Already deleted or using the wrong subscriber key in the URL', 404);
34
+ }
35
+ }
36
+
37
+ switch ($action) {
38
+ case 'u':
39
+ $url = $this->build_message_url(null, 'unsubscribe', $user, $email);
40
+ wp_redirect($url);
41
+ die();
42
+ break;
43
+
44
+ case 'lu': //Left for backwards compatibility, could be removed after some time
45
+ case 'uc':
46
+ if (isset($_POST['List-Unsubscribe']) && 'One-Click' === $_POST['List-Unsubscribe']) {
47
+ $this->unsubscribe($user, $email);
48
+ } else if ($this->antibot_form_check()) {
49
+ $this->unsubscribe($user, $email);
50
+ $url = $this->build_message_url(null, 'unsubscribed', $user, $email);
51
+ wp_redirect($url);
52
+ } else {
53
+ $this->request_to_antibot_form('Unsubscribe');
54
+ }
55
+ die();
56
+ break;
57
+
58
+ case 'reactivate':
59
+ if ($this->antibot_form_check()) {
60
+ $this->reactivate($user);
61
+ $url = $this->build_message_url(null, 'reactivated', $user);
62
+ wp_redirect($url);
63
+ } else {
64
+ $this->request_to_antibot_form('Reactivate');
65
+ }
66
+ die();
67
+ break;
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Unsubscribes the subscriber from the request. Die on subscriber extraction failure.
73
+ *
74
+ * @return TNP_User
75
+ */
76
+ function unsubscribe($user, $email = null) {
77
+ global $wpdb;
78
+
79
+ if ($user->status == TNP_User::STATUS_UNSUBSCRIBED) {
80
+ return $user;
81
+ }
82
+
83
+ $this->refresh_user_token($user);
84
+ $this->set_user_status($user, TNP_User::STATUS_UNSUBSCRIBED);
85
+
86
+ $this->add_user_log($user, 'unsubscribe');
87
+
88
+ do_action('newsletter_user_unsubscribed', $user);
89
+
90
+ if ($email) {
91
+ $wpdb->update(NEWSLETTER_USERS_TABLE, array('unsub_email_id' => (int) $email->id, 'unsub_time' => time()), array('id' => $user->id));
92
+ }
93
+
94
+ $this->send_unsubscribed_email($user);
95
+
96
+ $this->notify_admin_on_unsubscription($user);
97
+
98
+ return $user;
99
+ }
100
+
101
+ function send_unsubscribed_email($user, $force = false) {
102
+ $options = $this->get_options('', $this->get_user_language($user));
103
+ if (!$force && !empty($options['unsubscribed_disabled'])) {
104
+ return true;
105
+ }
106
+
107
+ $message = do_shortcode( $options['unsubscribed_message'] );
108
+ $subject = $options['unsubscribed_subject'];
109
+
110
+ return NewsletterSubscription::instance()->mail($user, $subject, $message);
111
+ }
112
+
113
+ function notify_admin_on_unsubscription($user) {
114
+
115
+ if (empty($this->options['notify_admin_on_unsubscription'])) {
116
+ return;
117
+ }
118
+
119
+ $message = $this->generate_admin_notification_message($user);
120
+ $email = trim(get_option('admin_email'));
121
+ $subject = $this->generate_admin_notification_subject('New cancellation');
122
+
123
+ Newsletter::instance()->mail($email, $subject, array('html' => $message));
124
+ }
125
+
126
+ /**
127
+ * Reactivate the subscriber extracted from the request setting his status
128
+ * to confirmed and logging. No email are sent. Dies on subscriber extraction failure.
129
+ *
130
+ * @return TNP_User
131
+ */
132
+ function reactivate($user = null) {
133
+ // For compatibility, to be removed
134
+ if (!$user) {
135
+ $user = $this->get_user_from_request(true);
136
+ }
137
+ $this->set_user_status($user, TNP_User::STATUS_CONFIRMED);
138
+ $this->add_user_log($user, 'reactivate');
139
+ do_action('newsletter_user_reactivated', $user);
140
+ }
141
+
142
+ function hook_newsletter_replace($text, $user, $email, $html = true) {
143
+
144
+ if ($user) {
145
+ $text = $this->replace_url($text, 'unsubscription_confirm_url', $this->build_action_url('uc', $user, $email));
146
+ $text = $this->replace_url($text, 'unsubscription_url', $this->build_action_url('u', $user, $email));
147
+ $text = $this->replace_url($text, 'reactivate_url', $this->build_action_url('reactivate', $user, $email));
148
+ } else {
149
+ $text = $this->replace_url($text, 'unsubscription_confirm_url', $this->build_action_url('nul'));
150
+ $text = $this->replace_url($text, 'unsubscription_url', $this->build_action_url('nul'));
151
+ }
152
+
153
+ return $text;
154
+ }
155
+
156
+ function hook_newsletter_page_text($text, $key, $user = null) {
157
+
158
+ $options = $this->get_options('', $this->get_current_language($user));
159
+ if ($key == 'unsubscribe') {
160
+ if (!$user) {
161
+ return 'Subscriber not found.';
162
+ }
163
+ return $options['unsubscribe_text'];
164
+ }
165
+ if ($key == 'unsubscribed') {
166
+ if (!$user) {
167
+ return $options['error_text'];
168
+ }
169
+ return $options['unsubscribed_text'];
170
+ }
171
+ if ($key == 'reactivated') {
172
+ if (!$user) {
173
+ return $options['error_text'];
174
+ }
175
+ return $options['reactivated_text'];
176
+ }
177
+ if ($key == 'unsubscription_error') {
178
+ return $options['error_text'];
179
+ }
180
+ return $text;
181
+ }
182
+
183
+ function admin_menu() {
184
+ $this->add_admin_page('index', 'Unsubscribe');
185
+ }
186
+
187
+ /**
188
+ * @param array $headers
189
+ * @param TNP_Email $email
190
+ * @param TNP_User $user
191
+ *
192
+ * @return array
193
+ */
194
+ function hook_add_unsubscribe_headers_to_email($headers, $email, $user) {
195
+
196
+ if (isset($this->options['disable_unsubscribe_headers']) && $this->options['disable_unsubscribe_headers'] == 1) {
197
+ return $headers;
198
+ }
199
+
200
+ $list_unsubscribe_values = [];
201
+ if (!empty($this->options['list_unsubscribe_mailto_header'])) {
202
+ $unsubscribe_address = $this->options['list_unsubscribe_mailto_header'];
203
+ $list_unsubscribe_values[] = "<mailto:$unsubscribe_address?subject=unsubscribe>";
204
+ }
205
+
206
+ $unsubscribe_action_url = $this->build_action_url('uc', $user, $email);
207
+ $list_unsubscribe_values[] = "<$unsubscribe_action_url>";
208
+
209
+ $headers['List-Unsubscribe'] = implode(', ', $list_unsubscribe_values);
210
+ $headers['List-Unsubscribe-Post'] = 'List-Unsubscribe=One-Click';
211
+
212
+ return $headers;
213
+ }
214
+
215
+ }
216
+
217
+ NewsletterUnsubscription::instance();
vendor/spectrum/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) Brian Grinstead and spectrum contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vendor/spectrum/spectrum.min.css CHANGED
@@ -1 +1 @@
1
- .sp-container{position:absolute;top:0;left:0;display:inline-block;z-index:9999994;overflow:hidden}.sp-original-input-container{position:relative}.sp-original-input-container input+.sp-add-on{position:absolute;left:0;top:0;bottom:0;border-top:none!important;border-bottom:none!important;border-top-right-radius:0!important;border-bottom-right-radius:0!important}input.spectrum.with-add-on{padding-left:45px}.sp-original-input-container input+.sp-add-on .sp-colorize{height:100%;width:100%;border-radius:inherit}backgrou .sp-colorize-container{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.sp-container.sp-flat{position:relative}.sp-container,.sp-container *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.sp-top{position:relative;width:100%;display:inline-block}.sp-top-inner{position:absolute;top:0;left:0;bottom:0;right:0}.sp-color{position:absolute;top:0;left:0;bottom:0;right:20px!important}.sp-hue{position:absolute;top:0;right:0;bottom:0;width:12px;height:100%;left:initial!important}.sp-clear-enabled .sp-hue{top:15%;height:85%}.sp-fill{padding-top:80%}.sp-sat,.sp-val{position:absolute;top:0;left:0;right:0;bottom:0}.sp-alpha-enabled .sp-top{margin-bottom:28px}.sp-alpha-enabled .sp-alpha{display:block}.sp-alpha-handle{position:absolute;top:-3px;cursor:pointer;height:16px;border-radius:50%;width:16px;margin-right:5px;left:-2px;right:0;background:#f9f9f9;box-shadow:0 0 2px 0 #3a3a3a}.sp-alpha{display:none;position:absolute;bottom:-18px;right:0;left:0;height:10px}.sp-alpha-inner{border-radius:4px}.sp-clear{display:none}.sp-clear.sp-clear-display{background-position:center}.sp-clear-enabled .sp-clear{display:block;position:absolute;top:3px;right:0;bottom:0;cursor:pointer;left:initial;height:12px;width:12px}.sp-alpha,.sp-alpha-handle,.sp-clear,.sp-container,.sp-container button,.sp-container.sp-dragging .sp-input,.sp-dragger,.sp-preview,.sp-replacer,.sp-slider{-webkit-user-select:none;-moz-user-select:-moz-none;-o-user-select:none;user-select:none}.sp-container.sp-input-disabled .sp-input-container{display:none}.sp-container.sp-buttons-disabled .sp-button-container{display:none}.sp-container.sp-palette-buttons-disabled .sp-palette-button-container{display:none}.sp-palette-only .sp-picker-container{display:none}.sp-palette-disabled .sp-palette-container{display:none}.sp-initial-disabled .sp-initial{display:none}.sp-sat{background-image:-webkit-gradient(linear,0 0,100% 0,from(#fff),to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:-moz-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:-o-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:-ms-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:linear-gradient(to right,#fff,rgba(204,154,129,0))}.sp-val{border-radius:4px;background-image:-webkit-gradient(linear,0 100%,0 0,from(#000),to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-moz-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-o-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-ms-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:linear-gradient(to top,#000,rgba(204,154,129,0))}.sp-hue{background:-moz-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-ms-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-o-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-webkit-gradient(linear,left top,left bottom,from(red),color-stop(.17,#ff0),color-stop(.33,#0f0),color-stop(.5,#0ff),color-stop(.67,#00f),color-stop(.83,#f0f),to(red));background:-webkit-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.sp-1{height:17%}.sp-2{height:16%}.sp-3{height:17%}.sp-4{height:17%}.sp-5{height:16%}.sp-6{height:17%}.sp-hidden{display:none!important}.sp-cf:after,.sp-cf:before{content:"";display:table}.sp-cf:after{clear:both}@media (max-device-width:480px){.sp-color{right:40%}.sp-hue{left:63%}.sp-fill{padding-top:60%}}.sp-dragger{border-radius:5px;height:10px;width:10px;border:1px solid #fff;cursor:pointer;position:absolute;top:0;left:0;margin-left:3px;margin-top:3px;box-shadow:0 0 2px 1px rgba(0,0,0,.2)}.sp-slider{position:absolute;top:0;cursor:pointer;height:16px;border-radius:50%;width:16px;left:-2px;background:#f9f9f9;box-shadow:0 0 2px 0 #3a3a3a;margin-top:8px}.sp-container{border-radius:0;background-color:#fff;padding:0;border-radius:4px;color:#000;box-shadow:0 0 0 1px rgba(99,114,130,.16),0 8px 16px rgba(27,39,51,.08)}.sp-clear,.sp-color,.sp-container,.sp-container button,.sp-container input,.sp-hue{font-size:12px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.sp-top{margin-bottom:10px}.sp-clear,.sp-color,.sp-hue,.sp-sat,.sp-val{border-radius:3px}.sp-input-container{margin-top:-5px;margin-bottom:10px}.sp-button-container.sp-cf,.sp-initial.sp-thumb.sp-cf,.sp-input-container.sp-cf{height:25px}.sp-palette-row-initial>span:first-child{cursor:pointer}.sp-initial-disabled .sp-input-container{width:100%}.sp-input{padding:0 5px!important;margin:0;width:100%;box-shadow:none!important;height:100%!important;background:0 0;color:#3a3a3a;border-radius:2px!important;border:1px solid #e0e0e0!important;text-align:center;font-family:monospace;font-size:inherit!important}.sp-input:focus{border:1px solid orange}.sp-input.sp-validation-error{border:1px solid red;background:#fdd}.sp-palette-container,.sp-picker-container{float:left;position:relative;padding:10px;padding-bottom:300px;margin-bottom:-290px}.sp-picker-container{width:200px;border-left:solid 1px #fff}.sp-palette-container{border-right:solid 1px #ccc}.sp-palette-only .sp-palette-container{border:0}.sp-palette .sp-thumb-el{display:block;position:relative;float:left;width:24px;height:15px;margin:3px;cursor:pointer;border:solid 2px transparent}.sp-palette .sp-thumb-el.sp-thumb-active,.sp-palette .sp-thumb-el:hover{border-color:orange}.sp-thumb-el{position:relative}.sp-initial{float:left}.sp-initial span{width:30px;height:25px;border:none;display:block;float:left;margin:0}.sp-initial .spe-thumb-el.sp-thumb-active{border-radius:0 5px 5px 0}.sp-initial .spe-thumb-el{border-radius:5px 0 0 5px}.sp-initial .sp-clear-display{background-position:center}.sp-button-container{float:right}.sp-palette-button-container{margin-top:10px}.sp-replacer{position:relative;overflow:hidden;cursor:pointer;display:inline-block;border-radius:3px;border:1px solid #ccc;color:#666;transition:color .3s,border-color .3s;vertical-align:middle;width:3rem;height:1.5rem}.sp-replacer.sp-active,.sp-replacer:hover{border:1px solid #666;color:#000}.sp-replacer.sp-disabled{cursor:default;border-color:silver;color:silver}.sp-dd{position:absolute;font-size:10px;right:0;top:0;bottom:0;padding:0 2px;line-height:1.6rem;background-color:#fff}.sp-preview{position:relative;width:100%;height:100%;float:left;z-index:0}.sp-preview-inner{transition:background-color .2s}.sp-preview-inner.sp-clear-display{width:1rem;margin-left:.3rem}.sp-palette .sp-thumb-el{width:16px;height:16px;margin:3px;border:none;border-radius:3px}.sp-container{padding-bottom:0}.sp-container button{border-radius:3px;border:none;background:0 0;line-height:1;padding:0 8px;height:25px;text-transform:capitalize;text-align:center;vertical-align:middle;cursor:pointer;color:#606c72;font-weight:700}.sp-container button.sp-choose{background-color:#3cab3b;color:#fff;margin-left:5px}.sp-container button:hover{opacity:.8}.sp-container button.sp-palette-toggle{width:100%;background-color:#f3f3f3;margin:0}.sp-palette span.sp-thumb-active,.sp-palette span:hover{border-color:#000}.sp-alpha,.sp-preview,.sp-thumb-el{position:relative;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.sp-alpha-inner,.sp-preview-inner,.sp-thumb-inner{display:block;position:absolute;top:0;left:0;bottom:0;right:0}.sp-palette .sp-thumb-inner{border-radius:3px;background-position:50% 50%;background-repeat:no-repeat}.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=)}.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=)}.sp-clear-display{background-repeat:no-repeat;background-position:center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABe0lEQVQokYXSsUtcQRTF4d8Jj+VhHSxkEQuLsEUKK0nhTBFTmLSSUhBCMCAWsmgIwWrBLk0akfwLCaSQKBJmtrIIISwpRFKIhViETScphGMzysMtvOVwvpm5d0bGNCuGWAOPgYdl6S8wSDn9b+bUhDHEKWAdeAFMANg+l/TV9ofcz6cjMIbYBvaBMds7QCqZ58CmpBNgPuV0DvAAIMyFGugWtJr7eTv38xEwkPRPErY7QDeG2LqFkjrAgu0dSd/KDVqSNmxvAZ8lfbS9AHRuYemnLWkv5XRVBrQMbAI/gTXgEzAJtJuwBVS2L2OIle03QA/4Lmkl5XQBXEqqbFcAVYFDYChpFngiqWf7l6TXKaezMt2Zkhk24THwG+jZriX9AFZvUAyxLbRke2D75O5zPAO+ADXwEtizjaRHwDvbTyUtppwOmicCHAJvbXcl9YA1SQDjtseA97YPRz7ATcUQp2y/kjRdevsjaTfldNrMjcDGBjXA3T96L7yvrgFzP69+0Ao/HAAAAABJRU5ErkJggg==)}
1
+ .sp-container{position:absolute;top:0;left:0;display:inline-block;z-index:9999994;overflow:hidden}.sp-original-input-container{position:relative;display:inline-flex}.sp-original-input-container input{margin:0!important}.sp-original-input-container .sp-add-on{width:40px;border-top-right-radius:0!important;border-bottom-right-radius:0!important}input.spectrum.with-add-on{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0}.sp-original-input-container .sp-add-on .sp-colorize{height:100%;width:100%;border-radius:inherit}.sp-colorize-container{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.sp-container.sp-flat{position:relative}.sp-container,.sp-container *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.sp-top{position:relative;width:100%;display:inline-block}.sp-top-inner{position:absolute;top:0;left:0;bottom:0;right:0}.sp-color{position:absolute;top:0;left:0;bottom:0;right:20px!important}.sp-hue{position:absolute;top:0;right:0;bottom:0;width:12px;height:100%;left:initial!important}.sp-clear-enabled .sp-hue{top:15%;height:85%}.sp-fill{padding-top:80%}.sp-sat,.sp-val{position:absolute;top:0;left:0;right:0;bottom:0}.sp-alpha-enabled .sp-top{margin-bottom:28px!important}.sp-alpha-enabled .sp-alpha{display:block}.sp-alpha-handle{position:absolute;top:-3px;cursor:pointer;height:16px;border-radius:50%;width:16px;margin-right:5px;left:-2px;right:0;background:#f9f9f9;box-shadow:0 0 2px 0 #3a3a3a}.sp-alpha{display:none;position:absolute;bottom:-18px;right:0;left:0;height:10px}.sp-alpha-inner{border-radius:4px}.sp-clear{display:none}.sp-clear.sp-clear-display{background-position:center}.sp-clear-enabled .sp-clear{display:block;position:absolute;top:3px;right:0;bottom:0;cursor:pointer;left:initial;height:12px;width:12px}.sp-alpha,.sp-alpha-handle,.sp-clear,.sp-container,.sp-container button,.sp-container.sp-dragging .sp-input,.sp-dragger,.sp-preview,.sp-replacer,.sp-slider{-webkit-user-select:none;-moz-user-select:-moz-none;-o-user-select:none;user-select:none}.sp-container.sp-input-disabled .sp-input-container{display:none}.sp-container.sp-buttons-disabled .sp-button-container{display:none}.sp-container.sp-palette-buttons-disabled .sp-palette-button-container{display:none}.sp-palette-only .sp-picker-container{display:none}.sp-palette-disabled .sp-palette-container{display:none}.sp-initial-disabled .sp-initial{display:none}.sp-sat{background-image:-webkit-gradient(linear,0 0,100% 0,from(#fff),to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:-moz-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:-o-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:-ms-linear-gradient(left,#fff,rgba(204,154,129,0));background-image:linear-gradient(to right,#fff,rgba(204,154,129,0))}.sp-val{border-radius:4px;background-image:-webkit-gradient(linear,0 100%,0 0,from(#000),to(rgba(204,154,129,0)));background-image:-webkit-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-moz-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-o-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:-ms-linear-gradient(bottom,#000,rgba(204,154,129,0));background-image:linear-gradient(to top,#000,rgba(204,154,129,0))}.sp-hue{background:-moz-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-ms-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-o-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:-webkit-gradient(linear,left top,left bottom,from(red),color-stop(.17,#ff0),color-stop(.33,#0f0),color-stop(.5,#0ff),color-stop(.67,#00f),color-stop(.83,#f0f),to(red));background:-webkit-linear-gradient(top,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.sp-1{height:17%}.sp-2{height:16%}.sp-3{height:17%}.sp-4{height:17%}.sp-5{height:16%}.sp-6{height:17%}.sp-hidden{display:none!important}.sp-cf:after,.sp-cf:before{content:"";display:table}.sp-cf:after{clear:both}@media (max-device-width:480px){.sp-color{right:40%}.sp-hue{left:63%}.sp-fill{padding-top:60%}}.sp-dragger{border-radius:5px;height:10px;width:10px;border:1px solid #fff;cursor:pointer;position:absolute;top:0;left:0;margin-left:3px;margin-top:3px;box-shadow:0 0 2px 1px rgba(0,0,0,.2)}.sp-slider{position:absolute;top:0;cursor:pointer;height:16px;border-radius:50%;width:16px;left:-2px;background:#f9f9f9;box-shadow:0 0 2px 0 #3a3a3a;margin-top:8px}.sp-container{display:inline-flex;border-radius:0;background-color:#fff;padding:0;border-radius:4px;color:#000;box-shadow:0 0 0 1px rgba(99,114,130,.16),0 8px 16px rgba(27,39,51,.08)}.sp-clear,.sp-color,.sp-container,.sp-container button,.sp-container input,.sp-hue{font-size:12px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.sp-top{margin-bottom:10px}.sp-clear,.sp-color,.sp-hue,.sp-sat,.sp-val{border-radius:3px}.sp-input-container{margin-top:-5px}.sp-button-container.sp-cf,.sp-initial.sp-thumb.sp-cf,.sp-input-container.sp-cf{height:25px}.sp-picker-container .sp-cf{margin-bottom:10px}.sp-palette-row-initial>span:first-child{cursor:pointer}.sp-initial-disabled .sp-input-container{width:100%}.sp-input{padding:0 5px!important;margin:0;width:100%;box-shadow:none!important;height:100%!important;background:0 0;color:#3a3a3a;border-radius:2px!important;border:1px solid #e0e0e0!important;text-align:center;font-family:monospace;font-size:inherit!important}.sp-input:focus{border:1px solid orange}.sp-input.sp-validation-error{border:1px solid red;background:#fdd}.sp-palette-container,.sp-picker-container{position:relative;padding:10px}.sp-picker-container{width:200px;padding-bottom:0}.sp-palette-container{border-right:solid 1px #ccc}.sp-palette-only .sp-palette-container{border:0}.sp-palette .sp-thumb-el{display:block;position:relative;float:left;width:24px;height:15px;margin:3px;cursor:pointer;border:solid 2px transparent}.sp-palette .sp-thumb-el.sp-thumb-active,.sp-palette .sp-thumb-el:hover{border-color:orange}.sp-thumb-el{position:relative}.sp-initial{float:left}.sp-initial span{width:30px;height:25px;border:none;display:block;float:left;margin:0}.sp-initial .spe-thumb-el.sp-thumb-active{border-radius:0 5px 5px 0}.sp-initial .spe-thumb-el{border-radius:5px 0 0 5px}.sp-initial .sp-clear-display{background-position:center}.sp-button-container{float:right}.sp-palette-button-container{margin-top:10px}.sp-replacer{position:relative;overflow:hidden;cursor:pointer;display:inline-block;border-radius:3px;border:1px solid #aaa;color:#666;transition:border-color .3s;vertical-align:middle;width:3rem;height:1.5rem}.sp-replacer.sp-active,.sp-replacer:hover{border:1px solid #666;color:#000}.sp-replacer.sp-disabled{cursor:default;border-color:silver;color:silver}.sp-dd{position:absolute;font-size:10px;right:0;top:0;bottom:0;padding:0 2px;line-height:1.6rem;background-color:#fff}.sp-preview{position:relative;width:100%;height:100%;float:left;z-index:0}.sp-preview-inner{transition:background-color .2s}.sp-preview-inner.sp-clear-display{display:none}.sp-palette .sp-thumb-el{width:16px;height:16px;margin:3px;border:none;border-radius:3px}.sp-container button{border-radius:3px;border:none;background:0 0;line-height:1;padding:0 8px;height:25px;text-transform:capitalize;text-align:center;vertical-align:middle;cursor:pointer;color:#606c72;font-weight:700}.sp-container button.sp-choose{background-color:#3cab3b;color:#fff;margin-left:5px}.sp-container button:hover{opacity:.8}.sp-container button.sp-palette-toggle{width:100%;background-color:#f3f3f3;margin:0}.sp-palette span.sp-thumb-active,.sp-palette span:hover{border-color:#000}.sp-alpha,.sp-preview,.sp-thumb-el{position:relative;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.sp-alpha-inner,.sp-preview-inner,.sp-thumb-inner{display:block;position:absolute;top:0;left:0;bottom:0;right:0}.sp-palette .sp-thumb-inner{border-radius:3px;background-position:50% 50%;background-repeat:no-repeat}.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=)}.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=)}.sp-clear-display{background-repeat:no-repeat;background-position:center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABe0lEQVQokYXSsUtcQRTF4d8Jj+VhHSxkEQuLsEUKK0nhTBFTmLSSUhBCMCAWsmgIwWrBLk0akfwLCaSQKBJmtrIIISwpRFKIhViETScphGMzysMtvOVwvpm5d0bGNCuGWAOPgYdl6S8wSDn9b+bUhDHEKWAdeAFMANg+l/TV9ofcz6cjMIbYBvaBMds7QCqZ58CmpBNgPuV0DvAAIMyFGugWtJr7eTv38xEwkPRPErY7QDeG2LqFkjrAgu0dSd/KDVqSNmxvAZ8lfbS9AHRuYemnLWkv5XRVBrQMbAI/gTXgEzAJtJuwBVS2L2OIle03QA/4Lmkl5XQBXEqqbFcAVYFDYChpFngiqWf7l6TXKaezMt2Zkhk24THwG+jZriX9AFZvUAyxLbRke2D75O5zPAO+ADXwEtizjaRHwDvbTyUtppwOmicCHAJvbXcl9YA1SQDjtseA97YPRz7ATcUQp2y/kjRdevsjaTfldNrMjcDGBjXA3T96L7yvrgFzP69+0Ao/HAAAAABJRU5ErkJggg==)}
vendor/spectrum/spectrum.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports&&"object"==typeof module?module.exports=e(require("jquery")):e(jQuery)}(function(De,qe){"use strict";var e,Ie={beforeShow:a,move:a,change:a,show:a,hide:a,color:!1,flat:!1,type:"",showInput:!1,allowEmpty:!0,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!0,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:8,locale:"en",cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:"name",className:"",containerClassName:"",replacerClassName:"",showAlpha:!0,theme:"sp-light",palette:[["#000000","#444444","#5b5b5b","#999999","#bcbcbc","#eeeeee","#f3f6f4","#ffffff"],["#f44336","#744700","#ce7e00","#8fce00","#2986cc","#16537e","#6a329f","#c90076"],["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],["#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],["#990000","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],["#660000","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]],selectionPalette:[],disabled:!1,offset:null},Ve=[],We=!!/msie/i.exec(window.navigator.userAgent),Be=((e=document.createElement("div").style).cssText="background-color:rgba(0,0,0,.5)",t(e.backgroundColor,"rgba")||t(e.backgroundColor,"hsla")),Ke=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),$e=function(){var e="";if(We)for(var t=1;t<=6;t++)e+="<div class='sp-"+t+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",e,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<button class='sp-cancel' href='#'></button>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}();function t(e,t){return!!~(""+e).indexOf(t)}function Xe(e,t,a,o){for(var r=[],n=0;n<e.length;n++){var s=e[n];if(s){var i=tinycolor(s),l=i.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";l+=tinycolor.equals(t,s)?" sp-thumb-active":"";var c=i.toString(o.preferredFormat||"rgb"),u=Be?"background-color:"+i.toRgbString():"filter:"+i.toFilter();r.push('<span title="'+c+'" data-color="'+i.toRgbString()+'" class="'+l+'"><span class="sp-thumb-inner" style="'+u+';" /></span>')}else r.push('<span class="sp-thumb-el sp-clear-display" ><span class="sp-clear-palette-only" style="background-color: transparent;" /></span>')}return"<div class='sp-cf "+a+"'>"+r.join("")+"</div>"}function n(e,t){var a,o,r,n,h=function(e,t){e.locale=e.locale||window.navigator.language,e.locale&&(e.locale=e.locale.split("-")[0].toLowerCase()),"en"!=e.locale&&De.spectrum.localization[e.locale]&&(e=De.extend({},De.spectrum.localization[e.locale],e));var a=De.extend({},Ie,e);return a.callbacks={move:Ge(a.move,t),change:Ge(a.change,t),show:Ge(a.show,t),hide:Ge(a.hide,t),beforeShow:Ge(a.beforeShow,t)},a}(t,e),s=h.type,d="flat"==s,i=h.showSelectionPalette,l=h.localStorageKey,c=h.theme,u=h.callbacks,f=(a=Qe,function(){var e=this,t=arguments;r&&clearTimeout(n),!r&&n||(n=setTimeout(function(){n=null,a.apply(e,t)},o))}),p=!(o=10),g=!1,b=0,m=0,v=0,x=0,y=0,T=0,w=0,_=0,k=0,P=0,C=1,S=[],M=[],z={},j=h.selectionPalette.slice(0),A=h.maxSelectionSize,R="sp-dragging",F=!1,H=null,L=e.ownerDocument,O=(L.body,De(e)),Q=!1,E=De($e,L).addClass(c),N=E.find(".sp-picker-container"),D=E.find(".sp-color"),q=E.find(".sp-dragger"),I=E.find(".sp-hue"),V=E.find(".sp-slider"),W=E.find(".sp-alpha-inner"),B=E.find(".sp-alpha"),K=E.find(".sp-alpha-handle"),$=E.find(".sp-input"),X=E.find(".sp-palette"),Y=E.find(".sp-initial"),G=E.find(".sp-cancel"),U=E.find(".sp-clear"),J=E.find(".sp-choose"),Z=E.find(".sp-palette-toggle"),ee=O.is("input"),te=(ee&&"color"===O.attr("type")&&Je(),ee&&"color"==s),ae=te?De(Ke).addClass(c).addClass(h.className).addClass(h.replacerClassName):De([]),oe=te?ae:O,re=ae.find(".sp-preview-inner"),ne=h.color||ee&&O.val(),se=!1,ie=h.preferredFormat,le=!h.showButtons||h.clickoutFiresChange,ce=!ne,ue=h.allowEmpty,fe=null,he=null,de=null,pe=null,ge=O.attr("id");if(ge!==qe&&0<ge.length){var be=De('label[for="'+ge+'"]');be.length&&be.on("click",function(e){return e.preventDefault(),O.spectrum("show"),!1})}function me(){if(h.showPaletteOnly&&(h.showPalette=!0),Z.text(h.showPaletteOnly?h.togglePaletteMoreText:h.togglePaletteLessText),h.palette){S=h.palette.slice(0),M=De.isArray(S[0])?S:[S],z={};for(var e=0;e<M.length;e++)for(var t=0;t<M[e].length;t++){var a=tinycolor(M[e][t]).toRgbString();z[a]=!0}h.showPaletteOnly&&!h.color&&(ne=""===S[0][0]?S[0][0]:Object.keys(z)[0])}E.toggleClass("sp-flat",d),E.toggleClass("sp-input-disabled",!h.showInput),E.toggleClass("sp-alpha-enabled",h.showAlpha),E.toggleClass("sp-clear-enabled",ue),E.toggleClass("sp-buttons-disabled",!h.showButtons),E.toggleClass("sp-palette-buttons-disabled",!h.togglePaletteOnly),E.toggleClass("sp-palette-disabled",!h.showPalette),E.toggleClass("sp-palette-only",h.showPaletteOnly),E.toggleClass("sp-initial-disabled",!h.showInitial),E.addClass(h.className).addClass(h.containerClassName),Qe()}function ve(){if(l){try{var e=window.localStorage,t=e[l].split(",#");1<t.length&&(delete e[l],De.each(t,function(e,t){xe(t)}))}catch(e){}try{j=window.localStorage[l].split(";")}catch(e){}}}function xe(e){if(i){var t=tinycolor(e).toRgbString();if(!z[t]&&-1===De.inArray(t,j))for(j.push(t);j.length>A;)j.shift();if(l)try{window.localStorage[l]=j.join(";")}catch(e){}}}function ye(){var a=Re(),e=De.map(M,function(e,t){return Xe(e,a,"sp-palette-row sp-palette-row-"+t,h)});ve(),j&&e.push(Xe(function(){var e=[];if(h.showPalette)for(var t=0;t<j.length;t++){var a=tinycolor(j[t]).toRgbString();z[a]||e.push(j[t])}return e.reverse().slice(0,h.maxSelectionSize)}(),a,"sp-palette-row sp-palette-row-selection",h)),X.html(e.join(""))}function Te(){if(h.showInitial){var e=se,t=Re();Y.html(Xe([e,t],t,"sp-palette-row-initial",h))}}function we(){(m<=0||b<=0||x<=0)&&Qe(),g=!0,E.addClass(R),H=null,O.trigger("dragstart.spectrum",[Re()])}function _e(){g=!1,E.removeClass(R),O.trigger("dragstop.spectrum",[Re()])}function ke(e){if(F)F=!1;else if(null!==e&&""!==e||!ue){var t=tinycolor(e);t.isValid()?(Ae(t),Fe(),Oe()):$.addClass("sp-validation-error")}else Ae(null),Fe(),Oe()}function Pe(){(p?ze:Ce)()}function Ce(){var e=De.Event("beforeShow.spectrum");p?Qe():(O.trigger(e,[Re()]),!1===u.beforeShow(Re())||e.isDefaultPrevented()||(function(){for(var e=0;e<Ve.length;e++)Ve[e]&&Ve[e].hide()}(),p=!0,De(L).on("keydown.spectrum",Se),De(L).on("click.spectrum",Me),De(window).on("resize.spectrum",f),ae.addClass("sp-active"),E.removeClass("sp-hidden"),Qe(),He(),se=Re(),Te(),u.show(se),O.trigger("show.spectrum",[se])))}function Se(e){27===e.keyCode&&ze()}function Me(e){2!=e.button&&(g||(le?Oe(!0):je(),ze()))}function ze(){p&&!d&&(p=!1,De(L).off("keydown.spectrum",Se),De(L).off("click.spectrum",Me),De(window).off("resize.spectrum",f),ae.removeClass("sp-active"),E.addClass("sp-hidden"),u.hide(Re()),O.trigger("hide.spectrum",[Re()]))}function je(){Ae(se,!0),Oe(!0)}function Ae(e,t){var a,o;tinycolor.equals(e,Re())?He():(e&&e!==qe||!ue?(ce=!1,o=(a=tinycolor(e)).toHsv(),_=o.h%360/360,k=o.s,P=o.v,C=o.a):ce=!0,He(),a&&a.isValid()&&!t&&(ie=h.preferredFormat||a.getFormat()))}function Re(e){return e=e||{},ue&&ce?null:tinycolor.fromRatio({h:_,s:k,v:P,a:Math.round(1e3*C)/1e3},{format:e.format||ie})}function Fe(){He(),u.move(Re()),O.trigger("move.spectrum",[Re()])}function He(){$.removeClass("sp-validation-error"),Le();var e=tinycolor.fromRatio({h:_,s:1,v:1});D.css("background-color",e.toHexString());var t=ie;C<1&&(0!==C||"name"!==t)&&("hex"!==t&&"hex3"!==t&&"hex6"!==t&&"name"!==t||(t="rgb"));var a=Re({format:t}),o="";if(re.removeClass("sp-clear-display"),re.css("background-color","transparent"),!a&&ue)re.addClass("sp-clear-display");else{var r=a.toHexString(),n=a.toRgbString();if(Be||1===a.alpha?re.css("background-color",n):(re.css("background-color","transparent"),re.css("filter",a.toFilter())),h.showAlpha){var s=a.toRgb();s.a=0;var i=tinycolor(s).toRgbString(),l="linear-gradient(left, "+i+", "+r+")";We?W.css("filter",tinycolor(i).toFilter({gradientType:1},r)):(W.css("background","-webkit-"+l),W.css("background","-moz-"+l),W.css("background","-ms-"+l),W.css("background","linear-gradient(to right, "+i+", "+r+")"))}o=a.toString(t)}if(h.showInput&&$.val(o),O.val(o),"text"==h.type||"component"==h.type){var c=a;if(c&&he){var u=c.isLight()||c.getAlpha()<.4?"black":"white";he.css("background-color",c.toRgbString()).css("color",u)}else he.css("background-color",pe).css("color",de)}h.showPalette&&ye(),Te()}function Le(){var e=k,t=P;if(ue&&ce)K.hide(),V.hide(),q.hide();else{K.show(),V.show(),q.show();var a=e*b,o=m-t*m;a=Math.max(-v,Math.min(b-v,a-v)),o=Math.max(-v,Math.min(m-v,o-v)),q.css({top:o+"px",left:a+"px"});var r=C*y;K.css({left:r-T/2+"px"});var n=_*x;V.css({top:n-w+"px"})}}function Oe(e){var t=Re(),a=!tinycolor.equals(t,se);t&&(t.toString(ie),xe(t)),e&&a&&(u.change(t),F=!0,O.trigger("change",[t]))}function Qe(){var e,t,a,o,r,n,s,i,l,c,u,f;p&&(b=D.width(),m=D.height(),v=q.height(),I.width(),x=I.height(),w=V.height(),y=B.width(),T=K.width(),d||(E.css("position","absolute"),h.offset?E.offset(h.offset):E.offset((t=oe,a=(e=E).outerWidth(),o=e.outerHeight(),r=t.outerHeight(),n=e[0].ownerDocument,s=n.documentElement,i=s.clientWidth+De(n).scrollLeft(),l=s.clientHeight+De(n).scrollTop(),c=t.offset(),u=c.left,f=c.top,f+=r,u-=Math.min(u,i<u+a&&a<i?Math.abs(u+a-i):0),{top:f-=Math.min(f,l<f+o&&o<l?Math.abs(+(o+r)):0),bottom:c.bottom,left:u,right:c.right,width:c.width,height:c.height}))),Le(),h.showPalette&&ye(),O.trigger("reflow.spectrum"))}function Ee(){ze(),Q=!0,O.attr("disabled",!0),oe.addClass("sp-disabled")}!function(){if(We&&E.find("*:not(input)").attr("unselectable","on"),me(),fe=De('<span class="sp-original-input-container"></span>'),["margin"].forEach(function(e){fe.css(e,O.css(e))}),"block"==O.css("display")&&fe.css("display","flex"),te)O.after(ae).hide();else if("text"==s)fe.addClass("sp-colorize-container"),O.addClass("spectrum sp-colorize").wrap(fe);else if("component"==s){O.addClass("spectrum").wrap(fe);var e=De(["<div class='sp-colorize-container sp-add-on'>","<div class='sp-colorize'></div> ","</div>"].join(""));e.width(O.outerHeight()+"px").css("border-radius",O.css("border-radius")).css("border",O.css("border")),O.addClass("with-add-on").before(e)}if(he=O.parent().find(".sp-colorize"),de=he.css("color"),pe=he.css("background-color"),ue||U.hide(),d)O.after(E).hide();else{var t="parent"===h.appendTo?O.parent():De(h.appendTo);1!==t.length&&(t=De("body")),t.append(E)}function a(e){return e.data&&e.data.ignore?(Ae(De(e.target).closest(".sp-thumb-el").data("color")),Fe()):(Ae(De(e.target).closest(".sp-thumb-el").data("color")),Fe(),h.hideAfterPaletteSelect?(Oe(!0),ze()):Oe()),!1}ve(),oe.on("click.spectrum touchstart.spectrum",function(e){Q||Pe(),e.stopPropagation(),De(e.target).is("input")||e.preventDefault()}),!O.is(":disabled")&&!0!==h.disabled||Ee(),E.click(Ye),[$,O].forEach(function(t){t.change(function(){ke(t.val())}),t.on("paste",function(){setTimeout(function(){ke(t.val())},1)}),t.keydown(function(e){13==e.keyCode&&(ke(De(t).val()),t==O&&ze())})}),G.text(h.cancelText),G.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),je(),ze()}),U.attr("title",h.clearText),U.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),ce=!0,Fe(),d&&Oe(!0)}),J.text(h.chooseText),J.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),We&&$.is(":focus")&&$.trigger("change"),$.hasClass("sp-validation-error")||(Oe(!0),ze())}),Z.text(h.showPaletteOnly?h.togglePaletteMoreText:h.togglePaletteLessText),Z.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),h.showPaletteOnly=!h.showPaletteOnly,h.showPaletteOnly||d||E.css("left","-="+(N.outerWidth(!0)+5)),me()}),Ue(B,function(e,t,a){C=e/y,ce=!1,a.shiftKey&&(C=Math.round(10*C)/10),Fe()},we,_e),Ue(I,function(e,t){_=parseFloat(t/x),ce=!1,h.showAlpha||(C=1),Fe()},we,_e),Ue(D,function(e,t,a){if(a.shiftKey){if(!H){var o=k*b,r=m-P*m,n=Math.abs(e-o)>Math.abs(t-r);H=n?"x":"y"}}else H=null;var s=!H||"y"===H;H&&"x"!==H||(k=parseFloat(e/b)),s&&(P=parseFloat((m-t)/m)),ce=!1,h.showAlpha||(C=1),Fe()},we,_e),ne?(Ae(ne),He(),ie=tinycolor(ne).format||h.preferredFormat,xe(ne)):(""===ne&&Ae(ne),He()),d&&Ce();var o=We?"mousedown.spectrum":"click.spectrum touchstart.spectrum";X.on(o,".sp-thumb-el",a),Y.on(o,".sp-thumb-el:nth-child(1)",{ignore:!0},a)}();var Ne={show:Ce,hide:ze,toggle:Pe,reflow:Qe,option:function(e,t){return e===qe?De.extend({},h):t===qe?h[e]:(h[e]=t,"preferredFormat"===e&&(ie=h.preferredFormat),void me())},enable:function(){Q=!1,O.attr("disabled",!1),oe.removeClass("sp-disabled")},disable:Ee,offset:function(e){h.offset=e,Qe()},set:function(e){Ae(e),Oe()},get:Re,destroy:function(){O.show().removeClass("spectrum with-add-on sp-colorize"),oe.off("click.spectrum touchstart.spectrum"),E.remove(),ae.remove(),he&&he.css("background-color",pe).css("color",de);var e=O.closest(".sp-original-input-container");0<e.length&&e.after(O).remove(),Ve[Ne.id]=null},container:E};return Ne.id=Ve.push(Ne)-1,Ne}function a(){}function Ye(e){e.stopPropagation()}function Ge(e,t){var a=Array.prototype.slice,o=a.call(arguments,2);return function(){return e.apply(t,o.concat(a.call(arguments)))}}function Ue(s,i,t,e){i=i||function(){},t=t||function(){},e=e||function(){};var l=document,c=!1,u={},f=0,h=0,d="ontouchstart"in window,a={};function p(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1}function o(e){if(c){if(We&&l.documentMode<9&&!e.button)return g();var t=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0],a=t&&t.pageX||e.pageX,o=t&&t.pageY||e.pageY,r=Math.max(0,Math.min(a-u.left,h)),n=Math.max(0,Math.min(o-u.top,f));d&&p(e),i.apply(s,[r,n,e])}}function g(){c&&(De(l).off(a),De(l.body).removeClass("sp-dragging"),setTimeout(function(){e.apply(s,arguments)},0)),c=!1}a.selectstart=p,a.dragstart=p,a["touchmove mousemove"]=o,a["touchend mouseup"]=g,De(s).on("touchstart mousedown",function(e){(e.which?3==e.which:2==e.button)||c||!1!==t.apply(s,arguments)&&(c=!0,f=De(s).height(),h=De(s).width(),u=De(s).offset(),De(l).on(a),De(l.body).addClass("sp-dragging"),o(e),p(e))})}function Je(){return De.fn.spectrum.inputTypeColorSupport()}var s="spectrum.id";De.fn.spectrum=function(a,e){if("string"!=typeof a)return this.spectrum("destroy").each(function(){var e=De.extend({},De(this).data(),a);De(this).is("input")?e.flat||"flat"==e.type?e.type="flat":"color"==De(this).attr("type")?e.type="color":e.type=e.type||"component":e.type="noInput";var t=n(this,e);De(this).data(s,t.id)});var o=this,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=Ve[De(this).data(s)];if(e){var t=e[a];if(!t)throw new Error("Spectrum: no such method: '"+a+"'");"get"==a?o=e.get():"container"==a?o=e.container:"option"==a?o=e.option.apply(e,r):"destroy"==a?(e.destroy(),De(this).removeData(s)):t.apply(e,r)}}),o},De.fn.spectrum.load=!0,De.fn.spectrum.loadOpts={},De.fn.spectrum.draggable=Ue,De.fn.spectrum.defaults=Ie,De.fn.spectrum.inputTypeColorSupport=function e(){if(void 0===e._cachedResult){var t=De("<input type='color'/>")[0];e._cachedResult="color"===t.type&&""!==t.value}return e._cachedResult},De.spectrum={},De.spectrum.localization={},De.spectrum.palettes={},De.fn.spectrum.processNativeColorInputs=function(){var e=De("input[type=color]");e.length&&!Je()&&e.spectrum({preferredFormat:"hex6"})},function(){var n=/^[\s,#]+/,s=/\s+$/,o=0,c=Math,i=c.round,u=c.min,f=c.max,e=c.random,h=function(e,t){if(t=t||{},(e=e||"")instanceof h)return e;if(!(this instanceof h))return new h(e,t);var a=function(e){var t={r:0,g:0,b:0},a=1,o=!1,r=!1;"string"==typeof e&&(e=function(e){e=e.replace(n,"").replace(s,"").toLowerCase();var t,a=!1;if(C[e])e=C[e],a=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=Q.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=Q.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=Q.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=Q.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=Q.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=Q.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=Q.hex8.exec(e))return{a:function(e){return A(e)/255}(t[1]),r:A(t[2]),g:A(t[3]),b:A(t[4]),format:a?"name":"hex8"};if(t=Q.hex6.exec(e))return{r:A(t[1]),g:A(t[2]),b:A(t[3]),format:a?"name":"hex"};if(t=Q.hex3.exec(e))return{r:A(t[1]+""+t[1]),g:A(t[2]+""+t[2]),b:A(t[3]+""+t[3]),format:a?"name":"hex"};return!1}(e));"object"==typeof e&&(e.hasOwnProperty("r")&&e.hasOwnProperty("g")&&e.hasOwnProperty("b")?(t=function(e,t,a){return{r:255*z(e,255),g:255*z(t,255),b:255*z(a,255)}}(e.r,e.g,e.b),o=!0,r="%"===String(e.r).substr(-1)?"prgb":"rgb"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("v")?(e.s=F(e.s),e.v=F(e.v),t=function(e,t,a){e=6*z(e,360),t=z(t,100),a=z(a,100);var o=c.floor(e),r=e-o,n=a*(1-t),s=a*(1-r*t),i=a*(1-(1-r)*t),l=o%6;return{r:255*[a,s,n,n,i,a][l],g:255*[i,a,a,s,n,n][l],b:255*[n,n,i,a,a,s][l]}}(e.h,e.s,e.v),o=!0,r="hsv"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("l")&&(e.s=F(e.s),e.l=F(e.l),t=function(e,t,a){var o,r,n;function s(e,t,a){return a<0&&(a+=1),1<a&&--a,a<1/6?e+6*(t-e)*a:a<.5?t:a<2/3?e+(t-e)*(2/3-a)*6:e}if(e=z(e,360),t=z(t,100),a=z(a,100),0===t)o=r=n=a;else{var i=a<.5?a*(1+t):a+t-a*t,l=2*a-i;o=s(l,i,e+1/3),r=s(l,i,e),n=s(l,i,e-1/3)}return{r:255*o,g:255*r,b:255*n}}(e.h,e.s,e.l),o=!0,r="hsl"),e.hasOwnProperty("a")&&(a=e.a));return a=M(a),{ok:o,format:e.format||r,r:u(255,f(t.r,0)),g:u(255,f(t.g,0)),b:u(255,f(t.b,0)),a:a}}(e);this._originalInput=e,this._r=a.r,this._g=a.g,this._b=a.b,this._a=a.a,this._roundA=i(1e3*this._a)/1e3,this._format=t.format||a.format,this._gradientType=t.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=a.ok,this._tc_id=o++};function r(e,t,a){e=z(e,255),t=z(t,255),a=z(a,255);var o,r,n=f(e,t,a),s=u(e,t,a),i=(n+s)/2;if(n==s)o=r=0;else{var l=n-s;switch(r=.5<i?l/(2-n-s):l/(n+s),n){case e:o=(t-a)/l+(t<a?6:0);break;case t:o=(a-e)/l+2;break;case a:o=(e-t)/l+4}o/=6}return{h:o,s:r,l:i}}function l(e,t,a){e=z(e,255),t=z(t,255),a=z(a,255);var o,r,n=f(e,t,a),s=u(e,t,a),i=n,l=n-s;if(r=0===n?0:l/n,n==s)o=0;else{switch(n){case e:o=(t-a)/l+(t<a?6:0);break;case t:o=(a-e)/l+2;break;case a:o=(e-t)/l+4}o/=6}return{h:o,s:r,v:i}}function t(e,t,a,o){var r=[R(i(e).toString(16)),R(i(t).toString(16)),R(i(a).toString(16))];return o&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function d(e,t,a,o){var r;return[R((r=o,Math.round(255*parseFloat(r)).toString(16))),R(i(e).toString(16)),R(i(t).toString(16)),R(i(a).toString(16))].join("")}function a(e,t){t=0===t?0:t||10;var a=h(e).toHsl();return a.s-=t/100,a.s=j(a.s),h(a)}function p(e,t){t=0===t?0:t||10;var a=h(e).toHsl();return a.s+=t/100,a.s=j(a.s),h(a)}function g(e){return h(e).desaturate(100)}function b(e,t){t=0===t?0:t||10;var a=h(e).toHsl();return a.l+=t/100,a.l=j(a.l),h(a)}function m(e,t){t=0===t?0:t||10;var a=h(e).toRgb();return a.r=f(0,u(255,a.r-i(-t/100*255))),a.g=f(0,u(255,a.g-i(-t/100*255))),a.b=f(0,u(255,a.b-i(-t/100*255))),h(a)}function v(e,t){t=0===t?0:t||10;var a=h(e).toHsl();return a.l-=t/100,a.l=j(a.l),h(a)}function x(e,t){var a=h(e).toHsl(),o=(i(a.h)+t)%360;return a.h=o<0?360+o:o,h(a)}function y(e){var t=h(e).toHsl();return t.h=(t.h+180)%360,h(t)}function T(e){var t=h(e).toHsl(),a=t.h;return[h(e),h({h:(a+120)%360,s:t.s,l:t.l}),h({h:(a+240)%360,s:t.s,l:t.l})]}function w(e){var t=h(e).toHsl(),a=t.h;return[h(e),h({h:(a+90)%360,s:t.s,l:t.l}),h({h:(a+180)%360,s:t.s,l:t.l}),h({h:(a+270)%360,s:t.s,l:t.l})]}function _(e){var t=h(e).toHsl(),a=t.h;return[h(e),h({h:(a+72)%360,s:t.s,l:t.l}),h({h:(a+216)%360,s:t.s,l:t.l})]}function k(e,t,a){t=t||6,a=a||30;var o=h(e).toHsl(),r=360/a,n=[h(e)];for(o.h=(o.h-(r*t>>1)+720)%360;--t;)o.h=(o.h+r)%360,n.push(h(o));return n}function P(e,t){t=t||6;for(var a=h(e).toHsv(),o=a.h,r=a.s,n=a.v,s=[],i=1/t;t--;)s.push(h({h:o,s:r,v:n})),n=(n+i)%1;return s}h.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},setAlpha:function(e){return this._a=M(e),this._roundA=i(1e3*this._a)/1e3,this},toHsv:function(){var e=l(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=l(this._r,this._g,this._b),t=i(360*e.h),a=i(100*e.s),o=i(100*e.v);return 1==this._a?"hsv("+t+", "+a+"%, "+o+"%)":"hsva("+t+", "+a+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var e=r(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=r(this._r,this._g,this._b),t=i(360*e.h),a=i(100*e.s),o=i(100*e.l);return 1==this._a?"hsl("+t+", "+a+"%, "+o+"%)":"hsla("+t+", "+a+"%, "+o+"%, "+this._roundA+")"},toHex:function(e){return t(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return d(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*z(this._r,255))+"%",g:i(100*z(this._g,255))+"%",b:i(100*z(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*z(this._r,255))+"%, "+i(100*z(this._g,255))+"%, "+i(100*z(this._b,255))+"%)":"rgba("+i(100*z(this._r,255))+"%, "+i(100*z(this._g,255))+"%, "+i(100*z(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[t(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+d(this._r,this._g,this._b,this._a),a=t,o=this._gradientType?"GradientType = 1, ":"";e&&(a=h(e).toHex8String());return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+t+",endColorstr="+a+")"},toString:function(e){var t=!!e;e=e||this._format;var a=!1,o=this._a<1&&0<=this._a;return t||!o||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"name"!==e?("rgb"===e&&(a=this.toRgbString()),"prgb"===e&&(a=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(a=this.toHexString()),"hex3"===e&&(a=this.toHexString(!0)),"hex8"===e&&(a=this.toHex8String()),"name"===e&&(a=this.toName()),"hsl"===e&&(a=this.toHslString()),"hsv"===e&&(a=this.toHsvString()),a||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},_applyModification:function(e,t){var a=e.apply(null,[this].concat([].slice.call(t)));return this._r=a._r,this._g=a._g,this._b=a._b,this.setAlpha(a._a),this},lighten:function(){return this._applyModification(b,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(a,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(P,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(T,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},h.fromRatio=function(e,t){if("object"==typeof e){var a={};for(var o in e)e.hasOwnProperty(o)&&(a[o]="a"===o?e[o]:F(e[o]));e=a}return h(e,t)},h.equals=function(e,t){return!(!e||!t)&&h(e).toRgbString()==h(t).toRgbString()},h.random=function(){return h.fromRatio({r:e(),g:e(),b:e()})},h.mix=function(e,t,a){a=0===a?0:a||50;var o,r=h(e).toRgb(),n=h(t).toRgb(),s=a/100,i=2*s-1,l=n.a-r.a,c=1-(o=((o=i*l==-1?i:(i+l)/(1+i*l))+1)/2),u={r:n.r*o+r.r*c,g:n.g*o+r.g*c,b:n.b*o+r.b*c,a:n.a*s+r.a*(1-s)};return h(u)},h.readability=function(e,t){var a=h(e),o=h(t),r=a.toRgb(),n=o.toRgb(),s=a.getBrightness(),i=o.getBrightness(),l=Math.max(r.r,n.r)-Math.min(r.r,n.r)+Math.max(r.g,n.g)-Math.min(r.g,n.g)+Math.max(r.b,n.b)-Math.min(r.b,n.b);return{brightness:Math.abs(s-i),color:l}},h.isReadable=function(e,t){var a=h.readability(e,t);return 125<a.brightness&&500<a.color},h.mostReadable=function(e,t){for(var a=null,o=0,r=!1,n=0;n<t.length;n++){var s=h.readability(e,t[n]),i=125<s.brightness&&500<s.color,l=s.brightness/125*3+s.color/500;(i&&!r||i&&r&&o<l||!i&&!r&&o<l)&&(r=i,o=l,a=h(t[n]))}return a};var C=h.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},S=h.hexNames=function(e){var t={};for(var a in e)e.hasOwnProperty(a)&&(t[e[a]]=a);return t}(C);function M(e){return e=parseFloat(e),(isNaN(e)||e<0||1<e)&&(e=1),e}function z(e,t){var a;"string"==typeof(a=e)&&-1!=a.indexOf(".")&&1===parseFloat(a)&&(e="100%");var o,r="string"==typeof(o=e)&&-1!=o.indexOf("%");return e=u(t,f(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),c.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function j(e){return u(1,f(0,e))}function A(e){return parseInt(e,16)}function R(e){return 1==e.length?"0"+e:""+e}function F(e){return e<=1&&(e=100*e+"%"),e}var H,L,O,Q=(L="[\\s|\\(]+("+(H="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",O="[\\s|\\(]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",{rgb:new RegExp("rgb"+L),rgba:new RegExp("rgba"+O),hsl:new RegExp("hsl"+L),hsla:new RegExp("hsla"+O),hsv:new RegExp("hsv"+L),hsva:new RegExp("hsva"+O),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});window.tinycolor=h}(),De(function(){De.fn.spectrum.load&&De.fn.spectrum.processNativeColorInputs()})}),jQuery.spectrum.localization.ar={cancelText:"إلغاء",chooseText:"إختار",clearText:"إرجاع الألوان على ما كانت",noColorSelectedText:"لم تختار أي لون",togglePaletteMoreText:"أكثر",togglePaletteLessText:"أقل"},jQuery.spectrum.localization.ca={cancelText:"Cancel·lar",chooseText:"Escollir",clearText:"Esborrar color seleccionat",noColorSelectedText:"Cap color seleccionat",togglePaletteMoreText:"Més",togglePaletteLessText:"Menys"},jQuery.spectrum.localization.cs={cancelText:"zrušit",chooseText:"vybrat",clearText:"Resetovat výměr barev",noColorSelectedText:"Žádná barva nebyla vybrána",togglePaletteMoreText:"více",togglePaletteLessText:"méně"},jQuery.spectrum.localization.de={cancelText:"Abbrechen",chooseText:"Wählen",clearText:"Farbauswahl zurücksetzen",noColorSelectedText:"Keine Farbe ausgewählt",togglePaletteMoreText:"Mehr",togglePaletteLessText:"Weniger"},jQuery.spectrum.localization.dk={cancelText:"annuller",chooseText:"Vælg"},jQuery.spectrum.localization.es={cancelText:"Cancelar",chooseText:"Elegir",clearText:"Borrar color seleccionado",noColorSelectedText:"Ningún color seleccionado",togglePaletteMoreText:"Más",togglePaletteLessText:"Menos"},jQuery.spectrum.localization.et={cancelText:"Katkesta",chooseText:"Vali",clearText:"Tühista värvivalik",noColorSelectedText:"Ühtki värvi pole valitud",togglePaletteMoreText:"Rohkem",togglePaletteLessText:"Vähem"},jQuery.spectrum.localization.fa={cancelText:"لغو",chooseText:"انتخاب",clearText:"تنظیم مجدد رنگ",noColorSelectedText:"هیچ رنگی انتخاب نشده است!",togglePaletteMoreText:"بیشتر",togglePaletteLessText:"کمتر"},jQuery.spectrum.localization.fi={cancelText:"Kumoa",chooseText:"Valitse"},jQuery.spectrum.localization.fr={cancelText:"Annuler",chooseText:"Valider",clearText:"Effacer couleur sélectionnée",noColorSelectedText:"Aucune couleur sélectionnée",togglePaletteMoreText:"Plus",togglePaletteLessText:"Moins"},jQuery.spectrum.localization.gr={cancelText:"Ακύρωση",chooseText:"Επιλογή",clearText:"Καθαρισμός επιλεγμένου χρώματος",noColorSelectedText:"Δεν έχει επιλεχθεί κάποιο χρώμα",togglePaletteMoreText:"Περισσότερα",togglePaletteLessText:"Λιγότερα"},jQuery.spectrum.localization.he={cancelText:"בטל בחירה",chooseText:"בחר צבע",clearText:"אפס בחירה",noColorSelectedText:"לא נבחר צבע",togglePaletteMoreText:"עוד צבעים",togglePaletteLessText:"פחות צבעים"},jQuery.spectrum.localization.hr={cancelText:"Odustani",chooseText:"Odaberi",clearText:"Poništi odabir",noColorSelectedText:"Niti jedna boja nije odabrana",togglePaletteMoreText:"Više",togglePaletteLessText:"Manje"},jQuery.spectrum.localization.hu={cancelText:"Mégsem",chooseText:"Mentés",clearText:"A színválasztás visszaállítása",noColorSelectedText:"Nincs szín kijelölve",togglePaletteMoreText:"Több",togglePaletteLessText:"Kevesebb"},jQuery.spectrum.localization.id={cancelText:"Batal",chooseText:"Pilih",clearText:"Hapus Pilihan Warna",noColorSelectedText:"Warna Tidak Dipilih",togglePaletteMoreText:"tambah",togglePaletteLessText:"kurangi"},jQuery.spectrum.localization.it={cancelText:"annulla",chooseText:"scegli",clearText:"Annulla selezione colore",noColorSelectedText:"Nessun colore selezionato"},jQuery.spectrum.localization.ja={cancelText:"中止",chooseText:"選択"},jQuery.spectrum.localization.ko={cancelText:"취소",chooseText:"선택",clearText:"선택 초기화",noColorSelectedText:"선택된 색상 없음",togglePaletteMoreText:"더보기",togglePaletteLessText:"줄이기"},jQuery.spectrum.localization.lt={cancelText:"Atšaukti",chooseText:"Pasirinkti",clearText:"Išvalyti pasirinkimą",noColorSelectedText:"Spalva nepasirinkta",togglePaletteMoreText:"Daugiau",togglePaletteLessText:"Mažiau"},jQuery.spectrum.localization["nb-no"]={cancelText:"Avbryte",chooseText:"Velg",clearText:"Tilbakestill",noColorSelectedText:"Farge er ikke valgt",togglePaletteMoreText:"Mer",togglePaletteLessText:"Mindre"},jQuery.spectrum.localization["nl-nl"]={cancelText:"Annuleer",chooseText:"Kies",clearText:"Wis kleur selectie",togglePaletteMoreText:"Meer",togglePaletteLessText:"Minder"},jQuery.spectrum.localization.pl={cancelText:"Anuluj",chooseText:"Wybierz",clearText:"Usuń wybór koloru",noColorSelectedText:"Nie wybrano koloru",togglePaletteMoreText:"Więcej",togglePaletteLessText:"Mniej"},jQuery.spectrum.localization["pt-br"]={cancelText:"Cancelar",chooseText:"Escolher",clearText:"Limpar cor selecionada",noColorSelectedText:"Nenhuma cor selecionada",togglePaletteMoreText:"Mais",togglePaletteLessText:"Menos"},jQuery.spectrum.localization["pt-pt"]={cancelText:"Cancelar",chooseText:"Escolher",clearText:"Limpar cor seleccionada",noColorSelectedText:"Nenhuma cor seleccionada",togglePaletteMoreText:"Mais",togglePaletteLessText:"Menos"},jQuery.spectrum.localization.ru={cancelText:"Отмена",chooseText:"Выбрать",clearText:"Сбросить",noColorSelectedText:"Цвет не выбран",togglePaletteMoreText:"Ещё",togglePaletteLessText:"Скрыть"},jQuery.spectrum.localization.sv={cancelText:"Avbryt",chooseText:"Välj"},jQuery.spectrum.localization.tr={cancelText:"iptal",chooseText:"tamam"},jQuery.spectrum.localization["zh-cn"]={cancelText:"取消",chooseText:"选择",clearText:"清除",togglePaletteMoreText:"更多选项",togglePaletteLessText:"隐藏",noColorSelectedText:"尚未选择任何颜色"},jQuery.spectrum.localization["zh-tw"]={cancelText:"取消",chooseText:"選擇",clearText:"清除",togglePaletteMoreText:"更多選項",togglePaletteLessText:"隱藏",noColorSelectedText:"尚未選擇任何顏色"};
1
+ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports&&"object"==typeof module?module.exports=e(require("jquery")):e(jQuery)}(function(De,qe){"use strict";var e,Ie={beforeShow:a,move:a,change:a,show:a,hide:a,color:!1,flat:!1,type:"",showInput:!1,allowEmpty:!0,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!0,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:8,locale:"en",cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:"name",className:"",containerClassName:"",replacerClassName:"",showAlpha:!0,theme:"sp-light",palette:[["#000000","#444444","#5b5b5b","#999999","#bcbcbc","#eeeeee","#f3f6f4","#ffffff"],["#f44336","#744700","#ce7e00","#8fce00","#2986cc","#16537e","#6a329f","#c90076"],["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],["#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],["#990000","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],["#660000","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]],selectionPalette:[],disabled:!1,offset:null},Ve=[],We=!!/msie/i.exec(window.navigator.userAgent),Be=((e=document.createElement("div").style).cssText="background-color:rgba(0,0,0,.5)",t(e.backgroundColor,"rgba")||t(e.backgroundColor,"hsla")),Ke=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),$e=function(){var e="";if(We)for(var t=1;t<=6;t++)e+="<div class='sp-"+t+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",e,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<button class='sp-cancel' href='#'></button>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}();function t(e,t){return!!~(""+e).indexOf(t)}function Xe(e,t,a,o){for(var r=[],n=0;n<e.length;n++){var s=e[n];if(s){var i=tinycolor(s),l=i.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";l+=tinycolor.equals(t,s)?" sp-thumb-active":"";var c=i.toString(o.preferredFormat||"rgb"),u=Be?"background-color:"+i.toRgbString():"filter:"+i.toFilter();r.push('<span title="'+c+'" data-color="'+i.toRgbString()+'" class="'+l+'"><span class="sp-thumb-inner" style="'+u+';"></span></span>')}else r.push('<span class="sp-thumb-el sp-clear-display" ><span class="sp-clear-palette-only" style="background-color: transparent;"></span></span>')}return"<div class='sp-cf "+a+"'>"+r.join("")+"</div>"}function n(e,t){var a,o,r,n,h=function(e,t){e.locale=e.locale||window.navigator.language,e.locale&&(e.locale=e.locale.split("-")[0].toLowerCase()),"en"!=e.locale&&De.spectrum.localization[e.locale]&&(e=De.extend({},De.spectrum.localization[e.locale],e));var a=De.extend({},Ie,e);return a.callbacks={move:Ge(a.move,t),change:Ge(a.change,t),show:Ge(a.show,t),hide:Ge(a.hide,t),beforeShow:Ge(a.beforeShow,t)},a}(t,e),s=h.type,d="flat"==s,i=h.showSelectionPalette,l=h.localStorageKey,c=h.theme,u=h.callbacks,f=(a=Qe,function(){var e=this,t=arguments;r&&clearTimeout(n),!r&&n||(n=setTimeout(function(){n=null,a.apply(e,t)},o))}),p=!(o=10),g=!1,b=0,m=0,v=0,x=0,y=0,T=0,w=0,_=0,k=0,P=0,C=1,S=[],M=[],z={},j=h.selectionPalette.slice(0),A=h.maxSelectionSize,R="sp-dragging",F=!1,H=null,L=e.ownerDocument,O=(L.body,De(e)),Q=!1,E=De($e,L).addClass(c),N=E.find(".sp-picker-container"),D=E.find(".sp-color"),q=E.find(".sp-dragger"),I=E.find(".sp-hue"),V=E.find(".sp-slider"),W=E.find(".sp-alpha-inner"),B=E.find(".sp-alpha"),K=E.find(".sp-alpha-handle"),$=E.find(".sp-input"),X=E.find(".sp-palette"),Y=E.find(".sp-initial"),G=E.find(".sp-cancel"),U=E.find(".sp-clear"),J=E.find(".sp-choose"),Z=E.find(".sp-palette-toggle"),ee=O.is("input"),te=(ee&&"color"===O.attr("type")&&Je(),ee&&"color"==s),ae=te?De(Ke).addClass(c).addClass(h.className).addClass(h.replacerClassName):De([]),oe=te?ae:O,re=ae.find(".sp-preview-inner"),ne=h.color||ee&&O.val(),se=!1,ie=h.preferredFormat,le=!h.showButtons||h.clickoutFiresChange,ce=!ne,ue=h.allowEmpty,fe=null,he=null,de=null,pe=null,ge=O.attr("id");if(ge!==qe&&0<ge.length){var be=De('label[for="'+ge+'"]');be.length&&be.on("click",function(e){return e.preventDefault(),O.spectrum("show"),!1})}function me(){if(h.showPaletteOnly&&(h.showPalette=!0),Z.text(h.showPaletteOnly?h.togglePaletteMoreText:h.togglePaletteLessText),h.palette){S=h.palette.slice(0),M=De.isArray(S[0])?S:[S],z={};for(var e=0;e<M.length;e++)for(var t=0;t<M[e].length;t++){var a=tinycolor(M[e][t]).toRgbString();z[a]=!0}h.showPaletteOnly&&!ne&&(ne=""===S[0][0]?S[0][0]:Object.keys(z)[0])}E.toggleClass("sp-flat",d),E.toggleClass("sp-input-disabled",!h.showInput),E.toggleClass("sp-alpha-enabled",h.showAlpha),E.toggleClass("sp-clear-enabled",ue),E.toggleClass("sp-buttons-disabled",!h.showButtons),E.toggleClass("sp-palette-buttons-disabled",!h.togglePaletteOnly),E.toggleClass("sp-palette-disabled",!h.showPalette),E.toggleClass("sp-palette-only",h.showPaletteOnly),E.toggleClass("sp-initial-disabled",!h.showInitial),E.addClass(h.className).addClass(h.containerClassName),Qe()}function ve(){if(l){try{var e=window.localStorage,t=e[l].split(",#");1<t.length&&(delete e[l],De.each(t,function(e,t){xe(t)}))}catch(e){}try{j=window.localStorage[l].split(";")}catch(e){}}}function xe(e){if(i){var t=tinycolor(e).toRgbString();if(!z[t]&&-1===De.inArray(t,j))for(j.push(t);j.length>A;)j.shift();if(l)try{window.localStorage[l]=j.join(";")}catch(e){}}}function ye(){var a=Re(),e=De.map(M,function(e,t){return Xe(e,a,"sp-palette-row sp-palette-row-"+t,h)});ve(),j&&e.push(Xe(function(){var e=[];if(h.showPalette)for(var t=0;t<j.length;t++){var a=tinycolor(j[t]).toRgbString();z[a]||e.push(j[t])}return e.reverse().slice(0,h.maxSelectionSize)}(),a,"sp-palette-row sp-palette-row-selection",h)),X.html(e.join(""))}function Te(){if(h.showInitial){var e=se,t=Re();Y.html(Xe([e,t],t,"sp-palette-row-initial",h))}}function we(){(m<=0||b<=0||x<=0)&&Qe(),g=!0,E.addClass(R),H=null,O.trigger("dragstart.spectrum",[Re()])}function _e(){g=!1,E.removeClass(R),O.trigger("dragstop.spectrum",[Re()])}function ke(e){if(F)F=!1;else if(null!==e&&""!==e||!ue){var t=tinycolor(e);t.isValid()?(Ae(t),Fe(),Oe()):$.addClass("sp-validation-error")}else Ae(null),Fe(),Oe()}function Pe(){(p?ze:Ce)()}function Ce(){var e=De.Event("beforeShow.spectrum");p?Qe():(O.trigger(e,[Re()]),!1===u.beforeShow(Re())||e.isDefaultPrevented()||(function(){for(var e=0;e<Ve.length;e++)Ve[e]&&Ve[e].hide()}(),p=!0,De(L).on("keydown.spectrum",Se),De(L).on("click.spectrum",Me),De(window).on("resize.spectrum",f),ae.addClass("sp-active"),E.removeClass("sp-hidden"),Qe(),He(),se=Re(),Te(),u.show(se),O.trigger("show.spectrum",[se])))}function Se(e){27===e.keyCode&&ze()}function Me(e){2!=e.button&&(g||(le?Oe(!0):je(),ze()))}function ze(){p&&!d&&(p=!1,De(L).off("keydown.spectrum",Se),De(L).off("click.spectrum",Me),De(window).off("resize.spectrum",f),ae.removeClass("sp-active"),E.addClass("sp-hidden"),u.hide(Re()),O.trigger("hide.spectrum",[Re()]))}function je(){Ae(se,!0),Oe(!0)}function Ae(e,t){var a,o;tinycolor.equals(e,Re())?He():(e&&e!==qe||!ue?(ce=!1,o=(a=tinycolor(e)).toHsv(),_=o.h%360/360,k=o.s,P=o.v,C=o.a):ce=!0,He(),a&&a.isValid()&&!t&&(ie=h.preferredFormat||a.getFormat()))}function Re(e){return e=e||{},ue&&ce?null:tinycolor.fromRatio({h:_,s:k,v:P,a:Math.round(1e3*C)/1e3},{format:e.format||ie})}function Fe(){He(),u.move(Re()),O.trigger("move.spectrum",[Re()])}function He(){$.removeClass("sp-validation-error"),Le();var e=tinycolor.fromRatio({h:_,s:1,v:1});D.css("background-color",e.toHexString());var t=ie;C<1&&(0!==C||"name"!==t)&&("hex"!==t&&"hex3"!==t&&"hex6"!==t&&"name"!==t||(t="rgb"));var a=Re({format:t}),o="";if(re.removeClass("sp-clear-display"),re.css("background-color","transparent"),!a&&ue)re.addClass("sp-clear-display");else{var r=a.toHexString(),n=a.toRgbString();if(Be||1===a.alpha?re.css("background-color",n):(re.css("background-color","transparent"),re.css("filter",a.toFilter())),h.showAlpha){var s=a.toRgb();s.a=0;var i=tinycolor(s).toRgbString(),l="linear-gradient(left, "+i+", "+r+")";We?W.css("filter",tinycolor(i).toFilter({gradientType:1},r)):(W.css("background","-webkit-"+l),W.css("background","-moz-"+l),W.css("background","-ms-"+l),W.css("background","linear-gradient(to right, "+i+", "+r+")"))}o=a.toString(t)}if(h.showInput&&$.val(o),O.val(o),"text"==h.type||"component"==h.type){var c=a;if(c&&he){var u=c.isLight()||c.getAlpha()<.4?"black":"white";he.css("background-color",c.toRgbString()).css("color",u)}else he.css("background-color",pe).css("color",de)}h.showPalette&&ye(),Te()}function Le(){var e=k,t=P;if(ue&&ce)K.hide(),V.hide(),q.hide();else{K.show(),V.show(),q.show();var a=e*b,o=m-t*m;a=Math.max(-v,Math.min(b-v,a-v)),o=Math.max(-v,Math.min(m-v,o-v)),q.css({top:o+"px",left:a+"px"});var r=C*y;K.css({left:r-T/2+"px"});var n=_*x;V.css({top:n-w+"px"})}}function Oe(e){var t=Re(),a=!tinycolor.equals(t,se);t&&(t.toString(ie),xe(t)),e&&a&&(u.change(t),F=!0,O.trigger("change",[t]))}function Qe(){var e,t,a,o,r,n,s,i,l,c,u,f;p&&(b=D.width(),m=D.height(),v=q.height(),I.width(),x=I.height(),w=V.height(),y=B.width(),T=K.width(),d||(E.css("position","absolute"),h.offset?E.offset(h.offset):E.offset((t=oe,a=(e=E).outerWidth(),o=e.outerHeight(),r=t.outerHeight(),n=e[0].ownerDocument,s=n.documentElement,i=s.clientWidth+De(n).scrollLeft(),l=s.clientHeight+De(n).scrollTop(),c=t.offset(),u=c.left,f=c.top,f+=r,u-=Math.min(u,i<u+a&&a<i?Math.abs(u+a-i):0),{top:f-=Math.min(f,l<f+o&&o<l?Math.abs(+(o+r)):0),bottom:c.bottom,left:u,right:c.right,width:c.width,height:c.height}))),Le(),h.showPalette&&ye(),O.trigger("reflow.spectrum"))}function Ee(){ze(),Q=!0,O.attr("disabled",!0),oe.addClass("sp-disabled")}!function(){if(We&&E.find("*:not(input)").attr("unselectable","on"),me(),fe=De('<span class="sp-original-input-container"></span>'),["margin"].forEach(function(e){fe.css(e,O.css(e))}),"block"==O.css("display")&&fe.css("display","flex"),te)O.after(ae).hide();else if("text"==s)fe.addClass("sp-colorize-container"),O.addClass("spectrum sp-colorize").wrap(fe);else if("component"==s){O.addClass("spectrum").wrap(fe);var e=De(["<div class='sp-colorize-container sp-add-on'>","<div class='sp-colorize'></div> ","</div>"].join(""));e.width(O.outerHeight()+"px").css("border-radius",O.css("border-radius")).css("border",O.css("border")),O.addClass("with-add-on").before(e)}if(he=O.parent().find(".sp-colorize"),de=he.css("color"),pe=he.css("background-color"),ue||U.hide(),d)O.after(E).hide();else{var t="parent"===h.appendTo?O.parent():De(h.appendTo);1!==t.length&&(t=De("body")),t.append(E)}function a(e){return e.data&&e.data.ignore?(Ae(De(e.target).closest(".sp-thumb-el").data("color")),Fe()):(Ae(De(e.target).closest(".sp-thumb-el").data("color")),Fe(),h.hideAfterPaletteSelect?(Oe(!0),ze()):Oe()),!1}ve(),oe.on("click.spectrum touchstart.spectrum",function(e){Q||Pe(),e.stopPropagation(),De(e.target).is("input")||e.preventDefault()}),!O.is(":disabled")&&!0!==h.disabled||Ee(),E.click(Ye),[$,O].forEach(function(t){t.change(function(){ke(t.val())}),t.on("paste",function(){setTimeout(function(){ke(t.val())},1)}),t.keydown(function(e){13==e.keyCode&&(ke(De(t).val()),t==O&&ze())})}),G.text(h.cancelText),G.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),je(),ze()}),U.attr("title",h.clearText),U.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),ce=!0,Fe(),d&&Oe(!0)}),J.text(h.chooseText),J.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),We&&$.is(":focus")&&$.trigger("change"),$.hasClass("sp-validation-error")||(Oe(!0),ze())}),Z.text(h.showPaletteOnly?h.togglePaletteMoreText:h.togglePaletteLessText),Z.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),h.showPaletteOnly=!h.showPaletteOnly,h.showPaletteOnly||d||E.css("left","-="+(N.outerWidth(!0)+5)),me()}),Ue(B,function(e,t,a){C=e/y,ce=!1,a.shiftKey&&(C=Math.round(10*C)/10),Fe()},we,_e),Ue(I,function(e,t){_=parseFloat(t/x),ce=!1,h.showAlpha||(C=1),Fe()},we,_e),Ue(D,function(e,t,a){if(a.shiftKey){if(!H){var o=k*b,r=m-P*m,n=Math.abs(e-o)>Math.abs(t-r);H=n?"x":"y"}}else H=null;var s=!H||"y"===H;H&&"x"!==H||(k=parseFloat(e/b)),s&&(P=parseFloat((m-t)/m)),ce=!1,h.showAlpha||(C=1),Fe()},we,_e),ne?(Ae(ne),He(),ie=tinycolor(ne).format||h.preferredFormat,xe(ne)):(""===ne&&Ae(ne),He()),d&&Ce();var o=We?"mousedown.spectrum":"click.spectrum touchstart.spectrum";X.on(o,".sp-thumb-el",a),Y.on(o,".sp-thumb-el:nth-child(1)",{ignore:!0},a)}();var Ne={show:Ce,hide:ze,toggle:Pe,reflow:Qe,option:function(e,t){return e===qe?De.extend({},h):t===qe?h[e]:(h[e]=t,"preferredFormat"===e&&(ie=h.preferredFormat),void me())},enable:function(){Q=!1,O.attr("disabled",!1),oe.removeClass("sp-disabled")},disable:Ee,offset:function(e){h.offset=e,Qe()},set:function(e){Ae(e),Oe()},get:Re,destroy:function(){O.show().removeClass("spectrum with-add-on sp-colorize"),oe.off("click.spectrum touchstart.spectrum"),E.remove(),ae.remove(),he&&he.css("background-color",pe).css("color",de);var e=O.closest(".sp-original-input-container");0<e.length&&e.after(O).remove(),Ve[Ne.id]=null},container:E};return Ne.id=Ve.push(Ne)-1,Ne}function a(){}function Ye(e){e.stopPropagation()}function Ge(e,t){var a=Array.prototype.slice,o=a.call(arguments,2);return function(){return e.apply(t,o.concat(a.call(arguments)))}}function Ue(s,i,t,e){i=i||function(){},t=t||function(){},e=e||function(){};var l=document,c=!1,u={},f=0,h=0,d="ontouchstart"in window,a={};function p(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1}function o(e){if(c){if(We&&l.documentMode<9&&!e.button)return g();var t=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0],a=t&&t.pageX||e.pageX,o=t&&t.pageY||e.pageY,r=Math.max(0,Math.min(a-u.left,h)),n=Math.max(0,Math.min(o-u.top,f));d&&p(e),i.apply(s,[r,n,e])}}function g(){c&&(De(l).off(a),De(l.body).removeClass("sp-dragging"),setTimeout(function(){e.apply(s,arguments)},0)),c=!1}a.selectstart=p,a.dragstart=p,a["touchmove mousemove"]=o,a["touchend mouseup"]=g,De(s).on("touchstart mousedown",function(e){(e.which?3==e.which:2==e.button)||c||!1!==t.apply(s,arguments)&&(c=!0,f=De(s).height(),h=De(s).width(),u=De(s).offset(),De(l).on(a),De(l.body).addClass("sp-dragging"),o(e),p(e))})}function Je(){return De.fn.spectrum.inputTypeColorSupport()}var s="spectrum.id";De.fn.spectrum=function(a,e){if("string"!=typeof a)return this.spectrum("destroy").each(function(){var e=De.extend({},De(this).data(),a);De(this).is("input")?e.flat||"flat"==e.type?e.type="flat":"color"==De(this).attr("type")?e.type="color":e.type=e.type||"component":e.type="noInput";var t=n(this,e);De(this).data(s,t.id)});var o=this,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=Ve[De(this).data(s)];if(e){var t=e[a];if(!t)throw new Error("Spectrum: no such method: '"+a+"'");"get"==a?o=e.get():"container"==a?o=e.container:"option"==a?o=e.option.apply(e,r):"destroy"==a?(e.destroy(),De(this).removeData(s)):t.apply(e,r)}}),o},De.fn.spectrum.load=!0,De.fn.spectrum.loadOpts={},De.fn.spectrum.draggable=Ue,De.fn.spectrum.defaults=Ie,De.fn.spectrum.inputTypeColorSupport=function e(){if(void 0===e._cachedResult){var t=De("<input type='color'/>")[0];e._cachedResult="color"===t.type&&""!==t.value}return e._cachedResult},De.spectrum={},De.spectrum.localization={},De.spectrum.palettes={},De.fn.spectrum.processNativeColorInputs=function(){var e=De("input[type=color]");e.length&&!Je()&&e.spectrum({preferredFormat:"hex6"})},function(){var n=/^[\s,#]+/,s=/\s+$/,o=0,c=Math,i=c.round,u=c.min,f=c.max,e=c.random,h=function(e,t){if(t=t||{},(e=e||"")instanceof h)return e;if(!(this instanceof h))return new h(e,t);var a=function(e){var t={r:0,g:0,b:0},a=1,o=!1,r=!1;"string"==typeof e&&(e=function(e){e=e.replace(n,"").replace(s,"").toLowerCase();var t,a=!1;if(C[e])e=C[e],a=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=Q.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=Q.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=Q.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=Q.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=Q.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=Q.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=Q.hex8.exec(e))return{a:function(e){return A(e)/255}(t[1]),r:A(t[2]),g:A(t[3]),b:A(t[4]),format:a?"name":"hex8"};if(t=Q.hex6.exec(e))return{r:A(t[1]),g:A(t[2]),b:A(t[3]),format:a?"name":"hex"};if(t=Q.hex3.exec(e))return{r:A(t[1]+""+t[1]),g:A(t[2]+""+t[2]),b:A(t[3]+""+t[3]),format:a?"name":"hex"};return!1}(e));"object"==typeof e&&(e.hasOwnProperty("r")&&e.hasOwnProperty("g")&&e.hasOwnProperty("b")?(t=function(e,t,a){return{r:255*z(e,255),g:255*z(t,255),b:255*z(a,255)}}(e.r,e.g,e.b),o=!0,r="%"===String(e.r).substr(-1)?"prgb":"rgb"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("v")?(e.s=F(e.s),e.v=F(e.v),t=function(e,t,a){e=6*z(e,360),t=z(t,100),a=z(a,100);var o=c.floor(e),r=e-o,n=a*(1-t),s=a*(1-r*t),i=a*(1-(1-r)*t),l=o%6;return{r:255*[a,s,n,n,i,a][l],g:255*[i,a,a,s,n,n][l],b:255*[n,n,i,a,a,s][l]}}(e.h,e.s,e.v),o=!0,r="hsv"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("l")&&(e.s=F(e.s),e.l=F(e.l),t=function(e,t,a){var o,r,n;function s(e,t,a){return a<0&&(a+=1),1<a&&--a,a<1/6?e+6*(t-e)*a:a<.5?t:a<2/3?e+(t-e)*(2/3-a)*6:e}if(e=z(e,360),t=z(t,100),a=z(a,100),0===t)o=r=n=a;else{var i=a<.5?a*(1+t):a+t-a*t,l=2*a-i;o=s(l,i,e+1/3),r=s(l,i,e),n=s(l,i,e-1/3)}return{r:255*o,g:255*r,b:255*n}}(e.h,e.s,e.l),o=!0,r="hsl"),e.hasOwnProperty("a")&&(a=e.a));return a=M(a),{ok:o,format:e.format||r,r:u(255,f(t.r,0)),g:u(255,f(t.g,0)),b:u(255,f(t.b,0)),a:a}}(e);this._originalInput=e,this._r=a.r,this._g=a.g,this._b=a.b,this._a=a.a,this._roundA=i(1e3*this._a)/1e3,this._format=t.format||a.format,this._gradientType=t.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=a.ok,this._tc_id=o++};function r(e,t,a){e=z(e,255),t=z(t,255),a=z(a,255);var o,r,n=f(e,t,a),s=u(e,t,a),i=(n+s)/2;if(n==s)o=r=0;else{var l=n-s;switch(r=.5<i?l/(2-n-s):l/(n+s),n){case e:o=(t-a)/l+(t<a?6:0);break;case t:o=(a-e)/l+2;break;case a:o=(e-t)/l+4}o/=6}return{h:o,s:r,l:i}}function l(e,t,a){e=z(e,255),t=z(t,255),a=z(a,255);var o,r,n=f(e,t,a),s=u(e,t,a),i=n,l=n-s;if(r=0===n?0:l/n,n==s)o=0;else{switch(n){case e:o=(t-a)/l+(t<a?6:0);break;case t:o=(a-e)/l+2;break;case a:o=(e-t)/l+4}o/=6}return{h:o,s:r,v:i}}function t(e,t,a,o){var r=[R(i(e).toString(16)),R(i(t).toString(16)),R(i(a).toString(16))];return o&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function d(e,t,a,o){var r;return[R((r=o,Math.round(255*parseFloat(r)).toString(16))),R(i(e).toString(16)),R(i(t).toString(16)),R(i(a).toString(16))].join("")}function a(e,t){t=0===t?0:t||10;var a=h(e).toHsl();return a.s-=t/100,a.s=j(a.s),h(a)}function p(e,t){t=0===t?0:t||10;var a=h(e).toHsl();return a.s+=t/100,a.s=j(a.s),h(a)}function g(e){return h(e).desaturate(100)}function b(e,t){t=0===t?0:t||10;var a=h(e).toHsl();return a.l+=t/100,a.l=j(a.l),h(a)}function m(e,t){t=0===t?0:t||10;var a=h(e).toRgb();return a.r=f(0,u(255,a.r-i(-t/100*255))),a.g=f(0,u(255,a.g-i(-t/100*255))),a.b=f(0,u(255,a.b-i(-t/100*255))),h(a)}function v(e,t){t=0===t?0:t||10;var a=h(e).toHsl();return a.l-=t/100,a.l=j(a.l),h(a)}function x(e,t){var a=h(e).toHsl(),o=(i(a.h)+t)%360;return a.h=o<0?360+o:o,h(a)}function y(e){var t=h(e).toHsl();return t.h=(t.h+180)%360,h(t)}function T(e){var t=h(e).toHsl(),a=t.h;return[h(e),h({h:(a+120)%360,s:t.s,l:t.l}),h({h:(a+240)%360,s:t.s,l:t.l})]}function w(e){var t=h(e).toHsl(),a=t.h;return[h(e),h({h:(a+90)%360,s:t.s,l:t.l}),h({h:(a+180)%360,s:t.s,l:t.l}),h({h:(a+270)%360,s:t.s,l:t.l})]}function _(e){var t=h(e).toHsl(),a=t.h;return[h(e),h({h:(a+72)%360,s:t.s,l:t.l}),h({h:(a+216)%360,s:t.s,l:t.l})]}function k(e,t,a){t=t||6,a=a||30;var o=h(e).toHsl(),r=360/a,n=[h(e)];for(o.h=(o.h-(r*t>>1)+720)%360;--t;)o.h=(o.h+r)%360,n.push(h(o));return n}function P(e,t){t=t||6;for(var a=h(e).toHsv(),o=a.h,r=a.s,n=a.v,s=[],i=1/t;t--;)s.push(h({h:o,s:r,v:n})),n=(n+i)%1;return s}h.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},setAlpha:function(e){return this._a=M(e),this._roundA=i(1e3*this._a)/1e3,this},toHsv:function(){var e=l(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=l(this._r,this._g,this._b),t=i(360*e.h),a=i(100*e.s),o=i(100*e.v);return 1==this._a?"hsv("+t+", "+a+"%, "+o+"%)":"hsva("+t+", "+a+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var e=r(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=r(this._r,this._g,this._b),t=i(360*e.h),a=i(100*e.s),o=i(100*e.l);return 1==this._a?"hsl("+t+", "+a+"%, "+o+"%)":"hsla("+t+", "+a+"%, "+o+"%, "+this._roundA+")"},toHex:function(e){return t(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return d(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*z(this._r,255))+"%",g:i(100*z(this._g,255))+"%",b:i(100*z(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*z(this._r,255))+"%, "+i(100*z(this._g,255))+"%, "+i(100*z(this._b,255))+"%)":"rgba("+i(100*z(this._r,255))+"%, "+i(100*z(this._g,255))+"%, "+i(100*z(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[t(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+d(this._r,this._g,this._b,this._a),a=t,o=this._gradientType?"GradientType = 1, ":"";e&&(a=h(e).toHex8String());return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+t+",endColorstr="+a+")"},toString:function(e){var t=!!e;e=e||this._format;var a=!1,o=this._a<1&&0<=this._a;return t||!o||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"name"!==e?("rgb"===e&&(a=this.toRgbString()),"prgb"===e&&(a=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(a=this.toHexString()),"hex3"===e&&(a=this.toHexString(!0)),"hex8"===e&&(a=this.toHex8String()),"name"===e&&(a=this.toName()),"hsl"===e&&(a=this.toHslString()),"hsv"===e&&(a=this.toHsvString()),a||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},_applyModification:function(e,t){var a=e.apply(null,[this].concat([].slice.call(t)));return this._r=a._r,this._g=a._g,this._b=a._b,this.setAlpha(a._a),this},lighten:function(){return this._applyModification(b,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(a,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(P,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(T,arguments)},tetrad:function(){return this._applyCombination(w,arguments)}},h.fromRatio=function(e,t){if("object"==typeof e){var a={};for(var o in e)e.hasOwnProperty(o)&&(a[o]="a"===o?e[o]:F(e[o]));e=a}return h(e,t)},h.equals=function(e,t){return!(!e||!t)&&h(e).toRgbString()==h(t).toRgbString()},h.random=function(){return h.fromRatio({r:e(),g:e(),b:e()})},h.mix=function(e,t,a){a=0===a?0:a||50;var o,r=h(e).toRgb(),n=h(t).toRgb(),s=a/100,i=2*s-1,l=n.a-r.a,c=1-(o=((o=i*l==-1?i:(i+l)/(1+i*l))+1)/2),u={r:n.r*o+r.r*c,g:n.g*o+r.g*c,b:n.b*o+r.b*c,a:n.a*s+r.a*(1-s)};return h(u)},h.readability=function(e,t){var a=h(e),o=h(t),r=a.toRgb(),n=o.toRgb(),s=a.getBrightness(),i=o.getBrightness(),l=Math.max(r.r,n.r)-Math.min(r.r,n.r)+Math.max(r.g,n.g)-Math.min(r.g,n.g)+Math.max(r.b,n.b)-Math.min(r.b,n.b);return{brightness:Math.abs(s-i),color:l}},h.isReadable=function(e,t){var a=h.readability(e,t);return 125<a.brightness&&500<a.color},h.mostReadable=function(e,t){for(var a=null,o=0,r=!1,n=0;n<t.length;n++){var s=h.readability(e,t[n]),i=125<s.brightness&&500<s.color,l=s.brightness/125*3+s.color/500;(i&&!r||i&&r&&o<l||!i&&!r&&o<l)&&(r=i,o=l,a=h(t[n]))}return a};var C=h.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},S=h.hexNames=function(e){var t={};for(var a in e)e.hasOwnProperty(a)&&(t[e[a]]=a);return t}(C);function M(e){return e=parseFloat(e),(isNaN(e)||e<0||1<e)&&(e=1),e}function z(e,t){var a;"string"==typeof(a=e)&&-1!=a.indexOf(".")&&1===parseFloat(a)&&(e="100%");var o,r="string"==typeof(o=e)&&-1!=o.indexOf("%");return e=u(t,f(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),c.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function j(e){return u(1,f(0,e))}function A(e){return parseInt(e,16)}function R(e){return 1==e.length?"0"+e:""+e}function F(e){return e<=1&&(e=100*e+"%"),e}var H,L,O,Q=(L="[\\s|\\(]+("+(H="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",O="[\\s|\\(]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",{rgb:new RegExp("rgb"+L),rgba:new RegExp("rgba"+O),hsl:new RegExp("hsl"+L),hsla:new RegExp("hsla"+O),hsv:new RegExp("hsv"+L),hsva:new RegExp("hsva"+O),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});window.tinycolor=h}(),De(function(){De.fn.spectrum.load&&De.fn.spectrum.processNativeColorInputs()})}),jQuery.spectrum.localization.ar={cancelText:"إلغاء",chooseText:"إختار",clearText:"إرجاع الألوان على ما كانت",noColorSelectedText:"لم تختار أي لون",togglePaletteMoreText:"أكثر",togglePaletteLessText:"أقل"},jQuery.spectrum.localization.ca={cancelText:"Cancel·lar",chooseText:"Escollir",clearText:"Esborrar color seleccionat",noColorSelectedText:"Cap color seleccionat",togglePaletteMoreText:"Més",togglePaletteLessText:"Menys"},jQuery.spectrum.localization.cs={cancelText:"zrušit",chooseText:"vybrat",clearText:"Resetovat výměr barev",noColorSelectedText:"Žádná barva nebyla vybrána",togglePaletteMoreText:"více",togglePaletteLessText:"méně"},jQuery.spectrum.localization.de={cancelText:"Abbrechen",chooseText:"Wählen",clearText:"Farbauswahl zurücksetzen",noColorSelectedText:"Keine Farbe ausgewählt",togglePaletteMoreText:"Mehr",togglePaletteLessText:"Weniger"},jQuery.spectrum.localization.dk={cancelText:"annuller",chooseText:"Vælg"},jQuery.spectrum.localization.es={cancelText:"Cancelar",chooseText:"Elegir",clearText:"Borrar color seleccionado",noColorSelectedText:"Ningún color seleccionado",togglePaletteMoreText:"Más",togglePaletteLessText:"Menos"},jQuery.spectrum.localization.et={cancelText:"Katkesta",chooseText:"Vali",clearText:"Tühista värvivalik",noColorSelectedText:"Ühtki värvi pole valitud",togglePaletteMoreText:"Rohkem",togglePaletteLessText:"Vähem"},jQuery.spectrum.localization.fa={cancelText:"لغو",chooseText:"انتخاب",clearText:"تنظیم مجدد رنگ",noColorSelectedText:"هیچ رنگی انتخاب نشده است!",togglePaletteMoreText:"بیشتر",togglePaletteLessText:"کمتر"},jQuery.spectrum.localization.fi={cancelText:"Kumoa",chooseText:"Valitse"},jQuery.spectrum.localization.fr={cancelText:"Annuler",chooseText:"Valider",clearText:"Effacer couleur sélectionnée",noColorSelectedText:"Aucune couleur sélectionnée",togglePaletteMoreText:"Plus",togglePaletteLessText:"Moins"},jQuery.spectrum.localization.gr={cancelText:"Ακύρωση",chooseText:"Επιλογή",clearText:"Καθαρισμός επιλεγμένου χρώματος",noColorSelectedText:"Δεν έχει επιλεχθεί κάποιο χρώμα",togglePaletteMoreText:"Περισσότερα",togglePaletteLessText:"Λιγότερα"},jQuery.spectrum.localization.he={cancelText:"בטל בחירה",chooseText:"בחר צבע",clearText:"אפס בחירה",noColorSelectedText:"לא נבחר צבע",togglePaletteMoreText:"עוד צבעים",togglePaletteLessText:"פחות צבעים"},jQuery.spectrum.localization.hr={cancelText:"Odustani",chooseText:"Odaberi",clearText:"Poništi odabir",noColorSelectedText:"Niti jedna boja nije odabrana",togglePaletteMoreText:"Više",togglePaletteLessText:"Manje"},jQuery.spectrum.localization.hu={cancelText:"Mégsem",chooseText:"Mentés",clearText:"A színválasztás visszaállítása",noColorSelectedText:"Nincs szín kijelölve",togglePaletteMoreText:"Több",togglePaletteLessText:"Kevesebb"},jQuery.spectrum.localization.id={cancelText:"Batal",chooseText:"Pilih",clearText:"Hapus Pilihan Warna",noColorSelectedText:"Warna Tidak Dipilih",togglePaletteMoreText:"tambah",togglePaletteLessText:"kurangi"},jQuery.spectrum.localization.it={cancelText:"annulla",chooseText:"scegli",clearText:"Annulla selezione colore",noColorSelectedText:"Nessun colore selezionato"},jQuery.spectrum.localization.ja={cancelText:"中止",chooseText:"選択"},jQuery.spectrum.localization.ko={cancelText:"취소",chooseText:"선택",clearText:"선택 초기화",noColorSelectedText:"선택된 색상 없음",togglePaletteMoreText:"더보기",togglePaletteLessText:"줄이기"},jQuery.spectrum.localization.lt={cancelText:"Atšaukti",chooseText:"Pasirinkti",clearText:"Išvalyti pasirinkimą",noColorSelectedText:"Spalva nepasirinkta",togglePaletteMoreText:"Daugiau",togglePaletteLessText:"Mažiau"},jQuery.spectrum.localization["nb-no"]={cancelText:"Avbryte",chooseText:"Velg",clearText:"Tilbakestill",noColorSelectedText:"Farge er ikke valgt",togglePaletteMoreText:"Mer",togglePaletteLessText:"Mindre"},jQuery.spectrum.localization["nl-nl"]={cancelText:"Annuleer",chooseText:"Kies",clearText:"Wis kleur selectie",togglePaletteMoreText:"Meer",togglePaletteLessText:"Minder"},jQuery.spectrum.localization.pl={cancelText:"Anuluj",chooseText:"Wybierz",clearText:"Usuń wybór koloru",noColorSelectedText:"Nie wybrano koloru",togglePaletteMoreText:"Więcej",togglePaletteLessText:"Mniej"},jQuery.spectrum.localization["pt-br"]={cancelText:"Cancelar",chooseText:"Escolher",clearText:"Limpar cor selecionada",noColorSelectedText:"Nenhuma cor selecionada",togglePaletteMoreText:"Mais",togglePaletteLessText:"Menos"},jQuery.spectrum.localization["pt-pt"]={cancelText:"Cancelar",chooseText:"Escolher",clearText:"Limpar cor seleccionada",noColorSelectedText:"Nenhuma cor seleccionada",togglePaletteMoreText:"Mais",togglePaletteLessText:"Menos"},jQuery.spectrum.localization.ru={cancelText:"Отмена",chooseText:"Выбрать",clearText:"Сбросить",noColorSelectedText:"Цвет не выбран",togglePaletteMoreText:"Ещё",togglePaletteLessText:"Скрыть"},jQuery.spectrum.localization.sv={cancelText:"Avbryt",chooseText:"Välj"},jQuery.spectrum.localization.tr={cancelText:"iptal",chooseText:"tamam"},jQuery.spectrum.localization["zh-cn"]={cancelText:"取消",chooseText:"选择",clearText:"清除",togglePaletteMoreText:"更多选项",togglePaletteLessText:"隐藏",noColorSelectedText:"尚未选择任何颜色"},jQuery.spectrum.localization["zh-tw"]={cancelText:"取消",chooseText:"選擇",clearText:"清除",togglePaletteMoreText:"更多選項",togglePaletteLessText:"隱藏",noColorSelectedText:"尚未選擇任何顏色"};