Code Duplication    Length = 4-5 lines in 5 locations

geodirectory-admin/admin_hooks_actions.php 1 location

@@ 1974-1978 (lines=5) @@
1971
        $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
1972
        $customKeyarray = $columns;
1973
1974
        if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
1975
            $return['error'] = CSV_INVAILD_FILE;
1976
            echo json_encode($return);
1977
            exit;
1978
        }
1979
1980
        for ($i = 1; $i <= $importlimit; $i++) {
1981
            $current_index = $tmpCnt + $i;

geodirectory-admin/admin_functions.php 4 locations

@@ 3771-3775 (lines=5) @@
3768
                if (!empty($file)) {
3769
                    $columns = isset($file[0]) ? $file[0] : NULL;
3770
                    
3771
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3772
                        $json['error'] = CSV_INVAILD_FILE;
3773
                        wp_send_json( $json );
3774
                        exit;
3775
                    }
3776
                    
3777
                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
3778
                    
@@ 4018-4022 (lines=5) @@
4015
                    
4016
                    $columns = isset($file[0]) ? $file[0] : NULL;
4017
                    
4018
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4019
                        $json['error'] = CSV_INVAILD_FILE;
4020
                        wp_send_json( $json );
4021
                        exit;
4022
                    }
4023
4024
                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4025
                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
@@ 4608-4611 (lines=4) @@
4605
                if (!empty($file)) {
4606
                    $columns = isset($file[0]) ? $file[0] : NULL;
4607
                    
4608
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4609
                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4610
                        wp_send_json( $json );
4611
                    }
4612
                    
4613
                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4614
                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
@@ 4704-4707 (lines=4) @@
4701
                if (!empty($file)) {
4702
                    $columns = isset($file[0]) ? $file[0] : NULL;
4703
                    
4704
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4705
                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4706
                        wp_send_json( $json );
4707
                    }
4708
                    
4709
                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4710
                    $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );