Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms - Version 1.12.1

Version Description

  • Improvement: Better compatibility with 3rd party popups.
  • Bugfix: Form couldn't be added to ACF rich text editor fields.
  • Bugfix: Trashed and deleted forms where showing up in form widget.
Download this release

Release Info

Developer happyforms
Plugin Icon 128x128 Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms
Version 1.12.1
Comparing to
See all releases

Code changes from version 1.12.0 to 1.12.1

core/assets/css/color.css CHANGED
@@ -403,7 +403,8 @@
403
  /* submit button */
404
 
405
  .happyforms-styles input[type=submit].happyforms-button--submit,
406
- .happyforms-styles input[type=submit][disabled].happyforms-button--submit {
 
407
  -webkit-appearance: none;
408
  height: auto;
409
  padding: 15px 30px;
403
  /* submit button */
404
 
405
  .happyforms-styles input[type=submit].happyforms-button--submit,
406
+ .happyforms-styles input[type=submit][disabled].happyforms-button--submit,
407
+ .happyforms-styles input[type=submit]:not(:hover):not(:active):not(.has-background) {
408
  -webkit-appearance: none;
409
  height: auto;
410
  padding: 15px 30px;
core/assets/js/admin/dashboard.js CHANGED
@@ -5,7 +5,7 @@
5
 
6
  happyForms.dashboard = {
7
  init: function() {
8
- $( '.happyforms-editor-button' ).on( 'click', this.onEditorButton.bind( this ) );
9
  $( '.happyforms-dialog__button' ).on( 'click', this.onDialogButton.bind( this ) );
10
  $( '.happyforms-notice:not(.one-time)' ).on( 'click', '.notice-dismiss', this.onNoticeDismiss.bind( this ) );
11
  },
5
 
6
  happyForms.dashboard = {
7
  init: function() {
8
+ $( document ).on( 'click', '.happyforms-editor-button', this.onEditorButton.bind( this ) );
9
  $( '.happyforms-dialog__button' ).on( 'click', this.onDialogButton.bind( this ) );
10
  $( '.happyforms-notice:not(.one-time)' ).on( 'click', '.notice-dismiss', this.onNoticeDismiss.bind( this ) );
11
  },
core/classes/class-form-assets.php CHANGED
@@ -3,6 +3,7 @@
3
  class HappyForms_Form_Assets {
4
 
5
  private static $instance;
 
6
 
7
  const MODE_NONE = 0;
8
  const MODE_ADMIN = 1;
@@ -10,14 +11,26 @@ class HappyForms_Form_Assets {
10
  const MODE_CUSTOMIZER = 4;
11
  const MODE_COMPLETE = 8;
12
 
 
 
13
  public static function instance() {
14
  if ( is_null( self::$instance ) ) {
15
  self::$instance = new self();
16
  }
17
 
 
 
18
  return self::$instance;
19
  }
20
 
 
 
 
 
 
 
 
 
21
  public function output_frontend_styles( $form ) {
22
  happyforms_the_form_styles( $form );
23
  happyforms_additional_css( $form );
@@ -29,7 +42,7 @@ class HappyForms_Form_Assets {
29
  <?php
30
  }
31
 
32
- public function output_frontend_scripts( $form ) {
33
  wp_register_script(
34
  'happyforms-select',
35
  happyforms_get_plugin_url() . 'core/assets/js/lib/happyforms-select.js',
@@ -46,15 +59,13 @@ class HappyForms_Form_Assets {
46
 
47
  $dependencies = apply_filters(
48
  'happyforms_frontend_dependencies',
49
- array( 'jquery', 'jquery-ui-core', 'jquery-ui-tooltip', 'happyforms-settings' ), [ $form ]
50
  );
51
 
52
- wp_register_script(
53
- 'happyforms-frontend',
54
- happyforms_get_plugin_url() . 'inc/assets/js/frontend.js',
55
- $dependencies, HAPPYFORMS_VERSION, true
56
- );
57
 
 
58
  if ( wp_doing_ajax() ) {
59
  global $wp_scripts;
60
 
@@ -62,6 +73,14 @@ class HappyForms_Form_Assets {
62
  return '';
63
  }, 10, 3 );
64
 
 
 
 
 
 
 
 
 
65
  wp_scripts()->all_deps( 'happyforms-frontend' );
66
 
67
  $queue = array();
@@ -114,13 +133,11 @@ class HappyForms_Form_Assets {
114
  enqueueNextScript();
115
  </script>
116
  <?php
 
 
117
  } else {
118
- wp_scripts()->print_scripts( 'happyforms-frontend' );
119
  }
120
-
121
- wp_deregister_script( 'happyforms-frontend' );
122
-
123
- do_action( 'happyforms_print_scripts', [ $form ] );
124
  }
125
 
126
  public function output( $form, $mode = self::MODE_COMPLETE ) {
@@ -162,12 +179,36 @@ class HappyForms_Form_Assets {
162
  $dependencies, HAPPYFORMS_VERSION
163
  );
164
 
165
- wp_styles()->do_items( 'happyforms-layout' );
166
 
167
- wp_deregister_style( 'happyforms-layout' );
 
 
 
 
 
 
 
168
 
169
  do_action( 'happyforms_print_frontend_styles', $form );
170
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
172
 
173
  if ( ! function_exists( 'happyforms_get_form_assets' ) ):
3
  class HappyForms_Form_Assets {
4
 
5
  private static $instance;
6
+ private static $hooked = false;
7
 
8
  const MODE_NONE = 0;
9
  const MODE_ADMIN = 1;
11
  const MODE_CUSTOMIZER = 4;
12
  const MODE_COMPLETE = 8;
13
 
14
+ private $forms = array();
15
+
16
  public static function instance() {
17
  if ( is_null( self::$instance ) ) {
18
  self::$instance = new self();
19
  }
20
 
21
+ self::$instance->hook();
22
+
23
  return self::$instance;
24
  }
25
 
26
+ public function hook() {
27
+ if ( self::$hooked ) {
28
+ return;
29
+ }
30
+
31
+ add_action( 'wp_print_footer_scripts', array( $this, 'wp_print_footer_scripts' ), 0 );
32
+ }
33
+
34
  public function output_frontend_styles( $form ) {
35
  happyforms_the_form_styles( $form );
36
  happyforms_additional_css( $form );
42
  <?php
43
  }
44
 
45
+ private function get_frontend_script_dependencies( $forms ) {
46
  wp_register_script(
47
  'happyforms-select',
48
  happyforms_get_plugin_url() . 'core/assets/js/lib/happyforms-select.js',
59
 
60
  $dependencies = apply_filters(
61
  'happyforms_frontend_dependencies',
62
+ array( 'jquery', 'jquery-ui-core', 'jquery-ui-tooltip', 'happyforms-settings' ), $forms
63
  );
64
 
65
+ return $dependencies;
66
+ }
 
 
 
67
 
68
+ public function output_frontend_scripts( $form ) {
69
  if ( wp_doing_ajax() ) {
70
  global $wp_scripts;
71
 
73
  return '';
74
  }, 10, 3 );
75
 
76
+ $dependencies = $this->get_frontend_script_dependencies( [ $form ] );
77
+
78
+ wp_register_script(
79
+ 'happyforms-frontend',
80
+ happyforms_get_plugin_url() . 'inc/assets/js/frontend.js',
81
+ $dependencies, HAPPYFORMS_VERSION, true
82
+ );
83
+
84
  wp_scripts()->all_deps( 'happyforms-frontend' );
85
 
86
  $queue = array();
133
  enqueueNextScript();
134
  </script>
135
  <?php
136
+
137
+ do_action( 'happyforms_print_scripts', [ $form ] );
138
  } else {
139
+ $this->forms[] = $form;
140
  }
 
 
 
 
141
  }
142
 
143
  public function output( $form, $mode = self::MODE_COMPLETE ) {
179
  $dependencies, HAPPYFORMS_VERSION
180
  );
181
 
182
+ $dependencies[] = 'happyforms-layout';
183
 
184
+ global $wp_styles;
185
+
186
+ foreach( $dependencies as $dependency ) {
187
+ if ( isset( $wp_styles->registered[$dependency] ) ) {
188
+ $stylesheet_url = $wp_styles->registered[$dependency]->src;
189
+ ?><link rel="stylesheet" property="stylesheet" href="<?php echo $stylesheet_url; ?>" /><?php
190
+ }
191
+ }
192
 
193
  do_action( 'happyforms_print_frontend_styles', $form );
194
  }
195
+
196
+ public function wp_print_footer_scripts() {
197
+ if ( empty( $this->forms ) ) {
198
+ return;
199
+ }
200
+
201
+ $dependencies = $this->get_frontend_script_dependencies( $this->forms );
202
+
203
+ wp_enqueue_script(
204
+ 'happyforms-frontend',
205
+ happyforms_get_plugin_url() . 'inc/assets/js/frontend.js',
206
+ $dependencies, HAPPYFORMS_VERSION, true
207
+ );
208
+
209
+ do_action( 'happyforms_print_scripts', $this->forms );
210
+ }
211
+
212
  }
213
 
214
  if ( ! function_exists( 'happyforms_get_form_assets' ) ):
core/classes/class-form-controller.php CHANGED
@@ -788,6 +788,11 @@ class HappyForms_Form_Controller {
788
  return $html;
789
  }
790
 
 
 
 
 
 
791
  ob_start();
792
 
793
  happyforms_get_form_assets()->output( $form, $asset_mode );
788
  return $html;
789
  }
790
 
791
+ // Prevent rendering in preview screen from 3rd party plugins.
792
+ if ( happyforms_is_preview() && doing_action() ) {
793
+ return $html;
794
+ }
795
+
796
  ob_start();
797
 
798
  happyforms_get_form_assets()->output( $form, $asset_mode );
core/classes/class-happyforms-widget.php CHANGED
@@ -84,6 +84,7 @@ class HappyForms_Widget extends WP_Widget {
84
  <select class="widefat" id="<?php echo $this->get_field_id( 'form_id' ); ?>" name="<?php echo $this->get_field_name( 'form_id' ); ?>">
85
  <?php
86
  $forms = happyforms_get_form_controller()->get();
 
87
 
88
  foreach ( $forms as $form ) {
89
  echo '<option value="'. $form['ID'] .'" '. selected( (int) $instance['form_id'] === (int) $form['ID'] ) .'">'. $form['post_title'] .'</option>';
84
  <select class="widefat" id="<?php echo $this->get_field_id( 'form_id' ); ?>" name="<?php echo $this->get_field_name( 'form_id' ); ?>">
85
  <?php
86
  $forms = happyforms_get_form_controller()->get();
87
+ $forms = array_values( wp_list_filter( $forms, array( 'post_status' => 'publish' ) ) );
88
 
89
  foreach ( $forms as $form ) {
90
  echo '<option value="'. $form['ID'] .'" '. selected( (int) $instance['form_id'] === (int) $form['ID'] ) .'">'. $form['post_title'] .'</option>';
happyforms.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin URI: https://happyforms.io
6
  * Description: We're changin' WordPress forms.
7
  * Author: Happyforms
8
- * Version: 1.12.0
9
  * Author URI: https://happyforms.io
10
  * Upgrade URI: https://happyforms.io/upgrade
11
  */
@@ -13,7 +13,7 @@
13
  /**
14
  * The current version of the plugin.
15
  */
16
- define( 'HAPPYFORMS_VERSION', '1.12.0' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
5
  * Plugin URI: https://happyforms.io
6
  * Description: We're changin' WordPress forms.
7
  * Author: Happyforms
8
+ * Version: 1.12.1
9
  * Author URI: https://happyforms.io
10
  * Upgrade URI: https://happyforms.io/upgrade
11
  */
13
  /**
14
  * The current version of the plugin.
15
  */
16
+ define( 'HAPPYFORMS_VERSION', '1.12.1' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
languages/happyforms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Happyforms (free) package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Happyforms (free) 1.12.0\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
- "POT-Creation-Date: 2021-03-09 08:46:14+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
2
  # This file is distributed under the same license as the Happyforms (free) package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Happyforms (free) 1.12.1\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
+ "POT-Creation-Date: 2021-03-20 06:04:17+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: contact form, contact form plugin, forms, form builder, custom form, intak
5
  Requires at least: 4.8
6
  Tested up to: 5.7
7
  Requires PHP: 5.3
8
- Stable tag: 1.12.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -144,6 +144,11 @@ Note: you'll need to upgrade to our paid contact form builder plugin to get some
144
 
145
  == Changelog ==
146
 
 
 
 
 
 
147
  = 1.12.0 =
148
  * Improvement: Removed jQuery deprecations.
149
 
@@ -763,6 +768,9 @@ Note: you'll need to upgrade to our paid contact form builder plugin to get some
763
 
764
  == Upgrade Notice ==
765
 
 
 
 
766
  = 1.12.0 =
767
  * jQuery deprecation updates.
768
 
5
  Requires at least: 4.8
6
  Tested up to: 5.7
7
  Requires PHP: 5.3
8
+ Stable tag: 1.12.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
144
 
145
  == Changelog ==
146
 
147
+ = 1.12.1 =
148
+ * Improvement: Better compatibility with 3rd party popups.
149
+ * Bugfix: Form couldn't be added to ACF rich text editor fields.
150
+ * Bugfix: Trashed and deleted forms where showing up in form widget.
151
+
152
  = 1.12.0 =
153
  * Improvement: Removed jQuery deprecations.
154
 
768
 
769
  == Upgrade Notice ==
770
 
771
+ = 1.12.1 =
772
+ * Minor improvements and bugfixes.
773
+
774
  = 1.12.0 =
775
  * jQuery deprecation updates.
776