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

Version Description

  • Improvement: Form assets now get loaded only on pages containing forms.
  • Improvement: Forms now work when displayed inside the Dashboard.
Download this release

Release Info

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

Code changes from version 1.5.3 to 1.5.4

happyforms.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin URI: https://happyforms.me
6
  * Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
7
  * Author: The Theme Foundry
8
- * Version: 1.5.3
9
  * Author URI: https://thethemefoundry.com
10
  * Upgrade URI: https://thethemefoundry.com
11
  */
@@ -13,7 +13,7 @@
13
  /**
14
  * The current version of the plugin.
15
  */
16
- define( 'HAPPYFORMS_VERSION', '1.5.3' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
5
  * Plugin URI: https://happyforms.me
6
  * Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
7
  * Author: The Theme Foundry
8
+ * Version: 1.5.4
9
  * Author URI: https://thethemefoundry.com
10
  * Upgrade URI: https://thethemefoundry.com
11
  */
13
  /**
14
  * The current version of the plugin.
15
  */
16
+ define( 'HAPPYFORMS_VERSION', '1.5.4' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
inc/classes/class-happyforms-plugin.php CHANGED
@@ -39,6 +39,11 @@ class HappyForms_Plugin {
39
  */
40
  private $current_forms = array();
41
 
 
 
 
 
 
42
  /**
43
  * Action: initialize admin and frontend logic.
44
  *
@@ -79,10 +84,12 @@ class HappyForms_Plugin {
79
  // Common hooks
80
  add_shortcode( $this->shortcode, array( $this, 'handle_shortcode' ) );
81
  add_action( 'wp_head', array( $this, 'wp_head' ) );
82
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
83
  add_action( 'wp_print_footer_scripts', array( $this, 'wp_print_footer_scripts' ), 0 );
 
84
 
85
- // Preview scripts
 
86
  add_action( 'wp_footer', array( $this, 'enqueue_scripts_preview' ) );
87
  }
88
 
@@ -336,28 +343,17 @@ class HappyForms_Plugin {
336
  $form_id = intval( $attrs['id'] );
337
  $form_controller = happyforms_get_form_controller();
338
  $form = $form_controller->get( $form_id );
 
 
 
 
 
339
  $output = $form_controller->render( $form, true );
340
  $this->enqueue_form( $form );
341
 
342
  return $output;
343
  }
344
 
345
- public function enqueue_styles() {
346
- wp_enqueue_style(
347
- 'happyforms-frontend',
348
- happyforms_get_plugin_url() . 'assets/css/frontend.css',
349
- array(), HAPPYFORMS_VERSION
350
- );
351
-
352
- if ( happyforms_is_preview() ) {
353
- wp_enqueue_style(
354
- 'happyforms-preview',
355
- happyforms_get_plugin_url() . 'assets/css/preview.css',
356
- array(), HAPPYFORMS_VERSION
357
- );
358
- }
359
- }
360
-
361
  /**
362
  * Action: output scripts and styles for the forms
363
  * embedded into the current post.
@@ -419,6 +415,17 @@ class HappyForms_Plugin {
419
  require_once( happyforms_get_include_folder() . '/templates/admin-form-modal.php' );
420
  }
421
 
 
 
 
 
 
 
 
 
 
 
 
422
  /**
423
  * Action: enqueue scripts and styles
424
  * for the frontend part of the plugin.
@@ -465,6 +472,18 @@ class HappyForms_Plugin {
465
  do_action( 'happyforms_footer', $this->current_forms );
466
  }
467
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  /**
469
  * Action: enqueue HappyForms styles and scripts
470
  * for the Customizer preview part.
39
  */
40
  private $current_forms = array();
41
 
42
+ /**
43
+ * Whether or not frontend styles were loaded.
44
+ */
45
+ private $frontend_styles = false;
46
+
47
  /**
48
  * Action: initialize admin and frontend logic.
49
  *
84
  // Common hooks
85
  add_shortcode( $this->shortcode, array( $this, 'handle_shortcode' ) );
86
  add_action( 'wp_head', array( $this, 'wp_head' ) );
87
+ add_action( 'admin_head', array( $this, 'wp_head' ) );
88
  add_action( 'wp_print_footer_scripts', array( $this, 'wp_print_footer_scripts' ), 0 );
89
+ add_action( 'admin_print_footer_scripts', array( $this, 'wp_print_footer_scripts' ), 0 );
90
 
91
+ // Preview scripts and styles
92
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_preview' ) );
93
  add_action( 'wp_footer', array( $this, 'enqueue_scripts_preview' ) );
94
  }
95
 
343
  $form_id = intval( $attrs['id'] );
344
  $form_controller = happyforms_get_form_controller();
345
  $form = $form_controller->get( $form_id );
346
+
347
+ if ( empty( $form ) ) {
348
+ return '';
349
+ }
350
+
351
  $output = $form_controller->render( $form, true );
352
  $this->enqueue_form( $form );
353
 
354
  return $output;
355
  }
356
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  /**
358
  * Action: output scripts and styles for the forms
359
  * embedded into the current post.
415
  require_once( happyforms_get_include_folder() . '/templates/admin-form-modal.php' );
416
  }
417
 
418
+ public function print_frontend_styles() {
419
+ if ( false !== $this->frontend_styles ) {
420
+ return;
421
+ }
422
+
423
+ $url = happyforms_get_plugin_url() . 'assets/css/frontend.css?' . HAPPYFORMS_VERSION;
424
+ ?>
425
+ <link rel="stylesheet" property="stylesheet" href="<?php echo $url; ?>" />
426
+ <?php
427
+ }
428
+
429
  /**
430
  * Action: enqueue scripts and styles
431
  * for the frontend part of the plugin.
472
  do_action( 'happyforms_footer', $this->current_forms );
473
  }
474
 
475
+ public function enqueue_styles_preview() {
476
+ if ( ! happyforms_is_preview() ) {
477
+ return;
478
+ }
479
+
480
+ wp_enqueue_style(
481
+ 'happyforms-preview',
482
+ happyforms_get_plugin_url() . 'assets/css/preview.css',
483
+ array(), HAPPYFORMS_VERSION
484
+ );
485
+ }
486
+
487
  /**
488
  * Action: enqueue HappyForms styles and scripts
489
  * for the Customizer preview part.
inc/classes/class-message-controller.php CHANGED
@@ -113,6 +113,7 @@ class HappyForms_Message_Controller {
113
  public function hook() {
114
  add_action( 'init', array( $this, 'register_post_type' ) );
115
  add_action( 'parse_request', array( $this, 'admin_post' ) );
 
116
  add_action( 'delete_post', array( $this, 'delete_post' ) );
117
  }
118
 
113
  public function hook() {
114
  add_action( 'init', array( $this, 'register_post_type' ) );
115
  add_action( 'parse_request', array( $this, 'admin_post' ) );
116
+ add_action( 'admin_init', array( $this, 'admin_post' ) );
117
  add_action( 'delete_post', array( $this, 'delete_post' ) );
118
  }
119
 
inc/helpers/helper-form-templates.php CHANGED
@@ -548,7 +548,9 @@ if ( ! function_exists( 'happyforms_the_form_styles' ) ):
548
  * @return array
549
  */
550
  function happyforms_the_form_styles( $form ) {
551
- $styles = happyforms_get_form_styles( $form ); ?>
 
 
552
  <!-- HappyForms CSS variables -->
553
  <style>
554
  #happyforms-form-<?php echo esc_attr( $form['ID'] ); ?> {
548
  * @return array
549
  */
550
  function happyforms_the_form_styles( $form ) {
551
+ HappyForms()->print_frontend_styles();
552
+ $styles = happyforms_get_form_styles( $form );
553
+ ?>
554
  <!-- HappyForms CSS variables -->
555
  <style>
556
  #happyforms-form-<?php echo esc_attr( $form['ID'] ); ?> {
inc/templates/preview-form-edit.php CHANGED
@@ -12,7 +12,7 @@
12
 
13
  <?php global $post; $form = happyforms_get_form_controller()->get( $post->ID ); ?>
14
  <?php happyforms_the_form_styles( $form ); ?>
15
- <?php require_once( happyforms_get_include_folder() . '/templates/single-form.php' ); ?>
16
 
17
  <?php wp_footer(); ?>
18
  </body>
12
 
13
  <?php global $post; $form = happyforms_get_form_controller()->get( $post->ID ); ?>
14
  <?php happyforms_the_form_styles( $form ); ?>
15
+ <?php include( happyforms_get_include_folder() . '/templates/single-form.php' ); ?>
16
 
17
  <?php wp_footer(); ?>
18
  </body>
languages/happyforms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: HappyForms 1.5.3\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
- "POT-Creation-Date: 2018-07-19 07:45:42+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -126,8 +126,8 @@ msgstr ""
126
 
127
  #: inc/classes/class-form-controller.php:74
128
  #: inc/classes/class-form-controller.php:84
129
- #: inc/classes/class-happyforms-plugin.php:144
130
- #: inc/classes/class-happyforms-plugin.php:145
131
  msgid "All Forms"
132
  msgstr ""
133
 
@@ -186,7 +186,7 @@ msgid "Submit Form"
186
  msgstr ""
187
 
188
  #: inc/classes/class-form-controller.php:748
189
- #: inc/classes/class-message-controller.php:236
190
  msgid "Your submission contains errors."
191
  msgstr ""
192
 
@@ -574,7 +574,7 @@ msgstr ""
574
  msgid "Disable transitions on submit button"
575
  msgstr ""
576
 
577
- #: inc/classes/class-happyforms-plugin.php:133
578
  msgid "HappyForms Index"
579
  msgstr ""
580
 
@@ -582,30 +582,30 @@ msgstr ""
582
  msgid "HappyForms"
583
  msgstr ""
584
 
585
- #: inc/classes/class-happyforms-plugin.php:152
586
- #: inc/classes/class-happyforms-plugin.php:153
587
  msgid "Add New"
588
  msgstr ""
589
 
590
- #: inc/classes/class-happyforms-plugin.php:161
591
- #: inc/classes/class-happyforms-plugin.php:162
592
  msgid "Responses"
593
  msgstr ""
594
 
595
- #: inc/classes/class-happyforms-plugin.php:173
596
- #: inc/classes/class-happyforms-plugin.php:174
597
  msgid "Welcome"
598
  msgstr ""
599
 
600
- #: inc/classes/class-happyforms-plugin.php:270
601
  msgid "HappyForm"
602
  msgstr ""
603
 
604
- #: inc/classes/class-happyforms-plugin.php:274
605
  msgid "New HappyForm"
606
  msgstr ""
607
 
608
- #: inc/classes/class-happyforms-plugin.php:398
609
  msgid "Add HappyForms"
610
  msgstr ""
611
 
@@ -626,7 +626,7 @@ msgid "View response #"
626
  msgstr ""
627
 
628
  #: inc/classes/class-message-admin.php:182
629
- #: inc/classes/class-message-controller.php:156
630
  msgid "View response"
631
  msgstr ""
632
 
@@ -755,36 +755,36 @@ msgstr ""
755
  msgid "Unread"
756
  msgstr ""
757
 
758
- #: inc/classes/class-message-controller.php:129
759
  msgid "New submission"
760
  msgstr ""
761
 
762
- #: inc/classes/class-message-controller.php:153
763
- #: inc/classes/class-message-controller.php:161
764
  msgid "All Responses"
765
  msgstr ""
766
 
767
- #: inc/classes/class-message-controller.php:154
768
  msgid "Response"
769
  msgstr ""
770
 
771
- #: inc/classes/class-message-controller.php:155
772
  msgid "Edit response"
773
  msgstr ""
774
 
775
- #: inc/classes/class-message-controller.php:157
776
  msgid "View Responses"
777
  msgstr ""
778
 
779
- #: inc/classes/class-message-controller.php:158
780
  msgid "Search Responses"
781
  msgstr ""
782
 
783
- #: inc/classes/class-message-controller.php:159
784
  msgid "No response found"
785
  msgstr ""
786
 
787
- #: inc/classes/class-message-controller.php:160
788
  msgid "No response found in Trash"
789
  msgstr ""
790
 
@@ -1184,59 +1184,59 @@ msgstr ""
1184
  msgid "How can I access my premium upgrade credentials?"
1185
  msgstr ""
1186
 
1187
- #: inc/helpers/helper-form-templates.php:721
1188
  msgid "Get my location"
1189
  msgstr ""
1190
 
1191
- #: inc/helpers/helper-form-templates.php:721
1192
  msgid "Fetching location…"
1193
  msgstr ""
1194
 
1195
- #: inc/helpers/helper-form-templates.php:732
1196
  msgid "January"
1197
  msgstr ""
1198
 
1199
- #: inc/helpers/helper-form-templates.php:733
1200
  msgid "February"
1201
  msgstr ""
1202
 
1203
- #: inc/helpers/helper-form-templates.php:734
1204
  msgid "March"
1205
  msgstr ""
1206
 
1207
- #: inc/helpers/helper-form-templates.php:735
1208
  msgid "April"
1209
  msgstr ""
1210
 
1211
- #: inc/helpers/helper-form-templates.php:736
1212
  msgid "May"
1213
  msgstr ""
1214
 
1215
- #: inc/helpers/helper-form-templates.php:737
1216
  msgid "June"
1217
  msgstr ""
1218
 
1219
- #: inc/helpers/helper-form-templates.php:738
1220
  msgid "July"
1221
  msgstr ""
1222
 
1223
- #: inc/helpers/helper-form-templates.php:739
1224
  msgid "August"
1225
  msgstr ""
1226
 
1227
- #: inc/helpers/helper-form-templates.php:740
1228
  msgid "September"
1229
  msgstr ""
1230
 
1231
- #: inc/helpers/helper-form-templates.php:741
1232
  msgid "October"
1233
  msgstr ""
1234
 
1235
- #: inc/helpers/helper-form-templates.php:742
1236
  msgid "November"
1237
  msgstr ""
1238
 
1239
- #: inc/helpers/helper-form-templates.php:743
1240
  msgid "December"
1241
  msgstr ""
1242
 
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: HappyForms 1.5.4\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
+ "POT-Creation-Date: 2018-07-25 13:22:25+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
126
 
127
  #: inc/classes/class-form-controller.php:74
128
  #: inc/classes/class-form-controller.php:84
129
+ #: inc/classes/class-happyforms-plugin.php:151
130
+ #: inc/classes/class-happyforms-plugin.php:152
131
  msgid "All Forms"
132
  msgstr ""
133
 
186
  msgstr ""
187
 
188
  #: inc/classes/class-form-controller.php:748
189
+ #: inc/classes/class-message-controller.php:237
190
  msgid "Your submission contains errors."
191
  msgstr ""
192
 
574
  msgid "Disable transitions on submit button"
575
  msgstr ""
576
 
577
+ #: inc/classes/class-happyforms-plugin.php:140
578
  msgid "HappyForms Index"
579
  msgstr ""
580
 
582
  msgid "HappyForms"
583
  msgstr ""
584
 
585
+ #: inc/classes/class-happyforms-plugin.php:159
586
+ #: inc/classes/class-happyforms-plugin.php:160
587
  msgid "Add New"
588
  msgstr ""
589
 
590
+ #: inc/classes/class-happyforms-plugin.php:168
591
+ #: inc/classes/class-happyforms-plugin.php:169
592
  msgid "Responses"
593
  msgstr ""
594
 
595
+ #: inc/classes/class-happyforms-plugin.php:180
596
+ #: inc/classes/class-happyforms-plugin.php:181
597
  msgid "Welcome"
598
  msgstr ""
599
 
600
+ #: inc/classes/class-happyforms-plugin.php:277
601
  msgid "HappyForm"
602
  msgstr ""
603
 
604
+ #: inc/classes/class-happyforms-plugin.php:281
605
  msgid "New HappyForm"
606
  msgstr ""
607
 
608
+ #: inc/classes/class-happyforms-plugin.php:394
609
  msgid "Add HappyForms"
610
  msgstr ""
611
 
626
  msgstr ""
627
 
628
  #: inc/classes/class-message-admin.php:182
629
+ #: inc/classes/class-message-controller.php:157
630
  msgid "View response"
631
  msgstr ""
632
 
755
  msgid "Unread"
756
  msgstr ""
757
 
758
+ #: inc/classes/class-message-controller.php:130
759
  msgid "New submission"
760
  msgstr ""
761
 
762
+ #: inc/classes/class-message-controller.php:154
763
+ #: inc/classes/class-message-controller.php:162
764
  msgid "All Responses"
765
  msgstr ""
766
 
767
+ #: inc/classes/class-message-controller.php:155
768
  msgid "Response"
769
  msgstr ""
770
 
771
+ #: inc/classes/class-message-controller.php:156
772
  msgid "Edit response"
773
  msgstr ""
774
 
775
+ #: inc/classes/class-message-controller.php:158
776
  msgid "View Responses"
777
  msgstr ""
778
 
779
+ #: inc/classes/class-message-controller.php:159
780
  msgid "Search Responses"
781
  msgstr ""
782
 
783
+ #: inc/classes/class-message-controller.php:160
784
  msgid "No response found"
785
  msgstr ""
786
 
787
+ #: inc/classes/class-message-controller.php:161
788
  msgid "No response found in Trash"
789
  msgstr ""
790
 
1184
  msgid "How can I access my premium upgrade credentials?"
1185
  msgstr ""
1186
 
1187
+ #: inc/helpers/helper-form-templates.php:723
1188
  msgid "Get my location"
1189
  msgstr ""
1190
 
1191
+ #: inc/helpers/helper-form-templates.php:723
1192
  msgid "Fetching location…"
1193
  msgstr ""
1194
 
1195
+ #: inc/helpers/helper-form-templates.php:734
1196
  msgid "January"
1197
  msgstr ""
1198
 
1199
+ #: inc/helpers/helper-form-templates.php:735
1200
  msgid "February"
1201
  msgstr ""
1202
 
1203
+ #: inc/helpers/helper-form-templates.php:736
1204
  msgid "March"
1205
  msgstr ""
1206
 
1207
+ #: inc/helpers/helper-form-templates.php:737
1208
  msgid "April"
1209
  msgstr ""
1210
 
1211
+ #: inc/helpers/helper-form-templates.php:738
1212
  msgid "May"
1213
  msgstr ""
1214
 
1215
+ #: inc/helpers/helper-form-templates.php:739
1216
  msgid "June"
1217
  msgstr ""
1218
 
1219
+ #: inc/helpers/helper-form-templates.php:740
1220
  msgid "July"
1221
  msgstr ""
1222
 
1223
+ #: inc/helpers/helper-form-templates.php:741
1224
  msgid "August"
1225
  msgstr ""
1226
 
1227
+ #: inc/helpers/helper-form-templates.php:742
1228
  msgid "September"
1229
  msgstr ""
1230
 
1231
+ #: inc/helpers/helper-form-templates.php:743
1232
  msgid "October"
1233
  msgstr ""
1234
 
1235
+ #: inc/helpers/helper-form-templates.php:744
1236
  msgid "November"
1237
  msgstr ""
1238
 
1239
+ #: inc/helpers/helper-form-templates.php:745
1240
  msgid "December"
1241
  msgstr ""
1242
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: contact, contact form, email, feedback form, form, form builder, custom fo
5
  Requires at least: 4.8
6
  Tested up to: 4.9.7
7
  Requires PHP: 5.2.4
8
- Stable tag: 1.5.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -75,6 +75,10 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
75
 
76
  == Changelog ==
77
 
 
 
 
 
78
  = 1.5.3 =
79
  * Improvement: New default styles to provide even better visual experience.
80
  * Improvement: Clearer display of email alerts and confirmations in Step 2 of form configuration.
@@ -190,6 +194,9 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
190
 
191
  == Upgrade Notice ==
192
 
 
 
 
193
  = 1.5.3 =
194
  * New default styles and bug fixes.
195
 
5
  Requires at least: 4.8
6
  Tested up to: 4.9.7
7
  Requires PHP: 5.2.4
8
+ Stable tag: 1.5.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
75
 
76
  == Changelog ==
77
 
78
+ = 1.5.4 =
79
+ * Improvement: Form assets now get loaded only on pages containing forms.
80
+ * Improvement: Forms now work when displayed inside the Dashboard.
81
+
82
  = 1.5.3 =
83
  * Improvement: New default styles to provide even better visual experience.
84
  * Improvement: Clearer display of email alerts and confirmations in Step 2 of form configuration.
194
 
195
  == Upgrade Notice ==
196
 
197
+ = 1.5.4 =
198
+ * Support for forms inside admin screens.
199
+
200
  = 1.5.3 =
201
  * New default styles and bug fixes.
202