Formidable Forms – Form Builder for WordPress - Version 4.09

Version Description

  • New: Updated the UX for creating a new blank form or from a template.
  • Fix: Duplicating a closed form action didn't copy correctly.
  • Fix: PHP warnings showed on the add-ons page on some sites.
Download this release

Release Info

Developer sswells
Plugin Icon 128x128 Formidable Forms – Form Builder for WordPress
Version 4.09
Comparing to
See all releases

Code changes from version 4.08 to 4.09

Files changed (33) hide show
  1. classes/controllers/FrmAddonsController.php +58 -12
  2. classes/controllers/FrmAppController.php +67 -4
  3. classes/controllers/FrmEntriesController.php +2 -1
  4. classes/controllers/FrmFormsController.php +86 -36
  5. classes/controllers/FrmHooksController.php +3 -0
  6. classes/helpers/FrmAppHelper.php +67 -8
  7. classes/helpers/FrmFormsHelper.php +56 -16
  8. classes/models/FrmFormAction.php +14 -0
  9. classes/models/FrmFormTemplateApi.php +99 -1
  10. classes/views/addons/list.php +1 -23
  11. classes/views/frm-form-actions/_action_inside.php +11 -12
  12. classes/views/frm-form-actions/email_action.php +4 -0
  13. classes/views/frm-forms/create-template-from-an-existing-form.php +35 -0
  14. classes/views/frm-forms/list-template.php +71 -0
  15. classes/views/frm-forms/list-templates.php +72 -273
  16. classes/views/frm-forms/list.php +3 -3
  17. classes/views/frm-forms/new-form-overlay.php +169 -29
  18. classes/views/frm-forms/new-form-overlay/code-from-email.php +24 -0
  19. classes/views/frm-forms/new-form-overlay/leave-email.php +25 -0
  20. classes/views/frm-forms/new-form-overlay/renew-account.php +11 -0
  21. classes/views/frm-forms/new-form-overlay/upgrade-body.php +33 -0
  22. classes/views/frm-forms/template-name-overlay.php +0 -18
  23. classes/views/shared/errors.php +1 -1
  24. classes/views/shared/views-info.php +1 -3
  25. css/frm_admin.css +474 -133
  26. formidable.php +1 -1
  27. images/icons.svg +15 -2
  28. images/leave-email.svg +1 -0
  29. images/renew-account.svg +1 -0
  30. images/upgrade-rocket.svg +1 -0
  31. js/formidable_admin.js +447 -80
  32. languages/formidable.pot +527 -364
  33. readme.txt +6 -1
classes/controllers/FrmAddonsController.php CHANGED
@@ -158,6 +158,10 @@ class FrmAddonsController {
158
  'docs' => 'knowledgebase/twilio-add-on/',
159
  'excerpt' => 'Allow users to text their votes for polls created by Formidable Forms, or send SMS notifications when entries are submitted or updated.',
160
  ),
 
 
 
 
161
  );
162
 
