Formidable Forms – Form Builder for WordPress - Version 1.07.10

Version Description

  • Improve ajax form load speed on form builder page
  • Added 4.0 compatibility for deprecated like_escape function
  • Remove label html in radio and checkbox fields when label=0 is used on the [input] tag in the customizable HTML
  • Fix Akismet integration for current version of Akismet
  • Added Italian translation
  • Added a few ajax nonce checks but don't require valid nonce for logged-out users for caching reasons
  • Allow data-something="value" inside the [input] short code
  • Pro: Allow [default-message] to have short code parameters to set rtl (direction=rtl), font size (font_size="14px"), and styling (text_color="000" border_width="1px" border_color="000" bg_color="fff" alt_bg_color="eee").
  • Pro: Added frm_html_scoll_box class for scrolling content in an HTML field
  • Pro: Allow recurring entries using values like "Third Wednesday of [frmcal-date]"
  • Pro: Allow comma separated view filters for entry key and id
  • Pro: Allow drafts=both in view short code and form results short code
  • Pro: Added created_at and updated_at support to the frm-stats short code
  • Pro: Added column separation option to csv export
  • Pro: Added hook: frm_csv_column_sep for changing the , separation between columns in csv
  • Pro: Added hook: frm_csv_field_ids to specify fields to export in CSV
  • Pro: Added hook: frm_filter_where_val and frm_filter_dfe_where_val for filtering only the value instead of the full WHERE statement
  • Pro: Added hook: frm_rte_options for adding options to the TinyMce editor
  • Pro: Added hook: frm_show_form_after_edit to show or hide the form differently from create
  • Pro: Added hook: frm_scroll_offset to change the point of scroll after submit to allow for static headers
  • Pro: Added hook: frm_ajax_load_styles for allowing additional styles on ajax loaded form pages
  • Pro: Added hook: frm_create_cookies for preventing cookie creation
  • Pro: Added hook: frm_filter_auto_content to prevent filtering on auto-inserted views
  • Pro: Added hook: frm_file_icon to change what is displayed for a upload field when editing
  • Pro: Import CSV values for a taxonomy field correctly when the term name is in the CSV instead of requiring the ID
  • Pro: Import CSV dates correctly in entries if format has been changed to a day-first format
  • Pro: Added Post ID into the view filtering options
  • Pro: Added support for multiselect drop downs in calculations
  • Pro: Updated the way templates are fetched for wpmu copying
  • Pro: Show any additional info on the entry view page that is stored in the entry description
  • Pro: Update to Chosen 1.1.0
  • Pro: Allow comma-separated values to populate a checkbox field
  • Pro: Make fields and exclude_fields parameter work with multi-page forms (required fields are still a limitation)
  • Pro: Allow drafts=1 or drafts=both in stats shortcode
  • Pro: Allow field keys in stats filtering
  • Miscellaneous bug fixes
Download this release

Release Info

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

Code changes from version 1.07.09 to 1.07.10

Files changed (42) hide show
  1. classes/controllers/FrmAppController.php +19 -10
  2. classes/controllers/FrmEntriesController.php +104 -31
  3. classes/controllers/FrmFieldsController.php +41 -22
  4. classes/controllers/FrmFormsController.php +58 -21
  5. classes/controllers/FrmSettingsController.php +9 -1
  6. classes/controllers/FrmXMLController.php +1 -1
  7. classes/helpers/FrmAppHelper.php +110 -11
  8. classes/helpers/FrmEntriesHelper.php +41 -2
  9. classes/helpers/FrmFieldsHelper.php +22 -4
  10. classes/helpers/FrmFormsHelper.php +6 -2
  11. classes/helpers/FrmListHelper.php +28 -22
  12. classes/models/FrmDb.php +1 -0
  13. classes/models/FrmEntry.php +17 -10
  14. classes/models/FrmEntryMeta.php +0 -1
  15. classes/models/FrmField.php +10 -2
  16. classes/models/FrmNotification.php +4 -13
  17. classes/views/frm-entries/errors.php +1 -0
  18. classes/views/frm-entries/frm-entry.php +2 -2
  19. classes/views/frm-fields/input.php +44 -21
  20. classes/views/frm-forms/add_field.php +29 -16
  21. classes/views/frm-forms/edit.php +8 -7
  22. classes/views/frm-forms/form.php +7 -8
  23. classes/views/frm-forms/new-field-js.php +1 -6
  24. classes/views/frm-forms/new.php +5 -4
  25. classes/views/frm-settings/form.php +8 -3
  26. classes/views/xml/import_form.php +12 -4
  27. css/frm_admin.css +59 -10
  28. formidable.php +1 -1
  29. js/formidable.js +51 -14
  30. js/formidable.min.js +37 -36
  31. js/formidable_admin.js +74 -33
  32. languages/formidable-de_DE.mo +0 -0
  33. languages/formidable-de_DE.po +1186 -1157
  34. languages/formidable-en_US.po +811 -783
  35. languages/formidable-es_ES.mo +0 -0
  36. languages/formidable-es_ES.po +811 -783
  37. languages/formidable-fr_FR.mo +0 -0
  38. languages/formidable-fr_FR.po +811 -783
  39. languages/formidable-it_IT.mo +0 -0
  40. languages/formidable-it_IT.po +6978 -0
  41. languages/formidable-nl_NL.mo +0 -0
  42. languages/formidable-nl_NL.po +572 -586
classes/controllers/FrmAppController.php CHANGED
@@ -131,11 +131,11 @@ class FrmAppController{
131
  if ( ( (int) $db_version < (int) FrmAppHelper::$db_version ) ||
132
  ( $frm_vars['pro_is_installed'] && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
133
  ?>
134
- <div class="error" id="frm_install_message" style="padding:7px;"><?php _e('Your Formidable database needs to be updated.<br/>Please deactivate and reactivate the plugin to fix this or', 'formidable'); ?> <a id="frm_install_link" href="javascript:void(0)"><?php _e('Update Now', 'formidable') ?></a></div>
135
  <script type="text/javascript">
136
- jQuery(document).ready(function($){ $('#frm_install_link').click(function(){frm_install_now()}); });
137
  function frm_install_now(){
138
- jQuery('#frm_install_link').replaceWith('<img src="<?php echo FrmAppHelper::plugin_url() ?>/images/wpspin_light.gif" alt="<?php _e('Loading&hellip;') ?>" />');
139
  jQuery.ajax({
140
  type:"POST",url:ajaxurl,data:"action=frm_install",
141
  success:function(msg){jQuery("#frm_install_message").fadeOut("slow");}
@@ -156,7 +156,7 @@ function frm_deauthorize_now(){
156
  if(!confirm("<?php esc_attr_e('Are you sure you want to deauthorize Formidable Pro on this site?', 'formidable') ?>"))
157
  return false;
158
  jQuery('.frm_deauthorize_link').html('<span class="spinner" style="display:inline-block;margin-top:0;float:none;"></span>');
159
- jQuery.ajax({type:'POST',url:ajaxurl,data:'action=frm_deauthorize',
160
  success:function(msg){jQuery('.error').fadeOut('slow');}
161
  });
162
  return false;
@@ -188,7 +188,7 @@ return false;
188
  wp_enqueue_script('admin-widgets');
189
  wp_enqueue_style('widgets');
190
  wp_enqueue_script('formidable');
191
- wp_enqueue_script('formidable_admin', FrmAppHelper::plugin_url() .'/js/formidable_admin.js', array('formidable', 'jquery', 'jquery-ui-draggable', 'bootstrap_tooltip'), $version);
192
  self::localize_script('admin');
193
 
194
  wp_enqueue_style('formidable-admin', FrmAppHelper::plugin_url() .'/css/frm_admin.css', array(), $version);
@@ -277,12 +277,12 @@ return false;
277
  if ( 'all' == $frm_settings->load_style ) {
278
  wp_enqueue_style($k);
279
  }
280
- unset($k);
281
- unset($file);
282
  }
283
  }
 
284
 
285
- if((!is_admin() or defined('DOING_AJAX')) and $frm_settings->load_style == 'all'){
286
  global $frm_vars;
287
  $frm_vars['css_loaded'] = true;
288
  }
@@ -293,7 +293,8 @@ return false;
293
  'ajax_url' => admin_url( 'admin-ajax.php' ),
294
  'images_url' => FrmAppHelper::plugin_url() .'/images',
295
  'loading' => __('Loading&hellip;'),
296
- 'remove' => __('Remove', 'formidable')
 
297
  ));
298
 
299
  if($location == 'admin'){
@@ -315,6 +316,8 @@ return false;
315
  'confirm' => __('Are you sure?', 'formidable'),
316
  'default_unique' => $frm_settings->unique_msg,
317
  'import_complete' => __('Import Complete', 'formidable'),
 
 
318
  ));
319
  }
320
  }
@@ -352,6 +355,8 @@ return false;
352
  }
353
 
354
  public static function uninstall(){
 
 
355
  if ( current_user_can('administrator') ) {
356
  global $frmdb;
357
  $frmdb->uninstall();
@@ -377,8 +382,9 @@ return false;
377
  public static function referer_session() {
378
  global $frm_settings;
379
 
380
- if(!isset($frm_settings->track) or !$frm_settings->track or defined('WP_IMPORTING'))
381
  return;
 
382
 
383
  // keep the page history below 100
384
  $max = 100;
@@ -465,9 +471,12 @@ return false;
465
  }
466
 
467
  public static function deauthorize(){
 
 
468
  delete_option('frmpro-credentials');
469
  delete_option('frmpro-authorized');
470
  delete_site_option('frmpro-credentials');
471
  delete_site_option('frmpro-authorized');
 
472
  }
473
  }
131
  if ( ( (int) $db_version < (int) FrmAppHelper::$db_version ) ||
132
  ( $frm_vars['pro_is_installed'] && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
133
  ?>
134
+ <div class="error" id="frm_install_message" style="padding:7px;"><?php _e('Your update is not complete yet.<br/>Please deactivate and reactivate the plugin to complete the update or', 'formidable'); ?> <a id="frm_install_link" href="javascript:void(0)"><?php _e('Update Now', 'formidable') ?></a></div>
135
  <script type="text/javascript">
136
+ jQuery(document).ready(function($){ $('#frm_install_link').click(frm_install_now); });
137
  function frm_install_now(){
138
+ jQuery('#frm_install_message').html('<div style="line-height:24px;"><?php _e("Please wait while your site updates.", "formidable") ?><div class="spinner frm_spinner" style="float:left;display:block;"></div></div>');
139
  jQuery.ajax({
140
  type:"POST",url:ajaxurl,data:"action=frm_install",
141
  success:function(msg){jQuery("#frm_install_message").fadeOut("slow");}
156
  if(!confirm("<?php esc_attr_e('Are you sure you want to deauthorize Formidable Pro on this site?', 'formidable') ?>"))
157
  return false;
158
  jQuery('.frm_deauthorize_link').html('<span class="spinner" style="display:inline-block;margin-top:0;float:none;"></span>');
159
+ jQuery.ajax({type:'POST',url:ajaxurl,data:'action=frm_deauthorize&nonce='+wp_create_nonce('frm_ajax'),
160
  success:function(msg){jQuery('.error').fadeOut('slow');}
161
  });
162
  return false;
188
  wp_enqueue_script('admin-widgets');
189
  wp_enqueue_style('widgets');
190
  wp_enqueue_script('formidable');
191
+ wp_enqueue_script('formidable_admin', FrmAppHelper::plugin_url() .'/js/formidable_admin.js', array('formidable', 'jquery', 'jquery-ui-draggable', 'bootstrap_tooltip'), $version, true);
192
  self::localize_script('admin');
193
 
194
  wp_enqueue_style('formidable-admin', FrmAppHelper::plugin_url() .'/css/frm_admin.css', array(), $version);
277
  if ( 'all' == $frm_settings->load_style ) {
278
  wp_enqueue_style($k);
279
  }
280
+ unset($k, $file);
 
281
  }
282
  }
283
+ unset($style);
284
 
285
+ if ( $frm_settings->load_style == 'all' ) {
286
  global $frm_vars;
287
  $frm_vars['css_loaded'] = true;
288
  }
293
  'ajax_url' => admin_url( 'admin-ajax.php' ),
294
  'images_url' => FrmAppHelper::plugin_url() .'/images',
295
  'loading' => __('Loading&hellip;'),
296
+ 'remove' => __('Remove', 'formidable'),
297
+ 'offset' => apply_filters('frm_scroll_offset', 4),
298
  ));
299
 
300
  if($location == 'admin'){
316
  'confirm' => __('Are you sure?', 'formidable'),
317
  'default_unique' => $frm_settings->unique_msg,
318
  'import_complete' => __('Import Complete', 'formidable'),
319
+ 'updating' => __('Please wait while your site updates.', 'formidable'),
320
+ 'nonce' => wp_create_nonce('frm_ajax'),
321
  ));
322
  }
323
  }
355
  }
356
 
