Version Description
- DROPPED PHP4 SUPPORT. Do not update if you run PHP4.
- Added the "create template" link into the free version
- Added quotes around the menu position number to minimize menu position conflicts with other plugins
- Moved all stripslashes to the point the data is retrieved from the database
- Switched the field options bulk edit to use the admin ajax url to minimize plugin conflicts
- Changed all occurrences of .live() to .on() for jQuery 1.9 compatibility
- PRO: Added AJAX form submit
- PRO: Dropped Open Flash Chart support due to security vulnerabilities
- PRO: Added multiple option to dropdown fields
- PRO: Added unique error message into global and field settings
- PRO: Added option to limit by ranges in the frm-stats shortcode. Ex: [frm-stats id=50 '-1 month'<45<'-3 days']
- PRO: Automatically strip javascript before displaying entries through a custom display
- PRO: Added striphtml=1 and keepjs=1 options for use in custom displays
- PRO: Added option to get the field description with [125 show="description"]
- PRO: Added separate value column on entries page
- PRO: Added link to delete entry only and leave post
- PRO: Added box for custom css in the styling settings
- PRO: Added buttons to insert default HTML or plain text for those who wish to modify the default message without starting from scratch
- PRO: Added link to uploaded files in the entry edit form
- PRO: Added "like" and "not like" options to the conditional logic for hiding and showing fields
- PRO: Switched section headings to use h3 tags by default instead of h2
- PRO: Migrated "Allow Only One Entry for Each" fields to the unique checkbox on each field
- PRO: Allow for multiple uses of frm-entry-update-field for the same field and entry
- PRO: Allow external short codes in the email recipients box
- PRO: Allow the frm-search shortcode to be used in text widgets
- PRO: Switched conditional fields to show and hide instead of fadeIn and fadeOut
- PRO: Switched rich text fields to default to TinyMCE
- PRO: Correctly send emails to [admin_email], and allow the same email address to receive multiple notifications from the same form
- PRO: Filter shortcodes in success message when the form is limited to one entry per user and editable
- PRO: Correctly show the taxonomy name even if it is not linked to a post
- PRO: Fixed read-only option to work with dropdown fields
- PRO: Fixed post password setting
- PRO: Fixed post content replacement when entry is updated instead of only on creation
- PRO: Fixed frm-stats shortcode to allow field keys when using the value option
- PRO: Fixed custom displays getting used if they are in the trash
- PRO: Fixed custom display pages to not include the unfiltered post content when there are no entries to display
- PRO: Fixed the bulk delete option showing for users without permission to delete in the bulk actions dropdown on the admin entry listing page
- PRO: Fixed the delete link in entry edit links shortcode to prevent it from going to a blank form when using the page_id param
- PRO: Fixed calendar to show the correct number of extra boxes when not starting on Sunday
- PRO: Fixed repeated, inline conditional logic in custom displays
- PRO: Fixed option to copy forms to other sites in multi-site installs, so they will no longer be copied when the box is unchecked
- PRO: Fixed admin-only fields to not validate for users who can't see the field
Download this release
Release Info
Developer | sswells |
Plugin | Formidable Forms – Form Builder for WordPress |
Version | 1.06.09 |
Comparing to | |
See all releases |
Code changes from version 1.06.08 to 1.06.09
- classes/controllers/FrmAppController.php +10 -10
- classes/controllers/FrmEntriesController.php +13 -11
- classes/controllers/FrmFieldsController.php +23 -8
- classes/controllers/FrmFormsController.php +1 -1
- classes/helpers/FrmAppHelper.php +57 -18
- classes/helpers/FrmEntriesHelper.php +16 -8
- classes/helpers/FrmFieldsHelper.php +32 -17
- classes/helpers/FrmFormsHelper.php +5 -5
- classes/helpers/FrmListHelper.php +4 -7
- classes/models/FrmEntry.php +8 -7
- classes/models/FrmEntryMeta.php +29 -5
- classes/models/FrmField.php +23 -15
- classes/models/FrmForm.php +14 -9
- classes/models/FrmSettings.php +65 -73
- classes/models/FrmUpdate.php +49 -7
- classes/views/frm-entries/errors.php +1 -1
- classes/views/frm-entries/form.php +6 -3
- classes/views/frm-entries/frm-entry.php +0 -1
- classes/views/frm-entries/list.php +1 -1
- classes/views/frm-entries/new.php +1 -1
- classes/views/frm-fields/import_choices.php +2 -6
- classes/views/frm-fields/input.php +7 -2
- classes/views/frm-forms/add_field.php +6 -4
- classes/views/frm-forms/default-templates.php +3 -3
- classes/views/frm-forms/list.php +19 -19
- classes/views/frm-forms/mb_insert_fields.php +1 -1
- classes/views/frm-forms/notification.php +1 -1
- classes/views/frm-forms/settings.php +10 -17
- classes/views/frm-forms/sidebar-settings.php +12 -1
- classes/views/frm-settings/form.php +18 -7
- classes/views/shared/mb_insert_fields.php +15 -4
- css/frm_admin.css +7 -6
- formidable.php +3 -2
- js/formidable.js +48 -24
- js/formidable_admin.js +190 -115
- languages/formidable-de_DE.mo +0 -0
- languages/formidable-de_DE.po +1075 -851
- languages/formidable-en_US.po +1072 -848
- languages/formidable-nl_NL.mo +0 -0
- languages/formidable-nl_NL.po +1076 -852
- languages/formidable-pl_PL.mo +0 -0
- languages/formidable-pl_PL.po +1039 -826
- languages/formidable-pt_BR.mo +0 -0
- languages/formidable-pt_BR.po +1073 -849
- readme.txt +46 -1
classes/controllers/FrmAppController.php
CHANGED
@@ -43,7 +43,7 @@ class FrmAppController{
|
|
43 |
}
|
44 |
|
45 |
$count = count(get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ));
|
46 |
-
$pos = ((int)$count > 0) ? 22.7 : 29.3;
|
47 |
$pos = apply_filters('frm_menu_position', $pos);
|
48 |
|
49 |
if(current_user_can('frm_view_forms')){
|
@@ -56,8 +56,7 @@ class FrmAppController{
|
|
56 |
}
|
57 |
|
58 |
function menu_css(){ ?>
|
59 |
-
<style type="text/css"
|
60 |
-
#adminmenu .toplevel_page_formidable div.wp-menu-image{background: url(<?php echo FRM_IMAGES_URL ?>/form_16.png) no-repeat center;}
|
61 |
</style>
|
62 |
<?php
|
63 |
//#adminmenu .toplevel_page_formidable:hover div.wp-menu-image{background: url(<?php echo FRM_IMAGES_URL /icon_16.png) no-repeat center;}
|
@@ -108,7 +107,7 @@ class FrmAppController{
|
|
108 |
global $frmpro_is_installed, $frm_db_version, $frm_ajax_url;
|
109 |
$db_version = get_option('frm_db_version');
|
110 |
$pro_db_version = ($frmpro_is_installed) ? get_option('frmpro_db_version') : false;
|
111 |
-
if(((int)$db_version < (int)$frm_db_version) or ($frmpro_is_installed and (int)$pro_db_version <
|
112 |
?>
|
113 |
<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="#" onclick="frm_install_now();return false;"><?php _e('Update Now', 'formidable') ?></a></div>
|
114 |
<script type="text/javascript">
|
@@ -151,8 +150,10 @@ success:function(msg){jQuery("#frm_install_message").fadeOut("slow");}
|
|
151 |
}else if($pagenow == 'post.php' or ($pagenow == 'post-new.php' and isset($_REQUEST['post_type']) and $_REQUEST['post_type'] == 'frm_display')){
|
152 |
if(isset($_REQUEST['post_type'])){
|
153 |
$post_type = $_REQUEST['post_type'];
|
154 |
-
}else if(isset($_REQUEST['post'])){
|
155 |
$post = get_post($_REQUEST['post']);
|
|
|
|
|
156 |
$post_type = $post->post_type;
|
157 |
}else{
|
158 |
return;
|
@@ -183,11 +184,12 @@ success:function(msg){jQuery("#frm_install_message").fadeOut("slow");}
|
|
183 |
//$frm_db_version is the version of the database we're moving to
|
184 |
$old_db_version = get_option('frm_db_version');
|
185 |
$pro_db_version = ($frmpro_is_installed) ? get_option('frmpro_db_version') : false;
|
186 |
-
if(((int)$old_db_version < (int)$frm_db_version) or ($frmpro_is_installed and (int)$pro_db_version <
|
187 |
$this->install($old_db_version);
|
188 |
}
|
189 |
|
190 |
wp_register_script('formidable', FRM_URL . '/js/formidable.js', array('jquery'), $frm_version, true);
|
|
|
191 |
wp_enqueue_script('jquery');
|
192 |
|
193 |
if(!is_admin() and $frm_settings->load_style == 'all'){
|
@@ -234,10 +236,8 @@ success:function(msg){jQuery("#frm_install_message").fadeOut("slow");}
|
|
234 |
}
|
235 |
}
|
236 |
|
237 |
-
if(!is_admin() and $location != 'header' and !empty($frm_forms_loaded))
|
238 |
-
|
239 |
-
$wp_scripts->do_items( array('formidable') );
|
240 |
-
}
|
241 |
}
|
242 |
|
243 |
function install($old_db_version=false){
|
43 |
}
|
44 |
|
45 |
$count = count(get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ));
|
46 |
+
$pos = ((int)$count > 0) ? '22.7' : '29.3';
|
47 |
$pos = apply_filters('frm_menu_position', $pos);
|
48 |
|
49 |
if(current_user_can('frm_view_forms')){
|
56 |
}
|
57 |
|
58 |
function menu_css(){ ?>
|
59 |
+
<style type="text/css">#adminmenu .toplevel_page_formidable div.wp-menu-image{background: url(<?php echo FRM_IMAGES_URL ?>/form_16.png) no-repeat center;}.menu-icon-frmdisplay .wp-menu-image img{display:none;}
|
|
|
60 |
</style>
|
61 |
<?php
|
62 |
//#adminmenu .toplevel_page_formidable:hover div.wp-menu-image{background: url(<?php echo FRM_IMAGES_URL /icon_16.png) no-repeat center;}
|
107 |
global $frmpro_is_installed, $frm_db_version, $frm_ajax_url;
|
108 |
$db_version = get_option('frm_db_version');
|
109 |
$pro_db_version = ($frmpro_is_installed) ? get_option('frmpro_db_version') : false;
|
110 |
+
if(((int)$db_version < (int)$frm_db_version) or ($frmpro_is_installed and (int)$pro_db_version < 17)){ //this number should match the db_version in FrmDb.php
|
111 |
?>
|
112 |
<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="#" onclick="frm_install_now();return false;"><?php _e('Update Now', 'formidable') ?></a></div>
|
113 |
<script type="text/javascript">
|
150 |
}else if($pagenow == 'post.php' or ($pagenow == 'post-new.php' and isset($_REQUEST['post_type']) and $_REQUEST['post_type'] == 'frm_display')){
|
151 |
if(isset($_REQUEST['post_type'])){
|
152 |
$post_type = $_REQUEST['post_type'];
|
153 |
+
}else if(isset($_REQUEST['post']) and !empty($_REQUEST['post'])){
|
154 |
$post = get_post($_REQUEST['post']);
|
155 |
+
if(!$post)
|
156 |
+
return;
|
157 |
$post_type = $post->post_type;
|
158 |
}else{
|
159 |
return;
|
184 |
//$frm_db_version is the version of the database we're moving to
|
185 |
$old_db_version = get_option('frm_db_version');
|
186 |
$pro_db_version = ($frmpro_is_installed) ? get_option('frmpro_db_version') : false;
|
187 |
+
if(((int)$old_db_version < (int)$frm_db_version) or ($frmpro_is_installed and (int)$pro_db_version < 17))
|
188 |
$this->install($old_db_version);
|
189 |
}
|
190 |
|
191 |
wp_register_script('formidable', FRM_URL . '/js/formidable.js', array('jquery'), $frm_version, true);
|
192 |
+
wp_register_script('recaptcha-ajax', 'http'. (is_ssl() ? 's' : '').'://www.google.com/recaptcha/api/js/recaptcha_ajax.js', '', true);
|
193 |
wp_enqueue_script('jquery');
|
194 |
|
195 |
if(!is_admin() and $frm_settings->load_style == 'all'){
|
236 |
}
|
237 |
}
|
238 |
|
239 |
+
if(!is_admin() and $location != 'header' and !empty($frm_forms_loaded)) //load formidable js
|
240 |
+
FrmAppHelper::load_scripts(array('formidable'));
|
|
|
|
|
241 |
}
|
242 |
|
243 |
function install($old_db_version=false){
|
classes/controllers/FrmEntriesController.php
CHANGED
@@ -7,8 +7,8 @@ class FrmEntriesController{
|
|
7 |
|
8 |
function FrmEntriesController(){
|
9 |
add_action('admin_menu', array( &$this, 'menu' ), 20);
|
10 |
-
add_action('wp', array(&$this, 'process_entry'));
|
11 |
-
add_action('frm_wp', array(&$this, 'process_entry'));
|
12 |
add_filter('frm_redirect_msg', array( &$this, 'delete_entry_before_redirect'), 50, 3);
|
13 |
add_filter('frm_redirect_url', array( &$this, 'delete_entry_before_wpredirect'), 50, 3);
|
14 |
add_action('frm_after_entry_processed', array(&$this, 'delete_entry_after_save'), 100);
|
@@ -54,7 +54,6 @@ class FrmEntriesController{
|
|
54 |
return do_shortcode($frm_settings->login_msg);
|
55 |
}
|
56 |
|
57 |
-
$form->options = stripslashes_deep(maybe_unserialize($form->options));
|
58 |
if($form->logged_in and $user_ID and isset($form->options['logged_in_role']) and $form->options['logged_in_role'] != ''){
|
59 |
if(FrmAppHelper::user_has_permission($form->options['logged_in_role'])){
|
60 |
return FrmEntriesController::get_form(FRM_VIEWS_PATH.'/frm-entries/frm-entry.php', $form, $title, $description);
|
@@ -77,7 +76,7 @@ class FrmEntriesController{
|
|
77 |
return false;
|
78 |
}
|
79 |
|
80 |
-
function process_entry(){
|
81 |
if(is_admin() or !isset($_POST) or !isset($_POST['form_id']) or !is_numeric($_POST['form_id']) or !isset($_POST['item_key']))
|
82 |
return;
|
83 |
|
@@ -98,13 +97,14 @@ class FrmEntriesController{
|
|
98 |
if(isset($frm_created_entry[$_POST['form_id']]))
|
99 |
return;
|
100 |
|
101 |
-
$errors
|
|
|
102 |
$frm_created_entry[$_POST['form_id']] = array('errors' => $errors);
|
103 |
|
104 |
if( empty($errors) ){
|
105 |
$_POST['frm_skip_cookie'] = 1;
|
106 |
if($params['action'] == 'create'){
|
107 |
-
if (apply_filters('frm_continue_to_create', true, $_POST['form_id']))
|
108 |
$frm_created_entry[$_POST['form_id']]['entry_id'] = $frm_entry->create( $_POST );
|
109 |
}
|
110 |
|
@@ -120,7 +120,8 @@ class FrmEntriesController{
|
|
120 |
}
|
121 |
|
122 |
function delete_entry_before_wpredirect($url, $form, $atts){
|
123 |
-
|
|
|
124 |
return $url;
|
125 |
}
|
126 |
|
@@ -140,21 +141,22 @@ class FrmEntriesController{
|
|
140 |
}
|
141 |
}
|
142 |
|
143 |
-
function &filter_email_value($value, $meta, $entry){
|
144 |
global $frm_field;
|
145 |
|
146 |
$field = $frm_field->getOne($meta->field_id);
|
147 |
if(!$field)
|
148 |
return $value;
|
149 |
|
150 |
-
$value = $this->filter_display_value($value, $field);
|
151 |
return $value;
|
152 |
}
|
153 |
|
154 |
-
function &filter_display_value($value, $field){
|
155 |
$field->field_options = maybe_unserialize($field->field_options);
|
156 |
|
157 |
-
|
|
|
158 |
return $value;
|
159 |
|
160 |
$field->options = maybe_unserialize($field->options);
|
7 |
|
8 |
function FrmEntriesController(){
|
9 |
add_action('admin_menu', array( &$this, 'menu' ), 20);
|
10 |
+
add_action('wp', array(&$this, 'process_entry'), 10, 0);
|
11 |
+
add_action('frm_wp', array(&$this, 'process_entry'), 10, 0);
|
12 |
add_filter('frm_redirect_msg', array( &$this, 'delete_entry_before_redirect'), 50, 3);
|
13 |
add_filter('frm_redirect_url', array( &$this, 'delete_entry_before_wpredirect'), 50, 3);
|
14 |
add_action('frm_after_entry_processed', array(&$this, 'delete_entry_after_save'), 100);
|
54 |
return do_shortcode($frm_settings->login_msg);
|
55 |
}
|
56 |
|
|
|
57 |
if($form->logged_in and $user_ID and isset($form->options['logged_in_role']) and $form->options['logged_in_role'] != ''){
|
58 |
if(FrmAppHelper::user_has_permission($form->options['logged_in_role'])){
|
59 |
return FrmEntriesController::get_form(FRM_VIEWS_PATH.'/frm-entries/frm-entry.php', $form, $title, $description);
|
76 |
return false;
|
77 |
}
|
78 |
|
79 |
+
function process_entry($errors=''){
|
80 |
if(is_admin() or !isset($_POST) or !isset($_POST['form_id']) or !is_numeric($_POST['form_id']) or !isset($_POST['item_key']))
|
81 |
return;
|
82 |
|
97 |
if(isset($frm_created_entry[$_POST['form_id']]))
|
98 |
return;
|
99 |
|
100 |
+
if($errors == '')
|
101 |
+
$errors = $frm_entry->validate($_POST);
|
102 |
$frm_created_entry[$_POST['form_id']] = array('errors' => $errors);
|
103 |
|
104 |
if( empty($errors) ){
|
105 |
$_POST['frm_skip_cookie'] = 1;
|
106 |
if($params['action'] == 'create'){
|
107 |
+
if (apply_filters('frm_continue_to_create', true, $_POST['form_id']) and !isset($frm_created_entry[$_POST['form_id']]['entry_id']))
|
108 |
$frm_created_entry[$_POST['form_id']]['entry_id'] = $frm_entry->create( $_POST );
|
109 |
}
|
110 |
|
120 |
}
|
121 |
|
122 |
function delete_entry_before_wpredirect($url, $form, $atts){
|
123 |
+
if(!defined('DOING_AJAX'))
|
124 |
+
$this->_delete_entry($atts['id'], $form);
|
125 |
return $url;
|
126 |
}
|
127 |
|
141 |
}
|
142 |
}
|
143 |
|
144 |
+
function &filter_email_value($value, $meta, $entry, $atts=array()){
|
145 |
global $frm_field;
|
146 |
|
147 |
$field = $frm_field->getOne($meta->field_id);
|
148 |
if(!$field)
|
149 |
return $value;
|
150 |
|
151 |
+
$value = $this->filter_display_value($value, $field, $atts);
|
152 |
return $value;
|
153 |
}
|
154 |
|
155 |
+
function &filter_display_value($value, $field, $atts=array()){
|
156 |
$field->field_options = maybe_unserialize($field->field_options);
|
157 |
|
158 |
+
$saved_value = (isset($atts['saved_value']) and $atts['saved_value']) ? true : false;
|
159 |
+
if(!in_array($field->type, array('radio', 'checkbox', 'radio', 'select')) or !isset($field->field_options['separate_value']) or !$field->field_options['separate_value'] or $saved_value)
|
160 |
return $value;
|
161 |
|
162 |
$field->options = maybe_unserialize($field->options);
|
classes/controllers/FrmFieldsController.php
CHANGED
@@ -15,6 +15,7 @@ class FrmFieldsController{
|
|
15 |
add_action('wp_ajax_frm_add_field_option', array(&$this, 'add_option'));
|
16 |
add_action('wp_ajax_frm_field_option_ipe', array(&$this, 'edit_option') );
|
17 |
add_action('wp_ajax_frm_delete_field_option', array(&$this, 'delete_option'));
|
|
|
18 |
add_action('wp_ajax_frm_import_options', array(&$this, 'import_options') );
|
19 |
add_action('wp_ajax_frm_update_field_order', array(&$this, 'update_order') );
|
20 |
add_filter('frm_field_type' ,array( &$this, 'change_type'));
|
@@ -100,9 +101,10 @@ class FrmFieldsController{
|
|
100 |
|
101 |
$values = array();
|
102 |
$values['field_key'] = FrmAppHelper::get_unique_key('', $frmdb->fields, 'field_key');
|
103 |
-
$values['
|
|
|
104 |
$values['form_id'] = $copy_field->form_id;
|
105 |
-
foreach (array('name', 'description', 'type', '
|
106 |
$values[$col] = $copy_field->{$col};
|
107 |
$field_count = $frm_app_helper->getRecordCount("form_id='$copy_field->form_id'", $frmdb->fields);
|
108 |
$values['field_order'] = $field_count + 1;
|
@@ -136,8 +138,15 @@ class FrmFieldsController{
|
|
136 |
$last = max(array_keys($options));
|
137 |
else
|
138 |
$last = 0;
|
|
|
139 |
$opt_key = $last + 1;
|
140 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
$field_val = $opt;
|
142 |
$options[$opt_key] = $opt;
|
143 |
$frm_field->update($id, array('options' => maybe_serialize($options)));
|
@@ -199,11 +208,19 @@ class FrmFieldsController{
|
|
199 |
die();
|
200 |
}
|
201 |
|
202 |
-
function import_choices(
|
203 |
if(!current_user_can('frm_edit_forms'))
|
204 |
return;
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
if(function_exists('register_admin_color_schemes'))
|
209 |
register_admin_color_schemes();
|
@@ -249,8 +266,6 @@ class FrmFieldsController{
|
|
249 |
);
|
250 |
|
251 |
$field = FrmField::getOne($field_id);
|
252 |
-
$field->options = stripslashes_deep(maybe_unserialize($field->options));
|
253 |
-
$field->field_options = maybe_unserialize($field->field_options);
|
254 |
|
255 |
include(FRM_VIEWS_PATH.'/frm-fields/import_choices.php');
|
256 |
die();
|
15 |
add_action('wp_ajax_frm_add_field_option', array(&$this, 'add_option'));
|
16 |
add_action('wp_ajax_frm_field_option_ipe', array(&$this, 'edit_option') );
|
17 |
add_action('wp_ajax_frm_delete_field_option', array(&$this, 'delete_option'));
|
18 |
+
add_action('wp_ajax_frm_import_choices', array(&$this, 'import_choices') );
|
19 |
add_action('wp_ajax_frm_import_options', array(&$this, 'import_options') );
|
20 |
add_action('wp_ajax_frm_update_field_order', array(&$this, 'update_order') );
|
21 |
add_filter('frm_field_type' ,array( &$this, 'change_type'));
|
101 |
|
102 |
$values = array();
|
103 |
$values['field_key'] = FrmAppHelper::get_unique_key('', $frmdb->fields, 'field_key');
|
104 |
+
$values['options'] = maybe_serialize($copy_field->options);
|
105 |
+
$values['default_value'] = maybe_serialize($copy_field->default_value);
|
106 |
$values['form_id'] = $copy_field->form_id;
|
107 |
+
foreach (array('name', 'description', 'type', 'field_options', 'required') as $col)
|
108 |
$values[$col] = $copy_field->{$col};
|
109 |
$field_count = $frm_app_helper->getRecordCount("form_id='$copy_field->form_id'", $frmdb->fields);
|
110 |
$values['field_order'] = $field_count + 1;
|
138 |
$last = max(array_keys($options));
|
139 |
else
|
140 |
$last = 0;
|
141 |
+
|
142 |
$opt_key = $last + 1;
|
143 |
+
$first_opt = reset($options);
|
144 |
+
$next_opt = count($options);
|
145 |
+
if($first_opt != '')
|
146 |
+
$next_opt++;
|
147 |
+
$opt = __('Option', 'formidable') .' '. $next_opt;
|
148 |
+
unset($next_opt);
|
149 |
+
|
150 |
$field_val = $opt;
|
151 |
$options[$opt_key] = $opt;
|
152 |
$frm_field->update($id, array('options' => maybe_serialize($options)));
|
208 |
die();
|
209 |
}
|
210 |
|
211 |
+
function import_choices(){
|
212 |
if(!current_user_can('frm_edit_forms'))
|
213 |
return;
|
214 |
+
|
215 |
+
$field_id = $_REQUEST['field_id'];
|
216 |
+
|
217 |
+
global $current_screen, $hook_suffix;
|
218 |
+
|
219 |
+
// Catch plugins that include admin-header.php before admin.php completes.
|
220 |
+
if (empty( $current_screen ) and function_exists('set_current_screen')){
|
221 |
+
$hook_suffix = '';
|
222 |
+
set_current_screen();
|
223 |
+
}
|
224 |
|
225 |
if(function_exists('register_admin_color_schemes'))
|
226 |
register_admin_color_schemes();
|
266 |
);
|
267 |
|
268 |
$field = FrmField::getOne($field_id);
|
|
|
|
|
269 |
|
270 |
include(FRM_VIEWS_PATH.'/frm-fields/import_choices.php');
|
271 |
die();
|
classes/controllers/FrmFormsController.php
CHANGED
@@ -388,7 +388,7 @@ class FrmFormsController{
|
|
388 |
}else{
|
389 |
$columns['entries'] = __('Entries', 'formidable');
|
390 |
$columns['link'] = __('Direct Link', 'formidable');
|
391 |
-
$columns['shortcode'] = __('
|
392 |
add_screen_option( 'per_page', array('label' => __('Forms', 'formidable'), 'default' => 20, 'option' => 'formidable_page_formidable_per_page') );
|
393 |
}
|
394 |
|
388 |
}else{
|
389 |
$columns['entries'] = __('Entries', 'formidable');
|
390 |
$columns['link'] = __('Direct Link', 'formidable');
|
391 |
+
$columns['shortcode'] = __('Shortcodes', 'formidable');
|
392 |
add_screen_option( 'per_page', array('label' => __('Forms', 'formidable'), 'default' => 20, 'option' => 'formidable_page_formidable_per_page') );
|
393 |
}
|
394 |
|
classes/helpers/FrmAppHelper.php
CHANGED
@@ -2,13 +2,19 @@
|
|
2 |
|
3 |
class FrmAppHelper{
|
4 |
|
5 |
-
function get_param($param, $default=''){
|
6 |
if(strpos($param, '[')){
|
7 |
$params = explode('[', $param);
|
8 |
$param = $params[0];
|
9 |
}
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
if(isset($params) and is_array($value) and !empty($value)){
|
14 |
foreach($params as $k => $p){
|
@@ -20,11 +26,33 @@ class FrmAppHelper{
|
|
20 |
}
|
21 |
}
|
22 |
|
23 |
-
return
|
24 |
}
|
25 |
|
26 |
function get_post_param($param, $default=''){
|
27 |
-
return isset($_POST[$param]) ? $_POST[$param] : $default;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
function get_pages(){
|
@@ -142,6 +170,11 @@ class FrmAppHelper{
|
|
142 |
return apply_filters( 'esc_textarea', $safe_text, $text );
|
143 |
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
145 |
function script_version($handle, $list='scripts'){
|
146 |
global $wp_scripts;
|
147 |
if(!$wp_scripts)
|
@@ -214,14 +247,13 @@ class FrmAppHelper{
|
|
214 |
$values['id'] = $record->id;
|
215 |
|
216 |
foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default_val)
|
217 |
-
$values[$var] =
|
218 |
if(apply_filters('frm_use_wpautop', true))
|
219 |
$values['description'] = wpautop($values['description']);
|
220 |
$values['fields'] = array();
|
221 |
|
222 |
if ($fields){
|
223 |
foreach($fields as $field){
|
224 |
-
$field->field_options = stripslashes_deep(maybe_unserialize($field->field_options));
|
225 |
|
226 |
if ($default){
|
227 |
$meta_value = $field->default_value;
|
@@ -238,19 +270,16 @@ class FrmAppHelper{
|
|
238 |
}
|
239 |
|
240 |
$field_type = isset($_POST['field_options']['type_'.$field->id]) ? $_POST['field_options']['type_'.$field->id] : $field->type;
|
241 |
-
$new_value = (isset($_POST['item_meta'][$field->id])) ? $_POST['item_meta'][$field->id] : $meta_value;
|
242 |
-
|
243 |
-
if(is_array($new_value))
|
244 |
-
$new_value = stripslashes_deep($new_value);
|
245 |
-
|
246 |
$field_array = array(
|
247 |
'id' => $field->id,
|
248 |
'value' => $new_value,
|
249 |
-
'default_value' =>
|
250 |
-
'name' =>
|
251 |
-
'description' =>
|
252 |
'type' => apply_filters('frm_field_type', $field_type, $field, $new_value),
|
253 |
-
'options' =>
|
254 |
'required' => $field->required,
|
255 |
'field_key' => $field->field_key,
|
256 |
'field_order' => $field->field_order,
|
@@ -269,7 +298,7 @@ class FrmAppHelper{
|
|
269 |
$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
|
270 |
|
271 |
foreach ($opt_defaults as $opt => $default_opt){
|
272 |
-
$field_array[$opt] = ($_POST and isset($_POST['field_options'][$opt.'_'.$field->id]) ) ? $_POST['field_options'][$opt.'_'.$field->id] : (isset($field->field_options[$opt]) ? $field->field_options[$opt] : $default_opt);
|
273 |
if($opt == 'blank' and $field_array[$opt] == ''){
|
274 |
$field_array[$opt] = $frm_settings->blank_msg;
|
275 |
}else if($opt == 'invalid' and $field_array[$opt] == ''){
|
@@ -288,7 +317,17 @@ class FrmAppHelper{
|
|
288 |
if ($field_array['size'] == '')
|
289 |
$field_array['size'] = $frm_sidebar_width;
|
290 |
|
291 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
unset($field);
|
293 |
}
|
294 |
}
|
@@ -483,7 +522,7 @@ class FrmAppHelper{
|
|
483 |
|
484 |
function truncate($str, $length, $minword = 3, $continue = '...'){
|
485 |
$length = (int)$length;
|
486 |
-
$str =
|
487 |
$original_len = (function_exists('mb_strlen')) ? mb_strlen($str) : strlen($str);
|
488 |
|
489 |
if($length == 0){
|
2 |
|
3 |
class FrmAppHelper{
|
4 |
|
5 |
+
function get_param($param, $default='', $src='get'){
|
6 |
if(strpos($param, '[')){
|
7 |
$params = explode('[', $param);
|
8 |
$param = $params[0];
|
9 |
}
|
10 |
|
11 |
+
if($src == 'get'){
|
12 |
+
$value = (isset($_POST[$param]) ? stripslashes_deep($_POST[$param]) : (isset($_GET[$param]) ? stripslashes_deep($_GET[$param]) : $default));
|
13 |
+
if(!isset($_POST[$param]) and isset($_GET[$param]) and !is_array($value))
|
14 |
+
$value = urldecode($value);
|
15 |
+
}else{
|
16 |
+
$value = isset($_POST[$param]) ? stripslashes_deep(maybe_unserialize($_POST[$param])) : $default;
|
17 |
+
}
|
18 |
|
19 |
if(isset($params) and is_array($value) and !empty($value)){
|
20 |
foreach($params as $k => $p){
|
26 |
}
|
27 |
}
|
28 |
|
29 |
+
return $value;
|
30 |
}
|
31 |
|
32 |
function get_post_param($param, $default=''){
|
33 |
+
return isset($_POST[$param]) ? stripslashes_deep(maybe_unserialize($_POST[$param])) : $default;
|
34 |
+
}
|
35 |
+
|
36 |
+
function load_scripts($scripts){
|
37 |
+
global $wp_version;
|
38 |
+
if(version_compare( $wp_version, '3.3', '<')){
|
39 |
+
global $wp_scripts;
|
40 |
+
$wp_scripts->do_items( (array)$scripts );
|
41 |
+
}else{
|
42 |
+
foreach((array)$scripts as $s)
|
43 |
+
wp_enqueue_script($s);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
function load_styles($styles){
|
48 |
+
global $wp_version;
|
49 |
+
if(version_compare( $wp_version, '3.3', '<')){
|
50 |
+
global $wp_styles;
|
51 |
+
$wp_styles->do_items( (array)$styles );
|
52 |
+
}else{
|
53 |
+
foreach((array)$styles as $s)
|
54 |
+
wp_enqueue_style($s);
|
55 |
+
}
|
56 |
}
|
57 |
|
58 |
function get_pages(){
|
170 |
return apply_filters( 'esc_textarea', $safe_text, $text );
|
171 |
}
|
172 |
|
173 |
+
function replace_quotes($val){
|
174 |
+
$val = str_replace(array('“', '”', '‘', '’'), array('"', '"', "'", "'"), $val);
|
175 |
+
return $val;
|
176 |
+
}
|
177 |
+
|
178 |
function script_version($handle, $list='scripts'){
|
179 |
global $wp_scripts;
|
180 |
if(!$wp_scripts)
|
247 |
$values['id'] = $record->id;
|
248 |
|
249 |
foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default_val)
|
250 |
+
$values[$var] = FrmAppHelper::get_param($var, $default_val);
|
251 |
if(apply_filters('frm_use_wpautop', true))
|
252 |
$values['description'] = wpautop($values['description']);
|
253 |
$values['fields'] = array();
|
254 |
|
255 |
if ($fields){
|
256 |
foreach($fields as $field){
|
|
|
257 |
|
258 |
if ($default){
|
259 |
$meta_value = $field->default_value;
|
270 |
}
|
271 |
|
272 |
$field_type = isset($_POST['field_options']['type_'.$field->id]) ? $_POST['field_options']['type_'.$field->id] : $field->type;
|
273 |
+
$new_value = (isset($_POST['item_meta'][$field->id])) ? stripslashes_deep(maybe_unserialize($_POST['item_meta'][$field->id])) : $meta_value;
|
274 |
+
|
|
|
|
|
|
|
275 |
$field_array = array(
|
276 |
'id' => $field->id,
|
277 |
'value' => $new_value,
|
278 |
+
'default_value' => $field->default_value,
|
279 |
+
'name' => $field->name,
|
280 |
+
'description' => $field->description,
|
281 |
'type' => apply_filters('frm_field_type', $field_type, $field, $new_value),
|
282 |
+
'options' => $field->options,
|
283 |
'required' => $field->required,
|
284 |
'field_key' => $field->field_key,
|
285 |
'field_order' => $field->field_order,
|
298 |
$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
|
299 |
|
300 |
foreach ($opt_defaults as $opt => $default_opt){
|
301 |
+
$field_array[$opt] = ($_POST and isset($_POST['field_options'][$opt.'_'.$field->id]) ) ? stripslashes_deep(maybe_unserialize($_POST['field_options'][$opt.'_'.$field->id])) : (isset($field->field_options[$opt]) ? $field->field_options[$opt] : $default_opt);
|
302 |
if($opt == 'blank' and $field_array[$opt] == ''){
|
303 |
$field_array[$opt] = $frm_settings->blank_msg;
|
304 |
}else if($opt == 'invalid' and $field_array[$opt] == ''){
|
317 |
if ($field_array['size'] == '')
|
318 |
$field_array['size'] = $frm_sidebar_width;
|
319 |
|
320 |
+
$field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
|
321 |
+
|
322 |
+
foreach((array)$field->field_options as $k => $v){
|
323 |
+
if(!isset($field_array[$k]))
|
324 |
+
$field_array[$k] = $v;
|
325 |
+
unset($k);
|
326 |
+
unset($v);
|
327 |
+
}
|
328 |
+
|
329 |
+
$values['fields'][] = $field_array;
|
330 |
+
|
331 |
unset($field);
|
332 |
}
|
333 |
}
|
522 |
|
523 |
function truncate($str, $length, $minword = 3, $continue = '...'){
|
524 |
$length = (int)$length;
|
525 |
+
$str = strip_tags($str);
|
526 |
$original_len = (function_exists('mb_strlen')) ? mb_strlen($str) : strlen($str);
|
527 |
|
528 |
if($length == 0){
|
classes/helpers/FrmEntriesHelper.php
CHANGED
@@ -6,7 +6,7 @@ class FrmEntriesHelper{
|
|
6 |
global $frm_form, $frm_settings, $frm_sidebar_width;
|
7 |
$values = array();
|
8 |
foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default)
|
9 |
-
$values[$var] =
|
10 |
|
11 |
$values['fields'] = array();
|
12 |
if ($fields){
|
@@ -21,7 +21,6 @@ class FrmEntriesHelper{
|
|
21 |
|
22 |
$is_default = ($new_value == $default) ? true : false;
|
23 |
|
24 |
-
$new_value = stripslashes_deep(maybe_unserialize($new_value));
|
25 |
if (!is_array($new_value))
|
26 |
$new_value = apply_filters('frm_get_default_value', $new_value, $field);
|
27 |
|
@@ -34,11 +33,11 @@ class FrmEntriesHelper{
|
|
34 |
$field_array = array(
|
35 |
'id' => $field->id,
|
36 |
'value' => $new_value,
|
37 |
-
'default_value' =>
|
38 |
-
'name' =>
|
39 |
-
'description' =>
|
40 |
'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
|
41 |
-
'options' =>
|
42 |
'required' => $field->required,
|
43 |
'field_key' => $field->field_key,
|
44 |
'field_order' => $field->field_order,
|
@@ -71,8 +70,17 @@ class FrmEntriesHelper{
|
|
71 |
|
72 |
if ($field_array['custom_html'] == '')
|
73 |
$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
|
74 |
-
|
75 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
if (!$form or !isset($form->id))
|
78 |
$form = $frm_form->getOne($field->form_id);
|
6 |
global $frm_form, $frm_settings, $frm_sidebar_width;
|
7 |
$values = array();
|
8 |
foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default)
|
9 |
+
$values[$var] = FrmAppHelper::get_post_param($var, $default);
|
10 |
|
11 |
$values['fields'] = array();
|
12 |
if ($fields){
|
21 |
|
22 |
$is_default = ($new_value == $default) ? true : false;
|
23 |
|
|
|
24 |
if (!is_array($new_value))
|
25 |
$new_value = apply_filters('frm_get_default_value', $new_value, $field);
|
26 |
|
33 |
$field_array = array(
|
34 |
'id' => $field->id,
|
35 |
'value' => $new_value,
|
36 |
+
'default_value' => $field->default_value,
|
37 |
+
'name' => $field->name,
|
38 |
+
'description' => $field->description,
|
39 |
'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
|
40 |
+
'options' => $field->options,
|
41 |
'required' => $field->required,
|
42 |
'field_key' => $field->field_key,
|
43 |
'field_order' => $field->field_order,
|
70 |
|
71 |
if ($field_array['custom_html'] == '')
|
72 |
$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
|
73 |
+
|
74 |
+
$field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
|
75 |
+
|
76 |
+
foreach((array)$field->field_options as $k => $v){
|
77 |
+
if(!isset($field_array[$k]))
|
78 |
+
$field_array[$k] = $v;
|
79 |
+
unset($k);
|
80 |
+
unset($v);
|
81 |
+
}
|
82 |
+
|
83 |
+
$values['fields'][] = $field_array; //stripslashes_deep($field_array)
|
84 |
|
85 |
if (!$form or !isset($form->id))
|
86 |
$form = $frm_form->getOne($field->form_id);
|
classes/helpers/FrmFieldsHelper.php
CHANGED
@@ -84,21 +84,18 @@ class FrmFieldsHelper{
|
|
84 |
function setup_edit_vars($record){
|
85 |
global $frm_entry_meta, $frm_form;
|
86 |
|
87 |
-
$values = array();
|
88 |
-
|
89 |
|
90 |
-
$values['id'] = $record->id;
|
91 |
-
$values['form_id'] = $record->form_id;
|
92 |
foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default)
|
93 |
-
$values[$var] = htmlspecialchars(
|
94 |
|
95 |
$values['form_name'] = ($record->form_id) ? $frm_form->getName( $record->form_id ) : '';
|
96 |
|
97 |
foreach (array('field_key' => $record->field_key, 'type' => $record->type, 'default_value'=> $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required) as $var => $default)
|
98 |
$values[$var] = FrmAppHelper::get_param($var, $default);
|
99 |
|
100 |
-
$values['options'] =
|
101 |
-
|
102 |
$values['field_options'] = $record->field_options;
|
103 |
|
104 |
$defaults = FrmFieldsHelper::get_default_field_opts($values['type'], $record, true);
|
@@ -111,7 +108,7 @@ class FrmFieldsHelper{
|
|
111 |
foreach($defaults as $opt => $default)
|
112 |
$values[$opt] = (isset($record->field_options[$opt])) ? $record->field_options[$opt] : $default;
|
113 |
|
114 |
-
$values['custom_html'] = (isset($record->field_options['custom_html'])) ?
|
115 |
|
116 |
return apply_filters('frm_setup_edit_field_vars', $values, $values['field_options']);
|
117 |
}
|
@@ -138,13 +135,13 @@ class FrmFieldsHelper{
|
|
138 |
'name' => __('Untitled', 'formidable'), 'description' => '',
|
139 |
'field_key' => $key, 'type' => $type, 'options'=>'', 'default_value'=>'',
|
140 |
'field_order' => $field_count+1, 'required' => false,
|
141 |
-
'blank' => $frm_settings->blank_msg,
|
142 |
'invalid' => __('This field is invalid', 'formidable'), 'form_id' => $form_id,
|
143 |
'field_options' => $field_options
|
144 |
);
|
145 |
}
|
146 |
|
147 |
-
function get_form_fields($form_id, $error=false){
|
148 |
global $frm_field;
|
149 |
$fields = apply_filters('frm_get_paged_fields', false, $form_id, $error);
|
150 |
if (!$fields)
|
@@ -172,10 +169,15 @@ DEFAULT_HTML;
|
|
172 |
}
|
173 |
|
174 |
function replace_shortcodes($html, $field, $errors=array(), $form=false){
|
|
|
|
|
175 |
$html = stripslashes($html);
|
176 |
$html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
|
177 |
|
178 |
-
$field_name =
|
|
|
|
|
|
|
179 |
//replace [id]
|
180 |
$html = str_replace('[id]', $field['id'], $html);
|
181 |
|
@@ -184,7 +186,9 @@ DEFAULT_HTML;
|
|
184 |
|
185 |
//replace [description] and [required_label] and [error]
|
186 |
$required = ($field['required'] == '0') ? '' : $field['required_indicator'];
|
187 |
-
|
|
|
|
|
188 |
foreach (array('description' => $field['description'], 'required_label' => $required, 'error' => $error) as $code => $value){
|
189 |
if (!$value or $value == '')
|
190 |
$html = preg_replace('/(\[if\s+'.$code.'\])(.*?)(\[\/if\s+'.$code.'\])/mis', '', $html);
|
@@ -274,10 +278,19 @@ DEFAULT_HTML;
|
|
274 |
require_once(FRM_PATH.'/classes/recaptchalib.php');
|
275 |
|
276 |
$lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
}
|
282 |
|
283 |
function dropdown_categories($args){
|
@@ -305,9 +318,11 @@ DEFAULT_HTML;
|
|
305 |
$args = array(
|
306 |
'show_option_all' => ' ', 'hierarchical' => 1, 'name' => $name,
|
307 |
'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
|
308 |
-
'hide_empty' => false, 'echo' => 0, 'orderby' => 'name'
|
309 |
);
|
310 |
|
|
|
|
|
311 |
if(class_exists('FrmProForm')){
|
312 |
$post_type = FrmProForm::post_type($field['form_id']);
|
313 |
if(function_exists('get_object_taxonomies')){
|
84 |
function setup_edit_vars($record){
|
85 |
global $frm_entry_meta, $frm_form;
|
86 |
|
87 |
+
$values = array('id' => $record->id, 'form_id' => $record->form_id);
|
88 |
+
//$record->field_options = maybe_unserialize($record->field_options);
|
89 |
|
|
|
|
|
90 |
foreach (array('name' => $record->name, 'description' => $record->description) as $var => $default)
|
91 |
+
$values[$var] = htmlspecialchars(FrmAppHelper::get_param($var, $default));
|
92 |
|
93 |
$values['form_name'] = ($record->form_id) ? $frm_form->getName( $record->form_id ) : '';
|
94 |
|
95 |
foreach (array('field_key' => $record->field_key, 'type' => $record->type, 'default_value'=> $record->default_value, 'field_order' => $record->field_order, 'required' => $record->required) as $var => $default)
|
96 |
$values[$var] = FrmAppHelper::get_param($var, $default);
|
97 |
|
98 |
+
$values['options'] = $record->options;
|
|
|
99 |
$values['field_options'] = $record->field_options;
|
100 |
|
101 |
$defaults = FrmFieldsHelper::get_default_field_opts($values['type'], $record, true);
|
108 |
foreach($defaults as $opt => $default)
|
109 |
$values[$opt] = (isset($record->field_options[$opt])) ? $record->field_options[$opt] : $default;
|
110 |
|
111 |
+
$values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : FrmFieldsHelper::get_default_html($record->type);
|
112 |
|
113 |
return apply_filters('frm_setup_edit_field_vars', $values, $values['field_options']);
|
114 |
}
|
135 |
'name' => __('Untitled', 'formidable'), 'description' => '',
|
136 |
'field_key' => $key, 'type' => $type, 'options'=>'', 'default_value'=>'',
|
137 |
'field_order' => $field_count+1, 'required' => false,
|
138 |
+
'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg,
|
139 |
'invalid' => __('This field is invalid', 'formidable'), 'form_id' => $form_id,
|
140 |
'field_options' => $field_options
|
141 |
);
|
142 |
}
|
143 |
|
144 |
+
function get_form_fields($form_id, $error=false){
|
145 |
global $frm_field;
|
146 |
$fields = apply_filters('frm_get_paged_fields', false, $form_id, $error);
|
147 |
if (!$fields)
|
169 |
}
|
170 |
|
171 |
function replace_shortcodes($html, $field, $errors=array(), $form=false){
|
172 |
+
global $frm_readonly;
|
173 |
+
|
174 |
$html = stripslashes($html);
|
175 |
$html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
|
176 |
|
177 |
+
$field_name = 'item_meta['. $field['id'] .']';
|
178 |
+
if($field['type'] == 'select' and isset($field['multiple']) and $field['multiple'])
|
179 |
+
$field_name .= '[]';
|
180 |
+
|
181 |
//replace [id]
|
182 |
$html = str_replace('[id]', $field['id'], $html);
|
183 |
|
186 |
|
187 |
//replace [description] and [required_label] and [error]
|
188 |
$required = ($field['required'] == '0') ? '' : $field['required_indicator'];
|
189 |
+
if(!is_array($errors))
|
190 |
+
$errors = array();
|
191 |
+
$error = (isset($errors['field'. $field['id']])) ? stripslashes($errors['field'. $field['id']]) : false;
|
192 |
foreach (array('description' => $field['description'], 'required_label' => $required, 'error' => $error) as $code => $value){
|
193 |
if (!$value or $value == '')
|
194 |
$html = preg_replace('/(\[if\s+'.$code.'\])(.*?)(\[\/if\s+'.$code.'\])/mis', '', $html);
|
278 |
require_once(FRM_PATH.'/classes/recaptchalib.php');
|
279 |
|
280 |
$lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
|
281 |
+
|
282 |
+
if(defined('DOING_AJAX')){
|
283 |
+
global $frm_recaptcha_loaded;
|
284 |
+
if(!$frm_recaptcha_loaded)
|
285 |
+
$frm_recaptcha_loaded = '';
|
286 |
+
|
287 |
+
$frm_recaptcha_loaded .= "Recaptcha.create('". $frm_settings->pubkey ."','field_". $field['field_key'] ."',{theme:'". $frm_settings->re_theme ."',lang:'". $lang ."'". apply_filters('frm_recaptcha_custom', '', $field) ."});";
|
288 |
+
?>
|
289 |
+
<div id="field_<?php echo $field['field_key'] ?>"></div>
|
290 |
+
<?php }else{ ?>
|
291 |
+
<script type="text/javascript">var RecaptchaOptions={theme:'<?php echo $frm_settings->re_theme ?>',lang:'<?php echo $lang ?>'<?php echo apply_filters('frm_recaptcha_custom', '', $field) ?>};</script>
|
292 |
+
<?php echo recaptcha_get_html($frm_settings->pubkey .'&hl='. $lang, $error, is_ssl());
|
293 |
+
}
|
294 |
}
|
295 |
|
296 |
function dropdown_categories($args){
|
318 |
$args = array(
|
319 |
'show_option_all' => ' ', 'hierarchical' => 1, 'name' => $name,
|
320 |
'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
|
321 |
+
'hide_empty' => false, 'echo' => 0, 'orderby' => 'name'
|
322 |
);
|
323 |
|
324 |
+
$args = apply_filters('frm_dropdown_cat', $args, $field);
|
325 |
+
|
326 |
if(class_exists('FrmProForm')){
|
327 |
$post_type = FrmProForm::post_type($field['form_id']);
|
328 |
if(function_exists('get_object_taxonomies')){
|
classes/helpers/FrmFormsHelper.php
CHANGED
@@ -49,13 +49,13 @@ class FrmFormsHelper{
|
|
49 |
global $frmdb, $frm_settings;
|
50 |
$values = array();
|
51 |
foreach (array('name' => __('Untitled Form', 'formidable'), 'description' => '') as $var => $default)
|
52 |
-
$values[$var] =
|
53 |
|
54 |
if(apply_filters('frm_use_wpautop', true))
|
55 |
$values['description'] = wpautop($values['description']);
|
56 |
|
57 |
foreach (array('form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0) as $var => $default)
|
58 |
-
$values[$var] =
|
59 |
|
60 |
$values['form_key'] = ($_POST and isset($_POST['form_key'])) ? $_POST['form_key'] : (FrmAppHelper::get_unique_key('', $frmdb->forms, 'form_key'));
|
61 |
|
@@ -122,12 +122,12 @@ BEFORE_HTML;
|
|
122 |
function replace_shortcodes($html, $form, $title=false, $description=false){
|
123 |
foreach (array('form_name' => $title, 'form_description' => $description, 'entry_key' => true) as $code => $show){
|
124 |
if ($code == 'form_name'){
|
125 |
-
$replace_with =
|
126 |
}else if ($code == 'form_description'){
|
127 |
if(apply_filters('frm_use_wpautop', true))
|
128 |
-
$replace_with = wpautop(
|
129 |
else
|
130 |
-
$replace_with =
|
131 |
}else if($code == 'entry_key' and isset($_GET) and isset($_GET['entry'])){
|
132 |
$replace_with = $_GET['entry'];
|
133 |
}
|
49 |
global $frmdb, $frm_settings;
|
50 |
$values = array();
|
51 |
foreach (array('name' => __('Untitled Form', 'formidable'), 'description' => '') as $var => $default)
|
52 |
+
$values[$var] = FrmAppHelper::get_param($var, $default);
|
53 |
|
54 |
if(apply_filters('frm_use_wpautop', true))
|
55 |
$values['description'] = wpautop($values['description']);
|
56 |
|
57 |
foreach (array('form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0) as $var => $default)
|
58 |
+
$values[$var] = FrmAppHelper::get_param($var, $default);
|
59 |
|
60 |
$values['form_key'] = ($_POST and isset($_POST['form_key'])) ? $_POST['form_key'] : (FrmAppHelper::get_unique_key('', $frmdb->forms, 'form_key'));
|
61 |
|
122 |
function replace_shortcodes($html, $form, $title=false, $description=false){
|
123 |
foreach (array('form_name' => $title, 'form_description' => $description, 'entry_key' => true) as $code => $show){
|
124 |
if ($code == 'form_name'){
|
125 |
+
$replace_with = $form->name;
|
126 |
}else if ($code == 'form_description'){
|
127 |
if(apply_filters('frm_use_wpautop', true))
|
128 |
+
$replace_with = wpautop($form->description);
|
129 |
else
|
130 |
+
$replace_with = $form->description;
|
131 |
}else if($code == 'entry_key' and isset($_GET) and isset($_GET['entry'])){
|
132 |
$replace_with = $_GET['entry'];
|
133 |
}
|
classes/helpers/FrmListHelper.php
CHANGED
@@ -112,7 +112,7 @@ class FrmListHelper extends WP_List_Table {
|
|
112 |
|
113 |
// Set up the hover actions for this user
|
114 |
$actions = array();
|
115 |
-
$title = esc_attr(strip_tags(
|
116 |
|
117 |
$edit_link = "?page=formidable&frm_action=edit&id={$item->id}";
|
118 |
$actions['frm_edit'] = "<a href='" . wp_nonce_url( $edit_link ) . "'>". __('Edit', 'formidable') ."</a>";
|
@@ -137,10 +137,7 @@ class FrmListHelper extends WP_List_Table {
|
|
137 |
|
138 |
$actions['frm_duplicate'] = "<a href='" . wp_nonce_url( $duplicate_link ) . "' title='". __('Copy', 'formidable') ." $title'>". __('Duplicate', 'formidable') ."</a>";
|
139 |
|
140 |
-
|
141 |
-
$actions['frm_template'] = "<a href='" . wp_nonce_url( "?page=formidable&frm_action=duplicate&id={$item->id}&template=1" ) . "' title='". __('Create Template', 'formidable') ."'>". __('Create Template', 'formidable') ."</a>";
|
142 |
-
|
143 |
-
}
|
144 |
}
|
145 |
|
146 |
if($frmpro_is_installed){
|
@@ -200,11 +197,11 @@ class FrmListHelper extends WP_List_Table {
|
|
200 |
break;
|
201 |
case 'id':
|
202 |
case 'form_key':
|
203 |
-
$val =
|
204 |
break;
|
205 |
case 'name':
|
206 |
case 'description':
|
207 |
-
$val = FrmAppHelper::truncate(strip_tags(
|
208 |
break;
|
209 |
case 'created_at':
|
210 |
$format = 'Y/m/d'; //get_option('date_format');
|
112 |
|
113 |
// Set up the hover actions for this user
|
114 |
$actions = array();
|
115 |
+
$title = esc_attr(strip_tags($item->name));
|
116 |
|
117 |
$edit_link = "?page=formidable&frm_action=edit&id={$item->id}";
|
118 |
$actions['frm_edit'] = "<a href='" . wp_nonce_url( $edit_link ) . "'>". __('Edit', 'formidable') ."</a>";
|
137 |
|
138 |
$actions['frm_duplicate'] = "<a href='" . wp_nonce_url( $duplicate_link ) . "' title='". __('Copy', 'formidable') ." $title'>". __('Duplicate', 'formidable') ."</a>";
|
139 |
|
140 |
+
$actions['frm_template'] = "<a href='" . wp_nonce_url( "?page=formidable&frm_action=duplicate&id={$item->id}&template=1" ) . "' title='". __('Create Template', 'formidable') ."'>". __('Create Template', 'formidable') ."</a>";
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
if($frmpro_is_installed){
|
197 |
break;
|
198 |
case 'id':
|
199 |
case 'form_key':
|
200 |
+
$val = $item->{$column_name};
|
201 |
break;
|
202 |
case 'name':
|
203 |
case 'description':
|
204 |
+
$val = FrmAppHelper::truncate(strip_tags($item->{$column_name}), 50);
|
205 |
break;
|
206 |
case 'created_at':
|
207 |
$format = 'Y/m/d'; //get_option('date_format');
|
classes/models/FrmEntry.php
CHANGED
@@ -33,7 +33,7 @@ class FrmEntry{
|
|
33 |
if($user_ID)
|
34 |
$new_values['user_id'] = $new_values['updated_by'] = $user_ID;
|
35 |
}
|
36 |
-
|
37 |
//check for duplicate entries created in the last 5 minutes
|
38 |
$create_entry = true;
|
39 |
if(!defined('WP_IMPORTING')){
|
@@ -96,7 +96,7 @@ class FrmEntry{
|
|
96 |
$new_values = array();
|
97 |
$new_values['item_key'] = FrmAppHelper::get_unique_key('', $frmdb->entries, 'item_key');
|
98 |
$new_values['name'] = $values->name;
|
99 |
-
$new_values['user_id'] = $new_values['updated_by'] = $values->user_id;
|
100 |
$new_values['form_id'] = ($values->form_id)?(int)$values->form_id: null;
|
101 |
$new_values['created_at'] = $new_values['updated_at'] = current_time('mysql', 1);
|
102 |
|
@@ -186,14 +186,14 @@ class FrmEntry{
|
|
186 |
$metas = $frm_entry_meta->getAll("item_id=$entry->id and field_id != 0");
|
187 |
$entry_metas = array();
|
188 |
foreach($metas as $meta_val)
|
189 |
-
$entry_metas[$meta_val->field_id] = $entry_metas[$meta_val->field_key] = $meta_val->meta_value;
|
190 |
|
191 |
$entry->metas = $entry_metas;
|
192 |
|
193 |
wp_cache_set( $entry->id, $entry, 'frm_entry');
|
194 |
}
|
195 |
|
196 |
-
return $entry;
|
197 |
}
|
198 |
|
199 |
function &exists( $id ){
|
@@ -257,7 +257,7 @@ class FrmEntry{
|
|
257 |
if(!isset($entries[$meta_val->item_id]->metas))
|
258 |
$entries[$meta_val->item_id]->metas = array();
|
259 |
|
260 |
-
$entries[$meta_val->item_id]->metas[$meta_val->field_id] = $entries[$meta_val->item_id]->metas[$meta_val->field_key] = $meta_val->meta_value;
|
261 |
}
|
262 |
|
263 |
foreach($entries as $entry){
|
@@ -282,7 +282,8 @@ class FrmEntry{
|
|
282 |
*/
|
283 |
}
|
284 |
}
|
285 |
-
|
|
|
286 |
}
|
287 |
|
288 |
// Pagination Methods
|
@@ -346,7 +347,7 @@ class FrmEntry{
|
|
346 |
$value = '';
|
347 |
|
348 |
if ($posted_field->required == '1' and !is_array($value) and trim($value) == ''){
|
349 |
-
$errors['field'
|
350 |
}else if ($posted_field->type == 'text' and !isset($_POST['name'])){
|
351 |
$_POST['name'] = $value;
|
352 |
}
|
33 |
if($user_ID)
|
34 |
$new_values['user_id'] = $new_values['updated_by'] = $user_ID;
|
35 |
}
|
36 |
+
|
37 |
//check for duplicate entries created in the last 5 minutes
|
38 |
$create_entry = true;
|
39 |
if(!defined('WP_IMPORTING')){
|
96 |
$new_values = array();
|
97 |
$new_values['item_key'] = FrmAppHelper::get_unique_key('', $frmdb->entries, 'item_key');
|
98 |
$new_values['name'] = $values->name;
|
99 |
+
$new_values['user_id'] = $new_values['updated_by'] = (int)$values->user_id;
|
100 |
$new_values['form_id'] = ($values->form_id)?(int)$values->form_id: null;
|
101 |
$new_values['created_at'] = $new_values['updated_at'] = current_time('mysql', 1);
|
102 |
|
186 |
$metas = $frm_entry_meta->getAll("item_id=$entry->id and field_id != 0");
|
187 |
$entry_metas = array();
|
188 |
foreach($metas as $meta_val)
|
189 |
+
$entry_metas[$meta_val->field_id] = $entry_metas[$meta_val->field_key] = maybe_unserialize($meta_val->meta_value);
|
190 |
|
191 |
$entry->metas = $entry_metas;
|
192 |
|
193 |
wp_cache_set( $entry->id, $entry, 'frm_entry');
|
194 |
}
|
195 |
|
196 |
+
return stripslashes_deep($entry);
|
197 |
}
|
198 |
|
199 |
function &exists( $id ){
|
257 |
if(!isset($entries[$meta_val->item_id]->metas))
|
258 |
$entries[$meta_val->item_id]->metas = array();
|
259 |
|
260 |
+
$entries[$meta_val->item_id]->metas[$meta_val->field_id] = $entries[$meta_val->item_id]->metas[$meta_val->field_key] = maybe_unserialize($meta_val->meta_value);
|
261 |
}
|
262 |
|
263 |
foreach($entries as $entry){
|
282 |
*/
|
283 |
}
|
284 |
}
|
285 |
+
|
286 |
+
return stripslashes_deep($entries);
|
287 |
}
|
288 |
|
289 |
// Pagination Methods
|
347 |
$value = '';
|
348 |
|
349 |
if ($posted_field->required == '1' and !is_array($value) and trim($value) == ''){
|
350 |
+
$errors['field'. $posted_field->id] = (!isset($posted_field->field_options['blank']) or $posted_field->field_options['blank'] == '' or $posted_field->field_options['blank'] == 'Untitled cannot be blank') ? $frm_settings->blank_msg : $posted_field->field_options['blank'];
|
351 |
}else if ($posted_field->type == 'text' and !isset($_POST['name'])){
|
352 |
$_POST['name'] = $value;
|
353 |
}
|
classes/models/FrmEntryMeta.php
CHANGED
@@ -62,9 +62,9 @@ class FrmEntryMeta{
|
|
62 |
return $cached->metas[$field_id];
|
63 |
|
64 |
if (is_numeric($field_id))
|
65 |
-
$query = "SELECT
|
66 |
else
|
67 |
-
$query = "SELECT
|
68 |
|
69 |
if($return_var){
|
70 |
$result = maybe_unserialize($wpdb->get_var("{$query} LIMIT 1"));
|
@@ -74,6 +74,7 @@ class FrmEntryMeta{
|
|
74 |
$cached->metas[$field_id] = $result;
|
75 |
wp_cache_set($entry_id, $cached, 'frm_entry');
|
76 |
}
|
|
|
77 |
}else{
|
78 |
$result = $wpdb->get_col($query, 0);
|
79 |
}
|
@@ -102,8 +103,12 @@ class FrmEntryMeta{
|
|
102 |
return $wpdb->get_col("SELECT meta_value FROM $frmdb->entry_metas WHERE item_id='{$entry_id}'");
|
103 |
}
|
104 |
|
105 |
-
function get_entry_metas_for_field($field_id, $order='', $limit='', $
|
106 |
global $wpdb, $frmdb;
|
|
|
|
|
|
|
|
|
107 |
$query = "SELECT ";
|
108 |
$query .= ($unique) ? "DISTINCT(em.meta_value)" : "em.meta_value";
|
109 |
$query .= " FROM $frmdb->entry_metas em ";
|
@@ -112,7 +117,17 @@ class FrmEntryMeta{
|
|
112 |
$query .= " AND meta_value='$value'";
|
113 |
$query .= "{$order}{$limit}";
|
114 |
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
function get_entry_meta_info($entry_id){
|
@@ -120,7 +135,7 @@ class FrmEntryMeta{
|
|
120 |
return $wpdb->get_results("SELECT * FROM $frmdb->entry_metas WHERE item_id='{$entry_id}'");
|
121 |
}
|
122 |
|
123 |
-
function getAll($where = '', $order_by = '', $limit = ''){
|
124 |
global $wpdb, $frmdb, $frm_field, $frm_app_helper;
|
125 |
$query = "SELECT it.*, fi.type as field_type, fi.field_key as field_key,
|
126 |
fi.required as required, fi.form_id as field_form_id, fi.name as field_name, fi.options as fi_options
|
@@ -131,6 +146,15 @@ class FrmEntryMeta{
|
|
131 |
$results = $wpdb->get_row($query);
|
132 |
else
|
133 |
$results = $wpdb->get_results($query);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
return $results;
|
135 |
}
|
136 |
|
62 |
return $cached->metas[$field_id];
|
63 |
|
64 |
if (is_numeric($field_id))
|
65 |
+
$query = "SELECT meta_value FROM $frmdb->entry_metas WHERE field_id='$field_id' and item_id='$entry_id'";
|
66 |
else
|
67 |
+
$query = "SELECT meta_value FROM $frmdb->entry_metas it LEFT OUTER JOIN $frmdb->fields fi ON it.field_id=fi.id WHERE fi.field_key='{$field_id}' and item_id='{$entry_id}'";
|
68 |
|
69 |
if($return_var){
|
70 |
$result = maybe_unserialize($wpdb->get_var("{$query} LIMIT 1"));
|
74 |
$cached->metas[$field_id] = $result;
|
75 |
wp_cache_set($entry_id, $cached, 'frm_entry');
|
76 |
}
|
77 |
+
$result = stripslashes_deep($result);
|
78 |
}else{
|
79 |
$result = $wpdb->get_col($query, 0);
|
80 |
}
|
103 |
return $wpdb->get_col("SELECT meta_value FROM $frmdb->entry_metas WHERE item_id='{$entry_id}'");
|
104 |
}
|
105 |
|
106 |
+
function get_entry_metas_for_field($field_id, $order='', $limit='', $args=array()){
|
107 |
global $wpdb, $frmdb;
|
108 |
+
|
109 |
+
$defaults = array('value' => false, 'unique' => false, 'stripslashes' => true);
|
110 |
+
extract(wp_parse_args( $args, $defaults ));
|
111 |
+
|
112 |
$query = "SELECT ";
|
113 |
$query .= ($unique) ? "DISTINCT(em.meta_value)" : "em.meta_value";
|
114 |
$query .= " FROM $frmdb->entry_metas em ";
|
117 |
$query .= " AND meta_value='$value'";
|
118 |
$query .= "{$order}{$limit}";
|
119 |
|
120 |
+
$values = $wpdb->get_col($query);
|
121 |
+
if($stripslashes){
|
122 |
+
foreach($values as $k => $v){
|
123 |
+
$values[$k] = maybe_unserialize($v);
|
124 |
+
unset($k);
|
125 |
+
unset($v);
|
126 |
+
}
|
127 |
+
$values = stripslashes_deep($values);
|
128 |
+
}
|
129 |
+
|
130 |
+
return $values;
|
131 |
}
|
132 |
|
133 |
function get_entry_meta_info($entry_id){
|
135 |
return $wpdb->get_results("SELECT * FROM $frmdb->entry_metas WHERE item_id='{$entry_id}'");
|
136 |
}
|
137 |
|
138 |
+
function getAll($where = '', $order_by = '', $limit = '', $stripslashes = false){
|
139 |
global $wpdb, $frmdb, $frm_field, $frm_app_helper;
|
140 |
$query = "SELECT it.*, fi.type as field_type, fi.field_key as field_key,
|
141 |
fi.required as required, fi.form_id as field_form_id, fi.name as field_name, fi.options as fi_options
|
146 |
$results = $wpdb->get_row($query);
|
147 |
else
|
148 |
$results = $wpdb->get_results($query);
|
149 |
+
|
150 |
+
if($results and $stripslashes){
|
151 |
+
foreach($results as $k => $result){
|
152 |
+
$results[$k]->meta_value = maybe_unserialize($result->meta_value);
|
153 |
+
unset($k);
|
154 |
+
unset($result);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
return $results;
|
159 |
}
|
160 |
|
classes/models/FrmField.php
CHANGED
@@ -37,9 +37,9 @@ class FrmField{
|
|
37 |
$values = array();
|
38 |
$new_key = ($copy_keys) ? $field->field_key : '';
|
39 |
$values['field_key'] = FrmAppHelper::get_unique_key($new_key, $frmdb->fields, 'field_key');
|
40 |
-
$values['
|
41 |
$values['form_id'] = $form_id;
|
42 |
-
foreach (array('name', 'description', 'type', 'default_value', '
|
43 |
$values[$col] = $field->{$col};
|
44 |
$this->create($values, false);
|
45 |
unset($field);
|
@@ -76,23 +76,27 @@ class FrmField{
|
|
76 |
|
77 |
function getOne( $id ){
|
78 |
global $wpdb, $frmdb;
|
79 |
-
$
|
80 |
-
if(
|
81 |
-
return $cached;
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
|
|
|
|
|
|
|
|
89 |
|
90 |
if($results){
|
91 |
$results->field_options = maybe_unserialize($results->field_options);
|
92 |
-
|
|
|
93 |
}
|
94 |
|
95 |
-
return $results;
|
96 |
}
|
97 |
|
98 |
function getAll($where=array(), $order_by = '', $limit = '', $blog_id=false){
|
@@ -141,17 +145,21 @@ class FrmField{
|
|
141 |
if($results){
|
142 |
if(is_array($results)){
|
143 |
foreach($results as $r_key => $result){
|
144 |
-
$results[$r_key]->field_options = maybe_unserialize($result->field_options);
|
145 |
wp_cache_set($result->id, $result, 'frm_field');
|
146 |
wp_cache_set($result->field_key, $result, 'frm_field');
|
|
|
|
|
|
|
147 |
}
|
148 |
}else{
|
149 |
-
$results->field_options = maybe_unserialize($results->field_options);
|
150 |
wp_cache_set($results->id, $results, 'frm_field');
|
151 |
wp_cache_set($results->field_key, $results, 'frm_field');
|
|
|
|
|
|
|
152 |
}
|
153 |
}
|
154 |
-
return $results;
|
155 |
}
|
156 |
|
157 |
function getIds($where = '', $order_by = '', $limit = ''){
|
37 |
$values = array();
|
38 |
$new_key = ($copy_keys) ? $field->field_key : '';
|
39 |
$values['field_key'] = FrmAppHelper::get_unique_key($new_key, $frmdb->fields, 'field_key');
|
40 |
+
$values['options'] = maybe_serialize($field->options);
|
41 |
$values['form_id'] = $form_id;
|
42 |
+
foreach (array('name', 'description', 'type', 'default_value', 'field_order', 'required', 'field_options') as $col)
|
43 |
$values[$col] = $field->{$col};
|
44 |
$this->create($values, false);
|
45 |
unset($field);
|
76 |
|
77 |
function getOne( $id ){
|
78 |
global $wpdb, $frmdb;
|
79 |
+
$results = wp_cache_get( $id, 'frm_field' );
|
80 |
+
if(!$results){
|
|
|
81 |
|
82 |
+
if (is_numeric($id))
|
83 |
+
$where = array('id' => $id);
|
84 |
+
else
|
85 |
+
$where = array('field_key' => $id);
|
86 |
|
87 |
+
$results = $frmdb->get_one_record($frmdb->fields, $where);
|
88 |
+
|
89 |
+
if($results)
|
90 |
+
wp_cache_set( $results->id, $results, 'frm_field' );
|
91 |
+
}
|
92 |
|
93 |
if($results){
|
94 |
$results->field_options = maybe_unserialize($results->field_options);
|
95 |
+
$results->options = maybe_unserialize($results->options);
|
96 |
+
$results->default_value = maybe_unserialize($results->default_value);
|
97 |
}
|
98 |
|
99 |
+
return stripslashes_deep($results);
|
100 |
}
|
101 |
|
102 |
function getAll($where=array(), $order_by = '', $limit = '', $blog_id=false){
|
145 |
if($results){
|
146 |
if(is_array($results)){
|
147 |
foreach($results as $r_key => $result){
|
|
|
148 |
wp_cache_set($result->id, $result, 'frm_field');
|
149 |
wp_cache_set($result->field_key, $result, 'frm_field');
|
150 |
+
$results[$r_key]->field_options = maybe_unserialize($result->field_options);
|
151 |
+
$results[$r_key]->options = maybe_unserialize($result->options);
|
152 |
+
$results[$r_key]->default_value = maybe_unserialize($result->default_value);
|
153 |
}
|
154 |
}else{
|
|
|
155 |
wp_cache_set($results->id, $results, 'frm_field');
|
156 |
wp_cache_set($results->field_key, $results, 'frm_field');
|
157 |
+
$results->field_options = maybe_unserialize($results->field_options);
|
158 |
+
$results->options = maybe_unserialize($results->options);
|
159 |
+
$results->default_value = maybe_unserialize($results->default_value);
|
160 |
}
|
161 |
}
|
162 |
+
return stripslashes_deep($results);
|
163 |
}
|
164 |
|
165 |
function getIds($where = '', $order_by = '', $limit = ''){
|
classes/models/FrmForm.php
CHANGED
@@ -220,10 +220,11 @@ class FrmForm{
|
|
220 |
|
221 |
function getName( $id ){
|
222 |
global $wpdb, $frmdb;
|
223 |
-
$query = "SELECT
|
224 |
$query .= (is_numeric($id)) ? "id" : "form_key";
|
225 |
$query .= "='{$id}'";
|
226 |
-
|
|
|
227 |
}
|
228 |
|
229 |
function getIdByKey( $key ){
|
@@ -248,9 +249,9 @@ class FrmForm{
|
|
248 |
$cache = wp_cache_get($id, 'frm_form');
|
249 |
if($cache){
|
250 |
if(isset($cache->options))
|
251 |
-
$cache->options =
|
252 |
|
253 |
-
return $cache;
|
254 |
}
|
255 |
}
|
256 |
|
@@ -263,9 +264,9 @@ class FrmForm{
|
|
263 |
|
264 |
if(isset($results->options)){
|
265 |
wp_cache_set($results->id, $results, 'frm_form');
|
266 |
-
$results->options =
|
267 |
}
|
268 |
-
return $results;
|
269 |
}
|
270 |
|
271 |
function getAll( $where = array(), $order_by = '', $limit = '' ){
|
@@ -282,8 +283,10 @@ class FrmForm{
|
|
282 |
else
|
283 |
$results = $wpdb->get_row($query);
|
284 |
|
285 |
-
if($results)
|
286 |
wp_cache_set($results->id, $results, 'frm_form');
|
|
|
|
|
287 |
}else{
|
288 |
if(is_array($where))
|
289 |
$results = $frmdb->get_records($frmdb->forms, $where, $order_by, $limit);
|
@@ -291,12 +294,14 @@ class FrmForm{
|
|
291 |
$results = $wpdb->get_results($query);
|
292 |
|
293 |
if($results){
|
294 |
-
foreach($results as $result)
|
295 |
wp_cache_set($result->id, $result, 'frm_form');
|
|
|
|
|
296 |
}
|
297 |
}
|
298 |
|
299 |
-
return $results;
|
300 |
}
|
301 |
|
302 |
function validate( $values ){
|
220 |
|
221 |
function getName( $id ){
|
222 |
global $wpdb, $frmdb;
|
223 |
+
$query = "SELECT name FROM $frmdb->forms WHERE ";
|
224 |
$query .= (is_numeric($id)) ? "id" : "form_key";
|
225 |
$query .= "='{$id}'";
|
226 |
+
$r = $wpdb->get_var($query);
|
227 |
+
return stripslashes($r);
|
228 |
}
|
229 |
|
230 |
function getIdByKey( $key ){
|
249 |
$cache = wp_cache_get($id, 'frm_form');
|
250 |
if($cache){
|
251 |
if(isset($cache->options))
|
252 |
+
$cache->options = maybe_unserialize($cache->options);
|
253 |
|
254 |
+
return stripslashes_deep($cache);
|
255 |
}
|
256 |
}
|
257 |
|
264 |
|
265 |
if(isset($results->options)){
|
266 |
wp_cache_set($results->id, $results, 'frm_form');
|
267 |
+
$results->options = maybe_unserialize($results->options);
|
268 |
}
|
269 |
+
return stripslashes_deep($results);
|
270 |
}
|
271 |
|
272 |
function getAll( $where = array(), $order_by = '', $limit = '' ){
|
283 |
else
|
284 |
$results = $wpdb->get_row($query);
|
285 |
|
286 |
+
if($results){
|
287 |
wp_cache_set($results->id, $results, 'frm_form');
|
288 |
+
$results->options = maybe_unserialize($results->options);
|
289 |
+
}
|
290 |
}else{
|
291 |
if(is_array($where))
|
292 |
$results = $frmdb->get_records($frmdb->forms, $where, $order_by, $limit);
|
294 |
$results = $wpdb->get_results($query);
|
295 |
|
296 |
if($results){
|
297 |
+
foreach($results as $result){
|
298 |
wp_cache_set($result->id, $result, 'frm_form');
|
299 |
+
$result->options = maybe_unserialize($result->options);
|
300 |
+
}
|
301 |
}
|
302 |
}
|
303 |
|
304 |
+
return stripslashes_deep($results);
|
305 |
}
|
306 |
|
307 |
function validate( $values ){
|
classes/models/FrmSettings.php
CHANGED
@@ -24,6 +24,7 @@ class FrmSettings{
|
|
24 |
var $success_msg;
|
25 |
var $failed_msg;
|
26 |
var $blank_msg;
|
|
|
27 |
var $invalid_msg;
|
28 |
var $submit_value;
|
29 |
var $login_msg;
|
@@ -45,32 +46,33 @@ class FrmSettings{
|
|
45 |
function FrmSettings(){
|
46 |
$this->set_default_options();
|
47 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
function set_default_options(){
|
50 |
-
if(!isset($this->menu))
|
51 |
-
$this->menu = 'Formidable';
|
52 |
-
|
53 |
-
if(!isset($this->mu_menu))
|
54 |
-
$this->mu_menu = 0;
|
55 |
-
|
56 |
-
if(IS_WPMU and is_admin()){
|
57 |
-
$mu_menu = get_site_option('frm_admin_menu_name');
|
58 |
-
if($mu_menu and !empty($mu_menu)){
|
59 |
-
$this->menu = $mu_menu;
|
60 |
-
$this->mu_menu = 1;
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
if(!isset($this->preview_page_id))
|
65 |
-
$this->preview_page_id = 0;
|
66 |
-
|
67 |
$this->preview_page_id_str = 'frm-preview-page-id';
|
68 |
-
|
69 |
-
if(!isset($this->lock_keys))
|
70 |
-
$this->lock_keys = false;
|
71 |
-
|
72 |
-
if(!isset($this->track))
|
73 |
-
$this->track = false;
|
74 |
|
75 |
if(!isset($this->pubkey)){
|
76 |
if(IS_WPMU)
|
@@ -92,10 +94,6 @@ class FrmSettings{
|
|
92 |
|
93 |
if(!isset($this->re_msg) or empty($this->re_msg))
|
94 |
$this->re_msg = __('The reCAPTCHA was not entered correctly', 'formidable');
|
95 |
-
|
96 |
-
|
97 |
-
if(!isset($this->use_html))
|
98 |
-
$this->use_html = true;
|
99 |
|
100 |
if(!isset($this->load_style)){
|
101 |
if(!isset($this->custom_style))
|
@@ -105,47 +103,35 @@ class FrmSettings{
|
|
105 |
|
106 |
$this->load_style = ($this->custom_stylesheet) ? 'none' : 'all';
|
107 |
}
|
108 |
-
|
109 |
-
if(!isset($this->jquery_css))
|
110 |
-
$this->jquery_css = false;
|
111 |
-
if(!isset($this->accordion_js))
|
112 |
-
$this->accordion_js = false;
|
113 |
-
|
114 |
-
if(!isset($this->success_msg))
|
115 |
-
$this->success_msg = __('Your responses were successfully submitted. Thank you!', 'formidable');
|
116 |
-
$this->success_msg = stripslashes($this->success_msg);
|
117 |
-
|
118 |
-
if(!isset($this->blank_msg))
|
119 |
-
$this->blank_msg = __('This field cannot be blank.', 'formidable');
|
120 |
-
$this->blank_msg = stripslashes($this->blank_msg);
|
121 |
-
|
122 |
-
if(!isset($this->invalid_msg))
|
123 |
-
$this->invalid_msg = __('There was a problem with your submission. Errors are marked below.', 'formidable');
|
124 |
-
$this->invalid_msg = stripslashes($this->invalid_msg);
|
125 |
|
126 |
-
|
127 |
-
$this->failed_msg = __('We\'re sorry. It looks like you\'ve already submitted that.', 'formidable');
|
128 |
-
$this->failed_msg = stripslashes($this->failed_msg);
|
129 |
|
130 |
-
|
131 |
-
$this->
|
132 |
-
|
133 |
-
|
134 |
-
$
|
135 |
-
|
136 |
-
|
137 |
-
if(!isset($this->admin_permission))
|
138 |
-
$this->admin_permission = __("You do not have permission to do that", 'formidable');
|
139 |
-
$this->admin_permission = stripslashes($this->admin_permission);
|
140 |
|
141 |
-
if(
|
142 |
-
$
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
$frm_roles = FrmAppHelper::frm_capabilities();
|
145 |
foreach($frm_roles as $frm_role => $frm_role_description){
|
146 |
if(!isset($this->$frm_role))
|
147 |
$this->$frm_role = 'administrator';
|
148 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
|
151 |
function validate($params,$errors){
|
@@ -157,36 +143,36 @@ class FrmSettings{
|
|
157 |
|
158 |
function update($params){
|
159 |
global $wp_roles;
|
160 |
-
|
161 |
$this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0;
|
162 |
if($this->mu_menu)
|
163 |
update_site_option('frm_admin_menu_name', $this->menu);
|
164 |
else if(FrmAppHelper::is_super_admin())
|
165 |
update_site_option('frm_admin_menu_name', false);
|
166 |
|
167 |
-
$this->preview_page_id = (int)$params[ $this->preview_page_id_str ];
|
168 |
-
$this->lock_keys = isset($params['frm_lock_keys']) ? $params['frm_lock_keys'] : 0;
|
169 |
-
$this->track = isset($params['frm_track']) ? $params['frm_track'] : 0;
|
170 |
-
|
171 |
$this->pubkey = trim($params['frm_pubkey']);
|
172 |
$this->privkey = $params['frm_privkey'];
|
173 |
$this->re_theme = $params['frm_re_theme'];
|
174 |
$this->re_lang = $params['frm_re_lang'];
|
175 |
|
176 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
$this->load_style = $params['frm_load_style'];
|
|
|
|
|
|
|
|
|
|
|
178 |
//$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
|
179 |
//$this->custom_stylesheet = isset($params['frm_custom_stylesheet']) ? $params['frm_custom_stylesheet'] : 0;
|
180 |
$this->jquery_css = isset($params['frm_jquery_css']) ? $params['frm_jquery_css'] : 0;
|
181 |
$this->accordion_js = isset($params['frm_accordion_js']) ? $params['frm_accordion_js'] : 0;
|
182 |
|
183 |
-
$this->success_msg = $params['frm_success_msg'];
|
184 |
-
$this->blank_msg = $params['frm_blank_msg'];
|
185 |
-
$this->invalid_msg = $params['frm_invalid_msg'];
|
186 |
-
$this->failed_msg = $params['frm_failed_msg'];
|
187 |
-
$this->submit_value = $params['frm_submit_value'];
|
188 |
-
$this->login_msg = $params['frm_login_msg'];
|
189 |
-
|
190 |
//update roles
|
191 |
$frm_roles = FrmAppHelper::frm_capabilities();
|
192 |
$roles = get_editable_roles();
|
@@ -202,6 +188,12 @@ class FrmSettings{
|
|
202 |
}
|
203 |
|
204 |
do_action( 'frm_update_settings', $params );
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
}
|
206 |
|
207 |
function store(){
|
24 |
var $success_msg;
|
25 |
var $failed_msg;
|
26 |
var $blank_msg;
|
27 |
+
var $unique_msg;
|
28 |
var $invalid_msg;
|
29 |
var $submit_value;
|
30 |
var $login_msg;
|
46 |
function FrmSettings(){
|
47 |
$this->set_default_options();
|
48 |
}
|
49 |
+
|
50 |
+
function default_options(){
|
51 |
+
return array(
|
52 |
+
'menu' => 'Formidable',
|
53 |
+
'mu_menu' => 0,
|
54 |
+
'preview_page_id' => 0,
|
55 |
+
'lock_keys' => false,
|
56 |
+
'track' => false,
|
57 |
+
'use_html' => true,
|
58 |
+
'jquery_css' => false,
|
59 |
+
'accordion_js' => false,
|
60 |
+
|
61 |
+
'success_msg' => __('Your responses were successfully submitted. Thank you!', 'formidable'),
|
62 |
+
'blank_msg' => __('This field cannot be blank.', 'formidable'),
|
63 |
+
'unique_msg' => __('This value must be unique.', 'formidable'),
|
64 |
+
'invalid_msg' => __('There was a problem with your submission. Errors are marked below.', 'formidable'),
|
65 |
+
'failed_msg' => __('We\'re sorry. It looks like you\'ve already submitted that.', 'formidable'),
|
66 |
+
'submit_value' => __('Submit', 'formidable'),
|
67 |
+
'login_msg' => __('You do not have permission to view this form.', 'formidable'),
|
68 |
+
'admin_permission' => __('You do not have permission to do that', 'formidable'),
|
69 |
+
|
70 |
+
'email_to' => '[admin_email]',
|
71 |
+
);
|
72 |
+
}
|
73 |
|
74 |
+
function set_default_options(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
$this->preview_page_id_str = 'frm-preview-page-id';
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
if(!isset($this->pubkey)){
|
78 |
if(IS_WPMU)
|
94 |
|
95 |
if(!isset($this->re_msg) or empty($this->re_msg))
|
96 |
$this->re_msg = __('The reCAPTCHA was not entered correctly', 'formidable');
|
|
|
|
|
|
|
|
|
97 |
|
98 |
if(!isset($this->load_style)){
|
99 |
if(!isset($this->custom_style))
|
103 |
|
104 |
$this->load_style = ($this->custom_stylesheet) ? 'none' : 'all';
|
105 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
$settings = $this->default_options();
|
|
|
|
|
108 |
|
109 |
+
foreach($settings as $setting => $default){
|
110 |
+
if(!isset($this->{$setting}))
|
111 |
+
$this->{$setting} = $default;
|
112 |
+
unset($setting);
|
113 |
+
unset($default);
|
114 |
+
}
|
|
|
|
|
|
|
|
|
115 |
|
116 |
+
if(IS_WPMU and is_admin()){
|
117 |
+
$mu_menu = get_site_option('frm_admin_menu_name');
|
118 |
+
if($mu_menu and !empty($mu_menu)){
|
119 |
+
$this->menu = $mu_menu;
|
120 |
+
$this->mu_menu = 1;
|
121 |
+
}
|
122 |
+
}
|
123 |
|
124 |
$frm_roles = FrmAppHelper::frm_capabilities();
|
125 |
foreach($frm_roles as $frm_role => $frm_role_description){
|
126 |
if(!isset($this->$frm_role))
|
127 |
$this->$frm_role = 'administrator';
|
128 |
}
|
129 |
+
|
130 |
+
foreach($this as $k => $v){
|
131 |
+
$this->{$k} = stripslashes_deep($v);
|
132 |
+
unset($k);
|
133 |
+
unset($v);
|
134 |
+
}
|
135 |
}
|
136 |
|
137 |
function validate($params,$errors){
|
143 |
|
144 |
function update($params){
|
145 |
global $wp_roles;
|
146 |
+
|
147 |
$this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0;
|
148 |
if($this->mu_menu)
|
149 |
update_site_option('frm_admin_menu_name', $this->menu);
|
150 |
else if(FrmAppHelper::is_super_admin())
|
151 |
update_site_option('frm_admin_menu_name', false);
|
152 |
|
|
|
|
|
|
|
|
|
153 |
$this->pubkey = trim($params['frm_pubkey']);
|
154 |
$this->privkey = $params['frm_privkey'];
|
155 |
$this->re_theme = $params['frm_re_theme'];
|
156 |
$this->re_lang = $params['frm_re_lang'];
|
157 |
|
158 |
+
$settings = $this->default_options();
|
159 |
+
|
160 |
+
foreach($settings as $setting => $default){
|
161 |
+
if(isset($params['frm_'. $setting]))
|
162 |
+
$this->{$setting} = $params['frm_'. $setting];
|
163 |
+
}
|
164 |
+
|
165 |
$this->load_style = $params['frm_load_style'];
|
166 |
+
$this->preview_page_id = (int)$params[ $this->preview_page_id_str ];
|
167 |
+
$this->lock_keys = isset($params['frm_lock_keys']) ? $params['frm_lock_keys'] : 0;
|
168 |
+
$this->track = isset($params['frm_track']) ? $params['frm_track'] : 0;
|
169 |
+
|
170 |
+
$this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
|
171 |
//$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
|
172 |
//$this->custom_stylesheet = isset($params['frm_custom_stylesheet']) ? $params['frm_custom_stylesheet'] : 0;
|
173 |
$this->jquery_css = isset($params['frm_jquery_css']) ? $params['frm_jquery_css'] : 0;
|
174 |
$this->accordion_js = isset($params['frm_accordion_js']) ? $params['frm_accordion_js'] : 0;
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
//update roles
|
177 |
$frm_roles = FrmAppHelper::frm_capabilities();
|
178 |
$roles = get_editable_roles();
|
188 |
}
|
189 |
|
190 |
do_action( 'frm_update_settings', $params );
|
191 |
+
|
192 |
+
foreach($this as $k => $v){
|
193 |
+
$this->{$k} = stripslashes_deep($v);
|
194 |
+
unset($k);
|
195 |
+
unset($v);
|
196 |
+
}
|
197 |
}
|
198 |
|
199 |
function store(){
|
classes/models/FrmUpdate.php
CHANGED
@@ -262,15 +262,16 @@ success:function(msg){jQuery("#frm_deauthorize_link").fadeOut("slow"); frm_show_
|
|
262 |
return compact('username', 'password', 'wpmu');
|
263 |
}
|
264 |
|
265 |
-
public function get_current_info($version, $force=false){
|
266 |
include_once( ABSPATH . 'wp-includes/class-IXR.php' );
|
267 |
|
268 |
$client = new IXR_Client( $this->pro_mothership_xmlrpc_url, false, 80, $this->timeout );
|
269 |
|
270 |
$force = $force ? 'true' : 'false';
|
271 |
-
|
|
|
272 |
if( !$client->query( 'proplug.get_current_info', $this->pro_username, $this->pro_password, $version, $force,
|
273 |
-
get_option('siteurl'), $
|
274 |
return false;
|
275 |
|
276 |
return $client->getResponse();
|
@@ -291,11 +292,24 @@ success:function(msg){jQuery("#frm_deauthorize_link").fadeOut("slow"); frm_show_
|
|
291 |
if( $this->pro_is_authorized() ) {
|
292 |
if( !$this->pro_is_installed() )
|
293 |
$force = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
}
|
300 |
}
|
301 |
|
@@ -306,5 +320,33 @@ success:function(msg){jQuery("#frm_deauthorize_link").fadeOut("slow"); frm_show_
|
|
306 |
$transient = get_site_transient('update_plugins');
|
307 |
set_site_transient('update_plugins', $this->queue_update($transient, true));
|
308 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
}
|
310 |
?>
|
262 |
return compact('username', 'password', 'wpmu');
|
263 |
}
|
264 |
|
265 |
+
public function get_current_info($version, $force=false, $plugin=false){
|
266 |
include_once( ABSPATH . 'wp-includes/class-IXR.php' );
|
267 |
|
268 |
$client = new IXR_Client( $this->pro_mothership_xmlrpc_url, false, 80, $this->timeout );
|
269 |
|
270 |
$force = $force ? 'true' : 'false';
|
271 |
+
$plugin = $plugin ? $plugin : $this->plugin_nicename;
|
272 |
+
|
273 |
if( !$client->query( 'proplug.get_current_info', $this->pro_username, $this->pro_password, $version, $force,
|
274 |
+
get_option('siteurl'), $plugin) )
|
275 |
return false;
|
276 |
|
277 |
return $client->getResponse();
|
292 |
if( $this->pro_is_authorized() ) {
|
293 |
if( !$this->pro_is_installed() )
|
294 |
$force = true;
|
295 |
+
|
296 |
+
$expired = true;
|
297 |
+
if(!$force){
|
298 |
+
$update = get_transient('frm_autoupdate');
|
299 |
+
$expired = false;
|
300 |
+
}
|
301 |
|
302 |
+
if(!$update)
|
303 |
+
$update = $this->get_current_info( $transient->checked[ $this->plugin_name ], $force );
|
304 |
+
|
305 |
+
if( $update and !empty( $update ) ){
|
306 |
+
$update = (object) $update;
|
307 |
+
$transient->response[ $this->plugin_name ] = $update;
|
308 |
+
|
309 |
+
//only check every 12 hours
|
310 |
+
if(!$expired)
|
311 |
+
set_transient( 'frm_autoupdate', $update, 60 * 60 * 12 );
|
312 |
+
}
|
313 |
}
|
314 |
}
|
315 |
|
320 |
$transient = get_site_transient('update_plugins');
|
321 |
set_site_transient('update_plugins', $this->queue_update($transient, true));
|
322 |
}
|
323 |
+
|
324 |
+
function queue_addon_update($transient, $plugin, $force=false){
|
325 |
+
if(!is_object($transient) or empty($transient->checked))
|
326 |
+
return $transient;
|
327 |
+
|
328 |
+
global $frmpro_is_installed;
|
329 |
+
if($frmpro_is_installed){
|
330 |
+
$expired = true;
|
331 |
+
if(!$force){
|
332 |
+
$update = get_transient($plugin->pro_last_checked_store);
|
333 |
+
$expired = false;
|
334 |
+
}
|
335 |
+
|
336 |
+
if(!$update)
|
337 |
+
$update = $this->get_current_info( $transient->checked[ $plugin->plugin_name ], $force, $plugin->plugin_nicename );
|
338 |
+
|
339 |
+
if( $update and !empty( $update ) ){
|
340 |
+
$update = (object) $update;
|
341 |
+
$transient->response[ $plugin->plugin_name ] = $update;
|
342 |
+
|
343 |
+
//only check every 12 hours
|
344 |
+
if(!$expired)
|
345 |
+
set_transient($plugin->pro_last_checked_store, $update, $plugin->pro_check_interval );
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
return $transient;
|
350 |
+
}
|
351 |
}
|
352 |
?>
|
classes/views/frm-entries/errors.php
CHANGED
@@ -31,7 +31,7 @@ if(empty($frm_settings->invalid_msg)){
|
|
31 |
echo stripslashes($error) . '<br/>';
|
32 |
}
|
33 |
}else{
|
34 |
-
echo
|
35 |
|
36 |
$show_img = true;
|
37 |
foreach( $errors as $err_key => $error ){
|
31 |
echo stripslashes($error) . '<br/>';
|
32 |
}
|
33 |
}else{
|
34 |
+
echo $frm_settings->invalid_msg;
|
35 |
|
36 |
$show_img = true;
|
37 |
foreach( $errors as $err_key => $error ){
|
classes/views/frm-entries/form.php
CHANGED
@@ -23,7 +23,7 @@ echo FrmFormsHelper::replace_shortcodes($values['before_html'], $form, $title, $
|
|
23 |
|
24 |
if($values['fields']){
|
25 |
foreach($values['fields'] as $field){
|
26 |
-
$field_name =
|
27 |
if (apply_filters('frm_show_normal_field_type', true, $field['type']))
|
28 |
echo FrmFieldsHelper::replace_shortcodes($field['custom_html'], $field, $errors, $form);
|
29 |
else
|
@@ -52,7 +52,10 @@ if($frm_div){
|
|
52 |
</div>
|
53 |
</fieldset>
|
54 |
</div>
|
55 |
-
<?php echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form);
|
|
|
|
|
|
|
56 |
<script type="text/javascript">
|
57 |
<?php do_action('frm_entries_footer_scripts', $values['fields'], $form); ?>
|
58 |
-
</script
|
23 |
|
24 |
if($values['fields']){
|
25 |
foreach($values['fields'] as $field){
|
26 |
+
$field_name = 'item_meta['. $field['id'] .']';
|
27 |
if (apply_filters('frm_show_normal_field_type', true, $field['type']))
|
28 |
echo FrmFieldsHelper::replace_shortcodes($field['custom_html'], $field, $errors, $form);
|
29 |
else
|
52 |
</div>
|
53 |
</fieldset>
|
54 |
</div>
|
55 |
+
<?php echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form);
|
56 |
+
|
57 |
+
global $wp_filter;
|
58 |
+
if(isset($wp_filter['frm_entries_footer_scripts']) and !empty($wp_filter['frm_entries_footer_scripts'])){ ?>
|
59 |
<script type="text/javascript">
|
60 |
<?php do_action('frm_entries_footer_scripts', $values['fields'], $form); ?>
|
61 |
+
</script><?php } ?>
|
classes/views/frm-entries/frm-entry.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $user_ID, $frm_settings, $frm_created_entry, $frm_form_params;
|
3 |
$form_name = $form->name;
|
4 |
-
$form->options = stripslashes_deep(maybe_unserialize($form->options));
|
5 |
|
6 |
$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
|
7 |
$saved_message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
|
1 |
<?php
|
2 |
global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $user_ID, $frm_settings, $frm_created_entry, $frm_form_params;
|
3 |
$form_name = $form->name;
|
|
|
4 |
|
5 |
$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
|
6 |
$saved_message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
|
classes/views/frm-entries/list.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<div class="wrap">
|
2 |
<div id="icon-edit-pages" class="icon32"><br/></div>
|
3 |
-
<h2><?php echo ($form) ? (FrmAppHelper::truncate(
|
4 |
|
5 |
<?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
|
6 |
|
1 |
<div class="wrap">
|
2 |
<div id="icon-edit-pages" class="icon32"><br/></div>
|
3 |
+
<h2><?php echo ($form) ? (FrmAppHelper::truncate($form->name, 25) .' ') : ''; _e('Entries', 'formidable'); ?></h2>
|
4 |
|
5 |
<?php require(FRM_VIEWS_PATH.'/shared/errors.php'); ?>
|
6 |
|
classes/views/frm-entries/new.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<div class="frm_forms<?php echo ($values['custom_style']) ? ' with_frm_style' : ''; ?>" id="frm_form_<?php echo $form->id ?>_container">
|
2 |
-
<form enctype="multipart/form-data" method="post" class="frm-show-form <?php do_action('frm_form_classes', $form) ?>" id="form_<?php echo $form->form_key ?>" <?php echo ($frm_settings->use_html) ? '' : 'action=""'; ?>>
|
3 |
<?php
|
4 |
include(FRM_VIEWS_PATH.'/frm-entries/errors.php');
|
5 |
$form_action = 'create';
|
1 |
<div class="frm_forms<?php echo ($values['custom_style']) ? ' with_frm_style' : ''; ?>" id="frm_form_<?php echo $form->id ?>_container">
|
2 |
+
<form enctype="<?php echo apply_filters('frm_form_enctype', 'multipart/form-data', $form) ?>" method="post" class="frm-show-form <?php do_action('frm_form_classes', $form) ?>" id="form_<?php echo $form->form_key ?>" <?php echo ($frm_settings->use_html) ? '' : 'action=""'; ?>>
|
3 |
<?php
|
4 |
include(FRM_VIEWS_PATH.'/frm-entries/errors.php');
|
5 |
$form_action = 'create';
|
classes/views/frm-fields/import_choices.php
CHANGED
@@ -11,11 +11,7 @@
|
|
11 |
if ( is_multisite() )
|
12 |
wp_admin_css( 'ms' );
|
13 |
wp_enqueue_script('utils');
|
14 |
-
|
15 |
-
//3.4 hack
|
16 |
-
remove_action( 'admin_enqueue_scripts', '_wp_customize_loader_localize' );
|
17 |
-
|
18 |
-
do_action('admin_enqueue_scripts', $hook_suffix);
|
19 |
do_action('admin_print_styles');
|
20 |
do_action('admin_print_scripts');
|
21 |
|
@@ -74,7 +70,7 @@ if(is_array($fopt)){
|
|
74 |
</textarea>
|
75 |
|
76 |
<p class="submit clear">
|
77 |
-
<input type="button" onclick="window.top.frmUpdateOpts(<?php echo $field->id ?>,
|
78 |
<input type="button" onclick="window.top.tb_remove();" class="button" value="<?php _e('Cancel', 'formidable') ?>" />
|
79 |
</p>
|
80 |
</div>
|
11 |
if ( is_multisite() )
|
12 |
wp_admin_css( 'ms' );
|
13 |
wp_enqueue_script('utils');
|
14 |
+
|
|
|
|
|
|
|
|
|
15 |
do_action('admin_print_styles');
|
16 |
do_action('admin_print_scripts');
|
17 |
|
70 |
</textarea>
|
71 |
|
72 |
<p class="submit clear">
|
73 |
+
<input type="button" onclick="window.top.frmUpdateOpts(<?php echo $field->id ?>,jQuery('#frm_bulk_options').val()); window.top.tb_remove();" class="button-primary" value="<?php _e('Update Field Choices', 'formidable') ?>" />
|
74 |
<input type="button" onclick="window.top.tb_remove();" class="button" value="<?php _e('Cancel', 'formidable') ?>" />
|
75 |
</p>
|
76 |
</div>
|
classes/views/frm-fields/input.php
CHANGED
@@ -25,9 +25,14 @@
|
|
25 |
}else if ($field['type'] == 'select'){
|
26 |
if(isset($field['post_field']) and $field['post_field'] == 'post_category'){
|
27 |
echo FrmFieldsHelper::dropdown_categories(array('name' => $field_name, 'field' => $field) );
|
28 |
-
}else{
|
|
|
|
|
|
|
|
|
29 |
<select name="<?php echo $field_name ?>" id="field_<?php echo $field['field_key'] ?>" <?php do_action('frm_field_input_html', $field) ?>>
|
30 |
-
|
|
|
31 |
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
|
32 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
|
33 |
<option value="<?php echo esc_attr($field_val) ?>" <?php if (FrmAppHelper::check_selected($field['value'], $field_val)) echo 'selected="selected"'; ?>><?php echo $opt ?></option>
|
25 |
}else if ($field['type'] == 'select'){
|
26 |
if(isset($field['post_field']) and $field['post_field'] == 'post_category'){
|
27 |
echo FrmFieldsHelper::dropdown_categories(array('name' => $field_name, 'field' => $field) );
|
28 |
+
}else{
|
29 |
+
if($field['read_only'] and $frm_readonly != 'disabled' and (!current_user_can('administrator') or !is_admin())){ ?>
|
30 |
+
<input type="hidden" value="<?php echo esc_attr($field['value']) ?>" name="<?php echo $field_name ?>" id="field_<?php echo $field['field_key'] ?>" />
|
31 |
+
<select disabled="disabled" <?php do_action('frm_field_input_html', $field) ?>>
|
32 |
+
<?php }else{ ?>
|
33 |
<select name="<?php echo $field_name ?>" id="field_<?php echo $field['field_key'] ?>" <?php do_action('frm_field_input_html', $field) ?>>
|
34 |
+
<?php }
|
35 |
+
foreach ($field['options'] as $opt_key => $opt){
|
36 |
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
|
37 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
|
38 |
<option value="<?php echo esc_attr($field_val) ?>" <?php if (FrmAppHelper::check_selected($field['value'], $field_val)) echo 'selected="selected"'; ?>><?php echo $opt ?></option>
|
classes/views/frm-forms/add_field.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
|
8 |
<li id="frm_field_id_<?php echo $field['id']; ?>" class="form-field edit_form_item frm_field_box ui-state-default frm_hide_options<?php echo $display['options'] ?> edit_field_type_<?php echo $display['type'] ?> frm_top_container" onmouseover="frm_field_hover(1,<?php echo $field['id']; ?>)" onmouseout="frm_field_hover(0,<?php echo $field['id']; ?>)">
|
9 |
<a href="javascript:void(0);" class="alignright frm-show-hover frm-move frm-hover-icon" title="Move Field"><img src="<?php echo FRM_IMAGES_URL ?>/move.png" alt="Move" /></a>
|
10 |
-
<a href="javascript:frm_delete_field(<?php echo $field['id']; ?>)" class="alignright frm-show-hover frm-hover-icon" id="frm_delete_field<?php echo $field['id']; ?>" title="Delete Field"><img src="<?php echo FRM_IMAGES_URL ?>/trash.png" alt="Delete" /></a>
|
11 |
<a href="javascript:frm_duplicate_field(<?php echo $field['id']; ?>)" class="alignright frm-show-hover frm-hover-icon" title="<?php _e('Duplicate Field', 'formidable') ?>"><img src="<?php echo FRM_IMAGES_URL ?>/duplicate.png" alt="<?php _e('Duplicate', 'formidable') ?>" /></a>
|
12 |
<?php do_action('frm_extra_field_actions', $field['id']); ?>
|
13 |
|
@@ -44,7 +44,7 @@
|
|
44 |
|
45 |
<?php if (!isset($field['post_field']) or $field['post_field'] != 'post_category'){ ?>
|
46 |
<?php _e('or', 'formidable'); ?>
|
47 |
-
<a title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '"', $field['name']))), 20) . ' '. __('Field Choices', 'formidable'); ?>" href="<?php echo esc_url(
|
48 |
<?php } ?>
|
49 |
</div>
|
50 |
<?php
|
@@ -53,7 +53,9 @@
|
|
53 |
if(isset($field['post_field']) and $field['post_field'] == 'post_category'){
|
54 |
echo FrmFieldsHelper::dropdown_categories(array('name' => $field_name, 'field' => $field) );
|
55 |
}else{ ?>
|
56 |
-
<select name="<?php echo $field_name
|
|
|
|
|
57 |
<?php foreach ($field['options'] as $opt_key => $opt){
|
58 |
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
|
59 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
|
@@ -87,7 +89,7 @@
|
|
87 |
|
88 |
<?php if (!isset($field['post_field']) or $field['post_field'] != 'post_category'){ ?>
|
89 |
<?php _e('or', 'formidable'); ?>
|
90 |
-
<a title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '"', $field['name']))), 20) . ' '. __('Field Choices', 'formidable'); ?>" href="<?php echo esc_url(
|
91 |
<?php } ?>
|
92 |
</div>
|
93 |
<?php } ?>
|
7 |
|
8 |
<li id="frm_field_id_<?php echo $field['id']; ?>" class="form-field edit_form_item frm_field_box ui-state-default frm_hide_options<?php echo $display['options'] ?> edit_field_type_<?php echo $display['type'] ?> frm_top_container" onmouseover="frm_field_hover(1,<?php echo $field['id']; ?>)" onmouseout="frm_field_hover(0,<?php echo $field['id']; ?>)">
|
9 |
<a href="javascript:void(0);" class="alignright frm-show-hover frm-move frm-hover-icon" title="Move Field"><img src="<?php echo FRM_IMAGES_URL ?>/move.png" alt="Move" /></a>
|
10 |
+
<a href="javascript:frm_delete_field(<?php echo $field['id']; ?>)" class="alignright frm-show-hover frm-hover-icon" id="frm_delete_field<?php echo $field['id']; ?>" title="<?php _e('Delete Field', 'formidable') ?>"><img src="<?php echo FRM_IMAGES_URL ?>/trash.png" alt="Delete" /></a>
|
11 |
<a href="javascript:frm_duplicate_field(<?php echo $field['id']; ?>)" class="alignright frm-show-hover frm-hover-icon" title="<?php _e('Duplicate Field', 'formidable') ?>"><img src="<?php echo FRM_IMAGES_URL ?>/duplicate.png" alt="<?php _e('Duplicate', 'formidable') ?>" /></a>
|
12 |
<?php do_action('frm_extra_field_actions', $field['id']); ?>
|
13 |
|
44 |
|
45 |
<?php if (!isset($field['post_field']) or $field['post_field'] != 'post_category'){ ?>
|
46 |
<?php _e('or', 'formidable'); ?>
|
47 |
+
<a title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '"', $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>
|
48 |
<?php } ?>
|
49 |
</div>
|
50 |
<?php
|
53 |
if(isset($field['post_field']) and $field['post_field'] == 'post_category'){
|
54 |
echo FrmFieldsHelper::dropdown_categories(array('name' => $field_name, 'field' => $field) );
|
55 |
}else{ ?>
|
56 |
+
<select name="<?php echo $field_name; echo (isset($field['multiple']) and $field['multiple']) ? '[]' : ''; ?>" <?php
|
57 |
+
echo (isset($field['size']) && $field['size']) ? 'style="width:auto"' : '';
|
58 |
+
echo (isset($field['multiple']) and $field['multiple']) ? ' multiple="multiple"' : ''; ?> >
|
59 |
<?php foreach ($field['options'] as $opt_key => $opt){
|
60 |
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
|
61 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
|
89 |
|
90 |
<?php if (!isset($field['post_field']) or $field['post_field'] != 'post_category'){ ?>
|
91 |
<?php _e('or', 'formidable'); ?>
|
92 |
+
<a title="<?php echo FrmAppHelper::truncate(esc_attr(strip_tags(str_replace('"', '"', $field['name']))), 20) . ' '. __('Field Choices', 'formidable'); ?>" href="<?php echo esc_url(admin_url('admin-ajax.php') .'?plugin=formidable&controller=fields&frm_action=import_choices&field_id='. $field['id'] .'&TB_iframe=1') ?>" class="thickbox frm_orange"><?php _e('Bulk Edit Field Choices', 'formidable') ?></a>
|
93 |
<?php } ?>
|
94 |
</div>
|
95 |
<?php } ?>
|
classes/views/frm-forms/default-templates.php
CHANGED
@@ -18,16 +18,16 @@
|
|
18 |
?>
|
19 |
<tr class="<?php echo $alternate ?>">
|
20 |
<td class="post-title">
|
21 |
-
<a class="row-title" href="<?php echo $url = FrmFormsHelper::get_direct_link($form->form_key); ?>" title="<?php _e('Preview', 'formidable')?> <?php echo esc_attr(
|
22 |
<div class="row-actions">
|
23 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
24 |
-
<span><a href="?page=formidable&frm_action=duplicate&id=<?php echo $form->id; ?>" title="<?php _e('Copy', 'formidable') ?> <?php echo esc_attr(
|
25 |
<?php } ?>
|
26 |
<?php global $frm_settings;
|
27 |
if ($frm_settings->preview_page_id > 0)
|
28 |
$url = add_query_arg('form', $form->form_key, get_permalink($frm_settings->preview_page_id));
|
29 |
?>
|
30 |
-
<span><a href="<?php echo $url ?>" title="View <?php echo esc_attr(
|
31 |
</div>
|
32 |
</td>
|
33 |
<td><?php echo $form->description ?></td>
|
18 |
?>
|
19 |
<tr class="<?php echo $alternate ?>">
|
20 |
<td class="post-title">
|
21 |
+
<a class="row-title" href="<?php echo $url = FrmFormsHelper::get_direct_link($form->form_key); ?>" title="<?php _e('Preview', 'formidable')?> <?php echo esc_attr($form->name) ?>" target="blank"><?php echo $form->name; ?></a><br/>
|
22 |
<div class="row-actions">
|
23 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
24 |
+
<span><a href="?page=formidable&frm_action=duplicate&id=<?php echo $form->id; ?>" title="<?php _e('Copy', 'formidable') ?> <?php echo esc_attr($form->name); ?>"><?php _e('Create Form from Template', 'formidable') ?></a></span> |
|
25 |
<?php } ?>
|
26 |
<?php global $frm_settings;
|
27 |
if ($frm_settings->preview_page_id > 0)
|
28 |
$url = add_query_arg('form', $form->form_key, get_permalink($frm_settings->preview_page_id));
|
29 |
?>
|
30 |
+
<span><a href="<?php echo $url ?>" title="View <?php echo esc_attr($form->name) ?>" target="blank"><?php _e('View', 'formidable') ?></a></span>
|
31 |
</div>
|
32 |
</td>
|
33 |
<td><?php echo $form->description ?></td>
|
classes/views/frm-forms/list.php
CHANGED
@@ -75,7 +75,7 @@ if ($params['template']) require(FRM_VIEWS_PATH .'/frm-forms/default-templates.p
|
|
75 |
</th>
|
76 |
<th class="manage-column" width="60px"><?php _e('Entries', 'formidable') ?></th>
|
77 |
<th class="manage-column" width="115px"><?php _e('Direct Link', 'formidable') ?></th>
|
78 |
-
<th class="manage-column" width="115px"><?php _e('
|
79 |
<?php } ?>
|
80 |
</tr>
|
81 |
</thead>
|
@@ -107,19 +107,19 @@ if ($params['template']) require(FRM_VIEWS_PATH .'/frm-forms/default-templates.p
|
|
107 |
<?php if ($params['template']){ ?>
|
108 |
<td class="post-title">
|
109 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
110 |
-
<a class="row-title" href="?page=formidable&frm_action=edit&id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
111 |
<?php }else{
|
112 |
-
echo
|
113 |
} ?>
|
114 |
<br/>
|
115 |
<div class="row-actions">
|
116 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
117 |
-
<span><a href="?page=formidable&frm_action=duplicate&id=<?php echo $form->id; ?>" title="<?php _e('Copy', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
118 |
-
| <span class="edit"><a href="?page=formidable&frm_action=edit&id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
119 |
<?php } ?>
|
120 |
<?php do_action('frm_template_action_links', $form); ?>
|
121 |
<?php if(current_user_can('frm_delete_forms')){ ?>
|
122 |
-
| <span class="trash"><a href="?page=formidable&frm_=destroy&id=<?php echo $form->id; ?>" onclick="return confirm('<?php printf(__('Are you sure you want to delete your %1$s Form?', 'formidable'), strip_tags(
|
123 |
<?php } ?>
|
124 |
</div>
|
125 |
</td>
|
@@ -128,40 +128,40 @@ if ($params['template']) require(FRM_VIEWS_PATH .'/frm-forms/default-templates.p
|
|
128 |
<td><?php echo $form->id ?></td>
|
129 |
<td class="post-title">
|
130 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
131 |
-
<a class="row-title" href="?page=formidable&frm_action=edit&id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
132 |
<?php }else{
|
133 |
-
echo
|
134 |
}
|
135 |
?>
|
136 |
<br/>
|
137 |
<div class="row-actions">
|
138 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
139 |
-
<span class="edit"><a href="?page=formidable&frm_action=edit&id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
140 |
-
| <span><a href="?page=formidable&frm_action=settings&id=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags(
|
141 |
<?php } ?>
|
142 |
|
143 |
<?php if(current_user_can('frm_view_entries')){ ?>
|
144 |
-
| <span><a href="?page=formidable-entries&form=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags(
|
145 |
-
| <span><a href="?page=formidable-reports&form=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags(
|
146 |
<?php } ?>
|
147 |
|
148 |
<?php if($frmpro_is_installed and current_user_can('frm_create_entries')){ ?>
|
149 |
-
| <span><a href="?page=formidable-entries&frm_action=new&form=<?php echo $form->id; ?>" title="<?php _e('New', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
150 |
<?php } ?>
|
151 |
|
152 |
<?php if(current_user_can('frm_edit_forms') and $frmpro_is_installed){ ?>
|
153 |
-
<span><a href="?page=formidable&frm_action=duplicate&id=<?php echo $form->id; ?>" title="<?php _e('Copy', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
154 |
-
| <span><a href="?page=formidable&frm_action=duplicate&id=<?php echo $form->id; ?>&template=1" title="<?php _e('Create', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
155 |
-
| <span><a href="<?php echo FRM_SCRIPT_URL ?>&controller=forms&frm_action=export&id=<?php echo $form->id; ?>" title="<?php _e('Export', 'formidable') ?> <?php echo esc_attr(strip_tags(
|
156 |
<?php
|
157 |
}
|
158 |
|
159 |
if(current_user_can('frm_delete_forms')){ ?>
|
160 |
-
| <span class="trash"><a href="?page=formidable&frm_action=destroy&id=<?php echo $form->id; ?>" onclick="return confirm('<?php printf(__('Are you sure you want to delete your %1$s Form?', 'formidable'), strip_tags(
|
161 |
<?php } ?>
|
162 |
</div>
|
163 |
</td>
|
164 |
-
<td><?php echo
|
165 |
<td><?php echo $form->form_key ?></td>
|
166 |
<td><?php
|
167 |
$text = $frm_entry->getRecordCount($form->id);
|
@@ -195,7 +195,7 @@ if ($params['template']) require(FRM_VIEWS_PATH .'/frm-forms/default-templates.p
|
|
195 |
<th class="manage-column"><?php _e('Key', 'formidable') ?></th>
|
196 |
<th class="manage-column"><?php _e('Entries', 'formidable') ?></th>
|
197 |
<th class="manage-column"><?php _e('Direct Link', 'formidable') ?></th>
|
198 |
-
<th class="manage-column"><?php _e('
|
199 |
<?php } ?>
|
200 |
</tr>
|
201 |
</tfoot>
|
75 |
</th>
|
76 |
<th class="manage-column" width="60px"><?php _e('Entries', 'formidable') ?></th>
|
77 |
<th class="manage-column" width="115px"><?php _e('Direct Link', 'formidable') ?></th>
|
78 |
+
<th class="manage-column" width="115px"><?php _e('Shortcodes', 'formidable') ?></th>
|
79 |
<?php } ?>
|
80 |
</tr>
|
81 |
</thead>
|
107 |
<?php if ($params['template']){ ?>
|
108 |
<td class="post-title">
|
109 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
110 |
+
<a class="row-title" href="?page=formidable&frm_action=edit&id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)); ?>"><?php echo $form->name; ?></a>
|
111 |
<?php }else{
|
112 |
+
echo $form->name;
|
113 |
} ?>
|
114 |
<br/>
|
115 |
<div class="row-actions">
|
116 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
117 |
+
<span><a href="?page=formidable&frm_action=duplicate&id=<?php echo $form->id; ?>" title="<?php _e('Copy', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)); ?>"><?php _e('Create Form from Template', 'formidable') ?></a></span>
|
118 |
+
| <span class="edit"><a href="?page=formidable&frm_action=edit&id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)); ?>"><?php _e('Edit', 'formidable') ?></a></span>
|
119 |
<?php } ?>
|
120 |
<?php do_action('frm_template_action_links', $form); ?>
|
121 |
<?php if(current_user_can('frm_delete_forms')){ ?>
|
122 |
+
| <span class="trash"><a href="?page=formidable&frm_=destroy&id=<?php echo $form->id; ?>" onclick="return confirm('<?php printf(__('Are you sure you want to delete your %1$s Form?', 'formidable'), strip_tags($form->name)) ?>');" title="<?php _e('Delete', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)); ?>"><?php _e('Delete', 'formidable') ?></a></span>
|
123 |
<?php } ?>
|
124 |
</div>
|
125 |
</td>
|
128 |
<td><?php echo $form->id ?></td>
|
129 |
<td class="post-title">
|
130 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
131 |
+
<a class="row-title" href="?page=formidable&frm_action=edit&id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)); ?>"><?php echo $form->name; ?></a>
|
132 |
<?php }else{
|
133 |
+
echo $form->name;
|
134 |
}
|
135 |
?>
|
136 |
<br/>
|
137 |
<div class="row-actions">
|
138 |
<?php if(current_user_can('frm_edit_forms')){ ?>
|
139 |
+
<span class="edit"><a href="?page=formidable&frm_action=edit&id=<?php echo $form->id; ?>" title="<?php _e('Edit', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)) ?>"><?php _e('Edit', 'formidable') ?></a></span>
|
140 |
+
| <span><a href="?page=formidable&frm_action=settings&id=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags($form->name)) ?> <?php _e('Settings', 'formidable') ?>"><?php _e('Settings', 'formidable') ?></a></span>
|
141 |
<?php } ?>
|
142 |
|
143 |
<?php if(current_user_can('frm_view_entries')){ ?>
|
144 |
+
| <span><a href="?page=formidable-entries&form=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags($form->name)); ?> Entries"><?php _e('Entries', 'formidable') ?></a></span>
|
145 |
+
| <span><a href="?page=formidable-reports&form=<?php echo $form->id; ?>" title="<?php echo esc_attr(strip_tags($form->name)); ?> Reports"><?php _e('Reports', 'formidable') ?></a></span>
|
146 |
<?php } ?>
|
147 |
|
148 |
<?php if($frmpro_is_installed and current_user_can('frm_create_entries')){ ?>
|
149 |
+
| <span><a href="?page=formidable-entries&frm_action=new&form=<?php echo $form->id; ?>" title="<?php _e('New', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)) ?> <?php _e('Entry', 'formidable') ?>"><?php _e('New Entry', 'formidable') ?></a></span></br>
|
150 |
<?php } ?>
|
151 |
|
152 |
<?php if(current_user_can('frm_edit_forms') and $frmpro_is_installed){ ?>
|
153 |
+
<span><a href="?page=formidable&frm_action=duplicate&id=<?php echo $form->id; ?>" title="<?php _e('Copy', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)) ?>"><?php _e('Duplicate', 'formidable') ?></a></span>
|
154 |
+
| <span><a href="?page=formidable&frm_action=duplicate&id=<?php echo $form->id; ?>&template=1" title="<?php _e('Create', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)) ?> <?php _e('Template', 'formidable') ?>"><?php _e('Create Template', 'formidable') ?></a></span>
|
155 |
+
| <span><a href="<?php echo FRM_SCRIPT_URL ?>&controller=forms&frm_action=export&id=<?php echo $form->id; ?>" title="<?php _e('Export', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)) ?> <?php _e('Template', 'formidable') ?>"><?php _e('Export as Template', 'formidable') ?></a></span>
|
156 |
<?php
|
157 |
}
|
158 |
|
159 |
if(current_user_can('frm_delete_forms')){ ?>
|
160 |
+
| <span class="trash"><a href="?page=formidable&frm_action=destroy&id=<?php echo $form->id; ?>" onclick="return confirm('<?php printf(__('Are you sure you want to delete your %1$s Form?', 'formidable'), strip_tags($form->name)) ?>');" title="<?php _e('Delete', 'formidable') ?> <?php echo esc_attr(strip_tags($form->name)) ?>"><?php _e('Delete', 'formidable') ?></a></span>
|
161 |
<?php } ?>
|
162 |
</div>
|
163 |
</td>
|
164 |
+
<td><?php echo $form->description ?></td>
|
165 |
<td><?php echo $form->form_key ?></td>
|
166 |
<td><?php
|
167 |
$text = $frm_entry->getRecordCount($form->id);
|
195 |
<th class="manage-column"><?php _e('Key', 'formidable') ?></th>
|
196 |
<th class="manage-column"><?php _e('Entries', 'formidable') ?></th>
|
197 |
<th class="manage-column"><?php _e('Direct Link', 'formidable') ?></th>
|
198 |
+
<th class="manage-column"><?php _e('Shortcodes', 'formidable') ?></th>
|
199 |
<?php } ?>
|
200 |
</tr>
|
201 |
</tfoot>
|
classes/views/frm-forms/mb_insert_fields.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<div id="frm_adv_info" class="postbox">
|
2 |
-
<div class="handlediv" title="Click to toggle"><br
|
3 |
<div class="inside">
|
4 |
<div id="taxonomy-linkcategory" class="categorydiv">
|
5 |
<ul id="category-tabs" class="category-tabs frm-category-tabs">
|
1 |
<div id="frm_adv_info" class="postbox">
|
2 |
+
<div class="handlediv" title="<?php _e('Click to toggle', 'formidable') ?>"><br/></div><h3 class="hndle"><span><?php _e('Customization', 'formidable') ?></span></h3>
|
3 |
<div class="inside">
|
4 |
<div id="taxonomy-linkcategory" class="categorydiv">
|
5 |
<ul id="category-tabs" class="category-tabs frm-category-tabs">
|
classes/views/frm-forms/notification.php
CHANGED
@@ -50,7 +50,7 @@
|
|
50 |
} ?>
|
51 |
</select>
|
52 |
|
53 |
-
<div id="frm_cust_reply_container_<?php echo $email_key ?>" <?php echo ($notification['reply_to_name'] == 'custom' or $notification['
|
54 |
<span class="howto" style="visibility:hidden;"><?php _e('Name', 'formidable') ?></span>
|
55 |
<input type="text" name="notification[<?php echo $email_key ?>][cust_reply_to_name]" value="<?php echo esc_attr($notification['cust_reply_to_name']) ?>" id="cust_reply_to_name_<?php echo $email_key ?>" title="<?php _e('Name', 'formidable') ?>" <?php echo ($notification['reply_to_name'] == 'custom') ? '' : 'style="visibility:hidden;"'; ?> />
|
56 |
<span class="howto" style="visibility:hidden;"><?php _e('Email', 'formidable') ?></span>
|
50 |
} ?>
|
51 |
</select>
|
52 |
|
53 |
+
<div id="frm_cust_reply_container_<?php echo $email_key ?>" <?php echo ($notification['reply_to_name'] == 'custom' or $notification['reply_to'] == 'custom') ? '' : 'style="display:none"'; ?>>
|
54 |
<span class="howto" style="visibility:hidden;"><?php _e('Name', 'formidable') ?></span>
|
55 |
<input type="text" name="notification[<?php echo $email_key ?>][cust_reply_to_name]" value="<?php echo esc_attr($notification['cust_reply_to_name']) ?>" id="cust_reply_to_name_<?php echo $email_key ?>" title="<?php _e('Name', 'formidable') ?>" <?php echo ($notification['reply_to_name'] == 'custom') ? '' : 'style="visibility:hidden;"'; ?> />
|
56 |
<span class="howto" style="visibility:hidden;"><?php _e('Email', 'formidable') ?></span>
|
classes/views/frm-forms/settings.php
CHANGED
@@ -34,13 +34,13 @@
|
|
34 |
|
35 |
<div class="clear"></div>
|
36 |
|
37 |
-
|
38 |
-
|
39 |
<div id="poststuff" class="metabox-holder">
|
40 |
<div id="post-body">
|
41 |
<div class="meta-box-sortables">
|
42 |
<div class="categorydiv postbox">
|
43 |
-
<h3 class="hndle"><span><?php echo FrmAppHelper::truncate(
|
44 |
<div class="inside">
|
45 |
<div class="contextual-help-tabs">
|
46 |
<ul class="frm-category-tabs <?php if(version_compare( $GLOBALS['wp_version'], '3.3.0', '<')) echo 'category-tabs" id="category-tabs'; ?>">
|
@@ -55,27 +55,19 @@
|
|
55 |
</div>
|
56 |
<div style="display:block;" class="advanced_settings tabs-panel">
|
57 |
<table class="form-table">
|
58 |
-
<tr>
|
59 |
-
<td width="200px"><label><?php _e('Form ShortCodes', 'formidable') ?></label> <a href="http://formidablepro.com/knowledgebase/publish-your-forms/" target="_blank"><img src="<?php echo FRM_IMAGES_URL ?>/tooltip.png" alt="?" class="frm_help" title="<?php _e('Key and id are generally synonymous. For more information on using this shortcode, click now.', 'formidable') ?>" /></a></td>
|
60 |
-
<td><input type="text" style="width:255px; border:none; background:transparent;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable id=<?php echo $id; ?> title=true description=true]" /> <?php _e('or', 'formidable') ?>
|
61 |
-
<input type="text" style="width:200px; border:none; background:transparent;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable key=<?php echo $values['form_key']; ?>]" />
|
62 |
-
</td>
|
63 |
-
</tr>
|
64 |
-
|
65 |
<tr>
|
66 |
<td><label><?php _e('Form Key', 'formidable') ?></label></td>
|
67 |
<td><input type="text" name="form_key" value="<?php echo esc_attr($values['form_key']); ?>" /></td>
|
68 |
</tr>
|
69 |
|
70 |
-
<tr><td><label><?php _e('Styling', 'formidable') ?></label></td>
|
71 |
-
<td><input type="checkbox" name="options[custom_style]" id="custom_style" <?php echo ($values['custom_style']) ? ' checked="checked"' : ''; ?> value="1" />
|
72 |
-
<label for="custom_style"><?php _e('Use Formidable styling for this form', 'formidable') ?></label></td>
|
73 |
-
</tr>
|
74 |
-
|
75 |
<tr><td><label><?php _e('Submit Button Text', 'formidable') ?></label></td>
|
76 |
<td><input type="text" name="options[submit_value]" value="<?php echo esc_attr($values['submit_value']); ?>" /></td>
|
77 |
</tr>
|
78 |
|
|
|
|
|
|
|
|
|
79 |
<tr><td valign="top" colspan="2"><label><?php _e('Action After Form Submission', 'formidable') ?></label><br/>
|
80 |
<?php if(!$frmpro_is_installed){ ?>
|
81 |
<img src="<?php echo FRM_IMAGES_URL ?>/tooltip.png" alt="?" class="frm_help" title="<?php _e('You must upgrade to Formidable Pro to get access to the second two options.', 'formidable') ?>" />
|
@@ -92,13 +84,14 @@
|
|
92 |
</tr>
|
93 |
|
94 |
<tr class="success_action_message_box success_action_box" <?php echo ($values['success_action'] == 'message') ? '' : 'style="display:none;"'; ?>><td valign="top" colspan="2"><label><?php _e('Confirmation Message', 'formidable') ?></label>
|
95 |
-
<textarea id="success_msg" name="options[success_msg]" cols="50" rows="
|
96 |
<div class="frm_show_form_opt">
|
97 |
<input type="checkbox" name="options[show_form]" id="show_form" value="1" <?php checked($values['show_form'], 1) ?> /> <label for="show_form"><?php _e('Show the form with the success message.', 'formidable')?></label>
|
98 |
</div>
|
99 |
<td>
|
100 |
</tr>
|
101 |
|
|
|
102 |
<?php do_action('frm_additional_form_options', $values); ?>
|
103 |
|
104 |
<tr><td colspan="2"><input type="checkbox" name="options[no_save]" id="no_save" value="1" <?php checked($values['no_save'], 1); ?> /> <?php _e('Do not store any entries submitted from this form.', 'formidable') ?> <span class="howto"><?php _e('Warning: There is no way retrieve unsaved entries.', 'formidable') ?></span></td></tr>
|
@@ -142,7 +135,7 @@
|
|
142 |
foreach($values['fields'] as $field){
|
143 |
if (apply_filters('frm_show_custom_html', true, $field['type'])){ ?>
|
144 |
<p><label class="frm_primary_label"><?php echo $field['name'] ?></label>
|
145 |
-
<textarea name="field_options[custom_html_<?php echo $field['id'] ?>]" rows="7" id="custom_html_<?php echo $field['id'] ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea($field['custom_html']) ?></textarea></p>
|
146 |
<?php }
|
147 |
unset($field);
|
148 |
}
|
34 |
|
35 |
<div class="clear"></div>
|
36 |
|
37 |
+
<input type="hidden" name="id" value="<?php echo $id; ?>" />
|
38 |
+
<input type="hidden" name="frm_action" value="update_settings" />
|
39 |
<div id="poststuff" class="metabox-holder">
|
40 |
<div id="post-body">
|
41 |
<div class="meta-box-sortables">
|
42 |
<div class="categorydiv postbox">
|
43 |
+
<h3 class="hndle"><span><?php echo FrmAppHelper::truncate($values['name'], 40) .' '. __('Settings', 'formidable') ?></span></h3>
|
44 |
<div class="inside">
|
45 |
<div class="contextual-help-tabs">
|
46 |
<ul class="frm-category-tabs <?php if(version_compare( $GLOBALS['wp_version'], '3.3.0', '<')) echo 'category-tabs" id="category-tabs'; ?>">
|
55 |
</div>
|
56 |
<div style="display:block;" class="advanced_settings tabs-panel">
|
57 |
<table class="form-table">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
<tr>
|
59 |
<td><label><?php _e('Form Key', 'formidable') ?></label></td>
|
60 |
<td><input type="text" name="form_key" value="<?php echo esc_attr($values['form_key']); ?>" /></td>
|
61 |
</tr>
|
62 |
|
|
|
|
|
|
|
|
|
|
|
63 |
<tr><td><label><?php _e('Submit Button Text', 'formidable') ?></label></td>
|
64 |
<td><input type="text" name="options[submit_value]" value="<?php echo esc_attr($values['submit_value']); ?>" /></td>
|
65 |
</tr>
|
66 |
|
67 |
+
<tr><td colspan="2"><input type="checkbox" name="options[custom_style]" id="custom_style" <?php echo ($values['custom_style']) ? ' checked="checked"' : ''; ?> value="1" />
|
68 |
+
<label for="custom_style"><?php _e('Use Formidable styling for this form', 'formidable') ?></label></td>
|
69 |
+
</tr>
|
70 |
+
|
71 |
<tr><td valign="top" colspan="2"><label><?php _e('Action After Form Submission', 'formidable') ?></label><br/>
|
72 |
<?php if(!$frmpro_is_installed){ ?>
|
73 |
<img src="<?php echo FRM_IMAGES_URL ?>/tooltip.png" alt="?" class="frm_help" title="<?php _e('You must upgrade to Formidable Pro to get access to the second two options.', 'formidable') ?>" />
|
84 |
</tr>
|
85 |
|
86 |
<tr class="success_action_message_box success_action_box" <?php echo ($values['success_action'] == 'message') ? '' : 'style="display:none;"'; ?>><td valign="top" colspan="2"><label><?php _e('Confirmation Message', 'formidable') ?></label>
|
87 |
+
<textarea id="success_msg" name="options[success_msg]" cols="50" rows="3" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['success_msg']); ?></textarea> <br/>
|
88 |
<div class="frm_show_form_opt">
|
89 |
<input type="checkbox" name="options[show_form]" id="show_form" value="1" <?php checked($values['show_form'], 1) ?> /> <label for="show_form"><?php _e('Show the form with the success message.', 'formidable')?></label>
|
90 |
</div>
|
91 |
<td>
|
92 |
</tr>
|
93 |
|
94 |
+
|
95 |
<?php do_action('frm_additional_form_options', $values); ?>
|
96 |
|
97 |
<tr><td colspan="2"><input type="checkbox" name="options[no_save]" id="no_save" value="1" <?php checked($values['no_save'], 1); ?> /> <?php _e('Do not store any entries submitted from this form.', 'formidable') ?> <span class="howto"><?php _e('Warning: There is no way retrieve unsaved entries.', 'formidable') ?></span></td></tr>
|
135 |
foreach($values['fields'] as $field){
|
136 |
if (apply_filters('frm_show_custom_html', true, $field['type'])){ ?>
|
137 |
<p><label class="frm_primary_label"><?php echo $field['name'] ?></label>
|
138 |
+
<textarea name="field_options[custom_html_<?php echo $field['id'] ?>]" rows="7" id="custom_html_<?php echo $field['id'] ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea(stripslashes($field['custom_html'])) ?></textarea></p>
|
139 |
<?php }
|
140 |
unset($field);
|
141 |
}
|
classes/views/frm-forms/sidebar-settings.php
CHANGED
@@ -2,7 +2,18 @@
|
|
2 |
<?php if(!isset($hide_preview) or !$hide_preview){
|
3 |
if (!$values['is_template']){ ?>
|
4 |
<p class="howto" style="margin-top:0;"><?php _e('Insert into a post, page or text widget', 'formidable') ?>
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
<?php } ?>
|
7 |
|
8 |
<p class="frm_orange"><a href="<?php echo FrmFormsHelper::get_direct_link($values['form_key']); ?>" target="_blank"><?php _e('Preview', 'formidable') ?></a>
|
2 |
<?php if(!isset($hide_preview) or !$hide_preview){
|
3 |
if (!$values['is_template']){ ?>
|
4 |
<p class="howto" style="margin-top:0;"><?php _e('Insert into a post, page or text widget', 'formidable') ?>
|
5 |
+
<a href="http://formidablepro.com/knowledgebase/publish-your-forms/" target="_blank"><img src="<?php echo FRM_IMAGES_URL ?>/tooltip.png" alt="?" class="frm_help" title="<?php _e('Key and id are generally synonymous. For more information on using this shortcode, click now.', 'formidable') ?>" /></a>
|
6 |
+
<a href="#" onclick="frmToggleDiv('.frm_ext_sc')"><?php _e('Show more', 'formidable') ?></a>
|
7 |
+
<input type="text" style="text-align:center;font-weight:bold;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable id=<?php echo $id; ?>]" />
|
8 |
+
<span class="frm_ext_sc">
|
9 |
+
<input type="text" style="text-align:center;font-weight:bold;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable id=<?php echo $id; ?> title=true description=true]" />
|
10 |
+
<input type="text" style="text-align:center;font-weight:bold;width:100%;" readonly="true" onclick="this.select();" onfocus="this.select();" value="[formidable key=<?php echo $values['form_key']; ?>]" /><br/>
|
11 |
+
|
12 |
+
<?php _e('Insert in a template', 'formidable') ?>
|
13 |
+
<input type="text" style="font-size:10px;width:100%;text-align:center;" readonly="true" onclick="this.select();" onfocus="this.select();" value="<?php echo FrmAppController::get_form_shortcode(array('id' => <?php echo $id; ?>, 'title' => false, 'description' => false)); ?>" />
|
14 |
+
</span>
|