163
  $defaults = array(
@@ -277,7 +281,7 @@ class FrmAddonsController {
277
  return false;
278
  }
279
 
280
- if ( ! isset( $version_info['error'] ) || empty( $version_info['expires'] ) ) {
281
  // It's either invalid or already expired.
282
  return false;
283
  }
@@ -437,20 +441,14 @@ class FrmAddonsController {
437
  * Get the action link for an addon that isn't active.
438
  *
439
  * @since 3.06.03
440
- * @param string $addon The plugin slug
441
  * @return array
442
  */
443
  public static function install_link( $plugin ) {
444
- $link = array();
445
- $addons = self::get_api_addons();
446
- self::prepare_addons( $addons );
447
-
448
- foreach ( $addons as $addon ) {
449
- $slug = explode( '/', $addon['plugin'] );
450
- if ( $slug[0] !== 'formidable-' . $plugin ) {
451
- continue;
452
- }
453
 
 
454
  if ( $addon['status']['type'] === 'installed' && ! empty( $addon['activate_url'] ) ) {
455
  $link = array(
456
  'url' => $addon['plugin'],
@@ -470,9 +468,39 @@ class FrmAddonsController {
470
  if ( ! empty( $link ) ) {
471
  $link['status'] = $addon['status']['type'];
472
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
 
474
- return $link;
 
 
 
 
 
 
 
 
475
  }
 
476
  }
477
 
478
  /**
@@ -518,6 +546,9 @@ class FrmAddonsController {
518
  $base_file = 'formidable-' . $slug;
519
  }
520
  $file_name = $base_file . '/' . $base_file . '.php';
 
 
 
521
  }
522
 
523
  $addon['installed'] = self::is_installed( $file_name );
@@ -1112,6 +1143,21 @@ class FrmAddonsController {
1112
  );
1113
  }
1114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1115
  /**
1116
  * @since 3.04.03
1117
  * @deprecated 3.06
158
  'docs' => 'knowledgebase/twilio-add-on/',
159
  'excerpt' => 'Allow users to text their votes for polls created by Formidable Forms, or send SMS notifications when entries are submitted or updated.',
160
  ),
161
+ 'views' => array(
162
+ 'title' => 'Formidable Views',
163
+ 'excerpt' => 'Add the power of views to your Formidable Forms to display your form submissions in listings, tables, calendars, and more.',
164
+ ),
165
  );
166
 
167
  $defaults = array(
281
  return false;
282
  }
283
 
284
+ if ( isset( $version_info['error'] ) || empty( $version_info['expires'] ) ) {
285
  // It's either invalid or already expired.
286
  return false;
287
  }
441
  * Get the action link for an addon that isn't active.
442
  *
443
  * @since 3.06.03
444
+ * @param string $plugin The plugin slug
445
  * @return array
446
  */
447
  public static function install_link( $plugin ) {
448
+ $link = array();
449
+ $addon = self::get_addon( $plugin );
 
 
 
 
 
 
 
450
 
451
+ if ( $addon ) {
452
  if ( $addon['status']['type'] === 'installed' && ! empty( $addon['activate_url'] ) ) {
453
  $link = array(
454
  'url' => $addon['plugin'],
468
  if ( ! empty( $link ) ) {
469
  $link['status'] = $addon['status']['type'];
470
  }
471
+ }
472
+
473
+ return $link;
474
+ }
475
+
476
+ /**
477
+ * @since 4.09
478
+ * @param string $plugin The plugin slug
479
+ * @return array|false
480
+ */
481
+ private static function get_addon( $plugin ) {
482
+ $addons = self::get_api_addons();
483
+ self::prepare_addons( $addons );
484
+ foreach ( $addons as $addon ) {
485
+ $slug = explode( '/', $addon['plugin'] );
486
+ if ( $slug[0] === 'formidable-' . $plugin ) {
487
+ return $addon;
488
+ }
489
+ }
490
+ return false;
491
+ }
492
 
493
+ /**
494
+ * @since 4.09
495
+ * @return string
496
+ */
497
+ private static function get_license_type() {
498
+ $license_type = '';
499
+ $addons = self::get_api_addons();
500
+ if ( isset( $addons['error'] ) && isset( $addons['error']['type'] ) ) {
501
+ $license_type = $addons['error']['type'];
502
  }
503
+ return $license_type;
504
  }
505
 
506
  /**
546
  $base_file = 'formidable-' . $slug;
547
  }
548
  $file_name = $base_file . '/' . $base_file . '.php';
549
+ if ( ! isset( $addon['plugin'] ) ) {
550
+ $addon['plugin'] = $file_name;
551
+ }
552
  }
553
 
554
  $addon['installed'] = self::is_installed( $file_name );
1143
  );
1144
  }
1145
 
1146
+ /**
1147
+ * Render a conditional action button for a specified plugin
1148
+ *
1149
+ * @param string $plugin
1150
+ * @param array|string $upgrade_link_args
1151
+ * @since 4.09
1152
+ */
1153
+ public static function conditional_action_button( $plugin, $upgrade_link_args ) {
1154
+ $addon = self::get_addon( $plugin );
1155
+ $license_type = self::get_license_type();
1156
+ $plan_required = FrmFormsHelper::get_plan_required( $addon );
1157
+ $upgrade_link = FrmAppHelper::admin_upgrade_link( $upgrade_link_args );
1158
+ FrmAppHelper::conditional_action_button( $addon, $license_type, $plan_required, $upgrade_link );
1159
+ }
1160
+
1161
  /**
1162
  * @since 3.04.03
1163
  * @deprecated 3.06
classes/controllers/FrmAppController.php CHANGED
@@ -168,8 +168,9 @@ class FrmAppController {
168
  ),
169
  );
170
 
171
- // Let people know reports and views exist.
172
- if ( ! FrmAppHelper::pro_is_installed() ) {
 
173
  $nav_items[] = array(
174
  'link' => admin_url( 'admin.php?page=formidable-views&frm-full=1&form=' . absint( $id ) ),
175
  'label' => __( 'Views', 'formidable' ),
@@ -180,6 +181,10 @@ class FrmAppController {
180
  'class' => 'frm_noallow',
181
  ),
182
  );
 
 
 
 
183
  $nav_items[] = array(
184
  'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&frm-full=1&form=' . absint( $id ) ),
185
  'label' => __( 'Reports', 'formidable' ),
@@ -256,10 +261,63 @@ class FrmAppController {
256
  'content' => 'upgrade',
257
  );
258
  $default_link = FrmAppHelper::admin_upgrade_link( $upgrade_link );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
 
260
- include( FrmAppHelper::plugin_path() . '/classes/views/shared/upgrade_overlay.php' );
 
 
 
261
 
262
- include( FrmAppHelper::plugin_path() . '/classes/views/shared/confirm-overlay.php' );
 
 
 
 
 
 
 
 
263
  }
264
 
265
  public static function include_info_overlay() {
@@ -352,6 +410,11 @@ class FrmAppController {
352
  // don't continue during ajax calls
353
  self::admin_js();
354
  }
 
 
 
 
 
355
  }
356
 
357
  public static function admin_js() {
168
  ),
169
  );
170
 
171
+ $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
172
+
173
+ if ( ! $views_installed ) {
174
  $nav_items[] = array(
175
  'link' => admin_url( 'admin.php?page=formidable-views&frm-full=1&form=' . absint( $id ) ),
176
  'label' => __( 'Views', 'formidable' ),
181
  'class' => 'frm_noallow',
182
  ),
183
  );
184
+ }
185
+
186
+ // Let people know reports and views exist.
187
+ if ( ! FrmAppHelper::pro_is_installed() ) {
188
  $nav_items[] = array(
189
  'link' => admin_url( 'admin.php?page=formidable&frm_action=lite-reports&frm-full=1&form=' . absint( $id ) ),
190
  'label' => __( 'Reports', 'formidable' ),
261
  'content' => 'upgrade',
262
  );
263
  $default_link = FrmAppHelper::admin_upgrade_link( $upgrade_link );
264
+ $plugin_path = FrmAppHelper::plugin_path();
265
+ $shared_path = $plugin_path . '/classes/views/shared/';
266
+
267
+ include $shared_path . 'upgrade_overlay.php';
268
+ include $shared_path . 'confirm-overlay.php';
269
+
270
+ if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( FrmAppHelper::get_param( 'frm_action' ), array( '', 'list', 'trash' ), true ) ) {
271
+ self::new_form_overlay_html();
272
+ }
273
+ }
274
+
275
+ private static function new_form_overlay_html() {
276
+ FrmFormsController::before_list_templates();
277
+
278
+ $plugin_path = FrmAppHelper::plugin_path();
279
+ $path = $plugin_path . '/classes/views/frm-forms/';
280
+ $expired = FrmFormsController::expired();
281
+ $expiring = FrmAddonsController::is_license_expiring();
282
+ $user = wp_get_current_user(); // $user used in leave-email.php to determine a default value for field
283
+ $view_path = $path . 'new-form-overlay/';
284
+ $modal_class = '';
285
+ $upgrade_link = FrmAppHelper::admin_upgrade_link(
286
+ array(
287
+ 'medium' => 'new-template',
288
+ 'content' => 'upgrade',
289
+ )
290
+ );
291
+ $renew_link = FrmAppHelper::admin_upgrade_link(
292
+ array(
293
+ 'medium' => 'new-template',
294
+ 'content' => 'renew',
295
+ )
296
+ );
297
+ $blocks_to_render = array();
298
+
299
+ if ( ! FrmAppHelper::pro_is_installed() ) {
300
+ // avoid rendering the email and code blocks for users who have upgraded or have a free license already
301
+ $api = new FrmFormTemplateApi();
302
+ if ( ! $api->get_free_license() ) {
303
+ array_push( $blocks_to_render, 'email', 'code' );
304
+ }
305
+ }
306
 
307
+ // avoid rendering the upgrade block for users with elite
308
+ if ( 'elite' !== FrmAddonsController::license_type() ) {
309
+ $blocks_to_render[] = 'upgrade';
310
+ }
311
 
312
+ // avoid rendering the renew block for users who are not currently expired
313
+ if ( $expired ) {
314
+ $blocks_to_render[] = 'renew';
315
+ $modal_class = 'frm-expired';
316
+ } elseif ( $expiring ) {
317
+ $modal_class = 'frm-expiring';
318
+ }
319
+
320
+ include $path . 'new-form-overlay.php';
321
  }
322
 
323
  public static function include_info_overlay() {
410
  // don't continue during ajax calls
411
  self::admin_js();
412
  }
413
+
414
+ if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( FrmAppHelper::get_param( 'frm_action' ), array( 'add_new', 'list_templates' ), true ) ) {
415
+ wp_safe_redirect( admin_url( 'admin.php?page=formidable&triggerNewFormModal=1' ) );
416
+ exit;
417
+ }
418
  }
419
 
420
  public static function admin_js() {
classes/controllers/FrmEntriesController.php CHANGED
@@ -10,7 +10,8 @@ class FrmEntriesController {
10
 
11
  add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
12
 
13
- if ( ! FrmAppHelper::pro_is_installed() ) {
 
14
  add_submenu_page( 'formidable', 'Formidable | ' . __( 'Views', 'formidable' ), __( 'Views', 'formidable' ), 'frm_view_entries', 'formidable-views', 'FrmFormsController::no_views' );
15
  }
16
 
10
 
11
  add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
12
 
13
+ $views_installed = is_callable( 'FrmProAppHelper::views_is_installed' ) ? FrmProAppHelper::views_is_installed() : FrmAppHelper::pro_is_installed();
14
+ if ( ! $views_installed ) {
15
  add_submenu_page( 'formidable', 'Formidable | ' . __( 'Views', 'formidable' ), __( 'Views', 'formidable' ), 'frm_view_entries', 'formidable-views', 'FrmFormsController::no_views' );
16
  }
17
 
classes/controllers/FrmFormsController.php CHANGED
@@ -77,15 +77,6 @@ class FrmFormsController {
77
  return self::display_forms_list( $params, $message, $errors );
78
  }
79
 
80
- /**
81
- * Choose which type of form to create
82
- *
83
- * @since 3.06
84
- */
85
- public static function add_new() {
86
- self::list_templates();
87
- }
88
-
89
  /**
90
  * Load the scripts before a modal can be triggered.
91
  *
@@ -580,7 +571,7 @@ class FrmFormsController {
580
 
581
  $form_id = FrmAppHelper::get_param( 'xml', '', 'post', 'absint' );
582
  $new_form_id = FrmForm::duplicate( $form_id, 1, true );
583
- if ( empty( $new_form_id ) ) {
584
  $response = array(
585
  'message' => __( 'There was an error creating a template.', 'formidable' ),
586
  );
@@ -592,7 +583,7 @@ class FrmFormsController {
592
  }
593
 
594
  $response = array(
595
- 'redirect' => admin_url( 'admin.php?page=formidable&frm_action=list_templates' ),
596
  );
597
  }
598
 
@@ -795,39 +786,93 @@ class FrmFormsController {
795
  }
796
 
797
  /**
798
- * Show the template listing page
799
- *
800
- * @since 3.06
801
  */
802
- private static function list_templates() {
803
- self::init_modal();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
804
 
805
- $where = apply_filters( 'frm_forms_dropdown', array(), '' );
806
- $forms = FrmForm::get_published_forms( $where );
 
 
807
 
808
- $api = new FrmFormTemplateApi();
809
- $templates = $api->get_api_info();
 
810
 
811
- $custom_templates = array();
812
  self::add_user_templates( $custom_templates );
813
 
814
- $error = '';
815
- $expired = false;
816
- $license_type = '';
817
- if ( isset( $templates['error'] ) ) {
818
- $error = $templates['error']['message'];
819
- $error = str_replace( 'utm_medium=addons', 'utm_medium=form-templates', $error );
820
- $expired = ( $templates['error']['code'] === 'expired' );
821
 
822
- $license_type = isset( $templates['error']['type'] ) ? $templates['error']['type'] : '';
823
- unset( $templates['error'] );
 
 
 
 
 
824
  }
 
825
 
826
- $pricing = FrmAppHelper::admin_upgrade_link( 'form-templates' );
 
827
 
828
- $categories = self::get_template_categories( $templates );
 
 
 
 
 
 
 
 
 
 
829
 
830
- require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list-templates.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
  }
832
 
833
  /**
@@ -1376,9 +1421,6 @@ class FrmFormsController {
1376
  switch ( $action ) {
1377
  case 'new':
1378
  return self::new_form( $vars );
1379
- case 'add_new':
1380
- case 'list_templates':
1381
- return self::list_templates();
1382
  case 'create':
1383
  case 'edit':
1384
  case 'update':
@@ -2144,4 +2186,12 @@ class FrmFormsController {
2144
  public static function edit_description() {
2145
  FrmDeprecated::edit_description();
2146
  }
 
 
 
 
 
 
 
 
2147
  }
77
  return self::display_forms_list( $params, $message, $errors );
78
  }
79
 
 
 
 
 
 
 
 
 
 
80
  /**
81
  * Load the scripts before a modal can be triggered.
82
  *
571
 
572
  $form_id = FrmAppHelper::get_param( 'xml', '', 'post', 'absint' );
573
  $new_form_id = FrmForm::duplicate( $form_id, 1, true );
574
+ if ( ! $new_form_id ) {
575
  $response = array(
576
  'message' => __( 'There was an error creating a template.', 'formidable' ),
577
  );
583
  }
584
 
585
  $response = array(
586
+ 'redirect' => admin_url( 'admin.php?page=formidable&frm_action=duplicate&id=' . $new_form_id ),
587
  );
588
  }
589
 
786
  }
787
 
788
  /**
789
+ * @return bool
 
 
790
  */
791
+ public static function expired() {
792
+ global $frm_expired;
793
+ return $frm_expired;
794
+ }
795
+
796
+ /**
797
+ * Get data from api before rendering it so that we can flag the modal as expired
798
+ */
799
+ public static function before_list_templates() {
800
+ global $frm_templates;
801
+ global $frm_expired;
802
+ global $frm_license_type;
803
+
804
+ $api = new FrmFormTemplateApi();
805
+ $frm_templates = $api->get_api_info();
806
+ $expired = false;
807
+ $license_type = '';
808
+ if ( isset( $frm_templates['error'] ) ) {
809
+ $error = $frm_templates['error']['message'];
810
+ $error = str_replace( 'utm_medium=addons', 'utm_medium=form-templates', $error );
811
+ $expired = 'expired' === $frm_templates['error']['code'];
812
+ $license_type = isset( $frm_templates['error']['type'] ) ? $frm_templates['error']['type'] : '';
813
+ unset( $frm_templates['error'] );
814
+ }
815
+
816
+ $frm_expired = $expired;
817
+ $frm_license_type = $license_type;
818
+ }
819
 
820
+ public static function list_templates() {
821
+ global $frm_templates;
822
+ global $frm_expired;
823
+ global $frm_license_type;
824
 
825
+ $templates = $frm_templates;
826
+ $custom_templates = array();
827
+ $templates_by_category = array();
828
 
 
829
  self::add_user_templates( $custom_templates );
830
 
831
+ foreach ( $templates as $template ) {
832
+ if ( ! isset( $template['categories'] ) ) {
833
+ continue;
834
+ }
 
 
 
835
 
836
+ foreach ( $template['categories'] as $category ) {
837
+ if ( ! isset( $templates_by_category[ $category ] ) ) {
838
+ $templates_by_category[ $category ] = array();
839
+ }
840
+
841
+ $templates_by_category[ $category ][] = $template;
842
+ }
843
  }
844
+ unset( $template );
845
 
846
+ // Subcategories that are included elsewhere.
847
+ $redundant_cats = array( 'PayPal', 'Stripe', 'Twilio' );
848
 
849
+ $categories = array_keys( $templates_by_category );
850
+ $categories = array_diff( $categories, FrmFormsHelper::ignore_template_categories() );
851
+ $categories = array_diff( $categories, $redundant_cats );
852
+ sort( $categories );
853
+
854
+ array_walk(
855
+ $custom_templates,
856
+ function( &$template ) {
857
+ $template['custom'] = true;
858
+ }
859
+ );
860
 
861
+ $my_templates_translation = __( 'My Templates', 'formidable' );
862
+ $categories = array_merge( array( $my_templates_translation ), $categories );
863
+ $pricing = FrmAppHelper::admin_upgrade_link( 'form-templates' );
864
+ $expired = $frm_expired;
865
+ $license_type = $frm_license_type;
866
+ $args = compact( 'pricing', 'license_type' );
867
+ $where = apply_filters( 'frm_forms_dropdown', array(), '' );
868
+ $forms = FrmForm::get_published_forms( $where );
869
+ $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/';
870
+
871
+ $templates_by_category[ $my_templates_translation ] = $custom_templates;
872
+
873
+ unset( $pricing, $license_type, $where );
874
+ wp_enqueue_script( 'accordion' ); // register accordion for template groups
875
+ require $view_path . 'list-templates.php';
876
  }
877
 
878
  /**
1421
  switch ( $action ) {
1422
  case 'new':
1423
  return self::new_form( $vars );
 
 
 
1424
  case 'create':
1425
  case 'edit':
1426
  case 'update':
2186
  public static function edit_description() {
2187
  FrmDeprecated::edit_description();
2188
  }
2189
+
2190
+ /**
2191
+ * @deprecated 4.08
2192
+ * @since 3.06
2193
+ */
2194
+ public static function add_new() {
2195
+ _deprecated_function( __FUNCTION__, '4.08' );
2196
+ }
2197
  }
classes/controllers/FrmHooksController.php CHANGED
@@ -206,6 +206,9 @@ class FrmHooksController {
206
  add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' );
207
  add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' );
208
  add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
 
 
 
209
  }
210
 
211
  public static function load_form_hooks() {
206
  add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' );
207
  add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' );
208
  add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
209
+
210
+ // Templates API.
211
+ add_action( 'wp_ajax_template_api_signup', 'FrmFormTemplateApi::signup' );
212
  }
213
 
214
  public static function load_form_hooks() {
classes/helpers/FrmAppHelper.php CHANGED
@@ -11,7 +11,7 @@ class FrmAppHelper {
11
  /**
12
  * @since 2.0
13
  */
14
- public static $plug_version = '4.08';
15
 
16
  /**
17
  * @since 1.07.02
@@ -73,6 +73,56 @@ class FrmAppHelper {
73
  return absint( apply_filters( 'frm_affiliate_id', 0 ) );
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  /**
77
  * @since 3.04.02
78
  * @param array|string $args
@@ -129,7 +179,7 @@ class FrmAppHelper {
129
   
130
  <?php esc_html_e( 'Your account has expired', 'formidable' ); ?>
131
  <div style="float:right">
132
- <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-renew', 'account/downloads/' ) ); ?>">
133
  Renew Now
134
  </a>
135
  </div>
@@ -156,7 +206,7 @@ class FrmAppHelper {
156
  _n(
157
  'Your form subscription expires in %1$s day%2$s.',
158
  'Your form subscription expires in %1$s days%2$s.',
159
- $expiring,
160
  'formidable'
161
  )
162
  ),
@@ -166,7 +216,7 @@ class FrmAppHelper {
166
  ?>
167
  <div style="float:right">
168
  <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-renew', 'account/downloads/' ) ); ?>">
169
- Renew Now
170
  </a>
171
  </div>
172
  </div>
@@ -955,15 +1005,25 @@ class FrmAppHelper {
955
 
956
  /**
957
  * @since 3.0
 
958
  */
959
  public static function add_new_item_link( $atts ) {
960
- if ( isset( $atts['new_link'] ) && ! empty( $atts['new_link'] ) ) {
961
  ?>
962
  <a href="<?php echo esc_url( $atts['new_link'] ); ?>" class="button button-primary frm-button-primary frm-with-plus">
963
  <?php self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' ); ?>
964
  <?php esc_html_e( 'Add New', 'formidable' ); ?>
965
  </a>
966
  <?php
 
 
 
 
 
 
 
 
 
967
  } elseif ( isset( $atts['link_hook'] ) ) {
968
  do_action( $atts['link_hook']['hook'], $atts['link_hook']['param'] );
969
  }
@@ -2665,7 +2725,6 @@ class FrmAppHelper {
2665
  'sv' => __( 'Swedish', 'formidable' ),
2666
  'ta' => __( 'Tamil', 'formidable' ),
2667
  'th' => __( 'Thai', 'formidable' ),
2668
- 'tu' => __( 'Turkish', 'formidable' ),
2669
  'tr' => __( 'Turkish', 'formidable' ),
2670
  'uk' => __( 'Ukranian', 'formidable' ),
2671
  'vi' => __( 'Vietnamese', 'formidable' ),
@@ -2673,10 +2732,10 @@ class FrmAppHelper {
2673
 
2674
  if ( $type === 'captcha' ) {
2675
  // remove the languages unavailable for the captcha
2676
- $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta', 'tu' );
2677
  } else {
2678
  // remove the languages unavailable for the datepicker
2679
- $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419', 'tr' );
2680
  }
2681
 
2682
  $locales = array_diff_key( $locales, array_flip( $unset ) );
11
  /**
12
  * @since 2.0
13
  */
14
+ public static $plug_version = '4.09';
15
 
16
  /**
17
  * @since 1.07.02
73
  return absint( apply_filters( 'frm_affiliate_id', 0 ) );
74
  }
75
 
76
+ /**
77
+ * Render a conditional action button for an add on
78
+ *
79
+ * @since 4.09
80
+ * @param array $addon
81
+ * @param string|false $license_type
82
+ * @param string $plan_required
83
+ * @param string $upgrade_link
84
+ */
85
+ public static function conditional_action_button( $addon, $license_type, $plan_required, $upgrade_link ) {
86
+ if ( ! $addon ) {
87
+ ?>
88
+ <a class="install-now button button-secondary frm-button-secondary" href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
89
+ <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
90
+ </a>
91
+ <?php
92
+ return;
93
+ }
94
+
95
+ if ( $addon['status']['type'] === 'installed' ) {
96
+ ?>
97
+ <a rel="<?php echo esc_attr( $addon['plugin'] ); ?>" class="button button-primary frm-button-primary frm-activate-addon <?php echo esc_attr( empty( $addon['activate_url'] ) ? 'frm_hidden' : '' ); ?>">
98
+ <?php esc_html_e( 'Activate', 'formidable' ); ?>
99
+ </a>
100
+ <?php
101
+ } elseif ( ! empty( $addon['url'] ) ) {
102
+ ?>
103
+ <a class="frm-install-addon button button-primary frm-button-primary" rel="<?php echo esc_attr( $addon['url'] ); ?>" aria-label="<?php esc_attr_e( 'Install', 'formidable' ); ?>">
104
+ <?php esc_html_e( 'Install', 'formidable' ); ?>
105
+ </a>
106
+ <?php
107
+ } elseif ( $license_type && $license_type === strtolower( $plan_required ) ) {
108
+ ?>
109
+ <a class="install-now button button-secondary frm-button-secondary" href="<?php echo esc_url( self::admin_upgrade_link( 'addons', 'account/downloads/' ) . '&utm_content=' . $addon['slug'] ); ?>" target="_blank" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
110
+ <?php esc_html_e( 'Renew Now', 'formidable' ); ?>
111
+ </a>
112
+ <?php
113
+ } else {
114
+ if ( isset( $addon['categories'] ) && in_array( 'Solution', $addon['categories'], true ) ) {
115
+ // Solutions will go to a separate page.
116
+ $upgrade_link = self::admin_upgrade_link( 'addons', $addon['link'] );
117
+ }
118
+ ?>
119
+ <a class="install-now button button-secondary frm-button-secondary" href="<?php echo esc_url( $upgrade_link . '&utm_content=' . $addon['slug'] ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
120
+ <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
121
+ </a>
122
+ <?php
123
+ }
124
+ }
125
+
126
  /**
127
  * @since 3.04.02
128
  * @param array|string $args
179
  &nbsp;
180
  <?php esc_html_e( 'Your account has expired', 'formidable' ); ?>
181
  <div style="float:right">
182
+ <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-expired', 'account/downloads/' ) ); ?>">
183
  Renew Now
184
  </a>
185
  </div>
206
  _n(
207
  'Your form subscription expires in %1$s day%2$s.',
208
  'Your form subscription expires in %1$s days%2$s.',
209
+ intval( $expiring ),
210
  'formidable'
211
  )
212
  ),
216
  ?>
217
  <div style="float:right">
218
  <a href="<?php echo esc_url( self::admin_upgrade_link( 'form-renew', 'account/downloads/' ) ); ?>">
219
+ <?php esc_html_e( 'Renew Now', 'formidable' ); ?>
220
  </a>
221
  </div>
222
  </div>
1005
 
1006
  /**
1007
  * @since 3.0
1008
+ * @param array $atts
1009
  */
1010
  public static function add_new_item_link( $atts ) {
1011
+ if ( ! empty( $atts['new_link'] ) ) {
1012
  ?>
1013
  <a href="<?php echo esc_url( $atts['new_link'] ); ?>" class="button button-primary frm-button-primary frm-with-plus">
1014
  <?php self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' ); ?>
1015
  <?php esc_html_e( 'Add New', 'formidable' ); ?>
1016
  </a>
1017
  <?php
1018
+ } elseif ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1019
+ ?>
1020
+ <a href="#" class="button button-primary frm-button-primary frm-with-plus frm-trigger-new-form-modal">
1021
+ <?php
1022
+ self::icon_by_class( 'frmfont frm_plus_icon frm_svg15' );
1023
+ esc_html_e( 'Add New', 'formidable' );
1024
+ ?>
1025
+ </a>
1026
+ <?php
1027
  } elseif ( isset( $atts['link_hook'] ) ) {
1028
  do_action( $atts['link_hook']['hook'], $atts['link_hook']['param'] );
1029
  }
2725
  'sv' => __( 'Swedish', 'formidable' ),
2726
  'ta' => __( 'Tamil', 'formidable' ),
2727
  'th' => __( 'Thai', 'formidable' ),
 
2728
  'tr' => __( 'Turkish', 'formidable' ),
2729
  'uk' => __( 'Ukranian', 'formidable' ),
2730
  'vi' => __( 'Vietnamese', 'formidable' ),
2732
 
2733
  if ( $type === 'captcha' ) {
2734
  // remove the languages unavailable for the captcha
2735
+ $unset = array( 'af', 'sq', 'hy', 'az', 'eu', 'bs', 'zh-HK', 'eo', 'et', 'fo', 'fr-CH', 'he', 'is', 'ms', 'sr-SR', 'ta' );
2736
  } else {
2737
  // remove the languages unavailable for the datepicker
2738
+ $unset = array( 'fil', 'fr-CA', 'de-AT', 'de-CH', 'iw', 'hi', 'pt', 'pt-PT', 'es-419' );
2739
  }
2740
 
2741
  $locales = array_diff_key( $locales, array_flip( $unset ) );
classes/helpers/FrmFormsHelper.php CHANGED
@@ -1214,19 +1214,31 @@ BEFORE_HTML;
1214
  $categories = array_diff( $categories, $ignore );
1215
 
1216
  $icons = array(
1217
- 'WooCommerce' => array( 'woocommerce', 'var(--purple)' ),
1218
- 'Post' => array( 'wordpress', 'rgb(0,160,210)' ),
1219
- 'User Registration' => array( 'register', 'var(--pink)' ),
1220
- 'PayPal' => array( 'paypal' ),
1221
- 'Stripe' => array( 'credit_card', 'var(--green)' ),
1222
- 'Twilio' => array( 'sms', 'rgb(0,160,210)' ),
1223
- 'Calculator' => array( 'calculator', 'var(--orange)' ),
1224
- 'Contact Form' => array( 'address_card' ),
1225
- 'Survey' => array( 'align_right', 'var(--pink)' ),
1226
- 'Application Form' => array( 'align_right', 'rgb(0,160,210)' ),
1227
- '' => array( 'align_right' ),
 
 
 
 
 
 
 
 
 
 
1228
  );
1229
 
 
 
1230
  $icon = $icons[''];
1231
 
1232
  if ( count( $categories ) === 1 ) {
@@ -1266,7 +1278,7 @@ BEFORE_HTML;
1266
  'atts' => true,
1267
  );
1268
 
1269
- if ( isset( $template['url'] ) && ! empty( $template['url'] ) ) {
1270
  $link = array(
1271
  'url' => $template['url'],
1272
  'label' => __( 'Create Form', 'formidable' ),
@@ -1298,7 +1310,7 @@ BEFORE_HTML;
1298
  *
1299
  * @return bool
1300
  */
1301
- private static function plan_is_allowed( $args ) {
1302
  if ( empty( $args['license_type'] ) ) {
1303
  return false;
1304
  }
@@ -1306,7 +1318,7 @@ BEFORE_HTML;
1306
  $included = $args['license_type'] === strtolower( $args['plan_required'] );
1307
 
1308
  $plans = array( 'free', 'personal', 'business', 'elite' );
1309
- if ( $included || ! in_array( strtolower( $args['plan_required'] ), $plans ) ) {
1310
  return $included;
1311
  }
1312
 
@@ -1353,19 +1365,21 @@ BEFORE_HTML;
1353
  * @since 4.0
1354
  */
1355
  public static function get_plan_required( &$item ) {
1356
- if ( ! isset( $item['categories'] ) || ( isset( $item['url'] ) && ! empty( $item['url'] ) ) ) {
1357
  return false;
1358
  }
1359
 
1360
  $plans = array( 'free', 'Basic', 'Personal', 'Business', 'Elite' );
1361
 
1362
  foreach ( $item['categories'] as $k => $category ) {
1363
- if ( in_array( $category, $plans ) ) {
1364
  unset( $item['categories'][ $k ] );
 
1365
  if ( $category === 'Personal' ) {
1366
  // Show the current package name.
1367
  $category = 'Basic';
1368
  }
 
1369
  return $category;
1370
  }
1371
  }
@@ -1528,4 +1542,30 @@ BEFORE_HTML;
1528
  'year',
1529
  );
1530
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1531
  }
1214
  $categories = array_diff( $categories, $ignore );
1215
 
1216
  $icons = array(
1217
+ 'WooCommerce' => array( 'woocommerce', 'var(--purple)' ),
1218
+ 'Post' => array( 'wordpress', 'rgb(0,160,210)' ),
1219
+ 'User Registration' => array( 'register', 'var(--pink)' ),
1220
+ 'PayPal' => array( 'paypal' ),
1221
+ 'Stripe' => array( 'credit_card', 'var(--green)' ),
1222
+ 'Twilio' => array( 'sms', 'rgb(0,160,210)' ),
1223
+ 'Payment' => array( 'credit_card', 'var(--green)' ),
1224
+ 'Health and Wellness' => array( 'heart', 'var(--pink)' ),
1225
+ 'Event Planning' => array( 'calendar', 'var(--orange)' ),
1226
+ 'Real Estate' => array( 'house', 'var(--purple)' ),
1227
+ 'Calculator' => array( 'calculator', 'var(--purple)' ),
1228
+ 'Registrations' => array( 'address_card' ),
1229
+ 'Customer Service' => array( 'users_solid', 'var(--pink)' ),
1230
+ 'Education' => array( 'pencil', 'var(--primary-color)' ),
1231
+ 'Marketing' => array( 'eye', 'rgb(0,160,210)' ),
1232
+ 'Feedback' => array( 'smile', 'var(--green)' ),
1233
+ 'Business Operations' => array( 'case' ),
1234
+ 'Contact Form' => array( 'email' ),
1235
+ 'Survey' => array( 'comment', 'var(--primary-color)' ),
1236
+ 'Application Form' => array( 'align_right', 'rgb(0,160,210)' ),
1237
+ '' => array( 'align_right' ),
1238
  );
1239
 
1240
+ $icons[ __( 'My Templates', 'formidable' ) ] = array( 'user', 'var(--orange)' );
1241
+
1242
  $icon = $icons[''];
1243
 
1244
  if ( count( $categories ) === 1 ) {
1278
  'atts' => true,
1279
  );
1280
 
1281
+ if ( ! empty( $template['url'] ) ) {
1282
  $link = array(
1283
  'url' => $template['url'],
1284
  'label' => __( 'Create Form', 'formidable' ),
1310
  *
1311
  * @return bool
1312
  */
1313
+ public static function plan_is_allowed( $args ) {
1314
  if ( empty( $args['license_type'] ) ) {
1315
  return false;
1316
  }
1318
  $included = $args['license_type'] === strtolower( $args['plan_required'] );
1319
 
1320
  $plans = array( 'free', 'personal', 'business', 'elite' );
1321
+ if ( $included || ! in_array( strtolower( $args['plan_required'] ), $plans, true ) ) {
1322
  return $included;
1323
  }
1324
 
1365
  * @since 4.0
1366
  */
1367
  public static function get_plan_required( &$item ) {
1368
+ if ( ! isset( $item['categories'] ) || ! empty( $item['url'] ) ) {
1369
  return false;
1370
  }
1371
 
1372
  $plans = array( 'free', 'Basic', 'Personal', 'Business', 'Elite' );
1373
 
1374
  foreach ( $item['categories'] as $k => $category ) {
1375
+ if ( in_array( $category, $plans, true ) ) {
1376
  unset( $item['categories'][ $k ] );
1377
+
1378
  if ( $category === 'Personal' ) {
1379
  // Show the current package name.
1380
  $category = 'Basic';
1381
  }
1382
+
1383
  return $category;
1384
  }
1385
  }
1542
  'year',
1543
  );
1544
  }
1545
+
1546
+ /**
1547
+ * Check an array of templates, determine how many the logged in user can use
1548
+ *
1549
+ * @param array $templates
1550
+ * @param array $args
1551
+ * @return int
1552
+ */
1553
+ public static function available_count( $templates, $args ) {
1554
+ return array_reduce(
1555
+ $templates,
1556
+ function( $total, $template ) use ( $args ) {
1557
+ if ( ! empty( $template['url'] ) ) {
1558
+ return $total + 1;
1559
+ }
1560
+
1561
+ $args['plan_required'] = self::get_plan_required( $template );
1562
+ if ( self::plan_is_allowed( $args ) ) {
1563
+ return $total + 1;
1564
+ }
1565
+
1566
+ return $total;
1567
+ },
1568
+ 0
1569
+ );
1570
+ }
1571
  }
classes/models/FrmFormAction.php CHANGED
@@ -834,4 +834,18 @@ class FrmFormAction {
834
 
835
  return apply_filters( 'frm_action_triggers', $triggers );
836
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  }
834
 
835
  return apply_filters( 'frm_action_triggers', $triggers );
836
  }
837
+
838
+ public function render_conditional_logic_call_to_action() {
839
+ ?>
840
+ <h3>
841
+ <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php echo esc_attr( $this->get_upgrade_text() ); ?>" data-medium="conditional-<?php echo esc_attr( $this->id_base ); ?>">
842
+ <?php esc_html_e( 'Use Conditional Logic', 'formidable' ); ?>
843
+ </a>
844
+ </h3>
845
+ <?php
846
+ }
847
+
848
+ protected function get_upgrade_text() {
849
+ return __( 'Conditional form actions', 'formidable' );
850
+ }
851
  }
classes/models/FrmFormTemplateApi.php CHANGED
@@ -5,6 +5,12 @@ if ( ! defined( 'ABSPATH' ) ) {
5
 
6
  class FrmFormTemplateApi extends FrmFormApi {
7
 
 
 
 
 
 
 
8
  /**
9
  * @since 3.06
10
  */
@@ -16,7 +22,18 @@ class FrmFormTemplateApi extends FrmFormApi {
16
  * @since 3.06
17
  */
18
  protected function api_url() {
19
- return 'https://formidableforms.com/wp-json/form-templates/v1/list';
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
  /**
@@ -25,4 +42,85 @@ class FrmFormTemplateApi extends FrmFormApi {
25
  protected function skip_categories() {
26
  return array();
27
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
5
 
6
  class FrmFormTemplateApi extends FrmFormApi {
7
 
8
+ protected static $code_option_name = 'frm_free_license_code';
9
+
10
+ private static $base_api_url = 'https://formidableforms.com/wp-json/form-templates/v1/';
11
+
12
+ protected $free_license;
13
+
14
  /**
15
  * @since 3.06
16
  */
22
  * @since 3.06
23
  */
24
  protected function api_url() {
25
+ $url = self::$base_api_url . 'list';
26
+
27
+ if ( empty( $this->license ) ) {
28
+ $free_license = $this->get_free_license();
29
+
30
+ if ( $free_license ) {
31
+ $url .= '?l=' . urlencode( base64_encode( $free_license ) );
32
+ $url .= '&v=' . FrmAppHelper::plugin_version();
33
+ }
34
+ }
35
+
36
+ return $url;
37
  }
38
 
39
  /**
42
  protected function skip_categories() {
43
  return array();
44
  }
45
+
46
+ /**
47
+ * @return string
48
+ */
49
+ public function get_free_license() {
50
+ if ( ! isset( $this->free_license ) ) {
51
+ $this->free_license = get_option( self::$code_option_name );
52
+ }
53
+
54
+ return $this->free_license;
55
+ }
56
+
57
+ /**
58
+ * @param string $code the code from the email sent for the API
59
+ */
60
+ private static function verify_code( $code ) {
61
+ $base64_code = base64_encode( $code );
62
+ $api_url = self::$base_api_url . 'code?l=' . $base64_code;
63
+ $response = wp_remote_get( $api_url );
64
+
65
+ self::handle_verify_response_errors_if_any( $response );
66
+
67
+ $decoded = json_decode( $response['body'] );
68
+ $successful = ! empty( $decoded->response );
69
+
70
+ if ( $successful ) {
71
+ self::on_api_verify_code_success( $base64_code );
72
+ } else {
73
+ wp_send_json_error( new WP_Error( $decoded->code, $decoded->message ) );
74
+ }
75
+ }
76
+
77
+ /**
78
+ * @param array $response
79
+ */
80
+ private static function handle_verify_response_errors_if_any( $response ) {
81
+ if ( is_wp_error( $response ) ) {
82
+ wp_send_json_error( $response );
83
+ }
84
+
85
+ if ( ! is_array( $response ) ) {
86
+ wp_send_json_error();
87
+ }
88
+ }
89
+
90
+ /**
91
+ * @param string $code the base64 encoded code
92
+ */
93
+ private static function on_api_verify_code_success( $code ) {
94
+ update_option( self::$code_option_name, $code );
95
+
96
+ $data = array();
97
+ $key = FrmAppHelper::get_param( 'key', '', 'post', 'sanitize_key' );
98
+
99
+ if ( $key ) {
100
+ $api = new self();
101
+ $templates = $api->get_api_info();
102
+
103
+ foreach ( $templates as $template ) {
104
+ if ( $key === $template['key'] ) {
105
+ $data['url'] = $template['url'];
106
+ break;
107
+ }
108
+ }
109
+ }
110
+
111
+ wp_send_json_success( $data );
112
+ }
113
+
114
+ /**
115
+ * AJAX Hook for signing free users up for a template API key
116
+ */
117
+ public static function signup() {
118
+ $code = FrmAppHelper::get_param( 'code', '', 'post' );
119
+
120
+ if ( ! $code ) {
121
+ wp_send_json_error();
122
+ }
123
+
124
+ self::verify_code( $code );
125
+ }
126
  }
classes/views/addons/list.php CHANGED
@@ -77,29 +77,7 @@ if ( ! defined( 'ABSPATH' ) ) {
77
  );
78
  ?>
79
  </span>
80
- <?php if ( $addon['status']['type'] === 'installed' ) { ?>
81
- <a rel="<?php echo esc_attr( $addon['plugin'] ); ?>" class="button button-primary frm-button-primary frm-activate-addon <?php echo esc_attr( empty( $addon['activate_url'] ) ? 'frm_hidden' : '' ); ?>">
82
- <?php esc_html_e( 'Activate', 'formidable' ); ?>
83
- </a>
84
- <?php } elseif ( isset( $addon['url'] ) && ! empty( $addon['url'] ) ) { ?>
85
- <a class="frm-install-addon button button-primary frm-button-primary" rel="<?php echo esc_attr( $addon['url'] ); ?>" aria-label="<?php esc_attr_e( 'Install', 'formidable' ); ?>">
86
- <?php esc_html_e( 'Install', 'formidable' ); ?>
87
- </a>
88
- <?php } elseif ( ! empty( $license_type ) && $license_type === strtolower( $plan_required ) ) { ?>
89
- <a class="install-now button button-secondary frm-button-secondary" href="<?php echo esc_url( FrmAppHelper::admin_upgrade_link( 'addons', 'account/downloads/' ) . '&utm_content=' . $addon['slug'] ); ?>" target="_blank" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
90
- <?php esc_html_e( 'Renew Now', 'formidable' ); ?>
91
- </a>
92
- <?php } else { ?>
93
- <?php
94
- if ( isset( $addon['categories'] ) && in_array( 'Solution', $addon['categories'] ) ) {
95
- // Solutions will go to a separate page.
96
- $pricing = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] );
97
- }
98
- ?>
99
- <a class="install-now button button-secondary frm-button-secondary" href="<?php echo esc_url( $pricing . '&utm_content=' . $addon['slug'] ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
100
- <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
101
- </a>
102
- <?php } ?>
103
  </div>
104
  </div>
105
  <?php } ?>
77
  );
78
  ?>
79
  </span>
80
+ <?php FrmAppHelper::conditional_action_button( $addon, ! empty( $license_type ) ? $license_type : false, $plan_required, $pricing ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  </div>
82
  </div>
83
  <?php } ?>
classes/views/frm-form-actions/_action_inside.php CHANGED
@@ -65,18 +65,17 @@ do_action( 'frm_additional_action_settings', $form_action, $pass_args );
65
 
66
  // Show Conditional logic indicator.
67
  if ( ! FrmAppHelper::pro_is_installed() ) {
68
- ?>
69
- <h3>
70
- <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php esc_attr_e( 'Email attachments', 'formidable' ); ?>" data-medium="email-attachment">
71
- <?php esc_html_e( 'Attachment', 'formidable' ); ?>
72
- </a>
73
- </h3>
74
- <h3>
75
- <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php esc_attr_e( 'Conditional emails', 'formidable' ); ?>" data-medium="conditional-email">
76
- <?php esc_html_e( 'Use Conditional Logic', 'formidable' ); ?>
77
- </a>
78
- </h3>
79
- <?php
80
  }
81
 
82
  // Show Form Action Automation indicator.
65
 
66
  // Show Conditional logic indicator.
67
  if ( ! FrmAppHelper::pro_is_installed() ) {
68
+ if ( 'email' === $form_action->post_excerpt ) {
69
+ ?>
70
+ <h3>
71
+ <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php esc_attr_e( 'Email attachments', 'formidable' ); ?>" data-medium="email-attachment">
72
+ <?php esc_html_e( 'Attachment', 'formidable' ); ?>
73
+ </a>
74
+ </h3>
75
+ <?php
76
+ }
77
+
78
+ $action_control->render_conditional_logic_call_to_action();
 
79
  }
80
 
81
  // Show Form Action Automation indicator.
classes/views/frm-form-actions/email_action.php CHANGED
@@ -39,4 +39,8 @@ class FrmEmailAction extends FrmFormAction {
39
  'event' => array( 'create' ),
40
  );
41
  }
 
 
 
 
42
  }
39
  'event' => array( 'create' ),
40
  );
41
  }
42
+
43
+ protected function get_upgrade_text() {
44
+ return __( 'Conditional emails', 'formidable' );
45
+ }
46
  }
classes/views/frm-forms/create-template-from-an-existing-form.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'You are not allowed to call this page directly.' );
4
+ }
5
+ ?><li>
6
+ <h3><?php esc_html_e( 'Create a template from an existing form', 'formidable' ); ?></h3>
7
+ <div class="dropdown frm-fields">
8
+ <button type="button" class="frm-dropdown-toggle dropdown-toggle btn btn-default" id="frm-template-drop" data-toggle="dropdown" style="width:auto">
9
+ <?php esc_html_e( 'Select form for new template', 'formidable' ); ?>
10
+ <b class="caret"></b>
11
+ </button>
12
+ <ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-template-drop">
13
+ <?php
14
+ if ( empty( $forms ) ) {
15
+ ?>
16
+ <li class="frm_dropdown_li">
17
+ <?php esc_html_e( 'You have not created any forms yet.', 'formidable' ); ?>
18
+ </li>
19
+ <?php
20
+ } else {
21
+ foreach ( $forms as $form ) {
22
+ ?>
23
+ <li>
24
+ <a href="#" data-formid="<?php echo esc_attr( $form->id ); ?>" class="frm-build-template" data-fullname="<?php echo esc_attr( $form->name ); ?>" tabindex="-1">
25
+ <?php echo esc_html( empty( $form->name ) ? __( '(no title)', 'formidable' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?>
26
+ </a>
27
+ </li>
28
+ <?php
29
+ unset( $form );
30
+ }
31
+ }
32
+ ?>
33
+ </ul>
34
+ </div>
35
+ </li><?php
classes/views/frm-forms/list-template.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ die( 'You are not allowed to call this page directly.' );
4
+ }
5
+
6
+ $plan_required = FrmFormsHelper::get_plan_required( $template );
7
+ $args['plan_required'] = $plan_required;
8
+ $stripped_template_name = preg_replace( '/(\sForm)?(\sTemplate)?$/', '', $template['name'] );
9
+
10
+ if ( ! empty( $template['custom'] ) ) {
11
+ $preview_base = admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' );
12
+ $preview_end = '';
13
+ } else {
14
+ $preview_base = 'https://sandbox.formidableforms.com/demos/wp-json/frm/v2/forms/';
15
+ $preview_end = '?return=html';
16
+ }
17
+ ?><li
18
+ class="frm-selectable <?php echo ! empty( $searchable ) ? 'frm-searchable-template' : ''; ?> <?php echo $plan_required ? 'frm-locked-template frm-' . esc_attr( $plan_required ) . '-template' : ''; ?>"
19
+ aria-label="<?php echo esc_attr( $stripped_template_name ); ?>"
20
+ <?php
21
+ if ( 'free' === $plan_required ) {
22
+ echo 'data-key="' . esc_attr( $template['key'] ) . '" ';
23
+ } elseif ( ! empty( $template['custom'] ) ) {
24
+ echo 'data-formid="' . absint( $template['id'] ) . '" ';
25
+ echo 'data-custom="1" ';
26
+ echo 'data-href="' . esc_url( admin_url( '?page=formidable&frm_action=duplicate&id=' . $template['id'] ) ) . '" ';
27
+ } elseif ( ! $plan_required ) {
28
+ $link = FrmFormsHelper::get_template_install_link( $template, $args );
29
+ echo 'data-rel="' . esc_url( $link['url'] ) . '" ';
30
+ }
31
+ ?>
32
+ data-preview="<?php echo esc_url( $preview_base . $template['key'] . $preview_end ); ?>"
33
+ >
34
+ <div class="frm-featured-form">
35
+ <?php
36
+ if ( $render_icon ) {
37
+ ?><div class="frm-category-icon">
38
+ <?php FrmFormsHelper::template_icon( $template['categories'] ); ?>
39
+ </div><?php
40
+ }
41
+ ?><div>
42
+ <h3 role="button">
43
+ <?php if ( $plan_required ) { ?>
44
+ <svg class="frmsvg">
45
+ <use xlink:href="#frm_lock_simple"></use>
46
+ </svg>
47
+ <?php } ?>
48
+ <?php echo esc_html( $stripped_template_name ); ?>
49
+ <?php if ( $plan_required ) { ?>
50
+ <span class="frm-plan-required-tag">
51
+ <?php
52
+ echo esc_html( $plan_required );
53
+ if ( ! in_array( $plan_required, array( 'free', 'Elite' ), true ) ) {
54
+ echo esc_html( ' +' );
55
+ }
56
+ ?>
57
+ </span>
58
+ <?php } ?>
59
+ </h3>
60
+ <p role="button"><?php echo $template['description'] ? esc_html( $template['description'] ) : '<i>' . esc_html__( 'No description', 'formidable' ) . '</i>'; ?></p>
61
+ <?php
62
+ $template_is_new = strtotime( $template['released'] ) > strtotime( '-10 days' );
63
+ if ( $template_is_new && empty( $template['custom'] ) ) {
64
+ ?><div class="frm_ribbon">
65
+ <span>New</span>
66
+ </div><?php
67
+ }
68
+ ?>
69
+ </div>
70
+ </div>
71
+ </li><?php
classes/views/frm-forms/list-templates.php CHANGED
@@ -3,281 +3,80 @@ if ( ! defined( 'ABSPATH' ) ) {
3
  die( 'You are not allowed to call this page directly.' );
4
  }
5
  ?>
6
- <div class="frm_wrap" id="frm-templates-page">
7
- <?php
8
- FrmAppHelper::get_admin_header(
9
- array(
10
- 'label' => __( 'Add New Form', 'formidable' ),
11
- 'cancel_link' => '?page=formidable',
12
- )
13
- );
14
- ?>
15
- <div class="wrap">
16
- <p class="howto">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <?php
18
- printf(
19
- /* translators: %1$s: Start link HTML, %2$s: End link HTML */
20
- esc_html__( 'Save time by starting from one of our pre-made templates. They are expertly designed and configured to work right out of the box. If you don\'t find a template you like, you can always start with a %1$sblank form%2$s.', 'formidable' ),
21
- '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=add_new' ) ) . '">',
22
- '</a>'
23
- );
24
  ?>
25
- </p>
26
-
27
- <ul class="frm-featured-forms" style="margin-top:30px">
28
- <li class="frm-add-blank-form">
29
- <a class="frm-new-form-button frm-featured-form" href="#">
30
- <span class="frm-inner-circle">
31
- <?php FrmAppHelper::icon_by_class( 'frmfont frm_plus_icon' ); ?>
32
- </span>
33
- <h3><?php esc_html_e( 'Blank Form', 'formidable' ); ?></h3>
34
- </a>
35
- </li>
36
- <?php
37
- foreach ( array( 20872734, 20874748, 20882522, 20874739 ) as $template ) {
38
- if ( ! isset( $templates[ $template ] ) ) {
39
- continue;
40
- }
41
-
42
- $template = $templates[ $template ];
43
- $plan_required = FrmFormsHelper::get_plan_required( $template );
44
- $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type', 'plan_required' ) );
45
- ?>
46
- <li>
47
- <?php FrmFormsHelper::template_install_html( $link, 'frm-featured-form' ); ?>
48
- <?php FrmFormsHelper::template_icon( isset( $template['categories'] ) ? $template['categories'] : array() ); ?>
49
- <h3><?php echo esc_html( preg_replace( '/(\sForm)?(\sTemplate)?$/', '', $template['name'] ) ); ?></h3>
50
- </a>
51
- <a href="#" class="frm-preview-template" rel="https://sandbox.formidableforms.com/demos/wp-json/frm/v2/forms/<?php echo esc_attr( $template['key'] ); ?>?return=html">
52
- <span class="frm-inner-circle">
53
- <?php FrmAppHelper::icon_by_class( 'frmfont frm_search_icon' ); ?>
54
- </span>
55
- </a>
56
- </li>
57
- <?php } ?>
58
- <li>
59
- <a class="frm-featured-form" href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-import' ) ); ?>">
60
- <span class="frm-inner-circle" style="background-color:var(--orange)">
61
- <?php FrmAppHelper::icon_by_class( 'frmfont frm_upload_icon' ); ?>
62
- </span>
63
- <h3><?php esc_html_e( 'Import', 'formidable' ); ?></h3>
64
- </a>
65
- </li>
66
- </ul>
67
-
68
- <?php
69
- FrmAppHelper::show_search_box(
70
- array(
71
- 'input_id' => 'template',
72
- 'placeholder' => __( 'Search Templates', 'formidable' ),
73
- 'tosearch' => 'frm-template-row',
74
- )
75
- );
76
- ?>
77
- <p class="frm-search" style="clear:none;max-width:200px;margin-right:5px">
78
- <label class="screen-reader-text" for="filter-template-search-input">
79
- <?php esc_html_e( 'Filter', 'formidable' ); ?>
80
- </label>
81
- <span class="frmfont frm_filter_icon"></span>
82
- <select name="frm_filter_templates" id="filter-template-search-input" multiple="multiple" class="frm_multiselect frm-search-input frm-auto-search" data-tosearch="frm-template-row" data-placeholder="<?php esc_attr_e( 'Filter Templates', 'formidable' ); ?>">
83
- <?php foreach ( $categories as $cat ) { ?>
84
- <option value="<?php echo esc_attr( $cat ); ?>">
85
- <?php echo esc_html( $cat ); ?>
86
- </option>
87
- <?php } ?>
88
- </select>
89
- </p>
90
-
91
- <ul class="frm-nav-tabs">
92
- <li class="frm-tabs">
93
- <a href="#frm-premium-templates">
94
- <?php esc_html_e( 'Premium Templates', 'formidable' ); ?>
95
- </a>
96
- </li>
97
- <li class="hide-if-no-js">
98
- <a href="#frm-custom-templates">
99
- <?php esc_html_e( 'My Templates', 'formidable' ); ?>
100
- </a>
101
- </li>
102
- </ul>
103
- <div class="clear"></div>
104
-
105
- <div id="frm-premium-templates" class="hide_with_tabs">
106
- <table class="wp-list-table widefat fixed striped frm-list-templates">
107
- <tbody>
108
- <?php
109
- foreach ( $templates as $k => $template ) {
110
- if ( ! is_numeric( $k ) ) {
111
- continue;
112
- }
113
-
114
- $plan_required = FrmFormsHelper::get_plan_required( $template );
115
- $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type', 'plan_required' ) );
116
- ?>
117
- <tr class="frm-template-row <?php echo esc_attr( $link['class'] === 'install-now' ? $link['class'] : '' ); ?>" id="frm-template-<?php echo esc_attr( $template['id'] ); ?>">
118
- <td>
119
- <?php if ( strtotime( $template['released'] ) > strtotime( '-10 days' ) ) { ?>
120
- <div class="frm_ribbon">
121
- <span>New</span>
122
- </div>
123
- <?php } ?>
124
- <?php FrmFormsHelper::template_icon( isset( $template['categories'] ) ? $template['categories'] : array() ); ?>
125
- <h3><?php echo esc_html( preg_replace( '/(\sForm)?(\sTemplate)?$/', '', $template['name'] ) ); ?></h3>
126
- <p><?php echo esc_html( $template['description'] ); ?></p>
127
- <?php
128
-
129
- echo '<p class="frm_plan_required">';
130
- if ( ! empty( $plan_required ) ) {
131
- printf(
132
- /* translators: %s: Link with label */
133
- esc_html__( 'This template requires an active %s license or above.', 'formidable' ),
134
- '<a href="' . esc_url( $pricing . '&utm_content=' . $template['key'] ) . '" target="_blank" rel="noopener">' .
135
- esc_html( $plan_required ) .
136
- '</a>'
137
- );
138
- } else {
139
- // Show the description on hover too.
140
- echo esc_html( $template['description'] );
141
- }
142
- ?>
143
- </p>
144
-
145
- <?php if ( ! empty( $template['categories'] ) ) { ?>
146
- <div class="frm_hidden">
147
- <?php
148
- esc_html_e( 'Category:', 'formidable' );
149
- echo esc_html( implode( ', ', $template['categories'] ) );
150
- ?>
151
- </div>
152
- <?php } ?>
153
-
154
- <div class="frm-template-actions">
155
- <?php FrmFormsHelper::template_install_html( $link, 'button button-primary frm-button-primary' ); ?>
156
- <?php echo esc_html( $link['label'] ); ?>
157
- </a>
158
- &nbsp;
159
- <a href="#" class="frm-preview-template button frm-button-secondary" rel="<?php echo esc_url( 'https://sandbox.formidableforms.com/demos/wp-json/frm/v2/forms/' . $template['key'] . '?return=html' ); ?>">
160
- <?php esc_html_e( 'Preview', 'formidable' ); ?>
161
- </a>
162
  </div>
163
- </td>
164
- </tr>
165
- <?php unset( $template, $templates[ $k ] ); ?>
166
- <?php } ?>
167
- </tbody>
168
- </table>
169
- <?php if ( $expired ) { ?>
170
- <br/>
171
- <p class="frm_error_style">
172
- <?php echo FrmAppHelper::kses( str_replace( 'Please resave your license on the Formidable Global Settings page to refresh this message.', '', $error ), 'a' ); // WPCS: XSS ok. ?>
173
-
174
- <br/>
175
- <a href="#" id="frm_reconnect_link" class="frm-show-authorized" data-refresh="1">
176
- <?php esc_html_e( 'Check now for a recent upgrade or renewal', 'formidable' ); ?>
177
- </a>
178
- </p>
179
  <?php } ?>
180
- </div>
181
-
182
- <div id="frm-custom-templates" class="hide_with_tabs frm_hidden">
183
-
184
- <h3><?php esc_html_e( 'Create a template from an existing form', 'formidable' ); ?></h3>
185
- <div class="dropdown frm-fields">
186
- <button type="button" class="frm-dropdown-toggle dropdown-toggle btn btn-default" id="frm-template-drop" data-toggle="dropdown" style="width:auto">
187
- <?php esc_html_e( 'Select form for new template', 'formidable' ); ?>
188
- <b class="caret"></b>
189
- </button>
190
- <ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-template-drop">
191
- <?php
192
- if ( empty( $forms ) ) {
193
- ?>
194
- <li class="frm_dropdown_li">
195
- <?php esc_html_e( 'You have not created any forms yet.', 'formidable' ); ?>
196
- </li>
197
- <?php
198
- } else {
199
- foreach ( $forms as $form ) {
200
- ?>
201
- <li>
202
- <a href="#" data-formid="<?php echo esc_attr( $form->id ); ?>" class="frm-build-template" data-fullname="<?php echo esc_attr( $form->name ); ?>" tabindex="-1">
203
- <?php echo esc_html( empty( $form->name ) ? __( '(no title)', 'formidable' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?>
204
- </a>
205
- </li>
206
- <?php
207
- unset( $form );
208
- }
209
- }
210
- ?>
211
- </ul>
212
- </div>
213
-
214
- <h3 class="frm-nav-tabs" style="padding-bottom:10px;margin-top:30px">
215
- <?php esc_html_e( 'My Templates', 'formidable' ); ?>
216
- </h3>
217
- <table class="wp-list-table widefat fixed striped frm-list-templates">
218
- <tbody>
219
- <?php
220
- if ( empty( $custom_templates ) ) {
221
- ?>
222
- <tr class="frm-template-row">
223
- <td>
224
- <span class="frm-inner-circle">
225
- <?php FrmAppHelper::icon_by_class( 'frmfont frm_tooltip_icon' ); ?>
226
- </span>
227
- <h3><?php esc_html_e( 'You do not have any custom templates yet.', 'formidable' ); ?></h3>
228
- <p style="display:block">
229
- <a href="<?php
230
- echo esc_url(
231
- FrmAppHelper::admin_upgrade_link(
232
- array(
233
- 'anchor' => 'kb-how-to-create-a-template-from-a-form',
234
- 'medium' => 'form-templates',
235
- 'content' => 'create-template',
236
- ),
237
- 'knowledgebase/create-a-form/'
238
- )
239
- ); // phpcs:ignore Generic.WhiteSpace.ScopeIndent
240
- ?>"
241
- target="_blank" rel="noopener">
242
- <?php esc_html_e( 'Learn how to create custom form templates.', 'formidable' ); ?>
243
- </a>
244
- </p>
245
- </td>
246
- </tr>
247
- <?php
248
- }
249
-
250
- foreach ( $custom_templates as $k => $template ) {
251
- $link = FrmFormsHelper::get_template_install_link( $template, compact( 'pricing', 'license_type', 'plan_required' ) );
252
- ?>
253
- <tr class="frm-template-row" id="frm-template-custom-<?php echo esc_attr( $template['id'] ); ?>">
254
- <td>
255
- <?php FrmFormsHelper::template_icon( array() ); ?>
256
- <h3><?php echo esc_html( $template['name'] ); ?></h3>
257
- <p style="display:block"><?php echo esc_html( $template['description'] ); ?></p>
258
-
259
- <div class="frm-template-actions">
260
- <a href="#" class="frm-trash-template frm-trash" data-frmdelete="trash-template" data-id="<?php echo esc_attr( $template['id'] ); ?>" data-trashtemplate="1" data-frmverify="<?php esc_attr_e( 'Delete this form template?', 'formidable' ); ?>">
261
- <?php esc_html_e( 'Delete', 'formidable' ); ?>
262
- </a>
263
- &nbsp;
264
- <a class="button button-primary frm-button-primary" href="<?php echo esc_attr( $template['url'] ); ?>" aria-label="<?php esc_attr_e( 'Create Form', 'formidable' ); ?>">
265
- <?php esc_html_e( 'Create Form', 'formidable' ); ?>
266
- </a>
267
- &nbsp;
268
- <a href="#" class="frm-preview-template button frm-button-secondary" rel="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $template['key'] ) ); ?>">
269
- <?php esc_html_e( 'Preview', 'formidable' ); ?>
270
- </a>
271
- </div>
272
- </td>
273
- </tr>
274
- <?php unset( $template, $templates[ $k ] ); ?>
275
- <?php } ?>
276
- </tbody>
277
- </table>
278
- </div>
279
-
280
- <?php include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/template-name-overlay.php' ); ?>
281
- <div class="clear"></div>
282
- </div>
283
  </div>
3
  die( 'You are not allowed to call this page directly.' );
4
  }
5
  ?>
6
+ <ul class="frm-templates-list frm-featured-forms">
7
+ <li class="frm-add-blank-form frm-selectable">
8
+ <div class="frm-featured-form">
9
+ <div class="frm-category-icon" style="background-color: #F4AD3D;">
10
+ <?php FrmAppHelper::icon_by_class( 'frmfont frm_plus_icon' ); ?>
11
+ </div><div>
12
+ <h3 role="button"><?php esc_html_e( 'Blank Form', 'formidable' ); ?></h3>
13
+ <p role="button"><?php esc_html_e( 'Create a new form from scratch', 'formidable' ); ?></p>
14
+ </div>
15
+ </div>
16
+ </li><?php
17
+ $render_icon = true;
18
+ foreach ( array( 20872734, 20874748, 20882522, 20874739 ) as $template ) {
19
+ if ( isset( $templates[ $template ] ) ) {
20
+ $template = $templates[ $template ];
21
+ require $view_path . 'list-template.php';
22
+ }
23
+ }
24
+ ?><li class="frm-selectable" data-href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-import' ) ); ?>">
25
+ <div class="frm-featured-form">
26
+ <div class="frm-category-icon" style="background-color: #805EF6;">
27
+ <?php FrmAppHelper::icon_by_class( 'frmfont frm_upload_icon' ); ?>
28
+ </div><div>
29
+ <h3 role="button"><?php esc_html_e( 'Import', 'formidable' ); ?></h3>
30
+ <p role="button"><?php esc_html_e( 'Upload your Formidable XML or CSV file to import forms.', 'formidable' ); ?></p>
31
+ </div>
32
+ </div>
33
+ </li>
34
+ </ul>
35
+ <?php
36
+ FrmAppHelper::show_search_box(
37
+ array(
38
+ 'input_id' => 'template',
39
+ 'placeholder' => __( 'Search Templates', 'formidable' ),
40
+ 'tosearch' => 'frm-searchable-template',
41
+ )
42
+ );
43
+ ?>
44
+ <div tabindex="0" class="accordion-container">
45
+ <ul class="frm-templates-list frm-categories-list">
46
+ <?php foreach ( $categories as $category ) { ?>
47
  <?php
48
+ $category_templates = $templates_by_category[ $category ];
49
+ $count = count( $category_templates );
50
+ $available = FrmFormsHelper::available_count( $category_templates, $args );
 
 
 
51
  ?>
52
+ <li class="control-section accordion-section">
53
+ <div class="frm-featured-form">
54
+ <div class="frm-category-icon" style="background-color: #805EF6;">
55
+ <?php FrmFormsHelper::template_icon( array( $category ) ); ?>
56
+ </div><div>
57
+ <div role="button" class="accordion-section-title">
58
+ <h3><?php echo esc_attr( $category ); ?></h3>
59
+ <p><span class="frm-template-count"><?php echo esc_html( $count ); ?></span> <span class="frm-templates-plural <?php echo $count === 1 ? 'frm_hidden' : ''; ?>"><?php esc_html_e( 'templates', 'formidable' ); ?></span><span class="frm-templates-singular <?php echo $count !== 1 ? 'frm_hidden' : ''; ?>"><?php esc_html_e( 'template', 'formidable' ); ?></span><?php echo $available !== $count ? '&nbsp;&nbsp;|&nbsp;&nbsp;<span class="frm-available-templates-count">' . esc_html( $available ) . '</span> ' . esc_html__( 'available', 'formidable' ) : ''; ?></p>
60
+ </div>
61
+ <div class="accordion-section-content" aria-expanded="false">
62
+ <ul>
63
+ <?php
64
+ if ( $my_templates_translation === $category ) {
65
+ require $view_path . 'create-template-from-an-existing-form.php';
66
+ }
67
+
68
+ $searchable = true;
69
+ $render_icon = false;
70
+ foreach ( $category_templates as $category_template ) {
71
+ $template = $category_template;
72
+ require $view_path . 'list-template.php';
73
+ }
74
+ ?>
75
+ </ul>
76
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  </div>
78
+ </div>
79
+ </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  <?php } ?>
81
+ </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  </div>
classes/views/frm-forms/list.php CHANGED
@@ -7,9 +7,9 @@ if ( ! defined( 'ABSPATH' ) ) {
7
  <?php
8
  FrmAppHelper::get_admin_header(
9
  array(
10
- 'label' => $params['template'] ? __( 'Templates', 'formidable' ) : __( 'Forms', 'formidable' ),
11
- 'new_link' => ( ! $params['template'] && current_user_can( 'frm_edit_forms' ) ) ? '?page=formidable&frm_action=add_new' : '',
12
- 'import_link' => true,
13
  )
14
  );
15
  ?>
7
  <?php
8
  FrmAppHelper::get_admin_header(
9
  array(
10
+ 'label' => $params['template'] ? __( 'Templates', 'formidable' ) : __( 'Forms', 'formidable' ),
11
+ 'trigger_new_form_modal' => ! $params['template'] && current_user_can( 'frm_edit_forms' ),
12
+ 'import_link' => true,
13
  )
14
  );
15
  ?>
classes/views/frm-forms/new-form-overlay.php CHANGED
@@ -3,41 +3,181 @@ if ( ! defined( 'ABSPATH' ) ) {
3
  die( 'You are not allowed to call this page directly.' );
4
  }
5
  ?>
6
- <div id="frm_<?php echo esc_attr( $type ); ?>_modal" class="frm_hidden settings-lite-cta">
7
  <div class="metabox-holder">
8
  <div class="postbox">
9
- <div class="inside">
10
- <div class="cta-inside">
11
-
12
- <form name="frm-new-<?php echo esc_attr( $type ); ?>" id="frm-new-<?php echo esc_attr( $type ); ?>" method="post" class="field-group">
13
- <p>
14
- <label for="frm_template_name" id="frm_new_name" data-template="<?php esc_attr_e( 'Template Name', 'formidable' ); ?>" data-form="<?php esc_html_e( 'Form Name', 'formidable' ); ?>">
15
- <?php esc_html_e( 'Form Name', 'formidable' ); ?>
16
- </label><br/>
17
- <input type="text" name="template_name" id="frm_template_name" class="frm_long_input" />
18
- </p>
19
-
20
- <p>
21
- <label for="frm_template_desc" id="frm_new_desc" data-template="<?php esc_attr_e( 'Template Description', 'formidable' ); ?>" data-form="<?php esc_html_e( 'Form Description', 'formidable' ); ?>">
22
- <?php esc_html_e( 'Form Description', 'formidable' ); ?>
23
- </label>
24
- <span class="frm-sub-label"><?php esc_html_e( '(optional)', 'formidable' ); ?></span>
25
- <br/>
26
- <textarea name="template_desc" id="frm_template_desc" class="frm_long_input"></textarea>
27
- </p>
28
- <input type="hidden" name="link" id="frm_link" value="" />
29
- <input type="hidden" name="type" id="frm_action_type" value="frm_install_<?php echo esc_attr( $type ); ?>" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
- <button type="submit" class="button-primary frm-button-primary">
32
- <?php esc_html_e( 'Create', 'formidable' ); ?>
33
- </button>
 
 
 
 
 
 
 
34
 
35
- <a href="#" class="dismiss">
36
- <?php esc_attr_e( 'Cancel', 'formidable' ); ?>
37
- </a>
38
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  </div>
42
  </div>
43
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  die( 'You are not allowed to call this page directly.' );
4
  }
5
  ?>
6
+ <div id="frm_new_form_modal" class="frm_hidden <?php echo esc_attr( $modal_class ); ?>" frm-page="create">
7
  <div class="metabox-holder">
8
  <div class="postbox">
9
+ <div>
10
+ <div>
11
+ <span role="button" class="frm-modal-back" title="<?php esc_html_e( 'Back', 'formidable' ); ?>">
12
+ <svg class="frmsvg">
13
+ <use xlink:href="#frm_back"></use>
14
+ </svg>
15
+ </span>
16
+ <span id="frm-create-title">
17
+ <span frm-type="form"><?php esc_html_e( 'Create new form', 'formidable' ); ?></span>
18
+ <span frm-type="template"><?php esc_html_e( 'Create new template', 'formidable' ); ?></span>
19
+ </span>
20
+ <span id="frm-upgrade-title">
21
+