Code Duplication    Length = 23-23 lines in 2 locations

classes/PodsAPI.php 2 locations

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