357
  public static function uninstall(){
358
+ check_ajax_referer( 'frm_ajax', 'nonce' );
359
+
360
  if ( current_user_can('administrator') ) {
361
  global $frmdb;
362
  $frmdb->uninstall();
382
  public static function referer_session() {
383
  global $frm_settings;
384
 
385
+ if ( !isset($frm_settings->track) || !$frm_settings->track || defined('WP_IMPORTING') ) {
386
  return;
387
+ }
388
 
389
  // keep the page history below 100
390
  $max = 100;
471
  }
472
 
473
  public static function deauthorize(){
474
+ check_ajax_referer( 'frm_ajax', 'nonce' );
475
+
476
  delete_option('frmpro-credentials');
477
  delete_option('frmpro-authorized');
478
  delete_site_option('frmpro-credentials');
479
  delete_site_option('frmpro-authorized');
480
+ die();
481
  }
482
  }
classes/controllers/FrmEntriesController.php CHANGED
@@ -110,11 +110,15 @@ class FrmEntriesController{
110
  }
111
 
112
  public static function show_entry_shortcode($atts){
113
- extract(shortcode_atts(array(
114
  'id' => false, 'entry' => false, 'fields' => false, 'plain_text' => false,
115
  'user_info' => false, 'include_blank' => false, 'default_email' => false,
116
- 'form_id' => false, 'format' => 'text',
117
- ), $atts));
 
 
 
 
118
 
119
  if ( $format != 'text' ) {
120
  //format options are text, array, or json
@@ -144,23 +148,45 @@ class FrmEntriesController{
144
 
145
  $content = ( $format != 'text' ) ? array() : '';
146
  $odd = true;
147
-
148
  if ( !$plain_text ) {
149
  global $frmpro_settings;
150
- if ( !$frmpro_settings ) {
151
- $frmpro_settings = array(
152
- 'field_border_width' => '1px',
153
- 'border_color' => 'dddddd',
154
- 'bg_color' => 'f7f7f7',
155
- 'bg_color_active' => 'ffffff',
156
- 'text_color' => '444444',
157
- );
158
- $frmpro_settings = (object) $frmpro_settings;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
- $content .= "<table cellspacing='0' style='font-size:{$frmpro_settings->font_size};line-height:135%; border-bottom:{$frmpro_settings->field_border_width} solid #{$frmpro_settings->border_color};'><tbody>\r\n";
161
- $bg_color = " style='background-color:#{$frmpro_settings->bg_color};'";
162
- $bg_color_alt = " style='background-color:#{$frmpro_settings->bg_color_active};'";
163
- $row_style = "style='text-align:left;color:#{$frmpro_settings->text_color};padding:7px 9px;border-top:{$frmpro_settings->field_border_width} solid #{$frmpro_settings->border_color}'";
 
 
 
164
  }
165
 
166
  foreach ( $fields as $f ) {
@@ -186,6 +212,7 @@ class FrmEntriesController{
186
  $entry->metas[$f->id] = $default_email ? '['. $f->id .']' : '';
187
  }
188
 
 
189
  if ( $entry ) {
190
  $prev_val = maybe_unserialize($entry->metas[$f->id]);
191
  $meta = array('item_id' => $id, 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type);
@@ -199,6 +226,11 @@ class FrmEntriesController{
199
  $val = str_replace(array("\r\n", "\r", "\n"), ' <br/>', $val);
200
  }
201
 
 
 
 
 
 
202
  if ( is_array($val) && $format == 'text' ) {
203
  $val = implode(', ', $val);
204
  }
@@ -208,19 +240,34 @@ class FrmEntriesController{
208
  if ( $format != 'text' ){
209
  $content[$f->field_key] = $val;
210
  } else if ( $plain_text ) {
211
- $content .= $fname . ': ' . $val . "\r\n\r\n";
 
 
 
 
212
  } else {
213
  if (!$default_email){
214
- $content .= "<tr".(($odd) ? $bg_color : $bg_color_alt)."><th $row_style>" . $fname ."</th><td $row_style>$val</td></tr>\r\n";
 
 
 
 
 
 
215
  $odd = ($odd) ? false : true;
216
  }else{
217
- $content .= "[if $f->id]<tr style=\"[frm-alt-color]\"><th $row_style>" . $fname ."</th><td $row_style>$val</td></tr>\r\n[/if $f->id]";
 
 
 
 
 
 
218
  }
219
 
220
  }
221
 
222
- unset($fname);
223
- unset($f);
224
  }
225
 
226
  if ( $user_info ) {
@@ -239,29 +286,55 @@ class FrmEntriesController{
239
  $content['referrer'] = $data['referrer'];
240
  } else if ( $plain_text ) {
241
  $content .= "\r\n\r\n" . __('User Information', 'formidable') ."\r\n";
242
- $content .= __('IP Address', 'formidable') . ": ". $entry->ip ."\r\n";
243
- $content .= __('User-Agent (Browser/OS)', 'formidable') . ": ". $data['browser']."\r\n";
244
- $content .= __('Referrer', 'formidable') . ": ". $data['referrer']."\r\n";
 
 
 
 
 
 
245
  } else {
246
- $content .= "<tr".(($odd) ? $bg_color : $bg_color_alt)."><th $row_style>". __('IP Address', 'formidable') . "</th><td $row_style>". $entry->ip ."</td></tr>\r\n";
 
 
 
 
 
 
247
  $odd = ($odd) ? false : true;
248
 
249
  if ( isset($data['browser']) ) {
250
- $content .= "<tr".(($odd) ? $bg_color : $bg_color_alt)."><th $row_style>".__('User-Agent (Browser/OS)', 'formidable') . "</th><td $row_style>". $data['browser']."</td></tr>\r\n";
 
 
 
 
 
 
251
  }
252
  $odd = ($odd) ? false : true;
253
 
254
  if ( isset($data['referrer']) ) {
255
- $content .= "<tr".(($odd) ? $bg_color : $bg_color_alt)."><th $row_style>".__('Referrer', 'formidable') . "</th><td $row_style>". str_replace("\r\n", '<br/>', $data['referrer']) ."</td></tr>\r\n";
 
 
 
 
 
 
256
  }
257
  }
258
  }
259
 
260
- if(!$plain_text)
261
- $content .= "</tbody></table>";
 
262
 
263
- if ( $format == 'json' )
264
  $content = json_encode($content);
 
265
 
266
  return $content;
267
  }
110
  }
111
 
112
  public static function show_entry_shortcode($atts){
113
+ $atts = shortcode_atts(array(
114
  'id' => false, 'entry' => false, 'fields' => false, 'plain_text' => false,
115
  'user_info' => false, 'include_blank' => false, 'default_email' => false,
116
+ 'form_id' => false, 'format' => 'text', 'direction' => 'ltr',
117
+ 'font_size' => '', 'text_color' => '',
118
+ 'border_width' => '', 'border_color' => '',
119
+ 'bg_color' => '', 'alt_bg_color' => '',
120
+ ), $atts);
121
+ extract($atts);
122
 
123
  if ( $format != 'text' ) {
124
  //format options are text, array, or json
148
 
149
  $content = ( $format != 'text' ) ? array() : '';
150
  $odd = true;
151
+
152
  if ( !$plain_text ) {
153
  global $frmpro_settings;
154
+
155
+ $default_settings = array(
156
+ 'border_color' => 'dddddd',
157
+ 'bg_color' => 'f7f7f7',
158
+ 'text_color' => '444444',
159
+ 'font_size' => '12px',
160
+ 'border_width' => '1px',
161
+ 'alt_bg_color' => 'ffffff',
162
+ );
163
+
164
+ // merge defaults, global settings, and shortcode options
165
+ foreach ( $default_settings as $key => $setting ) {
166
+ if ( $atts[$key] != '' ) {
167
+ continue;
168
+ }
169
+
170
+ if ( $frmpro_settings ) {
171
+ if ( 'alt_bg_color' == $key ) {
172
+ $atts[$key] = $frmpro_settings->bg_color_active;
173
+ } else if ( 'border_width' == $key ) {
174
+ $atts[$key] = $frmpro_settings->field_border_width;
175
+ } else {
176
+ $atts[$key] = $frmpro_settings->{$key};
177
+ }
178
+ } else {
179
+ $atts[$key] = $setting;
180
+ }
181
+ unset($key, $setting);
182
  }
183
+
184
+ unset($default_settings);
185
+
186
+ $content .= "<table cellspacing='0' style='font-size:{$atts['font_size']};line-height:135%; border-bottom:{$atts['border_width']} solid #{$atts['border_color']};'><tbody>\r\n";
187
+ $bg_color = " style='background-color:#{$atts['bg_color']};'";
188
+ $bg_color_alt = " style='background-color:#{$atts['alt_bg_color']};'";
189
+ $row_style = "style='text-align:". ( $direction == 'rtl' ? 'right' : 'left' ) .";color:#{$atts['text_color']};padding:7px 9px;border-top:{$atts['border_width']} solid #{$atts['border_color']}'";
190
  }
191
 
192
  foreach ( $fields as $f ) {
212
  $entry->metas[$f->id] = $default_email ? '['. $f->id .']' : '';
213
  }
214
 
215
+ $val = '';
216
  if ( $entry ) {
217
  $prev_val = maybe_unserialize($entry->metas[$f->id]);
218
  $meta = array('item_id' => $id, 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type);
226
  $val = str_replace(array("\r\n", "\r", "\n"), ' <br/>', $val);
227
  }
228
 
229
+ //Remove signature from default-message shortcode
230
+ if ( $f->type == 'signature' && !$default_email ) {
231
+ continue;
232
+ }
233
+
234
  if ( is_array($val) && $format == 'text' ) {
235
  $val = implode(', ', $val);
236
  }
240
  if ( $format != 'text' ){
241
  $content[$f->field_key] = $val;
242
  } else if ( $plain_text ) {
243
+ if ( 'rtl' == $direction ) {
244
+ $content .= $val . ' :' . $fname . "\r\n\r\n";
245
+ } else {
246
+ $content .= $fname . ': ' . $val . "\r\n\r\n";
247
+ }
248
  } else {
249
  if (!$default_email){
250
+ $content .= '<tr'. ( $odd ? $bg_color : $bg_color_alt ) .'>';
251
+ if ( 'rtl' == $direction ) {
252
+ $content .= "<td $row_style>$val</td><th $row_style>" . $fname ."</th>";
253
+ } else {
254
+ $content .= "<th $row_style>" . $fname ."</th><td $row_style>$val</td>";
255
+ }
256
+ $content .= '</tr>'. "\r\n";
257
  $odd = ($odd) ? false : true;
258
  }else{
259
+ $content .= '[if '. $f->id .']<tr style="[frm-alt-color]">';
260
+ if ( 'rtl' == $direction ) {
261
+ $content .= "<td $row_style>$val</td><th $row_style>" . $fname ."</th>";
262
+ } else {
263
+ $content .= "<th $row_style>" . $fname ."</th><td $row_style>$val</td>";
264
+ }
265
+ $content .= "</tr>\r\n[/if $f->id]";
266
  }
267
 
268
  }
269
 
270
+ unset($fname, $f);
 
271
  }
272
 
273
  if ( $user_info ) {
286
  $content['referrer'] = $data['referrer'];
287
  } else if ( $plain_text ) {
288
  $content .= "\r\n\r\n" . __('User Information', 'formidable') ."\r\n";
289
+ if ( 'rtl' == $direction ) {
290
+ $content .= $entry->ip . ' :'. __('IP Address', 'formidable') ."\r\n";
291
+ $content .= $data['browser'] .' :'. __('User-Agent (Browser/OS)', 'formidable') ."\r\n";
292
+ $content .= $data['referrer'] .' :'. __('Referrer', 'formidable') ."\r\n";
293
+ } else {
294
+ $content .= __('IP Address', 'formidable') . ': '. $entry->ip ."\r\n";
295
+ $content .= __('User-Agent (Browser/OS)', 'formidable') . ': '. $data['browser']."\r\n";
296
+ $content .= __('Referrer', 'formidable') . ': '. $data['referrer']."\r\n";
297
+ }
298
  } else {
299
+ $content .= '<tr'. ($odd ? $bg_color : $bg_color_alt) .'>';
300
+ if ( 'rtl' == $direction ) {
301
+ $content .= "<td $row_style>". $entry->ip ."</td><th $row_style>". __('IP Address', 'formidable') . "</th>";
302
+ } else {
303
+ $content .= "<th $row_style>". __('IP Address', 'formidable') . "</th><td $row_style>". $entry->ip ."</td>";
304
+ }
305
+ $content .= '</tr>'. "\r\n";
306
  $odd = ($odd) ? false : true;
307
 
308
  if ( isset($data['browser']) ) {
309
+ $content .= '<tr'. ($odd ? $bg_color : $bg_color_alt) .'>';
310
+ if ( 'rtl' == $direction ) {
311
+ $content .= "<td $row_style>". $data['browser']."</td><th $row_style>". __('User-Agent (Browser/OS)', 'formidable') . "</th>";
312
+ } else {
313
+ $content .= "<th $row_style>". __('User-Agent (Browser/OS)', 'formidable') . "</th><td $row_style>". $data['browser']."</td>";
314
+ }
315
+ $content .= '</tr>'. "\r\n";
316
  }
317
  $odd = ($odd) ? false : true;
318
 
319
  if ( isset($data['referrer']) ) {
320
+ $content .= '<tr'. ($odd ? $bg_color : $bg_color_alt) .'>';
321
+ if ( 'rtl' == $direction ) {
322
+ $content .= "<td $row_style>". str_replace("\r\n", '<br/>', $data['referrer']) ."</td><th $row_style>".__('Referrer', 'formidable') . "</th>";
323
+ } else {
324
+ $content .= "<th $row_style>".__('Referrer', 'formidable') . "</th><td $row_style>". str_replace("\r\n", '<br/>', $data['referrer']) ."</td>";
325
+ }
326
+ $content .= '</tr>'. "\r\n";
327
  }
328
  }
329
  }
330
 
331
+ if ( ! $plain_text ) {
332
+ $content .= '</tbody></table>';
333
+ }
334
 
335
+ if ( $format == 'json' ) {
336
  $content = json_encode($content);
337
+ }
338
 
339
  return $content;
340
  }
classes/controllers/FrmFieldsController.php CHANGED
@@ -31,25 +31,41 @@ class FrmFieldsController{
31
  }
32
 
33
  public static function load_field(){
34
- $id = $field_id = $_POST['field_id'];
35
- if(!$field_id or !is_numeric($field_id))
36
  die();
 
37
 
38
  $_GET['page'] = 'formidable';
39
- $field = htmlspecialchars_decode(nl2br(stripslashes_deep($_POST['field'])));
40
- $field = json_decode($field, true);
41
- if(!isset($field['value']))
42
- $field['value'] = '';
43
 
44
- $field_name = "item_meta[$field_id]";
45
  $ajax = true;
46
  $values = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
- $path = FrmAppHelper::plugin_path();
49
- include($path .'/classes/views/frm-forms/add_field.php');
50
- include($path .'/classes/views/frm-forms/new-field-js.php');
51
  unset($path);
52
 
 
 
53
  die();
54
  }
55
 
@@ -69,8 +85,7 @@ class FrmFieldsController{
69
  $field = FrmFieldsHelper::setup_edit_vars($frm_field->getOne($field_id));
70
  $field_name = "item_meta[$field_id]";
71
  $id = $form_id;
72
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/add_field.php');
73
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new-field-js.php');
74
  }
75
  die();
76
  }
@@ -147,8 +162,7 @@ class FrmFieldsController{
147
  $id = $field['form_id'];
148
  if($field['type'] == 'html')
149
  $field['stop_filter'] = true;
150
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/add_field.php');
151
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new-field-js.php');
152
  }
153
  die();
154
  }
@@ -362,8 +376,6 @@ class FrmFieldsController{
362
  }
363
  }
364
 
365
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new-field-js.php');
366
-
367
  die();
368
  }
