Code Duplication    Length = 12-12 lines in 3 locations

classes/admin.php 3 locations

@@ 1457-1468 (lines=12) @@
1454
				$id     = esc_attr( $post_data['id'] );
1455
				$result = $this->mappings->update_fieldmap( $post_data, $wordpress_fields, $salesforce_fields, $id );
1456
			}
1457
			if ( false === $result ) { // if the database didn't save, it's still an error
1458
				$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1459
				if ( '' !== $cachekey ) {
1460
					$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&transient=' . $cachekey;
1461
				}
1462
			} else {
1463
				if ( isset( $post_data['transient'] ) ) { // there was previously an error saved. can delete it now.
1464
					$this->sfwp_transients->delete( esc_attr( $post_data['map_transient'] ) );
1465
				}
1466
				// then send the user to the list of fieldmaps
1467
				$url = esc_url_raw( $post_data['redirect_url_success'] );
1468
			}
1469
		}
1470
		wp_safe_redirect( $url );
1471
		exit();
@@ 1523-1534 (lines=12) @@
1520
				$id     = esc_attr( $post_data['id'] );
1521
				$result = $this->mappings->update_object_map( $post_data, $id );
1522
			}
1523
			if ( false === $result ) { // if the database didn't save, it's still an error
1524
				$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1525
				if ( '' !== $cachekey ) {
1526
					$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&map_transient=' . $cachekey;
1527
				}
1528
			} else {
1529
				if ( isset( $post_data['map_transient'] ) ) { // there was previously an error saved. can delete it now.
1530
					$this->sfwp_transients->delete( esc_attr( $post_data['map_transient'] ) );
1531
				}
1532
				// then send the user to the success redirect url
1533
				$url = esc_url_raw( $post_data['redirect_url_success'] );
1534
			}
1535
		}
1536
		wp_safe_redirect( $url );
1537
		exit();
@@ 1576-1587 (lines=12) @@
1573
					$url = esc_url_raw( $post_data['redirect_url_success'] );
1574
				}
1575
1576
				if ( false === $result ) { // if the database didn't save, it's still an error
1577
					$this->sfwp_transients->set( $cachekey, $post_data, $this->wordpress->options['cache_expiration'] );
1578
					if ( '' !== $cachekey ) {
1579
						$url = esc_url_raw( $post_data['redirect_url_error'] ) . '&mapping_error_transient=' . $cachekey;
1580
					}
1581
				} else {
1582
					if ( isset( $post_data['mapping_error_transient'] ) ) { // there was previously an error saved. can delete it now.
1583
						$this->sfwp_transients->delete( esc_attr( $post_data['mapping_error_transient'] ) );
1584
					}
1585
					// then send the user to the list of fieldmaps
1586
					$url = esc_url_raw( $post_data['redirect_url_success'] );
1587
				}
1588
			}
1589
			wp_safe_redirect( $url );
1590
			exit();