Formidable Forms – Form Builder for WordPress - Version 1.02.01

Version Description

  • Emailer now works for everyone! (hopefully)
  • Optionally Reset HTML. Just clear out the box for the HTML for that field and hit update.
  • PRO: Fixed collapsable section to use correct default HTML.
  • PRO: Only call rich text javascript on entries pages
  • PRO: A few small reports modifications. Report for the User ID field will show the percentage of your users who have submitted the form if you are allowing edits with only one submission per user.
Download this release

Release Info

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

Code changes from version 1.01.04 to 1.02.01

Files changed (51) hide show
  1. classes/controllers/FrmAppController.php +7 -15
  2. classes/controllers/FrmEntriesController.php +25 -68
  3. classes/controllers/FrmFieldsController.php +4 -6
  4. classes/controllers/FrmFormsController.php +24 -23
  5. classes/controllers/FrmSettingsController.php +2 -2
  6. classes/helpers/FrmAppHelper.php +13 -9
  7. classes/helpers/FrmEntriesHelper.php +17 -10
  8. classes/helpers/FrmFieldsHelper.php +55 -11
  9. classes/helpers/FrmFormsHelper.php +10 -8
  10. classes/models/FrmEntry.php +22 -26
  11. classes/models/FrmEntryMeta.php +7 -2
  12. classes/models/FrmField.php +26 -52
  13. classes/models/FrmForm.php +7 -6
  14. classes/models/FrmNotification.php +32 -31
  15. classes/models/FrmSettings.php +12 -0
  16. classes/models/FrmUpdate.php +3 -4
  17. classes/templates/contact.php +15 -15
  18. classes/views/frm-entries/direct.php +2 -1
  19. classes/views/frm-entries/form.php +2 -2
  20. classes/views/frm-entries/frm-entry.php +13 -13
  21. classes/views/frm-entries/list.php +2 -2
  22. classes/views/frm-entries/new.php +2 -2
  23. classes/views/frm-fields/input.php +3 -4
  24. classes/views/frm-fields/single-option.php +1 -1
  25. classes/views/frm-forms/add_field.php +24 -25
  26. classes/views/frm-forms/add_field_links.php +36 -30
  27. classes/views/frm-forms/default-templates.php +10 -10
  28. classes/views/frm-forms/edit.php +5 -5
  29. classes/views/frm-forms/footer.php +9 -2
  30. classes/views/frm-forms/form.php +27 -27
  31. classes/views/frm-forms/list.php +43 -34
  32. classes/views/frm-forms/new-field-js.php +2 -8
  33. classes/views/frm-forms/new-option-js.php +1 -1
  34. classes/views/frm-forms/new-selection.php +3 -3
  35. classes/views/frm-forms/new.php +3 -3
  36. classes/views/frm-settings/form.php +2 -2
  37. classes/views/frm-statistics/list.php +2 -2
  38. classes/views/shared/errors.php +1 -1
  39. classes/views/shared/head.php +2 -2
  40. classes/views/shared/item-table-nav.php +3 -55
  41. classes/views/shared/nav.php +3 -3
  42. classes/views/shared/pagination.php +43 -0
  43. css/frm_admin.css +20 -6
  44. css/frm_display.css +2 -1
  45. formidable.php +1 -45
  46. images/rte.gif +0 -0
  47. js/formidable.js +61 -0
  48. js/jquery/jquery.editinplace.js +2 -2
  49. js/jquery/jquery.editinplace.packed.js +2 -2
  50. js/list-items.js +0 -51
  51. readme.txt +40 -6
