Formidable Forms – Form Builder for WordPress - Version 1.01.04

Version Description

  • Updated in-place edit to work with more characters and function without the save buttons
  • Fixed bug causing several form options to be lost when the form name or description was edited without also clicking update for the whole form
  • Made more user interface modifications
  • PRO: Added dynamic default values for GET/POST variables
  • PRO: Added shortcode for fetching field-wide calculations [frm-stats id=5 type=(count, total, average, or median)]
  • PRO: Added icon link to duplicate an individual field
  • PRO: Increased the WPMU efficiency so the templates are only updated if the database version is changed
  • PRO: Added functionality to the 'Data From Entries' field to use another observed 'Data From Entries' field to join a third form
  • PRO: Fixed admin entry searches to start on first page of results if search was submitted from a higher page
Download this release

Release Info

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

Code changes from version 1.0.12 to 1.01.04

Files changed (93) hide show
  1. classes/controllers/FrmAppController.php +76 -24
  2. classes/controllers/FrmFieldsController.php +4 -6
  3. classes/controllers/FrmFormsController.php +5 -5
  4. classes/controllers/FrmSettingsController.php +11 -14
  5. classes/helpers/FrmAppHelper.php +7 -4
  6. classes/helpers/FrmEntriesHelper.php +8 -2
  7. classes/helpers/FrmFieldsHelper.php +4 -4
  8. classes/helpers/FrmFormsHelper.php +2 -1
  9. classes/models/FrmEntry.php +15 -10
  10. classes/models/FrmField.php +15 -6
  11. classes/models/FrmForm.php +50 -22
  12. classes/models/FrmSettings.php +13 -19
  13. classes/models/FrmUpdate.php +57 -18
  14. classes/templates/contact.php +0 -3
  15. classes/views/frm-entries/direct.php +12 -7
  16. classes/views/frm-entries/form.php +8 -2
  17. classes/views/frm-entries/frm-entry.php +0 -1
  18. classes/views/frm-entries/new.php +3 -3
  19. classes/views/frm-fields/input.php +9 -8
  20. classes/views/frm-fields/single-option.php +2 -2
  21. classes/views/frm-forms/add_field.php +51 -65
  22. classes/views/frm-forms/add_field_links.php +84 -55
  23. classes/views/frm-forms/edit.php +5 -0
  24. classes/views/frm-forms/footer.php +53 -31
  25. classes/views/frm-forms/form.php +12 -5
  26. classes/views/frm-forms/list.php +1 -1
  27. classes/views/frm-forms/new-field-js.php +20 -90
  28. classes/views/frm-forms/new-option-js.php +7 -32
  29. classes/views/frm-forms/new-selection.php +1 -1
  30. classes/views/frm-settings/form.php +10 -2
  31. classes/views/shared/head.php +2 -2
  32. css/frm_admin.css +423 -28
  33. css/frm_display.css +12 -6
  34. formidable.php +3 -3
  35. images/duplicate.png +0 -0
  36. images/move.png +0 -0
  37. images/trash.png +0 -0
  38. js/jquery/jquery-ui-themepicker.js +539 -20
  39. js/jquery/jquery.editinplace.js +4 -2
  40. js/jquery/jquery.editinplace.packed.js +4 -4
  41. js/json2.js +0 -461
  42. js/list-items.js +13 -25
  43. js/nicedit.js +0 -118
  44. js/ofc-library/JSON.php +0 -806
  45. js/ofc-library/README.txt +0 -16
  46. js/ofc-library/dot_base.php +0 -231
  47. js/ofc-library/json_format.php +0 -86
  48. js/ofc-library/ofc_area_base.php +0 -40
  49. js/ofc-library/ofc_area_hollow.php +0 -10
  50. js/ofc-library/ofc_area_line.php +0 -10
  51. js/ofc-library/ofc_arrow.php +0 -27
  52. js/ofc-library/ofc_bar.php +0 -34
  53. js/ofc-library/ofc_bar_3d.php +0 -22
  54. js/ofc-library/ofc_bar_base.php +0 -97
  55. js/ofc-library/ofc_bar_filled.php +0 -39
  56. js/ofc-library/ofc_bar_glass.php +0 -131
  57. js/ofc-library/ofc_bar_sketch.php +0 -29
  58. js/ofc-library/ofc_bar_stack.php +0 -55
  59. js/ofc-library/ofc_candle.php +0 -41
  60. js/ofc-library/ofc_hbar.php +0 -64
  61. js/ofc-library/ofc_line.php +0 -157
  62. js/ofc-library/ofc_line_base.php +0 -92
  63. js/ofc-library/ofc_line_dot.php +0 -33
  64. js/ofc-library/ofc_line_hollow.php +0 -9
  65. js/ofc-library/ofc_line_style.php +0 -11
  66. js/ofc-library/ofc_menu.php +0 -56
  67. js/ofc-library/ofc_pie.php +0 -257
  68. js/ofc-library/ofc_radar_axis.php +0 -47
  69. js/ofc-library/ofc_radar_axis_labels.php +0 -15
  70. js/ofc-library/ofc_radar_spoke_labels.php +0 -15
  71. js/ofc-library/ofc_scatter.php +0 -47
  72. js/ofc-library/ofc_scatter_line.php +0 -49
  73. js/ofc-library/ofc_shape.php +0 -25
  74. js/ofc-library/ofc_sugar.php +0 -43
  75. js/ofc-library/ofc_tags.php +0 -133
  76. js/ofc-library/ofc_title.php +0 -39
  77. js/ofc-library/ofc_tooltip.php +0 -67
  78. js/ofc-library/ofc_upload_image.php +0 -70
  79. js/ofc-library/ofc_x_axis.php +0 -140
  80. js/ofc-library/ofc_x_axis_label.php +0 -45
  81. js/ofc-library/ofc_x_axis_labels.php +0 -69
  82. js/ofc-library/ofc_x_legend.php +0 -15
  83. js/ofc-library/ofc_y_axis.php +0 -17
  84. js/ofc-library/ofc_y_axis_base.php +0 -116
  85. js/ofc-library/ofc_y_axis_label.php +0 -38
  86. js/ofc-library/ofc_y_axis_labels.php +0 -57
  87. js/ofc-library/ofc_y_axis_right.php +0 -6
  88. js/ofc-library/ofc_y_legend.php +0 -15
  89. js/ofc-library/open-flash-chart-object.php +0 -109
  90. js/ofc-library/open-flash-chart.php +0 -178
  91. js/open-flash-chart.swf +0 -0
  92. js/swfobject.js +0 -5
  93. readme.txt +54 -8
classes/controllers/FrmAppController.php CHANGED
@@ -4,6 +4,8 @@ class FrmAppController{
4
  function FrmAppController(){
5
  add_action('admin_menu', array( $this, 'menu' ));
6
  add_filter( 'plugin_action_links_'.FRM_PLUGIN_NAME.'/'.FRM_PLUGIN_NAME.'.php', array( $this, 'settings_link'), 10, 2 );
 
 
7
  add_filter('the_content', array( $this, 'page_route' ), 1);
8
  add_action('init', array($this, 'front_head'));
9
  add_action('admin_init', array( $this, 'admin_js'));
@@ -18,12 +20,9 @@ class FrmAppController{
18
  }
19
 
20
  function menu(){
21
- global $frmpro_is_installed, $frm_forms_controller;
22
 
23
  add_menu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE, 8, FRM_PLUGIN_NAME, array($frm_forms_controller,'route'), FRM_URL . '/images/icon_16.png');
24
-
25
- //if(!$frmpro_is_installed)
26
- //add_submenu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE .' | Pro Statistics', 'Pro Statistics', 8, FRM_PLUGIN_TITLE.'-statistics',array($this,''));
27
  }
28
 
29
  // Adds a settings link to the plugins page
@@ -33,10 +32,43 @@ class FrmAppController{
33
  return $links;
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  function head(){
37
- global $frm_settings;
38
- $css_file = array($frm_settings->theme_nicename => $frm_settings->theme_css, 'frm_admin' => FRM_URL. '/css/frm_admin.css');
39
- $js_file = 'list-items.js';
40
  require_once(FRM_VIEWS_PATH . '/shared/head.php');
41
  }
42
 
@@ -52,22 +84,38 @@ class FrmAppController{
52
  }
53
 
54
  function front_head(){
55
- if (!is_admin())
56
- wp_enqueue_style('frm-forms', FRM_URL.'/css/frm_display.css');
 
 
 
 
 
 
 
 
57
  }
58
 
59
  function install(){
60
  global $wpdb, $frm_form, $frm_field, $frm_app_helper;
61
- $db_version = 1.0; // this is the version of the database we're moving to
62
  $old_db_version = get_option('frm_db_version');
63
 
64
- $fields_table = $wpdb->prefix . "frm_fields";
65
- $forms_table = $wpdb->prefix . "frm_forms";
66
- $items_table = $wpdb->prefix . "frm_items";
67
- $item_metas_table = $wpdb->prefix . "frm_item_metas";
68
-
69
  if ($db_version != $old_db_version){
70
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  /* Create/Upgrade Fields Table */
73
  $sql = "CREATE TABLE {$fields_table} (
@@ -85,7 +133,7 @@ class FrmAppController{
85
  created_at datetime NOT NULL,
86
  PRIMARY KEY (id),
87
  KEY form_id (form_id)
88
- );";
89
 
90
  dbDelta($sql);
91
 
@@ -104,7 +152,7 @@ class FrmAppController{
104
  options longtext default NULL,
105
  created_at datetime NOT NULL,
106
  PRIMARY KEY (id)
107
- );";
108
 
109
  dbDelta($sql);
110
 
@@ -120,7 +168,7 @@ class FrmAppController{
120
  PRIMARY KEY (id),
121
  KEY form_id (form_id),
122
  KEY parent_item_id (parent_item_id)
123
- );";
124
 
125
  dbDelta($sql);
126
 
@@ -135,13 +183,9 @@ class FrmAppController{
135
  PRIMARY KEY (id),
136
  KEY field_id (field_id),
137
  KEY item_id (item_id)
138
- );";
139
 
140
  dbDelta($sql);
141
-
142
- /***** SAVE DB VERSION *****/
143
- update_option('frm_db_version',$db_version);
144
- }
145
 
146
  /**** ADD DEFAULT TEMPLATES ****/
147
  $templates = glob(FRM_TEMPLATES_PATH."/*.php");
@@ -150,9 +194,16 @@ class FrmAppController{
150
  $filename = preg_replace("#".FRM_TEMPLATES_PATH."/#","",$templates[$i]);
151
  $filename = str_replace('.php','', $filename);
152
  $form = $frm_form->getAll("form_key='{$filename}' and is_template='1' and default_template='1'", '', ' LIMIT 1');
 
 
 
153
  require_once($templates[$i]);
154
  }
155
 
 
 
 
 
156
  do_action('frm_after_install');
157
  }
158
 
@@ -215,5 +266,6 @@ class FrmAppController{
215
  function widget_text_filter_callback( $matches ) {
216
  return do_shortcode( $matches[0] );
217
  }
 
218
  }
219
  ?>
4
  function FrmAppController(){
5
  add_action('admin_menu', array( $this, 'menu' ));
6
  add_filter( 'plugin_action_links_'.FRM_PLUGIN_NAME.'/'.FRM_PLUGIN_NAME.'.php', array( $this, 'settings_link'), 10, 2 );
7
+ add_action('after_plugin_row_'.FRM_PLUGIN_NAME.'/'.FRM_PLUGIN_NAME.'.php', array( $this,'frmpro_action_needed'));
8
+ add_action('admin_notices', array( $this,'frmpro_get_started_headline'));
9
  add_filter('the_content', array( $this, 'page_route' ), 1);
10
  add_action('init', array($this, 'front_head'));
11
  add_action('admin_init', array( $this, 'admin_js'));
20
  }
21
 
22
  function menu(){
23
+ global $frm_forms_controller;
24
 
25
  add_menu_page(FRM_PLUGIN_TITLE, FRM_PLUGIN_TITLE, 8, FRM_PLUGIN_NAME, array($frm_forms_controller,'route'), FRM_URL . '/images/icon_16.png');
 
 
 
26
  }
27
 
28
  // Adds a settings link to the plugins page
32
  return $links;
33
  }
34
 
35
+ function frmpro_action_needed( $plugin ){
36
+ global $frm_update;
37
+
38
+ if( $frm_update->pro_is_authorized() and !$frm_update->pro_is_installed() ){
39
+ if (IS_WPMU and $frm_update->pro_wpmu and !is_site_admin())
40
+ return;
41
+ $frm_update->queue_update(true);
42
+ $inst_install_url = wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $plugin, 'upgrade-plugin_' . $plugin);
43
+ ?>
44
+ <td colspan="3" class="plugin-update"><div class="update-message" style="-moz-border-radius:5px; border:1px solid #CC0000;; margin:5px; background-color:#FFEBE8; padding:3px 5px;"><?php printf(__('Your Formidable Pro installation isn\'t quite complete yet.<br/>%1$sAutomatically Upgrade to Enable Formidable Pro%2$s', FRM_PLUGIN_NAME), '<a href="'.$inst_install_url.'">', '</a>'); ?></div></td>
45
+ <?php
46
+ }
47
+ }
48
+
49
+ function frmpro_get_started_headline(){
50
+ global $frm_update;
51
+
52
+ // Don't display this error as we're upgrading the thing... cmon
53
+ if(isset($_GET['action']) and $_GET['action'] == 'upgrade-plugin')
54
+ return;
55
+
56
+ if (IS_WPMU and $frm_update->pro_wpmu and !is_site_admin())
57
+ return;
58
+
59
+ if( $frm_update->pro_is_authorized() and !$frm_update->pro_is_installed()){
60
+ $frm_update->queue_update(true);
61
+ $inst_install_url = wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $frm_update->plugin_name, 'upgrade-plugin_' . $frm_update->plugin_name);
62
+ ?>
63
+ <div class="error" style="padding:7px;"><?php printf(__('Your Formidable Pro installation isn\'t quite complete yet.<br/>%1$sAutomatically Upgrade to Enable Formidable Pro%2$s', FRM_PLUGIN_NAME), '<a href="'.$inst_install_url.'">','</a>'); ?></div>
64
+ <?php
65
+ }
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
 
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();
92
+ }
93
+ //if (!is_admin()){
94
+ $css = apply_filters('get_frm_stylesheet', FRM_URL .'/css/frm_display.css');
95
+ wp_enqueue_style('frm-forms', $css);
96
+ //}
97
  }
