Formidable Forms – Form Builder for WordPress - Version 2.0.19

Version Description

  • Add CSV export to free version
  • Add page with list of add-ons
  • Set up base for allowing affiliate links inside the free version
  • Pro Features:
  • Updating improvements
  • Add show_image=1 and add_link=1 to file upload field shortcode
  • Show draft, pending, and private posts for creator and admin in frm-entry-links shortcode
  • Make sure Number fields perform calc when shown
  • Include embedded fields in CSV export
  • Deprecate the frm_csv_field_ids filter
  • Fix graph bug
  • Fix Dynamic Field filtering in Views
  • Fix JavaScript error in repeating section
  • Fix showing errors in collapsible sections
  • Hide the end divider field when needed
  • Fix inline label for Dynamic dropdowns
  • Make LIKE logic case-insensitive in field ID shortcode
  • Make sure multiple file upload fields save on edit when all files are removed
  • Fix conditional logic issues with extra white space
  • Fix LIKE conditional logic issues with arrays and number values
  • Fix calcs with edit in-place
Download this release

Release Info

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

Code changes from version 2.0.18 to 2.0.19

Files changed (46) hide show
  1. classes/controllers/FrmAddonsController.php +59 -1
  2. classes/controllers/FrmAppController.php +35 -6
  3. classes/controllers/FrmEntriesController.php +2 -2
  4. classes/controllers/FrmFieldsController.php +1 -7
  5. classes/controllers/FrmHooksController.php +5 -5
  6. classes/controllers/FrmSettingsController.php +1 -1
  7. classes/controllers/FrmStatisticsController.php +0 -19
  8. classes/controllers/FrmStylesController.php +0 -2
  9. classes/controllers/FrmXMLController.php +109 -10
  10. classes/helpers/FrmAppHelper.php +6 -5
  11. classes/helpers/FrmCSVExportHelper.php +306 -0
  12. classes/helpers/FrmListHelper.php +0 -1
  13. classes/models/FrmAddon.php +117 -21
  14. classes/models/{EDD_SL_Plugin_Updater.php → FrmEDD_SL_Plugin_Updater.php} +2 -107
  15. classes/models/FrmEntryMeta.php +14 -13
  16. classes/models/FrmSettings.php +1 -1
  17. classes/views/addons/list.php +46 -0
  18. classes/views/addons/settings.php +6 -2
  19. classes/views/frm-form-actions/_email_settings.php +0 -1
  20. classes/views/frm-settings/license_box.php +2 -2
  21. classes/views/frm-statistics/list.php +0 -18
  22. classes/views/frm-statistics/list_displays.php +0 -17
  23. classes/views/shared/form-nav.php +9 -25
  24. classes/views/shared/mb_adv_info.php +4 -5
  25. classes/views/shared/update_message.php +0 -4
  26. classes/views/styles/manage.php +1 -1
  27. classes/views/xml/import_form.php +4 -14
  28. css/_single_theme.css.php +11 -11
  29. css/custom_theme.css.php +6 -6
  30. css/frm_admin.css +11 -1
  31. formidable.php +1 -1
  32. js/formidable.js +119 -54
  33. js/formidable.min.js +63 -62
  34. js/formidable_admin.js +77 -39
  35. languages/formidable-da_DK.po +12 -12
  36. languages/formidable-de_DE.po +12 -12
  37. languages/formidable-en_US.po +398 -444
  38. languages/formidable-es_ES.po +12 -12
  39. languages/formidable-fr_FR.po +13 -13
  40. languages/formidable-it_IT.po +12 -12
  41. languages/formidable-nl_NL.po +12 -12
  42. languages/formidable-pl_PL.po +12 -12
  43. languages/formidable-pt_BR.po +12 -12
  44. languages/formidable-sr_RS.po +12 -12
  45. languages/formidable-sv_SE.po +16 -16
  46. readme.txt +28 -6
classes/controllers/FrmAddonsController.php CHANGED
@@ -2,7 +2,35 @@
2
 
