Code Duplication    Length = 3-3 lines in 10 locations

admin/class-yikes-inc-easy-mailchimp-extender-admin.php 10 locations

@@ 2449-2451 (lines=3) @@
2446
			$nonce = $_REQUEST['nonce'];
2447
			$post_id_to_delete = $_REQUEST['mailchimp-form'];
2448
			// verify our nonce
2449
			if ( ! wp_verify_nonce( $nonce, 'delete-mailchimp-form-'.$post_id_to_delete ) ) {
2450
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
2451
			}
2452
2453
			$this->form_interface->delete_form( $post_id_to_delete );
2454
@@ 365-367 (lines=3) @@
362
			// grab the forms.
363
			$forms = isset( $_REQUEST['yikes_export_forms'] ) ? $_REQUEST['yikes_export_forms'] : array();
364
			// validate nonce.
365
			if ( ! wp_verify_nonce( $nonce, 'export-forms' ) ) {
366
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
367
			}
368
369
			// run the export function.
370
			// parameters: ( $table_name, $form_ids, $file_name ).
@@ 387-389 (lines=3) @@
384
			// grab our nonce
385
			$nonce = $_REQUEST['nonce'];
386
			// validate nonce.
387
			if ( ! wp_verify_nonce( $nonce, 'export-settings' ) ) {
388
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
389
			}
390
391
			// run the export function.
392
			// parameters: ( $table_name, $form_ids, $file_name ).
@@ 407-409 (lines=3) @@
404
			// grab our nonce.
405
			$nonce = $_REQUEST['nonce'];
406
			// validate nonce.
407
			if ( ! wp_verify_nonce( $nonce, 'import-forms' ) ) {
408
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
409
			}
410
			// include the export class.
411
			if ( ! class_exists( 'Yikes_Inc_Easy_Mailchimp_Import_Class' ) ) {
412
				include_once( YIKES_MC_PATH . 'includes/import-export/yikes-easy-mailchimp-import.class.php' );
@@ 2469-2471 (lines=3) @@
2466
			$nonce = $_REQUEST['nonce'];
2467
			$post_id_to_clone = $_REQUEST['mailchimp-form'];
2468
			// verify our nonce
2469
			if ( ! wp_verify_nonce( $nonce, 'duplicate-mailchimp-form-'.$post_id_to_clone ) ) {
2470
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
2471
			}
2472
2473
			// Get the current form data.
2474
			$form_data = $this->form_interface->get_form( $post_id_to_clone );
@@ 2512-2514 (lines=3) @@
2509
			$nonce = $_REQUEST['nonce'];
2510
			$form_id_to_reset = $_REQUEST['mailchimp-form'];
2511
			// verify our nonce
2512
			if ( ! wp_verify_nonce( $nonce, 'reset-stats-mailchimp-form-'.$form_id_to_reset ) ) {
2513
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
2514
			}
2515
2516
			$result = $this->form_interface->update_form(
2517
				$form_id_to_reset,
@@ 2545-2547 (lines=3) @@
2542
			$form_id = $_REQUEST['id'];
2543
2544
			// verify our nonce
2545
			if ( ! wp_verify_nonce( $nonce, 'update-mailchimp-form-' . $form_id ) ) {
2546
				wp_die(
2547
					__( "We've run into an error. The security check didn't pass. Please try again.", 'yikes-inc-easy-mailchimp-extender' ),
2548
					__( "Failed nonce validation", 'yikes-inc-easy-mailchimp-extender' ),
2549
					array(
2550
						'response'  => 500,
@@ 2687-2689 (lines=3) @@
2684
			$email_id = $_REQUEST['email_id'];
2685
2686
			// verify our nonce
2687
			if ( ! wp_verify_nonce( $nonce, 'unsubscribe-user-' . $email_id ) ) {
2688
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
2689
			}
2690
2691
			$response = yikes_get_mc_api_manager()->get_list_handler()->member_unsubscribe( $list_id, $email_id );
2692
			if ( is_wp_error( $response ) ) {
@@ 2709-2711 (lines=3) @@
2706
			// grab our nonnce
2707
			$nonce = $_REQUEST['nonce'];
2708
			// validate nonce
2709
			if ( !wp_verify_nonce( $nonce, 'create_error_log' ) ) {
2710
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
2711
			}
2712
			// setup the path to the error log
2713
			$error_log = fopen( plugin_dir_path( __FILE__ ) . '../includes/error_log/yikes-easy-mailchimp-error-log.php', 'w' );
2714
			try {
@@ 2733-2735 (lines=3) @@
2730
2731
			// verify our nonce
2732
			$nonce = $_REQUEST['nonce'];
2733
			if ( ! wp_verify_nonce( $nonce, 'clear-mc-transient-data' ) ) {
2734
				wp_die( __( "We've run into an error. The security check didn't pass. Please try again." , 'yikes-inc-easy-mailchimp-extender' ) , __( "Failed nonce validation" , 'yikes-inc-easy-mailchimp-extender' ) , array( 'response' => 500 , 'back_link' => true ) );
2735
			}
2736
2737
			$this->delete_yikes_mailchimp_transients();
2738