Official MailerLite Sign Up Forms - Version 1.4.9

Version Description

  • Forms are embedded with the new method
  • 1k limit to webforms API request
Download this release

Release Info

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

Code changes from version 1.4.8 to 1.4.9

assets/js/iframe.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ function mlResizeIframe(iframe) {
2
+ setTimeout(function() {
3
+ iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
4
+ }, 1000);
5
+ }
include/mailerlite-admin.php CHANGED
@@ -203,7 +203,10 @@ class MailerLite_Admin {
203
  }
204
 
205
  $ML_Webforms = new MailerLite_Forms_Webforms( $api_key );
206
- $webforms = $ML_Webforms->getAllJson();
 
 
 
207
 
208
  if ( ! empty( $webforms->error ) && ! empty( $webforms->error->message ) ) {
209
  $mailerlite_error = '<u>' . __( 'Error happened', 'mailerlite' ) . '</u>: ' . $webforms->error->message;
@@ -371,7 +374,10 @@ class MailerLite_Admin {
371
  include( MAILERLITE_PLUGIN_DIR . 'include/templates/admin/edit_custom.php' );
372
  } elseif ( $form->type == MailerLite_Form::TYPE_EMBEDDED ) {
373
  $ML_Webforms = new MailerLite_Forms_Webforms( $api_key );
374
- $webforms = $ML_Webforms->getAllJson();
 
 
 
375
 
376
  if ( ! empty( $webforms->error ) && ! empty( $webforms->error->message ) ) {
377
  $mailerlite_error = '<u>' . __( 'Error happened',
203
  }
204
 
205
  $ML_Webforms = new MailerLite_Forms_Webforms( $api_key );
206
+ $webforms = $ML_Webforms->getAllJson([
207
+ 'limit' => 1000,
208
+ 'type' => 'embedded'
209
+ ]);
210
 
211
  if ( ! empty( $webforms->error ) && ! empty( $webforms->error->message ) ) {
212
  $mailerlite_error = '<u>' . __( 'Error happened', 'mailerlite' ) . '</u>: ' . $webforms->error->message;
374
  include( MAILERLITE_PLUGIN_DIR . 'include/templates/admin/edit_custom.php' );
375
  } elseif ( $form->type == MailerLite_Form::TYPE_EMBEDDED ) {
376
  $ML_Webforms = new MailerLite_Forms_Webforms( $api_key );
377
+ $webforms = $ML_Webforms->getAllJson([
378
+ 'limit' => 1000,
379
+ 'type' => 'embedded'
380
+ ]);
381
 
382
  if ( ! empty( $webforms->error ) && ! empty( $webforms->error->message ) ) {
383
  $mailerlite_error = '<u>' . __( 'Error happened',
include/mailerlite-gutenberg.php CHANGED
@@ -56,6 +56,8 @@ class MailerLite_Gutenberg {
56
  wp_localize_script('mailerlite-form-block', 'mailerlite_vars', [
57
  'ml_nonce' => wp_create_nonce('mailerlite_gutenberg'),
58
  ]);
 
 
59
  }
60
 
61
  /**
@@ -102,6 +104,8 @@ class MailerLite_Gutenberg {
102
  */
103
  public function form_preview_iframe() {
104
  global $wpdb;
 
 
105
 
106
  check_admin_referer( 'mailerlite_gutenberg', 'ml_nonce' );
107
 
56
  wp_localize_script('mailerlite-form-block', 'mailerlite_vars', [
57
  'ml_nonce' => wp_create_nonce('mailerlite_gutenberg'),
58
  ]);
59
+
60
+ wp_enqueue_script( 'mailerlite-form-iframe', MAILERLITE_PLUGIN_URL . '/assets/js/iframe.js');
61
  }
62
 
63
  /**
104
  */
105
  public function form_preview_iframe() {
106
  global $wpdb;
107
+ error_log('test');
108
+
109
 
110
  check_admin_referer( 'mailerlite_gutenberg', 'ml_nonce' );
111
 
include/templates/forms/embedded_form.php CHANGED
@@ -1 +1,11 @@
1
- <script type="text/javascript" src="https://static.mailerlite.com/data/webforms/<?php echo $form_data['id']; ?>/<?php echo $form_data['code']; ?>.js?v=<?php echo time(); ?>"></script>
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (get_option('account_id') && get_option('account_subdomain')) { ?>
2
+
3
+ <div class="ml-form-embed"
4
+ data-account="<?php echo get_option('account_id') . ':' . get_option('account_subdomain'); ?>"
5
+ data-form="<?php echo $form_data['id'] . ':' . $form_data['code']; ?>">
6
+ </div>
7
+
8
+ <?php } else { ?>
9
+
10
+ <script type="text/javascript" src="https://static.mailerlite.com/data/webforms/<?php echo $form_data['id']; ?>/<?php echo $form_data['code']; ?>.js?v=<?php echo time(); ?>"></script>
11
+ <?php } ?>
include/templates/forms/iframe.php CHANGED
@@ -1,5 +1,5 @@
1
  <div style='position: relative;'>
2
  <div style='position: absolute;top:0;left:0;width:100%;height:100%;'></div>
3
  <iframe style='z-index:1;' src='<?php echo $url ?>'
4
- onload="this.style.height = this.contentWindow.document.body.scrollHeight + 'px'"></iframe>
5
- </div>
1
  <div style='position: relative;'>
2
  <div style='position: absolute;top:0;left:0;width:100%;height:100%;'></div>
3
  <iframe style='z-index:1;' src='<?php echo $url ?>'
4
+ onload="mlResizeIframe(this)"></iframe>
5
+ </div>
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.4.8
7
  * Author: MailerGroup
8
  * Author URI: https://www.mailerlite.com
9
  * License: GPLv2 or later
@@ -29,9 +29,9 @@
29
  define( 'MAILERLITE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
30
  define( 'MAILERLITE_PLUGIN_URL', plugins_url( '', __FILE__ ) );
31
 
32
- define( 'MAILERLITE_VERSION', '1.4.8' );
33
 
34
- define( 'MAILERLITE_PHP_VERSION', '5.6.0' );
35
  define( 'MAILERLITE_WP_VERSION', '3.0.1' );
36
 
37
  function mailerlite_load_plugin_textdomain() {
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.4.9
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.4.9' );
33
 
34
+ define( 'MAILERLITE_PHP_VERSION', '7.2.5' );
35
  define( 'MAILERLITE_WP_VERSION', '3.0.1' );
36
 
37
  function mailerlite_load_plugin_textdomain() {
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: mailerlite
3
  Donate link: https://www.mailerlite.com/
4
  Tags: mailerlite, newsletter, subscribe, form, webform
5
  Requires at least: 3.0.1
6
- Tested up to: 5.5.3
7
- Requires PHP: 5.6.0
8
- Stable tag: 1.4.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -130,6 +130,10 @@ Add your custom CSS rules to the end of your theme stylesheet, /wp-content/theme
130
 
131
  == Changelog ==
132
 
 
 
 
 
133
  = 1.4.8 =
134
  * Fix - Gutenberg add / edit form fix
135
 
3
  Donate link: https://www.mailerlite.com/
4
  Tags: mailerlite, newsletter, subscribe, form, webform
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.7
7
+ Requires PHP: 7.2.5
8
+ Stable tag: 1.4.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
130
 
131
  == Changelog ==
132
 
133
+ = 1.4.9 =
134
+ * Forms are embedded with the new method
135
+ * 1k limit to webforms API request
136
+
137
  = 1.4.8 =
138
  * Fix - Gutenberg add / edit form fix
139
 
webpack.config.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const externals = {
2
+ lodash: 'lodash',
3
+ };
4
+
5
+ module.exports = {
6
+ // Entry.
7
+ entry: "./assets/js/block.js", // Import all JavaScript dependencies in this file.
8
+
9
+ // Output.
10
+ output: {
11
+ path: __dirname + '/assets/js/', // Path to produce the output. Set to the current directory.
12
+ filename: "block.build.js" // Filename of the file that webpack builds.
13
+ },
14
+
15
+ externals,
16
+
17
+ // Loaders.
18
+ // The configuration below has defined a rules property for a single module with
19
+ // two required properties: test and use. This tells webpack's compiler the following:
20
+ // "Hey webpack compiler, when you come across a '.js' or '.jsx' file inside of a
21
+ // require()/import statement, use the babel-loader to transform it before you add
22
+ // it to the bundle."
23
+ module: {
24
+ rules: [
25
+ {
26
+ test: /\.jsx?$/,
27
+ exclude: /node_modules/,
28
+ loader: 'babel-loader',
29
+ },
30
+ ]
31
+ }
32
+ };