3
  class FrmAddonsController {
4
 
5
- public static function show_addons() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  $plugins = apply_filters( 'frm_installed_addons', array() );
7
  if ( empty( $plugins ) ) {
8
  _e( 'There are no plugins on your site that require a license', 'formidable' );
@@ -11,4 +39,34 @@ class FrmAddonsController {
11
 
12
  include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' );
13
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
2
 
3
  class FrmAddonsController {
4
 
5
+ public static function menu() {
6
+ add_submenu_page( 'formidable', 'Formidable | '. __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
7
+ }
8
+
9
+ public static function list_addons() {
10
+ $installed_addons = apply_filters( 'frm_installed_addons', array() );
11
+
12
+ $pro_link = 'http://formidablepro.com/pricing';
13
+ $addons = self::get_api_addons();
14
+ if ( ! is_array( $addons ) ) {
15
+ $addons = array(
16
+ array( 'url' => $pro_link, 'name' => 'Formidable Pro', 'slug' => 'formidable_pro' ),
17
+ );
18
+ } else {
19
+ $addons = $addons['products'];
20
+ }
21
+ $addons = array_reverse( $addons );
22
+ $append_affiliate = FrmAppHelper::affiliate();
23
+
24
+ $plugin_names = array(
25
+ 'formidable-pro' => 'formidable/pro', 'wp-multilingual' => 'formidable-wpml',
26
+ 'registration-lite' => 'formidable-registration', 'bootstrap-modal' => 'formidable-modal',
27
+ 'paypal-standard' => 'formidable-paypal', 'formidable-api' => 'formidable-api',
28
+ );
29
+
30
+ include( FrmAppHelper::plugin_path() . '/classes/views/addons/list.php' );
31
+ }
32
+
33
+ public static function license_settings() {
34
  $plugins = apply_filters( 'frm_installed_addons', array() );
35
  if ( empty( $plugins ) ) {
36
  _e( 'There are no plugins on your site that require a license', 'formidable' );
39
 
40
  include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' );
41
  }
42
+
43
+ private static function get_api_addons() {
44
+ $addons = get_transient( 'frm_api_addons' );
45
+ if ( $addons !== false ) {
46
+ return $addons;
47
+ }
48
+
49
+ $url = 'https://formidablepro.com/edd-api/products?number=40';
50
+
51
+ $arg_array = array(
52
+ 'body' => array(
53
+ 'url' => home_url(),
54
+ ),
55
+ 'timeout' => 15,
56
+ 'sslverify' => false,
57
+ 'user-agent' => 'Formidable/' . FrmAppHelper::$plug_version . '; ' . home_url(),
58
+ );
59
+
60
+ $response = wp_remote_post( $url, $arg_array );
61
+ $body = wp_remote_retrieve_body( $response );
62
+ if ( ! is_wp_error( $response ) && ! is_wp_error( $body ) ) {
63
+ $addons = json_decode( $body, true );
64
+ set_transient( 'frm_api_addons', $addons, 60 * 60 * 24 * 5 ); // check every 5 days
65
+ if ( is_array( $addons ) ) {
66
+ return $addons;
67
+ }
68
+ }
69
+
70
+ return false;
71
+ }
72
  }
classes/controllers/FrmAppController.php CHANGED
@@ -32,6 +32,9 @@ class FrmAppController {
32
  }
33
 
34
  $current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
 
 
 
35
 
36
  if ( $form ) {
37
  FrmForm::maybe_get_form( $form );
@@ -45,9 +48,40 @@ class FrmAppController {
45
  $form = $id = false;
46
  }
47
 
 
 
48
  include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  // Adds a settings link to the plugins page
52
  public static function settings_link( $links ) {
53
  $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
@@ -72,7 +106,7 @@ class FrmAppController {
72
  <?php
73
  echo wp_kses_post( apply_filters( 'frm_pro_update_msg',
74
  sprintf(
75
- __( 'This site has been previously authorized to run Formidable Forms.<br/>%1$sInstall the pro version%2$s or %3$sdeauthorize%4$s this site to continue running the free version and remove this message.', 'formidable' ),
76
  '<a href="' . esc_url( $inst_install_url ) . '" target="_blank">', '</a>',
77
  '<a href="#" class="frm_deauthorize_link">', '</a>'
78
  ), esc_url( $inst_install_url )
@@ -324,11 +358,6 @@ class FrmAppController {
324
  return $content;
325
  }
326
 
327
- public static function update_message( $features ) {
328
- _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::update_message' );
329
- return FrmAppHelper::update_message( $features );
330
- }
331
-
332
  public static function deauthorize() {
333
  check_ajax_referer( 'frm_ajax', 'nonce' );
334
 
32
  }
33
 
34
  $current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
35
+ if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) {
36
+ $current_page = 'frm_display';
37
+ }
38
 
39
  if ( $form ) {
40
  FrmForm::maybe_get_form( $form );
48
  $form = $id = false;
49
  }
50
 
51
+ $nav_items = self::get_form_nav_items( $id );
52
+
53
  include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
  }
55
 
56
+ private static function get_form_nav_items( $id ) {
57
+ $nav_items = array(
58
+ array(
59
+ 'link' => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . absint( $id ) ),
60
+ 'label' => __( 'Build', 'formidable' ),
61
+ 'current' => array( 'edit', 'new', 'duplicate' ),
62
+ 'page' => 'formidable',
63
+ 'permission' => 'frm_edit_forms',
64
+ ),
65
+ array(
66
+ 'link' => admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . absint( $id ) ),
67
+ 'label' => __( 'Settings', 'formidable' ),
68
+ 'current' => array( 'settings' ),
69
+ 'page' => 'formidable',
70
+ 'permission' => 'frm_edit_forms',
71
+ ),
72
+ array(
73
+ 'link' => admin_url( 'admin.php?page=formidable-entries&frm_action=list&form=' . absint( $id ) ),
74
+ 'label' => __( 'Entries', 'formidable' ),
75
+ 'current' => array(),
76
+ 'page' => 'formidable-entries',
77
+ 'permission' => 'frm_view_entries',
78
+ ),
79
+ );
80
+
81
+ $nav_items = apply_filters( 'frm_form_nav_list', $nav_items, array( 'form_id' => $id ) );
82
+ return $nav_items;
83
+ }
84
+
85
  // Adds a settings link to the plugins page
86
  public static function settings_link( $links ) {
87
  $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
106
  <?php
107
  echo wp_kses_post( apply_filters( 'frm_pro_update_msg',
108
  sprintf(
109
+ __( 'This site has been previously authorized to run Formidable Forms.<br/>%1$sInstall Formidable Pro%2$s or %3$sdeauthorize%4$s this site to continue running the free version and remove this message.', 'formidable' ),
110
  '<a href="' . esc_url( $inst_install_url ) . '" target="_blank">', '</a>',
111
  '<a href="#" class="frm_deauthorize_link">', '</a>'
112
  ), esc_url( $inst_install_url )
358
  return $content;
359
  }
360
 
 
 
 
 
 
361
  public static function deauthorize() {
362
  check_ajax_referer( 'frm_ajax', 'nonce' );
363
 
classes/controllers/FrmEntriesController.php CHANGED
@@ -56,8 +56,8 @@ class FrmEntriesController {
56
 
57
  $screen->set_help_sidebar(
58
  '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
59
- '<p><a href="http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
60
- '<p><a href="http://formidablepro.com/help-topics/" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
61
  );
62
 
63
  return $help;
56
 
57
  $screen->set_help_sidebar(
58
  '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
59
+ '<p><a href="http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' . FrmAppHelper::affiliate() . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
60
+ '<p><a href="http://formidablepro.com/help-topics/' . FrmAppHelper::affiliate() . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
61
  );
62
 
63
  return $help;
classes/controllers/FrmFieldsController.php CHANGED
@@ -540,7 +540,7 @@ class FrmFieldsController {
540
  self::add_html_size($field, $add_html);
541
  self::add_html_length($field, $add_html);
542
  self::add_html_placeholder($field, $add_html, $class);
543
- self::add_validation_messages( $field, $add_html );
544
 
545
  $class = apply_filters('frm_field_classes', implode(' ', $class), $field);
546
 
@@ -725,10 +725,4 @@ class FrmFieldsController {
725
 
726
  return $opt;
727
  }
728
-
729
- public static function add_conditional_update_msg() {
730
- echo '<tr><td colspan="2">';
731
- FrmAppHelper::update_message( 'calculate and conditionally hide and show fields' );
732
- echo '</td></tr>';
733
- }
734
  }
540
  self::add_html_size($field, $add_html);
541
  self::add_html_length($field, $add_html);
542
  self::add_html_placeholder($field, $add_html, $class);
543
+ //self::add_validation_messages( $field, $add_html ); uncomment this when the js validation is complete
544
 
545
  $class = apply_filters('frm_field_classes', implode(' ', $class), $field);
546
 
725
 
726
  return $opt;
727
  }
 
 
 
 
 
 
728
  }
classes/controllers/FrmHooksController.php CHANGED
@@ -91,6 +91,9 @@ class FrmHooksController {
91
  add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
92
  register_activation_hook( FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::activation_install' );
93
 
 
 
 
94
  // Entries Controller
95
  add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
96
  add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
@@ -100,7 +103,6 @@ class FrmHooksController {
100
 
101
  // Fields Controller
102
  add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' );
103
- add_action( 'frm_field_options_form', 'FrmFieldsController::add_conditional_update_msg', 50 );
104
 
105
  // Form Actions Controller
106
  if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
@@ -123,10 +125,6 @@ class FrmHooksController {
123
  add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
124
  add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
125
 
126
- // Stats Controller
127
- add_action( 'admin_menu', 'FrmStatisticsController::menu', 24 );
128
- add_action( 'frm_form_action_reports', 'FrmStatisticsController::list_reports' );
129
-
130
  // Styles Controller
131
  add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
132
  add_action( 'admin_init', 'FrmStylesController::admin_init' );
@@ -184,6 +182,8 @@ class FrmHooksController {
184
  add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmStylesController::load_saved_css' );
185
 
186
  // XML Controller
 
 
187
  add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
188
  }
189
 
91
  add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
92
  register_activation_hook( FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::activation_install' );
93
 
94
+ // Addons Controller
95
+ add_action( 'admin_menu', 'FrmAddonsController::menu', 100 );
96
+
97
  // Entries Controller
98
  add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
99
  add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
103
 
104
  // Fields Controller
105
  add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' );
 
106
 
107
  // Form Actions Controller
108
  if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
125
  add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
126
  add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
127
 
 
 
 
 
128
  // Styles Controller
129
  add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
130
  add_action( 'admin_init', 'FrmStylesController::admin_init' );
182
  add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmStylesController::load_saved_css' );
183
 
184
  // XML Controller
185
+ add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' );
186
+ add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' );
187
  add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
188
  }
189
 
classes/controllers/FrmSettingsController.php CHANGED
@@ -26,7 +26,7 @@ class FrmSettingsController {
26
  $sections = array();
27
  if ( apply_filters( 'frm_include_addon_page', false ) ) {
28
  $sections['licenses'] = array(
29
- 'class' => 'FrmAddonsController', 'function' => 'show_addons',
30
  'name' => __( 'Plugin Licenses', 'formidable' ),
31
  );
32
  }
26
  $sections = array();
27
  if ( apply_filters( 'frm_include_addon_page', false ) ) {
28
  $sections['licenses'] = array(
29
+ 'class' => 'FrmAddonsController', 'function' => 'license_settings',
30
  'name' => __( 'Plugin Licenses', 'formidable' ),
31
  );
32
  }
classes/controllers/FrmStatisticsController.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- class FrmStatisticsController {
4
-
5
- public static function menu() {
6
- add_submenu_page( 'formidable', 'Formidable | ' . __( 'Views', 'formidable' ), '<span class="frm_inactive_menu">' . __( 'Views', 'formidable' ) . '</span>', 'administrator', 'formidable-entry-templates', 'FrmStatisticsController::list_displays' );
7
- }
8
-
9
- public static function list_reports() {
10
- add_filter( 'frm_form_stop_action_reports', '__return_true' );
11
- $form = FrmAppHelper::get_param( 'form', false, 'get', 'absint' );
12
- require( FrmAppHelper::plugin_path() . '/classes/views/frm-statistics/list.php' );
13
- }
14
-
15
- public static function list_displays() {
16
- $form = FrmAppHelper::get_param( 'form', false, 'get', 'sanitize_title' );
17
- require( FrmAppHelper::plugin_path() . '/classes/views/frm-statistics/list_displays.php' );
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/controllers/FrmStylesController.php CHANGED
@@ -128,12 +128,10 @@ class FrmStylesController {
128
  }
129
 
130
  public static function new_style( $return = '' ) {
131
- FrmAppHelper::update_message( __( 'create multiple styling templates', 'formidable' ), 'wrap' );
132
  self::load_styler('default');
133
  }
134
 
135
  public static function duplicate() {
136
- FrmAppHelper::update_message( __( 'duplicate styling templates', 'formidable' ), 'wrap' );
137
  self::load_styler('default');
138
  }
139
 
128
  }
129
 
130
  public static function new_style( $return = '' ) {
 
131
  self::load_styler('default');
132
  }
133
 
134
  public static function duplicate() {
 
135
  self::load_styler('default');
136
  }
137
 
classes/controllers/FrmXMLController.php CHANGED
@@ -56,20 +56,14 @@ class FrmXMLController {
56
  $forms = FrmForm::getAll( $where, 'name' );
57
 
58
  $export_types = apply_filters( 'frm_xml_export_types',
59
- array( 'forms' => __( 'Forms', 'formidable' ) )
60
  );
61
 
62
  $export_format = apply_filters( 'frm_export_formats', array(
63
  'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
 
64
  ) );
65
 
66
- if ( FrmAppHelper::pro_is_installed() ) {
67
- $frmpro_settings = new FrmProSettings();
68
- $csv_format = $frmpro_settings->csv_format;
69
- } else {
70
- $csv_format = 'UTF-8';
71
- }
72
-
73
  include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php');
74
  }
75
 
@@ -113,8 +107,6 @@ class FrmXMLController {
113
  }
114
  unset($file_type);
115
 
116
- //$media_id = FrmProAppHelper::upload_file('frm_import_file');
117
-
118
  if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
119
  $errors[] = __( 'XML import is not enabled on your server.', 'formidable' );
120
  self::form( $errors );
@@ -152,6 +144,8 @@ class FrmXMLController {
152
 
153
  if ( $format == 'xml' ) {
154
  self::generate_xml($type, compact('ids'));
 
 
155
  } else {
156
  do_action('frm_export_format_'. $format, compact('ids'));
157
  }
@@ -273,6 +267,111 @@ class FrmXMLController {
273
  include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php');
274
  }
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  public static function allow_mime( $mimes ) {
277
  if ( ! isset( $mimes['csv'] ) ) {
278
  // allow csv files
56
  $forms = FrmForm::getAll( $where, 'name' );
57
 
58
  $export_types = apply_filters( 'frm_xml_export_types',
59
+ array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) )
60
  );
61
 
62
  $export_format = apply_filters( 'frm_export_formats', array(
63
  'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ),
64
+ 'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ),
65
  ) );
66
 
 
 
 
 
 
 
 
67
  include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php');
68
  }
69
 
107
  }
108
  unset($file_type);
109
 
 
 
110
  if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
111
  $errors[] = __( 'XML import is not enabled on your server.', 'formidable' );
112
  self::form( $errors );
144
 
145
  if ( $format == 'xml' ) {
146
  self::generate_xml($type, compact('ids'));
147
+ } if ( $format == 'csv' ) {
148
+ self::generate_csv( compact('ids') );
149
  } else {
150
  do_action('frm_export_format_'. $format, compact('ids'));
151
  }
267
  include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php');
268
  }
269
 
270
+
271
+ public static function generate_csv( $atts ) {
272
+ $form_ids = $atts['ids'];
273
+ if ( empty( $form_ids ) ) {
274
+ wp_die( __( 'Please select a form', 'formidable' ) );
275
+ }
276
+ self::csv( reset( $form_ids ) );
277
+ }
278
+
279
+ /**
280
+ * Export to CSV
281
+ * @since 2.0.19
282
+ */
283
+ public static function csv( $form_id = false, $search = '', $fid = '' ) {
284
+ FrmAppHelper::permission_check( 'frm_view_entries' );
285
+
286
+ if ( ! $form_id ) {
287
+ $form_id = FrmAppHelper::get_param( 'form', '', 'get', 'sanitize_text_field' );
288
+ $search = FrmAppHelper::get_param( ( isset( $_REQUEST['s'] ) ? 's' : 'search' ), '', 'get', 'sanitize_text_field' );
289
+ $fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' );
290
+ }
291
+
292
+ if ( ! ini_get('safe_mode') ) {
293
+ set_time_limit(0); //Remove time limit to execute this function
294
+ $mem_limit = str_replace('M', '', ini_get('memory_limit'));
295
+ if ( (int) $mem_limit < 256 ) {
296
+ ini_set('memory_limit', '256M');
297
+ }
298
+ }
299
+
300
+ global $wpdb;
301
+
302
+ $form = FrmForm::getOne( $form_id );
303
+ $form_id = $form->id;
304
+
305
+ $form_cols = self::get_fields_for_csv_export( $form_id, $form );
306
+
307
+ $item_id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'sanitize_text_field' );
308
+ if ( ! empty( $item_id ) ) {
309
+ $item_id = explode( ',', $item_id );
310
+ }
311
+
312
+ $query = array( 'form_id' => $form_id );
313
+
314
+ if ( $item_id ) {
315
+ $query['id'] = $item_id;
316
+ }
317
+
318
+ /**
319
+ * Allows the query to be changed for fetching the entry ids to include in the export
320
+ *
321
+ * $query is the array of options to be filtered. It includes form_id, and maybe id (array of entry ids),
322
+ * and the search query. This should return an array, but it can be handled as a string as well.
323
+ */
324
+ $query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) );
325
+
326
+ $entry_ids = FrmDb::get_col( $wpdb->prefix .'frm_items it', $query );
327
+ unset( $query );
328
+
329
+ if ( empty( $entry_ids ) ) {
330
+ esc_html_e( 'There are no entries for that form.', 'formidable' );
331
+ } else {
332
+ FrmCSVExportHelper::generate_csv( compact( 'form', 'entry_ids', 'form_cols' ) );
333
+ }
334
+
335
+ wp_die();
336
+ }
337
+
338
+ /**
339
+ * Get the fields that should be included in the CSV export
340
+ *
341
+ * @since 2.0.19
342
+ *
343
+ * @param int $form_id
344
+ * @param object $form
345
+ * @return array $csv_fields
346
+ */
347
+ private static function get_fields_for_csv_export( $form_id, $form ) {
348
+ // Phase frm_csv_field_ids out by 2.01.05
349
+ $csv_field_ids = apply_filters( 'frm_csv_field_ids', '', $form_id, array( 'form' => $form ) );
350
+
351
+ if ( $csv_field_ids ) {
352
+ _deprecated_function( 'The frm_csv_field_ids filter', '2.0.19', 'the frm_csv_columns filter' );
353
+ $where = array( 'fi.type not' => FrmField::no_save_fields() );
354
+ $where[] = array( 'or' => 1, 'fi.form_id' => $form->id, 'fr.parent_form_id' => $form->id );
355
+ if ( ! is_array( $csv_field_ids ) ) {
356
+ $csv_field_ids = explode( ',', $csv_field_ids );
357
+ }
358
+ if ( ! empty( $csv_field_ids ) ) {
359
+ $where['fi.id'] = $csv_field_ids;
360
+ }
361
+ $csv_fields = FrmField::getAll( $where, 'field_order' );
362
+ } else {
363
+ $csv_fields = FrmField::get_all_for_form( $form_id, '', 'include', 'include' );
364
+ $no_export_fields = FrmField::no_save_fields();
365
+ foreach ( $csv_fields as $k => $f ) {
366
+ if ( in_array( $f->type, $no_export_fields ) ) {
367
+ unset( $csv_fields[ $k ] );
368
+ }
369
+ }
370
+ }
371
+
372
+ return $csv_fields;
373
+ }
374
+
375
  public static function allow_mime( $mimes ) {
376
  if ( ! isset( $mimes['csv'] ) ) {
377
  // allow csv files
classes/helpers/FrmAppHelper.php CHANGED
@@ -10,7 +10,7 @@ class FrmAppHelper {
10
  /**
11
  * @since 2.0
12
  */
13
- public static $plug_version = '2.0.18';
14
 
15
  /**
16
  * @since 1.07.02
@@ -57,6 +57,10 @@ class FrmAppHelper {
57
  return get_option('blogname');
58
  }
59
 
 
 
 
 
60
  /**
61
  * Get the Formidable settings
62
  *
@@ -79,10 +83,7 @@ class FrmAppHelper {
79
  * @since 2.0
80
  */
81
  public static function update_message( $features, $class = '' ) {
82
- return; // hide the upgrade messages for now
83
- if ( ! self::pro_is_installed() ) {
84
- include(self::plugin_path() .'/classes/views/shared/update_message.php');
85
- }
86
  }
87
 
88
  public static function pro_is_installed() {
10
  /**
11
  * @since 2.0
12
  */
13
+ public static $plug_version = '2.0.19';
14
 
15
  /**
16
  * @since 1.07.02
57
  return get_option('blogname');
58
  }
59
 
60
+ public static function affiliate() {
61
+ return '';
62
+ }
63
+
64
  /**
65
  * Get the Formidable settings
66
  *
83
  * @since 2.0
84
  */
85
  public static function update_message( $features, $class = '' ) {
86
+ _deprecated_function( __FUNCTION__, '2.0.19' );
 
 
 
87
  }
88
 
89
  public static function pro_is_installed() {
classes/helpers/FrmCSVExportHelper.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmCSVExportHelper{
4
+ protected static $separator = ', ';
5
+ protected static $column_separator = ',';
6
+ protected static $line_break = 'return';
7
+ protected static $charset = 'UTF-8';
8
+ protected static $to_encoding = 'UTF-8';
9
+ protected static $wp_date_format = 'Y-m-d H:i:s';
10
+ protected static $comment_count = 0;
11
+ protected static $form_id = 0;
12
+ protected static $headings = array();
13
+ protected static $fields = array();
14
+ protected static $entry;
15
+
16
+ public static function csv_format_options() {
17
+ $formats = array( 'UTF-8', 'ISO-8859-1', 'windows-1256', 'windows-1251', 'macintosh' );
18
+ $formats = apply_filters( 'frm_csv_format_options', $formats );
19
+ return $formats;
20
+ }
21
+
22
+ public static function generate_csv( $atts ) {
23
+ global $frm_vars;
24
+ $frm_vars['prevent_caching'] = true;
25
+
26
+ self::$fields = $atts['form_cols'];
27
+ self::$form_id = $atts['form']->id;
28
+ self::set_class_paramters();
29
+
30
+ $filename = apply_filters( 'frm_csv_filename', date( 'ymdHis', time() ) . '_' . sanitize_title_with_dashes( $atts['form']->name ) . '_formidable_entries.csv', $atts['form'] );
31
+ unset( $atts['form'], $atts['form_cols'] );
32
+
33
+ self::print_file_headers( $filename );
34
+ unset( $filename );
35
+
36
+ $comment_count = FrmDb::get_count(
37
+ 'frm_item_metas',
38
+ array( 'item_id' => $atts['entry_ids'], 'field_id' => 0, 'meta_value like' => '{' ),
39
+ array( 'group_by' => 'item_id', 'order_by' => 'count(*) DESC', 'limit' => 1 )
40
+ );
41
+ self::$comment_count = $comment_count;
42
+
43
+ self::prepare_csv_headings();
44
+
45
+ // fetch 20 posts at a time rather than loading the entire table into memory
46
+ while ( $next_set = array_splice( $atts['entry_ids'], 0, 20 ) ) {
47
+ self::prepare_next_csv_rows( $next_set );
48
+ }
49
+ }
50
+
51
+ private static function set_class_paramters() {
52
+ self::$separator = apply_filters( 'frm_csv_sep', self::$separator );
53
+ self::$line_break = apply_filters( 'frm_csv_line_break', self::$line_break );
54
+ self::$wp_date_format = apply_filters( 'frm_csv_date_format', self::$wp_date_format );
55
+ self::get_csv_format();
56
+ self::$charset = get_option( 'blog_charset' );
57
+
58
+ $col_sep = ( isset( $_POST['csv_col_sep'] ) && ! empty( $_POST['csv_col_sep'] ) ) ? sanitize_text_field( $_POST['csv_col_sep'] ) : self::$column_separator;
59
+ self::$column_separator = apply_filters( 'frm_csv_column_sep', $col_sep );
60
+ }
61
+
62
+ private static function print_file_headers( $filename ) {
63
+ header( 'Content-Description: File Transfer' );
64
+ header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' );
65
+ header( 'Content-Type: text/csv; charset=' . self::$charset, true );
66
+ header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date('Y' ) ) ) . ' GMT' );
67
+ header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
68
+ header( 'Cache-Control: no-cache, must-revalidate' );
69
+ header( 'Pragma: no-cache' );
70
+
71
+ do_action( 'frm_csv_headers', array( 'form_id' => self::$form_id, 'fields' => self::$fields ) );
72
+ }
73
+
74
+ public static function get_csv_format() {
75
+ self::$to_encoding = FrmAppHelper::get_post_param( 'csv_format', 'UTF-8', 'sanitize_text_field' );
76
+ }
77
+
78
+ private static function prepare_csv_headings() {
79
+ $headings = array();
80
+ self::csv_headings( $headings );
81
+ $headings = apply_filters( 'frm_csv_columns', $headings, self::$form_id );
82
+ self::$headings = $headings;
83
+
84
+ self::print_csv_row( $headings );
85
+ }
86
+
87
+ private static function csv_headings( &$headings ) {
88
+ foreach ( self::$fields as $col ) {
89
+ if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) {
90
+ $headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) );
91
+ }
92
+
93
+ $headings[ $col->id ] = strip_tags( $col->name );
94
+ }
95
+
96
+ if ( self::$comment_count ) {
97
+ for ( $i = 0; $i < self::$comment_count; $i++ ) {
98
+ $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' );
99
+ $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' );
100
+ $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' );
101
+ }
102
+ unset($i);
103
+ }
104
+
105
+ $headings['created_at'] = __( 'Timestamp', 'formidable' );
106
+ $headings['updated_at'] = __( 'Last Updated', 'formidable' );
107
+ $headings['user_id'] = __( 'Created By', 'formidable' );
108
+ $headings['updated_by'] = __( 'Updated By', 'formidable' );
109
+ $headings['is_draft'] = __( 'Draft', 'formidable' );
110
+ $headings['ip'] = __( 'IP', 'formidable' );
111
+ $headings['id'] = __( 'ID', 'formidable' );
112
+ $headings['item_key'] = __( 'Key', 'formidable' );
113
+ }
114
+
115
+ private static function prepare_next_csv_rows( $next_set ) {
116
+ // order by parent_item_id so children will be first
117
+ $entries = FrmEntry::getAll( array( 'or' => 1, 'id' => $next_set, 'parent_item_id' => $next_set ), ' ORDER BY parent_item_id DESC', '', true, false );
118
+
119
+ foreach ( $entries as $k => $entry ) {
120
+ self::$entry = $entry;
121
+ unset( $entry );
122
+
123
+ if ( self::$entry->form_id != self::$form_id ) {
124
+ self::add_repeat_field_values_to_csv( $entries );
125
+ } else {
126
+ self::prepare_csv_row();
127
+ }
128
+ }
129
+ }
130
+
131
+ private static function prepare_csv_row() {
132
+ $row = array();
133
+ self::add_field_values_to_csv( $row );
134
+ self::add_entry_data_to_csv( $row );
135
+ $row = apply_filters( 'frm_csv_row', $row, array( 'entry' => self::$entry, 'date_format' => self::$wp_date_format, 'comment_count' => self::$comment_count ) );
136
+ self::print_csv_row( $row );
137
+ }
138
+
139
+ private static function add_repeat_field_values_to_csv( &$entries ) {
140
+ if ( isset( self::$entry->metas ) ) {
141
+ // add child entries to the parent
142
+ foreach ( self::$entry->metas as $meta_id => $meta_value ) {
143
+ if ( ! is_numeric( $meta_id ) || $meta_value == '' ) {
144
+ // if the hook is being used to include field keys in the metas array,
145
+ // we need to skip the keys and only process field ids
146
+ continue;
147
+ }
148
+
149
+ if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
150
+ $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array();
151
+ } else if ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) {
152
+ // if the data is here, it should be an array but if this field has collected data
153
+ // both while inside and outside of the repeating section, it's possible this is a string
154
+ $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ];
155
+ }
156
+
157
+ //add the repeated values
158
+ $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value;
159
+ }
160
+ $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas;
161
+ }
162
+
163
+ // add the embedded form id
164
+ if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) {
165
+ $entries[ self::$entry->parent_item_id ]->embedded_fields = array();
166
+ }
167
+ $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id;
168
+ }
169
+
170
+ private static function add_field_values_to_csv( &$row ) {
171
+ foreach ( self::$fields as $col ) {
172
+ $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false;
173
+
174
+ $field_value = maybe_unserialize( $field_value );
175
+ $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator, ) );
176
+
177
+ if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] ) {
178
+ $sep_value = FrmEntriesHelper::display_value( $field_value, $col, array(
179
+ 'type' => $col->type, 'post_id' => self::$entry->post_id, 'show_icon' => false,
180
+ 'entry_id' => self::$entry->id, 'sep' => self::$separator,
181
+ 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0,
182
+ ) );
183
+ $row[ $col->id . '_label' ] = $sep_value;
184
+ unset( $sep_value );
185
+ }
186
+
187
+ $row[ $col->id ] = $field_value;
188
+
189
+ unset( $col, $field_value );
190
+ }
191
+ }
192
+
193
+ private static function add_entry_data_to_csv( &$row ) {
194
+ $row['created_at'] = FrmAppHelper::get_formatted_time( self::$entry->created_at, self::$wp_date_format, ' ' );
195
+ $row['updated_at'] = FrmAppHelper::get_formatted_time( self::$entry->updated_at, self::$wp_date_format, ' ' );
196
+ $row['user_id'] = self::$entry->user_id;
197
+ $row['updated_by'] = self::$entry->updated_by;
198
+ $row['is_draft'] = self::$entry->is_draft ? '1' : '0';
199
+ $row['ip'] = self::$entry->ip;
200
+ $row['id'] = self::$entry->id;
201
+ $row['item_key'] = self::$entry->item_key;
202
+ }
203
+
204
+ private static function print_csv_row( $rows ) {
205
+ $col_count = count( $rows );
206
+ $this_col = 0;
207
+ foreach ( $rows as $k => $row ) {
208
+ $this_col++;
209
+
210
+ if ( ! isset( self::$headings[ $k ] ) ) {
211
+ // this column has been removed from the csv, so skip it
212
+ continue;
213
+ }
214
+
215
+ if ( is_array( $row ) ) {
216
+ // implode the repeated field values
217
+ $row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) );
218
+ }
219
+
220
+ $val = self::encode_value( $row );
221
+ if ( self::$line_break != 'return' ) {
222
+ $val = str_replace( array( "\r\n", "\r", "\n" ), self::$line_break, $val );
223
+ }
224
+ echo '"' . $val . '"';
225
+ if ( $this_col != $col_count ) {
226
+ echo self::$column_separator;
227
+ }
228
+ unset( $k, $row );
229
+ }
230
+ echo "\n";
231
+ }
232
+
233
+ public static function encode_value( $line ) {
234
+ if ( $line == '' ) {
235
+ return $line;
236
+ }
237
+
238
+ $convmap = false;
239
+
240
+ switch ( self::$to_encoding ) {
241
+ case 'macintosh':
242
+ // this map was derived from the differences between the MacRoman and UTF-8 Charsets
243
+ // Reference:
244
+ // - http://www.alanwood.net/demos/macroman.html
245
+ $convmap = array(
246
+ 256, 304, 0, 0xffff,
247
+ 306, 337, 0, 0xffff,
248
+ 340, 375, 0, 0xffff,
249
+ 377, 401, 0, 0xffff,
250
+ 403, 709, 0, 0xffff,
251
+ 712, 727, 0, 0xffff,
252
+ 734, 936, 0, 0xffff,
253
+ 938, 959, 0, 0xffff,
254
+ 961, 8210, 0, 0xffff,
255
+ 8213, 8215, 0, 0xffff,
256
+ 8219, 8219, 0, 0xffff,
257
+ 8227, 8229, 0, 0xffff,
258
+ 8231, 8239, 0, 0xffff,
259
+ 8241, 8248, 0, 0xffff,
260
+ 8251, 8259, 0, 0xffff,
261
+ 8261, 8363, 0, 0xffff,
262
+ 8365, 8481, 0, 0xffff,
263
+ 8483, 8705, 0, 0xffff,
264
+ 8707, 8709, 0, 0xffff,
265
+ 8711, 8718, 0, 0xffff,
266
+ 8720, 8720, 0, 0xffff,
267
+ 8722, 8729, 0, 0xffff,
268
+ 8731, 8733, 0, 0xffff,
269
+ 8735, 8746, 0, 0xffff,
270
+ 8748, 8775, 0, 0xffff,
271
+ 8777, 8799, 0, 0xffff,
272
+ 8801, 8803, 0, 0xffff,
273
+ 8806, 9673, 0, 0xffff,
274
+ 9675, 63742, 0, 0xffff,
275
+ 63744, 64256, 0, 0xffff,
276
+ );
277
+ break;
278
+ case 'ISO-8859-1':
279
+ $convmap = array( 256, 10000, 0, 0xffff );
280
+ break;
281
+ }
282
+
283
+ if ( is_array( $convmap ) ) {
284
+ $line = mb_encode_numericentity( $line, $convmap, self::$charset );
285
+ }
286
+
287
+ if ( self::$to_encoding != self::$charset ) {
288
+ $line = iconv( self::$charset, self::$to_encoding . '//IGNORE', $line );
289
+ }
290
+
291
+ return self::escape_csv( $line );
292
+ }
293
+
294
+ /**
295
+ * Escape a " in a csv with another "
296
+ * @since 2.0
297
+ */
298
+ public static function escape_csv( $value ) {
299
+ if ( $value[0] == '=' ) {
300
+ // escape the = to prevent vulnerability
301
+ $value = "'" . $value;
302
+ }
303
+ $value = str_replace( '"', '""', $value );
304
+ return $value;
305
+ }
306
+ }
classes/helpers/FrmListHelper.php CHANGED
@@ -137,7 +137,6 @@ class FrmListHelper {
137
  }