369
 
@@ -477,12 +489,19 @@ class FrmFieldsController{
477
  if(!empty($class))
478
  $add_html .= ' class="'. trim($class) .'"';
479
 
480
- if(isset($field['shortcodes']) and !empty($field['shortcodes'])){
481
- foreach($field['shortcodes'] as $k => $v){
482
- if($k == 'opt' or strpos($add_html, " $k=")) continue;
483
- $add_html .= ' '. $k .'="'. $v .'"';
484
- unset($k);
485
- unset($v);
 
 
 
 
 
 
 
486
  }
487
  }
488
 
31
  }
32
 
33
  public static function load_field(){
34
+ $fields = $_POST['field'];
35
+ if ( empty($fields) ) {
36
  die();
37
+ }
38
 
39
  $_GET['page'] = 'formidable';
40
+ $fields = stripslashes_deep($fields);
 
 
 
41
 
 
42
  $ajax = true;
43
  $values = array();
44
+ $path = FrmAppHelper::plugin_path();
45
+ $field_html = array();
46
+
47
+ foreach ( $fields as $field ) {
48
+ $field = htmlspecialchars_decode(nl2br($field));
49
+ $field = json_decode($field, true);
50
+
51
+ $field_id = $field['id'];
52
+
53
+ if ( !isset($field['value']) ) {
54
+ $field['value'] = '';
55
+ }
56
+
57
+ $field_name = "item_meta[$field_id]";
58
+
59
+ ob_start();
60
+ include($path .'/classes/views/frm-forms/add_field.php');
61
+ $field_html[$field_id] = ob_get_contents();
62
+ ob_end_clean();
63
+ }
64
 
 
 
 
65
  unset($path);
66
 
67
+ echo json_encode($field_html);
68
+
69
  die();
70
  }
71
 
85
  $field = FrmFieldsHelper::setup_edit_vars($frm_field->getOne($field_id));
86
  $field_name = "item_meta[$field_id]";
87
  $id = $form_id;
88
+ require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/add_field.php');
 
89
  }
90
  die();
91
  }
162
  $id = $field['form_id'];
163
  if($field['type'] == 'html')
164
  $field['stop_filter'] = true;
165
+ require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/add_field.php');
 
166
  }
167
  die();
168
  }
376
  }
377
  }
378
 
 
 
379
  die();
380
  }
381
 
489
  if(!empty($class))
490
  $add_html .= ' class="'. trim($class) .'"';
491
 
492
+ if ( isset($field['shortcodes']) && !empty($field['shortcodes']) ) {
493
+ foreach ( $field['shortcodes'] as $k => $v ) {
494
+ if ( 'opt' === $k || (!is_numeric($k) && strpos($add_html, " $k=")) ) {
495
+ continue;
496
+ }
497
+
498
+ if ( is_numeric($k) && strpos($v, '=') ) {
499
+ $add_html .= ' '. $v;
500
+ } else {
501
+ $add_html .= ' '. $k .'="'. $v .'"';
502
+ }
503
+
504
+ unset($k, $v);
505
  }
506
  }
507
 
