Code Duplication    Length = 23-23 lines in 2 locations

classes/PodsAPI.php 2 locations

@@ 1892-1914 (lines=23) @@
1889
            );
1890
        }
1891
1892
        if ( true === $db ) {
1893
            if ( !has_filter( 'wp_unique_post_slug', array( $this, 'save_slug_fix' ) ) )
1894
                add_filter( 'wp_unique_post_slug', array( $this, 'save_slug_fix' ), 100, 6 );
1895
1896
            $conflicted = false;
1897
1898
            // Headway compatibility fix
1899
            if ( has_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 ) ) {
1900
                remove_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 );
1901
1902
                $conflicted = true;
1903
            }
1904
1905
            $params->id = $this->save_wp_object( 'post', $post_data, $pod[ 'options' ], true, true );
1906
1907
            if ( $conflicted )
1908
                add_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 );
1909
1910
            if ( false === $params->id )
1911
                return pods_error( __( 'Cannot save Pod', 'pods' ), $this );
1912
        }
1913
        elseif ( empty( $params->id ) )
1914
            $params->id = (int) $db;
1915
1916
        $pod[ 'id' ] = $params->id;
1917
@@ 2573-2595 (lines=23) @@
2570
            }
2571
        }
2572
2573
        if ( true === $db ) {
2574
            if ( !has_filter( 'wp_unique_post_slug', array( $this, 'save_slug_fix' ) ) )
2575
                add_filter( 'wp_unique_post_slug', array( $this, 'save_slug_fix' ), 100, 6 );
2576
2577
            $conflicted = false;
2578
2579
            // Headway compatibility fix
2580
            if ( has_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 ) ) {
2581
                remove_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 );
2582
2583
                $conflicted = true;
2584
            }
2585
2586
            $params->id = $this->save_wp_object( 'post', $post_data, $field[ 'options' ], true, true );
2587
2588
            if ( $conflicted )
2589
                add_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 );
2590
2591
            if ( false === $params->id )
2592
                return pods_error( __( 'Cannot save Field', 'pods' ), $this );
2593
        }
2594
        else
2595
            $params->id = $field[ 'name' ];
2596
2597
        $field[ 'id' ] = $params->id;
2598