@@ -1,8 +1,8 @@ |
||
| 1 | -<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ($a == 'general_settings') ? 'frm_block' : 'frm_hidden'; ?>"> |
|
| 1 | +<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ( $a == 'general_settings' ) ? 'frm_block' : 'frm_hidden'; ?>"> |
|
| 2 | 2 | <?php if ( ! is_multisite() || is_super_admin() ) { ?> |
| 3 | 3 | <div class="postbox"> |
| 4 | 4 | <div class="inside"> |
| 5 | - <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> »</p> |
|
| 5 | + <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> »</p> |
|
| 6 | 6 | <p><?php _e( 'Ready to take your forms to the next level?<br/>Formidable Forms will help you create views, manage data, and get reports.', 'formidable' ) ?></p> |
| 7 | 7 | |
| 8 | 8 | <p>Already signed up? <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/knowledgebase/install-formidable-forms/' ) ) ?>" target="_blank"><?php _e( 'Click here', 'formidable' ) ?></a> to get installation instructions and download the pro version.</p> |
@@ -2,200 +2,200 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmEntriesController { |
| 4 | 4 | |
| 5 | - public static function menu() { |
|
| 5 | + public static function menu() { |
|
| 6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
| 7 | 7 | |
| 8 | - add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
| 8 | + add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
| 9 | 9 | |
| 10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
| 11 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 11 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 12 | 12 | add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' ); |
| 13 | 13 | add_filter( 'get_user_option_manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' ); |
| 14 | 14 | add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' ); |
| 15 | - } |
|
| 16 | - } |
|
| 15 | + } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - /* Display in Back End */ |
|
| 19 | - public static function route() { |
|
| 18 | + /* Display in Back End */ |
|
| 19 | + public static function route() { |
|
| 20 | 20 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 21 | 21 | |
| 22 | - switch ( $action ) { |
|
| 23 | - case 'show': |
|
| 24 | - case 'destroy': |
|
| 25 | - case 'destroy_all': |
|
| 26 | - return self::$action(); |
|
| 22 | + switch ( $action ) { |
|
| 23 | + case 'show': |
|
| 24 | + case 'destroy': |
|
| 25 | + case 'destroy_all': |
|
| 26 | + return self::$action(); |
|
| 27 | 27 | |
| 28 | - default: |
|
| 29 | - do_action( 'frm_entry_action_route', $action ); |
|
| 30 | - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
| 31 | - return; |
|
| 32 | - } |
|
| 28 | + default: |
|
| 29 | + do_action( 'frm_entry_action_route', $action ); |
|
| 30 | + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - return self::display_list(); |
|
| 35 | - } |
|
| 36 | - } |
|
| 34 | + return self::display_list(); |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | public static function contextual_help( $help, $screen_id, $screen ) { |
| 39 | - // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
| 40 | - if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
| 41 | - return $help; |
|
| 42 | - } |
|
| 39 | + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
| 40 | + if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
| 41 | + return $help; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
| 45 | 45 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
| 46 | 46 | if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) { |
| 47 | - return $help; |
|
| 48 | - } |
|
| 47 | + return $help; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | unset( $action, $page ); |
| 51 | 51 | |
| 52 | - $screen->add_help_tab( array( |
|
| 53 | - 'id' => 'formidable-entries-tab', |
|
| 54 | - 'title' => __( 'Overview', 'formidable' ), |
|
| 52 | + $screen->add_help_tab( array( |
|
| 53 | + 'id' => 'formidable-entries-tab', |
|
| 54 | + 'title' => __( 'Overview', 'formidable' ), |
|
| 55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
| 56 | - )); |
|
| 56 | + )); |
|
| 57 | 57 | |
| 58 | - $screen->set_help_sidebar( |
|
| 58 | + $screen->set_help_sidebar( |
|
| 59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
| 60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
| 61 | 61 | '<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
| 62 | - ); |
|
| 62 | + ); |
|
| 63 | 63 | |
| 64 | - return $help; |
|
| 65 | - } |
|
| 64 | + return $help; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | public static function manage_columns( $columns ) { |
| 68 | - global $frm_vars, $wpdb; |
|
| 68 | + global $frm_vars, $wpdb; |
|
| 69 | 69 | $form_id = FrmForm::get_current_form_id(); |
| 70 | 70 | |
| 71 | - $columns[ $form_id .'_id' ] = 'ID'; |
|
| 71 | + $columns[ $form_id .'_id' ] = 'ID'; |
|
| 72 | 72 | $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
| 73 | 73 | |
| 74 | - if ( ! $form_id ) { |
|
| 75 | - return $columns; |
|
| 76 | - } |
|
| 74 | + if ( ! $form_id ) { |
|
| 75 | + return $columns; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 78 | + $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 79 | 79 | |
| 80 | - foreach ( $form_cols as $form_col ) { |
|
| 80 | + foreach ( $form_cols as $form_col ) { |
|
| 81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
| 82 | - continue; |
|
| 83 | - } |
|
| 82 | + continue; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
| 85 | + if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
| 86 | 86 | $sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] ); |
| 87 | 87 | |
| 88 | - if ( $sub_form_cols ) { |
|
| 89 | - foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
| 88 | + if ( $sub_form_cols ) { |
|
| 89 | + foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
| 90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
| 91 | - unset( $sub_form_cols[ $k ] ); |
|
| 92 | - continue; |
|
| 93 | - } |
|
| 91 | + unset( $sub_form_cols[ $k ] ); |
|
| 92 | + continue; |
|
| 93 | + } |
|
| 94 | 94 | $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
| 95 | - unset($sub_form_col); |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - unset($sub_form_cols); |
|
| 99 | - } else { |
|
| 100 | - $col_id = $form_col->field_key; |
|
| 101 | - if ( $form_col->form_id != $form_id ) { |
|
| 102 | - $col_id .= '-_-form'. $form_col->form_id; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
| 106 | - $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 107 | - } |
|
| 108 | - $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 113 | - $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 114 | - $columns[ $form_id .'_ip' ] = 'IP'; |
|
| 115 | - |
|
| 116 | - $frm_vars['cols'] = $columns; |
|
| 95 | + unset($sub_form_col); |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + unset($sub_form_cols); |
|
| 99 | + } else { |
|
| 100 | + $col_id = $form_col->field_key; |
|
| 101 | + if ( $form_col->form_id != $form_id ) { |
|
| 102 | + $col_id .= '-_-form'. $form_col->form_id; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
| 106 | + $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 107 | + } |
|
| 108 | + $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 113 | + $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 114 | + $columns[ $form_id .'_ip' ] = 'IP'; |
|
| 115 | + |
|
| 116 | + $frm_vars['cols'] = $columns; |
|
| 117 | 117 | |
| 118 | 118 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
| 119 | 119 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) { |
| 120 | 120 | add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) ); |
| 121 | - } |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - return $columns; |
|
| 124 | - } |
|
| 123 | + return $columns; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
| 127 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 128 | - if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
| 129 | - return $check; |
|
| 130 | - } |
|
| 127 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 128 | + if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
| 129 | + return $check; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | if ( empty( $prev_value ) ) { |
| 133 | 133 | $prev_value = get_metadata( 'user', $object_id, $meta_key, true ); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - global $frm_vars; |
|
| 137 | - //add a check so we don't create a loop |
|
| 138 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
| 136 | + global $frm_vars; |
|
| 137 | + //add a check so we don't create a loop |
|
| 138 | + $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
| 139 | 139 | |
| 140 | - return $check; |
|
| 141 | - } |
|
| 140 | + return $check; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | - //add hidden columns back from other forms |
|
| 143 | + //add hidden columns back from other forms |
|
| 144 | 144 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
| 145 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 146 | - |
|
| 147 | - $sanitized = sanitize_title($frm_settings->menu); |
|
| 148 | - if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
| 149 | - return; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - global $frm_vars; |
|
| 153 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
| 154 | - return; //don't continue if there's no previous value |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - foreach ( $meta_value as $mk => $mv ) { |
|
| 158 | - //remove blank values |
|
| 159 | - if ( empty( $mv ) ) { |
|
| 160 | - unset( $meta_value[ $mk ] ); |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - $cur_form_prefix = reset($meta_value); |
|
| 165 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
| 166 | - $cur_form_prefix = $cur_form_prefix[0]; |
|
| 167 | - $save = false; |
|
| 168 | - |
|
| 169 | - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
| 145 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 146 | + |
|
| 147 | + $sanitized = sanitize_title($frm_settings->menu); |
|
| 148 | + if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
| 149 | + return; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + global $frm_vars; |
|
| 153 | + if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
| 154 | + return; //don't continue if there's no previous value |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + foreach ( $meta_value as $mk => $mv ) { |
|
| 158 | + //remove blank values |
|
| 159 | + if ( empty( $mv ) ) { |
|
| 160 | + unset( $meta_value[ $mk ] ); |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + $cur_form_prefix = reset($meta_value); |
|
| 165 | + $cur_form_prefix = explode('_', $cur_form_prefix); |
|
| 166 | + $cur_form_prefix = $cur_form_prefix[0]; |
|
| 167 | + $save = false; |
|
| 168 | + |
|
| 169 | + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
| 170 | 170 | if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) { |
| 171 | - //don't add blank cols or process included cols |
|
| 172 | - continue; |
|
| 173 | - } |
|
| 171 | + //don't add blank cols or process included cols |
|
| 172 | + continue; |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | $form_prefix = explode( '_', $prev_hidden ); |
| 176 | - $form_prefix = $form_prefix[0]; |
|
| 177 | - if ( $form_prefix == $cur_form_prefix ) { |
|
| 178 | - //don't add back columns that are meant to be hidden |
|
| 179 | - continue; |
|
| 180 | - } |
|
| 176 | + $form_prefix = $form_prefix[0]; |
|
| 177 | + if ( $form_prefix == $cur_form_prefix ) { |
|
| 178 | + //don't add back columns that are meant to be hidden |
|
| 179 | + continue; |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - $meta_value[] = $prev_hidden; |
|
| 183 | - $save = true; |
|
| 184 | - unset($form_prefix); |
|
| 185 | - } |
|
| 182 | + $meta_value[] = $prev_hidden; |
|
| 183 | + $save = true; |
|
| 184 | + unset($form_prefix); |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | 187 | if ( $save ) { |
| 188 | - $user = wp_get_current_user(); |
|
| 189 | - update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
| 190 | - } |
|
| 191 | - } |
|
| 188 | + $user = wp_get_current_user(); |
|
| 189 | + update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | 193 | public static function save_per_page( $save, $option, $value ) { |
| 194 | - if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
| 195 | - $save = (int) $value; |
|
| 196 | - } |
|
| 197 | - return $save; |
|
| 198 | - } |
|
| 194 | + if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
| 195 | + $save = (int) $value; |
|
| 196 | + } |
|
| 197 | + return $save; |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | 200 | public static function sortable_columns() { |
| 201 | 201 | $form_id = FrmForm::get_current_form_id(); |
@@ -221,226 +221,226 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public static function hidden_columns( $result ) { |
| 224 | - global $frm_vars; |
|
| 224 | + global $frm_vars; |
|
| 225 | 225 | |
| 226 | 226 | $form_id = FrmForm::get_current_form_id(); |
| 227 | 227 | |
| 228 | - $return = false; |
|
| 229 | - foreach ( (array) $result as $r ) { |
|
| 230 | - if ( ! empty( $r ) ) { |
|
| 231 | - $form_prefix = explode( '_', $r ); |
|
| 232 | - $form_prefix = $form_prefix[0]; |
|
| 228 | + $return = false; |
|
| 229 | + foreach ( (array) $result as $r ) { |
|
| 230 | + if ( ! empty( $r ) ) { |
|
| 231 | + $form_prefix = explode( '_', $r ); |
|
| 232 | + $form_prefix = $form_prefix[0]; |
|
| 233 | 233 | |
| 234 | - if ( (int) $form_prefix == (int) $form_id ) { |
|
| 235 | - $return = true; |
|
| 236 | - break; |
|
| 237 | - } |
|
| 234 | + if ( (int) $form_prefix == (int) $form_id ) { |
|
| 235 | + $return = true; |
|
| 236 | + break; |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - unset($form_prefix); |
|
| 240 | - } |
|
| 241 | - } |
|
| 239 | + unset($form_prefix); |
|
| 240 | + } |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | - if ( $return ) { |
|
| 243 | + if ( $return ) { |
|
| 244 | 244 | return $result; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
| 248 | - $max_columns = 8; |
|
| 249 | - if ( $i <= $max_columns ) { |
|
| 247 | + $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
| 248 | + $max_columns = 8; |
|
| 249 | + if ( $i <= $max_columns ) { |
|
| 250 | 250 | return $result; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - global $frm_vars; |
|
| 254 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
| 255 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
| 256 | - } |
|
| 253 | + global $frm_vars; |
|
| 254 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
| 255 | + $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
| 259 | - $result = $frm_vars['current_form']->options['hidden_cols']; |
|
| 260 | - } else { |
|
| 261 | - $cols = $frm_vars['cols']; |
|
| 262 | - $cols = array_reverse($cols, true); |
|
| 258 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
| 259 | + $result = $frm_vars['current_form']->options['hidden_cols']; |
|
| 260 | + } else { |
|
| 261 | + $cols = $frm_vars['cols']; |
|
| 262 | + $cols = array_reverse($cols, true); |
|
| 263 | 263 | |
| 264 | - $result[] = $form_id .'_id'; |
|
| 265 | - $i--; |
|
| 264 | + $result[] = $form_id .'_id'; |
|
| 265 | + $i--; |
|
| 266 | 266 | |
| 267 | - $result[] = $form_id .'_item_key'; |
|
| 268 | - $i--; |
|
| 267 | + $result[] = $form_id .'_item_key'; |
|
| 268 | + $i--; |
|
| 269 | 269 | |
| 270 | 270 | foreach ( $cols as $col_key => $col ) { |
| 271 | - if ( $i > $max_columns ) { |
|
| 271 | + if ( $i > $max_columns ) { |
|
| 272 | 272 | $result[] = $col_key; |
| 273 | 273 | } |
| 274 | - //remove some columns by default |
|
| 275 | - $i--; |
|
| 276 | - unset($col_key, $col); |
|
| 277 | - } |
|
| 278 | - } |
|
| 274 | + //remove some columns by default |
|
| 275 | + $i--; |
|
| 276 | + unset($col_key, $col); |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - return $result; |
|
| 281 | - } |
|
| 280 | + return $result; |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | 283 | public static function display_list( $message = '', $errors = array() ) { |
| 284 | - global $wpdb, $frm_vars; |
|
| 284 | + global $wpdb, $frm_vars; |
|
| 285 | 285 | |
| 286 | 286 | $form = FrmForm::get_current_form(); |
| 287 | 287 | $params = FrmForm::get_admin_params( $form ); |
| 288 | 288 | |
| 289 | - if ( $form ) { |
|
| 290 | - $params['form'] = $form->id; |
|
| 291 | - $frm_vars['current_form'] = $form; |
|
| 289 | + if ( $form ) { |
|
| 290 | + $params['form'] = $form->id; |
|
| 291 | + $frm_vars['current_form'] = $form; |
|
| 292 | 292 | |
| 293 | - if ( 'trash' == $form->status ) { |
|
| 294 | - $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
| 295 | - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
| 296 | - $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
| 297 | - unset( $time_to_delete, $delete_timestamp ); |
|
| 298 | - } |
|
| 293 | + if ( 'trash' == $form->status ) { |
|
| 294 | + $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
| 295 | + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
| 296 | + $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
| 297 | + unset( $time_to_delete, $delete_timestamp ); |
|
| 298 | + } |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
| 301 | + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
| 302 | 302 | |
| 303 | - $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
| 303 | + $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
| 304 | 304 | |
| 305 | - $pagenum = $wp_list_table->get_pagenum(); |
|
| 305 | + $pagenum = $wp_list_table->get_pagenum(); |
|
| 306 | 306 | |
| 307 | - $wp_list_table->prepare_items(); |
|
| 307 | + $wp_list_table->prepare_items(); |
|
| 308 | 308 | |
| 309 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 310 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 309 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 310 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 311 | 311 | $url = add_query_arg( 'paged', $total_pages ); |
| 312 | - if ( headers_sent() ) { |
|
| 313 | - echo FrmAppHelper::js_redirect($url); |
|
| 314 | - } else { |
|
| 315 | - wp_redirect( esc_url_raw( $url ) ); |
|
| 316 | - } |
|
| 317 | - die(); |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
| 321 | - $message = __( 'Your import is complete', 'formidable' ); |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
| 325 | - } |
|
| 326 | - |
|
| 327 | - /* Back End CRUD */ |
|
| 312 | + if ( headers_sent() ) { |
|
| 313 | + echo FrmAppHelper::js_redirect($url); |
|
| 314 | + } else { |
|
| 315 | + wp_redirect( esc_url_raw( $url ) ); |
|
| 316 | + } |
|
| 317 | + die(); |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + if ( empty($message) && isset($_GET['import-message']) ) { |
|
| 321 | + $message = __( 'Your import is complete', 'formidable' ); |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
| 325 | + } |
|
| 326 | + |
|
| 327 | + /* Back End CRUD */ |
|
| 328 | 328 | public static function show( $id = 0 ) { |
| 329 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
| 329 | + FrmAppHelper::permission_check('frm_view_entries'); |
|
| 330 | 330 | |
| 331 | - if ( ! $id ) { |
|
| 331 | + if ( ! $id ) { |
|
| 332 | 332 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
| 333 | 333 | |
| 334 | - if ( ! $id ) { |
|
| 334 | + if ( ! $id ) { |
|
| 335 | 335 | $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' ); |
| 336 | - } |
|
| 337 | - } |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | - $entry = FrmEntry::getOne($id, true); |
|
| 339 | + $entry = FrmEntry::getOne($id, true); |
|
| 340 | 340 | |
| 341 | - $data = maybe_unserialize($entry->description); |
|
| 341 | + $data = maybe_unserialize($entry->description); |
|
| 342 | 342 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
| 343 | 343 | $data = array( 'referrer' => $data ); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
| 347 | - $to_emails = array(); |
|
| 347 | + $to_emails = array(); |
|
| 348 | 348 | |
| 349 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
| 350 | - } |
|
| 349 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - public static function destroy() { |
|
| 353 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
| 352 | + public static function destroy() { |
|
| 353 | + FrmAppHelper::permission_check('frm_delete_entries'); |
|
| 354 | 354 | |
| 355 | 355 | $params = FrmForm::get_admin_params(); |
| 356 | 356 | |
| 357 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
| 358 | - //unlink entry from post |
|
| 359 | - global $wpdb; |
|
| 357 | + if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
| 358 | + //unlink entry from post |
|
| 359 | + global $wpdb; |
|
| 360 | 360 | $wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
| 361 | - } |
|
| 361 | + } |
|
| 362 | 362 | |
| 363 | - $message = ''; |
|
| 364 | - if ( FrmEntry::destroy( $params['id'] ) ) { |
|
| 365 | - $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
| 366 | - } |
|
| 363 | + $message = ''; |
|
| 364 | + if ( FrmEntry::destroy( $params['id'] ) ) { |
|
| 365 | + $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | - self::display_list( $message ); |
|
| 369 | - } |
|
| 368 | + self::display_list( $message ); |
|
| 369 | + } |
|
| 370 | 370 | |
| 371 | - public static function destroy_all() { |
|
| 372 | - if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
| 373 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 374 | - wp_die( $frm_settings->admin_permission ); |
|
| 375 | - } |
|
| 371 | + public static function destroy_all() { |
|
| 372 | + if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
| 373 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 374 | + wp_die( $frm_settings->admin_permission ); |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | - global $wpdb; |
|
| 377 | + global $wpdb; |
|
| 378 | 378 | $params = FrmForm::get_admin_params(); |
| 379 | - $message = ''; |
|
| 380 | - $errors = array(); |
|
| 381 | - $form_id = (int) $params['form']; |
|
| 379 | + $message = ''; |
|
| 380 | + $errors = array(); |
|
| 381 | + $form_id = (int) $params['form']; |
|
| 382 | 382 | |
| 383 | - if ( $form_id ) { |
|
| 384 | - $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
| 383 | + if ( $form_id ) { |
|
| 384 | + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
| 385 | 385 | $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 ); |
| 386 | 386 | |
| 387 | - if ( $action ) { |
|
| 388 | - // this action takes a while, so only trigger it if there are posts to delete |
|
| 389 | - foreach ( $entry_ids as $entry_id ) { |
|
| 390 | - do_action( 'frm_before_destroy_entry', $entry_id ); |
|
| 391 | - unset( $entry_id ); |
|
| 392 | - } |
|
| 393 | - } |
|
| 394 | - |
|
| 395 | - $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
| 396 | - $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
| 397 | - if ( $results ) { |
|
| 398 | - $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
| 399 | - } |
|
| 400 | - } else { |
|
| 401 | - $errors = __( 'No entries were specified', 'formidable' ); |
|
| 402 | - } |
|
| 403 | - |
|
| 404 | - self::display_list( $message, $errors ); |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
| 408 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
| 409 | - return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
| 410 | - } |
|
| 411 | - |
|
| 412 | - public static function get_form( $filename, $form, $title, $description ) { |
|
| 413 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
| 414 | - return FrmFormsController::get_form( $form, $title, $description ); |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - public static function process_entry( $errors = '', $ajax = false ) { |
|
| 387 | + if ( $action ) { |
|
| 388 | + // this action takes a while, so only trigger it if there are posts to delete |
|
| 389 | + foreach ( $entry_ids as $entry_id ) { |
|
| 390 | + do_action( 'frm_before_destroy_entry', $entry_id ); |
|
| 391 | + unset( $entry_id ); |
|
| 392 | + } |
|
| 393 | + } |
|
| 394 | + |
|
| 395 | + $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
| 396 | + $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
| 397 | + if ( $results ) { |
|
| 398 | + $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
| 399 | + } |
|
| 400 | + } else { |
|
| 401 | + $errors = __( 'No entries were specified', 'formidable' ); |
|
| 402 | + } |
|
| 403 | + |
|
| 404 | + self::display_list( $message, $errors ); |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
| 408 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
| 409 | + return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
| 410 | + } |
|
| 411 | + |
|
| 412 | + public static function get_form( $filename, $form, $title, $description ) { |
|
| 413 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
| 414 | + return FrmFormsController::get_form( $form, $title, $description ); |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + public static function process_entry( $errors = '', $ajax = false ) { |
|
| 418 | 418 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 419 | 419 | if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
| 420 | - return; |
|
| 421 | - } |
|
| 420 | + return; |
|
| 421 | + } |
|
| 422 | 422 | |
| 423 | - global $frm_vars; |
|
| 423 | + global $frm_vars; |
|
| 424 | 424 | |
| 425 | 425 | $form = FrmForm::getOne( $form_id ); |
| 426 | - if ( ! $form ) { |
|
| 427 | - return; |
|
| 428 | - } |
|
| 426 | + if ( ! $form ) { |
|
| 427 | + return; |
|
| 428 | + } |
|
| 429 | 429 | |
| 430 | 430 | $params = FrmForm::get_params( $form ); |
| 431 | 431 | |
| 432 | - if ( ! isset( $frm_vars['form_params'] ) ) { |
|
| 433 | - $frm_vars['form_params'] = array(); |
|
| 434 | - } |
|
| 432 | + if ( ! isset( $frm_vars['form_params'] ) ) { |
|
| 433 | + $frm_vars['form_params'] = array(); |
|
| 434 | + } |
|
| 435 | 435 | $frm_vars['form_params'][ $form->id ] = $params; |
| 436 | 436 | |
| 437 | 437 | if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
| 438 | - return; |
|
| 439 | - } |
|
| 438 | + return; |
|
| 439 | + } |
|
| 440 | 440 | |
| 441 | - if ( $errors == '' ) { |
|
| 441 | + if ( $errors == '' ) { |
|
| 442 | 442 | $errors = FrmEntryValidate::validate( $_POST ); |
| 443 | - } |
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | 445 | /** |
| 446 | 446 | * Use this filter to add trigger actions and add errors after |
@@ -451,102 +451,102 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
| 453 | 453 | |
| 454 | - if ( empty( $errors ) ) { |
|
| 454 | + if ( empty( $errors ) ) { |
|
| 455 | 455 | $_POST['frm_skip_cookie'] = 1; |
| 456 | - if ( $params['action'] == 'create' ) { |
|
| 456 | + if ( $params['action'] == 'create' ) { |
|
| 457 | 457 | if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
| 458 | 458 | $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
| 459 | - } |
|
| 460 | - } |
|
| 459 | + } |
|
| 460 | + } |
|
| 461 | 461 | |
| 462 | - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
| 462 | + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
| 463 | 463 | unset( $_POST['frm_skip_cookie'] ); |
| 464 | - } |
|
| 465 | - } |
|
| 466 | - |
|
| 467 | - public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
| 468 | - self::_delete_entry( $atts['id'], $form ); |
|
| 469 | - return $url; |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - //Delete entry if not redirected |
|
| 473 | - public static function delete_entry_after_save( $atts ) { |
|
| 474 | - self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
| 475 | - } |
|
| 476 | - |
|
| 477 | - private static function _delete_entry( $entry_id, $form ) { |
|
| 478 | - if ( ! $form ) { |
|
| 479 | - return; |
|
| 480 | - } |
|
| 481 | - |
|
| 482 | - $form->options = maybe_unserialize( $form->options ); |
|
| 483 | - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
| 484 | - FrmEntry::destroy( $entry_id ); |
|
| 485 | - } |
|
| 486 | - } |
|
| 464 | + } |
|
| 465 | + } |
|
| 466 | + |
|
| 467 | + public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
| 468 | + self::_delete_entry( $atts['id'], $form ); |
|
| 469 | + return $url; |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + //Delete entry if not redirected |
|
| 473 | + public static function delete_entry_after_save( $atts ) { |
|
| 474 | + self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + private static function _delete_entry( $entry_id, $form ) { |
|
| 478 | + if ( ! $form ) { |
|
| 479 | + return; |
|
| 480 | + } |
|
| 481 | + |
|
| 482 | + $form->options = maybe_unserialize( $form->options ); |
|
| 483 | + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
| 484 | + FrmEntry::destroy( $entry_id ); |
|
| 485 | + } |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | 488 | public static function show_entry_shortcode( $atts ) { |
| 489 | 489 | return FrmEntryFormat::show_entry( $atts ); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
| 493 | - $field = FrmField::getOne($meta->field_id); |
|
| 494 | - if ( ! $field ) { |
|
| 495 | - return $value; |
|
| 496 | - } |
|
| 492 | + public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
| 493 | + $field = FrmField::getOne($meta->field_id); |
|
| 494 | + if ( ! $field ) { |
|
| 495 | + return $value; |
|
| 496 | + } |
|
| 497 | 497 | |
| 498 | - $value = self::filter_display_value($value, $field, $atts); |
|
| 499 | - return $value; |
|
| 500 | - } |
|
| 498 | + $value = self::filter_display_value($value, $field, $atts); |
|
| 499 | + return $value; |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | 502 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
| 503 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
| 503 | + $plain_text = add_filter('frm_plain_text_email', true); |
|
| 504 | 504 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
| 505 | 505 | |
| 506 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
| 507 | - return $value; |
|
| 508 | - } |
|
| 506 | + if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
| 507 | + return $value; |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | - return self::filter_display_value($value, $field, $atts); |
|
| 511 | - } |
|
| 510 | + return self::filter_display_value($value, $field, $atts); |
|
| 511 | + } |
|
| 512 | 512 | |
| 513 | - public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
| 514 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
| 513 | + public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
| 514 | + $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
| 515 | 515 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
| 516 | - return $value; |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - $f_values = $f_labels = array(); |
|
| 520 | - |
|
| 521 | - foreach ( $field->options as $opt_key => $opt ) { |
|
| 522 | - if ( ! is_array($opt) ) { |
|
| 523 | - continue; |
|
| 524 | - } |
|
| 525 | - |
|
| 526 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
| 527 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
| 528 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
| 529 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
| 530 | - } |
|
| 531 | - unset($opt_key, $opt); |
|
| 532 | - } |
|
| 533 | - |
|
| 534 | - if ( ! empty($f_values) ) { |
|
| 535 | - foreach ( (array) $value as $v_key => $val ) { |
|
| 536 | - if ( in_array($val, $f_values) ) { |
|
| 537 | - $opt = array_search($val, $f_values); |
|
| 538 | - if ( is_array($value) ) { |
|
| 539 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
| 540 | - } else { |
|
| 541 | - $value = $f_labels[ $opt ]; |
|
| 542 | - } |
|
| 543 | - } |
|
| 544 | - unset($v_key, $val); |
|
| 545 | - } |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - return $value; |
|
| 549 | - } |
|
| 516 | + return $value; |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + $f_values = $f_labels = array(); |
|
| 520 | + |
|
| 521 | + foreach ( $field->options as $opt_key => $opt ) { |
|
| 522 | + if ( ! is_array($opt) ) { |
|
| 523 | + continue; |
|
| 524 | + } |
|
| 525 | + |
|
| 526 | + $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
| 527 | + $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
| 528 | + if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
| 529 | + unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
| 530 | + } |
|
| 531 | + unset($opt_key, $opt); |
|
| 532 | + } |
|
| 533 | + |
|
| 534 | + if ( ! empty($f_values) ) { |
|
| 535 | + foreach ( (array) $value as $v_key => $val ) { |
|
| 536 | + if ( in_array($val, $f_values) ) { |
|
| 537 | + $opt = array_search($val, $f_values); |
|
| 538 | + if ( is_array($value) ) { |
|
| 539 | + $value[ $v_key ] = $f_labels[ $opt ]; |
|
| 540 | + } else { |
|
| 541 | + $value = $f_labels[ $opt ]; |
|
| 542 | + } |
|
| 543 | + } |
|
| 544 | + unset($v_key, $val); |
|
| 545 | + } |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + return $value; |
|
| 549 | + } |
|
| 550 | 550 | |
| 551 | 551 | public static function get_params( $form = null ) { |
| 552 | 552 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' ); |
@@ -554,13 +554,13 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | public static function entry_sidebar( $entry ) { |
| 557 | - $data = maybe_unserialize($entry->description); |
|
| 558 | - $date_format = get_option('date_format'); |
|
| 559 | - $time_format = get_option('time_format'); |
|
| 557 | + $data = maybe_unserialize($entry->description); |
|
| 558 | + $date_format = get_option('date_format'); |
|
| 559 | + $time_format = get_option('time_format'); |
|
| 560 | 560 | if ( isset( $data['browser'] ) ) { |
| 561 | 561 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
| 565 | - } |
|
| 564 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
| 565 | + } |
|
| 566 | 566 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | public static function menu() { |
| 6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
| 7 | 7 | |
| 8 | - add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
| 8 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
| 9 | 9 | |
| 10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
| 11 | 11 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | $screen->add_help_tab( array( |
| 53 | 53 | 'id' => 'formidable-entries-tab', |
| 54 | 54 | 'title' => __( 'Overview', 'formidable' ), |
| 55 | - 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
|
| 56 | - )); |
|
| 55 | + 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
|
| 56 | + ) ); |
|
| 57 | 57 | |
| 58 | 58 | $screen->set_help_sidebar( |
| 59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
| 60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
| 61 | - '<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
|
| 61 | + '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | return $help; |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | global $frm_vars, $wpdb; |
| 69 | 69 | $form_id = FrmForm::get_current_form_id(); |
| 70 | 70 | |
| 71 | - $columns[ $form_id .'_id' ] = 'ID'; |
|
| 72 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 71 | + $columns[$form_id . '_id'] = 'ID'; |
|
| 72 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 73 | 73 | |
| 74 | 74 | if ( ! $form_id ) { |
| 75 | 75 | return $columns; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 78 | + $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
| 79 | 79 | |
| 80 | 80 | foreach ( $form_cols as $form_col ) { |
| 81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
@@ -88,30 +88,30 @@ discard block |
||
| 88 | 88 | if ( $sub_form_cols ) { |
| 89 | 89 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
| 90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
| 91 | - unset( $sub_form_cols[ $k ] ); |
|
| 91 | + unset( $sub_form_cols[$k] ); |
|
| 92 | 92 | continue; |
| 93 | 93 | } |
| 94 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 95 | - unset($sub_form_col); |
|
| 94 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 95 | + unset( $sub_form_col ); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | - unset($sub_form_cols); |
|
| 98 | + unset( $sub_form_cols ); |
|
| 99 | 99 | } else { |
| 100 | 100 | $col_id = $form_col->field_key; |
| 101 | 101 | if ( $form_col->form_id != $form_id ) { |
| 102 | - $col_id .= '-_-form'. $form_col->form_id; |
|
| 102 | + $col_id .= '-_-form' . $form_col->form_id; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
| 106 | - $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 105 | + if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) { |
|
| 106 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 107 | 107 | } |
| 108 | - $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 108 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 113 | - $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 114 | - $columns[ $form_id .'_ip' ] = 'IP'; |
|
| 112 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
| 113 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
| 114 | + $columns[$form_id . '_ip'] = 'IP'; |
|
| 115 | 115 | |
| 116 | 116 | $frm_vars['cols'] = $columns; |
| 117 | 117 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
| 127 | 127 | $frm_settings = FrmAppHelper::get_settings(); |
| 128 | - if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
| 128 | + if ( $meta_key != 'manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
| 129 | 129 | return $check; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | global $frm_vars; |
| 137 | 137 | //add a check so we don't create a loop |
| 138 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
| 138 | + $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
| 139 | 139 | |
| 140 | 140 | return $check; |
| 141 | 141 | } |
@@ -144,25 +144,25 @@ discard block |
||
| 144 | 144 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
| 145 | 145 | $frm_settings = FrmAppHelper::get_settings(); |
| 146 | 146 | |
| 147 | - $sanitized = sanitize_title($frm_settings->menu); |
|
| 148 | - if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
| 147 | + $sanitized = sanitize_title( $frm_settings->menu ); |
|
| 148 | + if ( $meta_key != 'manage' . $sanitized . '_page_formidable-entriescolumnshidden' ) { |
|
| 149 | 149 | return; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | global $frm_vars; |
| 153 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
| 153 | + if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
|
| 154 | 154 | return; //don't continue if there's no previous value |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | foreach ( $meta_value as $mk => $mv ) { |
| 158 | 158 | //remove blank values |
| 159 | - if ( empty( $mv ) ) { |
|
| 160 | - unset( $meta_value[ $mk ] ); |
|
| 159 | + if ( empty( $mv ) ) { |
|
| 160 | + unset( $meta_value[$mk] ); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - $cur_form_prefix = reset($meta_value); |
|
| 165 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
| 164 | + $cur_form_prefix = reset( $meta_value ); |
|
| 165 | + $cur_form_prefix = explode( '_', $cur_form_prefix ); |
|
| 166 | 166 | $cur_form_prefix = $cur_form_prefix[0]; |
| 167 | 167 | $save = false; |
| 168 | 168 | |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | $meta_value[] = $prev_hidden; |
| 183 | 183 | $save = true; |
| 184 | - unset($form_prefix); |
|
| 184 | + unset( $form_prefix ); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if ( $save ) { |
| 188 | 188 | $user = wp_get_current_user(); |
| 189 | - update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
| 189 | + update_user_option( $user->ID, 'manage' . $sanitized . '_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | foreach ( $fields as $field ) { |
| 214 | 214 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
| 215 | 215 | // Can't sort on checkboxes because they are stored serialized, or post fields |
| 216 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
| 216 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | break; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - unset($form_prefix); |
|
| 239 | + unset( $form_prefix ); |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
@@ -244,36 +244,36 @@ discard block |
||
| 244 | 244 | return $result; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
| 247 | + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; |
|
| 248 | 248 | $max_columns = 8; |
| 249 | 249 | if ( $i <= $max_columns ) { |
| 250 | 250 | return $result; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | global $frm_vars; |
| 254 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
| 255 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
| 254 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) { |
|
| 255 | + $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options ); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
| 258 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) { |
|
| 259 | 259 | $result = $frm_vars['current_form']->options['hidden_cols']; |
| 260 | 260 | } else { |
| 261 | 261 | $cols = $frm_vars['cols']; |
| 262 | - $cols = array_reverse($cols, true); |
|
| 262 | + $cols = array_reverse( $cols, true ); |
|
| 263 | 263 | |
| 264 | - $result[] = $form_id .'_id'; |
|
| 265 | - $i--; |
|
| 264 | + $result[] = $form_id . '_id'; |
|
| 265 | + $i --; |
|
| 266 | 266 | |
| 267 | - $result[] = $form_id .'_item_key'; |
|
| 268 | - $i--; |
|
| 267 | + $result[] = $form_id . '_item_key'; |
|
| 268 | + $i --; |
|
| 269 | 269 | |
| 270 | 270 | foreach ( $cols as $col_key => $col ) { |
| 271 | 271 | if ( $i > $max_columns ) { |
| 272 | 272 | $result[] = $col_key; |
| 273 | 273 | } |
| 274 | 274 | //remove some columns by default |
| 275 | - $i--; |
|
| 276 | - unset($col_key, $col); |
|
| 275 | + $i --; |
|
| 276 | + unset( $col_key, $col ); |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
@@ -310,23 +310,23 @@ discard block |
||
| 310 | 310 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
| 311 | 311 | $url = add_query_arg( 'paged', $total_pages ); |
| 312 | 312 | if ( headers_sent() ) { |
| 313 | - echo FrmAppHelper::js_redirect($url); |
|
| 313 | + echo FrmAppHelper::js_redirect( $url ); |
|
| 314 | 314 | } else { |
| 315 | 315 | wp_redirect( esc_url_raw( $url ) ); |
| 316 | 316 | } |
| 317 | 317 | die(); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
| 320 | + if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
|
| 321 | 321 | $message = __( 'Your import is complete', 'formidable' ); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
| 324 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /* Back End CRUD */ |
| 328 | 328 | public static function show( $id = 0 ) { |
| 329 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
| 329 | + FrmAppHelper::permission_check( 'frm_view_entries' ); |
|
| 330 | 330 | |
| 331 | 331 | if ( ! $id ) { |
| 332 | 332 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $entry = FrmEntry::getOne($id, true); |
|
| 339 | + $entry = FrmEntry::getOne( $id, true ); |
|
| 340 | 340 | |
| 341 | - $data = maybe_unserialize($entry->description); |
|
| 341 | + $data = maybe_unserialize( $entry->description ); |
|
| 342 | 342 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
| 343 | 343 | $data = array( 'referrer' => $data ); |
| 344 | 344 | } |
@@ -346,18 +346,18 @@ discard block |
||
| 346 | 346 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
| 347 | 347 | $to_emails = array(); |
| 348 | 348 | |
| 349 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
| 349 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | public static function destroy() { |
| 353 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
| 353 | + FrmAppHelper::permission_check( 'frm_delete_entries' ); |
|
| 354 | 354 | |
| 355 | 355 | $params = FrmForm::get_admin_params(); |
| 356 | 356 | |
| 357 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
| 357 | + if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
|
| 358 | 358 | //unlink entry from post |
| 359 | 359 | global $wpdb; |
| 360 | - $wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
|
| 360 | + $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $message = ''; |
@@ -432,9 +432,9 @@ discard block |
||
| 432 | 432 | if ( ! isset( $frm_vars['form_params'] ) ) { |
| 433 | 433 | $frm_vars['form_params'] = array(); |
| 434 | 434 | } |
| 435 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
| 435 | + $frm_vars['form_params'][$form->id] = $params; |
|
| 436 | 436 | |
| 437 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
| 437 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
| 438 | 438 | return; |
| 439 | 439 | } |
| 440 | 440 | |
@@ -449,13 +449,13 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
| 451 | 451 | |
| 452 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
| 452 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
| 453 | 453 | |
| 454 | 454 | if ( empty( $errors ) ) { |
| 455 | 455 | $_POST['frm_skip_cookie'] = 1; |
| 456 | 456 | if ( $params['action'] == 'create' ) { |
| 457 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
| 458 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
| 457 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
| 458 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
@@ -490,28 +490,28 @@ discard block |
||
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
| 493 | - $field = FrmField::getOne($meta->field_id); |
|
| 493 | + $field = FrmField::getOne( $meta->field_id ); |
|
| 494 | 494 | if ( ! $field ) { |
| 495 | 495 | return $value; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | - $value = self::filter_display_value($value, $field, $atts); |
|
| 498 | + $value = self::filter_display_value( $value, $field, $atts ); |
|
| 499 | 499 | return $value; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
| 503 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
| 503 | + $plain_text = add_filter( 'frm_plain_text_email', true ); |
|
| 504 | 504 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
| 505 | 505 | |
| 506 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
| 506 | + if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) { |
|
| 507 | 507 | return $value; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - return self::filter_display_value($value, $field, $atts); |
|
| 510 | + return self::filter_display_value( $value, $field, $atts ); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | public static function &filter_display_value( $value, $field, $atts = array() ) { |
| 514 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
| 514 | + $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false; |
|
| 515 | 515 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
| 516 | 516 | return $value; |
| 517 | 517 | } |
@@ -519,29 +519,29 @@ discard block |
||
| 519 | 519 | $f_values = $f_labels = array(); |
| 520 | 520 | |
| 521 | 521 | foreach ( $field->options as $opt_key => $opt ) { |
| 522 | - if ( ! is_array($opt) ) { |
|
| 522 | + if ( ! is_array( $opt ) ) { |
|
| 523 | 523 | continue; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
| 527 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
| 528 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
| 529 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
| 526 | + $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
| 527 | + $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key]; |
|
| 528 | + if ( $f_labels[$opt_key] == $f_values[$opt_key] ) { |
|
| 529 | + unset( $f_values[$opt_key], $f_labels[$opt_key] ); |
|
| 530 | 530 | } |
| 531 | - unset($opt_key, $opt); |
|
| 531 | + unset( $opt_key, $opt ); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - if ( ! empty($f_values) ) { |
|
| 534 | + if ( ! empty( $f_values ) ) { |
|
| 535 | 535 | foreach ( (array) $value as $v_key => $val ) { |
| 536 | - if ( in_array($val, $f_values) ) { |
|
| 537 | - $opt = array_search($val, $f_values); |
|
| 538 | - if ( is_array($value) ) { |
|
| 539 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
| 536 | + if ( in_array( $val, $f_values ) ) { |
|
| 537 | + $opt = array_search( $val, $f_values ); |
|
| 538 | + if ( is_array( $value ) ) { |
|
| 539 | + $value[$v_key] = $f_labels[$opt]; |
|
| 540 | 540 | } else { |
| 541 | - $value = $f_labels[ $opt ]; |
|
| 541 | + $value = $f_labels[$opt]; |
|
| 542 | 542 | } |
| 543 | 543 | } |
| 544 | - unset($v_key, $val); |
|
| 544 | + unset( $v_key, $val ); |
|
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | |
@@ -554,13 +554,13 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | public static function entry_sidebar( $entry ) { |
| 557 | - $data = maybe_unserialize($entry->description); |
|
| 558 | - $date_format = get_option('date_format'); |
|
| 559 | - $time_format = get_option('time_format'); |
|
| 557 | + $data = maybe_unserialize( $entry->description ); |
|
| 558 | + $date_format = get_option( 'date_format' ); |
|
| 559 | + $time_format = get_option( 'time_format' ); |
|
| 560 | 560 | if ( isset( $data['browser'] ) ) { |
| 561 | 561 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
| 564 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
|
| 565 | 565 | } |
| 566 | 566 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | <a href="?page=formidable-styles&page-tab=default#tabs-panel-default-color" class="nav-tab-link" data-type="tabs-panel-default-color"><?php _e( 'Default', 'formidable' ) ?></a> |
| 5 | 5 | </li> |
| 6 | 6 | <li <?php echo ( 'active-color' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 7 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=active-color#page-active-color') ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
| 7 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=active-color#page-active-color' ) ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
| 8 | 8 | </li> |
| 9 | 9 | <li <?php echo ( 'active-error' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 10 | 10 | <a href="?page=formidable-styles&page-tab=active-error#tabs-panel-active-error" class="nav-tab-link" data-type="tabs-panel-active-error"><?php _e( 'Error', 'formidable' ) ?></a> |
@@ -19,34 +19,34 @@ discard block |
||
| 19 | 19 | ?>"> |
| 20 | 20 | <div class="field-group field-group-border clearfix"> |
| 21 | 21 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
| 22 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color') ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
| 22 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color' ) ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
| 23 | 23 | </div> |
| 24 | 24 | <div class="field-group clearfix"> |
| 25 | 25 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 26 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color') ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
| 26 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color' ) ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
| 27 | 27 | </div> |
| 28 | 28 | |
| 29 | 29 | <div class="field-group field-group-border clearfix"> |
| 30 | 30 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 31 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color') ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
| 31 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color' ) ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
| 32 | 32 | </div> |
| 33 | 33 | <div class="field-group clearfix"> |
| 34 | 34 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
| 35 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_border_width') ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
| 35 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_width' ) ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
| 36 | 36 | </div> |
| 37 | 37 | <div class="field-group clearfix"> |
| 38 | 38 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
| 39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_border_style') ) ?>" id="frm_field_border_style"> |
|
| 40 | - <option value="solid" <?php selected($style->post_content['field_border_style'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
| 41 | - <option value="dotted" <?php selected($style->post_content['field_border_style'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
| 42 | - <option value="dashed" <?php selected($style->post_content['field_border_style'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
| 43 | - <option value="double" <?php selected($style->post_content['field_border_style'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
| 39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_style' ) ) ?>" id="frm_field_border_style"> |
|
| 40 | + <option value="solid" <?php selected( $style->post_content['field_border_style'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
| 41 | + <option value="dotted" <?php selected( $style->post_content['field_border_style'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
| 42 | + <option value="dashed" <?php selected( $style->post_content['field_border_style'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
| 43 | + <option value="double" <?php selected( $style->post_content['field_border_style'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
| 44 | 44 | </select> |
| 45 | 45 | </div> |
| 46 | 46 | <div class="clear"></div> |
| 47 | 47 | <p class="frm_no_bottom_margin"> |
| 48 | 48 | <label> |
| 49 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow') ) ?>" id="frm_remove_box_shadow" value="1" <?php checked($style->post_content['remove_box_shadow'], 1) ?> /> |
|
| 49 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow' ) ) ?>" id="frm_remove_box_shadow" value="1" <?php checked( $style->post_content['remove_box_shadow'], 1 ) ?> /> |
|
| 50 | 50 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
| 51 | 51 | </label> |
| 52 | 52 | </p> |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | ?>"> |
| 58 | 58 | <div class="field-group field-group-border clearfix"> |
| 59 | 59 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
| 60 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_active') ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
| 60 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_active' ) ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
| 61 | 61 | </div> |
| 62 | 62 | <div class="field-group clearfix"> |
| 63 | 63 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 64 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_active') ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
| 64 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_active' ) ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
| 65 | 65 | </div> |
| 66 | 66 | <div class="clear"></div> |
| 67 | 67 | <p class="frm_no_bottom_margin"> |
| 68 | 68 | <label> |
| 69 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow_active') ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked($style->post_content['remove_box_shadow_active'], 1) ?> /> |
|
| 69 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow_active' ) ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked( $style->post_content['remove_box_shadow_active'], 1 ) ?> /> |
|
| 70 | 70 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
| 71 | 71 | </label> |
| 72 | 72 | </p> |
@@ -77,28 +77,28 @@ discard block |
||
| 77 | 77 | ?>"> |
| 78 | 78 | <div class="field-group field-group-border clearfix"> |
| 79 | 79 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
| 80 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_error') ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
| 80 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_error' ) ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
| 81 | 81 | </div> |
| 82 | 82 | <div class="field-group clearfix"> |
| 83 | 83 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 84 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_error') ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
| 84 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_error' ) ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
| 85 | 85 | </div> |
| 86 | 86 | |
| 87 | 87 | <div class="field-group field-group-border clearfix"> |
| 88 | 88 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 89 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_error') ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
| 89 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_error' ) ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
| 90 | 90 | </div> |
| 91 | 91 | <div class="field-group clearfix"> |
| 92 | 92 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
| 93 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_width_error') ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
| 93 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_width_error' ) ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
| 94 | 94 | </div> |
| 95 | 95 | <div class="field-group clearfix"> |
| 96 | 96 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
| 97 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('border_style_error') ) ?>" id="frm_border_style_error"> |
|
| 98 | - <option value="solid" <?php selected($style->post_content['border_style_error'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
| 99 | - <option value="dotted" <?php selected($style->post_content['border_style_error'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
| 100 | - <option value="dashed" <?php selected($style->post_content['border_style_error'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
| 101 | - <option value="double" <?php selected($style->post_content['border_style_error'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
| 97 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'border_style_error' ) ) ?>" id="frm_border_style_error"> |
|
| 98 | + <option value="solid" <?php selected( $style->post_content['border_style_error'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
| 99 | + <option value="dotted" <?php selected( $style->post_content['border_style_error'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
| 100 | + <option value="dashed" <?php selected( $style->post_content['border_style_error'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
| 101 | + <option value="double" <?php selected( $style->post_content['border_style_error'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
| 102 | 102 | </select> |
| 103 | 103 | </div> |
| 104 | 104 | |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | ?>"> |
| 111 | 111 | <div class="field-group field-group-border clearfix"> |
| 112 | 112 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
| 113 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_disabled') ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
| 113 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_disabled' ) ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
| 114 | 114 | </div> |
| 115 | 115 | <div class="field-group clearfix"> |
| 116 | 116 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 117 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_disabled') ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
| 117 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_disabled' ) ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
| 118 | 118 | </div> |
| 119 | 119 | |
| 120 | 120 | <div class="field-group clearfix"> |
| 121 | 121 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 122 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_disabled') ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
| 122 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_disabled' ) ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
| 123 | 123 | </div> |
| 124 | 124 | <div class="clear"></div> |
| 125 | 125 | </div><!-- /.tabs-panel --> |
@@ -1,42 +1,42 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_font_size') ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_font_size' ) ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Height', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_height') ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_height' ) ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | 11 | <div class="field-group clearfix frm-first-row"> |
| 12 | 12 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
| 13 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_width') ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
| 13 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_width' ) ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
| 14 | 14 | </div> |
| 15 | 15 | |
| 16 | 16 | <div class="clear"></div> |
| 17 | 17 | <p class="frm_no_bottom_margin"> |
| 18 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('auto_width') ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
| 18 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'auto_width' ) ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
| 19 | 19 | <?php _e( 'Automatic Width for drop-down fields', 'formidable' ) ?></label> |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <div class="field-group clearfix"> |
| 23 | 23 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 24 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_pad') ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
| 24 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_pad' ) ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
| 25 | 25 | </div> |
| 26 | 26 | |
| 27 | 27 | <div class="field-group clearfix"> |
| 28 | 28 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
| 29 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_margin') ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
| 29 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_margin' ) ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
| 30 | 30 | </div> |
| 31 | 31 | |
| 32 | 32 | <div class="field-group clearfix"> |
| 33 | 33 | <label><?php _e( 'Corners', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Formidable uses CSS3 border-radius for corner rounding, which is not currently supported by Internet Explorer.', 'formidable' ) ?>" ></span></label> |
| 34 | - <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('border_radius') ) ?>" id="frm_border_radius" /> |
|
| 34 | + <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_radius' ) ) ?>" id="frm_border_radius" /> |
|
| 35 | 35 | </div> |
| 36 | 36 | |
| 37 | 37 | <div class="field-group clearfix frm-first-row"> |
| 38 | 38 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
| 39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_weight') ) ?>" id="frm_field_weight"> |
|
| 39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_weight' ) ) ?>" id="frm_field_weight"> |
|
| 40 | 40 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
| 41 | 41 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['field_weight'], $value ) ?>><?php echo $name ?></option> |
| 42 | 42 | <?php } ?> |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_size') ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_size' ) ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-half frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_color') ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_color' ) ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | <div class="field-group clearfix frm-half"> |
| 11 | 11 | <label><?php _e( 'Margin Top', 'formidable' ) ?></label> |
| 12 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_top') ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" /> |
|
| 12 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_top' ) ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" /> |
|
| 13 | 13 | </div> |
| 14 | 14 | <div class="field-group clearfix frm-half"> |
| 15 | 15 | <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label> |
| 16 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_bottom') ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" /> |
|
| 16 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_bottom' ) ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" /> |
|
| 17 | 17 | </div> |
| 18 | 18 | \ No newline at end of file |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_size') ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_size' ) ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-half frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_color') ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_color' ) ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | <div class="field-group clearfix frm-half"> |
| 11 | 11 | <label><?php _e( 'Margin Top', 'formidable' ) ?></label> |
| 12 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_top') ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" /> |
|
| 12 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_top' ) ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" /> |
|
| 13 | 13 | </div> |
| 14 | 14 | <div class="field-group clearfix frm-half"> |
| 15 | 15 | <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label> |
| 16 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_bottom') ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" /> |
|
| 16 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_bottom' ) ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" /> |
|
| 17 | 17 | </div> |
| 18 | 18 | \ No newline at end of file |
@@ -1,59 +1,59 @@ |
||
| 1 | 1 | <p> |
| 2 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('center_form') ) ?>" id="frm_center_form" value="1" <?php checked($style->post_content['center_form'], 1) ?> /> |
|
| 2 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'center_form' ) ) ?>" id="frm_center_form" value="1" <?php checked( $style->post_content['center_form'], 1 ) ?> /> |
|
| 3 | 3 | <?php _e( 'Center form on page', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will center your form on the page where it is published if the form width is less than the available width on the page.', 'formidable' ) ?>" ></span> |
| 4 | 4 | </label> |
| 5 | 5 | </p> |
| 6 | 6 | |
| 7 | 7 | <div class="field-group clearfix frm-first-row"> |
| 8 | 8 | <label><?php _e( 'Alignment', 'formidable' ) ?></label> |
| 9 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align"> |
|
| 10 | - <option value="left" <?php selected($style->post_content['form_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 11 | - <option value="right" <?php selected($style->post_content['form_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 12 | - <option value="center" <?php selected($style->post_content['form_align'], 'center') ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
| 9 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'form_align' ) ) ?>" id="frm_form_align"> |
|
| 10 | + <option value="left" <?php selected( $style->post_content['form_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 11 | + <option value="right" <?php selected( $style->post_content['form_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 12 | + <option value="center" <?php selected( $style->post_content['form_align'], 'center' ) ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
| 13 | 13 | </select> |
| 14 | 14 | </div> |
| 15 | 15 | |
| 16 | 16 | <div class="field-group clearfix frm-first-row"> |
| 17 | 17 | <label><?php _e( 'Max Width', 'formidable' ) ?></label> |
| 18 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_width') ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_width' ) ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
| 19 | 19 | </div> |
| 20 | 20 | |
| 21 | 21 | <div class="field-group clearfix frm-first-row"> |
| 22 | 22 | <label><?php _e( 'Background', 'formidable' ) ?></label> |
| 23 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_bg_color') ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
| 23 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_bg_color' ) ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
| 24 | 24 | </div> |
| 25 | 25 | |
| 26 | 26 | <div class="field-group field-group-border clearfix"> |
| 27 | 27 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 28 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset') ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
| 28 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset' ) ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
| 29 | 29 | </div> |
| 30 | 30 | |
| 31 | 31 | <div class="field-group clearfix"> |
| 32 | 32 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 33 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_color') ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
| 33 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_color' ) ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
| 34 | 34 | </div> |
| 35 | 35 | |
| 36 | 36 | <div class="field-group clearfix"> |
| 37 | 37 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 38 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_padding') ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
| 38 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_padding' ) ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
| 39 | 39 | </div> |
| 40 | 40 | |
| 41 | 41 | <div id="frm_gen_font_box" class="field-group clearfix"> |
| 42 | 42 | <label><?php _e( 'Font Family', 'formidable' ) ?></label> |
| 43 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font') ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
| 43 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font' ) ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
| 44 | 44 | </div> |
| 45 | 45 | |
| 46 | 46 | <div class="field-group clearfix frm-half"> |
| 47 | 47 | <label><?php _e( 'Direction', 'formidable' ) ?></label> |
| 48 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('direction') ) ?>" id="frm_direction"> |
|
| 49 | - <option value="ltr" <?php selected($style->post_content['direction'], 'ltr') ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
| 50 | - <option value="rtl" <?php selected($style->post_content['direction'], 'rtl') ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
| 48 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'direction' ) ) ?>" id="frm_direction"> |
|
| 49 | + <option value="ltr" <?php selected( $style->post_content['direction'], 'ltr' ) ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
| 50 | + <option value="rtl" <?php selected( $style->post_content['direction'], 'rtl' ) ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
| 51 | 51 | </select> |
| 52 | 52 | </div> |
| 53 | 53 | |
| 54 | 54 | <div class="clear"></div> |
| 55 | 55 | <p class="frm_no_bottom_margin"> |
| 56 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('important_style') ) ?>" id="frm_important_style" value="1" <?php checked($style->post_content['important_style'], 1) ?> /> |
|
| 56 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'important_style' ) ) ?>" id="frm_important_style" value="1" <?php checked( $style->post_content['important_style'], 1 ) ?> /> |
|
| 57 | 57 | <?php _e( 'Override theme styling', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will add !important to many of the lines in the Formidable styling to make sure it will be used.', 'formidable' ) ?>" ></span> |
| 58 | 58 | </label> |
| 59 | 59 | </p> |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | class FrmAddonsController { |
| 4 | 4 | |
| 5 | 5 | public static function menu() { |
| 6 | - add_submenu_page( 'formidable', 'Formidable | '. __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' ); |
|
| 6 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' ); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | public static function list_addons() { |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public static function get_licenses() { |
| 60 | - $license = get_option('frmpro-credentials'); |
|
| 60 | + $license = get_option( 'frmpro-credentials' ); |
|
| 61 | 61 | if ( $license && is_array( $license ) && isset( $license['license'] ) ) { |
| 62 | - $url = 'http://formidablepro.com/frm-edd-api/licenses?l='. urlencode( base64_encode( $license['license'] ) ); |
|
| 62 | + $url = 'http://formidablepro.com/frm-edd-api/licenses?l=' . urlencode( base64_encode( $license['license'] ) ); |
|
| 63 | 63 | $licenses = self::send_api_request( $url, array( 'name' => 'frm_api_licence', 'expires' => 60 * 60 * 5 ) ); |
| 64 | 64 | echo json_encode( $licenses ); |
| 65 | 65 | } |