98
 
99
  function install(){
100
  global $wpdb, $frm_form, $frm_field, $frm_app_helper;
101
+ $db_version = 1.01; // this is the version of the database we're moving to
102
  $old_db_version = get_option('frm_db_version');
103
 
 
 
 
 
 
104
  if ($db_version != $old_db_version){
105
+ $fields_table = $wpdb->prefix . "frm_fields";
106
+ $forms_table = $wpdb->prefix . "frm_forms";
107
+ $items_table = $wpdb->prefix . "frm_items";
108
+ $item_metas_table = $wpdb->prefix . "frm_item_metas";
109
+
110
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
111
+
112
+ $charset_collate = '';
113
+ if( $wpdb->has_cap( 'collation' ) ){
114
+ if( !empty($wpdb->charset) )
115
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
116
+ if( !empty($wpdb->collate) )
117
+ $charset_collate .= " COLLATE $wpdb->collate";
118
+ }
119
 
120
  /* Create/Upgrade Fields Table */
121
  $sql = "CREATE TABLE {$fields_table} (
133
  created_at datetime NOT NULL,
134
  PRIMARY KEY (id),
135
  KEY form_id (form_id)
136
+ ) {$charset_collate};";
137
 
138
  dbDelta($sql);
139
 
152
  options longtext default NULL,
153
  created_at datetime NOT NULL,
154
  PRIMARY KEY (id)
155
+ ) {$charset_collate};";
156
 
157
  dbDelta($sql);
158
 
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);
174
 
183
  PRIMARY KEY (id),
184
  KEY field_id (field_id),
185
  KEY item_id (item_id)
186
+ ) {$charset_collate};";
187
 
188
  dbDelta($sql);
 
 
 
 
189
 
190
  /**** ADD DEFAULT TEMPLATES ****/
191
  $templates = glob(FRM_TEMPLATES_PATH."/*.php");
194
  $filename = preg_replace("#".FRM_TEMPLATES_PATH."/#","",$templates[$i]);
195
  $filename = str_replace('.php','', $filename);
196
  $form = $frm_form->getAll("form_key='{$filename}' and is_template='1' and default_template='1'", '', ' LIMIT 1');
197
+ $values = FrmFormsHelper::setup_new_vars();
198
+ $values['form_key'] = $filename;
199
+ $values['is_template'] = $values['default_template'] = 1;
200
  require_once($templates[$i]);
201
  }
202
 
203
+ /***** SAVE DB VERSION *****/
204
+ update_option('frm_db_version',$db_version);
205
+ }
206
+
207
  do_action('frm_after_install');
208
  }
209
 
266
  function widget_text_filter_callback( $matches ) {
267
  return do_shortcode( $matches[0] );
268
  }
269
+
270
  }
271
  ?>
