Newsletter - Version 5.2.2

Version Description

=

  • Removed create_function from widgets (compatibility PHP 7.2)
  • Fixed the list exclusion condition
  • Added options to Newsletter shortcodes to show the lists as dropdown

=

Download this release

Release Info

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

Code changes from version 5.2.1 to 5.2.2

admin.css CHANGED
@@ -179,11 +179,15 @@
179
  color: #fff;
180
  }
181
 
182
- #tnp-body a, #tnp-body a:hover, #tnp-body a:visited, #tnp-body a:active {
183
- color: #E67E22; /* Orange */
184
  }
185
 
186
- /* Actiojn button container */
 
 
 
 
187
  #tnp-body .tnp-submit {
188
  margin-bottom: 10px;
189
  }
@@ -1875,17 +1879,57 @@ input:checked + .slider:before {
1875
  .slider.round:before {
1876
  border-radius: 50%;
1877
  }
 
 
 
1878
  #tnp-body div.tnp-emails-theme-options table.form-table {
1879
- margin: 0;
1880
  }
1881
 
1882
  #tnp-body div.tnp-emails-theme-options h3 {
1883
  color: #000;
1884
  }
1885
 
 
 
 
1886
  .tnp-emails-edit #options-subject {
1887
- font-size: 20px;
1888
  display: inline-block;
1889
- margin-bottom: 10px;
1890
- width: 100%;
 
 
1891
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  color: #fff;
180
  }
181
 
182
+ #tnp-body a, #tnp-body a:active {
183
+ color: #2980B9; /* Blue */
184
  }
185
 
186
+ #tnp-body a:hover {
187
+ color: #3498DB;
188
+ }
189
+
190
+ /* Action button container */
191
  #tnp-body .tnp-submit {
192
  margin-bottom: 10px;
193
  }
1879
  .slider.round:before {
1880
  border-radius: 50%;
1881
  }
1882
+
1883
+ /* Cossa sea sta roba? ORDINE! */
1884
+
1885
  #tnp-body div.tnp-emails-theme-options table.form-table {
1886
+ margin: 0;
1887
  }
1888
 
1889
  #tnp-body div.tnp-emails-theme-options h3 {
1890
  color: #000;
1891
  }
1892
 
1893
+
1894
+ /* Suggerimenti Oggetto + Inserimento Emoticons */
1895
+
1896
  .tnp-emails-edit #options-subject {
1897
+ font-size: 16px;
1898
  display: inline-block;
1899
+ margin: 20px 0px;
1900
+ width: 70%;
1901
+ border-radius: 4px;
1902
+ padding: 5px 10px;
1903
  }
1904
+
1905
+ .tnp-suggest-button {
1906
+ font-family: "Montserrat", sans-serif;
1907
+ margin-left: 8px;
1908
+ border-radius: 3px;
1909
+ border: 1px solid #2980B9;
1910
+ padding: 5px 15px;
1911
+ font-size: 16px;
1912
+ text-decoration: none;
1913
+ }
1914
+
1915
+ .tnp-suggest-button:hover {
1916
+ border: 2px solid #3498DB;
1917
+ }
1918
+
1919
+ /*
1920
+ #options-subject {
1921
+ background: url(images/idea.svg) no-repeat white 99% 3px;
1922
+ background-size: 25px;
1923
+ }
1924
+
1925
+ #options-subject:hover {
1926
+ background: url(images/idea.svg) no-repeat red 99% 3px;
1927
+ background-size: 25px;
1928
+ }
1929
+ */
1930
+
1931
+ /* Stile selettore liste - Schermata di invio newsletter */
1932
+
1933
+ .tnp-list-conditions p {
1934
+ margin: 0px 10px;
1935
+ }
emails/edit.php CHANGED
@@ -148,7 +148,8 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
148
  }
149
  }
150
  if (!empty($list_where)) {
151
- $query .= ' and (' . implode(' or ', $list_where) . ')';
 
152
  }
153
 
