@@ -26,55 +26,55 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - /* Display in Back End */ |
|
| 30 | - public static function route() { |
|
| 29 | + /* Display in Back End */ |
|
| 30 | + public static function route() { |
|
| 31 | 31 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 32 | 32 | |
| 33 | - switch ( $action ) { |
|
| 34 | - case 'show': |
|
| 35 | - case 'destroy': |
|
| 36 | - case 'destroy_all': |
|
| 37 | - return self::$action(); |
|
| 33 | + switch ( $action ) { |
|
| 34 | + case 'show': |
|
| 35 | + case 'destroy': |
|
| 36 | + case 'destroy_all': |
|
| 37 | + return self::$action(); |
|
| 38 | 38 | |
| 39 | - default: |
|
| 40 | - do_action( 'frm_entry_action_route', $action ); |
|
| 41 | - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
| 42 | - return; |
|
| 43 | - } |
|
| 39 | + default: |
|
| 40 | + do_action( 'frm_entry_action_route', $action ); |
|
| 41 | + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
| 42 | + return; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return self::display_list(); |
|
| 46 | - } |
|
| 47 | - } |
|
| 45 | + return self::display_list(); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | public static function contextual_help( $help, $screen_id, $screen ) { |
| 50 | - // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
| 51 | - if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
| 52 | - return $help; |
|
| 53 | - } |
|
| 50 | + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
| 51 | + if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
| 52 | + return $help; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
| 56 | 56 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
| 57 | 57 | $show_help = ( $page == 'formidable-entries' && ( empty( $action ) || $action == 'list' ) ); |
| 58 | 58 | if ( ! $show_help ) { |
| 59 | - return $help; |
|
| 60 | - } |
|
| 59 | + return $help; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | unset( $action, $page ); |
| 63 | 63 | |
| 64 | - $screen->add_help_tab( array( |
|
| 65 | - 'id' => 'formidable-entries-tab', |
|
| 66 | - 'title' => __( 'Overview', 'formidable' ), |
|
| 64 | + $screen->add_help_tab( array( |
|
| 65 | + 'id' => 'formidable-entries-tab', |
|
| 66 | + 'title' => __( 'Overview', 'formidable' ), |
|
| 67 | 67 | '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>', |
| 68 | - )); |
|
| 68 | + )); |
|
| 69 | 69 | |
| 70 | - $screen->set_help_sidebar( |
|
| 70 | + $screen->set_help_sidebar( |
|
| 71 | 71 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
| 72 | 72 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
| 73 | 73 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
| 74 | - ); |
|
| 74 | + ); |
|
| 75 | 75 | |
| 76 | - return $help; |
|
| 77 | - } |
|
| 76 | + return $help; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Prevent the "screen options" tab from showing when |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public static function manage_columns( $columns ) { |
| 95 | - global $frm_vars; |
|
| 95 | + global $frm_vars; |
|
| 96 | 96 | $form_id = FrmForm::get_current_form_id(); |
| 97 | 97 | |
| 98 | 98 | $columns[ $form_id . '_id' ] = 'ID'; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
| 111 | 111 | self::maybe_add_ip_col( $form_id, $columns ); |
| 112 | 112 | |
| 113 | - $frm_vars['cols'] = $columns; |
|
| 113 | + $frm_vars['cols'] = $columns; |
|
| 114 | 114 | |
| 115 | 115 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
| 116 | 116 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) { |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | 'default' => 20, |
| 120 | 120 | 'option' => 'formidable_page_formidable_entries_per_page', |
| 121 | 121 | ) ); |
| 122 | - } |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - return $columns; |
|
| 125 | - } |
|
| 124 | + return $columns; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | 127 | private static function get_columns_for_form( $form_id, &$columns ) { |
| 128 | 128 | $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
@@ -171,67 +171,67 @@ discard block |
||
| 171 | 171 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
| 172 | 172 | $this_page_name = self::hidden_column_key(); |
| 173 | 173 | if ( $meta_key != $this_page_name || $meta_value == $prev_value ) { |
| 174 | - return $check; |
|
| 175 | - } |
|
| 174 | + return $check; |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | 177 | if ( empty( $prev_value ) ) { |
| 178 | 178 | $prev_value = get_metadata( 'user', $object_id, $meta_key, true ); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - global $frm_vars; |
|
| 181 | + global $frm_vars; |
|
| 182 | 182 | //add a check so we don't create a loop |
| 183 | 183 | $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
| 184 | 184 | |
| 185 | - return $check; |
|
| 186 | - } |
|
| 185 | + return $check; |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - //add hidden columns back from other forms |
|
| 188 | + //add hidden columns back from other forms |
|
| 189 | 189 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
| 190 | 190 | $this_page_name = self::hidden_column_key(); |
| 191 | 191 | if ( $meta_key != $this_page_name ) { |
| 192 | - return; |
|
| 193 | - } |
|
| 192 | + return; |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | global $frm_vars; |
| 196 | 196 | if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
| 197 | 197 | return; //don't continue if there's no previous value |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - foreach ( $meta_value as $mk => $mv ) { |
|
| 201 | - //remove blank values |
|
| 202 | - if ( empty( $mv ) ) { |
|
| 203 | - unset( $meta_value[ $mk ] ); |
|
| 204 | - } |
|
| 205 | - } |
|
| 200 | + foreach ( $meta_value as $mk => $mv ) { |
|
| 201 | + //remove blank values |
|
| 202 | + if ( empty( $mv ) ) { |
|
| 203 | + unset( $meta_value[ $mk ] ); |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | 207 | $cur_form_prefix = reset( $meta_value ); |
| 208 | 208 | $cur_form_prefix = explode( '_', $cur_form_prefix ); |
| 209 | - $cur_form_prefix = $cur_form_prefix[0]; |
|
| 210 | - $save = false; |
|
| 209 | + $cur_form_prefix = $cur_form_prefix[0]; |
|
| 210 | + $save = false; |
|
| 211 | 211 | |
| 212 | - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
| 212 | + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
| 213 | 213 | if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) { |
| 214 | - //don't add blank cols or process included cols |
|
| 215 | - continue; |
|
| 216 | - } |
|
| 214 | + //don't add blank cols or process included cols |
|
| 215 | + continue; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | $form_prefix = explode( '_', $prev_hidden ); |
| 219 | - $form_prefix = $form_prefix[0]; |
|
| 220 | - if ( $form_prefix == $cur_form_prefix ) { |
|
| 221 | - //don't add back columns that are meant to be hidden |
|
| 222 | - continue; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - $meta_value[] = $prev_hidden; |
|
| 226 | - $save = true; |
|
| 219 | + $form_prefix = $form_prefix[0]; |
|
| 220 | + if ( $form_prefix == $cur_form_prefix ) { |
|
| 221 | + //don't add back columns that are meant to be hidden |
|
| 222 | + continue; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + $meta_value[] = $prev_hidden; |
|
| 226 | + $save = true; |
|
| 227 | 227 | unset( $form_prefix ); |
| 228 | - } |
|
| 228 | + } |
|
| 229 | 229 | |
| 230 | 230 | if ( $save ) { |
| 231 | 231 | $user_id = get_current_user_id(); |
| 232 | 232 | update_user_option( $user_id, $this_page_name, $meta_value, true ); |
| 233 | - } |
|
| 234 | - } |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | /** |
| 237 | 237 | * @since 2.05.07 |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | public static function save_per_page( $save, $option, $value ) { |
| 255 | - if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
| 256 | - $save = (int) $value; |
|
| 257 | - } |
|
| 258 | - return $save; |
|
| 259 | - } |
|
| 255 | + if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
| 256 | + $save = (int) $value; |
|
| 257 | + } |
|
| 258 | + return $save; |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | 261 | public static function sortable_columns() { |
| 262 | 262 | $form_id = FrmForm::get_current_form_id(); |
@@ -356,43 +356,43 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | public static function display_list( $message = '', $errors = array() ) { |
| 359 | - global $wpdb, $frm_vars; |
|
| 359 | + global $wpdb, $frm_vars; |
|
| 360 | 360 | |
| 361 | 361 | $form = FrmForm::maybe_get_current_form(); |
| 362 | 362 | $params = FrmForm::get_admin_params( $form ); |
| 363 | 363 | |
| 364 | - if ( $form ) { |
|
| 365 | - $params['form'] = $form->id; |
|
| 366 | - $frm_vars['current_form'] = $form; |
|
| 364 | + if ( $form ) { |
|
| 365 | + $params['form'] = $form->id; |
|
| 366 | + $frm_vars['current_form'] = $form; |
|
| 367 | 367 | |
| 368 | 368 | self::get_delete_form_time( $form, $errors ); |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
| 371 | + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
| 372 | 372 | |
| 373 | - $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
| 373 | + $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
| 374 | 374 | |
| 375 | - $pagenum = $wp_list_table->get_pagenum(); |
|
| 375 | + $pagenum = $wp_list_table->get_pagenum(); |
|
| 376 | 376 | |
| 377 | - $wp_list_table->prepare_items(); |
|
| 377 | + $wp_list_table->prepare_items(); |
|
| 378 | 378 | |
| 379 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 380 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 379 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
| 380 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
| 381 | 381 | $url = add_query_arg( 'paged', $total_pages ); |
| 382 | - if ( headers_sent() ) { |
|
| 382 | + if ( headers_sent() ) { |
|
| 383 | 383 | echo FrmAppHelper::js_redirect( $url ); |
| 384 | - } else { |
|
| 385 | - wp_redirect( esc_url_raw( $url ) ); |
|
| 386 | - } |
|
| 387 | - die(); |
|
| 388 | - } |
|
| 384 | + } else { |
|
| 385 | + wp_redirect( esc_url_raw( $url ) ); |
|
| 386 | + } |
|
| 387 | + die(); |
|
| 388 | + } |
|
| 389 | 389 | |
| 390 | 390 | if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
| 391 | - $message = __( 'Your import is complete', 'formidable' ); |
|
| 392 | - } |
|
| 391 | + $message = __( 'Your import is complete', 'formidable' ); |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | 394 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); |
| 395 | - } |
|
| 395 | + } |
|
| 396 | 396 | |
| 397 | 397 | private static function get_delete_form_time( $form, &$errors ) { |
| 398 | 398 | if ( 'trash' == $form->status ) { |
@@ -402,17 +402,17 @@ discard block |
||
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - /* Back End CRUD */ |
|
| 405 | + /* Back End CRUD */ |
|
| 406 | 406 | public static function show( $id = 0 ) { |
| 407 | 407 | FrmAppHelper::permission_check( 'frm_view_entries' ); |
| 408 | 408 | |
| 409 | - if ( ! $id ) { |
|
| 409 | + if ( ! $id ) { |
|
| 410 | 410 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
| 411 | 411 | |
| 412 | - if ( ! $id ) { |
|
| 412 | + if ( ! $id ) { |
|
| 413 | 413 | $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' ); |
| 414 | - } |
|
| 415 | - } |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | 416 | |
| 417 | 417 | $entry = FrmEntry::getOne( $id, true ); |
| 418 | 418 | if ( ! $entry ) { |
@@ -428,63 +428,63 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
| 431 | - $to_emails = array(); |
|
| 431 | + $to_emails = array(); |
|
| 432 | 432 | $form = FrmForm::getOne( $entry->form_id ); |
| 433 | 433 | |
| 434 | 434 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
| 435 | - } |
|
| 435 | + } |
|
| 436 | 436 | |
| 437 | - public static function destroy() { |
|
| 437 | + public static function destroy() { |
|
| 438 | 438 | FrmAppHelper::permission_check( 'frm_delete_entries' ); |
| 439 | 439 | |
| 440 | 440 | $params = FrmForm::get_admin_params(); |
| 441 | 441 | |
| 442 | 442 | if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
| 443 | 443 | self::unlink_post( $params['id'] ); |
| 444 | - } |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | - $message = ''; |
|
| 447 | - if ( FrmEntry::destroy( $params['id'] ) ) { |
|
| 448 | - $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
| 449 | - } |
|
| 446 | + $message = ''; |
|
| 447 | + if ( FrmEntry::destroy( $params['id'] ) ) { |
|
| 448 | + $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | - self::display_list( $message ); |
|
| 452 | - } |
|
| 451 | + self::display_list( $message ); |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | - public static function destroy_all() { |
|
| 455 | - if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
| 456 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 457 | - wp_die( $frm_settings->admin_permission ); |
|
| 458 | - } |
|
| 454 | + public static function destroy_all() { |
|
| 455 | + if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
| 456 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 457 | + wp_die( $frm_settings->admin_permission ); |
|
| 458 | + } |
|
| 459 | 459 | |
| 460 | 460 | $params = FrmForm::get_admin_params(); |
| 461 | - $message = ''; |
|
| 462 | - $errors = array(); |
|
| 463 | - $form_id = (int) $params['form']; |
|
| 461 | + $message = ''; |
|
| 462 | + $errors = array(); |
|
| 463 | + $form_id = (int) $params['form']; |
|
| 464 | 464 | |
| 465 | - if ( $form_id ) { |
|
| 466 | - $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
| 465 | + if ( $form_id ) { |
|
| 466 | + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
| 467 | 467 | $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 ); |
| 468 | 468 | |
| 469 | - if ( $action ) { |
|
| 470 | - // this action takes a while, so only trigger it if there are posts to delete |
|
| 471 | - foreach ( $entry_ids as $entry_id ) { |
|
| 472 | - do_action( 'frm_before_destroy_entry', $entry_id ); |
|
| 473 | - unset( $entry_id ); |
|
| 474 | - } |
|
| 475 | - } |
|
| 469 | + if ( $action ) { |
|
| 470 | + // this action takes a while, so only trigger it if there are posts to delete |
|
| 471 | + foreach ( $entry_ids as $entry_id ) { |
|
| 472 | + do_action( 'frm_before_destroy_entry', $entry_id ); |
|
| 473 | + unset( $entry_id ); |
|
| 474 | + } |
|
| 475 | + } |
|
| 476 | 476 | |
| 477 | - $results = self::delete_form_entries( $form_id ); |
|
| 478 | - if ( $results ) { |
|
| 477 | + $results = self::delete_form_entries( $form_id ); |
|
| 478 | + if ( $results ) { |
|
| 479 | 479 | FrmEntry::clear_cache(); |
| 480 | - $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
| 481 | - } |
|
| 482 | - } else { |
|
| 483 | - $errors = __( 'No entries were specified', 'formidable' ); |
|
| 484 | - } |
|
| 480 | + $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
| 481 | + } |
|
| 482 | + } else { |
|
| 483 | + $errors = __( 'No entries were specified', 'formidable' ); |
|
| 484 | + } |
|
| 485 | 485 | |
| 486 | - self::display_list( $message, $errors ); |
|
| 487 | - } |
|
| 486 | + self::display_list( $message, $errors ); |
|
| 487 | + } |
|
| 488 | 488 | |
| 489 | 489 | /** |
| 490 | 490 | * @since 3.0.07 |
@@ -530,47 +530,47 @@ discard block |
||
| 530 | 530 | * @deprecated 1.07.05 |
| 531 | 531 | * @codeCoverageIgnore |
| 532 | 532 | */ |
| 533 | - public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
| 534 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
| 535 | - return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
| 536 | - } |
|
| 533 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
| 534 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
| 535 | + return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
| 536 | + } |
|
| 537 | 537 | |
| 538 | 538 | /** |
| 539 | 539 | * @deprecated 1.07.05 |
| 540 | 540 | * @codeCoverageIgnore |
| 541 | 541 | */ |
| 542 | - public static function get_form( $filename, $form, $title, $description ) { |
|
| 543 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
| 544 | - return FrmFormsController::get_form( $form, $title, $description ); |
|
| 545 | - } |
|
| 542 | + public static function get_form( $filename, $form, $title, $description ) { |
|
| 543 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
| 544 | + return FrmFormsController::get_form( $form, $title, $description ); |
|
| 545 | + } |
|
| 546 | 546 | |
| 547 | - public static function process_entry( $errors = '', $ajax = false ) { |
|
| 547 | + public static function process_entry( $errors = '', $ajax = false ) { |
|
| 548 | 548 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
| 549 | 549 | if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
| 550 | - return; |
|
| 551 | - } |
|
| 550 | + return; |
|
| 551 | + } |
|
| 552 | 552 | |
| 553 | - global $frm_vars; |
|
| 553 | + global $frm_vars; |
|
| 554 | 554 | |
| 555 | 555 | $form = FrmForm::getOne( $form_id ); |
| 556 | - if ( ! $form ) { |
|
| 557 | - return; |
|
| 558 | - } |
|
| 556 | + if ( ! $form ) { |
|
| 557 | + return; |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | 560 | $params = FrmForm::get_params( $form ); |
| 561 | 561 | |
| 562 | - if ( ! isset( $frm_vars['form_params'] ) ) { |
|
| 563 | - $frm_vars['form_params'] = array(); |
|
| 564 | - } |
|
| 562 | + if ( ! isset( $frm_vars['form_params'] ) ) { |
|
| 563 | + $frm_vars['form_params'] = array(); |
|
| 564 | + } |
|
| 565 | 565 | $frm_vars['form_params'][ $form->id ] = $params; |
| 566 | 566 | |
| 567 | 567 | if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
| 568 | - return; |
|
| 569 | - } |
|
| 568 | + return; |
|
| 569 | + } |
|
| 570 | 570 | |
| 571 | - if ( $errors == '' && ! $ajax ) { |
|
| 571 | + if ( $errors == '' && ! $ajax ) { |
|
| 572 | 572 | $errors = FrmEntryValidate::validate( $_POST ); |
| 573 | - } |
|
| 573 | + } |
|
| 574 | 574 | |
| 575 | 575 | /** |
| 576 | 576 | * Use this filter to add trigger actions and add errors after |
@@ -581,24 +581,24 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
| 583 | 583 | |
| 584 | - if ( empty( $errors ) ) { |
|
| 584 | + if ( empty( $errors ) ) { |
|
| 585 | 585 | $_POST['frm_skip_cookie'] = 1; |
| 586 | 586 | $do_success = false; |
| 587 | - if ( $params['action'] == 'create' ) { |
|
| 587 | + if ( $params['action'] == 'create' ) { |
|
| 588 | 588 | if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
| 589 | 589 | $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
| 590 | 590 | $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
| 591 | 591 | $do_success = true; |
| 592 | - } |
|
| 593 | - } |
|
| 592 | + } |
|
| 593 | + } |
|
| 594 | 594 | |
| 595 | - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
| 595 | + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
| 596 | 596 | if ( $do_success ) { |
| 597 | 597 | FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) ); |
| 598 | 598 | } |
| 599 | 599 | unset( $_POST['frm_skip_cookie'] ); |
| 600 | - } |
|
| 601 | - } |
|
| 600 | + } |
|
| 601 | + } |
|
| 602 | 602 | |
| 603 | 603 | /** |
| 604 | 604 | * Escape url entities before redirect |
@@ -612,27 +612,27 @@ discard block |
||
| 612 | 612 | return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url ); |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
| 616 | - self::_delete_entry( $atts['id'], $form ); |
|
| 617 | - return $url; |
|
| 618 | - } |
|
| 615 | + public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
| 616 | + self::_delete_entry( $atts['id'], $form ); |
|
| 617 | + return $url; |
|
| 618 | + } |
|
| 619 | 619 | |
| 620 | - //Delete entry if not redirected |
|
| 621 | - public static function delete_entry_after_save( $atts ) { |
|
| 622 | - self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
| 623 | - } |
|
| 620 | + //Delete entry if not redirected |
|
| 621 | + public static function delete_entry_after_save( $atts ) { |
|
| 622 | + self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
| 623 | + } |
|
| 624 | 624 | |
| 625 | - private static function _delete_entry( $entry_id, $form ) { |
|
| 626 | - if ( ! $form ) { |
|
| 627 | - return; |
|
| 628 | - } |
|
| 625 | + private static function _delete_entry( $entry_id, $form ) { |
|
| 626 | + if ( ! $form ) { |
|
| 627 | + return; |
|
| 628 | + } |
|
| 629 | 629 | |
| 630 | - $form->options = maybe_unserialize( $form->options ); |
|
| 631 | - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
| 630 | + $form->options = maybe_unserialize( $form->options ); |
|
| 631 | + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
| 632 | 632 | self::unlink_post( $entry_id ); |
| 633 | - FrmEntry::destroy( $entry_id ); |
|
| 634 | - } |
|
| 635 | - } |
|
| 633 | + FrmEntry::destroy( $entry_id ); |
|
| 634 | + } |
|
| 635 | + } |
|
| 636 | 636 | |
| 637 | 637 | /** |
| 638 | 638 | * unlink entry from post |
@@ -704,5 +704,5 @@ discard block |
||
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
| 707 | - } |
|
| 707 | + } |
|
| 708 | 708 | } |