classes/controllers/FrmAppController.php CHANGED
@@ -27,7 +27,7 @@ class FrmAppController{
27
 
28
  // Adds a settings link to the plugins page
29
  function settings_link($links, $file){
30
- $settings = '<a href="'.admin_url('admin.php?page='.FRM_PLUGIN_NAME).'">' . __('Settings') . '</a>';
31
  array_unshift($links, $settings);
32
  return $links;
33
  }
@@ -66,26 +66,20 @@ class FrmAppController{
66
  }
67
 
68
  function head(){
69
- $css_file = array('frm_admin' => FRM_URL. '/css/frm_admin.css');
70
- $css_file = apply_filters('frm_app_css', $css_file);
71
- $js_file = FRM_URL . '/js/list-items.js';
72
- require_once(FRM_VIEWS_PATH . '/shared/head.php');
73
  }
74
 
75
  function admin_js(){
76
  wp_enqueue_script('jQuery');
77
- wp_enqueue_script('jQuery-ui-1.7.2', FRM_URL.'/js/jquery/jquery-ui-1.7.2.min.js');
78
- wp_enqueue_script('jQuery-in-place-edit-patched', FRM_URL.'/js/jquery/jquery.editinplace.packed.js');
79
-
80
- add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
81
- if ( user_can_richedit() )
82
- wp_enqueue_script('editor');
83
  add_thickbox();
84
  }
85
 
86
  function front_head(){
87
  if (IS_WPMU){
88
- $db_version = 1.0; // this is the version of the database we're moving to
89
  $old_db_version = get_option('frm_db_version');
90
  if ($db_version != $old_db_version)
91
  $this->install();
@@ -163,11 +157,9 @@ class FrmAppController{
163
  name varchar(255) default NULL,
164
  description text default NULL,
165
  form_id int(11) default NULL,
166
- parent_item_id int(11) default NULL,
167
  created_at datetime NOT NULL,
168
  PRIMARY KEY (id),
169
- KEY form_id (form_id),
170
- KEY parent_item_id (parent_item_id)
171
  ) {$charset_collate};";
172
 
173
  dbDelta($sql);
27
 
28
  // Adds a settings link to the plugins page
29
  function settings_link($links, $file){
30
+ $settings = '<a href="'.admin_url('admin.php?page='.FRM_PLUGIN_NAME).'">' . __('Settings', FRM_PLUGIN_NAME) . '</a>';
31
  array_unshift($links, $settings);
32
  return $links;
33
  }
66
  }
67
 
68
  function head(){
69
+ $css_file = FRM_URL. '/css/frm_admin.css';
70
+ $js_file = FRM_URL . '/js/formidable.js';
71
+ require(FRM_VIEWS_PATH . '/shared/head.php');
 
72
  }
73
 
74
  function admin_js(){
75
  wp_enqueue_script('jQuery');
76
+ wp_enqueue_script('jQuery-ui', FRM_URL.'/js/jquery/jquery-ui-1.7.2.min.js', '', '1.7.2');
 
 
 
 
 
77
  add_thickbox();
78
  }
79
 
80
  function front_head(){
81
  if (IS_WPMU){
82
+ $db_version = 1.01; // this is the version of the database we're moving to
83
  $old_db_version = get_option('frm_db_version');
84
  if ($db_version != $old_db_version)
85
  $this->install();
157
  name varchar(255) default NULL,
158
  description text default NULL,
159
  form_id int(11) default NULL,
 
160
  created_at datetime NOT NULL,
161
  PRIMARY KEY (id),
162
+ KEY form_id (form_id)
 
163
  ) {$charset_collate};";
164
 
165
  dbDelta($sql);
classes/controllers/FrmEntriesController.php CHANGED
@@ -4,13 +4,20 @@ class FrmEntriesController{
4
  var $views;
5
 
6
  function FrmEntriesController(){
7
- //add_action('admin_menu', array( $this, 'menu' ));
8
  }
9
 
10
  function menu(){
11
  global $frmpro_is_installed;
12
- if(!$frmpro_is_installed)
13
- add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Pro Entries', 'Pro Entries', 8, FRM_PLUGIN_NAME.'-entries',array($this,'list'));
 
 
 
 
 
 
 
14
  }
15
 
16
  function list_entries(){
@@ -22,62 +29,13 @@ class FrmEntriesController{
22
  if ($id) $form = $frm_form->getOne($id);
23
  else if ($key) $form = $frm_form->getOne($key);
24
  if (!$form or $form->is_template or $form->status == 'draft')
25
- return 'Please select a valid form';
26
  else if ($form->logged_in and !$user_ID)
27
- return 'You must log in';
28
  else
29
  return FrmEntriesController::get_form(FRM_VIEWS_PATH.'/frm-entries/frm-entry.php', $form, $title, $description);
30
  }
31
 
32
- function new_entry($form){
33
- global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $frm_recaptcha_enabled, $user_ID;
34
- $fields = $frm_field->getAll("fi.form_id='$form->id'", ' ORDER BY field_order');
35
- $values = FrmEntriesHelper::setup_new_vars($fields);
36
- $form_name = $form->name;
37
- $form_options = stripslashes_deep(unserialize($form->options));
38
- $submit = isset($form_options['submit_value'])?$form_options['submit_value']:'Submit';
39
-
40
- $params = $this->get_params($form);
41
- $message = '';
42
- $errors = '';
43
-
44
- do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
45
- if (apply_filters('frm_continue_to_new', true)){
46
- $values = FrmEntriesHelper::setup_new_vars($fields);
47
- require_once(FRM_VIEWS_PATH.'/frm-entries/new.php');
48
- }
49
- }
50
-
51
- function create($form){
52
- global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $frm_recaptcha_enabled, $user_ID;
53
- $fields = $frm_field->getAll("fi.form_id='$form->id'", ' ORDER BY field_order');
54
- $values = FrmEntriesHelper::setup_new_vars($fields);
55
- $form_name = $form->name;
56
- $form_options = stripslashes_deep(unserialize($form->options));
57
-
58
- $submit = isset($form_options['submit_value'])?$form_options['submit_value']:'Submit';
59
- $failed_message = "We're sorry. There was an error processing your responses.";
60
- $saved_message = (isset($form_options['success_msg']) && $form_options['success_msg'] != '') ? $form_options['success_msg'] :"Your responses were successfully submitted. Thank you!";
61
-
62
- $params = $this->get_params($form);
63
- $message = '';
64
-
65
- $errors = $frm_entry->validate($_POST);
66
-
67
- if( count($errors) > 0 ){
68
- $values = FrmEntriesHelper::setup_new_vars($fields);
69
- require_once(FRM_VIEWS_PATH.'/frm-entries/new.php');
70
- }else{
71
- do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
72
- if (apply_filters('frm_continue_to_create', true)){
73
- if ($frm_entry->create( $_POST )){
74
- echo $saved_message;
75
- }else
76
- echo $failed_message;
77
- }
78
- }
79
- }
80
-
81
  function get_form($filename, $form, $title, $description) {
82
  if (is_file($filename)) {
83
  ob_start();
@@ -94,25 +52,24 @@ class FrmEntriesController{
94
 
95
  if(!$form)
96
  $form = $frm_form->getAll('',' ORDER BY name',' LIMIT 1');
 
97
  $action = apply_filters('frm_show_new_entry_page','new',$form);
98
- $values = array();
99
- foreach (array('id' => '', 'form_name' => '', 'paged' => 1, 'form' => $form->id, 'form_id' => $form->id, 'field_id' => '', 'search' => '', 'sort' => '', 'sdir' => '', 'action' => $action) as $var => $default)
 
 
 
 
 
 
100
  $values[$var] = $frm_app_controller->get_param($var, $default);
 
 
 
 
101
 
102
  return $values;
103
  }
104
-
105
- function route($form=false){
106
- global $frm_app_controller;
107
- $action = $frm_app_controller->get_param('action');
108
- if (!$form)
109
- $form = $frm_app_controller->get_param('form');
110
- $action = apply_filters('frm_show_new_entry_page', $action, $form);
111
- if($action=='create')
112
- return $this->create($form);
113
- else
114
- return $this->new_entry($form);
115
- }
116
 
117
  }
118
  ?>
4
  var $views;
5
 
6
  function FrmEntriesController(){
7
+ add_action('admin_menu', array( $this, 'menu' ), 20);
8
  }
9
 
10
  function menu(){
11
  global $frmpro_is_installed;
12
+ if(!$frmpro_is_installed){
13
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' |'. __('Pro Entries', FRM_PLUGIN_NAME), __('Pro Entries', FRM_PLUGIN_NAME), 8, FRM_PLUGIN_NAME.'-entries',array($this,'list_entries'));
14
+ add_action('admin_head-'.FRM_PLUGIN_NAME.'_page_'.FRM_PLUGIN_NAME.'-entries', array($this,'head'));
15
+ }
16
+ }
17
+
18
+ function head(){
19
+ $css_file = FRM_URL. '/css/frm_admin.css';
20
+ include(FRM_VIEWS_PATH . '/shared/head.php');
21
  }
22
 
23
  function list_entries(){
29
  if ($id) $form = $frm_form->getOne($id);
30
  else if ($key) $form = $frm_form->getOne($key);
31
  if (!$form or $form->is_template or $form->status == 'draft')
32
+ return __('Please select a valid form', FRM_PLUGIN_NAME);
33
  else if ($form->logged_in and !$user_ID)
34
+ return __('You must log in', FRM_PLUGIN_NAME);
35
  else
36
  return FrmEntriesController::get_form(FRM_VIEWS_PATH.'/frm-entries/frm-entry.php', $form, $title, $description);
37
  }
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  function get_form($filename, $form, $title, $description) {
40
  if (is_file($filename)) {
41
  ob_start();
52
 
53
  if(!$form)
54
  $form = $frm_form->getAll('',' ORDER BY name',' LIMIT 1');
55
+
56
  $action = apply_filters('frm_show_new_entry_page','new',$form);
57
+ $default_values = array('id' => '', 'form_name' => '', 'paged' => 1, 'form' => $form->id, 'form_id' => $form->id, 'field_id' => '', 'search' => '', 'sort' => '', 'sdir' => '', 'action' => $action);
58
+
59
+ $posted_form_id = $frm_app_controller->get_param('form_id');
60
+ if ($posted_form_id == '')
61
+ $posted_form_id = $frm_app_controller->get_param('form');
62
+
63
+ if ($form->id == $posted_form_id){
64
+ foreach ($default_values as $var => $default)
65
  $values[$var] = $frm_app_controller->get_param($var, $default);
66
+ }else{
67
+ foreach ($default_values as $var => $default)
68
+ $values[$var] = $default;
69
+ }
70
 
71
  return $values;
72
  }
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  }
75
  ?>
classes/controllers/FrmFieldsController.php CHANGED
@@ -18,13 +18,11 @@ class FrmFieldsController{
18
  }
19
 
20
  function create(){
21
- global $frm_field, $frm_recaptcha_enabled;
22
  $field_data = $_POST['field'];
23
  $form_id = $_POST['form_id'];
24
 
25
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars($field_data, $form_id));
26
- if (isset($_POST['position']))
27
- $field_values['field_order'] = $_POST['position'];
28
 
29
  $field_id = $frm_field->create( $field_values );
30
 
@@ -142,12 +140,12 @@ class FrmFieldsController{
142
  die();
143
  }
144
 
145
-
146
  function change_type($type){
147
- global $frm_field_selection, $frmpro_is_installed;
148
 
149
  if ($frmpro_is_installed) return $type;
150
-
 
151
  $types = array_keys($frm_field_selection);
152
  if (!in_array($type, $types) && $type != 'captcha')
153
  $type = 'text';
18
  }
19
 
20
  function create(){
21
+ global $frm_field;
22
  $field_data = $_POST['field'];
23
  $form_id = $_POST['form_id'];
24
 
25
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars($field_data, $form_id));
 
 
26
 
27
  $field_id = $frm_field->create( $field_values );
28
 
140
  die();
141
  }
142
 
 
143
  function change_type($type){
144
+ global $frmpro_is_installed;
145
 
146
  if ($frmpro_is_installed) return $type;
147
+
148
+ $frm_field_selection = FrmFieldsHelper::field_selection();
149
  $types = array_keys($frm_field_selection);
150
  if (!in_array($type, $types) && $type != 'captcha')
151
  $type = 'text';
classes/controllers/FrmFormsController.php CHANGED
@@ -12,15 +12,15 @@ class FrmFormsController{
12
  }
13
 
14
  function menu(){
15
- add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Forms', 'Forms', 8, FRM_PLUGIN_NAME, array($this,'route'));
16
- add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Create a Form', 'Create a Form', 8, FRM_PLUGIN_NAME.'-new', array($this,'new_form'));
17
- add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Templates', 'Templates', 8, FRM_PLUGIN_NAME.'-templates', array($this, 'template_list'));
18
  }
19
 
20
  function head(){
21
- $css_file = array('jquery-ui-1.7.2.custom' => FRM_URL.'/css/ui-lightness/jquery-ui-1.7.2.custom.css', 'frm_admin' => FRM_URL. '/css/frm_admin.css');
22
- $js_file = array(FRM_URL . '/js/list-items.js', FRM_URL . '/js/jquery/jquery-ui-themepicker.js');
23
- require_once(FRM_VIEWS_PATH . '/shared/head.php');
24
  }
25
 
26
  function list_form(){
@@ -35,12 +35,13 @@ class FrmFormsController{
35
  }
36
 
37
  function new_form(){
38
- global $frm_app_controller, $frm_form, $frm_field_selection, $frm_recaptcha_enabled, $frm_pro_field_selection, $frmpro_is_installed;
39
 
40
  $action = $frm_app_controller->get_param('action');
41
  if ($action == 'create')
42
  return $this->create();
43
- else if ($action == 'new'){
 
44
  $values = FrmFormsHelper::setup_new_vars();
45
  $id = $frm_form->create( $values );
46
  require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
@@ -51,19 +52,20 @@ class FrmFormsController{
51
  }
52
 
53
  function create(){
54
- global $frm_app_controller, $frm_app_helper, $frm_field_selection, $frm_entry, $frm_form, $frm_field, $frm_recaptcha_enabled, $frm_pro_field_selection, $frmpro_is_installed;
55
  $errors = $frm_form->validate($_POST);
56
  $id = $frm_app_controller->get_param('id');
57
 
58
  if( count($errors) > 0 ){
 
59
  $record = $frm_form->getOne( $id );
60
  $fields = $frm_field->getAll("fi.form_id=$id", ' ORDER BY field_order');
61
- $values = $frm_app_helper->setup_edit_vars($record,'forms',$fields,true);
62
  require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
63
  }else{
64
  $items = $frm_entry->getAll('',' ORDER BY it.name');
65
  $record = $frm_form->update( $id, $_POST, true );
66
- $message = "Form was Successfully Created";
67
  $params = $this->get_params();
68
  return $this->display_forms_list($params, $message);
69
  }
@@ -99,7 +101,7 @@ class FrmFormsController{
99
  return $this->get_edit_vars($id, $errors);
100
  }else{
101
  $record = $frm_form->update( $_POST['id'], $_POST );
102
- $message = "Form was Successfully Updated";
103
  return $this->get_edit_vars($id, '', $message);
104
  }
105
  }
@@ -109,11 +111,11 @@ class FrmFormsController{
109
 
110
  $params = $this->get_params();
111
  $record = $frm_form->duplicate( $params['id'], $params['template'] );
112
- $message = ($params['template'])?('Form template was Successfully Created'):('Form was Successfully Copied');
113
  if ($record)
114
  return $this->get_edit_vars($record, '', $message, true);
115
  else
116
- return $this->display_forms_list($params, 'There was a problem creating new template.');
117
  }
118
 
119
  function page_preview(){
@@ -122,7 +124,7 @@ class FrmFormsController{
122
  $params = $this->get_params();
123
  if (!$params['form']) return;
124
  $form = $frm_form->getOne($params['form']);
125
- require_once(FRM_VIEWS_PATH.'/frm-entries/frm-entry.php');
126
  }
127
 
128
  function preview(){
@@ -138,7 +140,7 @@ class FrmFormsController{
138
 
139
  $plugin = FrmAppController::get_param('plugin');
140
  $controller = FrmAppController::get_param('controller');
141
- $key = (isset($_GET['form'])?$_GET['form']:(isset($_POST['form'])?$_POST['form']:''));
142
  $form = $frm_form->getAll("form_key='$key'",'',' LIMIT 1');
143
  if (!$form) $form = $frm_form->getAll('','',' LIMIT 1');
144
  $form_options = stripslashes_deep(maybe_unserialize($form->options));
@@ -153,7 +155,7 @@ class FrmFormsController{
153
  $params = $this->get_params();
154
  $message = '';
155
  if ($frm_form->destroy( $params['id'] ))
156
- $message = "Form was Successfully Deleted";
157
  $this->display_forms_list($params, $message, '', 1);
158
  }
159
 
@@ -267,14 +269,14 @@ class FrmFormsController{
267
  }
268
 
269
  function get_edit_vars($id, $errors = '', $message='', $create_link=false){
270
- global $frm_app_helper, $frm_field_selection, $frm_entry, $frm_form, $frm_field, $frm_recaptcha_enabled, $frm_pro_field_selection, $frmpro_is_installed;
271
  $record = $frm_form->getOne( $id );
272
  $items = $frm_entry->getAll('',' ORDER BY it.name');
273
-
274
  $fields = $frm_field->getAll("fi.form_id=$id", ' ORDER BY field_order');
275
- $values = $frm_app_helper->setup_edit_vars($record,'forms',$fields,true);
276
  if (isset($values['default_template']) && $values['default_template'])
277
- wp_die('That template cannot be edited');
278
  else if($create_link)
279
  require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
280
  else
@@ -291,8 +293,7 @@ class FrmFormsController{
291
  }
292
 
293
  function route(){
294
- global $frm_app_controller;
295
- $action = $frm_app_controller->get_param('action');
296
  if($action=='new')
297
  return $this->new_form();
298
  else if($action=='create')
12
  }
13
 
14
  function menu(){
15
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | '. __('Forms', FRM_PLUGIN_NAME), __('Forms', FRM_PLUGIN_NAME), 8, FRM_PLUGIN_NAME, array($this,'route'));
16
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | '. __('Create a Form', FRM_PLUGIN_NAME), __('Create a Form', FRM_PLUGIN_NAME), 8, FRM_PLUGIN_NAME.'-new', array($this,'new_form'));
17
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | '. __('Templates', FRM_PLUGIN_NAME), __('Templates', FRM_PLUGIN_NAME), 8, FRM_PLUGIN_NAME.'-templates', array($this, 'template_list'));
18
  }
19
 
20
  function head(){
21
+ $css_file = array(FRM_URL.'/css/ui-lightness/jquery-ui-1.7.2.custom.css', FRM_URL. '/css/frm_admin.css');
22
+ $js_file = array(FRM_URL . '/js/formidable.js', FRM_URL . '/js/jquery/jquery-ui-themepicker.js', FRM_URL.'/js/jquery/jquery.editinplace.packed.js');
23
+ require(FRM_VIEWS_PATH . '/shared/head.php');
24
  }
25
 
26
  function list_form(){
35
  }
36
 
37
  function new_form(){
38
+ global $frm_app_controller, $frm_form, $frmpro_is_installed;
39
 
40
  $action = $frm_app_controller->get_param('action');
41
  if ($action == 'create')
42
  return $this->create();
43
+ else if ($action == 'new'){
44
+ $frm_field_selection = FrmFieldsHelper::field_selection();
45
  $values = FrmFormsHelper::setup_new_vars();
46
  $id = $frm_form->create( $values );
47
  require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
52
  }
53
 
54
  function create(){
55
+ global $frm_app_controller, $frm_app_helper, $frm_entry, $frm_form, $frm_field, $frmpro_is_installed;
56
  $errors = $frm_form->validate($_POST);
57
  $id = $frm_app_controller->get_param('id');
58
 
59
  if( count($errors) > 0 ){
60
+ $frm_field_selection = FrmFieldsHelper::field_selection();
61
  $record = $frm_form->getOne( $id );
62
  $fields = $frm_field->getAll("fi.form_id=$id", ' ORDER BY field_order');
63
+ $values = FrmAppHelper::setup_edit_vars($record,'forms',$fields,true);
64
  require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
65
  }else{
66
  $items = $frm_entry->getAll('',' ORDER BY it.name');
67
  $record = $frm_form->update( $id, $_POST, true );
68
+ $message = __('Form was Successfully Created', FRM_PLUGIN_NAME);
69
  $params = $this->get_params();
70
  return $this->display_forms_list($params, $message);
71
  }
101
  return $this->get_edit_vars($id, $errors);
102
  }else{
103
  $record = $frm_form->update( $_POST['id'], $_POST );
104
+ $message = __('Form was Successfully Updated', FRM_PLUGIN_NAME);
105
  return $this->get_edit_vars($id, '', $message);
106
  }
107
  }
111
 
112
  $params = $this->get_params();
113
  $record = $frm_form->duplicate( $params['id'], $params['template'] );
114
+ $message = ($params['template']) ? __('Form template was Successfully Created', FRM_PLUGIN_NAME) : __('Form was Successfully Copied', FRM_PLUGIN_NAME);
115
  if ($record)
116
  return $this->get_edit_vars($record, '', $message, true);
117
  else
118
+ return $this->display_forms_list($params, __('There was a problem creating new template.', FRM_PLUGIN_NAME));
119
  }
120
 
121
  function page_preview(){
124
  $params = $this->get_params();
125
  if (!$params['form']) return;
126
  $form = $frm_form->getOne($params['form']);
127
+ require(FRM_VIEWS_PATH.'/frm-entries/frm-entry.php');
128
  }
129
 
130
  function preview(){
140
 
141
  $plugin = FrmAppController::get_param('plugin');
142
  $controller = FrmAppController::get_param('controller');
143
+ $key = (isset($_GET['form']) ? $_GET['form'] : (isset($_POST['form']) ? $_POST['form'] : ''));
144
  $form = $frm_form->getAll("form_key='$key'",'',' LIMIT 1');
145
  if (!$form) $form = $frm_form->getAll('','',' LIMIT 1');
146
  $form_options = stripslashes_deep(maybe_unserialize($form->options));
155
  $params = $this->get_params();
156
  $message = '';
157
  if ($frm_form->destroy( $params['id'] ))
158
+ $message = __('Form was Successfully Deleted', FRM_PLUGIN_NAME);
159
  $this->display_forms_list($params, $message, '', 1);
160
  }
161
 
269
  }
270
 
271
  function get_edit_vars($id, $errors = '', $message='', $create_link=false){
272
+ global $frm_app_helper, $frm_entry, $frm_form, $frm_field, $frmpro_is_installed;
273
  $record = $frm_form->getOne( $id );
274
  $items = $frm_entry->getAll('',' ORDER BY it.name');
275
+ $frm_field_selection = FrmFieldsHelper::field_selection();
276
  $fields = $frm_field->getAll("fi.form_id=$id", ' ORDER BY field_order');
277
+ $values = FrmAppHelper::setup_edit_vars($record,'forms',$fields,true);
278
  if (isset($values['default_template']) && $values['default_template'])
279
+ wp_die(__('That template cannot be edited', FRM_PLUGIN_NAME));
280
  else if($create_link)
281
  require_once(FRM_VIEWS_PATH.'/frm-forms/new.php');
282
  else
293
  }
294
 
295
  function route(){
296
+ $action = FrmAppController::get_param('action');
 
297
  if($action=='new')
298
  return $this->new_form();
299
  else if($action=='create')
classes/controllers/FrmSettingsController.php CHANGED
@@ -8,7 +8,7 @@ class FrmSettingsController{
8
  }
9
 
10
  function menu(){
11
- add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Settings', 'Settings', 8, FRM_PLUGIN_NAME.'-settings', array($this,'route'));
12
  }
13
 
14
  function pro_menu(){
@@ -38,7 +38,7 @@ class FrmSettingsController{
38
 
39
  if( empty($errors) ){
40
  $frm_settings->store();
41
- $message = 'Settings Saved';
42
  }
43
 
44
  require_once(FRM_VIEWS_PATH . '/frm-settings/form.php');
8
  }
9
 
10
  function menu(){
11
+ add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | '. __('Settings', FRM_PLUGIN_NAME), __('Settings', FRM_PLUGIN_NAME), 8, FRM_PLUGIN_NAME.'-settings', array($this,'route'));
12
  }
13
 
14
  function pro_menu(){
38
 
39
  if( empty($errors) ){
40
  $frm_settings->store();
41
+ $message = __('Settings Saved', FRM_PLUGIN_NAME);
42
  }
43
 
44
  require_once(FRM_VIEWS_PATH . '/frm-settings/form.php');
classes/helpers/FrmAppHelper.php CHANGED
@@ -54,6 +54,7 @@ class FrmAppHelper{
54
  return $key;
55
  }
56
 
 
57
  function setup_edit_vars($record, $table, $fields='', $default=false){
58
  if(!$record) return false;
59
  global $frm_entry_meta, $frm_form, $frm_app_controller, $frm_settings;
@@ -63,7 +64,7 @@ class FrmAppHelper{
63
 
64
  foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default_val)
65
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default_val));
66
-
67
  $values['fields'] = array();
68
  if ($fields){
69
  foreach($fields as $field){
@@ -79,19 +80,22 @@ class FrmAppHelper{
79
  $new_value = stripslashes_deep(maybe_unserialize($new_value));
80
 
81
  $field_array = array('id' => $field->id,
82
- 'value' => $new_value,
83
- 'default_value' => stripslashes($field->default_value),
84
  'name' => stripslashes($field->name),
85
  'description' => stripslashes($field->description),
86
  'type' => apply_filters('frm_field_type',$field_type, $field),
87
- 'options' => stripslashes_deep(unserialize($field->options)),
88
  'required' => $field->required,
89
  'field_key' => $field->field_key,
90
  'field_order' => $field->field_order,
91
  'form_id' => $field->form_id);
92
 
93
- foreach (array('size' => '','max' => '','label' => 'top','invalid' => '','required_indicator' => '*','blank' => '', 'clear_on_focus' => 0, 'custom_html' => FrmFieldsHelper::get_default_html($field), 'default_blank' => 0) as $opt => $default_opt)
94
- $field_array[$opt] = ($_POST and isset($_POST['field_options'][$opt.'_'.$field->id]) ) ? $_POST['field_options'][$opt.'_'.$field->id] : (isset($field_options[$opt]) ? $field_options[$opt]: $default_opt);
 
 
 
95
 
96
  $values['fields'][] = apply_filters('frm_setup_edit_fields_vars', stripslashes_deep($field_array), $field, $values['id']);
97
  }
@@ -112,7 +116,7 @@ class FrmAppHelper{
112
  }
113
 
114
  $email = get_option('admin_email');
115
- foreach (array('custom_style' => $frm_settings->custom_style, 'email_to' => $email, 'submit_value' => 'Submit', 'success_msg' => 'Your responses were successfully submitted. Thank you!') as $opt => $default){
116
  if (!isset($values[$opt]))
117
  $values[$opt] = ($_POST and isset($_POST['options'][$opt])) ? $_POST['options'][$opt] : $default;
118
  }
@@ -150,7 +154,7 @@ class FrmAppHelper{
150
  return $message;
151
  }
152
 
153
- function display_recaptcha($errors) {
154
  global $recaptcha_opt;
155
 
156
  $format = <<<END
@@ -182,7 +186,7 @@ COMMENT_FORM;
182
  return $sub . (($len < strlen($str)) ? $continue : '');
183
  }
184
 
185
- function prepend_and_or_where( $starts_with = ' WHERE', $where = '' ){
186
  return (( $where == '' )?'':$starts_with . $where);
187
  }
188
 
54
  return $key;
55
  }
56
 
57
+ //Editing a Form or Entry
58
  function setup_edit_vars($record, $table, $fields='', $default=false){
59
  if(!$record) return false;
60
  global $frm_entry_meta, $frm_form, $frm_app_controller, $frm_settings;
64
 
65
  foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default_val)
66
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default_val));
67
+ $values['description'] = wpautop($values['description']);
68
  $values['fields'] = array();
69
  if ($fields){
70
  foreach($fields as $field){
80
  $new_value = stripslashes_deep(maybe_unserialize($new_value));
81
 
82
  $field_array = array('id' => $field->id,
83
+ 'value' => str_replace('"', '&quot;', $new_value),
84
+ 'default_value' => str_replace('"', '&quot;', stripslashes($field->default_value)),
85
  'name' => stripslashes($field->name),
86
  'description' => stripslashes($field->description),
87
  'type' => apply_filters('frm_field_type',$field_type, $field),
88
+ 'options' => str_replace('"', '&quot;', stripslashes_deep(unserialize($field->options))),
89
  'required' => $field->required,
90
  'field_key' => $field->field_key,
91
  'field_order' => $field->field_order,
92
  'form_id' => $field->form_id);
93
 
94
+ foreach (array('size' => '', 'max' => '', 'label' => 'top', 'invalid' => '', 'required_indicator' => '*', 'blank' => '', 'clear_on_focus' => 0, 'custom_html' => '', 'default_blank' => 0) as $opt => $default_opt)
95
+ $field_array[$opt] = ($_POST and isset($_POST['field_options'][$opt.'_'.$field->id]) ) ? $_POST['field_options'][$opt.'_'.$field->id] : (isset($field_options[$opt]) ? $field_options[$opt] : $default_opt);
96
+
97
+ if ($field_array['custom_html'] == '')
98
+ $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field_type);
99
 
100
  $values['fields'][] = apply_filters('frm_setup_edit_fields_vars', stripslashes_deep($field_array), $field, $values['id']);
101
  }
116
  }
117
 
118
  $email = get_option('admin_email');
119
+ foreach (array('custom_style' => $frm_settings->custom_style, 'email_to' => $email, 'submit_value' => $frm_settings->submit_value, 'success_msg' => $frm_settings->success_msg) as $opt => $default){
120
  if (!isset($values[$opt]))
121
  $values[$opt] = ($_POST and isset($_POST['options'][$opt])) ? $_POST['options'][$opt] : $default;
122
  }
154
  return $message;
155
  }
156
 
157
+ function display_recaptcha() {
158
  global $recaptcha_opt;
159
 
160
  $format = <<<END
186
  return $sub . (($len < strlen($str)) ? $continue : '');
187
  }
188
 
189
+ function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ){
190
  return (( $where == '' )?'':$starts_with . $where);
191
  }
192
 
classes/helpers/FrmEntriesHelper.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  class FrmEntriesHelper{
4
 
5
- function setup_new_vars($fields){
6
  global $frm_app_controller, $frm_form, $frm_settings;
7
  $values = array();
8
  foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default)
@@ -14,11 +14,15 @@ class FrmEntriesHelper{
14
  $default = $field->default_value;
15
 
16
  $field_options = unserialize($field->field_options);
17
- $new_value = ($_POST and isset($_POST['item_meta'][$field->id])) ? $_POST['item_meta'][$field->id] : $default;
 
 
 
 
18
  if ($field->type != 'checkbox')
19
- $new_value = apply_filters('frm_get_default_value', stripslashes($new_value));
20
 
21
- $new_value = stripslashes_deep(maybe_unserialize($new_value));
22
 
23
  $field_array = array('id' => $field->id,
24
  'value' => $new_value,
@@ -26,18 +30,21 @@ class FrmEntriesHelper{
26
  'name' => stripslashes($field->name),
27
  'description' => stripslashes($field->description),
28
  'type' => apply_filters('frm_field_type',$field->type, $field),
29
- 'options' => stripslashes_deep(unserialize($field->options)),
30
  'required' => $field->required,
31
  'field_key' => $field->field_key,
32
  'field_order' => $field->field_order,
33
  'form_id' => $field->form_id);
34
 
35
- foreach (array('size' => '','max' => '','label' => 'top','invalid' => '','required_indicator' => '','blank' => '', 'clear_on_focus' => 0, 'custom_html' => FrmFieldsHelper::get_default_html($field), 'default_blank' => 0) as $opt => $default_opt)
36
  $field_array[$opt] = (isset($field_options[$opt]) && $field_options[$opt] != '') ? $field_options[$opt] : $default_opt;
 
 
 
37
 
38
  $values['fields'][] = apply_filters('frm_setup_new_fields_vars', stripslashes_deep($field_array), $field);
39
 
40
- if (!isset($form))
41
  $form = $frm_form->getOne($field->form_id);
42
  }
43
 
@@ -55,10 +62,10 @@ class FrmEntriesHelper{
55
  $values['email_to'] = '';
56
 
57
  if (!isset($values['submit_value']))
58
- $values['submit_value'] = 'Submit';
59
 
60
  if (!isset($values['success_msg']))
61
- $values['success_msg'] = 'Your responses were successfully submitted. Thank you!';
62
 
63
  if (!isset($values['akismet']))
64
  $values['akismet'] = 0;
@@ -89,7 +96,7 @@ class FrmEntriesHelper{
89
  <option value=""><?php echo $blank_label; ?></option>
90
  <?php } ?>
91
  <?php foreach($entries as $entry){ ?>
92
- <option value="<?php echo $entry->id; ?>" <?php selected($field_value, $entry->id); ?>><?php echo (!empty($entry->name)) ? $entry->name : $entry->item_key; ?></option>
93
  <?php } ?>
94
  </select>
95
  <?php
2
 
3
  class FrmEntriesHelper{
4
 
5
+ function setup_new_vars($fields, $form='', $reset=false){
6
  global $frm_app_controller, $frm_form, $frm_settings;
7
  $values = array();
8
  foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default)
14
  $default = $field->default_value;
15
 
16
  $field_options = unserialize($field->field_options);
17
+ if ($reset)
18
+ $new_value = $default;
19
+ else
20
+ $new_value = ($_POST and isset($_POST['item_meta'][$field->id])) ? $_POST['item_meta'][$field->id] : $default;
21
+
22
  if ($field->type != 'checkbox')
23
+ $new_value = apply_filters('frm_get_default_value', stripslashes_deep($new_value));
24
 
25
+ $new_value = str_replace('"', '&quot;', stripslashes_deep(maybe_unserialize($new_value)));
26
 
27
  $field_array = array('id' => $field->id,
28
  'value' => $new_value,
30
  'name' => stripslashes($field->name),
31
  'description' => stripslashes($field->description),
32
  'type' => apply_filters('frm_field_type',$field->type, $field),
33
+ 'options' => str_replace('"', '&quot;', stripslashes_deep(unserialize($field->options))),
34
  'required' => $field->required,
35
  'field_key' => $field->field_key,
36
  'field_order' => $field->field_order,
37
  'form_id' => $field->form_id);
38
 
39
+ foreach (array('size' => '','max' => '','label' => 'top','invalid' => '','required_indicator' => '','blank' => '', 'clear_on_focus' => 0, 'custom_html' => '', 'default_blank' => 0) as $opt => $default_opt)
40
  $field_array[$opt] = (isset($field_options[$opt]) && $field_options[$opt] != '') ? $field_options[$opt] : $default_opt;
41
+
42
+ if ($field_array['custom_html'] == '')
43
+ $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
44
 
45
  $values['fields'][] = apply_filters('frm_setup_new_fields_vars', stripslashes_deep($field_array), $field);
46
 
47
+ if (!$form or !isset($form->id))
48
  $form = $frm_form->getOne($field->form_id);
49
  }
50
 
62
  $values['email_to'] = '';
63
 
64
  if (!isset($values['submit_value']))
65
+ $values['submit_value'] = $frm_settings->submit_value;
66
 
67
  if (!isset($values['success_msg']))
68
+ $values['success_msg'] = $frm_settings->success_msg;
69
 
70
  if (!isset($values['akismet']))
71
  $values['akismet'] = 0;
96
  <option value=""><?php echo $blank_label; ?></option>
97
  <?php } ?>
98
  <?php foreach($entries as $entry){ ?>
99
+ <option value="<?php echo $entry->id; ?>" <?php selected($field_value, $entry->id); ?>><?php echo (!empty($entry->name)) ? stripslashes($entry->name) : $entry->item_key; ?></option>
100
  <?php } ?>
101
  </select>
102
  <?php
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -2,6 +2,45 @@
2
 
3
  class FrmFieldsHelper{
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  function setup_new_vars($type='',$form_id=''){
6
  global $frm_field, $frm_app_helper;
7
 
@@ -9,7 +48,7 @@ class FrmFieldsHelper{
9
  $key = FrmAppHelper::get_unique_key('', $frm_field->table_name, 'field_key');
10
 
11
  $values = array();
12
- foreach (array('name' => 'Untitled', 'description' => '', 'field_key' => $key, 'type' => $type, 'options'=>'', 'default_value'=>'', 'field_order' => $field_count+1, 'required' => false, 'blank' => 'Untitled can\'t be blank', 'invalid' => 'Untitled is an invalid format', 'form_id' => $form_id) as $var => $default)
13
  $values[$var] = $default;
14
 
15
  $values['field_options'] = array();
@@ -20,10 +59,8 @@ class FrmFieldsHelper{
20
  $values['options'] = serialize(array(1 => 'Option 1', 2 => 'Option 2'));
21
  else if ( $type == 'select')
22
  $values['options'] = serialize(array(1 => '', 2 => 'Option 1'));
23
- else if ($type == 'textarea'){
24
- $values['field_options']['size'] = '45';
25
  $values['field_options']['max'] = '5';
26
- }
27
 
28
  return $values;
29
  }
@@ -45,7 +82,7 @@ class FrmFieldsHelper{
45
  $values['options'] = unserialize($record->options);
46
  $field_options = unserialize($record->field_options);
47
  $values['field_options'] = $field_options;
48
- $values['size'] = (isset($field_options['size']))?($field_options['size']):('75');
49
  $values['max'] = (isset($field_options['max']))?($field_options['max']):('');
50
  $values['label'] = (isset($field_options['label']))?($field_options['label']):('top');
51
  $values['blank'] = (isset($field_options['blank']))?($field_options['blank']):('');
@@ -58,8 +95,16 @@ class FrmFieldsHelper{
58
  return $values;
59
  }
60
 
 
 
 
 
 
 
 
 
61
  function get_default_html($type){
62
- if (apply_filters('frm_show_normal_field_type', true, $type)){
63
  $default_html = <<<DEFAULT_HTML
64
  <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
65
  <label class="frm_pos_[label_position]">[field_name]
@@ -69,9 +114,8 @@ class FrmFieldsHelper{
69
  [if description]<p class="description">[description]</p>[/if description]
70
  </div>
71
  DEFAULT_HTML;
72
- }else{
73
  $default_html = apply_filters('frm_other_custom_html', '', $type);
74
- }
75
 
76
  return apply_filters('frm_custom_html', $default_html, $type);
77
  }
@@ -114,16 +158,16 @@ DEFAULT_HTML;
114
  ob_end_clean();
115
  $html = str_replace('[input]', $contents, $html);
116
 
117
- return $html;
118
  }
119
 
120
  function show_onfocus_js($field_id, $clear_on_focus){ ?>
121
- <a href="javascript:frm_clear_on_focus(<?php echo $field_id; ?>,<?php echo $clear_on_focus; ?>)" class="<?php echo ($clear_on_focus) ?'':'frm_inactive_icon'; ?> frm-show-hover" id="clear_field_<?php echo $field_id; ?>" title="Set this field to <?php echo ($clear_on_focus)?'not ':''; ?>clear on click"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></a>
122
  <?php
123
  }
124
 
125
  function show_default_blank_js($field_id, $default_blank){ ?>
126
- <a href="javascript:frm_default_blank(<?php echo $field_id; ?>,<?php echo $default_blank ?>)" class="<?php echo ($default_blank) ?'':'frm_inactive_icon'; ?> frm-show-hover" id="default_blank_<?php echo $field_id; ?>" title="This default value should <?php echo ($default_blank)?'not ':''; ?>be considered blank"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></a>
127
  <?php
128
  }
129
 
2
 
3
  class FrmFieldsHelper{
4
 
5
+ function field_selection(){
6
+ $fields = apply_filters('frm_available_fields', array(
7
+ 'text' => __('Text Input (One Line)', FRM_PLUGIN_NAME),
8
+ 'textarea' => __('Paragraph Input (Multiple Lines)', FRM_PLUGIN_NAME),
9
+ 'checkbox' => __('Multiple Selection (Check Boxes)', FRM_PLUGIN_NAME),
10
+ 'radio' => __('Select One (Radio)', FRM_PLUGIN_NAME),
11
+ 'select' => __('Drop-Down (Select)', FRM_PLUGIN_NAME)
12
+ ));
13
+
14
+ if ( in_array('wp-recaptcha/wp-recaptcha.php', get_option('active_plugins')) )
15
+ $fields['captcha'] = 'reCAPTCHA Field';
16
+ return $fields;
17
+ }
18
+
19
+ function pro_field_selection(){
20
+ return apply_filters('frm_pro_available_fields', array(
21
+ 'divider' => __('Section Divider/Heading', FRM_PLUGIN_NAME),
22
+ 'break' => __('Page Break', FRM_PLUGIN_NAME),
23
+ 'file' => __('File Upload', FRM_PLUGIN_NAME),
24
+ 'rte' => __('Rich Text Editor', FRM_PLUGIN_NAME),
25
+ 'phone' => __('Phone', FRM_PLUGIN_NAME),
26
+ 'email' => __('Email', FRM_PLUGIN_NAME),
27
+ 'date' => __('Date', FRM_PLUGIN_NAME),
28
+ //'time' => 'Time',
29
+ 'hidden' => __('Hidden Field', FRM_PLUGIN_NAME),
30
+ 'user_id' => __('Hidden User Id', FRM_PLUGIN_NAME),
31
+ 'website' => __('Website/URL', FRM_PLUGIN_NAME),
32
+ 'image' => __('Image URL', FRM_PLUGIN_NAME),
33
+ '10radio' => __('Scale', FRM_PLUGIN_NAME),
34
+ 'data' => __('Data from Entries', FRM_PLUGIN_NAME)
35
+ //'multiple' => 'Multiple Select Box', //http://code.google.com/p/jquery-asmselect/
36
+ //'address' => 'Address' //Address line 1, Address line 2, City, State/Providence, Postal Code, Select Country
37
+ //'city_selector' => 'US State/County/City selector',
38
+ //'full_name' => 'First and Last Name',
39
+ //'terms' => 'Terms of Use',// checkbox or show terms (integrate with Terms of use plugin)
40
+ //'quiz' => 'Question and Answer' // for captcha alternative
41
+ ));
42
+ }
43
+
44
  function setup_new_vars($type='',$form_id=''){
45
  global $frm_field, $frm_app_helper;
46
 
48
  $key = FrmAppHelper::get_unique_key('', $frm_field->table_name, 'field_key');
49
 
50
  $values = array();
51
+ foreach (array('name' => __('Untitled', FRM_PLUGIN_NAME), 'description' => '', 'field_key' => $key, 'type' => $type, 'options'=>'', 'default_value'=>'', 'field_order' => $field_count+1, 'required' => false, 'blank' => __('Untitled can\'t be blank', FRM_PLUGIN_NAME), 'invalid' => __('Untitled is an invalid format', FRM_PLUGIN_NAME), 'form_id' => $form_id) as $var => $default)
52
  $values[$var] = $default;
53
 
54
  $values['field_options'] = array();
59
  $values['options'] = serialize(array(1 => 'Option 1', 2 => 'Option 2'));
60
  else if ( $type == 'select')
61
  $values['options'] = serialize(array(1 => '', 2 => 'Option 1'));
62
+ else if ($type == 'textarea')
 
63
  $values['field_options']['max'] = '5';
 
64
 
65
  return $values;
66
  }
82
  $values['options'] = unserialize($record->options);
83
  $field_options = unserialize($record->field_options);
84
  $values['field_options'] = $field_options;
85
+ $values['size'] = (isset($field_options['size']))?($field_options['size']):('');
86
  $values['max'] = (isset($field_options['max']))?($field_options['max']):('');
87
  $values['label'] = (isset($field_options['label']))?($field_options['label']):('top');
88
  $values['blank'] = (isset($field_options['blank']))?($field_options['blank']):('');
95
  return $values;
96
  }
97
 
98
+ function get_form_fields($form_id, $error=false){
99
+ global $frm_field;
100
+ $fields = apply_filters('frm_get_paged_fields', false, $form_id, $error);
101
+ if (!$fields)
102
+ $fields = $frm_field->getAll("fi.form_id='$form_id'", ' ORDER BY field_order');
103
+ return $fields;
104
+ }
105
+
106
  function get_default_html($type){
107
+ if (apply_filters('frm_normal_field_type_html', true, $type)){
108
  $default_html = <<<DEFAULT_HTML
109
  <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
110
  <label class="frm_pos_[label_position]">[field_name]
114
  [if description]<p class="description">[description]</p>[/if description]
115
  </div>
116
  DEFAULT_HTML;
117
+ }else
118
  $default_html = apply_filters('frm_other_custom_html', '', $type);
 
119
 
120
  return apply_filters('frm_custom_html', $default_html, $type);
121
  }
158
  ob_end_clean();
159
  $html = str_replace('[input]', $contents, $html);
160
 
161
+ return apply_filters('frm_replace_shortcodes', $html, $field);
162
  }
163
 
164
  function show_onfocus_js($field_id, $clear_on_focus){ ?>
165
+ <a href="javascript:frm_clear_on_focus(<?php echo $field_id; ?>,<?php echo $clear_on_focus; ?>)" class="<?php echo ($clear_on_focus) ?'':'frm_inactive_icon '; ?>frm-show-hover" id="clear_field_<?php echo $field_id; ?>" title="<?php printf(__('Set this field to %1$sclear on click', FRM_PLUGIN_NAME), ($clear_on_focus) ? __('not ', FRM_PLUGIN_NAME) :'' ); ?>"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></a>
166
  <?php
167
  }
168
 
169
  function show_default_blank_js($field_id, $default_blank){ ?>
170
+ <a href="javascript:frm_default_blank(<?php echo $field_id; ?>,<?php echo $default_blank ?>)" class="<?php echo ($default_blank) ?'':'frm_inactive_icon '; ?>frm-show-hover" id="default_blank_<?php echo $field_id; ?>" title="<?php printf(__('This default value should %1$sbe considered blank', FRM_PLUGIN_NAME), ($default_blank) ? __('not ', FRM_PLUGIN_NAME) :'' ); ?>"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></a>
171
  <?php
172
  }
173
 
classes/helpers/FrmFormsHelper.php CHANGED
@@ -13,7 +13,7 @@ class FrmFormsHelper{
13
 
14
  function get_template_dropdown($templates){ ?>
15
  <select id="select_form" name="select_form" onChange='createFromFrmTemplate(this.value)'>
16
- <option value="">Create Form from Template: </option>
17
  <?php foreach ($templates as $temp){ ?>
18
  <option value="<?php echo $temp->id ?>"><?php echo $temp->name ?></option>
19
  <?php }?>
@@ -45,17 +45,19 @@ class FrmFormsHelper{
45
  function setup_new_vars(){
46
  global $frm_app_controller, $frm_form, $frm_settings;
47
  $values = array();
48
- foreach (array('name' => 'Untitled Form', 'description' => '') as $var => $default)
49
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
50
 
 
 
51
  foreach (array('form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0) as $var => $default)
52
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
53
 
54
  $values['form_key'] = ($_POST and isset($_POST['form_key']))?$_POST['form_key']:(FrmAppHelper::get_unique_key('', $frm_form->table_name, 'form_key'));
55
- $values['email_to'] = ($_POST and isset($_POST['options']['email_to'])) ? $_POST['options']['email_to'] : get_option('admin_email');
56
  $values['custom_style'] = ($_POST and isset($_POST['options']['custom_style'])) ? $_POST['options']['custom_style'] : $frm_settings->custom_style;
57
- $values['submit_value'] = ($_POST and isset($_POST['options']['submit_value'])) ? $_POST['options']['submit_value'] : 'Submit';
58
- $values['success_msg'] = ($_POST and isset($_POST['options']['success_msg'])) ? $_POST['options']['success_msg'] : 'Your responses were successfully submitted. Thank you!';
59
  $values['akismet'] = ($_POST and isset($_POST['options']['akismet'])) ? 1 : 0;
60
  $values['before_html'] = FrmFormsHelper::get_default_html('before');
61
  $values['after_html'] = FrmFormsHelper::get_default_html('after');
@@ -77,7 +79,7 @@ class FrmFormsHelper{
77
  if ($loc == 'before'){
78
  $default_html = <<<BEFORE_HTML
79
  [if form_name]<h3>[form_name]</h3>[/if form_name]
80
- [if form_description]<p class="frm_description">[form_description]</p>[/if form_description]
81
  BEFORE_HTML;
82
  }else{
83
  $default_html = '';
@@ -88,9 +90,9 @@ BEFORE_HTML;
88
  function replace_shortcodes($html, $form, $title=false, $description=false){
89
  foreach (array('form_name' => $title,'form_description' => $description) as $code => $show){
90
  if ($code == 'form_name')
91
- $replace_with = $form->name;
92
  else if ($code == 'form_description')
93
- $replace_with = $form->description;
94
 
95
  if (($show == true || $show == 'true') && $replace_with != '' ){
96
  $html = str_replace('[if '.$code.']','',$html);
13
 
14
  function get_template_dropdown($templates){ ?>
15
  <select id="select_form" name="select_form" onChange='createFromFrmTemplate(this.value)'>
16
+ <option value=""><?php _e('Create Form from Template', FRM_PLUGIN_NAME) ?>: </option>
17
  <?php foreach ($templates as $temp){ ?>
18
  <option value="<?php echo $temp->id ?>"><?php echo $temp->name ?></option>
19
  <?php }?>
45
  function setup_new_vars(){
46
  global $frm_app_controller, $frm_form, $frm_settings;
47
  $values = array();
48
+ foreach (array('name' => __('Untitled Form', FRM_PLUGIN_NAME), 'description' => '') as $var => $default)
49
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
50
 
51
+ $values['description'] = wpautop($values['description']);
52
+
53
  foreach (array('form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0) as $var => $default)
54
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
55
 
56
  $values['form_key'] = ($_POST and isset($_POST['form_key']))?$_POST['form_key']:(FrmAppHelper::get_unique_key('', $frm_form->table_name, 'form_key'));
57
+ $values['email_to'] = ($_POST and isset($_POST['options']['email_to'])) ? $_POST['options']['email_to'] : $frm_settings->email_to;
58
  $values['custom_style'] = ($_POST and isset($_POST['options']['custom_style'])) ? $_POST['options']['custom_style'] : $frm_settings->custom_style;
59
+ $values['submit_value'] = ($_POST and isset($_POST['options']['submit_value'])) ? $_POST['options']['submit_value'] : $frm_settings->submit_value;
60
+ $values['success_msg'] = ($_POST and isset($_POST['options']['success_msg'])) ? $_POST['options']['success_msg'] : $frm_settings->success_msg;
61
  $values['akismet'] = ($_POST and isset($_POST['options']['akismet'])) ? 1 : 0;
62
  $values['before_html'] = FrmFormsHelper::get_default_html('before');
63
  $values['after_html'] = FrmFormsHelper::get_default_html('after');
79
  if ($loc == 'before'){
80
  $default_html = <<<BEFORE_HTML
81
  [if form_name]<h3>[form_name]</h3>[/if form_name]
82
+ [if form_description]<div class="frm_description">[form_description]</div>[/if form_description]
83
  BEFORE_HTML;
84
  }else{
85
  $default_html = '';
90
  function replace_shortcodes($html, $form, $title=false, $description=false){
91
  foreach (array('form_name' => $title,'form_description' => $description) as $code => $show){
92
  if ($code == 'form_name')
93
+ $replace_with = stripslashes($form->name);
94
  else if ($code == 'form_description')
95
+ $replace_with = wpautop(stripslashes($form->description));
96
 
97
  if (($show == true || $show == 'true') && $replace_with != '' ){
98
  $html = str_replace('[if '.$code.']','',$html);
classes/models/FrmEntry.php CHANGED
@@ -17,7 +17,6 @@ class FrmEntry{
17
  'browser' => $_SERVER['HTTP_USER_AGENT'],
18
  'referrer' => $_SERVER['HTTP_REFERER']));
19
  $new_values['form_id'] = isset($values['form_id']) ? (int)$values['form_id']: null;
20
- //$new_values['parent_item_id'] = isset($values['parent_item_id'])?(int)$values['parent_item_id']: null;
21
  $new_values['created_at'] = current_time('mysql', 1);
22
 
23
  $query_results = $wpdb->insert( $this->table_name, $new_values );
@@ -26,7 +25,7 @@ class FrmEntry{
26
  $entry_id = $wpdb->insert_id;
27
  if (isset($values['item_meta']))
28
  $frm_entry_meta->update_entry_metas($entry_id, $values['item_meta']);
29
- do_action('frm_after_create_entry', $entry_id);
30
  return $entry_id;
31
  }else
32
  return false;
@@ -41,7 +40,6 @@ class FrmEntry{
41
  $new_values['item_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'item_key');
42
  $new_values['name'] = $values->name;
43
  $new_values['form_id'] = ($values->form_id)?(int)$values->form_id: null;
44
- //$new_values['parent_item_id'] = ($values->parent_item_id)?(int)$values->parent_item_id: null;
45
  $new_values['created_at'] = current_time('mysql', 1);
46
 
47
  $query_results = $wpdb->insert( $this->table_name, $new_values );
@@ -151,7 +149,7 @@ class FrmEntry{
151
  'fr.name as form_name ' .
152
  'FROM ' . $this->table_name . ' it ' .
153
  'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON it.form_id=fr.id' .
154
- $frm_app_helper->prepend_and_or_where(' WHERE', $where) . $order_by . ' ' .
155
  'LIMIT ' . $start_index . ',' . $p_size . ';';
156
  $results = $wpdb->get_results($query);
157
  return $results;
@@ -160,31 +158,29 @@ class FrmEntry{
160
  function validate( $values ){
161
  global $wpdb, $frm_field, $frm_entry_meta;
162
 
163
- $errors = array();
164
-
165
- if (!isset($values['name']) and isset($values['item_meta'])){
166
- foreach($values['item_meta'] as $key => $value){
167
- $field = $frm_field->getOne($key);
168
- if ($field->required == '1' and $field->type == 'text' and !isset($_POST['name']))
169
- $_POST['name'] = $value;
170
- }
171
- }
172
 
173
  if( !isset($values['item_key']) or $values['item_key'] == '' )
174
- $_POST['item_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'item_key');
175
 
176
- if (isset($values['item_meta'])){
177
- foreach($values['item_meta'] as $key => $value){
178
- $field = $frm_field->getOne($key);
179
- if ($field->required == '1' and ($field->form_id == $values['form_id'])){
180
- $field_options = unserialize($field->field_options);
181
-
182
- if ($values['item_meta'][$key] == null or $values['item_meta'][$key] == '' or (isset($field_options['default_blank']) and $field_options['default_blank'] and $value == $field->default_value))
183
- $errors['field'.$field->id] = ($field_options['blank'] == 'Untitled cannot be blank' || $field_options['blank'] == '')?($field->name." can't be blank"):$field_options['blank'];
184
- }
185
- $errors = apply_filters('frm_validate_field_entry', $errors, $key, $value);
186
- }
 
 
 
 
 
187
 
 
188
  }
189
 
190
  if (isset($_POST['recaptcha_challenge_field']) and $_POST['action'] == 'create'){
@@ -208,7 +204,7 @@ class FrmEntry{
208
  $form_options = stripslashes_deep(unserialize($form->options));
209
 
210
  if (isset($form_options['akismet']) && $form_options['akismet'])
211
- $errors['spam'] = 'Your entry appears to be spam!';
212
  }
213
 
214
  return $errors;
17
  'browser' => $_SERVER['HTTP_USER_AGENT'],
18
  'referrer' => $_SERVER['HTTP_REFERER']));
19
  $new_values['form_id'] = isset($values['form_id']) ? (int)$values['form_id']: null;
 
20
  $new_values['created_at'] = current_time('mysql', 1);
21
 
22
  $query_results = $wpdb->insert( $this->table_name, $new_values );
25
  $entry_id = $wpdb->insert_id;
26
  if (isset($values['item_meta']))
27
  $frm_entry_meta->update_entry_metas($entry_id, $values['item_meta']);
28
+ do_action('frm_after_create_entry', $entry_id, $new_values['form_id']);
29
  return $entry_id;
30
  }else
31
  return false;
40
  $new_values['item_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'item_key');
41
  $new_values['name'] = $values->name;
42
  $new_values['form_id'] = ($values->form_id)?(int)$values->form_id: null;
 
43
  $new_values['created_at'] = current_time('mysql', 1);
44
 
45
  $query_results = $wpdb->insert( $this->table_name, $new_values );
149
  'fr.name as form_name ' .
150
  'FROM ' . $this->table_name . ' it ' .
151
  'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON it.form_id=fr.id' .
152
+ $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . ' ' .
153
  'LIMIT ' . $start_index . ',' . $p_size . ';';
154
  $results = $wpdb->get_results($query);
155
  return $results;
158
  function validate( $values ){
159
  global $wpdb, $frm_field, $frm_entry_meta;
160
 
161
+ $errors = array();
 
 
 
 
 
 
 
 
162
 
163
  if( !isset($values['item_key']) or $values['item_key'] == '' )
164
+ $_POST['item_key'] = $values['item_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'item_key');
165
 
166
+ $where = apply_filters('frm_posted_field_ids', 'fi.form_id='.$values['form_id']);
167
+ $posted_fields = $frm_field->getAll($where, ' ORDER BY fi.field_order');
168
+
169
+ foreach($posted_fields as $posted_field){
170
+ $value = '';
171
+ $field_options = unserialize($posted_field->field_options);
172
+ if (isset($values['item_meta'][$posted_field->id]))
173
+ $value = $values['item_meta'][$posted_field->id];
174
+
175
+ if (isset($field_options['default_blank']) and $field_options['default_blank'] and $value == $posted_field->default_value)
176
+ $value = '';
177
+
178
+ if ($posted_field->required == '1' and $value == ''){
179
+ $errors['field'.$posted_field->id] = (!isset($field_options['blank']) or $field_options['blank'] == __('Untitled cannot be blank', FRM_PLUGIN_NAME) or $field_options['blank'] == '') ? ($posted_field->name . ' '. __('can\'t be blank', FRM_PLUGIN_NAME)) : $field_options['blank'];
180
+ }else if ($posted_field->type == 'text' and !isset($_POST['name']))
181
+ $_POST['name'] = $value;
182
 
183
+ $errors = apply_filters('frm_validate_field_entry', $errors, $posted_field, $value);
184
  }
185
 
186
  if (isset($_POST['recaptcha_challenge_field']) and $_POST['action'] == 'create'){
204
  $form_options = stripslashes_deep(unserialize($form->options));
205
 
206
  if (isset($form_options['akismet']) && $form_options['akismet'])
207
+ $errors['spam'] = __('Your entry appears to be spam!', FRM_PLUGIN_NAME);
208
  }
209
 
210
  return $errors;
classes/models/FrmEntryMeta.php CHANGED
@@ -56,7 +56,10 @@ class FrmEntryMeta{
56
 
57
  function get_entry_meta_by_field($item_id, $field_id, $return_var=false){
58
  global $wpdb;
59
- $query = "SELECT meta_value FROM {$this->table_name} WHERE field_id='{$field_id}' and item_id='{$item_id}'";
 
 
 
60
  if($return_var)
61
  return $wpdb->get_var("{$query} LIMIT 1");
62
  else
@@ -101,9 +104,11 @@ class FrmEntryMeta{
101
  global $wpdb, $frm_field, $frm_app_helper;
102
  $query = 'SELECT it.*, ' .
103
  'fi.type as field_type, ' .
 
104
  'fi.required as required, ' .
105
  'fi.form_id as field_form_id, ' .
106
- 'fi.name as field_name ' .
 
107
  'FROM '. $this->table_name . ' it ' .
108
  'LEFT OUTER JOIN ' . $frm_field->table_name . ' fi ON it.field_id=fi.id' .
109
  $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
56
 
57
  function get_entry_meta_by_field($item_id, $field_id, $return_var=false){
58
  global $wpdb;
59
+ if (is_numeric($field_id))
60
+ $query = "SELECT meta_value FROM {$this->table_name} WHERE field_id='{$field_id}' and item_id='{$item_id}'";
61
+ else
62
+ $query = "SELECT meta_value FROM {$this->table_name} it LEFT OUTER JOIN $frm_field->table_name fi ON it.field_id=fi.id WHERE fi.field_key='{$field_id}' and item_id='{$item_id}'";
63
  if($return_var)
64
  return $wpdb->get_var("{$query} LIMIT 1");
65
  else
104
  global $wpdb, $frm_field, $frm_app_helper;
105
  $query = 'SELECT it.*, ' .
106
  'fi.type as field_type, ' .
107
+ 'fi.field_key as field_key, ' .
108
  'fi.required as required, ' .
109
  'fi.form_id as field_form_id, ' .
110
+ 'fi.name as field_name, ' .
111
+ 'fi.options as fi_options '.
112
  'FROM '. $this->table_name . ' it ' .
113
  'LEFT OUTER JOIN ' . $frm_field->table_name . ' fi ON it.field_id=fi.id' .
114
  $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
classes/models/FrmField.php CHANGED
@@ -3,33 +3,33 @@ class FrmField{
3
  var $table_name;
4
 
5
  function FrmField(){
6
- global $wpdb;
7
- $this->table_name = "{$wpdb->prefix}frm_fields";
8
  }
9
 
10
  function create( $values, $return=true ){
11
- global $wpdb;
12
-
13
- $new_values = array();
14
- $key = isset($values['field_key']) ? $values['field_key'] : $values['name'];
15
- $new_values['field_key'] = FrmAppHelper::get_unique_key($key, $this->table_name, 'field_key');
16
-
17
- foreach (array('name','description','type','default_value','options') as $col)
18
- $new_values[$col] = stripslashes($values[$col]);
19
-
20
- $new_values['field_order'] = isset($values['field_order'])?(int)$values['field_order']:NULL;
21
- $new_values['required'] = isset($values['required'])?(int)$values['required']:NULL;
22
- $new_values['form_id'] = isset($values['form_id'])?(int)$values['form_id']:NULL;
23
- $new_values['field_options'] = serialize($values['field_options']);
24
- $new_values['created_at'] = current_time('mysql', 1);
25
-
26
- $query_results = $wpdb->insert( $this->table_name, $new_values );
27
- if($return){
28
- if($query_results)
29
- return $wpdb->insert_id;
30
- else
31
- return false;
32
- }
33
  }
34
 
35
  function duplicate($old_form_id, $form_id, $copy_keys=false, $blog_id=false){
@@ -42,7 +42,7 @@ class FrmField{
42
  foreach (array('name','description','type','default_value','options','field_order','required') as $col)
43
  $values[$col] = $field->$col;
44
  $this->create($values, false);
45
- }
46
  }
47
 
48
  function update( $id, $values ){
@@ -102,8 +102,7 @@ class FrmField{
102
 
103
  function getIds($where = '', $order_by = '', $limit = ''){
104
  global $wpdb, $frm_form, $frm_app_helper;
105
- $query = 'SELECT fi.id ' .
106
- 'FROM '. $this->table_name . ' fi ' .
107
  'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON fi.form_id=fr.id' .
108
  $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
109
  if ($limit == ' LIMIT 1')
@@ -112,30 +111,5 @@ class FrmField{
112
  $results = $wpdb->get_results($query);
113
  return $results;
114
  }
115
-
116
- function validate( $values ){
117
- global $wpdb, $frm_blogurl;
118
-
119
- $errors = array();
120
-
121
- if( $values['field_key'] == null or $values['field_key'] == '' ){
122
- if( $values['name'] == null or $values['name'] == '' )
123
- $errors[] = "Key can't be blank";
124
- else
125
- $_POST['field_key'] = $values['name'];
126
- }
127
-
128
- if( $values['name'] == null or $values['name'] == '' )
129
- $errors[] = "Label can't be blank";
130
-
131
- if( $values['type'] == null or $values['type'] == '' ){
132
- $errors[] = "Type can't be blank";
133
- }else{
134
- if(($values['type'] == 'select' or $values['type'] == 'radio') and ($values['options'] == null or $values['options'] == ''))
135
- $errors[] = "Options cannot be blank for that field type";
136
- }
137
-
138
- return $errors;
139
- }
140
  }
141
  ?>
3
  var $table_name;
4
 
5
  function FrmField(){
6
+ global $wpdb;
7
+ $this->table_name = "{$wpdb->prefix}frm_fields";
8
  }
9
 
10
  function create( $values, $return=true ){
11
+ global $wpdb;
12
+
13
+ $new_values = array();
14
+ $key = isset($values['field_key']) ? $values['field_key'] : $values['name'];
15
+ $new_values['field_key'] = FrmAppHelper::get_unique_key($key, $this->table_name, 'field_key');
16
+
17
+ foreach (array('name','description','type','default_value','options') as $col)
18
+ $new_values[$col] = stripslashes($values[$col]);
19
+
20
+ $new_values['field_order'] = isset($values['field_order'])?(int)$values['field_order']:NULL;
21
+ $new_values['required'] = isset($values['required'])?(int)$values['required']:NULL;
22
+ $new_values['form_id'] = isset($values['form_id'])?(int)$values['form_id']:NULL;
23
+ $new_values['field_options'] = serialize($values['field_options']);
24
+ $new_values['created_at'] = current_time('mysql', 1);
25
+
26
+ $query_results = $wpdb->insert( $this->table_name, $new_values );
27
+ if($return){
28
+ if($query_results)
29
+ return $wpdb->insert_id;
30
+ else
31
+ return false;
32
+ }
33
  }
34
 
35
  function duplicate($old_form_id, $form_id, $copy_keys=false, $blog_id=false){
42
  foreach (array('name','description','type','default_value','options','field_order','required') as $col)
43
  $values[$col] = $field->$col;
44
  $this->create($values, false);
45
+ }
46
  }
47
 
48
  function update( $id, $values ){
102
 
103
  function getIds($where = '', $order_by = '', $limit = ''){
104
  global $wpdb, $frm_form, $frm_app_helper;
105
+ $query = "SELECT fi.id FROM $this->table_name fi " .
 
106
  'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON fi.form_id=fr.id' .
107
  $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
108
  if ($limit == ' LIMIT 1')
111
  $results = $wpdb->get_results($query);
112
  return $results;
113
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
  ?>
classes/models/FrmForm.php CHANGED
@@ -8,7 +8,7 @@ class FrmForm{
8
  }
9
 
10
  function create( $values ){
11
- global $wpdb;
12
 
13
  $new_values = array();
14
  $new_values['form_key'] = FrmAppHelper::get_unique_key($values['form_key'], $this->table_name, 'form_key');
@@ -20,8 +20,8 @@ class FrmForm{
20
  $new_values['prli_link_id'] = isset($link_id)?(int)$link_id:0;
21
  $options = array();
22
  $options['email_to'] = isset($values['options']['email_to']) ? $values['options']['email_to'] : '';
23
- $options['submit_value'] = isset($values['options']['submit_value']) ? $values['options']['submit_value'] : 'Submit';
24
- $options['success_msg'] = isset($values['options']['success_msg']) ? $values['options']['success_msg'] : '';
25
  $options['akismet'] = isset($values['options']['akismet']) ? 1 : 0;
26
  $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
27
  $options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
@@ -70,7 +70,7 @@ class FrmForm{
70
  }
71
 
72
  function update( $id, $values, $create_link = false ){
73
- global $wpdb, $frm_field;
74
 
75
  if ($create_link)
76
  $values['status'] = 'published';
@@ -85,8 +85,8 @@ class FrmForm{
85
  if (isset($values['options'])){
86
  $options = array();
87
  $options['email_to'] = isset($values['options']['email_to']) ? $values['options']['email_to'] : '';
88
- $options['submit_value'] = isset($values['options']['submit_value']) ? $values['options']['submit_value'] : 'Submit';
89
- $options['success_msg'] = isset($values['options']['success_msg']) ? $values['options']['success_msg'] : '';
90
  $options['akismet'] = isset($values['options']['akismet']) ? 1 : 0;
91
  $options['custom_style'] = isset($values['options']['custom_style']) ? 1 : 0;
92
  $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
@@ -111,6 +111,7 @@ class FrmForm{
111
  }
112
  foreach ($values['item_meta'] as $field_id => $default_value){
113
  $field = $frm_field->getOne($field_id);
 
114
  $field_options = unserialize($field->field_options);
115
  foreach (array('size','max','label','invalid','required_indicator','blank') as $opt)
116
  $field_options[$opt] = isset($values['field_options'][$opt.'_'.$field_id]) ? trim($values['field_options'][$opt.'_'.$field_id]) : '';
8
  }
9
 
10
  function create( $values ){
11
+ global $wpdb, $frm_settings;
12
 
13
  $new_values = array();
14
  $new_values['form_key'] = FrmAppHelper::get_unique_key($values['form_key'], $this->table_name, 'form_key');
20
  $new_values['prli_link_id'] = isset($link_id)?(int)$link_id:0;
21
  $options = array();
22
  $options['email_to'] = isset($values['options']['email_to']) ? $values['options']['email_to'] : '';
23
+ $options['submit_value'] = isset($values['options']['submit_value']) ? $values['options']['submit_value'] : $frm_settings->submit_value;
24
+ $options['success_msg'] = isset($values['options']['success_msg']) ? $values['options']['success_msg'] : $frm_settings->success_msg;
25
  $options['akismet'] = isset($values['options']['akismet']) ? 1 : 0;
26
  $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
27
  $options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
70
  }
71
 
72
  function update( $id, $values, $create_link = false ){
73
+ global $wpdb, $frm_field, $frm_settings;
74
 
75
  if ($create_link)
76
  $values['status'] = 'published';
85
  if (isset($values['options'])){
86
  $options = array();
87
  $options['email_to'] = isset($values['options']['email_to']) ? $values['options']['email_to'] : '';
88
+ $options['submit_value'] = isset($values['options']['submit_value']) ? $values['options']['submit_value'] : $frm_settings->submit_value;
89
+ $options['success_msg'] = isset($values['options']['success_msg']) ? $values['options']['success_msg'] : $frm_settings->success_msg;
90
  $options['akismet'] = isset($values['options']['akismet']) ? 1 : 0;
91
  $options['custom_style'] = isset($values['options']['custom_style']) ? 1 : 0;
92
  $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
111
  }
112
  foreach ($values['item_meta'] as $field_id => $default_value){
113
  $field = $frm_field->getOne($field_id);
114
+ if (!$field) continue;
115
  $field_options = unserialize($field->field_options);
116
  foreach (array('size','max','label','invalid','required_indicator','blank') as $opt)
117
  $field_options[$opt] = isset($values['field_options'][$opt.'_'.$field_id]) ? trim($values['field_options'][$opt.'_'.$field_id]) : '';
classes/models/FrmNotification.php CHANGED
@@ -5,8 +5,9 @@ class FrmNotification{
5
  }
6
 
7
  function entry_created($entry_id){
8
- global $frm_blogname, $frm_blogurl, $frm_form, $frm_entry, $frm_entry_meta;
9
 
 
10
  $entry = $frm_entry->getOne($entry_id);
11
  $form = $frm_form->getOne($entry->form_id);
12
  $values = $frm_entry_meta->getAll("it.item_id = $entry->id", " ORDER BY fi.field_order");
@@ -15,45 +16,44 @@ class FrmNotification{
15
  $to_email = $form_options['email_to'];
16
  if ($to_email == '')
17
  return;
 
 
 
18
 
19
- $opener = sprintf(__('%1$s form has been submitted on %2$s.', FRM_PLUGIN_NAME), $form->name, $frm_blogname);
20
 
21
  $entry_data = '';
22
  foreach ($values as $value){
23
- $val = maybe_unserialize($value->meta_value);
24
  if (is_array($val))
25
  $val = implode(', ', $val);
26
- $entry_data .= $value->field_name . ': ' . $val . "\n\n";
 
 
 
27
  }
28
 
29
  $data = unserialize($entry->description);
30
- $user_data = "User Information\n";
31
- $user_data .= "IP Address: ". $data['ip'] ."\n";
32
- $user_data .= "User-Agent (Browser/OS): ". $data['browser']."\n";
33
- $user_data .= "Referrer: ". $data['referrer']."\n";
34
-
35
- $mail_body =<<<MAIL_BODY
36
- {$opener}
37
-
38
- {$entry_data}
39
 
40
- {$user_data}
41
- MAIL_BODY;
42
  $subject = sprintf(__('%1$s Form submitted on %2$s', FRM_PLUGIN_NAME), $form->name, $frm_blogname); //subject
43
 
44
- $this->send_notification_email($to_email, $subject, $mail_body, 'friend_request');
 
 
 
 
45
  }
46
 
47
- function send_notification_email($to_email, $subject, $message, $message_type){
48
- global $frm_blogname;
49
-
50
- if(isset($user->hide_notifications[$message_type]))
51
- return;
52
-
53
- $from_name = $frm_blogname; //senders name
54
- $from_email = get_option('admin_email'); //senders e-mail address
55
- $recipient = "<{$to_email}>"; //recipient
56
- $header = "From: {$from_name} <{$from_email}>\r\n"; //optional headerfields
57
  $subject = html_entity_decode(strip_tags(stripslashes($subject)));
58
  $message = html_entity_decode(strip_tags(stripslashes($message)));
59
  $signature = '';//$this->get_mail_signature();
@@ -62,16 +62,17 @@ MAIL_BODY;
62
  //$to_name = $user->full_name;
63
  //$full_to_email = "{$to_name} <{$to_email}>";
64
 
65
- wp_mail($to_email, $subject, $message.$signature, $header);
 
 
 
66
 
67
- do_action('frm_notification', $to_email, $subject, $message.$signature);
68
  }
69
 
70
  function get_mail_signature(){
71
- global $frm_blogname;
72
-
73
  $thanks = __('Thanks!', FRM_PLUGIN_NAME);
74
- $team = sprintf(__('%s Team', FRM_PLUGIN_NAME), $frm_blogname);
75
  //$manage_subscription = sprintf(__('If you want to stop future emails like this from coming to you, please modify your form settings.', FRM_PLUGIN_NAME));
76
 
77
  $signature =<<<MAIL_SIGNATURE
5
  }
6
 
7
  function entry_created($entry_id){
8
+ global $frm_blogurl, $frm_form, $frm_entry, $frm_entry_meta;
9
 
10
+ $frm_blogname = get_option('blogname');
11
  $entry = $frm_entry->getOne($entry_id);
12
  $form = $frm_form->getOne($entry->form_id);
13
  $values = $frm_entry_meta->getAll("it.item_id = $entry->id", " ORDER BY fi.field_order");
16
  $to_email = $form_options['email_to'];
17
  if ($to_email == '')
18
  return;
19
+ $to_emails = explode(',', $to_email);
20
+
21
+ $from_email = '';
22
 
23
+ $opener = sprintf(__('%1$s form has been submitted on %2$s.', FRM_PLUGIN_NAME), $form->name, $frm_blogname) ."\r\n\r\n";
24
 
25
  $entry_data = '';
26
  foreach ($values as $value){
27
+ $val = apply_filters('frm_email_value', maybe_unserialize($value->meta_value), $value);
28
  if (is_array($val))
29
  $val = implode(', ', $val);
30
+
31
+ $entry_data .= $value->field_name . ': ' . $val . "\r\n\r\n";
32
+ if ($from_email == '' and is_email($val))
33
+ $from_email = $val;
34
  }
35
 
36
  $data = unserialize($entry->description);
37
+ $user_data = __('User Information', FRM_PLUGIN_NAME) ."\r\n";
38
+ $user_data .= __('IP Address', FRM_PLUGIN_NAME) . ": ". $data['ip'] ."\r\n";
39
+ $user_data .= __('User-Agent (Browser/OS)', FRM_PLUGIN_NAME) . ": ". $data['browser']."\r\n";
40
+ $user_data .= __('Referrer', FRM_PLUGIN_NAME) . ": ". $data['referrer']."\r\n";
 
 
 
 
 
41
 
42
+ $mail_body = $opener . $entry_data ."\r\n". $user_data;
 
43
  $subject = sprintf(__('%1$s Form submitted on %2$s', FRM_PLUGIN_NAME), $form->name, $frm_blogname); //subject
44
 
45
+ if(is_array($to_emails)){
46
+ foreach($to_emails as $to_email)
47
+ $this->send_notification_email(trim($to_email), $subject, $mail_body, $from_email);
48
+ }else
49
+ $this->send_notification_email($to_email, $subject, $mail_body, $from_email);
50
  }
51
 
52
+ function send_notification_email($to_email, $subject, $message, $from_email=''){
53
+ $from_name = get_option('blogname'); //senders name
54
+ $from_email = ($from_email == '') ? get_option('admin_email') : $from_email; //senders e-mail address
55
+ $recipient = $to_email; //recipient
56
+ $header = "From: {$from_email}\r\n"; //optional headerfields
 
 
 
 
 
57
  $subject = html_entity_decode(strip_tags(stripslashes($subject)));
58
  $message = html_entity_decode(strip_tags(stripslashes($message)));
59
  $signature = '';//$this->get_mail_signature();
62
  //$to_name = $user->full_name;
63
  //$full_to_email = "{$to_name} <{$to_email}>";
64
 
65
+ if (!wp_mail($recipient, $subject, $message.$signature, $header)){
66
+ $header .= "Reply-To: {$from_email}\r\n Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\r\n";
67
+ mail($recipient, $subject, $message, $header);
68
+ }
69
 
70
+ do_action('frm_notification', $recipient, $subject, $message.$signature);
71
  }
72
 
73
  function get_mail_signature(){
 
 
74
  $thanks = __('Thanks!', FRM_PLUGIN_NAME);
75
+ $team = sprintf(__('%s Team', FRM_PLUGIN_NAME), get_option('blogname'));
76
  //$manage_subscription = sprintf(__('If you want to stop future emails like this from coming to you, please modify your form settings.', FRM_PLUGIN_NAME));
77
 
78
  $signature =<<<MAIL_SIGNATURE
classes/models/FrmSettings.php CHANGED
@@ -6,6 +6,12 @@ class FrmSettings{
6
  var $lock_keys;
7
 
8
  var $custom_style;
 
 
 
 
 
 
9
 
10
  function FrmSettings(){
11
  $this->set_default_options();
@@ -22,6 +28,12 @@ class FrmSettings{
22
 
23
  if(!isset($this->custom_style))
24
  $this->custom_style = true;
 
 
 
 
 
 
25
  }
26
 
27
  function validate($params,$errors){
6
  var $lock_keys;
7
 
8
  var $custom_style;
9
+
10
+ var $success_msg;
11
+ var $failed_msg;
12
+ var $submit_value;
13
+
14
+ var $email_to;
15
 
16
  function FrmSettings(){
17
  $this->set_default_options();
28
 
29
  if(!isset($this->custom_style))
30
  $this->custom_style = true;
31
+
32
+ $this->success_msg = __('Your responses were successfully submitted. Thank you!', FRM_PLUGIN_NAME);
33
+ $this->failed_msg = __('We\'re sorry. There was an error processing your responses.', FRM_PLUGIN_NAME);
34
+ $this->submit_value = __('Submit', FRM_PLUGIN_NAME);
35
+
36
+ $this->email_to = get_option('admin_email');
37
  }
38
 
39
  function validate($params,$errors){
classes/models/FrmUpdate.php CHANGED
@@ -126,7 +126,7 @@ class FrmUpdate{
126
  function pro_cred_form(){ ?>
127
  <div class="wrap">
128
  <div id="icon-options-general" class="icon32"><br></div>
129
- <h2><?php echo FRM_PLUGIN_TITLE ?>: Pro Account Information</h2>
130
  <?php
131
  if(isset($_POST) and isset($_POST['process_cred_form']) and $_POST['process_cred_form'] == 'Y'){
132
  if($this->process_pro_cred_form()){
@@ -152,10 +152,9 @@ class FrmUpdate{
152
 
153
  $this->display_pro_cred_form(); ?>
154
 
155
- <p>Ready to take your forms to the next level?<br/>
156
- Formidable Pro will help you style forms, manage data, and get reports.</p>
157
 
158
- <a href="http://formidablepro.com">Learn More &raquo;</a>
159
  </div>
160
  <?php
161
  }
126
  function pro_cred_form(){ ?>
127
  <div class="wrap">
128
  <div id="icon-options-general" class="icon32"><br></div>
129
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: <?php _e('Pro Account Information', FRM_PLUGIN_NAME)?></h2>
130
  <?php
131
  if(isset($_POST) and isset($_POST['process_cred_form']) and $_POST['process_cred_form'] == 'Y'){
132
  if($this->process_pro_cred_form()){
152
 
153
  $this->display_pro_cred_form(); ?>
154
 
155
+ <p><?php _e('Ready to take your forms to the next level?<br/>Formidable Pro will help you style forms, manage data, and get reports.', FRM_PLUGIN_NAME) ?></p>
 
156
 
157
+ <a href="http://formidablepro.com"><?php _e('Learn More', FRM_PLUGIN_NAME) ?> &raquo;</a>
158
  </div>
159
  <?php
160
  }
classes/templates/contact.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
- $values['name'] = 'Contact Us';
4
- $values['description'] = 'We would like to hear from you. Please send us a message by filling out the form below and we will get back with you shortly.';
5
 
6
  if ($form){
7
  $form_id = $form->id;
@@ -16,43 +16,43 @@ if ($form){
16
 
17
 
18
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('text', $form_id));
19
- $field_values['name'] = 'Name';
20
  $field_values['required'] = 1;
21
- $field_values['field_options']['blank'] = 'Name cannot be blank';
22
  $frm_field->create( $field_values );
23
 
24
 
25
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('email', $form_id));
26
- $field_values['name'] = 'Email';
27
  $field_values['required'] = 1;
28
- $field_values['field_options']['blank'] = 'Email cannot be blank';
29
- $field_values['field_options']['invalid'] = 'Please enter a valid email address';
30
  $frm_field->create( $field_values );
31
 
32
 
33
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('website', $form_id));
34
- $field_values['name'] = 'Website';
35
- $field_values['field_options']['blank'] = 'Website cannot be blank';
36
- $field_values['field_options']['invalid'] = 'Website is an invalid format';
37
  $frm_field->create( $field_values );
38
 
39
 
40
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('text', $form_id));
41
- $field_values['name'] = 'Subject';
42
  $field_values['required'] = 1;
43
- $field_values['field_options']['blank'] = 'Subject cannot be blank';
44
  $frm_field->create( $field_values );
45
 
46
 
47
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('textarea', $form_id));
48
- $field_values['name'] = 'Message';
49
  $field_values['required'] = 1;
50
- $field_values['field_options']['blank'] = 'Message cannot be blank';
51
  $frm_field->create( $field_values );
52
 
53
 
54
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('captcha', $form_id));
55
- $field_values['name'] = 'Captcha';
56
  $field_values['field_options']['label'] = 'none';
57
  $frm_field->create( $field_values );
58
 
1
  <?php
2
 
3
+ $values['name'] = __('Contact Us', FRM_PLUGIN_NAME);
4
+ $values['description'] = __('We would like to hear from you. Please send us a message by filling out the form below and we will get back with you shortly.', FRM_PLUGIN_NAME);
5
 
6
  if ($form){
7
  $form_id = $form->id;
16
 
17
 
18
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('text', $form_id));
19
+ $field_values['name'] = __('Name', FRM_PLUGIN_NAME);
20
  $field_values['required'] = 1;
21
+ $field_values['field_options']['blank'] = __('Name cannot be blank', FRM_PLUGIN_NAME);
22
  $frm_field->create( $field_values );
23
 
24
 
25
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('email', $form_id));
26
+ $field_values['name'] = __('Email', FRM_PLUGIN_NAME);
27
  $field_values['required'] = 1;
28
+ $field_values['field_options']['blank'] = __('Email cannot be blank', FRM_PLUGIN_NAME);
29
+ $field_values['field_options']['invalid'] = __('Please enter a valid email address', FRM_PLUGIN_NAME);
30
  $frm_field->create( $field_values );
31
 
32
 
33
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('website', $form_id));
34
+ $field_values['name'] = __('Website', FRM_PLUGIN_NAME);
35
+ $field_values['field_options']['blank'] = __('Website cannot be blank', FRM_PLUGIN_NAME);
36
+ $field_values['field_options']['invalid'] = __('Website is an invalid format', FRM_PLUGIN_NAME);
37
  $frm_field->create( $field_values );
38
 
39
 
40
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('text', $form_id));
41
+ $field_values['name'] = __('Subject', FRM_PLUGIN_NAME);
42
  $field_values['required'] = 1;
43
+ $field_values['field_options']['blank'] = __('Subject cannot be blank', FRM_PLUGIN_NAME);
44
  $frm_field->create( $field_values );
45
 
46
 
47
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('textarea', $form_id));
48
+ $field_values['name'] = __('Message', FRM_PLUGIN_NAME);
49
  $field_values['required'] = 1;
50
+ $field_values['field_options']['blank'] = __('Message cannot be blank', FRM_PLUGIN_NAME);
51
  $frm_field->create( $field_values );
52
 
53
 
54
  $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars('captcha', $form_id));
55
+ $field_values['name'] = __('Captcha', FRM_PLUGIN_NAME);
56
  $field_values['field_options']['label'] = 'none';
57
  $frm_field->create( $field_values );
58
 
classes/views/frm-entries/direct.php CHANGED
@@ -3,7 +3,7 @@
3
 
4
  <head profile="http://gmpg.org/xfn/11">
5
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
6
-
7
  <?php global $frm_blogurl; ?>
8
  <?php if ($custom_style){
9
  $css = apply_filters('get_frm_stylesheet', FRM_URL .'/css/frm_display.css');
@@ -14,5 +14,6 @@
14
  </head>
15
  <body>
16
  <?php require_once('frm-entry.php'); ?>
 
17
  </body>
18
  </html>
3
 
4
  <head profile="http://gmpg.org/xfn/11">
5
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
6
+ <title><?php bloginfo('name'); ?></title>
7
  <?php global $frm_blogurl; ?>
8
  <?php if ($custom_style){
9
  $css = apply_filters('get_frm_stylesheet', FRM_URL .'/css/frm_display.css');
14
  </head>
15
  <body>
16
  <?php require_once('frm-entry.php'); ?>
17
+ <?php //wp_footer(); ?>
18
  </body>
19
  </html>
classes/views/frm-entries/form.php CHANGED
@@ -32,7 +32,7 @@
32
  ?>
33
  <?php if (is_admin() && !$frm_settings->lock_keys){ ?>
34
  <div class="form-field">
35
- <label>Entry Key</label>
36
  <input type="text" id="item_key" name="item_key" value="<?php echo $values['item_key'] ?>" />
37
  </div>
38
  <?php } ?>
@@ -42,8 +42,8 @@
42
 
43
  <?php echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); ?>
44
 
45
- <?php do_action('frm_entries_footer_scripts',$values['fields']); ?>
46
  <script type="text/javascript">
 
47
  function frmClearDefault(default_value,thefield){if(thefield.value==default_value)thefield.value='';}
48
  function frmReplaceDefault(default_value,thefield){if(thefield.value=='')thefield.value=default_value;}
49
  </script>
32
  ?>
33
  <?php if (is_admin() && !$frm_settings->lock_keys){ ?>
34
  <div class="form-field">
35
+ <label><?php _e('Entry Key', FRM_PLUGIN_NAME) ?></label>
36
  <input type="text" id="item_key" name="item_key" value="<?php echo $values['item_key'] ?>" />
37
  </div>
38
  <?php } ?>
42
 
43
  <?php echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); ?>
44
 
 
45
  <script type="text/javascript">
46
+ <?php do_action('frm_entries_footer_scripts',$values['fields']); ?>
47
  function frmClearDefault(default_value,thefield){if(thefield.value==default_value)thefield.value='';}
48
  function frmReplaceDefault(default_value,thefield){if(thefield.value=='')thefield.value=default_value;}
49
  </script>
classes/views/frm-entries/frm-entry.php CHANGED
@@ -1,12 +1,10 @@
1
  <?php
2
- global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $frm_recaptcha_enabled, $user_ID;
3
- $fields = $frm_field->getAll("fi.form_id='$form->id'", ' ORDER BY field_order');
4
  $form_name = $form->name;
5
  $form_options = stripslashes_deep(maybe_unserialize($form->options));
6
 
7
- $submit = isset($form_options['submit_value'])?$form_options['submit_value']:'Submit';
8
- $failed_message = "We're sorry. There was an error processing your responses.";
9
- $saved_message = isset($form_options['success_msg'])? $form_options['success_msg'] : "Your responses were successfully submitted. Thank you!";
10
 
11
  $params = FrmEntriesController::get_params($form);
12
  $message = '';
@@ -16,21 +14,23 @@ if($params['action'] == 'create' && $params['form_id'] == $form->id){
16
  $errors = $frm_entry->validate($_POST);
17
 
18
  if( !empty($errors) ){
19
- $values = FrmEntriesHelper::setup_new_vars($fields);
 
20
  require('new.php');
21
  }else{
 
22
  do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
23
- if (apply_filters('frm_continue_to_create', true)){
24
- if ($frm_entry->create( $_POST ))
25
- echo $saved_message;
26
- else
27
- echo $failed_message;
28
  }
29
  }
30
  }else{
 
31
  do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
32
- if (apply_filters('frm_continue_to_new', true, $params['action'])){
33
- $values = FrmEntriesHelper::setup_new_vars($fields);
34
  require('new.php');
35
  }
36
  }
1
  <?php
2
+ global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $user_ID, $frm_settings;
 
3
  $form_name = $form->name;
4
  $form_options = stripslashes_deep(maybe_unserialize($form->options));
5
 
6
+ $submit = isset($form_options['submit_value'])?$form_options['submit_value'] : $frm_settings->submit_value;
7
+ $saved_message = isset($form_options['success_msg'])? $form_options['success_msg'] : $frm_settings->success_msg;
 
8
 
9
  $params = FrmEntriesController::get_params($form);
10
  $message = '';
14
  $errors = $frm_entry->validate($_POST);
15
 
16
  if( !empty($errors) ){
17
+ $fields = FrmFieldsHelper::get_form_fields($form->id, true);
18
+ $values = FrmEntriesHelper::setup_new_vars($fields, $form);
19
  require('new.php');
20
  }else{
21
+ $fields = FrmFieldsHelper::get_form_fields($form->id);
22
  do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
23
+ if (apply_filters('frm_continue_to_create', true, $form->id)){
24
+ $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
25
+ $message = ($frm_entry->create( $_POST )) ? $saved_message : $frm_settings->failed_msg;
26
+ require('new.php');
 
27
  }
28
  }
29
  }else{
30
+ $fields = FrmFieldsHelper::get_form_fields($form->id);
31
  do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
32
+ if (apply_filters('frm_continue_to_new', true, $form->id, $params['action'])){
33
+ $values = FrmEntriesHelper::setup_new_vars($fields, $form);
34
  require('new.php');
35
  }
36
  }
classes/views/frm-entries/list.php CHANGED
@@ -1,11 +1,11 @@
1
  <div class="wrap">
2
  <div class="frmicon"><br></div>
3
- <h2><?php echo FRM_PLUGIN_TITLE ?>: Pro Entries</h2>
4
 
5
  <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
6
 
7
  <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
8
 
9
- Please upgrade to Formidable Pro to see your saved entries
10
 
11
  </div>
1
  <div class="wrap">
2
  <div class="frmicon"><br></div>
3
+ <h2><?php echo FRM_PLUGIN_TITLE ?>: <?php _e('Pro Entries', FRM_PLUGIN_NAME) ?></h2>
4
 
5
  <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
6
 
7
  <?php require(FRM_VIEWS_PATH.'/shared/nav.php'); ?>
8
 
9
+ <p><?php printf(__('Upgrade to %1$sFormidable Pro%2$s to view, search, export, and bulk delete your saved entries.', FRM_PLUGIN_NAME), '<a href="http://formidablepro.com">', '</a>'); ?></p>
10
 
11
  </div>
classes/views/frm-entries/new.php CHANGED
@@ -1,14 +1,14 @@
1
  <div class="frm_forms<?php echo ($values['custom_style']) ? ' with_frm_style' : ''; ?>" id="frm_form_<?php echo $form->id ?>_container">
2
- <?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
3
 
4
  <form action="" enctype="multipart/form-data" method="post" class="frm-show-form" id="form_<?php echo $form->form_key ?>">
 
5
  <?php $form_action = 'create'; ?>
6
 
7
  <?php require(FRM_VIEWS_PATH.'/frm-entries/form.php'); ?>
8
 
9
  <?php if (!$form->is_template){ ?>
10
  <p class="submit">
11
- <?php if (!isset($submit)) $submit = 'Submit';?>
12
  <input type="submit" name="<?php echo $submit ?>" value="<?php echo $submit ?>" />
13
  </p>
14
  <?php } ?>
1
  <div class="frm_forms<?php echo ($values['custom_style']) ? ' with_frm_style' : ''; ?>" id="frm_form_<?php echo $form->id ?>_container">
 
2
 
3
  <form action="" enctype="multipart/form-data" method="post" class="frm-show-form" id="form_<?php echo $form->form_key ?>">
4
+ <?php include(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
5
  <?php $form_action = 'create'; ?>
6
 
7
  <?php require(FRM_VIEWS_PATH.'/frm-entries/form.php'); ?>
8
 
9
  <?php if (!$form->is_template){ ?>
10
  <p class="submit">
11
+ <?php if (!isset($submit)) $submit = $frm_settings->submit_value;?>
12
  <input type="submit" name="<?php echo $submit ?>" value="<?php echo $submit ?>" />
13
  </p>
14
  <?php } ?>
classes/views/frm-fields/input.php CHANGED
@@ -14,13 +14,12 @@
14
  <?php }else if ($field['type'] == 'select'){?>
15
  <select name="<?php echo $field_name ?>" id="item_meta<?php echo $field['id'] ?>" <?php echo $auto_width ?>>
16
  <?php foreach ($field['options'] as $opt){ ?>
17
- <option value='<?php echo $opt ?>' <?php if ($field['value'] == $opt) echo 'selected="selected"'; ?>><?php echo $opt ?></option>
18
  <?php } ?>
19
  </select>
20
  <?php }else if ($field['type'] == 'captcha'){
21
- global $frm_recaptcha_enabled;
22
- if ($frm_recaptcha_enabled)
23
- FrmAppHelper::display_recaptcha($errors);
24
  }else if ($field['type'] == 'checkbox'){
25
  $checked_values = $field['value'];
26
  foreach ($field['options'] as $opt){
14
  <?php }else if ($field['type'] == 'select'){?>
15
  <select name="<?php echo $field_name ?>" id="item_meta<?php echo $field['id'] ?>" <?php echo $auto_width ?>>
16
  <?php foreach ($field['options'] as $opt){ ?>
17
+ <option value="<?php echo $opt ?>" <?php if ($field['value'] == $opt) echo 'selected="selected"'; ?>><?php echo $opt ?></option>
18
  <?php } ?>
19
  </select>
20
  <?php }else if ($field['type'] == 'captcha'){
21
+ if (array_key_exists('captcha', FrmFieldsHelper::field_selection()))
22
+ FrmAppHelper::display_recaptcha();
 
23
  }else if ($field['type'] == 'checkbox'){
24
  $checked_values = $field['value'];
25
  foreach ($field['options'] as $opt){
classes/views/frm-fields/single-option.php CHANGED
@@ -2,7 +2,7 @@
2
  <span class="frm_spacer"></span>
3
  <a href="javascript:frm_delete_field_option(<?php echo $field['id']?>, <?php echo $opt_key ?>);" class="frm_single_show_hover alignleft" ><img src="<?php echo FRM_IMAGES_URL ?>/trash.png" alt="Delete"></a>
4
  <?php if ($field['type'] != 'select'){ ?>
5
- <input type='<?php echo $field['type'] ?>' name='<?php echo $field_name ?><?php echo ($field['type'] == 'checkbox')?'[]':''; ?>' value='<?php echo $opt ?>'<?php echo isset($checked)? $checked : ''; ?>/>
6
  <?php } ?>
7
  <span class="frm_ipe_field_option" id="field_<?php echo $field['id']?>-<?php echo $opt_key ?>"><?php echo $opt ?></span>
8
  </span>
2
  <span class="frm_spacer"></span>
3
  <a href="javascript:frm_delete_field_option(<?php echo $field['id']?>, <?php echo $opt_key ?>);" class="frm_single_show_hover alignleft" ><img src="<?php echo FRM_IMAGES_URL ?>/trash.png" alt="Delete"></a>
4
  <?php if ($field['type'] != 'select'){ ?>
5
+ <input type="<?php echo $field['type'] ?>" name="<?php echo $field_name ?><?php echo ($field['type'] == 'checkbox')?'[]':''; ?>" value="<?php echo str_replace('"', '&quot;', $opt) ?>"<?php echo isset($checked)? $checked : ''; ?>/>
6
  <?php } ?>
7
  <span class="frm_ipe_field_option" id="field_<?php echo $field['id']?>-<?php echo $opt_key ?>"><?php echo $opt ?></span>
8
  </span>
classes/views/frm-forms/add_field.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php $display = apply_filters('frm_display_field_options', array('type' => $field['type'], 'field_data' => $field, 'required' => true, 'description' => true, 'options' => true, 'label_position' => true, 'invalid' => false, 'size' => false, 'clear_on_focus' => false, 'default_blank' => true)); ?>
2
 
3
- <li id="frm_field_id_<?php echo $field['id']; ?>" class="edit_form_item frm_field_box ui-state-default frm_hide_options<?php echo $display['options'] ?>">
4
  <a href="javascript:void(0);" class="alignright frm-show-hover frm-move" title="Move Field"><img src="<?php echo FRM_IMAGES_URL ?>/move.png" alt="Move"></a>
5
  <a href="javascript:frm_delete_field(<?php echo $field['id']; ?>)" class="alignright frm-show-hover" id="frm_delete_field<?php echo $field['id']; ?>" title="Delete Field"><img src="<?php echo FRM_IMAGES_URL ?>/trash.png" alt="Delete"></a>
6
  <?php do_action('frm_extra_field_actions', $field['id']); ?>
@@ -15,14 +15,14 @@
15
  <?php if ($display['type'] == 'text'){ ?>
16
  <input type="text" name="<?php echo $field_name ?>" value="<?php echo $field['default_value']; ?>" size="<?php echo $field['size']; ?>"/>
17
  <?php }else if ($field['type'] == 'textarea'){ ?>
18
- <textarea name="<?php echo $field_name ?>" cols="<?php echo $field['size']; ?>" rows="<?php echo $field['max']; ?>"><?php echo $field['default_value']; ?></textarea>
19
 
20
  <?php }else if ($field['type'] == 'radio' || $field['type'] == 'checkbox'){
21
  $field['value'] = maybe_unserialize($field['default_value']); ?>
22
  <?php require(FRM_VIEWS_PATH.'/frm-fields/radio.php'); ?>
23
 
24
  <div id="frm_add_field_<?php echo $field['id']; ?>" class="frm-show-click">
25
- <a href="javascript:frm_add_field_option(<?php echo $field['id']; ?>)"><span class="ui-icon ui-icon-plusthick alignleft"></span> Add an Option</a>
26
  </div>
27
 
28
  <?php }else if ($field['type'] == 'select'){ ?>
@@ -35,23 +35,21 @@
35
  <?php if ($display['default_blank']) FrmFieldsHelper::show_default_blank_js($field['id'], $field['default_blank']); ?>
36
  <br/>
37
  <div class="frm-show-click">
38
- <?php foreach ($field['options'] as $opt_key => $opt)
39
- require(FRM_VIEWS_PATH.'/frm-fields/single-option.php');
40
- ?>
41
- </div>
42
- <div id="frm_add_field_<?php echo $field['id']; ?>" class="frm-show-click">
43
- <a href="javascript:frm_add_field_option(<?php echo $field['id']; ?>)"><span class="ui-icon ui-icon-plusthick alignleft"></span> Add an Option</a>
44
- <?php do_action('frm_add_multiple_opts', $field); ?>
45
  </div>
46
-
47
  <?php }else if ($field['type'] == 'captcha'){
48
- if ($frm_recaptcha_enabled){
49
  global $recaptcha_opt, $frm_siteurl; ?>
50
  <img src="<?php echo FRM_URL ?>/images/<?php echo $recaptcha_opt['re_theme'];?>-captcha.png">
51
- <span class="howto">Hint: Change colors in the "Registration Options" <a href="<?php echo $frm_siteurl ?>/wp-admin/options-general.php?page=wp-recaptcha/wp-recaptcha.php">reCAPTCHA settings</a></span>
52
  <input type="hidden" name="<?php echo $field_name ?>" value="1"/>
53
  <?php }else
54
- echo 'Please download and activate the WP reCAPTCHA plugin to enable this feature.';
55
 
56
  }else
57
  do_action('frm_display_added_fields',$field);
@@ -64,43 +62,44 @@ if ($display['clear_on_focus']){
64
  }
65
 
66
  if ($display['description']){ ?>
67
- <div class="frm_ipe_field_desc description" id="field_<?php echo $field['id']; ?>"><?php echo $field['description']; ?></div>
68
  <?php
69
  }
70
 
71
  if ($display['options']){ ?>
72
  <h3 class="ui-accordion-header ui-state-default">
73
  <span class="ui-icon ui-icon-triangle-1-e"></span>
74
- <a href="#">Field Options</a>
75
  </h3>
76
  <div class="ui-widget-content ui-corner-bottom">
77
  <?php if ($display['size']){ ?>
78
- <p><label><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')?'Columns':'Field Size' ?>:</label>
79
  <input type="text" name="field_options[size_<?php echo $field['id'] ?>]" value="<?php echo $field['size']; ?>" size="5">
80
 
81
- <label class="nofloat"><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')?'Rows':'Max length of input' ?>:</label>
82
  <input type="text" name="field_options[max_<?php echo $field['id'] ?>]" value="<?php echo $field['max']; ?>" size="5">
83
  </p>
84
  <?php } ?>
85
  <?php if ($display['label_position']){ ?>
86
- <p><label>Label Position:</label>
87
  <select name="field_options[label_<?php echo $field['id'] ?>]">
88
- <option value="top"<?php echo ($field['label'] == 'top')?(' selected="true"'):(''); ?>>Top</option>
89
- <option value="left"<?php echo ($field['label'] == 'left')?(' selected="true"'):(''); ?>>Left</option>
90
- <option value="none"<?php echo ($field['label'] == 'none')?(' selected="true"'):(''); ?>>Hidden</option>
 
91
  </select>
92
  </p>
93
  <?php } ?>
94
  <?php if ($display['required']){ ?>
95
- <p><label>Indicate required field with:</label>
96
  <input type="text" name="field_options[required_indicator_<?php echo $field['id'] ?>]" value="<?php echo $field['required_indicator']; ?>">
97
  </p>
98
- <p><label>Error message if required field is left blank:</label>
99
  <input type="text" name="field_options[blank_<?php echo $field['id'] ?>]" value="<?php echo $field['blank']; ?>" size="50">
100
  </p>
101
  <?php } ?>
102
  <?php if ($display['invalid']){ ?>
103
- <p><label>Error message if entry is an invalid format:</label>
104
  <input type="text" name="field_options[invalid_<?php echo $field['id'] ?>]" value="<?php echo $field['invalid']; ?>" size="50">
105
  </p>
106
  <?php } ?>
1
  <?php $display = apply_filters('frm_display_field_options', array('type' => $field['type'], 'field_data' => $field, 'required' => true, 'description' => true, 'options' => true, 'label_position' => true, 'invalid' => false, 'size' => false, 'clear_on_focus' => false, 'default_blank' => true)); ?>
2
 
3
+ <li id="frm_field_id_<?php echo $field['id']; ?>" class="edit_form_item frm_field_box ui-state-default frm_hide_options<?php echo $display['options'] ?> edit_field_type_<?php echo $display['type'] ?>" onmouseover="frm_field_hover(1,<?php echo $field['id']; ?>)" onmouseout="frm_field_hover(0,<?php echo $field['id']; ?>)">
4
  <a href="javascript:void(0);" class="alignright frm-show-hover frm-move" title="Move Field"><img src="<?php echo FRM_IMAGES_URL ?>/move.png" alt="Move"></a>
5
  <a href="javascript:frm_delete_field(<?php echo $field['id']; ?>)" class="alignright frm-show-hover" id="frm_delete_field<?php echo $field['id']; ?>" title="Delete Field"><img src="<?php echo FRM_IMAGES_URL ?>/trash.png" alt="Delete"></a>
6
  <?php do_action('frm_extra_field_actions', $field['id']); ?>
15
  <?php if ($display['type'] == 'text'){ ?>
16
  <input type="text" name="<?php echo $field_name ?>" value="<?php echo $field['default_value']; ?>" size="<?php echo $field['size']; ?>"/>
17
  <?php }else if ($field['type'] == 'textarea'){ ?>
18
+ <textarea name="<?php echo $field_name ?>"<?php if ($field['size']) echo ' cols="'.$field['size'].'"' ?> rows="<?php echo $field['max']; ?>"><?php echo $field['default_value']; ?></textarea>
19
 
20
  <?php }else if ($field['type'] == 'radio' || $field['type'] == 'checkbox'){
21
  $field['value'] = maybe_unserialize($field['default_value']); ?>
22
  <?php require(FRM_VIEWS_PATH.'/frm-fields/radio.php'); ?>
23
 
24
  <div id="frm_add_field_<?php echo $field['id']; ?>" class="frm-show-click">
25
+ <a href="javascript:frm_add_field_option(<?php echo $field['id']; ?>)"><span class="ui-icon ui-icon-plusthick alignleft"></span> <?php _e('Add an Option', FRM_PLUGIN_NAME) ?></a>
26
  </div>
27
 
28
  <?php }else if ($field['type'] == 'select'){ ?>
35
  <?php if ($display['default_blank']) FrmFieldsHelper::show_default_blank_js($field['id'], $field['default_blank']); ?>
36
  <br/>
37
  <div class="frm-show-click">
38
+ <?php foreach ($field['options'] as $opt_key => $opt) require(FRM_VIEWS_PATH.'/frm-fields/single-option.php'); ?>
39
+ <div id="frm_add_field_<?php echo $field['id']; ?>">
40
+ <a href="javascript:frm_add_field_option(<?php echo $field['id']; ?>)"><span class="ui-icon ui-icon-plusthick alignleft"></span>
41
+ <?php _e('Add an Option', FRM_PLUGIN_NAME) ?></a>
42
+ <?php do_action('frm_add_multiple_opts', $field); ?>
43
+ </div>
 
44
  </div>
 
45
  <?php }else if ($field['type'] == 'captcha'){
46
+ if (array_key_exists('captcha', FrmFieldsHelper::field_selection())){
47
  global $recaptcha_opt, $frm_siteurl; ?>
48
  <img src="<?php echo FRM_URL ?>/images/<?php echo $recaptcha_opt['re_theme'];?>-captcha.png">
49
+ <span class="howto"><?php printf(__('Hint: Change colors in the "Registration Options" %1$sreCAPTCHA settings', FRM_PLUGIN_NAME), '<a href="'. $frm_siteurl .'/wp-admin/options-general.php?page=wp-recaptcha/wp-recaptcha.php">') ?></a></span>
50
  <input type="hidden" name="<?php echo $field_name ?>" value="1"/>
51
  <?php }else
52
+ _e('Please download and activate the WP reCAPTCHA plugin to enable this feature.', FRM_PLUGIN_NAME);
53
 
54
  }else
55
  do_action('frm_display_added_fields',$field);
62
  }
63
 
64
  if ($display['description']){ ?>
65
+ <div class="frm_ipe_field_desc description frm-show-click" id="field_<?php echo $field['id']; ?>"><?php echo $field['description']; ?></div>
66
  <?php
67
  }
68
 
69
  if ($display['options']){ ?>
70
  <h3 class="ui-accordion-header ui-state-default">
71
  <span class="ui-icon ui-icon-triangle-1-e"></span>
72
+ <a href="#"><?php _e('Field Options', FRM_PLUGIN_NAME) ?></a>
73
  </h3>
74
  <div class="ui-widget-content ui-corner-bottom">
75
  <?php if ($display['size']){ ?>
76
+ <p><label><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')? __('Columns', FRM_PLUGIN_NAME) : __('Field Size', FRM_PLUGIN_NAME) ?>:</label>
77
  <input type="text" name="field_options[size_<?php echo $field['id'] ?>]" value="<?php echo $field['size']; ?>" size="5">
78
 
79
+ <label class="nofloat"><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')? __('Rows', FRM_PLUGIN_NAME) : __('Max length of input', FRM_PLUGIN_NAME) ?>:</label>
80
  <input type="text" name="field_options[max_<?php echo $field['id'] ?>]" value="<?php echo $field['max']; ?>" size="5">
81
  </p>
82
  <?php } ?>
83
  <?php if ($display['label_position']){ ?>
84
+ <p><label><?php _e('Label Position', FRM_PLUGIN_NAME) ?>:</label>
85
  <select name="field_options[label_<?php echo $field['id'] ?>]">
86
+ <option value="top"<?php echo ($field['label'] == 'top')?(' selected="true"'):(''); ?>><?php _e('Top', FRM_PLUGIN_NAME) ?></option>
87
+ <option value="left"<?php echo ($field['label'] == 'left')?(' selected="true"'):(''); ?>><?php _e('Left', FRM_PLUGIN_NAME) ?></option>
88
+ <option value="right"<?php echo ($field['label'] == 'right')?(' selected="true"'):(''); ?>><?php _e('Right', FRM_PLUGIN_NAME) ?></option>
89
+ <option value="none"<?php echo ($field['label'] == 'none')?(' selected="true"'):(''); ?>><?php _e('Hidden', FRM_PLUGIN_NAME) ?></option>
90
  </select>
91
  </p>
92
  <?php } ?>
93
  <?php if ($display['required']){ ?>
94
+ <p><label><?php _e('Indicate required field with', FRM_PLUGIN_NAME) ?>:</label>
95
  <input type="text" name="field_options[required_indicator_<?php echo $field['id'] ?>]" value="<?php echo $field['required_indicator']; ?>">
96
  </p>
97
+ <p><label><?php _e('Error message if required field is left blank', FRM_PLUGIN_NAME) ?>:</label>
98
  <input type="text" name="field_options[blank_<?php echo $field['id'] ?>]" value="<?php echo $field['blank']; ?>" size="50">
99
  </p>
100
  <?php } ?>
101
  <?php if ($display['invalid']){ ?>
102
+ <p><label><?php _e('Error message if entry is an invalid format', FRM_PLUGIN_NAME) ?>:</label>
103
  <input type="text" name="field_options[invalid_<?php echo $field['id'] ?>]" value="<?php echo $field['invalid']; ?>" size="50">
104
  </p>
105
  <?php } ?>
classes/views/frm-forms/add_field_links.php CHANGED
@@ -1,25 +1,25 @@
1
  <div id="frm_form_options" class="alignright">
2
  <?php if (!$values['is_template']){ ?>
3
- <p class="howto">Copy this code and paste it into your post, page or text widget:</p>
4
- <input type='text' style="text-align:center; font-weight:bold; width: 100%;" readonly="true" onclick='this.select();' onfocus='this.select();' value='[formidable id=<?php echo $id; ?>]' /><br/><br/>
5
  <?php } ?>
6
 
7
  <ul class="frmbutton nodrag">
8
- <li class="ui-widget-header"><a href="<?php echo FrmFormsHelper::get_direct_link($values['form_key']); ?>" target="blank" >Preview Form</a></li>
9
  <?php global $frm_settings; if ($frm_settings->preview_page_id > 0){ ?>
10
- <li class="ui-widget-header"><a href="<?php echo add_query_arg('form', $values['form_key'], get_permalink($frm_settings->preview_page_id)) ?>" target="blank" class="frmbutton">Preview Form in Current Theme</a></li>
11
  <?php } ?>
12
  </ul>
13
 
14
- <p class="howto">Click on or drag a field into your form</p>
15
  <div id="themeRoller" class="clearfix">
16
  <div id="rollerTabs">
17
 
18
  <fieldset class="clearfix">
19
  <div class="theme-group clearfix">
20
  <div class="theme-group-header state-default">
21
- <span class="icon icon-triangle-1-e">Collapse</span>
22
- <a href="#">Basic Fields</a>
23
  </div><!-- /theme group Error -->
24
  <div class="theme-group-content corner-bottom clearfix">
25
  <div class="clearfix">
@@ -27,60 +27,65 @@
27
  <?php foreach ($frm_field_selection as $field_key => $field_type){ ?>
28
  <li class="frmbutton button" id="<?php echo $field_key ?>"><a href="javascript:add_frm_field_link(<?php echo $id ?>, '<?php echo $field_key ?>');"><?php echo $field_type ?></a></li>
29
  <?php } ?>
30
- <?php if (!$frm_recaptcha_enabled && !function_exists( 'akismet_http_post' )){
31
- global $frm_siteurl;
32
- echo '<p class="howto">Hint: Download and activate <a href="'.$frm_siteurl.'/wp-admin/plugin-install.php?tab=plugin-information&amp;plugin=wp-recaptcha&amp;TB_iframe=true&amp;width=640&amp;height=593" class="thickbox onclick" title="WP-reCAPTCHA 2.9.6">WP-reCAPTCHA</a> to add a captcha to your form. Alternatively activate Akismet for captcha-free spam screening.</p>';
33
- } ?>
34
  </ul>
35
  </div>
36
-
37
  </div><!-- /theme group content -->
38
  </div><!-- /theme group -->
39
 
40
  <div class="theme-group clearfix">
41
  <div class="theme-group-header state-default">
42
- <span class="icon icon-triangle-1-e">Collapse</span>
43
- <a href="#">Pro Fields</a>
44
  </div><!-- /theme group Error -->
45
  <div class="theme-group-content corner-bottom clearfix">
46
  <div class="clearfix">
47
  <ul class="field_type_list">
48
  <?php
49
  if($frmpro_is_installed){
50
- foreach ($frm_pro_field_selection as $field_key => $field_type){ ?>
51
  <li class="frmbutton button" id="<?php echo $field_key ?>"><a href="javascript:add_frm_field_link(<?php echo $id ?>, '<?php echo $field_key ?>');"><?php echo $field_type ?></a></li>
52
  <?php }
53
  }else
54
- foreach ($frm_pro_field_selection as $field_key => $field_type)
55
  echo '<li class="frmbutton">'.$field_type.'</li>';
56
  ?>
57
  </ul>
58
  </div>
59
-
60
  </div><!-- /theme group content -->
61
  </div><!-- /theme group -->
62
 
63
 
64
  <div class="theme-group clearfix">
65
  <div class="theme-group-header state-default">
66
- <span class="icon icon-triangle-1-e">Collapse</span>
67
- <a href="#">Key</a>
68
  </div><!-- /theme group Content -->
69
  <div class="theme-group-content corner-bottom clearfix">
70
 
71
  <div class="clearfix">
72
  <ul class="ui-state-default">
73
- <li><span class="ui-icon ui-icon-star alignleft"></span> = required field</li>
74
- <li><span class="frm_inactive_icon ui-icon ui-icon-star alignleft"></span> = not required</li>
75
- <li><span><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></span> = clear default text on click</li>
76
- <li><span class="frm_inactive_icon"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></span> = do not clear default text on click</li>
77
- <li><span><img src="<?php echo FRM_IMAGES_URL?>/error.png"></span> = default value will NOT pass validation</li>
78
- <li><span class="frm_inactive_icon"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></span> = default value will pass validation</li>
79
- <li><span><img src="<?php echo FRM_IMAGES_URL ?>/trash.png" alt="Delete"></span> = delete field and all inputed data</li>
80
- <li><span><img src="<?php echo FRM_IMAGES_URL ?>/duplicate.png" alt="Move"></span> = duplicate field</li>
81
- <li><span><img src="<?php echo FRM_IMAGES_URL ?>/move.png" alt="Move"></span> = move field</li>
 
 
 
 
 
 
 
 
82
  </ul>
83
-
84
  </div>
85
  </div><!-- /theme group content -->
86
  </div><!-- /theme group -->
@@ -88,8 +93,9 @@
88
  </fieldset>
89
 
90
  </div>
 
91
  </div><!-- /themeroller -->
92
 
93
- <p class="howto">Enter or select default values into fields on this form.</p>
94
 
95
  </div>
1
  <div id="frm_form_options" class="alignright">
2
  <?php if (!$values['is_template']){ ?>
3
+ <p class="howto"><?php _e('Copy this code and paste it into your post, page or text widget', FRM_PLUGIN_NAME) ?>:
4
+ <input type='text' style="text-align:center; font-weight:bold; width: 100%;" readonly="true" onclick='this.select();' onfocus='this.select();' value='[formidable id=<?php echo $id; ?>]' /></p>
5
  <?php } ?>
6
 
7
  <ul class="frmbutton nodrag">
8
+ <li class="ui-widget-header"><a href="<?php echo FrmFormsHelper::get_direct_link($values['form_key']); ?>" target="blank" ><?php _e('Preview Form', FRM_PLUGIN_NAME) ?></a></li>
9
  <?php global $frm_settings; if ($frm_settings->preview_page_id > 0){ ?>
10
+ <li class="ui-widget-header"><a href="<?php echo add_query_arg('form', $values['form_key'], get_permalink($frm_settings->preview_page_id)) ?>" target="blank" class="frmbutton"><?php _e('Preview Form in Current Theme', FRM_PLUGIN_NAME) ?></a></li>
11
  <?php } ?>
12
  </ul>
13
 
14
+ <p class="howto"><?php _e('Click on or drag a field into your form', FRM_PLUGIN_NAME) ?></p>
15
  <div id="themeRoller" class="clearfix">
16
  <div id="rollerTabs">
17
 
18
  <fieldset class="clearfix">
19
  <div class="theme-group clearfix">
20
  <div class="theme-group-header state-default">
21
+ <span class="icon icon-triangle-1-e"><?php _e('Collapse', FRM_PLUGIN_NAME) ?></span>
22
+ <a href="#"><?php _e('Basic Fields', FRM_PLUGIN_NAME) ?></a>
23
  </div><!-- /theme group Error -->
24
  <div class="theme-group-content corner-bottom clearfix">
25
  <div class="clearfix">
27
  <?php foreach ($frm_field_selection as $field_key => $field_type){ ?>
28
  <li class="frmbutton button" id="<?php echo $field_key ?>"><a href="javascript:add_frm_field_link(<?php echo $id ?>, '<?php echo $field_key ?>');"><?php echo $field_type ?></a></li>
29
  <?php } ?>
30
+ <?php if (!array_key_exists('captcha', $frm_field_selection) && !function_exists( 'akismet_http_post' )){
31
+ global $frm_siteurl; ?>
32
+ <p class="howto"><?php printf(__('Hint: Download and activate %1$sWP-reCAPTCHA%2$s to add a captcha to your form. Alternatively activate Akismet for captcha-free spam screening.', FRM_PLUGIN_NAME), '<a href="'.$frm_siteurl.'/wp-admin/plugin-install.php?tab=plugin-information&amp;plugin=wp-recaptcha&amp;TB_iframe=true&amp;width=640&amp;height=593" class="thickbox onclick" title="WP-reCAPTCHA">', '</a>'); ?></p>
33
+ <?php } ?>
34
  </ul>
35
  </div>
 
36
  </div><!-- /theme group content -->
37
  </div><!-- /theme group -->
38
 
39
  <div class="theme-group clearfix">
40
  <div class="theme-group-header state-default">
41
+ <span class="icon icon-triangle-1-e"><?php _e('Collapse', FRM_PLUGIN_NAME) ?></span>
42
+ <a href="#"><?php _e('Pro Fields', FRM_PLUGIN_NAME) ?></a>
43
  </div><!-- /theme group Error -->
44
  <div class="theme-group-content corner-bottom clearfix">
45
  <div class="clearfix">
46
  <ul class="field_type_list">
47
  <?php
48
  if($frmpro_is_installed){
49
+ foreach (FrmFieldsHelper::pro_field_selection() as $field_key => $field_type){ ?>
50
  <li class="frmbutton button" id="<?php echo $field_key ?>"><a href="javascript:add_frm_field_link(<?php echo $id ?>, '<?php echo $field_key ?>');"><?php echo $field_type ?></a></li>
51
  <?php }
52
  }else
53
+ foreach (FrmFieldsHelper::pro_field_selection() as $field_key => $field_type)
54
  echo '<li class="frmbutton">'.$field_type.'</li>';
55
  ?>
56
  </ul>
57
  </div>
 
58
  </div><!-- /theme group content -->
59
  </div><!-- /theme group -->
60
 
61
 
62
  <div class="theme-group clearfix">
63
  <div class="theme-group-header state-default">
64
+ <span class="icon icon-triangle-1-e"><?php _e('Collapse', FRM_PLUGIN_NAME) ?></span>
65
+ <a href="#"><?php _e('Key', FRM_PLUGIN_NAME) ?></a>
66
  </div><!-- /theme group Content -->
67
  <div class="theme-group-content corner-bottom clearfix">
68
 
69
  <div class="clearfix">
70
  <ul class="ui-state-default">
71
+ <li><span class="ui-icon ui-icon-star alignleft"></span> = <?php _e('required field', FRM_PLUGIN_NAME) ?></li>
72
+ <li><span class="frm_inactive_icon ui-icon ui-icon-star alignleft"></span>
73
+ = <?php _e('not required', FRM_PLUGIN_NAME) ?></li>
74
+ <li><span><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></span>
75
+ = <?php _e('clear default text on click', FRM_PLUGIN_NAME) ?></li>
76
+ <li><span class="frm_inactive_icon"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></span>
77
+ = <?php _e('do not clear default text on click', FRM_PLUGIN_NAME) ?></li>
78
+ <li><span><img src="<?php echo FRM_IMAGES_URL?>/error.png"></span>
79
+ = <?php _e('default value will NOT pass validation', FRM_PLUGIN_NAME) ?></li>
80
+ <li><span class="frm_inactive_icon"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></span>
81
+ = <?php _e('default value will pass validation', FRM_PLUGIN_NAME) ?></li>
82
+ <li><span><img src="<?php echo FRM_IMAGES_URL ?>/trash.png" alt="Delete"></span>
83
+ = <?php _e('delete field and all inputed data', FRM_PLUGIN_NAME) ?></li>
84
+ <li><span><img src="<?php echo FRM_IMAGES_URL ?>/duplicate.png" alt="Move"></span>
85