classes/controllers/FrmFieldsController.php CHANGED
@@ -92,7 +92,7 @@ class FrmFieldsController{
92
  function add_option(){
93
  global $frm_field;
94
 
95
- $id = str_replace('field_', '', $_POST['field']);
96
  $field = $frm_field->getOne($id);
97
  $options = unserialize($field->options);
98
  $last = max(array_keys($options));
@@ -127,12 +127,10 @@ class FrmFieldsController{
127
 
128
  function delete_option(){
129
  global $frm_field;
130
- $ids = explode('-',$_POST['field']);
131
- $id = str_replace('frm_delete_field_', '', $ids[0]);
132
- $field = $frm_field->getOne($id);
133
  $options = unserialize($field->options);
134
- unset($options[$ids[1]]);
135
- $frm_field->update($id, array('options' => serialize($options)));
136
  die();
137
  }
138
 
92
  function add_option(){
93
  global $frm_field;
94
 
95
+ $id = $_POST['field_id'];
96
  $field = $frm_field->getOne($id);
97
  $options = unserialize($field->options);
98
  $last = max(array_keys($options));
127
 
128
  function delete_option(){
129
  global $frm_field;
130
+ $field = $frm_field->getOne($_POST['field_id']);
 
 
131
  $options = unserialize($field->options);
132
+ unset($options[$_POST['opt_key']]);
133
+ $frm_field->update($_POST['field_id'], array('options' => serialize($options)));
134
  die();
135
  }
136
 
classes/controllers/FrmFormsController.php CHANGED
@@ -19,7 +19,7 @@ class FrmFormsController{
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 = 'list-items.js';
23
  require_once(FRM_VIEWS_PATH . '/shared/head.php');
24
  }
25
 
@@ -118,8 +118,7 @@ class FrmFormsController{
118
 
119
  function page_preview(){
120
  global $frm_form;
121
- $description = true;
122
- $title = true;
123
  $params = $this->get_params();
124
  if (!$params['form']) return;
125
  $form = $frm_form->getOne($params['form']);
@@ -127,7 +126,7 @@ class FrmFormsController{
127
  }
128
 
129
  function preview(){
130
- global $frm_form;
131
  if ( !defined( 'ABSPATH' ) && !defined( 'XMLRPC_REQUEST' )) {
132
  $root = dirname(dirname(dirname(dirname(__FILE__))));
133
  include_once( $root.'/wp-config.php' );
@@ -144,7 +143,8 @@ class FrmFormsController{
144
  if (!$form) $form = $frm_form->getAll('','',' LIMIT 1');
145
  $form_options = stripslashes_deep(maybe_unserialize($form->options));
146
  $description = $title = true;
147
-
 
148
  require_once(FRM_VIEWS_PATH.'/frm-entries/direct.php');
149
  }
150
 
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
 
118
 
119
  function page_preview(){
120
  global $frm_form;
121
+ $description = $title = true;
 
122
  $params = $this->get_params();
123
  if (!$params['form']) return;
124
  $form = $frm_form->getOne($params['form']);
126
  }
127
 
128
  function preview(){
129
+ global $frm_form, $frm_settings;
130
  if ( !defined( 'ABSPATH' ) && !defined( 'XMLRPC_REQUEST' )) {
131
  $root = dirname(dirname(dirname(dirname(__FILE__))));
132
  include_once( $root.'/wp-config.php' );
143
  if (!$form) $form = $frm_form->getAll('','',' LIMIT 1');
144
  $form_options = stripslashes_deep(maybe_unserialize($form->options));
145
  $description = $title = true;
146
+ $custom_style = (isset($form_options['custom_style'])) ? $form_options['custom_style'] : $frm_settings->custom_style;
147
+
148
  require_once(FRM_VIEWS_PATH.'/frm-entries/direct.php');
149
  }
150
 
classes/controllers/FrmSettingsController.php CHANGED
@@ -3,28 +3,25 @@
3
  class FrmSettingsController{
4
  function FrmSettingsController(){
5
  add_action('admin_menu', array( $this, 'menu' ), 25);
 
6
  add_action('admin_head-'.FRM_PLUGIN_NAME.'_page_'.FRM_PLUGIN_NAME.'-settings', array($this,'head'));
7
  }
8
 
9
  function menu(){
10
- global $frm_update;
11
  add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | Settings', 'Settings', 8, FRM_PLUGIN_NAME.'-settings', array($this,'route'));
 
 
 
 
 
 
 
12
  add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | '. FRM_PLUGIN_TITLE . ' Pro', FRM_PLUGIN_TITLE . ' Pro', 8, FRM_PLUGIN_NAME.'-pro-settings', array($frm_update,'pro_cred_form'));
13
  }
14
 
15
  function head(){
16
- global $frm_settings;
17
- $css_file = array($frm_settings->theme_nicename => $frm_settings->theme_css, 'frm_admin' => FRM_URL. '/css/frm_admin.css');
18
- $js_file = 'jquery/jquery-ui-themepicker.js';
19
- ?>
20
- <link type="text/css" rel="stylesheet" href="http://jqueryui.com/themes/base/ui.all.css" />
21
- <script>
22
- jQuery(document).ready(function($){
23
- $('#frm_switcher').themeswitcher();
24
- });
25
- </script>
26
- <?php
27
- require_once(FRM_VIEWS_PATH . '/shared/head.php');
28
  }
29
 
30
  function display_form(){
@@ -38,7 +35,7 @@ class FrmSettingsController{
38
  //$errors = $frm_settings->validate($_POST,array());
39
  $errors = array();
40
  $frm_settings->update($_POST);
41
-
42
  if( empty($errors) ){
43
  $frm_settings->store();
44
  $message = 'Settings Saved';
3
  class FrmSettingsController{
4
  function FrmSettingsController(){
5
  add_action('admin_menu', array( $this, 'menu' ), 25);
6
+ add_action('admin_menu', array( $this, 'pro_menu' ), 19);
7
  add_action('admin_head-'.FRM_PLUGIN_NAME.'_page_'.FRM_PLUGIN_NAME.'-settings', array($this,'head'));
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(){
15
+ global $frm_update;
16
+ if (IS_WPMU and !is_site_admin() and get_site_option($frm_update->pro_wpmu_store))
17
+ return;
18
+
19
  add_submenu_page(FRM_PLUGIN_NAME, FRM_PLUGIN_TITLE .' | '. FRM_PLUGIN_TITLE . ' Pro', FRM_PLUGIN_TITLE . ' Pro', 8, FRM_PLUGIN_NAME.'-pro-settings', array($frm_update,'pro_cred_form'));
20
  }
21
 
22
  function head(){
23
+ $css_file = array('frm_admin' => FRM_URL. '/css/frm_admin.css');
24
+ require(FRM_VIEWS_PATH . '/shared/head.php');
 
 
 
 
 
 
 
 
 
 
25
  }
26
 
27
  function display_form(){
35
  //$errors = $frm_settings->validate($_POST,array());
36
  $errors = array();
37
  $frm_settings->update($_POST);
38
+
39
  if( empty($errors) ){
40
  $frm_settings->store();
41
  $message = 'Settings Saved';
classes/helpers/FrmAppHelper.php CHANGED
@@ -56,7 +56,7 @@ class FrmAppHelper{
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;
60
  $values = array();
61
 
62
  $values['id'] = $record->id;
@@ -76,7 +76,7 @@ class FrmAppHelper{
76
  $field_options = stripslashes_deep(unserialize($field->field_options));
77
  $field_type = isset($_POST['field_options']['type_'.$field->id]) ? $_POST['field_options']['type_'.$field->id] : $field->type;
78
  $new_value = (isset($_POST['item_meta'][$field->id])) ? $_POST['item_meta'][$field->id] : $meta_value;
79
- $new_value = stripslashes(maybe_unserialize($new_value));
80
 
81
  $field_array = array('id' => $field->id,
82
  'value' => $new_value,
@@ -90,7 +90,7 @@ class FrmAppHelper{
90
  'field_order' => $field->field_order,
91
  'form_id' => $field->form_id);
92
 
93
- foreach (array('size' => 50,'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']);
@@ -112,10 +112,13 @@ class FrmAppHelper{
112
  }
113
 
114
  $email = get_option('admin_email');
115
- foreach (array('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
  }
 
 
 
119
 
120
  if (!isset($values['akismet']))
121
  $values['akismet'] = ($_POST and isset($_POST['options']['akismet'])) ? 1 : 0;
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;
60
  $values = array();
61
 
62
  $values['id'] = $record->id;
76
  $field_options = stripslashes_deep(unserialize($field->field_options));
77
  $field_type = isset($_POST['field_options']['type_'.$field->id]) ? $_POST['field_options']['type_'.$field->id] : $field->type;
78
  $new_value = (isset($_POST['item_meta'][$field->id])) ? $_POST['item_meta'][$field->id] : $meta_value;
79
+ $new_value = stripslashes_deep(maybe_unserialize($new_value));
80
 
81
  $field_array = array('id' => $field->id,
82
  'value' => $new_value,
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']);
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
  }
119
+
120
+ if (!isset($values['custom_style']))
121
+ $values['custom_style'] = ($_POST and isset($_POST['options']['custom_style'])) ? $_POST['options']['custom_style'] : $frm_settings->custom_style;
122
 
123
  if (!isset($values['akismet']))
124
  $values['akismet'] = ($_POST and isset($_POST['options']['akismet'])) ? 1 : 0;
classes/helpers/FrmEntriesHelper.php CHANGED
@@ -3,7 +3,7 @@
3
  class FrmEntriesHelper{
4
 
5
  function setup_new_vars($fields){
6
- global $frm_app_controller, $frm_form;
7
  $values = array();
8
  foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default)
9
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
@@ -18,6 +18,8 @@ class FrmEntriesHelper{
18
  if ($field->type != 'checkbox')
19
  $new_value = apply_filters('frm_get_default_value', stripslashes($new_value));
20
 
 
 
21
  $field_array = array('id' => $field->id,
22
  'value' => $new_value,
23
  'default_value' => $new_value,
@@ -30,7 +32,7 @@ class FrmEntriesHelper{
30
  'field_order' => $field->field_order,
31
  'form_id' => $field->form_id);
32
 
33
- foreach (array('size' => 75,'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)
34
  $field_array[$opt] = (isset($field_options[$opt]) && $field_options[$opt] != '') ? $field_options[$opt] : $default_opt;
35
 
36
  $values['fields'][] = apply_filters('frm_setup_new_fields_vars', stripslashes_deep($field_array), $field);
@@ -45,6 +47,10 @@ class FrmEntriesHelper{
45
  foreach ($options as $opt => $value)
46
  $values[$opt] = $frm_app_controller->get_param($opt, $value);
47
  }
 
 
 
 
48
  if (!isset($values['email_to']))
49
  $values['email_to'] = '';
50
 
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)
9
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $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,
25
  'default_value' => $new_value,
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);
47
  foreach ($options as $opt => $value)
48
  $values[$opt] = $frm_app_controller->get_param($opt, $value);
49
  }
50
+
51
+ if (!isset($values['custom_style']))
52
+ $values['custom_style'] = $frm_settings->custom_style;
53
+
54
  if (!isset($values['email_to']))
55
  $values['email_to'] = '';
56
 
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -13,7 +13,7 @@ class FrmFieldsHelper{
13
  $values[$var] = $default;
14
 
15
  $values['field_options'] = array();
16
- foreach (array('size' => '50', 'max' => '', 'label' => 'top', 'required_indicator' => '*', 'clear_on_focus' => 0, 'custom_html' => FrmFieldsHelper::get_default_html($type), 'default_blank' => 0) as $var => $default)
17
  $values['field_options'][$var] = $default;
18
 
19
  if ($type == 'radio' || ($type == 'checkbox'))
@@ -41,7 +41,7 @@ class FrmFieldsHelper{
41
 
42
  foreach (array('field_key' => $record->field_key, 'type' => $record->type, 'default_value'=> $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required) as $var => $default)
43
  $values[$var] = $frm_app_controller->get_param($var, $default);
44
-
45
  $values['options'] = unserialize($record->options);
46
  $field_options = unserialize($record->field_options);
47
  $values['field_options'] = $field_options;
@@ -118,12 +118,12 @@ DEFAULT_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'; ?>" 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'; ?>" 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
 
13
  $values[$var] = $default;
14
 
15
  $values['field_options'] = array();
16
+ foreach (array('size' => '', 'max' => '', 'label' => 'top', 'required_indicator' => '*', 'clear_on_focus' => 0, 'custom_html' => FrmFieldsHelper::get_default_html($type), 'default_blank' => 0) as $var => $default)
17
  $values['field_options'][$var] = $default;
18
 
19
  if ($type == 'radio' || ($type == 'checkbox'))
41
 
42
  foreach (array('field_key' => $record->field_key, 'type' => $record->type, 'default_value'=> $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required) as $var => $default)
43
  $values[$var] = $frm_app_controller->get_param($var, $default);
44
+
45
  $values['options'] = unserialize($record->options);
46
  $field_options = unserialize($record->field_options);
47
  $values['field_options'] = $field_options;
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
 
classes/helpers/FrmFormsHelper.php CHANGED
@@ -43,7 +43,7 @@ class FrmFormsHelper{
43
  }
44
 
45
  function setup_new_vars(){
46
- global $frm_app_controller, $frm_form;
47
  $values = array();
48
  foreach (array('name' => 'Untitled Form', 'description' => '') as $var => $default)
49
  $values[$var] = stripslashes($frm_app_controller->get_param($var, $default));
@@ -53,6 +53,7 @@ class FrmFormsHelper{
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['submit_value'] = ($_POST and isset($_POST['options']['submit_value'])) ? $_POST['options']['submit_value'] : 'Submit';
57
  $values['success_msg'] = ($_POST and isset($_POST['options']['success_msg'])) ? $_POST['options']['success_msg'] : 'Your responses were successfully submitted. Thank you!';
58
  $values['akismet'] = ($_POST and isset($_POST['options']['akismet'])) ? 1 : 0;
43
  }
44
 
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));
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;
classes/models/FrmEntry.php CHANGED
@@ -76,7 +76,7 @@ class FrmEntry{
76
  global $wpdb, $frm_entry_meta;
77
 
78
  // Disconnect the child items from this parent item
79
- $query_results = $wpdb->update( $this->table_name, array('parent_item_id' => null), array( 'parent_item_id' => $id ) );
80
 
81
  $reset = 'DELETE FROM ' . $frm_entry_meta->table_name . ' WHERE item_id=' . $id;
82
  $destroy = 'DELETE FROM ' . $this->table_name . ' WHERE id=' . $id;
@@ -90,15 +90,6 @@ class FrmEntry{
90
  $form_id = isset($value) ? $form_id : NULL;
91
  return $wpdb->update( $this->table_name, array('form_id' => $form_id), array( 'id' => $id ) );
92
  }
93
-
94
- function getOneByKey( $key ){
95
- global $wpdb, $frm_entry_meta;
96
- $query = "SELECT it.*".//", meta.* " .
97
- "FROM {$this->table_name} it ".
98
- //"LEFT OUTER JOIN {$frm_entry_meta->table_name} meta ON meta.item_id=it.id " .
99
- "WHERE it.item_key='" . $key . "'";
100
- return $wpdb->get_row($query);
101
- }
102
 
103
  function getOne( $id ){
104
  global $wpdb, $frm_form;
@@ -113,6 +104,20 @@ class FrmEntry{
113
  $query .= " WHERE it.item_key='" . $id ."'";
114
  return $wpdb->get_row($query);
115
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  function getAll($where = '', $order_by = '', $limit = ''){
118
  global $wpdb, $frm_form, $frm_app_helper;
76
  global $wpdb, $frm_entry_meta;
77
 
78
  // Disconnect the child items from this parent item
79
+ //$query_results = $wpdb->update( $this->table_name, array('parent_item_id' => null), array( 'parent_item_id' => $id ) );
80
 
81
  $reset = 'DELETE FROM ' . $frm_entry_meta->table_name . ' WHERE item_id=' . $id;
82
  $destroy = 'DELETE FROM ' . $this->table_name . ' WHERE id=' . $id;
90
  $form_id = isset($value) ? $form_id : NULL;
91
  return $wpdb->update( $this->table_name, array('form_id' => $form_id), array( 'id' => $id ) );
92
  }
 
 
 
 
 
 
 
 
 
93
 
94
  function getOne( $id ){
95
  global $wpdb, $frm_form;
104
  $query .= " WHERE it.item_key='" . $id ."'";
105
  return $wpdb->get_row($query);
106
  }
107
+
108
+ function exists( $id ){
109
+ global $wpdb, $frm_form;
110
+ $query = 'SELECT id FROM '. $this->table_name;
111
+ if(is_numeric($id))
112
+ $query .= ' WHERE id=' . $id;
113
+ else
114
+ $query .= " WHERE item_key='" . $id ."'";
115
+ $id = $wpdb->get_var($query);
116
+ if ($id && $id > 0)
117
+ return true;
118
+ else
119
+ return false;
120
+ }
121
 
122
  function getAll($where = '', $order_by = '', $limit = ''){
123
  global $wpdb, $frm_form, $frm_app_helper;
classes/models/FrmField.php CHANGED
@@ -32,10 +32,11 @@ class FrmField{
32
  }
33
  }
34
 
35
- function duplicate($old_form_id,$form_id){
36
- foreach ($this->getAll("fi.form_id = $old_form_id") as $field){
37
  $values = array();
38
- $values['field_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'field_key');
 
39
  $values['field_options'] = unserialize($field->field_options);
40
  $values['form_id'] = $form_id;
41
  foreach (array('name','description','type','default_value','options','field_order','required') as $col)
@@ -77,12 +78,20 @@ class FrmField{
77
  return $wpdb->get_row($query);
78
  }
79
 
80
- function getAll($where = '', $order_by = '', $limit = ''){
81
  global $wpdb, $frm_form, $frm_app_helper;
 
 
 
 
 
 
 
 
82
  $query = 'SELECT fi.*, ' .
83
  'fr.name as form_name ' .
84
- 'FROM '. $this->table_name . ' fi ' .
85
- 'LEFT OUTER JOIN ' . $frm_form->table_name . ' fr ON fi.form_id=fr.id' .
86
  $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
87
  if ($limit == ' LIMIT 1')
88
  $results = $wpdb->get_row($query);
32
  }
33
  }
34
 
35
+ function duplicate($old_form_id, $form_id, $copy_keys=false, $blog_id=false){
36
+ foreach ($this->getAll("fi.form_id = $old_form_id",'','',$blog_id) as $field){
37
  $values = array();
38
+ $new_key = ($copy_keys) ? $field->field_key : '';
39
+ $values['field_key'] = FrmAppHelper::get_unique_key($new_key, $this->table_name, 'field_key');
40
  $values['field_options'] = unserialize($field->field_options);
41
  $values['form_id'] = $form_id;
42
  foreach (array('name','description','type','default_value','options','field_order','required') as $col)
78
  return $wpdb->get_row($query);
79
  }
80
 
81
+ function getAll($where = '', $order_by = '', $limit = '', $blog_id=false){
82
  global $wpdb, $frm_form, $frm_app_helper;
83
+ if ($blog_id and IS_WPMU){
84
+ global $wpmuBaseTablePrefix;
85
+ $table_name = "{$wpmuBaseTablePrefix}{$blog_id}_frm_fields";
86
+ $form_table_name = "{$wpmuBaseTablePrefix}{$blog_id}_frm_forms";
87
+ }else{
88
+ $table_name = $this->table_name;
89
+ $form_table_name = $frm_form->table_name;
90
+ }
91
  $query = 'SELECT fi.*, ' .
92
  'fr.name as form_name ' .
93
+ 'FROM '. $table_name . ' fi ' .
94
+ 'LEFT OUTER JOIN ' . $form_table_name . ' fr ON fi.form_id=fr.id' .
95
  $frm_app_helper->prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
96
  if ($limit == ' LIMIT 1')
97
  $results = $wpdb->get_row($query);
classes/models/FrmForm.php CHANGED
@@ -33,17 +33,26 @@ class FrmForm{
33
  return $wpdb->insert_id;
34
  }
35
 
36
- function duplicate( $id, $template=false ){
37
  global $wpdb, $frm_form, $frm_field;
38
 
39
- $values = $frm_form->getOne( $id );
40
-
41
  $new_values = array();
42
- $new_values['form_key'] = FrmAppHelper::get_unique_key('', $this->table_name, 'form_key');
 
43
  $new_values['name'] = $values->name;
44
  $new_values['description'] = $values->description;
45
  $new_values['status'] = (!$template)?'draft':'';
46
- $new_values['options'] = $values->options;
 
 
 
 
 
 
 
 
47
  $new_values['logged_in'] = $values->logged_in ? $values->logged_in : 0;
48
  $new_values['editable'] = $values->editable ? $values->editable : 0;
49
  $new_values['created_at'] = current_time('mysql', 1);
@@ -53,7 +62,7 @@ class FrmForm{
53
 
54
  if($query_results){
55
  $form_id = $wpdb->insert_id;
56
- $frm_field->duplicate($id, $form_id);
57
 
58
  return $form_id;
59
  }else
@@ -71,21 +80,25 @@ class FrmForm{
71
 
72
  $form_fields = array('form_key','name','description','status','prli_link_id');
73
 
74
- $options = array();
75
- $options['email_to'] = isset($values['options']['email_to']) ? $values['options']['email_to'] : '';
76
- $options['submit_value'] = isset($values['options']['submit_value']) ? $values['options']['submit_value'] : 'Submit';
77
- $options['success_msg'] = isset($values['options']['success_msg']) ? $values['options']['success_msg'] : '';
78
- $options['akismet'] = isset($values['options']['akismet']) ? 1 : 0;
79
- $options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
80
- $options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
81
- $options = apply_filters('frm_form_options_before_update', $options, $values);
82
-
83
  $new_values = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  foreach ($values as $value_key => $value){
85
  if (in_array($value_key, $form_fields))
86
  $new_values[$value_key] = $value;
87
  }
88
- $new_values['options'] = serialize($options);
89
 
90
  $query_results = $wpdb->update( $this->table_name, $new_values, array( 'id' => $id ) );
91
 
@@ -101,7 +114,7 @@ class FrmForm{
101
  $field_options = unserialize($field->field_options);
102
  foreach (array('size','max','label','invalid','required_indicator','blank') as $opt)
103
  $field_options[$opt] = isset($values['field_options'][$opt.'_'.$field_id]) ? trim($values['field_options'][$opt.'_'.$field_id]) : '';
104
- $field_options['custom_html'] = isset($values['field_options']['custom_html_'.$field_id]) ? $values['field_options']['custom_html_'.$field_id] : FrmFieldsHelper::get_default_html($field->type);
105
  $field_options = apply_filters('frm_update_field_options', $field_options, $field_id, $values);
106
  $default_value = maybe_serialize($values['item_meta'][$field_id]);
107
  $field_key = (isset($values['field_options']['field_key_'.$field_id]))? $values['field_options']['field_key_'.$field_id] : $field->field_key;
@@ -153,7 +166,10 @@ class FrmForm{
153
  $query_results = $wpdb->query($query);
154
 
155
  $destroy = 'DELETE FROM ' . $this->table_name . ' WHERE id=' . $id;
156
- return $wpdb->query($destroy);
 
 
 
157
  }
158
 
159
  function getName( $id ){
@@ -171,12 +187,24 @@ class FrmForm{
171
  $query = 'SELECT id FROM ' . $this->table_name . ' WHERE name="' . $name . '";';
172
  return $wpdb->get_var($query);
173
  }
 
 
 
 
 
 
174
 
175
- function getOne( $id ){
176
  global $wpdb;
177
- if (is_numeric($id))
178
- $query = 'SELECT * FROM ' . $this->table_name . ' WHERE id=' . $id . ';';
179
- else
 
 
 
 
 
 
180
  $query = 'SELECT * FROM ' . $this->table_name . ' WHERE form_key="' . $id . '";';
181
  return $wpdb->get_row($query);
182
  }
33
  return $wpdb->insert_id;
34
  }
35
 
36
+ function duplicate( $id, $template=false, $copy_keys=false, $blog_id=false ){
37
  global $wpdb, $frm_form, $frm_field;
38
 
39
+ $values = $frm_form->getOne( $id, $blog_id );
40
+
41
  $new_values = array();
42
+ $new_key = ($copy_keys) ? $values->form_key : '';
43
+ $new_values['form_key'] = FrmAppHelper::get_unique_key($new_key, $this->table_name, 'form_key');
44
  $new_values['name'] = $values->name;
45
  $new_values['description'] = $values->description;
46
  $new_values['status'] = (!$template)?'draft':'';
47
+ if ($blog_id){
48
+ $new_values['status'] = 'published';
49
+ $new_options = unserialize($values->options);
50
+ $new_options['email_to'] = get_option('admin_email');
51
+ $new_options['copy'] = false;
52
+ $new_values['options'] = serialize($new_options);
53
+ }else
54
+ $new_values['options'] = $values->options;
55
+
56
  $new_values['logged_in'] = $values->logged_in ? $values->logged_in : 0;
57
  $new_values['editable'] = $values->editable ? $values->editable : 0;
58
  $new_values['created_at'] = current_time('mysql', 1);
62
 
63
  if($query_results){
64
  $form_id = $wpdb->insert_id;
65
+ $frm_field->duplicate($id, $form_id, $copy_keys, $blog_id);
66
 
67
  return $form_id;
68
  }else
80
 
81
  $form_fields = array('form_key','name','description','status','prli_link_id');
82
 
 
 
 
 
 
 
 
 
 
83
  $new_values = array();
84
+
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');
93
+ $options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
94
+ $options = apply_filters('frm_form_options_before_update', $options, $values);
95
+ $new_values['options'] = serialize($options);
96
+ }
97
+
98
  foreach ($values as $value_key => $value){
99
  if (in_array($value_key, $form_fields))
100
  $new_values[$value_key] = $value;
101
  }
 
102
 
103
  $query_results = $wpdb->update( $this->table_name, $new_values, array( 'id' => $id ) );
104
 
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]) : '';
117
+ $field_options['custom_html'] = isset($values['field_options']['custom_html_'.$field_id]) ? $values['field_options']['custom_html_'.$field_id] : (isset($field_options['custom_html']) ? $field_options['custom_html'] : FrmFieldsHelper::get_default_html($field->type));
118
  $field_options = apply_filters('frm_update_field_options', $field_options, $field_id, $values);
119
  $default_value = maybe_serialize($values['item_meta'][$field_id]);
120
  $field_key = (isset($values['field_options']['field_key_'.$field_id]))? $values['field_options']['field_key_'.$field_id] : $field->field_key;
166
  $query_results = $wpdb->query($query);
167
 
168
  $destroy = 'DELETE FROM ' . $this->table_name . ' WHERE id=' . $id;
169
+ $query_results = $wpdb->query($destroy);
170
+ if ($query_results)
171
+ do_action('frm_destroy_form', $id);
172
+ return $query_results;
173
  }
174
 
175
  function getName( $id ){
187
  $query = 'SELECT id FROM ' . $this->table_name . ' WHERE name="' . $name . '";';
188
  return $wpdb->get_var($query);
189
  }
190
+
191
+ function getIdByKey( $key ){
192
+ global $wpdb;
193
+ $query = "SELECT id FROM $this->table_name WHERE form_key='$key' LIMIT 1";
194
+ return $wpdb->get_var($query);
195
+ }
196
 
197
+ function getOne( $id, $blog_id=false ){
198
  global $wpdb;
199
+
200
+ if (is_numeric($id)){
201
+ if ($blog_id and IS_WPMU){
202
+ global $wpmuBaseTablePrefix;
203
+ $table_name = "{$wpmuBaseTablePrefix}{$blog_id}_frm_forms";
204
+ }else
205
+ $table_name = $this->table_name;
206
+ $query = "SELECT * FROM $table_name WHERE id='$id'";
207
+ }else
208
  $query = 'SELECT * FROM ' . $this->table_name . ' WHERE form_key="' . $id . '";';
209
  return $wpdb->get_row($query);
210
  }
classes/models/FrmSettings.php CHANGED
@@ -3,10 +3,9 @@ class FrmSettings{
3
  // Page Setup Variables
4
  var $preview_page_id;
5
  var $preview_page_id_str;
6
- var $theme_css;
7
- var $theme_name;
8
- var $theme_nicename;
9
  var $lock_keys;
 
 
10
 
11
  function FrmSettings(){
12
  $this->set_default_options();
@@ -18,38 +17,33 @@ class FrmSettings{
18
 
19
  $this->preview_page_id_str = 'frm-preview-page-id';
20
 
21
- if(!isset($this->theme_css)){
22
- $this->theme_css = FRM_URL.'/css/ui-lightness/jquery-ui-1.7.2.custom.css';
23
- $this->theme_name = 'UI lightness';
24
- }
25
-
26
- $this->theme_nicename = sanitize_title_with_dashes($this->theme_name);
27
-
28
  if(!isset($this->lock_keys))
29
  $this->lock_keys = true;
 
 
 
30
  }
31
 
32
  function validate($params,$errors){
33
- if($params[ $this->preview_page_id_str ] == 0)
34
- $errors[] = "The Preview Page Must Not Be Blank.";
35
-
36
  return $errors;
37
  }
38
 
39
  function update($params){
40
  $this->preview_page_id = (int)$params[ $this->preview_page_id_str ];
41
- if (isset($params[ 'frm_themepicker_css' ]))
42
- $this->theme_css = $params[ 'frm_themepicker_css' ];
43
-
44
- if (isset($params[ 'frm_themepicker_name' ]))
45
- $this->theme_name = $params[ 'frm_themepicker_name' ];
46
-
47
  $this->lock_keys = isset($params['frm_lock_keys']) ? 1 : 0;
 
 
 
48
  }
49
 
50
  function store(){
51
  // Save the posted value in the database
52
  update_option( 'frm_options', $this);
 
 
53
  }
54
 
55
  }
3
  // Page Setup Variables
4
  var $preview_page_id;
5
  var $preview_page_id_str;
 
 
 
6
  var $lock_keys;
7
+
8
+ var $custom_style;
9
 
10
  function FrmSettings(){
11
  $this->set_default_options();
17
 
18
  $this->preview_page_id_str = 'frm-preview-page-id';
19
 
 
 
 
 
 
 
 
20
  if(!isset($this->lock_keys))
21
  $this->lock_keys = true;
22
+
23
+ if(!isset($this->custom_style))
24
+ $this->custom_style = true;
25
  }
26
 
27
  function validate($params,$errors){
28
+ //if($params[ $this->preview_page_id_str ] == 0)
29
+ // $errors[] = "The Preview Page Must Not Be Blank.";
30
+ $errors = apply_filters( 'frm_validate_settings', $errors, $params );
31
  return $errors;
32
  }
33
 
34
  function update($params){
35
  $this->preview_page_id = (int)$params[ $this->preview_page_id_str ];
 
 
 
 
 
 
36
  $this->lock_keys = isset($params['frm_lock_keys']) ? 1 : 0;
37
+ $this->custom_style = isset($params['frm_custom_style']) ? 1 : 0;
38
+
39
+ do_action( 'frm_update_settings', $params );
40
  }
41
 
42
  function store(){
43
  // Save the posted value in the database
44
  update_option( 'frm_options', $this);
45
+
46
+ do_action( 'frm_store_settings' );
47
  }
48
 
49
  }
classes/models/FrmUpdate.php CHANGED
@@ -12,12 +12,14 @@ class FrmUpdate{
12
 
13
  var $pro_cred_store;
14
  var $pro_auth_store;
 
15
 
16
  var $pro_username_label;
17
  var $pro_password_label;
18
 
19
  var $pro_username_str;
20
  var $pro_password_str;
 
21
 
22
  var $pro_error_message_str;
23
 
@@ -37,6 +39,7 @@ class FrmUpdate{
37
  $this->pro_mothership = 'http://formidablepro.com';
38
  $this->pro_cred_store = 'frmpro-credentials';
39
  $this->pro_auth_store = 'frmpro-authorized';
 
40
  $this->pro_last_checked_store = 'frmpro_last_checked_update';
41
  $this->pro_username_label = __(FRM_PLUGIN_TITLE .' Pro Username', FRM_PLUGIN_NAME);
42
  $this->pro_password_label = __(FRM_PLUGIN_TITLE .' Pro Password', FRM_PLUGIN_NAME);
@@ -46,10 +49,17 @@ class FrmUpdate{
46
  $this->pro_check_interval = 60*60; // Checking every hour
47
  $this->pro_username_str = 'proplug-username';
48
  $this->pro_password_str = 'proplug-password';
 
49
  $this->pro_mothership_xmlrpc_url = $this->pro_mothership . '/xmlrpc.php';
50
 
51
  // Retrieve Pro Credentials
52
- $creds = get_option($this->pro_cred_store);
 
 
 
 
 
 
53
  if($creds and is_array($creds)){
54
  extract($creds);
55
  $this->pro_username = ((isset($username) and !empty($username))?$username:'');
@@ -68,14 +78,20 @@ class FrmUpdate{
68
 
69
  function pro_is_authorized($force_check=false){
70
  if( !empty($this->pro_username) and !empty($this->pro_password) ){
71
- $authorized = get_option($this->pro_auth_store);
72
- if(!$force_check and isset($authorized))
73
- return $authorized;
74
- else{
75
- $new_auth = $this->authorize_user($this->pro_username,$this->pro_password);
76
- update_option($this->pro_auth_store, $new_auth);
77
- return $new_auth;
78
- }
 
 
 
 
 
 
79
  }
80
 
81
  return false;
@@ -135,6 +151,11 @@ class FrmUpdate{
135
  }
136
 
137
  $this->display_pro_cred_form(); ?>
 
 
 
 
 
138
  </div>
139
  <?php
140
  }
@@ -155,11 +176,20 @@ class FrmUpdate{
155
  </td>
156
  </tr>
157
  <tr class="form-field">
158
- <td valign="top" width="15%"><?php echo $this->pro_password_label; ?>:</td>
159
  <td width="85%">
160
  <input type="password" name="<?php echo $this->pro_password_str; ?>" value="<?php echo $password; ?>"/>
161
  </td>
162
  </tr>
 
 
 
 
 
 
 
 
 
163
  </table>
164
  <p class="submit">
165
  <input type="submit" name="Submit" value="<?php _e('Save', FRM_PLUGIN_NAME); ?>" />
@@ -173,15 +203,23 @@ class FrmUpdate{
173
  $user_authorized = $this->authorize_user($creds['username'], $creds['password']);
174
 
175
  if(!empty($user_authorized) and $user_authorized){
176
- update_option($this->pro_cred_store, $creds);
177
- update_option($this->pro_auth_store, $user_authorized);
 
 
 
 
 
 
 
 
178
 
179
- extract($creds);
180
- $this->pro_username = ((isset($username) and !empty($username))?$username:'');
181
- $this->pro_password = ((isset($password) and !empty($password))?$password:'');
182
 
183
- if(!$this->pro_is_installed())
184
- $this->queue_update(true);
185
  }
186
 
187
  return $user_authorized;
@@ -190,8 +228,9 @@ class FrmUpdate{
190
  function get_pro_cred_form_vals(){
191
  $username = ((isset($_POST[$this->pro_username_str]))?$_POST[$this->pro_username_str]:$this->pro_username);
192
  $password = ((isset($_POST[$this->pro_password_str]))?$_POST[$this->pro_password_str]:$this->pro_password);
 
193
 
194
- return compact('username','password');
195
  }
196
 
197
  function get_download_url($version){
12
 
13
  var $pro_cred_store;
14
  var $pro_auth_store;
15
+ var $pro_wpmu_store;
16
 
17
  var $pro_username_label;
18
  var $pro_password_label;
19
 
20
  var $pro_username_str;
21
  var $pro_password_str;
22
+ var $pro_wpmu_str;
23
 
24
  var $pro_error_message_str;
25
 
39
  $this->pro_mothership = 'http://formidablepro.com';
40
  $this->pro_cred_store = 'frmpro-credentials';
41
  $this->pro_auth_store = 'frmpro-authorized';
42
+ $this->pro_auth_store = 'frmpro-wpmu-sitewide';
43
  $this->pro_last_checked_store = 'frmpro_last_checked_update';
44
  $this->pro_username_label = __(FRM_PLUGIN_TITLE .' Pro Username', FRM_PLUGIN_NAME);
45
  $this->pro_password_label = __(FRM_PLUGIN_TITLE .' Pro Password', FRM_PLUGIN_NAME);
49
  $this->pro_check_interval = 60*60; // Checking every hour
50
  $this->pro_username_str = 'proplug-username';
51
  $this->pro_password_str = 'proplug-password';
52
+ $this->pro_wpmu_str = 'proplug-wpmu';
53
  $this->pro_mothership_xmlrpc_url = $this->pro_mothership . '/xmlrpc.php';
54
 
55
  // Retrieve Pro Credentials
56
+ $this->pro_wpmu = false;
57
+ if (IS_WPMU and get_site_option($this->pro_wpmu_store)){
58
+ $creds = get_site_option($this->pro_cred_store);
59
+ $this->pro_wpmu = true;
60
+ }else
61
+ $creds = get_option($this->pro_cred_store);
62
+
63
  if($creds and is_array($creds)){
64
  extract($creds);
65
  $this->pro_username = ((isset($username) and !empty($username))?$username:'');
78
 
79
  function pro_is_authorized($force_check=false){
80
  if( !empty($this->pro_username) and !empty($this->pro_password) ){
81
+ if (IS_WPMU and $this->pro_wpmu)
82
+ $authorized = get_site_option($this->pro_auth_store);
83
+ else
84
+ $authorized = get_option($this->pro_auth_store);
85
+ if(!$force_check and isset($authorized))
86
+ return $authorized;
87
+ else{
88
+ $new_auth = $this->authorize_user($this->pro_username,$this->pro_password);
89
+ if (IS_WPMU and $this->pro_wpmu)
90
+ update_site_option($this->pro_auth_store, $new_auth);
91
+ else
92
+ update_option($this->pro_auth_store, $new_auth);
93
+ return $new_auth;
94
+ }
95
  }
96
 
97
  return false;
151
  }
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
  }
176
  </td>
177
  </tr>
178
  <tr class="form-field">
179
+ <td valign="top"><?php echo $this->pro_password_label; ?>:</td>
180
  <td width="85%">
181
  <input type="password" name="<?php echo $this->pro_password_str; ?>" value="<?php echo $password; ?>"/>
182
  </td>
183
  </tr>
184
+ <?php if (IS_WPMU){ ?>
185
+ <tr>
186
+ <td valign="top"><?php _e('WordPress MU', FRM_PLUGIN_NAME); ?>:</td>
187
+ <td valign="top">
188
+ <input type="checkbox" value="1" name="<?php echo $this->pro_wpmu_str; ?>" <?php checked($wpmu, 1) ?>>
189
+ <?php _e('Use this username and password to enable Formidable Pro site-wide', FRM_PLUGIN_NAME); ?>
190
+ </td>
191
+ </tr>
192
+ <?php } ?>
193
  </table>
194
  <p class="submit">
195
  <input type="submit" name="Submit" value="<?php _e('Save', FRM_PLUGIN_NAME); ?>" />
203
  $user_authorized = $this->authorize_user($creds['username'], $creds['password']);
204
 
205
  if(!empty($user_authorized) and $user_authorized){
206
+ if (IS_WPMU)
207
+ update_site_option($this->pro_wpmu_store, $creds['wpmu']);
208
+
209
+ if ($creds['wpmu']){
210
+ update_site_option($this->pro_cred_store, $creds);
211
+ update_site_option($this->pro_auth_store, $user_authorized);
212
+ }else{
213
+ update_option($this->pro_cred_store, $creds);
214
+ update_option($this->pro_auth_store, $user_authorized);
215
+ }
216
 
217
+ extract($creds);
218
+ $this->pro_username = ((isset($username) and !empty($username))?$username:'');
219
+ $this->pro_password = ((isset($password) and !empty($password))?$password:'');
220
 
221
+ if(!$this->pro_is_installed())
222
+ $this->queue_update(true);
223
  }
224
 
225
  return $user_authorized;
228
  function get_pro_cred_form_vals(){
229
  $username = ((isset($_POST[$this->pro_username_str]))?$_POST[$this->pro_username_str]:$this->pro_username);
230
  $password = ((isset($_POST[$this->pro_password_str]))?$_POST[$this->pro_password_str]:$this->pro_password);
231
+ $wpmu = (isset($_POST[$this->pro_wpmu_str])) ? true : $this->pro_wpmu;
232
 
233
+ return compact('username','password','wpmu');
234
  }
235
 
236
  function get_download_url($version){
classes/templates/contact.php CHANGED
@@ -1,10 +1,7 @@
1
  <?php
2
 
3
- $values = FrmFormsHelper::setup_new_vars();
4
  $values['name'] = 'Contact Us';
5
- $values['form_key'] = 'contact';
6
  $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.';
7
- $values['is_template'] = $values['default_template'] = 1;
8
 
9
  if ($form){
10
  $form_id = $form->id;
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;
classes/views/frm-entries/direct.php CHANGED
@@ -1,11 +1,16 @@
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
3
- <head>
4
- <?php global $frm_settings, $frm_blogurl; ?>
5
- <link type="text/css" href="<?php echo FRM_URL; ?>/css/frm_display.css" rel="Stylesheet" />
6
- <link type="text/css" href="<?php echo $frm_settings->theme_css; ?>" rel="Stylesheet" />
7
- <script src="<?php echo FRM_URL; ?>/js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
8
- <script src="<?php echo FRM_URL; ?>/js/jquery/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
 
 
 
 
 
9
  </head>
10
  <body>
11
  <?php require_once('frm-entry.php'); ?>
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
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');
10
+ ?>
11
+ <link type="text/css" href="<?php echo $css; ?>" rel="Stylesheet" />
12
+ <?php } ?>
13
+ <?php do_action('frm_direct_link_head'); ?>
14
  </head>
15
  <body>
16
  <?php require_once('frm-entry.php'); ?>
classes/views/frm-entries/form.php CHANGED
@@ -1,8 +1,13 @@
1
  <?php echo FrmFormsHelper::replace_shortcodes($values['before_html'], $form, $title, $description); ?>
2
 
3
  <div id="frm_form_fields">
 
4
  <div>
 
5
  <input type="hidden" name="form_id" value="<?php echo $form->id ?>" />
 
 
 
6
  <?php if (isset($controller) && isset($plugin)){ ?>
7
  <input type="hidden" name="controller" value="<?php echo $controller; ?>" />
8
  <input type="hidden" name="plugin" value="<?php echo $plugin; ?>" />
@@ -26,12 +31,13 @@
26
  global $frm_settings;
27
  ?>
28
  <?php if (is_admin() && !$frm_settings->lock_keys){ ?>
29
- <div class="form_field">
30
- <label class="frm_pos_top">Entry Key</label>
31
  <input type="text" id="item_key" name="item_key" value="<?php echo $values['item_key'] ?>" />
32
  </div>
33
  <?php } ?>
34
  </div>
 
35
  </div>
36
 
37
  <?php echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); ?>
1
  <?php echo FrmFormsHelper::replace_shortcodes($values['before_html'], $form, $title, $description); ?>
2
 
3
  <div id="frm_form_fields">
4
+ <fieldset>
5
  <div>
6
+ <input type="hidden" name="action" value="<?php echo $form_action ?>" />
7
  <input type="hidden" name="form_id" value="<?php echo $form->id ?>" />
8
+ <?php if (isset($id)){ ?>
9
+ <input type="hidden" name="id" value="<?php echo $id ?>" />
10
+ <?php } ?>
11
  <?php if (isset($controller) && isset($plugin)){ ?>
12
  <input type="hidden" name="controller" value="<?php echo $controller; ?>" />
13
  <input type="hidden" name="plugin" value="<?php echo $plugin; ?>" />
31
  global $frm_settings;
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 } ?>
39
  </div>
40
+ </fieldset>
41
  </div>
42
 
43
  <?php echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); ?>
classes/views/frm-entries/frm-entry.php CHANGED
@@ -1,7 +1,6 @@
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
- //$values = FrmEntriesHelper::setup_new_vars($fields);
5
  $form_name = $form->name;
6
  $form_options = stripslashes_deep(maybe_unserialize($form->options));
7
 
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
 
classes/views/frm-entries/new.php CHANGED
@@ -1,8 +1,8 @@
1
- <div class="frm_forms" 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" name="form_<?php echo $form->form_key ?>" id="form_<?php echo $form->form_key ?>">
5
- <input type="hidden" name="action" value="create" />
6
 
7
  <?php require(FRM_VIEWS_PATH.'/frm-entries/form.php'); ?>
8
 
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
 
classes/views/frm-fields/input.php CHANGED
@@ -1,18 +1,18 @@
 
1
  <?php if ($field['type'] == 'text'){ ?>
2
- <input type="text" id="field_<?php echo $field['field_key'] ?>" name="<?php echo $field_name ?>" value="<?php echo $field['value'] ?>" size="<?php echo $field['size'] ?>" maxlength="<?php echo $field['max'] ?>" <?php echo ($field['clear_on_focus']) ? 'onfocus="frmClearDefault(\''.$field['default_value'].'\', this)" onblur="frmReplaceDefault(\''.$field['default_value'].'\', this)"':''; ?>/>
3
 
4
  <?php }else if ($field['type'] == 'textarea'){ ?>
5
- <textarea name="<?php echo $field_name ?>" cols="<?php echo $field['size'] ?>" rows="<?php echo $field['max'] ?>" <?php echo ($field['clear_on_focus']) ? 'onfocus="frmClearDefault(\''.$field['default_value'].'\', this)" onblur="frmReplaceDefault(\''.$field['default_value'].'\', this)"':''; ?>><?php echo $field['value'] ?></textarea>
6
 
7
  <?php }else if ($field['type'] == 'radio'){
8
  if (is_array($field['options'])){
9
  foreach($field['options'] as $opt){ ?>
10
- <input type='radio' name='<?php echo $field_name ?>' value='<?php echo $opt ?>' <?php if ($field['value'] == $opt) echo 'checked="checked"'; ?>/>
11
- <?php echo $opt ?><br/>
12
  <?php }
13
  } ?>
14
  <?php }else if ($field['type'] == 'select'){?>
15
- <select name="<?php echo $field_name ?>" id="item_meta<?php echo $field['id'] ?>">
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 } ?>
@@ -22,10 +22,11 @@
22
  if ($frm_recaptcha_enabled)
23
  FrmAppHelper::display_recaptcha($errors);
24
  }else if ($field['type'] == 'checkbox'){
25
- $checked_values = stripslashes_deep(maybe_unserialize($field['value']));
26
  foreach ($field['options'] as $opt){
27
- $checked = ((!is_array($checked_values) && $checked_values == $opt ) || (is_array($checked_values) && in_array($opt, $checked_values)))?' checked="true"':'';
28
- echo "<input type='checkbox' name='". $field_name ."[]' value='".$opt."'". $checked ."'/> ".$opt."<br/>";
 
29
  }
30
  }else do_action('frm_form_fields',$field, $field_name);
31
  ?>
1
+ <?php $auto_width = (isset($field['size']) && $field['size'] > 0) ? 'class="auto_width"' : ''; ?>
2
  <?php if ($field['type'] == 'text'){ ?>
3
+ <input type="text" id="field_<?php echo $field['field_key'] ?>" name="<?php echo $field_name ?>" value="<?php echo $field['value'] ?>" size="<?php echo $field['size'] ?>" maxlength="<?php echo $field['max'] ?>" <?php echo ($field['clear_on_focus']) ? 'onfocus="frmClearDefault(\''.$field['default_value'].'\', this)" onblur="frmReplaceDefault(\''.$field['default_value'].'\', this)"':''; ?> <?php echo $auto_width ?>/>
4
 
5
  <?php }else if ($field['type'] == 'textarea'){ ?>
6
+ <textarea name="<?php echo $field_name ?>" cols="<?php echo $field['size'] ?>" rows="<?php echo $field['max'] ?>" <?php echo ($field['clear_on_focus']) ? 'onfocus="frmClearDefault(\''.$field['default_value'].'\', this)" onblur="frmReplaceDefault(\''.$field['default_value'].'\', this)"':''; ?> <?php echo $auto_width ?>><?php echo $field['value'] ?></textarea>
7
 
8
  <?php }else if ($field['type'] == 'radio'){
9
  if (is_array($field['options'])){
10
  foreach($field['options'] as $opt){ ?>
11
+ <div class="frm_radio"><input type="radio" name="<?php echo $field_name ?>" value="<?php echo $opt ?>" <?php if ($field['value'] == $opt) echo 'checked="checked"'; ?> /><span><?php echo $opt ?></span></div>
 
12
  <?php }
13
  } ?>
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 } ?>
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){
27
+ $checked = ((!is_array($checked_values) && $checked_values == $opt ) || (is_array($checked_values) && in_array($opt, $checked_values)))?' checked="true"':''; ?>
28
+ <div class="frm_checkbox"><input type="checkbox" name="<?php echo $field_name ?>[]" value="<?php echo $opt ?>" <?php echo $checked ?> /><span><?php echo $opt ?></span></div>
29
+ <?php
30
  }
31
  }else do_action('frm_form_fields',$field, $field_name);
32
  ?>
classes/views/frm-fields/single-option.php CHANGED
@@ -1,9 +1,9 @@
1
  <span id="frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container" class="frm_single_option">
 
 
2
  <?php if ($field['type'] != 'select'){ ?>
3
  <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 : ''; ?>/>
4
  <?php } ?>
5
  <span class="frm_ipe_field_option" id="field_<?php echo $field['id']?>-<?php echo $opt_key ?>"><?php echo $opt ?></span>
6
- <span class="frm_spacer"></span>
7
- <a href="javascript:void(0);" class="ui-icon ui-icon-trash alignleft frm_delete_field_option" id="frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>"></a>
8
  </span>
9
  <div class="clear"></div>
1
  <span id="frm_delete_field_<?php echo $field['id']; ?>-<?php echo $opt_key ?>_container" class="frm_single_option">
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>
9
  <div class="clear"></div>
classes/views/frm-forms/add_field.php CHANGED
@@ -1,8 +1,10 @@
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
- <span class="ui-icon ui-icon-arrowthick-2-n-s alignright"></span>
5
- <a href="javascript:void(0);" class="ui-icon ui-icon-trash alignright" id="frm_delete_field<?php echo $field['id']; ?>" title="Delete Field"></a>
 
 
6
  <?php if ($display['required']){ ?>
7
  <span id="require_field_<?php echo $field['id']; ?>">
8
  <a href="javascript:frm_mark_required( <?php echo $field['id']; ?>, <?php echo $field_required = ($field['required'] == '0')?('0'):('1'); ?>)" class="ui-icon ui-icon-star alignleft frm_required<?php echo $field_required ?>" id="req_field_<?php echo $field['id']; ?>" title="Mark as <?php echo ($field['required'] == '0')?'':'not '; ?>Required"></a>
@@ -16,14 +18,15 @@
16
  <textarea name="<?php echo $field_name ?>" cols="<?php echo $field['size']; ?>" rows="<?php echo $field['max']; ?>"><?php echo $field['default_value']; ?></textarea>
17
 
18
  <?php }else if ($field['type'] == 'radio' || $field['type'] == 'checkbox'){
19
- $field['value'] = maybe_unserialize($field['default_value']);
20
- require(FRM_VIEWS_PATH.'/frm-fields/radio.php'); ?>
21
- <div id="frm_add_field_<?php echo $field['id']; ?>">
22
- <a href="javascipt:void(0)" class="frm_add_field_option" id="field_<?php echo $field['id']; ?>"><span class="ui-icon ui-icon-plusthick alignleft"></span> Add an Option</a>
 
23
  </div>
24
 
25
  <?php }else if ($field['type'] == 'select'){ ?>
26
- <select name='<?php echo $field_name ?>' id='<?php echo $field_name ?>'>
27
  <?php foreach ($field['options'] as $opt){
28
  $selected = ($field['default_value'] == $opt)?(' selected="selected"'):(''); ?>
29
  <option value="<?php echo $opt ?>"<?php echo $selected ?>><?php echo $opt ?></option>
@@ -31,11 +34,13 @@
31
  </select>
32
  <?php if ($display['default_blank']) FrmFieldsHelper::show_default_blank_js($field['id'], $field['default_blank']); ?>
33
  <br/>
 
34
  <?php foreach ($field['options'] as $opt_key => $opt)
35
  require(FRM_VIEWS_PATH.'/frm-fields/single-option.php');
36
  ?>
37
- <div id="frm_add_field_<?php echo $field['id']; ?>">
38
- <a href="javascipt:void(0)" class="frm_add_field_option" id="field_<?php echo $field['id']; ?>"><span class="ui-icon ui-icon-plusthick alignleft"></span> Add an Option</a>
 
39
  <?php do_action('frm_add_multiple_opts', $field); ?>
40
  </div>
41
 
@@ -64,62 +69,43 @@ if ($display['description']){ ?>
64
  }
65
 
66
  if ($display['options']){ ?>
67
- <div class="postbox">
68
- <h3 class="trigger">Field Options:</h3>
69
- <div class="toggle_container inside">
70
- <?php if ($display['size']){ ?>
71
- <p><label><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')?'Columns':'Field Size' ?></label>
72
- <input type="text" name="field_options[size_<?php echo $field['id'] ?>]" value="<?php echo $field['size']; ?>" size="5">
73
-
74
- <label class="nofloat"><?php echo ($field['type'] == 'textarea' || $field['type'] == 'rte')?'Rows':'Max length of input' ?></label>
75
- <input type="text" name="field_options[max_<?php echo $field['id'] ?>]" value="<?php echo $field['max']; ?>" size="5">
76
- </p>
77
- <?php } ?>
78
- <?php if ($display['label_position']){ ?>
79
- <p><label>Label Position:</label>
80
- <select name="field_options[label_<?php echo $field['id'] ?>]">
81
- <option value="top"<?php echo ($field['label'] == 'top')?(' selected="true"'):(''); ?>>Top</option>
82
- <option value="left"<?php echo ($field['label'] == 'left')?(' selected="true"'):(''); ?>>Left</option>
83
- <option value="none"<?php echo ($field['label'] == 'none')?(' selected="true"'):(''); ?>>Hidden</option>
84
- </select>
85
- </p>
86
- <?php } ?>
87
- <?php if ($display['required']){ ?>
88
- <p><label>Indicate required field with:</label>
89
- <input type="text" name="field_options[required_indicator_<?php echo $field['id'] ?>]" value="<?php echo $field['required_indicator']; ?>">
90
- </p>
91
- <p><label>Error message if required field is left blank:</label>
92
- <input type="text" name="field_options[blank_<?php echo $field['id'] ?>]" value="<?php echo $field['blank']; ?>" size="50">
93
- </p>
94
- <?php } ?>
95
- <?php if ($display['invalid']){ ?>
96
- <p><label>Error message if entry is an invalid format:</label>
97
- <input type="text" name="field_options[invalid_<?php echo $field['id'] ?>]" value="<?php echo $field['invalid']; ?>" size="50">
98
- </p>
99
- <?php } ?>
100
- <?php do_action('frm_field_options_form', $field, $display); ?>
101
- </div>
 
 
102
  </div>
103
  <?php } ?>
104
  </li>
105
-
106
- <script type="text/javascript">
107
- jQuery(document).ready(function() {
108
- jQuery("#frm_delete_field<?php echo $field['id']; ?>").click(function(){
109
- if(confirm("<?php _e('Are you sure you want to delete this field and all data associated with it?', FRM_PLUGIN_NAME); ?>")){
110
- jQuery.ajax({
111
- type:"POST",
112
- url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
113
- data:"action=frm_delete_field&field_id=<?php echo $field['id']; ?>",
114
- success:function(msg){
115
- jQuery('#new_fields').append(msg);
116
- jQuery("#frm_field_id_<?php echo $field['id']; ?>").hide('highlight',{},500,callback);
117
- }
118
- });
119
- return false;
120
- }
121
- });
122
-
123
- function callback(){setTimeout(function(){jQuery("#frm_delete_field<?php echo $field['id']; ?>:hidden").removeAttr('style').hide().fadeIn();}, 1000);};
124
- });
125
- </script>
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']); ?>
7
+
8
  <?php if ($display['required']){ ?>
9
  <span id="require_field_<?php echo $field['id']; ?>">
10
  <a href="javascript:frm_mark_required( <?php echo $field['id']; ?>, <?php echo $field_required = ($field['required'] == '0')?('0'):('1'); ?>)" class="ui-icon ui-icon-star alignleft frm_required<?php echo $field_required ?>" id="req_field_<?php echo $field['id']; ?>" title="Mark as <?php echo ($field['required'] == '0')?'':'not '; ?>Required"></a>
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'){ ?>
29
+ <select name="<?php echo $field_name ?>" id="<?php echo $field_name ?>">
30
  <?php foreach ($field['options'] as $opt){
31
  $selected = ($field['default_value'] == $opt)?(' selected="selected"'):(''); ?>
32
  <option value="<?php echo $opt ?>"<?php echo $selected ?>><?php echo $opt ?></option>
34
  </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)
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
 
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 } ?>
107
+ <?php do_action('frm_field_options_form', $field, $display); ?>
108
+
109
  </div>
110
  <?php } ?>
111
  </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/views/frm-forms/add_field_links.php CHANGED
@@ -1,66 +1,95 @@
1
  <div id="frm_form_options" class="alignright">
2
  <?php if (!$values['is_template']){ ?>
3
- <div>Copy this code and paste it into your post, page or text widget:
4
- <h4 class="frmcenter">[formidable id=<?php echo $id ?>]</h4>
5
- </div>
6
  <?php } ?>
7
 
8
  <ul class="frmbutton nodrag">
9
- <li><a href="<?php echo FrmFormsHelper::get_direct_link($values['form_key']); ?>" target="blank" >Preview Form</a></li>
10
  <?php global $frm_settings; if ($frm_settings->preview_page_id > 0){ ?>
11
- <li><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>
12
  <?php } ?>
13
  </ul>
14
 
15
- <h4>Basic Fields</h4>
16
- <ul class="field_type_list">
17
- <?php foreach ($frm_field_selection as $field_key => $field_type){ ?>
18
- <li class="frmbutton" id="<?php echo $field_key ?>"><a href="javascript:void(0);" class="add_frm_field_link" id="<?php echo $field_key ?>"><?php echo $field_type ?></a></li>
19
- <?php } ?>
20
- <?php if (!$frm_recaptcha_enabled && !function_exists( 'akismet_http_post' )){
21
- global $frm_siteurl;
22
- 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>';
23
- } ?>
24
- </ul>
25
-
26
- <h4>Pro Fields</h4>
27
- <ul class="field_type_list">
28
- <?php
29
- if($frmpro_is_installed){
30
- foreach ($frm_pro_field_selection as $field_key => $field_type){ ?>
31
- <li class="frmbutton" id="<?php echo $field_key ?>"><a href="javascript:void(0);" class="add_frm_field_link" id="<?php echo $field_key ?>"><?php echo $field_type ?></a></li>
32
- <?php }
33
- }else
34
- foreach ($frm_pro_field_selection as $field_key => $field_type)
35
- echo '<li class="frmbutton">'.$field_type.'</li>';
36
- ?>
37
- </ul>
38
-
39
- <br/>
40
- <h3>KEY</h3>
41
- <ul class="ui-state-default" style="border:none; font-weight:normal">
42
- <li><span class="ui-icon ui-icon-star alignleft"></span> = required field</li>
43
- <li><span class="frm_inactive_icon ui-icon ui-icon-star alignleft"></span> = not required</li>
44
- <li><span><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></span> = clear default data on click</li>
45
- <li><span class="frm_inactive_icon"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></span> = do not clear default data on click</li>
46
- <li><span><img src="<?php echo FRM_IMAGES_URL?>/error.png"></span> = default value will NOT pass validation</li>
47
- <li><span class="frm_inactive_icon"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></span> = default value will pass validation</li>
48
- <li><span class="ui-icon ui-icon-trash alignleft"></span> = delete field and all inputed data</li>
49
- </ul>
50
 
51
- <p class="howto">Enter or select default values into fields on this form.</p>
52
- <?php do_action('frm_extra_form_instructions'); ?>
53
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
- <script>
56
- jQuery(document).ready(function(){
57
- jQuery(".add_frm_field_link").click(function(){
58
- jQuery.ajax({
59
- type:"POST",
60
- url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
61
- data:"action=frm_insert_field&form_id=<?php echo $id; ?>&field="+this.getAttribute('id'),
62
- success:function(msg){jQuery('#new_fields').append(msg);}
63
- });
64
- });
65
- })
66
- </script>
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">
26
+ <ul class="field_type_list">
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 -->
87
+ <?php do_action('frm_extra_form_instructions'); ?>
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>
 
 
 
 
 
 
classes/views/frm-forms/edit.php CHANGED
@@ -8,6 +8,11 @@
8
 
9
  <div class="frm_form_builder alignleft" id="poststuff">
10
  <form name="form1" method="post" action="">
 
 
 
 
 
11
  <input type="hidden" name="action" value="update">
12
  <input type="hidden" name="id" value="<?php echo $id; ?>">
13
  <?php wp_nonce_field('update-options'); ?>
8
 
9
  <div class="frm_form_builder alignleft" id="poststuff">
10
  <form name="form1" method="post" action="">
11
+ <p class="submit">
12
+ <input type="submit" name="Submit" value="Update" class="button-primary" /> or
13
+ <a href="?page=<?php echo FRM_PLUGIN_NAME ?>">Cancel</a>
14
+ </p>
15
+
16
  <input type="hidden" name="action" value="update">
17
  <input type="hidden" name="id" value="<?php echo $id; ?>">
18
  <?php wp_nonce_field('update-options'); ?>
classes/views/frm-forms/footer.php CHANGED
@@ -3,39 +3,25 @@ jQuery(document).ready(function($){
3
  $(".frm_ipe_field_option").editInPlace({
4
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
5
  params:"action=frm_field_option_ipe",
6
- show_buttons:true,
7
  default_text:'(Blank)'
8
  });
9
 
10
  $(".frm_ipe_field_option_select").editInPlace({
11
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
12
  params:"action=frm_field_option_ipe",
13
- show_buttons:true,
14
  default_text:'(Blank)'
15
  });
16
 
17
- $(".frm_delete_field_option").click(function(){
18
- var thisid=this.getAttribute('id');
19
- jQuery.ajax({
20
- type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
21
- data:"action=frm_delete_field_option&field="+thisid,
22
- success:function(msg){ $('#'+thisid+'_container').hide('highlight');}
23
- });
24
- return false;
25
- });
26
-
27
  $(".frm_ipe_form_name").editInPlace({
28
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
29
  params:"action=frm_form_name_in_place_edit&form_id=<?php echo $id; ?>",
30
- value_required:"true",
31
- show_buttons:true
32
  });
33
 
34
  $(".frm_ipe_form_desc").editInPlace({
35
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
36
  params:"action=frm_form_desc_in_place_edit&form_id=<?php echo $id; ?>",
37
  field_type:"textarea",
38
- show_buttons:true,
39
  textarea_rows:3,
40
  textarea_cols:60,
41
  default_text:"(Click here to add form description or instructions)"
@@ -43,29 +29,16 @@ $(".frm_ipe_form_desc").editInPlace({
43
  $(".frm_ipe_field_label").editInPlace({
44
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
45
  params:"action=frm_field_name_in_place_edit",
46
- value_required:"true",
47
- show_buttons:true
48
  });
49
 
50
  $(".frm_ipe_field_desc").editInPlace({
51
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
52
  params:"action=frm_field_desc_in_place_edit",
53
  default_text:"(Click here to add optional description or instructions)",
54
- show_buttons:true,
55
  field_type:'textarea',
56
  textarea_rows:1
57
  });
58
-
59
- $(".frm_add_field_option").click(function(){
60
- var thisid=this.getAttribute('id');
61
- jQuery.ajax({
62
- type:"POST",
63
- url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
64
- data:"action=frm_add_field_option&field="+thisid,
65
- success:function(msg){ $('#frm_add_'+thisid).before(msg);}
66
- });
67
- return false;
68
- });
69
 
70
  $("#new_fields").sortable({
71
  cursor:'move',
@@ -97,6 +70,15 @@ jQuery("ul.field_type_list, .field_type_list li").disableSelection();
97
 
98
  //window.onunload = function(){jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",data:"action=frm_delete_form_wo_fields&form_id=<?php echo $id; ?>"});return false;};
99
 
 
 
 
 
 
 
 
 
 
100
  function frm_mark_required(field_id, required){
101
  var thisid= 'req_field_' + field_id;
102
  if (required == '0')
@@ -126,7 +108,7 @@ function frm_clear_on_focus(field_id, active){
126
  type:"POST",
127
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
128
  data:"action=frm_clear_on_focus&field="+field_id+"&active="+switch_to,
129
- success:function(msg){ jQuery('#'+thisid).replaceWith('<a href="javascript:frm_clear_on_focus( '+field_id+', '+switch_to+')" class="'+new_class +'" id="'+thisid+'"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></a>');}
130
  });
131
  };
132
 
@@ -144,7 +126,47 @@ function frm_default_blank(field_id, active){
144
  type:"POST",
145
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
146
  data:"action=frm_default_blank&field="+field_id+"&active="+switch_to,
147
- success:function(msg){ jQuery('#'+thisid).replaceWith('<a href="javascript:frm_default_blank( '+field_id+', '+switch_to+')" class="'+new_class +'" id="'+thisid+'"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></a>');}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  });
149
  };
150
  </script>
3
  $(".frm_ipe_field_option").editInPlace({
4
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
5
  params:"action=frm_field_option_ipe",
 
6
  default_text:'(Blank)'
7
  });
8
 
9
  $(".frm_ipe_field_option_select").editInPlace({
10
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
11
  params:"action=frm_field_option_ipe",
 
12
  default_text:'(Blank)'
13
  });
14
 
 
 
 
 
 
 
 
 
 
 
15
  $(".frm_ipe_form_name").editInPlace({
16
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
17
  params:"action=frm_form_name_in_place_edit&form_id=<?php echo $id; ?>",
18
+ value_required:"true", bg_out:'#fff'
 
19
  });
20
 
21
  $(".frm_ipe_form_desc").editInPlace({
22
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
23
  params:"action=frm_form_desc_in_place_edit&form_id=<?php echo $id; ?>",
24
  field_type:"textarea",
 
25
  textarea_rows:3,
26
  textarea_cols:60,
27
  default_text:"(Click here to add form description or instructions)"
29
  $(".frm_ipe_field_label").editInPlace({
30
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
31
  params:"action=frm_field_name_in_place_edit",
32
+ value_required:"true"
 
33
  });
34
 
35
  $(".frm_ipe_field_desc").editInPlace({
36
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
37
  params:"action=frm_field_desc_in_place_edit",
38
  default_text:"(Click here to add optional description or instructions)",
 
39
  field_type:'textarea',
40
  textarea_rows:1
41
  });
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  $("#new_fields").sortable({
44
  cursor:'move',
70
 
71
  //window.onunload = function(){jQuery.ajax({type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",data:"action=frm_delete_form_wo_fields&form_id=<?php echo $id; ?>"});return false;};
72
 
73
+ function add_frm_field_link(form_id, field_type){
74
+ jQuery.ajax({
75
+ type:"POST",
76
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
77
+ data:"action=frm_insert_field&form_id="+form_id+"&field="+field_type,
78
+ success:function(msg){jQuery('#new_fields').append(msg);}
79
+ });
80
+ };
81
+
82
  function frm_mark_required(field_id, required){
83
  var thisid= 'req_field_' + field_id;
84
  if (required == '0')
108
  type:"POST",
109
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
110
  data:"action=frm_clear_on_focus&field="+field_id+"&active="+switch_to,
111
+ success:function(msg){ jQuery('#'+thisid).replaceWith('<a href="javascript:frm_clear_on_focus( '+field_id+', '+switch_to+')" class="'+new_class +' frm-show-hover" id="'+thisid+'"><img src="<?php echo FRM_IMAGES_URL?>/reload.png"></a>');}
112
  });
113
  };
114
 
126
  type:"POST",
127
  url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
128
  data:"action=frm_default_blank&field="+field_id+"&active="+switch_to,
129
+ success:function(msg){ jQuery('#'+thisid).replaceWith('<a href="javascript:frm_default_blank('+field_id+', '+switch_to+')" class="'+new_class +' frm-show-hover" id="'+thisid+'"><img src="<?php echo FRM_IMAGES_URL?>/error.png"></a>');}
130
+ });
131
+ };
132
+
133
+ function frm_duplicate_field(field_id){
134
+ jQuery.ajax({
135
+ type:"POST",
136
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
137
+ data:"action=frm_duplicate_field&field_id="+field_id,
138
+ success:function(msg){jQuery('#new_fields').append(msg);}
139
+ });
140
+ };
141
+
142
+ function frm_delete_field(field_id){
143
+ if(confirm("<?php _e('Are you sure you want to delete this field and all data associated with it?', FRM_PLUGIN_NAME); ?>")){
144
+ jQuery.ajax({
145
+ type:"POST",
146
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
147
+ data:"action=frm_delete_field&field_id="+field_id,
148
+ success:function(msg){
149
+ jQuery('#new_fields').append(msg);
150
+ jQuery("#frm_field_id_"+field_id).hide('highlight',{},500, setTimeout(function(){ jQuery("#frm_delete_field"+field_id+":hidden").removeAttr('style').hide().fadeIn(); }, 1000));
151
+ }
152
+ });
153
+ }
154
+ };
155
+
156
+ function frm_add_field_option(field_id){
157
+ jQuery.ajax({
158
+ type:"POST",
159
+ url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
160
+ data:"action=frm_add_field_option&field_id="+field_id,
161
+ success:function(msg){jQuery('#frm_add_field_'+field_id).before(msg);}
162
+ });
163
+ };
164
+
165
+ function frm_delete_field_option(field_id, opt_key){
166
+ jQuery.ajax({
167
+ type:"POST",url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
168
+ data:"action=frm_delete_field_option&field_id="+field_id+"&opt_key="+opt_key,
169
+ success:function(msg){ jQuery('#frm_delete_field_'+field_id+'-'+opt_key+'_container').hide('highlight');}
170
  });
171
  };
172
  </script>
classes/views/frm-forms/form.php CHANGED
@@ -1,4 +1,4 @@
1
-
2
  <div id="form_desc" class="edit_form_item frm_field_box frm_head_box">
3
  <h2 class="frm_ipe_form_name" id="frmform_<?php echo $id; ?>"><?php echo $values['name']; ?></h2>
4
  <div class="frm_ipe_form_desc"><?php echo wpautop($values['description']); ?></div>
@@ -15,9 +15,11 @@ if (isset($values['fields']) && !empty($values['fields'])){
15
  </ul>
16
 
17
  <?php if (!$values['is_template']){ ?>
18
- <div class="postbox">
19
- <h3 class="trigger">Advanced Form Options</h3>