Official MailerLite Sign Up Forms - Version 1.3.5

Version Description

  • Tweak - Better support for older PHP versions in main plugin file
Download this release

Release Info

Developer mailerlite
Plugin Icon 128x128 Official MailerLite Sign Up Forms
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.5

include/mailerlite-form.php CHANGED
@@ -85,7 +85,7 @@ class MailerLite_Form {
85
  ];
86
 
87
  foreach ( $form->data['lists'] as $list ) {
88
- $ML_Subscribers->setId( $list )->add( $subscriber, 1 );
89
  }
90
 
91
  echo json_encode(
85
  ];
86
 
87
  foreach ( $form->data['lists'] as $list ) {
88
+ $ML_Subscribers->setGroupId( $list )->add( $subscriber, 1 );
89
  }
90
 
91
  echo json_encode(
libs/mailerlite_rest/ML_Subscribers.php CHANGED
@@ -6,6 +6,9 @@ require_once dirname( __FILE__ ) . '/base/ML_Rest.php';
6
  * Class ML_Subscribers
7
  */
8
  class ML_Subscribers extends ML_Rest {
 
 
 
9
  /**
10
  * ML_Subscribers constructor.
11
  *
@@ -34,7 +37,7 @@ class ML_Subscribers extends ML_Rest {
34
  }
35
 
36
  function get( $email = null, $history = 0 ) {
37
- $this->setId( null );
38
 
39
  $this->path .= '?email=' . urlencode( $email );
40
 
@@ -56,4 +59,16 @@ class ML_Subscribers extends ML_Rest {
56
 
57
  return $this->execute( 'POST' );
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
6
  * Class ML_Subscribers
7
  */
8
  class ML_Subscribers extends ML_Rest {
9
+ /** @var int|null */
10
+ var $groupId = null;
11
+
12
  /**
13
  * ML_Subscribers constructor.
14
  *
37
  }
38
 
39
  function get( $email = null, $history = 0 ) {
40
+ $this->setGroupId( null );
41
 
42
  $this->path .= '?email=' . urlencode( $email );
43
 
59
 
60
  return $this->execute( 'POST' );
61
  }
62
+
63
+ function setGroupId( $groupId ) {
64
+ $this->groupId = $groupId;
65
+
66
+ if ( $this->groupId ) {
67
+ $this->path = $this->url . 'groups' . '/' . $groupId . '/subscribers';
68
+ } else {
69
+ $this->path = $this->url . $this->endpoint . '/';
70
+ }
71
+
72
+ return $this;
73
+ }
74
  }
libs/mailerlite_rest/base/ML_Rest.php CHANGED
@@ -9,9 +9,6 @@ class ML_Rest extends ML_Rest_Base {
9
  /** @var string */
10
  var $endpoint = '';
11
 
12
- /** @var int|null */
13
- var $id = null;
14
-
15
  /**
16
  * ML_Rest constructor.
17
  *
@@ -25,18 +22,6 @@ class ML_Rest extends ML_Rest_Base {
25
  $this->path = $this->url . $this->endpoint . '/';
26
  }
27
 
28
- function setId( $id ) {
29
- $this->id = $id;
30
-
31
- if ( $this->id ) {
32
- $this->path = $this->url . $this->endpoint . '/' . $id . '/';
33
- } else {
34
- $this->path = $this->url . $this->endpoint . '/';
35
- }
36
-
37
- return $this;
38
- }
39
-
40
  function getAll() {
41
  return $this->execute( 'GET' );
42
  }
9
  /** @var string */
10
  var $endpoint = '';
11
 
 
 
 
12
  /**
13
  * ML_Rest constructor.
14
  *
22
  $this->path = $this->url . $this->endpoint . '/';
23
  }
24
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  function getAll() {
26
  return $this->execute( 'GET' );
27
  }
mailerlite.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Plugin Name: Official MailerLite Sign Up Forms
5
  * Description: Official MailerLite Sign Up Forms plugin for WordPress. Ability to embed MailerLite webforms and create custom ones just with few clicks.
6
- * Version: 1.3.3
7
  * Author: MailerGroup
8
  * Author URI: https://www.mailerlite.com
9
  * License: GPLv2 or later
@@ -29,7 +29,7 @@
29
  define( 'MAILERLITE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
30
  define( 'MAILERLITE_PLUGIN_URL', plugins_url( '', __FILE__ ) );
31
 
32
- define( 'MAILERLITE_VERSION', '1.3.3' );
33
 
34
  define( 'MAILERLITE_PHP_VERSION', '5.6.0' );
35
  define( 'MAILERLITE_WP_VERSION', '3.0.1' );
@@ -62,7 +62,7 @@ function mailerlite_install() {
62
 
63
  if ( $message ) {
64
  deactivate_plugins( basename( __FILE__ ) );
65
- wp_die( $message, 'Plugin Activation Error', [ 'response' => 200, 'back_link' => true ] );
66
  }
67
 
68
  $table_name = $wpdb->base_prefix . "mailerlite_forms";
@@ -98,7 +98,7 @@ register_activation_hook( __FILE__, 'mailerlite_install' );
98
  function register_mailerlite_styles() {
99
  wp_register_style(
100
  'mailerlite_forms.css',
101
- MAILERLITE_PLUGIN_URL . '/assets/css/mailerlite_forms.css', [],
102
  MAILERLITE_VERSION
103
  );
104
  wp_enqueue_style( 'mailerlite_forms.css' );
@@ -108,7 +108,7 @@ add_action( 'wp_enqueue_scripts', 'register_mailerlite_styles' );
108
 
109
  if ( is_admin() ) {
110
  require_once( MAILERLITE_PLUGIN_DIR . 'include/mailerlite-admin.php' );
111
- add_action( 'init', [ 'MailerLite_Admin', 'init' ] );
112
  }
113
 
114
 
@@ -116,6 +116,6 @@ require_once( MAILERLITE_PLUGIN_DIR . 'include/mailerlite-widget.php' );
116
  require_once( MAILERLITE_PLUGIN_DIR . 'include/mailerlite-shortcode.php' );
117
  require_once( MAILERLITE_PLUGIN_DIR . 'include/mailerlite-gutenberg.php' );
118
 
119
- add_action( 'init', [ 'MailerLite_Shortcode', 'init' ] );
120
- add_action( 'init', [ 'MailerLite_Form', 'init' ] );
121
- add_action( 'init', [ 'MailerLite_Gutenberg', 'init' ] );
3
  /**
4
  * Plugin Name: Official MailerLite Sign Up Forms
5
  * Description: Official MailerLite Sign Up Forms plugin for WordPress. Ability to embed MailerLite webforms and create custom ones just with few clicks.
6
+ * Version: 1.3.5
7
  * Author: MailerGroup
8
  * Author URI: https://www.mailerlite.com
9
  * License: GPLv2 or later
29
  define( 'MAILERLITE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
30
  define( 'MAILERLITE_PLUGIN_URL', plugins_url( '', __FILE__ ) );
31
 
32
+ define( 'MAILERLITE_VERSION', '1.3.5' );
33
 
34
  define( 'MAILERLITE_PHP_VERSION', '5.6.0' );
35
  define( 'MAILERLITE_WP_VERSION', '3.0.1' );
62
 
63
  if ( $message ) {
64
  deactivate_plugins( basename( __FILE__ ) );
65
+ wp_die( $message, 'Plugin Activation Error', array( 'response' => 200, 'back_link' => true ) );
66
  }
67
 
68
  $table_name = $wpdb->base_prefix . "mailerlite_forms";
98
  function register_mailerlite_styles() {
99
  wp_register_style(
100
  'mailerlite_forms.css',
101
+ MAILERLITE_PLUGIN_URL . '/assets/css/mailerlite_forms.css', array(),
102
  MAILERLITE_VERSION
103
  );
104
  wp_enqueue_style( 'mailerlite_forms.css' );
108
 
109
  if ( is_admin() ) {
110
  require_once( MAILERLITE_PLUGIN_DIR . 'include/mailerlite-admin.php' );
111
+ add_action( 'init', array( 'MailerLite_Admin', 'init' ) );
112
  }
113
 
114
 
116
  require_once( MAILERLITE_PLUGIN_DIR . 'include/mailerlite-shortcode.php' );
117
  require_once( MAILERLITE_PLUGIN_DIR . 'include/mailerlite-gutenberg.php' );
118
 
119
+ add_action( 'init', array( 'MailerLite_Shortcode', 'init' ) );
120
+ add_action( 'init', array( 'MailerLite_Form', 'init' ) );
121
+ add_action( 'init', array( 'MailerLite_Gutenberg', 'init' ) );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: mailerlite, newsletter, subscribe, form, webform
5
  Requires at least: 3.0.1
6
  Tested up to: 5.0.2
7
  Requires PHP: 5.6.0
8
- Stable tag: 1.3.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -130,6 +130,12 @@ Add your custom CSS rules to the end of your theme stylesheet, /wp-content/theme
130
 
131
  == Changelog ==
132
 
 
 
 
 
 
 
133
  = 1.3.3 =
134
  * Fix - Form edit redirect not working
135
 
5
  Requires at least: 3.0.1
6
  Tested up to: 5.0.2
7
  Requires PHP: 5.6.0
8
+ Stable tag: 1.3.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.3.5 =
134
+ * Tweak - Better support for older PHP versions in main plugin file
135
+
136
+ = 1.3.4 =
137
+ * Fix - Subscriber adding bug
138
+
139
  = 1.3.3 =
140
  * Fix - Form edit redirect not working
141