138
 
139
  public function display_rows() {
140
- $style = '';
141
  foreach ( $this->items as $item ) {
142
  echo "\n\t", $this->single_row( $item );
143
  }
137
  }
138
 
139
  public function display_rows() {
 
140
  foreach ( $this->items as $item ) {
141
  echo "\n\t", $this->single_row( $item );
142
  }
classes/models/FrmAddon.php CHANGED
@@ -6,12 +6,15 @@ if ( ! defined( 'ABSPATH' ) ) {
6
 
7
  class FrmAddon {
8
  public $store_url = 'https://formidablepro.com';
 
9
  public $plugin_file;
 
10
  public $plugin_name;
11
  public $plugin_slug;
12
  public $option_name;
13
  public $version;
14
  public $author = 'Strategy11';
 
15
 
16
  public function __construct() {
17
 
@@ -22,6 +25,9 @@ class FrmAddon {
22
  $this->option_name = 'edd_' . $this->plugin_slug . '_license_';
23
  }
24
 
 
 
 
25
  add_filter( 'frm_installed_addons', array( &$this, 'insert_installed_addon' ) );
26
  $this->edd_plugin_updater();
27
  }
@@ -47,25 +53,45 @@ class FrmAddon {
47
 
48
  public function edd_plugin_updater() {
49
 
50
- // retrieve our license key from the DB
51
- $license = trim( get_option( $this->option_name . 'key' ) );
52
 
53
  if ( empty( $license ) ) {
54
  add_action( 'after_plugin_row_' . plugin_basename( $this->plugin_file ), array( $this, 'show_license_message' ), 10, 2 );
55
  } else {
56
- if ( ! class_exists('EDD_SL_Plugin_Updater') ) {
57
- include( dirname( __FILE__ ) . '/EDD_SL_Plugin_Updater.php' );
58
- }
59
 
60
  // setup the updater
61
- new EDD_SL_Plugin_Updater( $this->store_url, $this->plugin_file, array(
62
  'version' => $this->version,
63
  'license' => $license,
64
  'author' => $this->author,
65
- ) );
 
 
 
 
 
 
 
66
  }
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  public function show_license_message( $file, $plugin ) {
70
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
71
  echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">';
@@ -75,6 +101,57 @@ class FrmAddon {
75
  echo '</div></td></tr>';
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  public static function activate() {
79
  check_ajax_referer( 'frm_ajax', 'nonce' );
80
 
@@ -85,7 +162,7 @@ class FrmAddon {
85
  $license = stripslashes( sanitize_text_field( $_POST['license'] ) );
86
  $plugin_slug = sanitize_text_field( $_POST['plugin'] );
87
  $this_plugin = self::get_addon( $plugin_slug );
88
- update_option( $this_plugin->option_name . 'key', $license );
89
 
90
  $response = array( 'success' => false, 'message' => '' );
91
  try {
@@ -93,14 +170,27 @@ class FrmAddon {
93
 
94
  // $license_data->license will be either "valid" or "invalid"
95
  $is_valid = 'invalid';
96
- if ( is_array( $license_data ) && $license_data['license'] == 'valid' ) {
97
- $is_valid = $license_data['license'];
98
- $response['success'] = __( 'Enjoy!', 'formidable' );
99
- } else {
 
 
 
 
 
 
 
 
 
 
 
100
  $response['message'] = __( 'That license is invalid', 'formidable' );
 
 
101
  }
102
 
103
- update_option( $this_plugin->option_name . 'active', $is_valid );
104
  } catch ( Exception $e ) {
105
  $response['message'] = $e->getMessage();
106
  }
@@ -130,8 +220,7 @@ class FrmAddon {
130
  $response['message'] = $e->getMessage();
131
  }
132
 
133
- delete_option( $this_plugin->option_name . 'active' );
134
- delete_option( $this_plugin->option_name . 'key' );
135
 
136
  echo json_encode( $response );
137
  wp_die();
@@ -144,6 +233,9 @@ class FrmAddon {
144
  'item_name' => urlencode( $this->plugin_name ),
145
  'url' => home_url(),
146
  );
 
 
 
147
 
148
  $arg_array = array(
149
  'body' => $api_params,
@@ -155,27 +247,31 @@ class FrmAddon {
155
  $resp = wp_remote_post( $this->store_url, $arg_array );
156
  $body = wp_remote_retrieve_body( $resp );
157
 
 
158
  if ( is_wp_error( $resp ) ) {
159
  $message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>');
160
  if ( is_wp_error( $resp ) ) {
161
  $message .= ' '. $resp->get_error_message();
162
  }
163
- return $message;
164
  } else if ( $body == 'error' || is_wp_error( $body ) ) {
165
- return __( 'You had an HTTP error connecting to Formidable Pro\'s API', 'formidable' );
166
  } else {
167
  $json_res = json_decode( $body, true );
168
  if ( null !== $json_res ) {
169
  if ( is_array( $json_res ) && isset( $json_res['error'] ) ) {
170
- return $json_res['error'];
171
  } else {
172
- return $json_res;
173
  }
174
  } else if ( isset( $resp['response'] ) && isset( $resp['response']['code'] ) ) {
175
- return sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] .' '. $resp['body'] );
176
  }
177
  }
178
 
179
- return __( 'Your License Key was invalid', 'formidable' );
180
  }
 
 
 
 
181
  }
6
 
7
  class FrmAddon {
8
  public $store_url = 'https://formidablepro.com';
9
+ public $download_id;
10
  public $plugin_file;
11
+ public $plugin_folder;
12
  public $plugin_name;
13
  public $plugin_slug;
14
  public $option_name;
15
  public $version;
16
  public $author = 'Strategy11';
17
+ private $license;
18
 
19
  public function __construct() {
20
 
25
  $this->option_name = 'edd_' . $this->plugin_slug . '_license_';
26
  }
27
 
28
+ $this->plugin_folder = plugin_basename( $this->plugin_file );
29
+ $this->license = $this->get_license();
30
+
31
  add_filter( 'frm_installed_addons', array( &$this, 'insert_installed_addon' ) );
32
  $this->edd_plugin_updater();
33
  }
53
 
54
  public function edd_plugin_updater() {
55
 
56
+ $license = $this->license;
 
57
 
58
  if ( empty( $license ) ) {
59
  add_action( 'after_plugin_row_' . plugin_basename( $this->plugin_file ), array( $this, 'show_license_message' ), 10, 2 );
60
  } else {
 
 
 
61
 
62
  // setup the updater
63
+ $api_data = array(
64
  'version' => $this->version,
65
  'license' => $license,
66
  'author' => $this->author,
67
+ );
68
+ if ( is_numeric( $this->download_id ) ) {
69
+ $api_data['item_id'] = $this->download_id;
70
+ }
71
+
72
+ new FrmEDD_SL_Plugin_Updater( $this->store_url, $this->plugin_file, $api_data );
73
+
74
+ add_filter( 'site_transient_update_plugins', array( &$this, 'clear_expired_download' ) );
75
  }
76
  }
77
 
78
+ public function get_license() {
79
+ return trim( get_option( $this->option_name . 'key' ) );
80
+ }
81
+
82
+ public function set_license( $license ) {
83
+ update_option( $this->option_name . 'key', $license );
84
+ }
85
+
86
+ public function clear_license() {
87
+ delete_option( $this->option_name . 'active' );
88
+ delete_option( $this->option_name . 'key' );
89
+ }
90
+
91
+ public function set_active( $is_active ) {
92
+ update_option( $this->option_name . 'active', $is_active );
93
+ }
94
+
95
  public function show_license_message( $file, $plugin ) {
96
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
97
  echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">';
101
  echo '</div></td></tr>';
102
  }
103
 
104
+ public function clear_expired_download( $transient ) {
105
+ if ( ! is_object( $transient ) ) {
106
+ return $transient;
107
+ }
108
+
109
+ if ( $this->is_current_version( $transient ) ) {
110
+ //make sure it doesn't show there is an update if plugin is up-to-date
111
+ if ( isset( $transient->response[ $this->plugin_folder ] ) ) {
112
+ unset( $transient->response[ $this->plugin_folder ] );
113
+ }
114
+ } else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
115
+ $cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' );
116
+ $version_info = get_transient( $cache_key );
117
+ if ( $version_info !== false ) {
118
+ $transient->response[ $this->plugin_folder ] = $version_info;
119
+ } else {
120
+ if ( ! $this->has_been_cleared() ) {
121
+ // if the transient has expired, clear the update and trigger it again
122
+ $this->cleared_plugins();
123
+ $this->manually_queue_update();
124
+ }
125
+
126
+ unset( $transient->response[ $this->plugin_folder ] );
127
+ }
128
+ }
129
+
130
+ return $transient;
131
+ }
132
+
133
+ private function is_current_version( $transient ) {
134
+ if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
135
+ return false;
136
+ }
137
+
138
+ $response = ! isset( $transient->response ) || empty( $transient->response );
139
+ if ( $response ) {
140
+ return true;
141
+ }
142
+
143
+ return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version;
144
+ }
145
+
146
+ private function has_been_cleared() {
147
+ $last_cleared = get_option( 'frm_last_cleared' );
148
+ return ( $last_cleared < date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) );
149
+ }
150
+
151
+ private function cleared_plugins() {
152
+ update_option( 'frm_last_cleared', date('Y-m-d H:i:s') );
153
+ }
154
+
155
  public static function activate() {
156
  check_ajax_referer( 'frm_ajax', 'nonce' );
157
 
162
  $license = stripslashes( sanitize_text_field( $_POST['license'] ) );
163
  $plugin_slug = sanitize_text_field( $_POST['plugin'] );
164
  $this_plugin = self::get_addon( $plugin_slug );
165
+ $this_plugin->set_license( $license );
166
 
167
  $response = array( 'success' => false, 'message' => '' );
168
  try {
170
 
171
  // $license_data->license will be either "valid" or "invalid"
172
  $is_valid = 'invalid';
173
+ if ( is_array( $license_data ) ) {
174
+ if ( $license_data['license'] == 'valid' ) {
175
+ $is_valid = $license_data['license'];
176
+ $response['message'] = __( 'Your license has been activated. Enjoy!', 'formidable' );
177
+ $response['success'] = true;
178
+ } else if ( $license_data['license'] == 'invalid' ) {
179
+ $response['message'] = __( 'That license is invalid', 'formidable' );
180
+ }
181
+ } else if ( $license_data == 'expired' ) {
182
+ $response['message'] = __( 'That license is expired', 'formidable' );
183
+ } else if ( $license_data == 'no_activations_left' ) {
184
+ $response['message'] = __( 'That license has been used too many times', 'formidable' );
185
+ } else if ( $license_data == 'invalid_item_id' ) {
186
+ $response['message'] = __( 'Oops! That is the wrong license number for this plugin.', 'formidable' );
187
+ } else if ( $license_data == 'missing' ) {
188
  $response['message'] = __( 'That license is invalid', 'formidable' );
189
+ } else {
190
+ $response['message'] = FrmAppHelper::kses( $license_data, array( 'a' ) );
191
  }
192
 
193
+ $this_plugin->set_active( $is_valid );
194
  } catch ( Exception $e ) {
195
  $response['message'] = $e->getMessage();
196
  }
220
  $response['message'] = $e->getMessage();
221
  }
222
 
223
+ $this_plugin->clear_license();
 
224
 
225
  echo json_encode( $response );
226
  wp_die();
233
  'item_name' => urlencode( $this->plugin_name ),
234
  'url' => home_url(),
235
  );
236
+ if ( is_numeric( $this->download_id ) ) {
237
+ $api_params['item_id'] = absint( $this->download_id );
238
+ }
239
 
240
  $arg_array = array(
241
  'body' => $api_params,
247
  $resp = wp_remote_post( $this->store_url, $arg_array );
248
  $body = wp_remote_retrieve_body( $resp );
249
 
250
+ $message = __( 'Your License Key was invalid', 'formidable' );
251
  if ( is_wp_error( $resp ) ) {
252
  $message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>');
253
  if ( is_wp_error( $resp ) ) {
254
  $message .= ' '. $resp->get_error_message();
255
  }
 
256
  } else if ( $body == 'error' || is_wp_error( $body ) ) {
257
+ $message = __( 'You had an HTTP error connecting to Formidable Pro\'s API', 'formidable' );
258
  } else {
259
  $json_res = json_decode( $body, true );
260
  if ( null !== $json_res ) {
261
  if ( is_array( $json_res ) && isset( $json_res['error'] ) ) {
262
+ $message = $json_res['error'];
263
  } else {
264
+ $message = $json_res;
265
  }
266
  } else if ( isset( $resp['response'] ) && isset( $resp['response']['code'] ) ) {
267
+ $message = sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] .' '. $resp['body'] );
268
  }
269
  }
270
 
271
+ return $message;
272
  }
273
+
274
+ public function manually_queue_update(){
275
+ set_site_transient( 'update_plugins', null );
276
+ }
277
  }
classes/models/{EDD_SL_Plugin_Updater.php → FrmEDD_SL_Plugin_Updater.php} RENAMED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  * @author Pippin Williamson
15
  * @version 1.6
16
  */
17
- class EDD_SL_Plugin_Updater {
18
  private $api_url = '';
19
  private $api_data = array();
20
  private $name = '';
@@ -51,11 +51,8 @@ class EDD_SL_Plugin_Updater {
51
  * @return void
52
  */
53
  public function init() {
54
-
55
  add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
56
  add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
57
-
58
- add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
59
  }
60
 
61
  /**
@@ -79,10 +76,6 @@ class EDD_SL_Plugin_Updater {
79
  $_transient_data = new stdClass;
80
  }
81
 
82
- if ( 'plugins.php' == $pagenow && is_multisite() ) {
83
- return $_transient_data;
84
- }
85
-
86
  if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
87
 
88
  $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
@@ -108,100 +101,6 @@ class EDD_SL_Plugin_Updater {
108
  return $_transient_data;
109
  }
110
 
111
- /**
112
- * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
113
- *
114
- * @param string $file
115
- * @param array $plugin
116
- */
117
- public function show_update_notification( $file, $plugin ) {
118
-
119
- if ( ! current_user_can( 'update_plugins' ) ) {
120
- return;
121
- }
122
-
123
- if ( ! is_multisite() ) {
124
- return;
125
- }
126
-
127
- if ( $this->name != $file ) {
128
- return;
129
- }
130
-
131
- // Remove our filter on the site transient
132
- remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
133
-
134
- $update_cache = get_site_transient( 'update_plugins' );
135
-
136
- if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
137
-
138
- $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
139
- $version_info = get_transient( $cache_key );
140
-
141
- if ( false === $version_info ) {
142
-
143
- $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
144
-
145
- set_transient( $cache_key, $version_info, HOUR_IN_SECONDS );
146
- }
147
-
148
- if ( ! is_object( $version_info ) ) {
149
- return;
150
- }
151
-
152
- if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
153
-
154
- $update_cache->response[ $this->name ] = $version_info;
155
-
156
- }
157
-
158
- $update_cache->last_checked = time();
159
- $update_cache->checked[ $this->name ] = $this->version;
160
-
161
- set_site_transient( 'update_plugins', $update_cache );
162
-
163
- } else {
164
-
165
- $version_info = $update_cache->response[ $this->name ];
166
-
167
- }
168
-
169
- // Restore our filter
170
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
171
-
172
- if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
173
-
174
- // build a plugin list row, with update notification
175
- $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
176
- echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
177
-
178
- $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
179
-
180
- if ( empty( $version_info->download_link ) ) {
181
- printf(
182
- __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'edd' ),
183
- esc_html( $version_info->name ),
184
- '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
185
- esc_html( $version_info->new_version ),
186
- '</a>'
187
- );
188
- } else {
189
- printf(
190
- __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'edd' ),
191
- esc_html( $version_info->name ),
192
- '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
193
- esc_html( $version_info->new_version ),
194
- '</a>',
195
- '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
196
- '</a>'
197
- );
198
- }
199
-
200
- echo '</div></td></tr>';
201
- }
202
- }
203
-
204
-
205
  /**
206
  * Updates information on the "View version x.x details" page with custom data.
207
  *
@@ -281,17 +180,13 @@ class EDD_SL_Plugin_Updater {
281
  return;
282
  }
283
 
284
- if ( empty( $data['license'] ) ) {
285
- return;
286
- }
287
-
288
  if ( $this->api_url == home_url() ) {
289
  return false; // Don't allow a plugin to ping itself
290
  }
291
 
292
  $api_params = array(
293
  'edd_action' => 'get_version',
294
- 'license' => $data['license'],
295
  'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
296
  'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
297
  'slug' => $data['slug'],
14
  * @author Pippin Williamson
15
  * @version 1.6
16
  */
