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
@@ 2568-2590 (lines=23) @@
2565
            }
2566
        }
2567
2568
        if ( true === $db ) {
2569
            if ( !has_filter( 'wp_unique_post_slug', array( $this, 'save_slug_fix' ) ) )
2570
                add_filter( 'wp_unique_post_slug', array( $this, 'save_slug_fix' ), 100, 6 );
2571
2572
            $conflicted = false;
2573
2574
            // Headway compatibility fix
2575
            if ( has_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 ) ) {
2576
                remove_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 );
2577
2578
                $conflicted = true;
2579
            }
2580
2581
            $params->id = $this->save_wp_object( 'post', $post_data, $field[ 'options' ], true, true );
2582
2583
            if ( $conflicted )
2584
                add_filter( 'wp_insert_post_data', 'headway_clean_slug', 0 );
2585
2586
            if ( false === $params->id )
2587
                return pods_error( __( 'Cannot save Field', 'pods' ), $this );
2588
        }
2589
        else
2590
            $params->id = $field[ 'name' ];
2591
2592
        $field[ 'id' ] = $params->id;
2593