classes/controllers/FrmFormsController.php CHANGED
@@ -95,6 +95,7 @@ class FrmFormsController{
95
  $frm_field_selection = FrmFieldsHelper::field_selection();
96
  $values = FrmFormsHelper::setup_new_vars($values);
97
  $id = $frm_form->create( $values );
 
98
  $values['id'] = $id;
99
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
100
  }else{
@@ -108,7 +109,7 @@ class FrmFormsController{
108
  if(!$values)
109
  $values = $_POST;
110
 
111
- if($_POST and (!isset($values['frm_save_form']) or !wp_verify_nonce($values['frm_save_form'], 'frm_save_form_nonce'))){
112
  global $frm_settings;
113
  $errors['form'] = $frm_settings->admin_permission;
114
  }
@@ -121,12 +122,12 @@ class FrmFormsController{
121
  if( count($errors) > 0 ){
122
  $hide_preview = true;
123
  $frm_field_selection = FrmFieldsHelper::field_selection();
124
- $record = $frm_form->getOne( $id );
125
  $fields = $frm_field->getAll(array('fi.form_id' => $id), 'field_order');
126
- $values = FrmAppHelper::setup_edit_vars($record, 'forms', $fields, true);
127
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
128
  }else{
129
- $record = $frm_form->update( $id, $values, true );
130
  die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
131
  //$message = __('Form was Successfully Created', 'formidable');
132
  //return self::settings($record, $message);
@@ -134,6 +135,11 @@ class FrmFormsController{
134
  }
135
 
136
  public static function edit($values=false){
 
 
 
 
 
137
  $id = isset($values['id']) ? (int)$values['id'] : (int)FrmAppHelper::get_param('id');
138
  return self::get_edit_vars($id);
139
  }
@@ -160,6 +166,10 @@ class FrmFormsController{
160
  }
161
 
162
  public static function edit_key(){
 
 
 
 
163
  global $wpdb;
164
  $values = array('form_key' => trim($_POST['update_value']));
165
  $frm_form = new FrmForm();
@@ -170,6 +180,10 @@ class FrmFormsController{
170
  }
171
 
172
  public static function edit_description(){
 
 
 
 
173
  $frm_form = new FrmForm();
174
  $form = $frm_form->update($_POST['form_id'], array('description' => $_POST['update_value']));
175
  $description = stripslashes($_POST['update_value']);
@@ -187,7 +201,7 @@ class FrmFormsController{
187
 
188
  $errors = $frm_form->validate($values);
189
 
190
- if($_POST and (!isset($values['frm_save_form']) or !wp_verify_nonce($values['frm_save_form'], 'frm_save_form_nonce'))){
191
  global $frm_settings;
192
  $errors['form'] = $frm_settings->admin_permission;
193
  }
@@ -207,15 +221,21 @@ class FrmFormsController{
207
  }
208
 
209
  public static function duplicate(){
 
 
 
 
 
210
  $frm_form = new FrmForm();
211
 
212
  $params = self::get_params();
213
- $record = $frm_form->duplicate( $params['id'], $params['template'], true );
214
  $message = ($params['template']) ? __('Form template was Successfully Created', 'formidable') : __('Form was Successfully Copied', 'formidable');
215
- if ($record)
216
- return self::get_edit_vars($record, '', $message, true);
217
- else
218
  return self::display_forms_list($params, __('There was a problem creating new template.', 'formidable'));
 
219
  }
220
 
221
 
@@ -417,27 +437,29 @@ class FrmFormsController{
417
  private static function get_edit_vars($id, $errors = '', $message='', $create_link=false){
418
  global $frm_entry, $frm_field, $frm_vars;
419
  $frm_form = new FrmForm();
420
- $record = $frm_form->getOne( $id );
421
- if ( !$record ) {
422
  wp_die( __('You are trying to edit a form that does not exist.', 'formidable') );
423
  }
424
 
425
  $frm_field_selection = FrmFieldsHelper::field_selection();
426
- $fields = $frm_field->getAll(array('fi.form_id' => $record->id), 'field_order');
427
- $values = FrmAppHelper::setup_edit_vars($record, 'forms', $fields, true);
428
 
429
  $edit_message = __('Form was Successfully Updated', 'formidable');
430
- if ($values['is_template'] and $message == $edit_message)
431
  $message = __('Template was Successfully Updated', 'formidable');
 
432
 
433
- if (isset($values['default_template']) && $values['default_template'])
434
  wp_die(__('That template cannot be edited', 'formidable'));
435
- else if(defined('DOING_AJAX'))
436
  die();
437
- else if($create_link)
438
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
439
- else
440
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
 
441
  }
442
 
443
  public static function get_settings_vars($id, $errors = '', $message=''){
@@ -558,10 +580,20 @@ class FrmFormsController{
558
  global $frm_settings;
559
  wp_die($frm_settings->admin_permission);
560
  }
561
- $json_vars = htmlspecialchars_decode(nl2br(stripslashes($_POST['frm_compact_fields'])));
562
  $json_vars = json_decode($json_vars, true);
563
- $vars = FrmAppHelper::json_to_array($json_vars);
564
- $action = $vars[$action];
 
 
 
 
 
 
 
 
 
 
565
  }else{
566
  $action = FrmAppHelper::get_param($action);
567
  }
@@ -606,6 +638,11 @@ class FrmFormsController{
606
  }
607
  }
608
 
 
 
 
 
 
609
 
610
  /* FRONT-END FORMS */
611
  public static function admin_bar_css() {
95
  $frm_field_selection = FrmFieldsHelper::field_selection();
96
  $values = FrmFormsHelper::setup_new_vars($values);
97
  $id = $frm_form->create( $values );
98
+ $form = $frm_form->getOne($id);
99
  $values['id'] = $id;
100
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
101
  }else{
109
  if(!$values)
110
  $values = $_POST;
111
 
112
+ if ( ! current_user_can('frm_edit_forms') || ( $_POST && (!isset($values['frm_save_form']) || !wp_verify_nonce($values['frm_save_form'], 'frm_save_form_nonce'))) ) {
113
  global $frm_settings;
114
  $errors['form'] = $frm_settings->admin_permission;
115
  }
122
  if( count($errors) > 0 ){
123
  $hide_preview = true;
124
  $frm_field_selection = FrmFieldsHelper::field_selection();
125
+ $form = $frm_form->getOne( $id );
126
  $fields = $frm_field->getAll(array('fi.form_id' => $id), 'field_order');
127
+ $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
128
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
129
  }else{
130
+ $form = $frm_form->update( $id, $values, true );
131
  die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
132
  //$message = __('Form was Successfully Created', 'formidable');
133
  //return self::settings($record, $message);
135
  }
136
 
137
  public static function edit($values=false){
138
+ if ( ! current_user_can('frm_edit_forms') ) {
139
+ global $frm_settings;
140
+ wp_die($frm_settings->admin_permission);
141
+ }
142
+
143
  $id = isset($values['id']) ? (int)$values['id'] : (int)FrmAppHelper::get_param('id');
144
  return self::get_edit_vars($id);
145
  }
166
  }
167
 
168
  public static function edit_key(){
169
+ if ( ! current_user_can('frm_edit_forms') ) {
170
+ die();
171
+ }
172
+
173
  global $wpdb;
174
  $values = array('form_key' => trim($_POST['update_value']));
175
  $frm_form = new FrmForm();
180
  }
181
 
182
  public static function edit_description(){
183
+ if ( ! current_user_can('frm_edit_forms') ) {
184
+ die();
185
+ }
186
+
187
  $frm_form = new FrmForm();
188
  $form = $frm_form->update($_POST['form_id'], array('description' => $_POST['update_value']));
189
  $description = stripslashes($_POST['update_value']);
201
 
202
  $errors = $frm_form->validate($values);
203
 
204
+ if ( ! current_user_can('frm_edit_forms') || ( $_POST && (!isset($values['frm_save_form']) || !wp_verify_nonce($values['frm_save_form'], 'frm_save_form_nonce')) ) ) {
205
  global $frm_settings;
206
  $errors['form'] = $frm_settings->admin_permission;
207
  }
221
  }
222
 
223
  public static function duplicate(){
224
+ if ( ! current_user_can('frm_edit_forms') ) {
225
+ global $frm_settings;
226
+ wp_die($frm_settings->admin_permission);
227
+ }
228
+
229
  $frm_form = new FrmForm();
230
 
231
  $params = self::get_params();
232
+ $form = $frm_form->duplicate( $params['id'], $params['template'], true );
233
  $message = ($params['template']) ? __('Form template was Successfully Created', 'formidable') : __('Form was Successfully Copied', 'formidable');
234
+ if ( $form ) {
235
+ return self::get_edit_vars($form, '', $message, true);
236
+ } else {
237
  return self::display_forms_list($params, __('There was a problem creating new template.', 'formidable'));
238
+ }
239
  }
240
 
241
 
437
  private static function get_edit_vars($id, $errors = '', $message='', $create_link=false){
438
  global $frm_entry, $frm_field, $frm_vars;
439
  $frm_form = new FrmForm();
440
+ $form = $frm_form->getOne( $id );
441
+ if ( !$form ) {
442
  wp_die( __('You are trying to edit a form that does not exist.', 'formidable') );
443
  }
444
 
445
  $frm_field_selection = FrmFieldsHelper::field_selection();
446
+ $fields = $frm_field->getAll(array('fi.form_id' => $form->id), 'field_order');
447
+ $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
448
 
449
  $edit_message = __('Form was Successfully Updated', 'formidable');
450
+ if ( $form->is_template && $message == $edit_message ) {
451
  $message = __('Template was Successfully Updated', 'formidable');
452
+ }
453
 
454
+ if ( $form->default_template ) {
455
  wp_die(__('That template cannot be edited', 'formidable'));
456
+ } else if ( defined('DOING_AJAX') ) {
457
  die();
458
+ } else if ( $create_link ) {
459
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
460
+ } else {
461
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
462
+ }
463
  }
464
 
465
  public static function get_settings_vars($id, $errors = '', $message=''){
580
  global $frm_settings;
581
  wp_die($frm_settings->admin_permission);
582
  }
583
+ $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
584
  $json_vars = json_decode($json_vars, true);
585
+ if ( empty($json_vars) ) {
586
+ // json decoding failed so we should return an error message
587
+ $action = FrmAppHelper::get_param($action);
588
+ if ( 'edit' == $action ) {
589
+ $action = 'update';
590
+ }
591
+
592
+ add_filter('frm_validate_form', array(__CLASS__, 'json_error'));
593
+ } else {
594
+ $vars = FrmAppHelper::json_to_array($json_vars);
595
+ $action = $vars[$action];
596
+ }
597
  }else{
598
  $action = FrmAppHelper::get_param($action);
599
  }
638
  }
639
  }
640
 
641
+ public static function json_error($errors) {
642
+ $errors['json'] = __('Abnormal HTML characters prevented your form from saving correctly', 'formidable');
643
+ return $errors;
644
+ }
645
+
646
 
647
  /* FRONT-END FORMS */
648
  public static function admin_bar_css() {
classes/controllers/FrmSettingsController.php CHANGED
@@ -33,7 +33,15 @@ class FrmSettingsController{
33
  $sections = apply_filters('frm_add_settings_section', array(
34
  'styling' => array('name' => __('Form Styling', 'formidable'), 'class' => 'FrmSettingsController', 'function' => 'styling_tab')
35
  ));
36
-
 
 
 
 
 
 
 
 
37
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-settings/form.php');
38
  }
39
 
33
  $sections = apply_filters('frm_add_settings_section', array(
34
  'styling' => array('name' => __('Form Styling', 'formidable'), 'class' => 'FrmSettingsController', 'function' => 'styling_tab')
35
  ));
36
+
37
+ $recaptcha_themes = array(
38
+ 'red' => __('Red', 'formidable'),
39
+ 'white' => __('White', 'formidable'),
40
+ 'blackglass' => __('Black Glass', 'formidable'),
41
+ 'clean' => __('Clean', 'formidable'),
42
+ //'custom' => __('Custom', 'formidable'),
43
+ );
44
+
45
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-settings/form.php');
46
  }
47
 
classes/controllers/FrmXMLController.php CHANGED
@@ -33,7 +33,7 @@ class FrmXMLController{
33
  else if($result)
34
  $message = $result;
35
 
36
- unset($file);
37
 
38
  libxml_use_internal_errors( $set_err );
39
  libxml_disable_entity_loader( $loader );
33
  else if($result)
34
  $message = $result;
35
 
36
+ unset($files);
37
 
38
  libxml_use_internal_errors( $set_err );
39
  libxml_disable_entity_loader( $loader );
classes/helpers/FrmAppHelper.php CHANGED
@@ -6,8 +6,14 @@ if(class_exists('FrmAppHelper'))
6
 
7
  class FrmAppHelper{
8
  public static $db_version = 11; //version of the database we are moving to (skip 12)
9
- public static $pro_db_version = 24;
10
-
 
 
 
 
 
 
11
  public static function plugin_version(){
12
  $plugin_data = get_file_data( WP_PLUGIN_DIR .'/formidable/formidable.php', array('Version' => 'Version'), 'plugin' );
13
  return $plugin_data['Version'];
@@ -63,6 +69,19 @@ class FrmAppHelper{
63
  return isset($_POST[$param]) ? stripslashes_deep(maybe_unserialize($_POST[$param])) : $default;
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  public static function load_scripts($scripts){
67
  foreach ( (array) $scripts as $s ) {
68
  wp_enqueue_script($s);
@@ -270,13 +289,17 @@ class FrmAppHelper{
270
 
271
  $values = array('id' => $record->id, 'fields' => array());
272
 
273
- foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default_val)
274
- $values[$var] = FrmAppHelper::get_param($var, $default_val);
 
 
 
275
 
276
- if(apply_filters('frm_use_wpautop', true))
277
  $values['description'] = wpautop(str_replace( '<br>', '<br />', $values['description']));
 
278
 
279
- foreach((array)$fields as $field){
280
 
281
  if ($default){
282
  $meta_value = $field->default_value;
@@ -355,14 +378,13 @@ class FrmAppHelper{
355
  $values['fields'][$field->id] = $field_array;
356
 
357
  unset($field);
358
- }
359
 
360
  $frm_form = new FrmForm();
361
  $form = $frm_form->getOne( $table == 'entries' ? $record->form_id : $record->id );
362
  unset($frm_form);
363
 
364
  if ($form){
365
- $form->options = maybe_unserialize($form->options);
366
  $values['form_name'] = (isset($record->form_id)) ? $form->name : '';
367
  if (is_array($form->options)){
368
  foreach ($form->options as $opt => $value){
@@ -561,19 +583,43 @@ class FrmAppHelper{
561
 
562
  foreach ($words as $word){
563
  $part = (($sub != '') ? ' ' : '') . $word;
 
 
 
 
 
564
  $sub .= $part;
565
  $len += (function_exists('mb_strlen')) ? mb_strlen($part) : strlen($part);
566
- $total_len = (function_exists('mb_strlen')) ? mb_strlen($sub) : strlen($sub);
567
 
568
- if (str_word_count($sub) > $minword && $total_len >= $length)
569
  break;
 
570
 
571
- unset($total_len);
572
  }
573
 
574
  return $sub . (($len < $original_len) ? $continue : '');
575
  }
576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ){
578
  if ( empty($where) ) {
579
  return '';
@@ -721,4 +767,57 @@ class FrmAppHelper{
721
  return $string;
722
  }
723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
  }
6
 
7
  class FrmAppHelper{
8
  public static $db_version = 11; //version of the database we are moving to (skip 12)
9
+ public static $pro_db_version = 25;
10
+
11
+ /*
12
+ * @since 1.07.02
13
+ *
14
+ * @param none
15
+ * @return float The version of this plugin
16
+ */
17
  public static function plugin_version(){
18
  $plugin_data = get_file_data( WP_PLUGIN_DIR .'/formidable/formidable.php', array('Version' => 'Version'), 'plugin' );
19
  return $plugin_data['Version'];
69
  return isset($_POST[$param]) ? stripslashes_deep(maybe_unserialize($_POST[$param])) : $default;
70
  }
71
 
72
+ /*
73
+ * Check a value from a shortcode to see if true or false.
74
+ * True when value is 1, true, 'true', 'yes'
75
+ *
76
+ * @since 1.07.10
77
+ *
78
+ * @param string $value The value to compare
79
+ * @return boolean True or False
80
+ */
81
+ public static function is_true($value) {
82
+ return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
83
+ }
84
+
85
  public static function load_scripts($scripts){
86
  foreach ( (array) $scripts as $s ) {
87
  wp_enqueue_script($s);
289
 
290
  $values = array('id' => $record->id, 'fields' => array());
291
 
292
+ foreach ( array('name', 'description') as $var ) {
293
+ $default_val = isset($record->{$var}) ? $record->{$var} : '';
294
+ $values[$var] = FrmAppHelper::get_param($var, $default_val);
295
+ unset($var, $default_val);
296
+ }
297
 
298
+ if ( apply_filters('frm_use_wpautop', true) ) {
299
  $values['description'] = wpautop(str_replace( '<br>', '<br />', $values['description']));
300
+ }
301
 
302
+ foreach ( (array) $fields as $field ) {
303
 
304
  if ($default){
305
  $meta_value = $field->default_value;
378
  $values['fields'][$field->id] = $field_array;
379
 
380
  unset($field);
381
+ }
382
 
383
  $frm_form = new FrmForm();
384
  $form = $frm_form->getOne( $table == 'entries' ? $record->form_id : $record->id );
385
  unset($frm_form);
386
 
387
  if ($form){
 
388
  $values['form_name'] = (isset($record->form_id)) ? $form->name : '';
389
  if (is_array($form->options)){
390
  foreach ($form->options as $opt => $value){
583
 
584
  foreach ($words as $word){
585
  $part = (($sub != '') ? ' ' : '') . $word;
586
+ $total_len = (function_exists('mb_strlen')) ? mb_strlen($sub . $part) : strlen($sub. $part);
587
+ if ( $total_len > $length ) {
588
+ break;
589
+ }
590
+
591
  $sub .= $part;
592
  $len += (function_exists('mb_strlen')) ? mb_strlen($part) : strlen($part);
 
593
 
594
+ if ( str_word_count($sub) > $minword && $total_len >= $length ) {
595
  break;
596
+ }
597
 
598
+ unset($total_len, $word);
599
  }
600
 
601
  return $sub . (($len < $original_len) ? $continue : '');
602
  }
603
 
604
+ /*
605
+ * Added for < 4.0 compatability
606
+ *
607
+ * @since 1.07.10
608
+ *
609
+ * @param $term The value to escape
610
+ * @return string The escaped value
611
+ */
612
+ public static function esc_like($term) {
613
+ global $wpdb;
614
+ if ( method_exists($wpdb, 'esc_like') ) { // WP 4.0
615
+ $term = $wpdb->esc_like( $term );
616
+ } else {
617
+ $term = like_escape( $term );
618
+ }
619
+
620
+ return $term;
621
+ }
622
+
623
  public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ){
624
  if ( empty($where) ) {
625
  return '';
767
  return $string;
768
  }
769
 
770
+ public static function check_mem_use($function='', $start_mem=0) {
771
+ $mem = memory_get_usage(true) - $start_mem;
772
+
773
+ //error_log($mem .' '. $function);
774
+ return $start_mem + $mem;
775
+ }
776
+
777
+ /*
778
+ * @since 1.07.10
779
+ *
780
+ * @param string $post_type The name of the post type that may need to be highlighted
781
+ * @return echo The javascript to open and highlight the Formidable menu
782
+ */
783
+ public static function maybe_highlight_menu($post_type) {
784
+ global $post, $pagenow;
785
+
786
+ if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
787
+ return;
788
+ }
789
+
790
+ if ( is_object($post) && $post->post_type != $post_type ) {
791
+ return;
792
+ }
793
+
794
+ echo <<<HTML
795
+ <script type="text/javascript">
796
+ jQuery(document).ready(function(){
797
+ jQuery('#toplevel_page_formidable').removeClass('wp-not-current-submenu').addClass('wp-has-current-submenu wp-menu-open');
798
+ jQuery('#toplevel_page_formidable a.wp-has-submenu').removeClass('wp-not-current-submenu').addClass('wp-has-current-submenu wp-menu-open');
799
+ });
800
+ </script>
801
+ HTML;
802
+ }
803
+
804
+ /*
805
+ * @since 1.07.10
806
+ *
807
+ * @param float $min_version The version the add-on requires
808
+ * @return echo The message on the plugins listing page
809
+ */
810
+ public static function min_version_notice($min_version) {
811
+ $frm_version = self::plugin_version();
812
+
813
+ // check if Formidable meets minimum requirements
814
+ if ( version_compare($frm_version, $min_version, '>=') ) {
815
+ return;
816
+ }
817
+
818
+ $wp_list_table = _get_list_table('WP_Plugins_List_Table');
819
+ echo '<tr class="plugin-update-tr active"><th colspan="' . $wp_list_table->get_column_count() . '" class="check-column plugin-update colspanchange"><div class="update-message">'.
820
+ __('You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable') .
821
+ '</div></td></tr>';
822
+ }
823
  }
classes/helpers/FrmEntriesHelper.php CHANGED
@@ -35,8 +35,15 @@ class FrmEntriesHelper{
35
  }
36
 
37
  $is_default = ($new_value == $default) ? true : false;
38
-
39
- $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field);
 
 
 
 
 
 
 
40
 
41
  if ( !is_array($new_value) ) {
42
  if ( $is_default ) {
@@ -140,6 +147,38 @@ class FrmEntriesHelper{
140
  $values['is_draft'] = $record->is_draft;
141
  return apply_filters('frm_setup_edit_entry_vars', $values, $record);
142
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
  public static function entries_dropdown( $form_id, $field_name, $field_value='', $blank=true, $blank_label='', $onchange=false ){
145
  _deprecated_function( __FUNCTION__, '1.07.09');
35
  }
36
 
37
  $is_default = ($new_value == $default) ? true : false;
38
+
39
+ //If checkbox, multi-select dropdown, or checkbox data from entries field, set return array to true
40
+ if ( $field && ( ( $field->type == 'data' && $field->field_options['data_type'] == 'checkbox' ) || $field->type == 'checkbox' || ( $field->type == 'select' && $field->field_options['multiple'] == 1 ) ) ) {
41
+ $return_array = true;
42
+ } else {
43
+ $return_array = false;
44
+ }
45
+
46
+ $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
47
 
48
  if ( !is_array($new_value) ) {
49
  if ( $is_default ) {
147
  $values['is_draft'] = $record->is_draft;
148
  return apply_filters('frm_setup_edit_entry_vars', $values, $record);
149
  }
150
+
151
+ public static function replace_default_message($message, $atts) {
152
+ if ( strpos($message, '[default-message') === false &&
153
+ strpos($message, '[default_message') === false &&
154
+ !empty($message) ) {
155
+ return $message;
156
+ }
157
+
158
+ if ( empty($message) ) {
159
+ $message = '[default-message]';
160
+ }
161
+
162
+ preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
163
+
164
+ foreach ( $shortcodes[0] as $short_key => $tag ) {
165
+ $add_atts = shortcode_parse_atts( $shortcodes[2][$short_key] );
166
+ if ( $add_atts ){
167
+ $this_atts = array_merge($atts, $add_atts);
168
+ } else {
169
+ $this_atts = $atts;
170
+ }
171
+
172
+ $default = FrmEntriesController::show_entry_shortcode($this_atts);
173
+
174
+ // Add the default message
175
+ $message = str_replace($shortcodes[0][$short_key], $default, $message);
176
+ }
177
+
178
+ return $message;
179
+ }
180
+
181
+
182
 
183
  public static function entries_dropdown( $form_id, $field_name, $field_value='', $blank=true, $blank_label='', $onchange=false ){
184
  _deprecated_function( __FUNCTION__, '1.07.09');
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -357,23 +357,26 @@ DEFAULT_HTML;
357
  $selected = reset($field['value']);
358
  }else{
359
  $selected = $field['value'];
360
- }
361
 
362
  $args = array(
363
  'show_option_all' => $show_option_all, 'hierarchical' => 1, 'name' => $name,
364
  'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
365
  'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
366
- 'exclude_tree' => $exclude,
367
  );
368
 
369
  $args = apply_filters('frm_dropdown_cat', $args, $field);
370
 
371
- if(class_exists('FrmProFormsHelper')){
372
  $post_type = FrmProFormsHelper::post_type($field['form_id']);
373
  $args['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $field);
374
- if ( !$args['taxonomy'] ) {
375
  return;
376
  }
 
 
 
 
377
  }
378
 
379
  $dropdown = wp_dropdown_categories($args);
@@ -400,6 +403,21 @@ DEFAULT_HTML;
400
  return $dropdown;
401
  }
402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  public static function get_field_types($type){
404
  $frm_field_selection = FrmFieldsHelper::field_selection();
405
  $field_types = array();
357
  $selected = reset($field['value']);
358
  }else{
359
  $selected = $field['value'];
360
+ }
361
 
362
  $args = array(
363
  'show_option_all' => $show_option_all, 'hierarchical' => 1, 'name' => $name,
364
  'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
365
  'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
 
366
  );
367
 
368
  $args = apply_filters('frm_dropdown_cat', $args, $field);
369
 
370
+ if ( class_exists('FrmProFormsHelper') ) {
371
  $post_type = FrmProFormsHelper::post_type($field['form_id']);
372
  $args['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $field);
373
+ if ( ! $args['taxonomy'] ) {
374
  return;
375
  }
376
+
377
+ if ( is_taxonomy_hierarchical($args['taxonomy']) ) {
378
+ $args['exclude_tree'] = $exclude;
379
+ }
380
  }
381
 
382
  $dropdown = wp_dropdown_categories($args);
403
  return $dropdown;
404
  }
405
 
406
+ public static function get_term_link($tax_id) {
407
+ $tax = get_taxonomy($tax_id);
408
+ if ( !$tax ) {
409
+ return;
410
+ }
411
+
412
+ $link = sprintf(
413
+ __('Please add options from the WordPress "%1$s" page', 'formidable'),
414
+ '<a href="'. esc_url(admin_url('edit-tags.php?taxonomy='. $tax->name)) .'" target="_blank">'. ( empty($tax->labels->name) ? __('Categories') : $tax->labels->name ) .'</a>'
415
+ );
416
+ unset($tax);
417
+
418
+ return $link;
419
+ }
420
+
421
  public static function get_field_types($type){
422
  $frm_field_selection = FrmFieldsHelper::field_selection();
423
  $field_types = array();
classes/helpers/FrmFormsHelper.php CHANGED
@@ -12,7 +12,11 @@ class FrmFormsHelper{
12
  return $target_url;
13
  }
14
 
15
- public static function get_template_dropdown($templates){ ?>
 
 
 
 
16
  <select id="select_form" name="select_form" onChange="frmAddNewForm(this.value,'duplicate')">
17
  <option value="">&mdash; <?php _e('Create Form from Template', 'formidable') ?> &mdash;</option>
18
  <?php foreach ($templates as $temp){ ?>
@@ -247,7 +251,7 @@ BEFORE_HTML;
247
  $replace_with = $_GET['entry'];
248
  }
249
 
250
- if (($show == true || $show == 'true') && $replace_with != '' ){
251
  $html = str_replace('[if '.$code.']', '', $html);
252
  $html = str_replace('[/if '.$code.']', '', $html);
253
  }else{
12
  return $target_url;
13
  }
14
 
15
+ public static function get_template_dropdown($templates) {
16
+ if ( ! current_user_can('frm_edit_forms') ) {
17
+ return;
18
+ }
19
+ ?>
20
  <select id="select_form" name="select_form" onChange="frmAddNewForm(this.value,'duplicate')">
21
  <option value="">&mdash; <?php _e('Create Form from Template', 'formidable') ?> &mdash;</option>
22
  <?php foreach ($templates as $temp){ ?>
251
  $replace_with = $_GET['entry'];
252
  }
253
 
254
+ if ( FrmAppHelper::is_true($show) && $replace_with != '' ) {
255
  $html = str_replace('[if '.$code.']', '', $html);
256
  $html = str_replace('[/if '.$code.']', '', $html);
257
  }else{
classes/helpers/FrmListHelper.php CHANGED
@@ -53,13 +53,16 @@ class FrmListHelper extends WP_List_Table {
53
  $s_query = " (status is NULL OR status = '' OR status = 'published') AND default_template=0 AND is_template = ". (int)$this->params['template'];
54
 
55
  if($s != ''){
56
- foreach((array)$search_terms as $term){
57
- $term = esc_sql( like_escape( $term ) );
58
- if(!empty($s_query))
59
  $s_query .= " AND";
60
-
61
- $s_query .= " (name like '%$term%' OR description like '%$term%' OR created_at like '%$term%')";
62
- unset($term);
 
 
 
 
63
  }
64
  }
65
 
@@ -89,7 +92,10 @@ class FrmListHelper extends WP_List_Table {
89
  }
90
 
91
  function get_bulk_actions(){
92
- $actions = array('bulk_delete' => __('Delete'));
 
 
 
93
 
94
  return $actions;
95
  }
@@ -110,22 +116,20 @@ class FrmListHelper extends WP_List_Table {
110
  $actions = array();
111
  $title = esc_attr(strip_tags($item->name));
112
 
113
- $edit_link = "?page=formidable&frm_action=edit&id={$item->id}";
114
- $actions['frm_edit'] = "<a href='" . wp_nonce_url( $edit_link ) . "'>". __('Edit') ."</a>";
115
-
116
- $duplicate_link = "?page=formidable&frm_action=duplicate&id={$item->id}";
117
-
118
- $view_link = "?page=formidable-{$this->page_name}&frm_action=show&id={$item->id}";
119
-
120
-
121
- if ($this->params['template']){
122
- $actions['frm_duplicate'] = "<a href='" . wp_nonce_url( $duplicate_link ) . "'>". __('Create Form from Template', 'formidable') ."</a>";
123
- }else{
124
- if(current_user_can('frm_edit_forms')){
125
  $actions['frm_settings'] = "<a href='" . wp_nonce_url( "?page=formidable&frm_action=settings&id={$item->id}" ) . "'>". __('Settings', 'formidable') ."</a>";
126
 
127
- if($frm_vars['pro_is_installed'])
128
  $actions['duplicate'] = '<a href="' . wp_nonce_url( $duplicate_link ) . '">'. __('Duplicate', 'formidable') .'</a>';
 
129
  }
130
  }
131
 
@@ -193,7 +197,9 @@ class FrmListHelper extends WP_List_Table {
193
  if($frm_vars['pro_is_installed'] and current_user_can('frm_create_entries'))
194
  $links[] = '<a href="'. wp_nonce_url( "?page=formidable-entries&frm_action=new&form={$item->id}" ) .'" class="frm_add_entry_icon frm_icon_font frm_bstooltip" title="'. __('Add Entry', 'formidable'). '" data-toggle="tooltip"> </a>';
195
 
196
- $links[] = '<a href="' . wp_nonce_url( "?page=formidable&frm_action=duplicate&id={$item->id}&template=1" ) .'" class="frm_icon_font frm_new_template_icon frm_bstooltip" title="'. __('Create template from form', 'formidable') .'" data-toggle="tooltip"> </a>';
 
 
197
 
198
  $val = implode(' ', $links);
199
  break;
@@ -205,7 +211,7 @@ class FrmListHelper extends WP_List_Table {
205
  if(isset($val)){
206
  $r .= "<td $attributes>";
207
  if($column_name == $action_col){
208
- $r .= '<a class="row-title" href="'. (isset($actions['frm_edit']) ? $edit_link : $view_link) .'">'. $val .'</a> ';
209
  $r .= $action_links;
210
  }else{
211
  $r .= $val;
53
  $s_query = " (status is NULL OR status = '' OR status = 'published') AND default_template=0 AND is_template = ". (int)$this->params['template'];
54
 
55
  if($s != ''){
56
+ foreach ( (array) $search_terms as $term ) {
57
+ if ( !empty($s_query) ) {
 
58
  $s_query .= " AND";
59
+ }
60
+
61
+ $term = FrmAppHelper::esc_like($term);
62
+
63
+ $s_query .= $wpdb->prepare(" (name like %s OR description like %s OR created_at like %s)", '%'. $term .'%', '%'. $term .'%', '%'. $term .'%');
64
+
65
+ unset($term);
66
  }
67
  }
68
 
92
  }
93
 
94
  function get_bulk_actions(){
95
+ $actions = array();
96
+ if ( current_user_can('frm_delete_forms') ) {
97
+ $actions['bulk_delete'] = __('Delete');
98
+ }
99
 
100
  return $actions;
101
  }
116
  $actions = array();
117
  $title = esc_attr(strip_tags($item->name));
118
 
119
+ if ( current_user_can('frm_edit_forms') ) {
120
+ $edit_link = "?page=formidable&frm_action=edit&id={$item->id}";
121
+ $duplicate_link = "?page=formidable&frm_action=duplicate&id={$item->id}";
122
+
123
+ $actions['frm_edit'] = "<a href='" . esc_url( $edit_link ) . "'>". __('Edit') ."</a>";
124
+
125
+ if ( $this->params['template'] ) {
126
+ $actions['frm_duplicate'] = "<a href='" . wp_nonce_url( $duplicate_link ) . "'>". __('Create Form from Template', 'formidable') ."</a>";
127
+ } else {
 
 
 
128
  $actions['frm_settings'] = "<a href='" . wp_nonce_url( "?page=formidable&frm_action=settings&id={$item->id}" ) . "'>". __('Settings', 'formidable') ."</a>";
129
 
130
+ if ( $frm_vars['pro_is_installed'] ) {
131
  $actions['duplicate'] = '<a href="' . wp_nonce_url( $duplicate_link ) . '">'. __('Duplicate', 'formidable') .'</a>';
132
+ }
133
  }
134
  }
135
 
197
  if($frm_vars['pro_is_installed'] and current_user_can('frm_create_entries'))
198
  $links[] = '<a href="'. wp_nonce_url( "?page=formidable-entries&frm_action=new&form={$item->id}" ) .'" class="frm_add_entry_icon frm_icon_font frm_bstooltip" title="'. __('Add Entry', 'formidable'). '" data-toggle="tooltip"> </a>';
199
 
200
+ if ( current_user_can('frm_edit_forms') ){
201
+ $links[] = '<a href="' . wp_nonce_url( "?page=formidable&frm_action=duplicate&id={$item->id}&template=1" ) .'" class="frm_icon_font frm_new_template_icon frm_bstooltip" title="'. __('Create template from form', 'formidable') .'" data-toggle="tooltip"> </a>';
202
+ }
203
 
204
  $val = implode(' ', $links);
205
  break;
211
  if(isset($val)){
212
  $r .= "<td $attributes>";
213
  if($column_name == $action_col){
214
+ $r .= '<a class="row-title" href="'. ( isset($actions['frm_edit']) ? $edit_link : FrmFormsHelper::get_direct_link($item->form_key, $item) ) .'">'. $val .'</a> ';
215
  $r .= $action_links;
216
  }else{
217
  $r .= $val;
classes/models/FrmDb.php CHANGED
@@ -60,6 +60,7 @@ class FrmDb{
60
  form_key varchar(255) default NULL,
61
  name varchar(255) default NULL,
62
  description text default NULL,
 
63
  logged_in tinyint(1) default NULL,
64
  editable tinyint(1) default NULL,
65
  is_template tinyint(1) default 0,
60
  form_key varchar(255) default NULL,
61
  name varchar(255) default NULL,
62
  description text default NULL,
63
+ parent_form_id int(11) default NULL,
64
  logged_in tinyint(1) default NULL,
65
  editable tinyint(1) default NULL,
66
  is_template tinyint(1) default 0,
classes/models/FrmEntry.php CHANGED
@@ -341,7 +341,7 @@ class FrmEntry{
341
 
342
  $errors = array();
343
 
344
- if ( !isset($values['frm_submit_entry']) || !wp_verify_nonce($values['frm_submit_entry'], 'frm_submit_entry_nonce') ) {
345
  $errors['form'] = __('You do not have permission to do that', 'formidable');
346
  }
347
 
@@ -356,10 +356,10 @@ class FrmEntry{
356
 
357
  $where = apply_filters('frm_posted_field_ids', 'fi.form_id='. (int)$values['form_id']);
358
  if($exclude)
359
- $where .= " and fi.type not in ('". implode("','", $exclude) ."')";
360
 
361
  $posted_fields = $frm_field->getAll($where, 'field_order');
362
-
363
  foreach($posted_fields as $posted_field){
364
  $posted_field->field_options = maybe_unserialize($posted_field->field_options);
365
  $value = '';
@@ -462,9 +462,7 @@ class FrmEntry{
462
 
463
  //Check entries for spam -- returns true if is spam
464
  function akismet($values) {
465
- global $akismet_api_host, $akismet_api_port;
466
-
467
- $content = FrmEntriesHelper::entry_array_to_string($values);
468
 
469
  if ( empty($content) ) {
470
  return false;
@@ -481,17 +479,26 @@ class FrmEntry{
481
 
482
  $datas['comment_content'] = $content;
483
 
484
- foreach ( $_SERVER as $key => $value )
485
- if ( !in_array($key, array('HTTP_COOKIE', 'argv')) )
486
  $datas["$key"] = $value;
 
 
 
 
 
 
487
 
488
  $query_string = '';
489
- foreach ( $datas as $key => $data )
490
  $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
 
 
491
 
492
  if ( is_callable('Akismet::http_post') ) {
493
- $response = Akismet::http_post($query_string, 'comment-check', $akismet_api_port);
494
  } else {
 
495
  $response = akismet_http_post( $query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port );
496
  }
497
 
341
 
342
  $errors = array();
343
 
344
+ if ( is_admin() && is_user_logged_in() && (!isset($values['frm_submit_entry']) || !wp_verify_nonce($values['frm_submit_entry'], 'frm_submit_entry_nonce')) ) {
345
  $errors['form'] = __('You do not have permission to do that', 'formidable');
346
  }
347
 
356
 
357
  $where = apply_filters('frm_posted_field_ids', 'fi.form_id='. (int)$values['form_id']);
358
  if($exclude)
359
+ $where .= " and fi.type not in ('". implode("','", array_filter($exclude, 'esc_sql')) ."')";
360
 
361
  $posted_fields = $frm_field->getAll($where, 'field_order');
362
+
363
  foreach($posted_fields as $posted_field){
364
  $posted_field->field_options = maybe_unserialize($posted_field->field_options);
365
  $value = '';
462
 
463
  //Check entries for spam -- returns true if is spam
464
  function akismet($values) {
465
+ $content = FrmEntriesHelper::entry_array_to_string($values);
 
 
466
 
467
  if ( empty($content) ) {
468
  return false;
479
 
480
  $datas['comment_content'] = $content;
481
 
482
+ foreach ( $_SERVER as $key => $value ) {
483
+ if ( !in_array($key, array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW')) && is_string($value) ) {
484
  $datas["$key"] = $value;
485
+ } else {
486
+ $datas["$key"] = '';
487
+ }
488
+
489
+ unset($key, $value);
490
+ }
491
 
492
  $query_string = '';
493
+ foreach ( $datas as $key => $data ) {
494
  $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
495
+ unset($key, $data);
496
+ }
497
 
498
  if ( is_callable('Akismet::http_post') ) {
499
+ $response = Akismet::http_post($query_string, 'comment-check');
500
  } else {
501
+ global $akismet_api_host, $akismet_api_port;
502
  $response = akismet_http_post( $query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port );
503
  }
504
 
classes/models/FrmEntryMeta.php CHANGED
@@ -105,7 +105,6 @@ class FrmEntryMeta{
105
  global $wpdb;
106
 
107
  $entry_id = (int)$entry_id;
108
- $field_id = (int)$field_id;
109
 
110
  $cached = wp_cache_get( $entry_id, 'frm_entry' );
111
  if($cached and isset($cached->metas) and isset($cached->metas[$field_id])){
105
  global $wpdb;
106
 
107
  $entry_id = (int)$entry_id;
 
108
 
109
  $cached = wp_cache_get( $entry_id, 'frm_entry' );
110
  if($cached and isset($cached->metas) and isset($cached->metas[$field_id])){
classes/models/FrmField.php CHANGED
@@ -218,9 +218,12 @@ class FrmField{
218
  $results[$r_key]->options = maybe_unserialize($result->options);
219
  $results[$r_key]->default_value = maybe_unserialize($result->default_value);
220
  $form_id = $result->form_id;
 
 
221
  }
222
  if(isset($save_cache))
223
  set_transient('frm_all_form_fields_'. $form_id, $results, 60*60*6);
 
224
  }else{
225
  wp_cache_set($results->id, $results, 'frm_field');
226
  wp_cache_set($results->field_key, $results, 'frm_field');
@@ -237,13 +240,18 @@ class FrmField{
237
 
238
  function getIds($where = '', $order_by = '', $limit = ''){
239
  global $wpdb;
 
 
 
 
 
240
  $query = "SELECT fi.id FROM {$wpdb->prefix}frm_fields fi " .
241
  "LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON fi.form_id=fr.id" .
242
  FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
243
  if ($limit == ' LIMIT 1' or $limit == 1)
244
- $results = $wpdb->get_row($query);
245
  else
246
- $results = $wpdb->get_results($query);
247
  return $results;
248
  }
249
  }
218
  $results[$r_key]->options = maybe_unserialize($result->options);
219
  $results[$r_key]->default_value = maybe_unserialize($result->default_value);
220
  $form_id = $result->form_id;
221
+
222
+ unset($r_key, $result);
223
  }
224
  if(isset($save_cache))
225
  set_transient('frm_all_form_fields_'. $form_id, $results, 60*60*6);
226
+ unset($form_id);
227
  }else{
228
  wp_cache_set($results->id, $results, 'frm_field');
229
  wp_cache_set($results->field_key, $results, 'frm_field');
240
 
241
  function getIds($where = '', $order_by = '', $limit = ''){
242
  global $wpdb;
243
+
244
+ if ( !empty($order_by) && !preg_match("/ORDER BY/", $order_by) ){
245
+ $order_by = ' ORDER BY '. $order_by;
246
+ }
247
+
248
  $query = "SELECT fi.id FROM {$wpdb->prefix}frm_fields fi " .
249
  "LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON fi.form_id=fr.id" .
250
  FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
251
  if ($limit == ' LIMIT 1' or $limit == 1)
252
+ $results = $wpdb->get_var($query);
253
  else
254
+ $results = $wpdb->get_col($query);
255
  return $results;
256
  }
257
  }
classes/models/FrmNotification.php CHANGED
@@ -54,21 +54,12 @@ class FrmNotification{
54
 
55
  // Set the email message
56
  $plain_text = (isset($notification['plain_text']) && $notification['plain_text']) ? true : false;
57
- $default = FrmEntriesController::show_entry_shortcode(array(
58
- 'id' => $entry->id, 'entry' => $entry, 'plain_text' => $plain_text,
59
- 'user_info' => (isset($notification['inc_user_info']) ? $notification['inc_user_info'] : false)
60
- ));
61
-
62
  $mail_body = isset($notification['email_message']) ? $notification['email_message'] : '';
63
 
64
- // Add the default message
65
- if ( strpos($mail_body, '[default-message]') !== false ) {
66
- $mail_body = str_replace('[default-message]', $default, $mail_body);
67
- } else {
68
- $mail_body = $default;
69
- }
70
-
71
- unset($default);
72
 
73
  // Set the subject
74
  $subject = isset($notification['email_subject']) ? $notification['email_subject'] : '';
54
 
55
  // Set the email message
56
  $plain_text = (isset($notification['plain_text']) && $notification['plain_text']) ? true : false;
 
 
 
 
 
57
  $mail_body = isset($notification['email_message']) ? $notification['email_message'] : '';
58
 
59
+ $mail_body = FrmEntriesHelper::replace_default_message($mail_body, array(
60
+ 'id' => $entry->id, 'entry' => $entry, 'plain_text' => $plain_text,
61
+ 'user_info' => (isset($notification['inc_user_info']) ? $notification['inc_user_info'] : false),
62
+ ) );
 
 
 
 
63
 
64
  // Set the subject
65
  $subject = isset($notification['email_subject']) ? $notification['email_subject'] : '';
classes/views/frm-entries/errors.php CHANGED
@@ -3,6 +3,7 @@ if (isset($message) && $message != ''){
3
  if(is_admin() and !defined('DOING_AJAX')){
4
  ?><div id="message" class="frm_message updated" style="padding:5px;"><?php echo $message ?></div><?php
5
  }else{
 
6
  echo $message;
7
  }
8
  }
3
  if(is_admin() and !defined('DOING_AJAX')){
4
  ?><div id="message" class="frm_message updated" style="padding:5px;"><?php echo $message ?></div><?php
5
  }else{
6
+ ?><script type="text/javascript">jQuery(document).ready(function($){frmScrollMsg(<?php echo $form->id ?>);})</script><?php
7
  echo $message;
8
  }
9
  }
classes/views/frm-entries/frm-entry.php CHANGED
@@ -34,8 +34,8 @@ if ( $params['action'] == 'create' && $params['posted_form_id'] == $form->id &&
34
  echo FrmAppController::footer_js('header');
35
  $frm_vars['css_loaded'] = true;
36
  }
37
- ?>
38
- <div class="frm_forms<?php echo ($values['custom_style']) ? ' with_frm_style' : ''; ?>" id="frm_form_<?php echo $form->id ?>_container"><?php echo $message ?></div>
39
  <?php
40
  }
41
  } else {
34
  echo FrmAppController::footer_js('header');
35
  $frm_vars['css_loaded'] = true;
36
  }
37
+ ?>
38
+ <div class="frm_forms<?php echo ($values['custom_style']) ? ' with_frm_style' : ''; ?>" id="frm_form_<?php echo $form->id ?>_container"><?php require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php') ?></div>
39
  <?php
40
  }
41
  } else {
classes/views/frm-fields/input.php CHANGED
@@ -1,24 +1,34 @@
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 esc_attr($field['value']) ?>" <?php do_action('frm_field_input_html', $field) ?>/>
3
-
4
  <?php }else if ($field['type'] == 'textarea'){ ?>
5
- <textarea name="<?php echo $field_name ?>" id="field_<?php echo $field['field_key'] ?>"<?php if($field['size']) echo ' cols="'. $field['size'].'"'; if($field['max']) echo ' rows="'. $field['max'] .'"'; ?> <?php do_action('frm_field_input_html', $field) ?>><?php echo FrmAppHelper::esc_textarea($field['value']) ?></textarea>
6
-
7
  <?php
8
 
9
  }else if ($field['type'] == 'radio'){
10
- if(isset($field['post_field']) and $field['post_field'] == 'post_category')
11
  do_action('frm_after_checkbox', array('field' => $field, 'field_name' => $field_name, 'type' => $field['type']));
12
- else{
13
- if (is_array($field['options'])){
14
- foreach($field['options'] as $opt_key => $opt){
15
- if(isset($atts) and isset($atts['opt']) and ($atts['opt'] != $opt_key)) continue;
16
- $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
17
- $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
 
 
18
  ?>
19
- <div class="<?php echo apply_filters('frm_radio_class', 'frm_radio', $field, $field_val)?>"><label for="field_<?php echo $field['id'] ?>-<?php echo $opt_key ?>"><input type="radio" name="<?php echo $field_name ?>" id="field_<?php echo $field['id'] ?>-<?php echo $opt_key ?>" value="<?php echo esc_attr($field_val) ?>" <?php echo (FrmAppHelper::check_selected($field['value'], $field_val)) ? 'checked="checked"' : ''; ?> <?php do_action('frm_field_input_html', $field) ?>/><?php if(!isset($atts) or !isset($atts['label']) or $atts['label']){ echo ' '. $opt; }
20
- ?></label></div>
21
- <?php }
 
 
 
 
 
 
 
 
 
 
22
  }
23
  }
24
 
@@ -46,19 +56,32 @@ if (FrmAppHelper::check_selected($field['value'], $field_val)) echo ' selected="
46
 
47
  if(isset($field['post_field']) and $field['post_field'] == 'post_category'){
48
  do_action('frm_after_checkbox', array('field' => $field, 'field_name' => $field_name, 'type' => $field['type']));
49
- }else{
50
- if($field['options']){
51
- foreach ($field['options'] as $opt_key => $opt){
52
- if(isset($atts) and isset($atts['opt']) and ($atts['opt'] != $opt_key)) continue;
 
 
53
  $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
54
  $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
55
- $checked = (FrmAppHelper::check_selected($checked_values, $field_val)) ? ' checked="checked"' : '';
 
56
  ?>
57
- <div class="<?php echo apply_filters('frm_checkbox_class', 'frm_checkbox', $field, $field_val)?>" id="frm_checkbox_<?php echo $field['id']?>-<?php echo $opt_key ?>" ><label for="field_<?php echo $field['id']?>-<?php echo $opt_key ?>"><input type="checkbox" name="<?php echo $field_name ?>[]" id="field_<?php echo $field['id']?>-<?php echo $opt_key ?>" value="<?php echo esc_attr($field_val) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?>/><?php if(!isset($atts) or !isset($atts['label']) or $atts['label']){ echo ' '. $opt; }
58
- ?></label></div>
 
 
 
 
 
 
 
 
 
 
 
59
  <?php
60
  }
61
- }
62
  }
63
 
64
  } else if ( $field['type'] == 'captcha' && (!is_admin() || defined('DOING_AJAX')) ) {
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 esc_attr($field['value']) ?>" <?php do_action('frm_field_input_html', $field) ?>/>
 
3
  <?php }else if ($field['type'] == 'textarea'){ ?>
4
+ <textarea name="<?php echo $field_name ?>" id="field_<?php echo $field['field_key'] ?>"<?php if($field['size']) echo ' cols="'. $field['size'].'"'; if($field['max']) echo ' rows="'. $field['max'] .'"'; ?> <?php do_action('frm_field_input_html', $field) ?>><?php echo FrmAppHelper::esc_textarea($field['value']) ?></textarea>
 
5
  <?php
6
 
7
  }else if ($field['type'] == 'radio'){
8
+ if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
9
  do_action('frm_after_checkbox', array('field' => $field, 'field_name' => $field_name, 'type' => $field['type']));
10
+ } else if ( is_array($field['options']) ) {
11
+ foreach ( $field['options'] as $opt_key => $opt ) {
12
+ if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) {
13
+ continue;
14
+ }
15
+
16
+ $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
17
+ $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
18
  ?>
19
+ <div class="<?php echo apply_filters('frm_radio_class', 'frm_radio', $field, $field_val)?>"><?php
20
+
21
+ if ( !isset($atts) || !isset($atts['label']) || $atts['label'] ) {
22
+ ?><label for="field_<?php echo $field['id'] ?>-<?php echo $opt_key ?>"><?php
23
+ }
24
+
25
+ ?><input type="radio" name="<?php echo $field_name ?>" id="field_<?php echo $field['id'] ?>-<?php echo $opt_key ?>" value="<?php echo esc_attr($field_val) ?>" <?php echo (FrmAppHelper::check_selected($field['value'], $field_val)) ? 'checked="checked"' : ''; ?> <?php do_action('frm_field_input_html', $field) ?>/><?php
26
+
27
+ if ( !isset($atts) || !isset($atts['label']) || $atts['label'] ) {
28
+ echo ' '. $opt .'</label>';
29
+ }
30
+ ?></div>
31
+ <?php
32
  }
33
  }
34
 
56
 
57
  if(isset($field['post_field']) and $field['post_field'] == 'post_category'){
58
  do_action('frm_after_checkbox', array('field' => $field, 'field_name' => $field_name, 'type' => $field['type']));
59
+ } else if ( $field['options'] ) {
60
+ foreach ( $field['options'] as $opt_key => $opt ) {
61
+ if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) {
62
+ continue;
63
+ }
64
+
65
  $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
66
  $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
67
+ $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
68
+
69
  ?>
70
+ <div class="<?php echo apply_filters('frm_checkbox_class', 'frm_checkbox', $field, $field_val) ?>" id="frm_checkbox_<?php echo $field['id']?>-<?php echo $opt_key ?>"><?php
71
+
72
+ if ( !isset($atts) || !isset($atts['label']) || $atts['label'] ) {
73
+ ?><label for="field_<?php echo $field['id'] ?>-<?php echo $opt_key ?>"><?php
74
+ }
75
+
76
+ ?><input type="checkbox" name="<?php echo $field_name ?>[]" id="field_<?php echo $field['id'] ?>-<?php echo $opt_key ?>" value="<?php echo esc_attr($field_val) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
77
+
78
+ if ( !isset($atts) || !isset($atts['label']) || $atts['label'] ) {
79
+ echo ' '. $opt .'</label>';
80
+ }
81
+
82
+ ?></div>
83
  <?php
84
  }
 
85
  }
86
 
87
  } else if ( $field['type'] == 'captcha' && (!is_admin() || defined('DOING_AJAX')) ) {
classes/views/frm-forms/add_field.php CHANGED
@@ -65,18 +65,26 @@ $display = apply_filters('frm_display_field_options', array(
65
  </div>
66
  <?php
67
  }
68
-
 
 
 
 
 
 
 
69
  ?>
70
- <div id="frm_add_field_<?php echo $field['id']; ?>" class="frm-show-click">
71
  <a href="javascript:frm_add_field_option(<?php echo $field['id']; ?>)" class="frm_orange frm_add_opt">+ <?php _e('Add an Option', 'formidable') ?></a>
72
 
73
- <?php if (!isset($field['post_field']) or $field['post_field'] != 'post_category'){ ?>
74
  <?php _e('or', 'formidable'); ?>
75
  <a title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '&quot;', $field['name']))), 20) . ' '. __('Field Choices', 'formidable'); ?>" href="<?php echo esc_url(admin_url('admin-ajax.php') .'?action=frm_import_choices&field_id='. $field['id'] .'&TB_iframe=1') ?>" class="thickbox frm_orange"><?php _e('Bulk Edit Field Choices', 'formidable') ?></a>
76
- <?php } ?>
77
  </div>
78
  <?php
79
-
 
 
 
80
  }else if ($field['type'] == 'select'){
81
  if(isset($field['post_field']) and $field['post_field'] == 'post_category'){
82
  echo FrmFieldsHelper::dropdown_categories(array('name' => $field_name, 'field' => $field) );
@@ -99,16 +107,20 @@ $display = apply_filters('frm_display_field_options', array(
99
  <?php } ?>
100
  <div class="clear"></div>
101
  <div class="frm-show-click" style="margin-top:5px;">
102
- <?php if(isset($field['post_field']) and $field['post_field'] == 'post_category'){ ?>
103
- <p class="howto"><?php _e('Please add options from the WordPress "Categories" page', 'formidable') ?></p>
104
- <?php }else if(!isset($field['post_field']) or $field['post_field'] != 'post_status'){ ?>
 
 
105
  <div id="frm_field_<?php echo $field['id'] ?>_opts"<?php echo (count($field['options']) > 10) ? ' class="frm_field_opts_list"' : ''; ?>>
106
  <?php do_action('frm_add_multiple_opts_labels', $field); ?>
107
- <?php foreach ($field['options'] as $opt_key => $opt){
108
- $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
109
- $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
110
- require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
111
- }
 
 
112
  ?>
113
  </div>
114
  <div id="frm_add_field_<?php echo $field['id']; ?>">
@@ -119,13 +131,14 @@ $display = apply_filters('frm_display_field_options', array(
119
  <a title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '&quot;', $field['name']))), 20) . ' '. __('Field Choices', 'formidable'); ?>" href="<?php echo esc_url(admin_url('admin-ajax.php') .'?action=frm_import_choices&field_id='. $field['id'] .'&TB_iframe=1') ?>" class="thickbox frm_orange"><?php _e('Bulk Edit Field Choices', 'formidable') ?></a>
120
  <?php } ?>
121
  </div>
122
- <?php } ?>
 
123
  </div>
124
  <?php
125
  }else if ($field['type'] == 'captcha'){
126
  ?>
127
- <img src="<?php echo FrmAppHelper::plugin_url() ?>/images/<?php echo $frm_settings->re_theme ?>-captcha.png" alt="captcha" class="alignleft"/>
128
- <span class="howto"><?php printf(__('Hint: Change colors in the %1$sFormidable settings', 'formidable'), '<a href="?page=formidable-settings">') ?></a></span>
129
  <div class="clear"></div>
130
  <?php if (empty($frm_settings->pubkey)){ ?>
131
  <div class="howto" style="font-weight:bold;color:red;"><?php printf(__('Your captcha will not appear on your form until you %1$sset up%2$s the Public and Private Keys', 'formidable'), '<a href="?page=formidable-settings">', '</a>') ?></div>
65
  </div>
66
  <?php
67
  }
68
+ ?>
69
+
70
+ <div class="frm-show-click" style="margin-top:5px;">
71
+ <?php
72
+
73
+ if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
74
+ echo '<p class="howto">'. FrmFieldsHelper::get_term_link($field['taxonomy']) .'</p>';
75
+ } else if ( !isset($field['post_field']) || $field['post_field'] != 'post_status' ) {
76
  ?>
77
+ <div id="frm_add_field_<?php echo $field['id']; ?>">
78
  <a href="javascript:frm_add_field_option(<?php echo $field['id']; ?>)" class="frm_orange frm_add_opt">+ <?php _e('Add an Option', 'formidable') ?></a>
79
 
 
80
  <?php _e('or', 'formidable'); ?>
81
  <a title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '&quot;', $field['name']))), 20) . ' '. __('Field Choices', 'formidable'); ?>" href="<?php echo esc_url(admin_url('admin-ajax.php') .'?action=frm_import_choices&field_id='. $field['id'] .'&TB_iframe=1') ?>" class="thickbox frm_orange"><?php _e('Bulk Edit Field Choices', 'formidable') ?></a>
 
82
  </div>
83
  <?php
84
+ }
85
+ ?>
86
+ </div>
87
+ <?php
88
  }else if ($field['type'] == 'select'){
89
  if(isset($field['post_field']) and $field['post_field'] == 'post_category'){
90
  echo FrmFieldsHelper::dropdown_categories(array('name' => $field_name, 'field' => $field) );
107
  <?php } ?>
108
  <div class="clear"></div>
109
  <div class="frm-show-click" style="margin-top:5px;">
110
+ <?php
111
+
112
+ if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
113
+ echo '<p class="howto">'. FrmFieldsHelper::get_term_link($field['taxonomy']) .'</p>';
114
+ } else if ( !isset($field['post_field']) || $field['post_field'] != 'post_status' ) { ?>
115
  <div id="frm_field_<?php echo $field['id'] ?>_opts"<?php echo (count($field['options']) > 10) ? ' class="frm_field_opts_list"' : ''; ?>>
116
  <?php do_action('frm_add_multiple_opts_labels', $field); ?>
117
+ <?php
118
+
119
+ foreach ( $field['options'] as $opt_key => $opt ) {
120
+ $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
121
+ $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
122
+ require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
123
+ }
124
  ?>
125
  </div>
126
  <div id="frm_add_field_<?php echo $field['id']; ?>">
131
  <a title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '&quot;', $field['name']))), 20) . ' '. __('Field Choices', 'formidable'); ?>" href="<?php echo esc_url(admin_url('admin-ajax.php') .'?action=frm_import_choices&field_id='. $field['id'] .'&TB_iframe=1') ?>" class="thickbox frm_orange"><?php _e('Bulk Edit Field Choices', 'formidable') ?></a>
132
  <?php } ?>
133
  </div>
134
+ <?php
135
+ } ?>
136
  </div>
137
  <?php
138
  }else if ($field['type'] == 'captcha'){
139
  ?>
140
+ <img src="<?php echo FrmAppHelper::plugin_url() ?>/images/<?php echo $frm_settings->re_theme ?>-captcha.png" alt="captcha" />
141
+ <p class="howto" style="margin-top:0;"><?php printf(__('Hint: Change colors in the %1$sFormidable settings', 'formidable'), '<a href="?page=formidable-settings">') ?></a></p>
142
  <div class="clear"></div>
143
  <?php if (empty($frm_settings->pubkey)){ ?>
144
  <div class="howto" style="font-weight:bold;color:red;"><?php printf(__('Your captcha will not appear on your form until you %1$sset up%2$s the Public and Private Keys', 'formidable'), '<a href="?page=formidable-settings">', '</a>') ?></div>
classes/views/frm-forms/edit.php CHANGED
@@ -1,11 +1,12 @@
1
  <div class="wrap">
2
  <div class="frmicon icon32"><br/></div>
3
- <h2><?php echo (($values['is_template']) ? __('Templates', 'formidable') : __('Build', 'formidable')); ?>
4
  <a href="?page=formidable&amp;frm_action=new-selection" class="add-new-h2"><?php _e('Add New', 'formidable'); ?></a>
5
  </h2>
6
  <?php
7
- if (!$values['is_template'])
8
  FrmAppController::get_form_nav($id, true);
 
9
  require(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php');
10
 
11
  if(version_compare( $GLOBALS['wp_version'], '3.3.3', '<')){ ?>
@@ -18,12 +19,12 @@
18
 
19
  <div id="post-body" class="metabox-holder columns-2">
20
  <div id="post-body-content">
21
- <div class="frm_form_builder<?php echo ($values['custom_style']) ? ' with_frm_style' : ''; ?>">
22
 
23
  <p style="margin-top:0;">
24
- <input type="button" onclick="frmSubmit<?php echo (isset($values['ajax_load']) and $values['ajax_load']) ? 'Build' : 'NoAjax'; ?>(this)" value="<?php _e('Update', 'formidable') ?>" class="button-primary" />
25
  <?php _e('or', 'formidable') ?>
26
- <a class="button-secondary cancel" href="?page=formidable<?php echo ($values['is_template']) ? '-templates' : ''; ?>"><?php _e('Cancel', 'formidable') ?></a>
27
  <span class="frm-loading-img"></span>
28
  </p>
29
 
@@ -35,9 +36,9 @@
35
  <?php require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/form.php'); ?>
36
 
37
  <p>
38
- <input type="button" onclick="frmSubmit<?php echo (isset($values['ajax_load']) and $values['ajax_load']) ? 'Build' : 'NoAjax'; ?>(this)" value="<?php _e('Update', 'formidable') ?>" class="button-primary" />
39
  <?php _e('or', 'formidable') ?>
40
- <a class="button-secondary cancel" href="?page=formidable<?php echo ($values['is_template']) ? '-templates' : ''; ?>"><?php _e('Cancel', 'formidable') ?></a>
41
  <span class="frm-loading-img"></span>
42
  </p>
43
  </form>
1
  <div class="wrap">
2
  <div class="frmicon icon32"><br/></div>
3
+ <h2><?php echo ( $form->is_template ? __('Templates', 'formidable') : __('Build', 'formidable')); ?>
4
  <a href="?page=formidable&amp;frm_action=new-selection" class="add-new-h2"><?php _e('Add New', 'formidable'); ?></a>
5
  </h2>
6
  <?php
7
+ if ( ! $form->is_template ) {
8
  FrmAppController::get_form_nav($id, true);
9
+ }
10
  require(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php');
11
 
12
  if(version_compare( $GLOBALS['wp_version'], '3.3.3', '<')){ ?>
19
 
20
  <div id="post-body" class="metabox-holder columns-2">
21
  <div id="post-body-content">
22
+ <div class="frm_form_builder<?php echo (isset($form->options['custom_style']) && $form->options['custom_style']) ? ' with_frm_style' : ''; ?>">
23
 
24
  <p style="margin-top:0;">
25
+ <input type="button" onclick="frmSubmit<?php echo (isset($form->options['ajax_load']) && $form->options['ajax_load']) ? 'Build' : 'NoAjax'; ?>(this)" value="<?php _e('Update', 'formidable') ?>" class="button-primary" />
26
  <?php _e('or', 'formidable') ?>
27
+ <a class="button-secondary cancel" href="?page=formidable<?php echo ($form->is_template) ? '-templates' : ''; ?>"><?php _e('Cancel', 'formidable') ?></a>
28
  <span class="frm-loading-img"></span>
29
  </p>
30
 
36
  <?php require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/form.php'); ?>
37
 
38
  <p>
39
+ <input type="button" onclick="frmSubmit<?php echo (isset($form->options['ajax_load']) && $form->options['ajax_load']) ? 'Build' : 'NoAjax'; ?>(this)" value="<?php _e('Update', 'formidable') ?>" class="button-primary" />
40
  <?php _e('or', 'formidable') ?>
41
+ <a class="button-secondary cancel" href="?page=formidable<?php echo $form->is_template ? '-templates' : ''; ?>"><?php _e('Cancel', 'formidable') ?></a>
42
  <span class="frm-loading-img"></span>
43
  </p>
44
  </form>
classes/views/frm-forms/form.php CHANGED
@@ -2,19 +2,19 @@
2
 
3
  <div id="frm_form_editor_container">
4
  <div id="titlediv">
5
- <input type="text" name="name" value="<?php echo esc_attr($values['name']); ?>" id="title" placeholder="<?php esc_attr_e('Enter title here') ?>" />
6
  <div id="edit-slug-box" class="hide-if-no-js">
7
  <div class="alignright" style="width:13em;max-width:30%">
8
  <strong><?php _e('Form Key:', 'formidable') ?></strong>
9
- <div id="editable-post-name" class="frm_ipe_form_key" title="<?php _e('Click to edit.', 'formidable') ?>"><?php echo $values['form_key']; ?></div>
10
  </div>
11
- <div class="frm_ipe_form_desc alignleft" style="width:70%"><?php echo ($values['description'] == '') ? __('(Click here to add a description or instructions)', 'formidable') : force_balance_tags($values['description']); ?></div>
12
  <div style="clear:both"></div>
13
  </div>
14
  </div>
15
 
16
  <div <?php echo version_compare( $GLOBALS['wp_version'], '3.7.2', '>') ? 'class="postbox"' : ''; ?>>
17
- <div class="frm_no_fields <?php echo ( isset($values['fields']) && !empty($values['fields']) ) ? 'frm_hidden' : ''; ?>">
18
  <div class="frm_brace">{</div>
19
  <div class="alignright frm_nofields_text">
20
  <div class="frm_all_field_inst"><?php _e('Add fields here', 'formidable') ?></div>
@@ -23,14 +23,13 @@
23
  </div>
24
  <ul id="new_fields" class="<?php echo version_compare( $GLOBALS['wp_version'], '3.7.2', '>') ? 'inside' : ''; ?>">
25
  <?php
26
- if (isset($values['fields']) and !empty($values['fields'])){
27
  $count = 0;
28
- foreach($values['fields'] as $field){
29
  $count++;
30
  $field_name = 'item_meta['. $field['id'] .']';
31
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/add_field.php');
32
- unset($field);
33
- unset($field_name);
34
  }
35
  unset($count);
36
  } ?>
2
 
3
  <div id="frm_form_editor_container">
4
  <div id="titlediv">
5
+ <input type="text" name="name" value="<?php echo esc_attr($form->name); ?>" id="title" placeholder="<?php esc_attr_e('Enter title here') ?>" />
6
  <div id="edit-slug-box" class="hide-if-no-js">
7
  <div class="alignright" style="width:13em;max-width:30%">
8
  <strong><?php _e('Form Key:', 'formidable') ?></strong>
9
+ <div id="editable-post-name" class="frm_ipe_form_key" title="<?php _e('Click to edit.', 'formidable') ?>"><?php echo $form->form_key; ?></div>
10
  </div>
11
+ <div class="frm_ipe_form_desc alignleft" style="width:70%"><?php echo ($form->description == '') ? __('(Click here to add a description or instructions)', 'formidable') : force_balance_tags($form->description); ?></div>
12
  <div style="clear:both"></div>
13
  </div>
14
  </div>
15
 
16
  <div <?php echo version_compare( $GLOBALS['wp_version'], '3.7.2', '>') ? 'class="postbox"' : ''; ?>>
17
+ <div class="frm_no_fields <?php echo ( isset($values['fields']) && ! empty($values['fields']) ) ? 'frm_hidden' : ''; ?>">
18
  <div class="frm_brace">{</div>
19
  <div class="alignright frm_nofields_text">
20
  <div class="frm_all_field_inst"><?php _e('Add fields here', 'formidable') ?></div>
23
  </div>
24
  <ul id="new_fields" class="<?php echo version_compare( $GLOBALS['wp_version'], '3.7.2', '>') ? 'inside' : ''; ?>">
25
  <?php
26
+ if ( isset($values['fields']) && ! empty($values['fields']) ) {
27
  $count = 0;
28
+ foreach ( $values['fields'] as $field ) {
29
  $count++;
30
  $field_name = 'item_meta['. $field['id'] .']';
31
  require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/add_field.php');
32
+ unset($field, $field_name);
 
33
  }
34
  unset($count);
35
  } ?>
classes/views/frm-forms/new-field-js.php CHANGED
@@ -1,6 +1 @@
1
- <script type="text/javascript">
2
- jQuery(document).ready(function($){
3
- $('select[name^="item_meta"], textarea[name^="item_meta"]').css('float','left');
4
- $('input[name^="item_meta"]').not(':radio, :checkbox').css('float','left');
5
- });
6
- </script>
1
+ <?php _deprecated_file( basename(__FILE__), '1.07.10', null, __( 'This file no longer needs to be included.' ) ); ?>
 
 
 
 
 
classes/views/frm-forms/new.php CHANGED
@@ -4,8 +4,9 @@
4
  <a href="?page=formidable-new" class="add-new-h2" style="visibility:hidden;"><?php _e('Add New', 'formidable'); ?></a>
5
  </h2>
6
  <?php
7
- if (!$values['is_template'])
8
  FrmAppController::get_form_nav($id, true);
 
9
  require(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php');
10
 
11
  if(version_compare( $GLOBALS['wp_version'], '3.3.3', '<')){ ?>
@@ -18,10 +19,10 @@
18
 
19
  <div id="post-body" class="metabox-holder columns-2">
20
  <div id="post-body-content">
21
- <div class="frm_form_builder<?php echo ($values['custom_style']) ? ' with_frm_style' : ''; ?>">
22
 
23
  <p style="margin-top:0;">
24
- <input type="button" onclick="frmSubmit<?php echo (isset($values['ajax_load']) and $values['ajax_load']) ? 'Build' : 'NoAjax'; ?>(this)" value="<?php _e('Create', 'formidable') ?>" class="button-primary" />
25
  <?php _e('or', 'formidable') ?>
26
  <a class="button-secondary cancel" href="?page=formidable&amp;frm_action=destroy&amp;id=<?php echo $id; ?>"><?php _e('Cancel', 'formidable') ?></a>
27
  <span class="frm-loading-img"></span>
@@ -35,7 +36,7 @@
35
  <?php require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/form.php'); ?>
36
 
37
  <p>
38
- <input type="button" onclick="frmSubmit<?php echo (isset($values['ajax_load']) and $values['ajax_load']) ? 'Build' : 'NoAjax'; ?>(this)" value="<?php _e('Create', 'formidable') ?>" class="button-primary" />
39
  <?php _e('or', 'formidable') ?>
40
  <a class="button-secondary cancel" href="?page=formidable&amp;frm_action=destroy&amp;id=<?php echo $id; ?>"><?php _e('Cancel', 'formidable') ?></a>
41
  <span class="frm-loading-img"></span>
4
  <a href="?page=formidable-new" class="add-new-h2" style="visibility:hidden;"><?php _e('Add New', 'formidable'); ?></a>
5
  </h2>
6
  <?php
7
+ if ( !$form->is_template ) {
8
  FrmAppController::get_form_nav($id, true);
9
+ }
10
  require(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php');
11
 
12
  if(version_compare( $GLOBALS['wp_version'], '3.3.3', '<')){ ?>
19
 
20
  <div id="post-body" class="metabox-holder columns-2">
21
  <div id="post-body-content">
22
+ <div class="frm_form_builder<?php echo (isset($form->options['custom_style']) && $form->options['custom_style']) ? ' with_frm_style' : ''; ?>">
23
 
24
  <p style="margin-top:0;">
25
+ <input type="button" onclick="frmSubmit<?php echo (isset($form->options['ajax_load']) && $form->options['ajax_load']) ? 'Build' : 'NoAjax'; ?>(this)" value="<?php _e('Create', 'formidable') ?>" class="button-primary" />
26
  <?php _e('or', 'formidable') ?>
27
  <a class="button-secondary cancel" href="?page=formidable&amp;frm_action=destroy&amp;id=<?php echo $id; ?>"><?php _e('Cancel', 'formidable') ?></a>
28
  <span class="frm-loading-img"></span>
36
  <?php require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/form.php'); ?>
37
 
38
  <p>
39
+ <input type="button" onclick="frmSubmit<?php echo (isset($form->options['ajax_load']) && $form->options['ajax_load']) ? 'Build' : 'NoAjax'; ?>(this)" value="<?php _e('Create', 'formidable') ?>" class="button-primary" />
40
  <?php _e('or', 'formidable') ?>
41
  <a class="button-secondary cancel" href="?page=formidable&amp;frm_action=destroy&amp;id=<?php echo $id; ?>"><?php _e('Cancel', 'formidable') ?></a>
42
  <span class="frm-loading-img"></span>
classes/views/frm-settings/form.php CHANGED
@@ -75,9 +75,11 @@
75
 
76
  <p><label class="frm_left_label"><?php _e('reCAPTCHA Theme', 'formidable') ?></label>
77
  <select name="frm_re_theme" id="frm_re_theme">
78
- <?php foreach(array('red' => __('Red', 'formidable'), 'white' => __('White', 'formidable'), 'blackglass' => __('Black Glass', 'formidable'), 'clean' => __('Clean', 'formidable')) as $theme_value => $theme_name){ ?>
79
  <option value="<?php echo esc_attr($theme_value) ?>" <?php selected($frm_settings->re_theme, $theme_value) ?>><?php echo $theme_name ?></option>
80
- <?php } ?>
 
 
81
  </select></p>
82
 
83
  <p><label class="frm_left_label"><?php _e('reCAPTCHA Language', 'formidable') ?></label>
@@ -151,7 +153,10 @@
151
  </div>
152
  <?php } ?>
153
 
154
- <p class="alignright frm_uninstall" style="padding-top:1.25em;"><a href="javascript:frm_uninstall_now()"><?php _e('Uninstall Formidable', 'formidable') ?></a></p>
 
 
 
155
  <p class="submit">
156
  <input class="button-primary" type="submit" value="<?php _e('Update Options', 'formidable') ?>" />
157
  </p>
75
 
76
  <p><label class="frm_left_label"><?php _e('reCAPTCHA Theme', 'formidable') ?></label>
77
  <select name="frm_re_theme" id="frm_re_theme">
78
+ <?php foreach($recaptcha_themes as $theme_value => $theme_name){ ?>
79
  <option value="<?php echo esc_attr($theme_value) ?>" <?php selected($frm_settings->re_theme, $theme_value) ?>><?php echo $theme_name ?></option>
80
+ <?php }
81
+ unset($recaptcha_themes, $theme_value, $theme_name);
82
+ ?>
83
  </select></p>
84
 
85
  <p><label class="frm_left_label"><?php _e('reCAPTCHA Language', 'formidable') ?></label>
153
  </div>
154
  <?php } ?>
155
 
156
+ <p class="alignright frm_uninstall" style="padding-top:1.25em;">
157
+ <a href="javascript:frm_uninstall_now()"><?php _e('Uninstall Formidable', 'formidable') ?></a>
158
+ <span class="spinner frm_spinner"></span>
159
+ </p>
160
  <p class="submit">
161
  <input class="button-primary" type="submit" value="<?php _e('Update Options', 'formidable') ?>" />
162
  </p>
classes/views/xml/import_form.php CHANGED
@@ -40,7 +40,7 @@
40
  <tr><td colspan="2"><input type="hidden" name="format" value="<?php echo key($export_format) ?>" /></td></tr>
41
  <?php } else { ?>
42
  <tr class="form-field">
43
- <th scope="row"><label><?php _e('Export Format', 'formidable'); ?></label></th>
44
  <td>
45
  <select name="format">
46
  <?php foreach ( $export_format as $t => $type ){ ?>
@@ -48,14 +48,22 @@
48
  <?php } ?>
49
  </select>
50
 
51
- <select name="csv_format" class="frm_hidden">
 
 
 
 
52
  <option value="UTF-8" <?php selected($csv_format, 'UTF-8') ?>>UTF-8</option>
53
  <option value="ISO-8859-1" <?php selected($csv_format, 'ISO-8859-1'); ?>>ISO-8859-1</option>
54
  <option value="windows-1256" <?php selected($csv_format, 'windows-1256'); ?>>windows-1256</option>
55
  <option value="windows-1251" <?php selected($csv_format, 'windows-1251'); ?>>windows-1251</option>
56
  <option value="macintosh" <?php selected($csv_format, 'macintosh'); ?>><?php _e('Macintosh', 'formidable') ?></option>
57
- </select>
58
- <span class="frm_help frm_icon_font frm_tooltip_icon frm_hidden" title="<?php _e('If your CSV special characters are not working correctly, try a different formatting option.', 'formidable') ?>"></span>
 
 
 
 
59
  </td>
60
  </tr>
61
  <?php } ?>
40
  <tr><td colspan="2"><input type="hidden" name="format" value="<?php echo key($export_format) ?>" /></td></tr>
41
  <?php } else { ?>
42
  <tr class="form-field">
43
+ <th scope="row"><label for="format"><?php _e('Export Format', 'formidable'); ?></label></th>
44
  <td>
45
  <select name="format">
46
  <?php foreach ( $export_format as $t => $type ){ ?>
48
  <?php } ?>
49
  </select>
50
 
51
+ <ul class="frm_hidden csv_opts export-filters">
52
+ <li>
53
+ <label for="csv_format"><?php _e('Format', 'formidable') ?>:</label>
54
+ <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php _e('If your CSV special characters are not working correctly, try a different formatting option.', 'formidable') ?>"></span>
55
+ <select name="csv_format">
56
  <option value="UTF-8" <?php selected($csv_format, 'UTF-8') ?>>UTF-8</option>
57
  <option value="ISO-8859-1" <?php selected($csv_format, 'ISO-8859-1'); ?>>ISO-8859-1</option>
58
  <option value="windows-1256" <?php selected($csv_format, 'windows-1256'); ?>>windows-1256</option>
59
  <option value="windows-1251" <?php selected($csv_format, 'windows-1251'); ?>>windows-1251</option>
60
  <option value="macintosh" <?php selected($csv_format, 'macintosh'); ?>><?php _e('Macintosh', 'formidable') ?></option>
61
+ </select>
62
+ </li>
63
+
64
+ <li><label for="csv_col_sep"><?php _e('Column separation', 'formidable') ?>:</label>
65
+ <input name="csv_col_sep" value="," type="text" style="width:45px;" /></li>
66
+ </ul>
67
  </td>
68
  </tr>
69
  <?php } ?>
css/frm_admin.css CHANGED
@@ -24,7 +24,11 @@ ul.frm_form_nav li{
24
  background-color:#EEE;
25
  }
26
  .frm_38_trigger .frm_form_nav a { background-color:#fff; }
27
- .frm_form_nav a:active, .frm_form_nav a:focus {outline:none;}
 
 
 
 
28
  .frm_form_nav li a.current_page {
29
  color:#333;
30
  font-weight:700;
@@ -61,11 +65,21 @@ ul.frm_form_nav li.last > a{
61
  .with_frm_style form label.frm_primary_label{font-size:12px;color:#444;font-weight:bold;text-align:left;margin:0;padding:0;width:auto;display:block;max-width:90%;min-height:20px;}
62
  form label.frm_primary_label input{font-size:12px;}
63
  .with_frm_style form .form-field{margin-bottom:20px;}
64
- .with_frm_style form div.description, .frm_error{margin:0;padding:0;font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif;font-size:11px;color:#666;font-weight:normal;text-align:left;font-style:normal;}
 
 
 
 
 
 
 
 
65
  .frm_error{color:#B94A48;}
66
  .with_frm_style form .frm_blank_field input, .with_frm_style form .frm_blank_field textarea, .with_frm_style form .frm_blank_field select, .with_frm_style form .frm_blank_field #recaptcha_area{border-color:#B94A48;}
67
  .with_frm_style form .frm_blank_field label{color:#B94A48;}
68
- .frm_required{color:#B94A48;font-weight:bold;}
 
 
69
  .form-field label.frm_primary_label{display:block;float:none;width:auto;}
70
  .with_frm_style .wp-editor-container textarea, .postbox .wp-editor-container textarea{border:none;}
71
  .with_frm_style .mceIframeContainer, .postbox .mceIframeContainer{background-color:#fff;}
@@ -119,10 +133,18 @@ form label.frm_primary_label input{font-size:12px;}
119
  .frm_scale{margin-right:10px;text-align:center;float:left;}
120
  .frm_scale input{display:block;margin-bottom:5px;}
121
  .frm_form_fields:not(.frm_sample_form) input, .frm_form_fields:not(.frm_sample_form) select, .frm_form_fields:not(.frm_sample_form) textarea{
122
- font-size:13px;margin-bottom:0;width:400px;max-width:100%;
 
 
 
123
  color:#222;
124
  background-color:#fafafa;
125
  border:solid 1px #dfdfdf;
 
 
 
 
 
126
  }
127
  .frm_form_fields textarea.wp-editor-area{width:100%;border:none;}
128
  .frm_form_fields input[type="file"], .frm_form_fields input[type="file"]:disabled{
@@ -140,7 +162,12 @@ form label.frm_primary_label input{font-size:12px;}
140
  .frm_form_fields textarea:focus, .frm_focus_field input{background-color:#fff;border-color:#ddd;}
141
 
142
  .frm_radio, .frm_checkbox{display:block;}
143
- .frm_radio label, .frm_checkbox label{font-family:Verdana,Arial,sans-serif;font-size:12px;color:#302c3f;font-weight:normal;display:inline;}
 
 
 
 
 
144
  .frm_radio input[type="radio"], .frm_checkbox input[type="checkbox"]{margin-right:5px;width:auto;}
145
  .wp-admin input[type="radio"], .wp-admin input[type="checkbox"]{width:auto;}
146
 
@@ -150,8 +177,19 @@ form label.frm_primary_label input{font-size:12px;}
150
  .frm_ext_sc{display:none;}