17
+ class FrmEDD_SL_Plugin_Updater {
18
  private $api_url = '';
19
  private $api_data = array();
20
  private $name = '';
51
  * @return void
52
  */
53
  public function init() {
 
54
  add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
55
  add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
 
 
56
  }
57
 
58
  /**
76
  $_transient_data = new stdClass;
77
  }
78
 
 
 
 
 
79
  if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
80
 
81
  $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
101
  return $_transient_data;
102
  }
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  /**
105
  * Updates information on the "View version x.x details" page with custom data.
106
  *
180
  return;
181
  }
182
 
 
 
 
 
183
  if ( $this->api_url == home_url() ) {
184
  return false; // Don't allow a plugin to ping itself
185
  }
186
 
187
  $api_params = array(
188
  'edd_action' => 'get_version',
189
+ 'license' => ! empty( $data['license'] ) ? $data['license'] : '',
190
  'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
191
  'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
192
  'slug' => $data['slug'],
classes/models/FrmEntryMeta.php CHANGED
@@ -68,21 +68,22 @@ class FrmEntryMeta {
68
 
69
  foreach ( $values as $field_id => $meta_value ) {
70
  // set the value for the file upload field and add new tags (in Pro version)
71
- $values = apply_filters( 'frm_prepare_data_before_db', $values, $field_id, $entry_id );
72
 
73
- if ( $prev_values && in_array($field_id, $prev_values) ) {
74
- if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) {
75
- // remove blank fields
 
76
  unset( $values[ $field_id ] );
77
- } else {
78
- // if value exists, then update it
79
- self::update_entry_meta( $entry_id, $field_id, '', $values[ $field_id ] );
80
- }
81
- } else {
82
- // if value does not exist, then create it
83
- self::add_entry_meta( $entry_id, $field_id, '', $values[ $field_id ] );
84
- }
85
- }
86
 
87
  if ( empty($prev_values) ) {
88
  return;
68
 
69
  foreach ( $values as $field_id => $meta_value ) {
70
  // set the value for the file upload field and add new tags (in Pro version)
71
+ $meta_value = apply_filters( 'frm_prepare_data_before_db', $meta_value, $field_id, $entry_id );
72
 
73
+ if ( $prev_values && in_array($field_id, $prev_values) ) {
74
+
75
+ if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) {
76
+ // remove blank fields
77
  unset( $values[ $field_id ] );
78
+ } else {
79
+ // if value exists, then update it
80
+ self::update_entry_meta( $entry_id, $field_id, '', $meta_value );
81
+ }
82
+ } else {
83
+ // if value does not exist, then create it
84
+ self::add_entry_meta( $entry_id, $field_id, '', $meta_value );
85
+ }
86
+ }
87
 
88
  if ( empty($prev_values) ) {
89
  return;
classes/models/FrmSettings.php CHANGED
@@ -75,7 +75,7 @@ class FrmSettings{
75
  */
76
  public function default_options() {
77
  return array(
78
- 'menu' => 'Formidable',
79
  'mu_menu' => 0,
80
  'preview_page_id' => 0,
81
  'use_html' => true,
75
  */
76
  public function default_options() {
77
  return array(
78
+ 'menu' => __( 'Forms', 'formidable' ),
79
  'mu_menu' => 0,
80
  'preview_page_id' => 0,
81
  'use_html' => true,
classes/views/addons/list.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h1><?php _e( 'Formidable AddOns', 'formidable' ) ?></h1>
3
+
4
+ <div id="the-list" class="frm-addons">
5
+ <?php foreach ( $addons as $addon ) {
6
+ if ( empty( $addon['info']['excerpt'] ) ) {
7
+ continue;
8
+ }
9
+
10
+ if ( isset( $plugin_names[ $addon['info']['slug'] ] ) ) {
11
+ $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[ $addon['info']['slug'] ] );
12
+ } else {
13
+ $installed = isset( $installed_addons[ $addon['info']['slug'] ] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] );
14
+ }
15
+ $has_thumbnail = ! empty( $addon['info']['thumbnail'] );
16
+ $addon['info']['link'] = $addon['info']['link'] . $append_affiliate;
17
+
18
+ ?>
19
+ <div class="plugin-card <?php echo esc_attr( $has_thumbnail ? '' : 'frm-no-thumb') ?>">
20
+ <div class="plugin-card-top">
21
+ <div class="name column-name">
22
+ <h3>
23
+ <a href="<?php echo esc_url( $addon['info']['link'] ) ?>">
24
+ <?php echo esc_html( $addon['info']['title'] ) ?>
25
+ <?php if ( $has_thumbnail ) { ?>
26
+ <img src="<?php echo esc_url( $addon['info']['thumbnail'] ) ?>" class="plugin-icon" alt="" />
27
+ <?php } ?>
28
+ </a>
29
+ </h3>
30
+ </div>
31
+ <div class="action-links">
32
+ <ul class="plugin-action-buttons">
33
+ <?php if ( $installed ) { ?>
34
+ <li><span class="button button-disabled" title="<?php esc_attr_e( 'This plugin is already installed', 'formidable' ) ?>"><?php _e( 'Installed', 'formidable' ) ?></span></li>
35
+ <?php } ?>
36
+ <li><a href="<?php echo esc_url( $addon['info']['link'] ) ?>" target="_blank" aria-label="<?php esc_attr_e( 'More Details', 'formidable' ) ?>"><?php _e( 'More Details', 'formidable' ) ?></a></li>
37
+ </ul>
38
+ </div>
39
+ <div class="desc column-description">
40
+ <p><?php echo wp_kses_post( $addon['info']['excerpt'] ) ?></p>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <?php } ?>
45
+ </div>
46
+ </div>
classes/views/addons/settings.php CHANGED
@@ -4,6 +4,10 @@
4
  <?php
5
 
6
  foreach ( $plugins as $slug => $plugin ) {
 
 
 
 
7
  $license = get_option( 'edd_'. $slug .'_license_key' );
8
  $status = get_option( 'edd_'. $slug .'_license_active' );
9
  $activate = ( false !== $license && $status == 'valid' ) ? 'deactivate' : 'activate';
@@ -13,13 +17,13 @@
13
  <div class="edd_frm_license_row">
14
  <label class="frm_left_label" for="edd_<?php echo esc_attr( $slug ) ?>_license_key"><?php echo wp_kses( sprintf( '%s license key', $plugin->plugin_name ), array() ); ?></label>
15
  <div class="edd_frm_authorized alignleft <?php echo esc_attr( $activate == 'activate' ) ? 'frm_hidden' : '' ?>">
16
- <span class="edd_frm_license"><?php echo esc_html( $license ); ?></span>
17
  <span class="frm_icon_font frm_action_icon frm_error_icon edd_frm_status_icon frm_inactive_icon"></span>
18
  <input type="button" class="button-secondary edd_frm_save_license" data-plugin="<?php echo esc_attr( $slug ) ?>" name="edd_<?php echo esc_attr( $slug ) ?>_license_deactivate" value="<?php esc_attr_e( 'Deactivate', 'formidable' ) ?>"/>
19
  <p class="frm_license_msg"></p>
20
  </div>
21
  <div class="edd_frm_unauthorized alignleft <?php echo esc_attr( $activate == 'deactivate' ) ? 'frm_hidden' : '' ?>">
22
- <input id="edd_<?php echo esc_attr( $slug ) ?>_license_key" name="edd_<?php echo esc_attr( $slug ) ?>_license_key" type="text" class="regular-text" value="<?php echo esc_attr( $license ); ?>" />
23
  <span class="frm_icon_font frm_action_icon frm_error_icon edd_frm_status_icon <?php echo esc_attr( $icon_class ); ?>"></span>
24
  <input type="button" class="button-secondary edd_frm_save_license" data-plugin="<?php echo esc_attr( $slug ) ?>" name="edd_<?php echo esc_attr( $slug ) ?>_license_activate" value="<?php esc_attr_e( 'Activate', 'formidable' ) ?>"/>
25
  <p class="frm_license_msg"></p>
4
  <?php
5
 
6
  foreach ( $plugins as $slug => $plugin ) {
7
+ if ( $slug == 'formidable_pro' ) {
8
+ continue;
9
+ }
10
+
11
  $license = get_option( 'edd_'. $slug .'_license_key' );
12
  $status = get_option( 'edd_'. $slug .'_license_active' );
13
  $activate = ( false !== $license && $status == 'valid' ) ? 'deactivate' : 'activate';
17
  <div class="edd_frm_license_row">
18
  <label class="frm_left_label" for="edd_<?php echo esc_attr( $slug ) ?>_license_key"><?php echo wp_kses( sprintf( '%s license key', $plugin->plugin_name ), array() ); ?></label>
19
  <div class="edd_frm_authorized alignleft <?php echo esc_attr( $activate == 'activate' ) ? 'frm_hidden' : '' ?>">
20
+ <span class="edd_frm_license"><?php esc_html_e( 'Good to go!', 'formidable' ); ?></span>
21
  <span class="frm_icon_font frm_action_icon frm_error_icon edd_frm_status_icon frm_inactive_icon"></span>
22
  <input type="button" class="button-secondary edd_frm_save_license" data-plugin="<?php echo esc_attr( $slug ) ?>" name="edd_<?php echo esc_attr( $slug ) ?>_license_deactivate" value="<?php esc_attr_e( 'Deactivate', 'formidable' ) ?>"/>
23
  <p class="frm_license_msg"></p>
24
  </div>
25
  <div class="edd_frm_unauthorized alignleft <?php echo esc_attr( $activate == 'deactivate' ) ? 'frm_hidden' : '' ?>">
26
+ <input id="edd_<?php echo esc_attr( $slug ) ?>_license_key" name="edd_<?php echo esc_attr( $slug ) ?>_license_key" type="text" class="regular-text" value="" />
27
  <span class="frm_icon_font frm_action_icon frm_error_icon edd_frm_status_icon <?php echo esc_attr( $icon_class ); ?>"></span>
28
  <input type="button" class="button-secondary edd_frm_save_license" data-plugin="<?php echo esc_attr( $slug ) ?>" name="edd_<?php echo esc_attr( $slug ) ?>_license_activate" value="<?php esc_attr_e( 'Activate', 'formidable' ) ?>"/>
29
  <p class="frm_license_msg"></p>
classes/views/frm-form-actions/_email_settings.php CHANGED
@@ -58,7 +58,6 @@
58
  <label for="<?php echo esc_attr( $this->get_field_id('inc_user_info') ) ?>"><input type="checkbox" name="<?php echo esc_attr( $this->get_field_name('inc_user_info') ) ?>" class="frm_not_inc_user_info" id="<?php echo esc_attr( $this->get_field_id('inc_user_info') ) ?>" value="1" <?php checked( $form_action->post_content['inc_user_info'], 1 ); ?> /> <?php _e( 'Append IP Address, Browser, and Referring URL to message', 'formidable' ) ?></label>
59
 
60
  <p><label for="<?php echo esc_attr( $this->get_field_id('plain_text') ) ?>"><input type="checkbox" name="<?php echo esc_attr( $this->get_field_name('plain_text') ) ?>" id="<?php echo esc_attr( $this->get_field_id('plain_text') ) ?>" value="1" <?php checked( $form_action->post_content['plain_text'], 1 ); ?> /> <?php _e( 'Send Emails in Plain Text', 'formidable' ) ?></label></p>
61
- <?php FrmAppHelper::update_message('conditionally send email notifications'); ?>
62
  </td>
63
  </tr>
64
  </table>
58
  <label for="<?php echo esc_attr( $this->get_field_id('inc_user_info') ) ?>"><input type="checkbox" name="<?php echo esc_attr( $this->get_field_name('inc_user_info') ) ?>" class="frm_not_inc_user_info" id="<?php echo esc_attr( $this->get_field_id('inc_user_info') ) ?>" value="1" <?php checked( $form_action->post_content['inc_user_info'], 1 ); ?> /> <?php _e( 'Append IP Address, Browser, and Referring URL to message', 'formidable' ) ?></label>
59
 
60
  <p><label for="<?php echo esc_attr( $this->get_field_id('plain_text') ) ?>"><input type="checkbox" name="<?php echo esc_attr( $this->get_field_name('plain_text') ) ?>" id="<?php echo esc_attr( $this->get_field_id('plain_text') ) ?>" value="1" <?php checked( $form_action->post_content['plain_text'], 1 ); ?> /> <?php _e( 'Send Emails in Plain Text', 'formidable' ) ?></label></p>
 
61
  </td>
62
  </tr>
63
  </table>
classes/views/frm-settings/license_box.php CHANGED
@@ -2,10 +2,10 @@
2
  <?php if ( ! is_multisite() || is_super_admin() ) { ?>
3
  <div class="postbox">
4
  <div class="inside">
5
- <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="http://formidablepro.com">', '</a>' ) ?> &#187;</p>
6
  <p><?php _e( 'Ready to take your forms to the next level?<br/>Formidable Forms will help you create views, manage data, and get reports.', 'formidable' ) ?></p>
7
 
8
- <p>Already signed up? <a href="https://formidablepro.com/knowledgebase/install-formidable-forms/" target="_blank"><?php _e( 'Click here', 'formidable' ) ?></a> to get installation instructions and download the pro version.</p>
9
  </div>
10
  </div>
11
  <?php } ?>
2
  <?php if ( ! is_multisite() || is_super_admin() ) { ?>
3
  <div class="postbox">
4
  <div class="inside">
5
+ <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="http://formidablepro.com' . esc_url( FrmAppHelper::affiliate() ) . '">', '</a>' ) ?> &#187;</p>
6
  <p><?php _e( 'Ready to take your forms to the next level?<br/>Formidable Forms will help you create views, manage data, and get reports.', 'formidable' ) ?></p>
7
 
8
+ <p>Already signed up? <a href="https://formidablepro.com/knowledgebase/install-formidable-forms/<?php echo esc_url( FrmAppHelper::affiliate() ) ?>" target="_blank"><?php _e( 'Click here', 'formidable' ) ?></a> to get installation instructions and download the pro version.</p>
9
  </div>
10
  </div>
11
  <?php } ?>
classes/views/frm-statistics/list.php DELETED
@@ -1,18 +0,0 @@
1
- <div id="form_reports_page" class="wrap">
2
- <div class="frmicon icon32"><br/></div>
3
- <h2>
4
- <?php _e( 'Reports', 'formidable' ) ?>
5
- <a href="#" class="add-new-h2 frm_invisible"><?php _e( 'Add New', 'formidable' ); ?></a>
6
- </h2>
7
-
8
- <?php
9
- if ( $form ) {
10
- FrmAppController::get_form_nav( $form, true );
11
- }
12
- require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' );
13
-
14
- FrmAppHelper::update_message( __( 'view reports and statistics on your saved entries', 'formidable' ) );
15
- ?>
16
-
17
- <img class="frm_no_reports" src="http://fp.strategy11.com/wp-content/themes/formidablepro/images/reports1.png" alt="Reports"/>
18
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/views/frm-statistics/list_displays.php DELETED
@@ -1,17 +0,0 @@
1
- <div id="form_views_page" class="wrap">
2
- <div class="frmicon icon32"><br/></div>
3
- <h2>
4
- <?php _e( 'Views', 'formidable' ); ?>
5
- <a href="#" class="add-new-h2 frm_invisible"><?php _e( 'Add New', 'formidable' ); ?></a>
6
- </h2>
7
-
8
- <?php
9
- if ( $form ) {
10
- FrmAppController::get_form_nav( $form );
11
- }
12
- require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' );
13
- FrmAppHelper::update_message( __( 'display collected data in lists, calendars, and other formats', 'formidable' ) );
14
- ?>
15
-
16
- <img class="frm_no_views" src="http://fp.strategy11.com/images/custom-display-settings.png" alt="Display"/>
17
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/views/shared/form-nav.php CHANGED
@@ -1,31 +1,15 @@
1
  <div id="titlediv">
2
  <ul class="frm_form_nav">
3
  <?php
4
- $class = ' class="first"';
5
- if ( current_user_can( 'frm_edit_forms' ) ) { ?>
6
- <li<?php echo $class ?>><a<?php FrmAppHelper::select_current_page( 'formidable', $current_page, array( 'edit', 'new', 'duplicate' ) ); ?> href="<?php echo esc_url( admin_url('admin.php?page=formidable&frm_action=edit&id='. $id) ) ?>"><?php _e( 'Build', 'formidable' ) ?></a> </li>
7
- <?php
8
- $class = '';
9
- }
10
-
11
- if ( current_user_can( 'frm_edit_forms' ) ) { ?>
12
- <li<?php echo $class ?>><a<?php FrmAppHelper::select_current_page( 'formidable', $current_page, array( 'settings' ) ); ?> href="<?php echo esc_url( admin_url('admin.php?page=formidable&frm_action=settings&id='. $id) ) ?>"><?php _e( 'Settings', 'formidable' ) ?></a> </li>
13
- <?php
14
- $class = '';
15
- } ?>
16
- <li<?php echo $class ?>> <a<?php FrmAppHelper::select_current_page( 'formidable-entries', $current_page ); ?> href="<?php echo esc_url( admin_url('admin.php?page=formidable-entries&frm_action=list&form='. $id) ) ?>"><?php _e( 'Entries', 'formidable' ) ?></a></li>
17
- <?php
18
- if ( current_user_can( 'frm_edit_displays' ) ) { ?>
19
- <li> <a<?php
20
- if ( $current_page == 'frm_display' || $pagenow == 'post.php' || $pagenow == 'post-new.php' || $current_page == 'formidable-entry-templates' ) {
21
- echo ' class="current_page"';
22
- } ?> href="<?php echo esc_url( (FrmAppHelper::pro_is_installed() ? admin_url('edit.php?post_type=frm_display') : admin_url( 'admin.php?page=formidable-entry-templates')) .'&form='. $id .'&show_nav=1' ); ?>"><?php _e( 'Views', 'formidable' ) ?></a></li>
23
- <?php
24
- }
25
 
26
- if ( current_user_can( 'frm_view_reports' ) ) { ?>
27
- <li> <a<?php FrmAppHelper::select_current_page( 'formidable', $current_page, array( 'reports' ) ); ?> href="<?php echo esc_url( admin_url('admin.php?page=formidable&frm_action=reports&form='. $id .'&show_nav=1') ) ?>"><?php _e( 'Reports', 'formidable' ) ?></a></li>
28
- <?php
 
 
 
 
 
29
  }
30
 
31
  FrmFormsHelper::form_switcher();
@@ -33,6 +17,6 @@ FrmFormsHelper::form_switcher();
33
  </ul>
34
 
35
  <?php if ( $form && $title == 'show' ) { ?>
36
- <input id="title" type="text" value="<?php echo esc_attr($form->name == '' ? __( '(no title)') : $form->name) ?>" readonly="readonly" disabled="disabled" />
37
  <?php } ?>
38
  </div>
1
  <div id="titlediv">
2
  <ul class="frm_form_nav">
3
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ $class = ' class="first"';
6
+ foreach ( $nav_items as $nav_item ) {
7
+ if ( current_user_can( $nav_item['permission'] ) ) {
8
+ ?>
9
+ <li<?php echo $class ?>><a<?php FrmAppHelper::select_current_page( $nav_item['page'], $current_page, $nav_item['current'] ); ?> href="<?php echo esc_url( $nav_item['link'] ) ?>"><?php echo esc_html( $nav_item['label'] ) ?></a> </li>
10
+ <?php
11
+ $class = '';
12
+ }
13
  }
14
 
15
  FrmFormsHelper::form_switcher();
17
  </ul>
18
 
19
  <?php if ( $form && $title == 'show' ) { ?>
20
+ <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)') : $form->name ) ?>" readonly="readonly" disabled="disabled" />
21
  <?php } ?>
22
  </div>
classes/views/shared/mb_adv_info.php CHANGED
@@ -1,7 +1,9 @@
1
  <div id="taxonomy-linkcategory" class="categorydiv <?php echo $class ?>">
2
  <ul id="category-tabs" class="category-tabs frm-category-tabs">
3
  <li class="tabs" ><a href="#frm-insert-fields-box" id="frm_insert_fields_tab"><?php _e( 'Insert Fields', 'formidable' ); ?></a></li>
 
4
  <li class="hide-if-no-js"><a href="#frm-conditionals"><?php _e( 'Conditionals', 'formidable' ); ?></a></li>
 
5
  <li class="hide-if-no-js"><a href="#frm-adv-info-tab"><?php _e( 'Advanced', 'formidable' ); ?></a></li>
6
  <?php if ( $settings_tab ) { ?>
7
  <li id="frm_html_tab" class="hide-if-no-js frm_hidden"><a href="#frm-html-tags" id="frm_html_tags_tab" ><?php _e( 'HTML Tags', 'formidable' ); ?></a></li>
@@ -88,8 +90,8 @@
88
  </ul>
89
  </div>
90
 
91
- <div id="frm-conditionals" class="tabs-panel">
92
  <?php if ( ! empty( $cond_shortcodes ) ) { ?>
 
93
  <ul class="subsubsub">
94
  <li><a href="javascript:void(0)" class="current frmids"><?php _e( 'IDs', 'formidable' ) ?></a> |</li>
95
  <li><a href="javascript:void(0)" class="frmkeys"><?php _e( 'Keys', 'formidable' ) ?></a></li>
@@ -134,10 +136,8 @@
134
  }
135
  ?>
136
  </ul>
137
- <?php } else {
138
- FrmAppHelper::update_message('use inline conditional logic');
139
- } ?>
140
  </div>
 
141
 
142
  <div id="frm-adv-info-tab" class="tabs-panel">
143
  <ul class="frm_code_list">
@@ -168,7 +168,6 @@
168
 
169
  <div class="clear"></div>
170
  <?php
171
- //FrmAppHelper::update_message('all of the advanced shortcode options');
172
 
173
  if ( isset($uid) && ! empty($user_fields) ) {
174
  $col = 'one'; ?>
1
  <div id="taxonomy-linkcategory" class="categorydiv <?php echo $class ?>">
2
  <ul id="category-tabs" class="category-tabs frm-category-tabs">
3
  <li class="tabs" ><a href="#frm-insert-fields-box" id="frm_insert_fields_tab"><?php _e( 'Insert Fields', 'formidable' ); ?></a></li>
4
+ <?php if ( ! empty( $cond_shortcodes ) ) { ?>
5
  <li class="hide-if-no-js"><a href="#frm-conditionals"><?php _e( 'Conditionals', 'formidable' ); ?></a></li>
6
+ <?php } ?>
7
  <li class="hide-if-no-js"><a href="#frm-adv-info-tab"><?php _e( 'Advanced', 'formidable' ); ?></a></li>
8
  <?php if ( $settings_tab ) { ?>
9
  <li id="frm_html_tab" class="hide-if-no-js frm_hidden"><a href="#frm-html-tags" id="frm_html_tags_tab" ><?php _e( 'HTML Tags', 'formidable' ); ?></a></li>
90
  </ul>
91
  </div>
92
 
 
93
  <?php if ( ! empty( $cond_shortcodes ) ) { ?>
94
+ <div id="frm-conditionals" class="tabs-panel">
95
  <ul class="subsubsub">
96
  <li><a href="javascript:void(0)" class="current frmids"><?php _e( 'IDs', 'formidable' ) ?></a> |</li>
97
  <li><a href="javascript:void(0)" class="frmkeys"><?php _e( 'Keys', 'formidable' ) ?></a></li>
136
  }
137
  ?>
138
  </ul>
 
 
 
139
  </div>
140
+ <?php } ?>
141
 
142
  <div id="frm-adv-info-tab" class="tabs-panel">
143
  <ul class="frm_code_list">
168
 
169
  <div class="clear"></div>
170
  <?php
 
171
 
172
  if ( isset($uid) && ! empty($user_fields) ) {
173
  $col = 'one'; ?>
classes/views/shared/update_message.php DELETED
@@ -1,4 +0,0 @@
1
- <div class="frm_update_msg <?php echo esc_attr( $class ) ?>">
2
- This plugin version does not give you access to <?php echo $features ?>.<br/>
3
- <a href="http://formidablepro.com/pricing/" target="_blank">Compare</a> our plans or enter your license number <a href="<?php echo esc_url( admin_url('admin.php?page=formidable-settings') ) ?>">here</a>
4
- </div>
 
 
 
 
classes/views/styles/manage.php CHANGED
@@ -2,7 +2,7 @@
2
  <div class="wrap">
3
  <?php FrmStylesHelper::style_menu('manage'); ?>
4
 
5
- <p><?php printf(__( 'Easily change which template your forms are using by making changes below or %1$screate a new style%2$s.', 'formidable' ), '<a href="?page=formidable-styles&frm_action=new_style">', '</a>'); ?></p>
6
 
7
  <?php include(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php'); ?>
8
 
2
  <div class="wrap">
3
  <?php FrmStylesHelper::style_menu('manage'); ?>
4
 
5
+ <p><?php printf(__( 'Easily change which template your forms are using by making changes below.', 'formidable' ), '<a href="?page=formidable-styles&frm_action=new_style">', '</a>'); ?></p>
6
 
7
  <?php include(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php'); ?>
8
 
classes/views/xml/import_form.php CHANGED