154
  if (isset($email['options']['sex'])) {
@@ -334,7 +335,11 @@ if (isset($controls->data['options_status']) && $controls->data['options_status'
334
  <?php //if ($images) $controls->button_confirm('import', __('Import images', 'newsletter'), 'Proceed?') ?>
335
  </div>
336
 
337
- <?php $controls->text('subject', 70, 'Subject'); ?>
 
 
 
 
338
 
339
  <div id="tabs">
340
  <ul>
@@ -376,7 +381,7 @@ if (isset($controls->data['options_status']) && $controls->data['options_status'
376
  </div>
377
 
378
 
379
- <div id="tabs-c">
380
  <p>
381
  <?php $controls->panel_help('https://www.thenewsletterplugin.com/documentation/newsletter-targeting') ?>
382
  </p>
@@ -501,6 +506,140 @@ if (isset($controls->data['options_status']) && $controls->data['options_status'
501
  </form>
502
  </div>
503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
505
 
506
  </div>
148
  }
149
  }
150
  if (!empty($list_where)) {
151
+ // Must not be in one of the excluded lists
152
+ $query .= ' and (' . implode(' and ', $list_where) . ')';
153
  }
154
 
155
  if (isset($email['options']['sex'])) {
335
  <?php //if ($images) $controls->button_confirm('import', __('Import images', 'newsletter'), 'Proceed?') ?>
336
  </div>
337
 
338
+ <?php $controls->text('subject', 70, 'Subject'); ?>
339
+ <!--
340
+ <a href="#" class="tnp-suggest-button" onclick="tnp_suggest_subject(); return false;"><?php _e('Get ideas', 'newsletter') ?></a></a>
341
+ <a href="#" class="tnp-suggest-button" onclick="tnp_emoji(); return false;"><?php _e('Insert emoji', 'newsletter') ?></a>
342
+ -->
343
 
344
  <div id="tabs">
345
  <ul>
381
  </div>
382
 
383
 
384
+ <div id="tabs-c" class="tnp-list-conditions">
385
  <p>
386
  <?php $controls->panel_help('https://www.thenewsletterplugin.com/documentation/newsletter-targeting') ?>
387
  </p>
506
  </form>
507
  </div>
508
 
509
+ <script>
510
+ function tnp_suggest_subject() {
511
+ jQuery("#tnp-edit-subjects").show();
512
+ }
513
+
514
+ function tnp_emoji() {
515
+ jQuery("#tnp-edit-emoji").show();
516
+ }
517
+
518
+ jQuery(function () {
519
+ jQuery("#tnp-edit-subjects-list a").click(function (e) {
520
+ e.preventDefault();
521
+ document.getElementById("options-subject").value = this.innerText;
522
+ jQuery("#tnp-edit-subjects").hide();
523
+ });
524
+
525
+ jQuery("#tnp-edit-emoji-list a").click(function (e) {
526
+ e.preventDefault();
527
+ document.getElementById("options-subject").value = this.title + document.getElementById("options-subject").value;
528
+ jQuery("#tnp-edit-emoji").hide();
529
+ });
530
+
531
+ jQuery(".tnp-popup-close").click(function () {
532
+ $(this).parent().parent().hide();
533
+
534
+ });
535
+ });
536
+ </script>
537
+ <style>
538
+ .tnp-popup-overlay {
539
+ display: none;
540
+ position: fixed;
541
+ top: 0;
542
+ left: 0;
543
+ width: 100%;
544
+ height: 100%;
545
+ background-color: rgba(0, 0, 0, .4);
546
+ z-index: 10000;
547
+ }
548
+
549
+ .tnp-popup {
550
+ width: 600px;
551
+ height: 500px;
552
+ overflow: auto;
553
+ margin: 100px auto 0 auto;
554
+ background-color: #fff;
555
+ padding: 20px;
556
+ position: relative;
557
+ }
558
+ .tnp-popup-close {
559
+ display: block;
560
+ position: fixed;
561
+ top: 5px;
562
+ right: 5px;
563
+ background-color: #000;
564
+ color: #fff;
565
+ font-size: 30px;
566
+ border-radius: 50%;
567
+ padding: 5px;
568
+ }
569
+ #tnp-edit-emoji-list {
570
+ font-size: 28px;
571
+ }
572
+ #tnp-edit-emoji-list a {
573
+ display: inline-block;
574
+ margin-right: 5px;
575
+ margin-bottom: 5px;
576
+ }
577
+ </style>
578
+ <div id="tnp-edit-subjects" class="tnp-popup-overlay">
579
+ <div class="tnp-popup">
580
+ <a class="tnp-popup-close">&times;</a>
581
+ <p>
582
+ Here few subject templates you can choose from which should engage your subscribers.
583
+ </p>
584
+ <div id="tnp-edit-subjects-list">
585
+ <h3>Dangers</h3>
586
+ <a href="#"><?php _e('How safe is your <em>[something]</em> from <em>[danger]</em>?', 'newsletter') ?></a><br>
587
+ <a href="#"><?php _e('10 Warning Signs That <em>[something]</em>', 'newsletter') ?></a><br>
588
+ <a href="#"><?php _e('10 Lies <em>[kind of people]</em> Likes to Tell', 'newsletter') ?></a><br>
589
+
590
+ <h3>Better life, problem management</h3>
591
+ <a href="#"><?php _e('10 Ways to Simplify Your <em>[something]</em>', 'newsletter') ?></a><br>
592
+ <a href="#"><?php _e('Get Rid of <em>[problem]</em> Once and Forever', 'newsletter') ?></a><br>
593
+ <a href="#"><?php _e('How to End [problem]', 'newsletter') ?></a><br>
594
+ <a href="#"><?php _e('Secrets of [famous people]', 'newsletter') ?></a><br>
595
+
596
+ <h3>Mistakes</h3>
597
+ <a href="#"><?php _e('Do You Make These 10 <em>[something]</em> Mistakes?', 'newsletter') ?></a><br>
598
+ <a href="#"><?php _e('10 <em>[something]</em> Mistakes That Make You Look Dumb', 'newsletter') ?></a><br>
599
+ <a href="#"><?php _e('Don\'t do These 10 Things When <em>[something]</em>', 'newsletter') ?></a><br>
600
+
601
+ <h3>Lists (classic)</h3>
602
+ <a href="#"><?php _e('10 Ways to <em>[something]</em>', 'newsletter') ?></a><br>
603
+ <a href="#"><?php _e('The Top 10 <em>[something]</em>', 'newsletter') ?></a><br>
604
+ <a href="#"><?php _e('The 10 Rules for <em>[something]</em>', 'newsletter') ?></a><br>
605
+ <a href="#"><?php _e('Get/Become <em>[something]</em>. 10 Ideas That Work', 'newsletter') ?></a><br>
606
+
607
+ </div>
608
+ </div>
609
+ </div>
610
+
611
+ <div id="tnp-edit-emoji" class="tnp-popup-overlay">
612
+ <div class="tnp-popup">
613
+ <a class="tnp-popup-close">&times;</a>
614
+ <p>
615
+ Emoji are usually rendered differently on different systems. Don't expect everyone will see what you see.
616
+ </p>
617
+ <div id="tnp-edit-emoji-list">
618
+ <?php
619
+ $emojiRangesCustom = array(
620
+ '128512' => '128590',
621
+ '129296' => '129310',
622
+ '129312' => '129319',
623
+ '127744' => '128511',
624
+ '128640' => '128705',
625
+ '129296' => '129310',
626
+ '129312' => '129319',
627
+ '129360' => '129374',
628
+ '129408' => '129425'
629
+ );
630
+
631
+ foreach ($emojiRangesCustom as $start => $end) {
632
+ $current = $start;
633
+ while ($current != $end) {
634
+ echo '<a href="#" title="&#' . $current . ';">&#' . $current . ';</a> ';
635
+ $current ++;
636
+ }
637
+ }
638
+ ?>
639
+ </div>
640
+ </div>
641
+ </div>
642
+
643
  <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
644
 
645
  </div>
images/idea.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 48 48" xml:space="preserve" width="48" height="48"><g class="nc-icon-wrapper"><path fill="#43A6DD" d="M6,25H2c-0.55225,0-1-0.44727-1-1s0.44775-1,1-1h4c0.55225,0,1,0.44727,1,1S6.55225,25,6,25z"></path> <path fill="#43A6DD" d="M11.27197,12.27246c-0.25586,0-0.51172-0.09766-0.70703-0.29297l-2.82812-2.8291 c-0.39062-0.39062-0.39062-1.02344,0-1.41406s1.02344-0.39062,1.41406,0l2.82812,2.8291c0.39062,0.39062,0.39062,1.02344,0,1.41406 C11.78369,12.1748,11.52783,12.27246,11.27197,12.27246z"></path> <path fill="#43A6DD" d="M24,7c-0.55225,0-1-0.44727-1-1V2c0-0.55273,0.44775-1,1-1s1,0.44727,1,1v4C25,6.55273,24.55225,7,24,7z"></path> <path fill="#43A6DD" d="M36.72803,12.27246c-0.25586,0-0.51172-0.09766-0.70703-0.29297c-0.39062-0.39062-0.39062-1.02344,0-1.41406 l2.82812-2.8291c0.38965-0.39062,1.02344-0.39062,1.41406,0s0.39062,1.02344,0,1.41406l-2.82812,2.8291 C37.24023,12.1748,36.98389,12.27246,36.72803,12.27246z"></path> <path fill="#43A6DD" d="M46,25h-4c-0.55225,0-1-0.44727-1-1s0.44775-1,1-1h4c0.55225,0,1,0.44727,1,1S46.55225,25,46,25z"></path> <path fill="#EFD358" d="M29,41H19v-5.01172c-5.33776-2.22651-8.67485-7.80107-7.88457-13.71942 c0.85052-6.36943,6.45305-11.26616,12.87902-11.26886C31.16545,10.997,37,16.83019,37,24c0,5.25-3.18652,9.98047-8,11.98828V41z"></path> <path fill="#E6E6E6" d="M24.00001,47h-0.00001C21.23857,47,19,44.76143,19,42v-3h10v3C29,44.76143,26.76143,47,24.00001,47z"></path> <rect x="19" y="39" fill="#B3B3B3" width="10" height="2"></rect></g></svg>
includes/controls.php CHANGED
@@ -1284,7 +1284,7 @@ class NewsletterControls {
1284
  return NewsletterUsers::instance()->get_test_users();
1285
  }
1286
 
1287
- function css_font_size($name) {
1288
  $value = $this->get_value($name);
1289
 
1290
  echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
@@ -1298,7 +1298,7 @@ class NewsletterControls {
1298
  echo '</select>&nbsp;px';
1299
  }
1300
 
1301
- function css_font_family($name) {
1302
  $value = $this->get_value($name);
1303
 
1304
  $fonts = array('Helvetica, Arial, sans-serif', 'Arial Black, Gadget, sans-serif', 'Garamond, serif', 'Courier, monospace', 'Cominc Sans MS, cursive', 'Impact, Charcoal, sans-serif',
1284
  return NewsletterUsers::instance()->get_test_users();
1285
  }
1286
 
1287
+ function css_font_size($name = 'font_size') {
1288
  $value = $this->get_value($name);
1289
 
1290
  echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
1298
  echo '</select>&nbsp;px';
1299
  }
1300
 
1301
+ function css_font_family($name = 'font_family') {
1302
  $value = $this->get_value($name);
1303
 
1304
  $fonts = array('Helvetica, Arial, sans-serif', 'Arial Black, Gadget, sans-serif', 'Garamond, serif', 'Courier, monospace', 'Cominc Sans MS, cursive', 'Impact, Charcoal, sans-serif',
plugin.php CHANGED
@@ -4,17 +4,17 @@
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: 5.2.1
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.
11
  Text Domain: newsletter
12
 
13
- Copyright 2009-2017 The Newsletter Team (email: info@thenewsletterplugin.com, web: https://www.thenewsletterplugin.com)
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
- define('NEWSLETTER_VERSION', '5.2.1');
18
 
19
  global $wpdb, $newsletter;
20
 
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: 5.2.2
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.
11
  Text Domain: newsletter
12
 
13
+ Copyright 2009-2018 The Newsletter Team (email: info@thenewsletterplugin.com, web: https://www.thenewsletterplugin.com)
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
+ define('NEWSLETTER_VERSION', '5.2.2');
18
 
19
  global $wpdb, $newsletter;
20
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
  Tested up to: 4.9.2
5
- Stable tag: 5.2.1
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -85,9 +85,11 @@ Thank you, The Newsletter Team
85
 
86
  == Changelog ==
87
 
88
- == NEXT ==
89
 
90
  * Removed create_function from widgets (compatibility PHP 7.2)
 
 
91
 
92
  == 5.2.1 ==
93
 
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
  Tested up to: 4.9.2
5
+ Stable tag: 5.2.2
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
85
 
86
  == Changelog ==
87
 
88
+ == 5.2.2 ==
89
 
90
  * Removed create_function from widgets (compatibility PHP 7.2)
91
+ * Fixed the list exclusion condition
92
+ * Added [options to Newsletter shortcodes](https://www.thenewsletterplugin.com/documentation/subscription-form-shortcodes) to show the lists as dropdown
93
 
94
  == 5.2.1 ==
95
 
subscription/subscription.php CHANGED
@@ -260,7 +260,7 @@ class NewsletterSubscription extends NewsletterModule {
260
  }
261
 
262
  function first_install() {
263
-
264
  }
265
 
266
  function admin_menu() {
@@ -1309,6 +1309,7 @@ class NewsletterSubscription extends NewsletterModule {
1309
  if (isset($attrs['referrer'])) {
1310
  $referrer = $attrs['referrer'];
1311
  }
 
1312
  $options_profile = get_option('newsletter_profile');
1313
  $options = get_option('newsletter');
1314
 
@@ -1334,6 +1335,8 @@ class NewsletterSubscription extends NewsletterModule {
1334
  $buffer .= "<input type='hidden' name='ncu' value='" . esc_attr($attrs['confirmation_url']) . "'>\n";
1335
  }
1336
 
 
 
1337
  if (isset($attrs['list'])) {
1338
  $arr = explode(',', $attrs['list']);
1339
  foreach ($arr as $a) {
@@ -1372,18 +1375,43 @@ class NewsletterSubscription extends NewsletterModule {
1372
  }
1373
 
1374
  $lists = '';
1375
- for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1376
- if ($options_profile['list_' . $i . '_status'] != 2) {
1377
- continue;
 
 
 
 
 
 
 
 
1378
  }
1379
- $lists .= '<div class="tnp-field tnp-field-list"><label><input class="tnp-preference" type="checkbox" name="nl[]" value="' . $i . '"';
1380
- if ($options_profile['list_' . $i . '_checked'] == 1) {
1381
- $lists .= ' checked';
 
 
 
 
 
 
 
 
 
 
 
 
 
1382
  }
1383
- $lists .= '/>&nbsp;' . esc_html($options_profile['list_' . $i]) . '</label></div>';
1384
  }
 
1385
  if (!empty($lists)) {
1386
- $buffer .= '<div class="tnp-lists">' . $lists . '</div>';
 
 
 
 
1387
  }
1388
 
1389
  // Extra profile fields
@@ -1764,7 +1792,7 @@ class NewsletterSubscription extends NewsletterModule {
1764
  if (!is_array($attrs)) {
1765
  $attrs = array();
1766
  }
1767
- $attrs = array_merge(array('class'=>'', 'referrer' => 'minimal', 'button' => $options_profile['subscribe'], 'placeholder' => $options_profile['email']), $attrs);
1768
 
1769
  $form = '';
1770
  $form .= '<div class="tnp tnp-subscription-minimal ' . $attrs['class'] . '">';
260
  }
261
 
262
  function first_install() {
263
+
264
  }
265
 
266
  function admin_menu() {
1309
  if (isset($attrs['referrer'])) {
1310
  $referrer = $attrs['referrer'];
1311
  }
1312
+
1313
  $options_profile = get_option('newsletter_profile');
1314
  $options = get_option('newsletter');
1315
 
1335
  $buffer .= "<input type='hidden' name='ncu' value='" . esc_attr($attrs['confirmation_url']) . "'>\n";
1336
  }
1337
 
1338
+ if (isset($attrs['lists']))
1339
+ $attrs['list'] = $attrs['lists'];
1340
  if (isset($attrs['list'])) {
1341
  $arr = explode(',', $attrs['list']);
1342
  foreach ($arr as $a) {
1375
  }
1376
 
1377
  $lists = '';
1378
+ if (!empty($attrs['lists_field_layout']) && $attrs['lists_field_layout'] == 'dropdown') {
1379
+ for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1380
+ if ($options_profile['list_' . $i . '_status'] != 2) {
1381
+ continue;
1382
+ }
1383
+ $lists .= '<option value="' . $i . '"';
1384
+ if ($options_profile['list_' . $i . '_checked'] == 1) {
1385
+ $lists .= ' selected';
1386
+ }
1387
+ $lists .= '>' . esc_html($options_profile['list_' . $i]) . '</option>';
1388
+ $lists .= "\n";
1389
  }
1390
+ if (!empty($attrs['lists_field_empty_label'])) {
1391
+ $lists = '<option value="">' . $attrs['lists_field_empty_label'] . '</option>' . $lists;
1392
+ }
1393
+ if (!empty($lists)) {
1394
+ $lists = '<select class="tnp-lists" name="nl[]" required>' . $lists . '</select>';
1395
+ }
1396
+ } else {
1397
+ for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1398
+ if ($options_profile['list_' . $i . '_status'] != 2) {
1399
+ continue;
1400
+ }
1401
+ $lists .= '<div class="tnp-field tnp-field-list"><label><input class="tnp-preference" type="checkbox" name="nl[]" value="' . $i . '"';
1402
+ if ($options_profile['list_' . $i . '_checked'] == 1) {
1403
+ $lists .= ' checked';
1404
+ }
1405
+ $lists .= '/>&nbsp;' . esc_html($options_profile['list_' . $i]) . '</label></div>';
1406
  }
 
1407
  }
1408
+
1409
  if (!empty($lists)) {
1410
+ $buffer .= '<div class="tnp-lists">';
1411
+ if (!empty($attrs['lists_field_label'])) {
1412
+ $buffer .= '<label>' . $attrs['lists_field_label'] . '</label>';
1413
+ }
1414
+ $buffer .= $lists . '</div>';
1415
  }
1416
 
1417
  // Extra profile fields
1792
  if (!is_array($attrs)) {
1793
  $attrs = array();
1794
  }
1795
+ $attrs = array_merge(array('class' => '', 'referrer' => 'minimal', 'button' => $options_profile['subscribe'], 'placeholder' => $options_profile['email']), $attrs);
1796
 
1797
  $form = '';
1798
  $form .= '<div class="tnp tnp-subscription-minimal ' . $attrs['class'] . '">';
widget/minimal.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
 
3
  class NewsletterWidgetMinimal extends WP_Widget {
4
 
@@ -97,5 +99,5 @@ class NewsletterWidgetMinimal extends WP_Widget {
97
 
98
  }
99
 
100
- add_action('widgets_init', create_function('', 'return register_widget("NewsletterWidgetMinimal");'));
101
  ?>
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ if (version_compare(phpversion(), '5.3', '<')) return;
4
 
5
  class NewsletterWidgetMinimal extends WP_Widget {
6
 
99
 
100
  }
101
 
102
+ add_action('widgets_init', function() {return register_widget("NewsletterWidgetMinimal");});
103
  ?>
widget/standard.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
  if (!defined('ABSPATH')) exit;
 
3
 
4
  /**
5
  * Newsletter widget version 2.0: it'll replace the old version left for compatibility.
@@ -15,12 +16,22 @@ class NewsletterWidget extends WP_Widget {
15
  $field_wrapper_tag = 'div';
16
  if (!isset($instance['nl']) || !is_array($instance['nl'])) $instance['nl'] = array();
17
 
 
 
 
 
18
  $options_profile = get_option('newsletter_profile');
19
  //$form = NewsletterSubscription::instance()->get_form_javascript();
20
  $form = '';
21
 
22
  $form .= '<div class="tnp tnp-widget">';
23
- $form .= NewsletterSubscription::instance()->get_subscription_form_html5('widget', null, array('list'=> implode(',', $instance['nl'])));
 
 
 
 
 
 
24
  $form .= "</div>\n";
25
 
26
  return $form;
@@ -174,7 +185,7 @@ class NewsletterWidget extends WP_Widget {
174
  if (!is_array($instance)) {
175
  $instance = array();
176
  }
177
- $instance = array_merge(array('title' => '', 'text' => ''), $instance);
178
  $options_profile = get_option('newsletter_profile');
179
  if (!isset($instance['nl']) || !is_array($instance['nl'])) $instance['nl'] = array();
180
  ?>
@@ -189,6 +200,24 @@ class NewsletterWidget extends WP_Widget {
189
  <textarea class="widefat" rows="10" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_html($instance['text']); ?></textarea>
190
  </label>
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  <br><br>
193
  <?php _e('Automatically subscribe to', 'newsletter')?>
194
  <br>
@@ -220,5 +249,5 @@ class NewsletterWidget extends WP_Widget {
220
 
221
  }
222
 
223
- add_action('widgets_init', create_function('', 'return register_widget("NewsletterWidget");'));
224
  ?>
1
  <?php
2
  if (!defined('ABSPATH')) exit;
3
+ if (version_compare(phpversion(), '5.3', '<')) return;
4
 
5
  /**
6
  * Newsletter widget version 2.0: it'll replace the old version left for compatibility.
16
  $field_wrapper_tag = 'div';
17
  if (!isset($instance['nl']) || !is_array($instance['nl'])) $instance['nl'] = array();
18
 
19
+ $instance = array_merge(array('lists_layout' => '',
20
+ 'lists_empty_label' => '',
21
+ 'lists_field_label' => ''), $instance);
22
+
23
  $options_profile = get_option('newsletter_profile');
24
  //$form = NewsletterSubscription::instance()->get_form_javascript();
25
  $form = '';
26
 
27
  $form .= '<div class="tnp tnp-widget">';
28
+ $form .= NewsletterSubscription::instance()->get_subscription_form_html5('widget', null, array(
29
+ 'list'=> implode(',', $instance['nl']),
30
+ 'lists_layout' => $instance['lists_layout'],
31
+ 'lists_empty_label' => $instance['lists_empty_label'],
32
+ 'lists_field_label' => $instance['lists_field_label'],
33
+
34
+ ));
35
  $form .= "</div>\n";
36
 
37
  return $form;
185
  if (!is_array($instance)) {
186
  $instance = array();
187
  }
188
+ $instance = array_merge(array('title' => '', 'text' => '', 'lists_layout'=>'', 'lists_empty_label'=>'', 'lists_field_label'=>''), $instance);
189
  $options_profile = get_option('newsletter_profile');
190
  if (!isset($instance['nl']) || !is_array($instance['nl'])) $instance['nl'] = array();
191
  ?>
200
  <textarea class="widefat" rows="10" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_html($instance['text']); ?></textarea>
201
  </label>
202
 
203
+ <label>
204
+ Show lists as:
205
+ <select name="<?php echo $this->get_field_name('lists_layout'); ?>" id="<?php echo $this->get_field_id('lists_layout'); ?>" style="width: 100%">
206
+ <option value="">Checkboxes</option>
207
+ <option value="dropdown" <?php echo $instance['lists_layout']=='dropdown'?'selected':''?>>Dropdown</option>
208
+ </select>
209
+ </label>
210
+ <br>
211
+ <label for="<?php echo $this->get_field_id('lists_empty_label'); ?>">
212
+ First dropdown entry label:
213
+ <input class="widefat" id="<?php echo $this->get_field_id('lists_empty_label'); ?>" name="<?php echo $this->get_field_name('lists_empty_label'); ?>" type="text" value="<?php echo esc_attr($instance['lists_empty_label']); ?>" />
214
+ </label>
215
+ <br>
216
+ <label for="<?php echo $this->get_field_id('lists_field_label'); ?>">
217
+ Lists field label:
218
+ <input class="widefat" id="<?php echo $this->get_field_id('lists_field_label'); ?>" name="<?php echo $this->get_field_name('lists_field_label'); ?>" type="text" value="<?php echo esc_attr($instance['lists_field_label']); ?>" />
219
+ </label>
220
+
221
  <br><br>
222
  <?php _e('Automatically subscribe to', 'newsletter')?>
223
  <br>
249
 
250
  }
251
 
252
+ add_action('widgets_init', function () {return register_widget("NewsletterWidget");});
253
  ?>