Code Duplication    Length = 4-5 lines in 5 locations

geodirectory-admin/admin_functions.php 4 locations

@@ 4044-4048 (lines=5) @@
4041
                if (!empty($file)) {
4042
                    $columns = isset($file[0]) ? $file[0] : NULL;
4043
                    
4044
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4045
                        $json['error'] = CSV_INVAILD_FILE;
4046
                        wp_send_json( $json );
4047
                        exit;
4048
                    }
4049
                    
4050
                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
4051
                    
@@ 4290-4294 (lines=5) @@
4287
                    
4288
                    $columns = isset($file[0]) ? $file[0] : NULL;
4289
                    
4290
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4291
                        $json['error'] = CSV_INVAILD_FILE;
4292
                        wp_send_json( $json );
4293
                        exit;
4294
                    }
4295
4296
                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4297
                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
@@ 4876-4879 (lines=4) @@
4873
                if (!empty($file)) {
4874
                    $columns = isset($file[0]) ? $file[0] : NULL;
4875
                    
4876
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4877
                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4878
                        wp_send_json( $json );
4879
                    }
4880
                    
4881
                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4882
                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
@@ 4972-4975 (lines=4) @@
4969
                if (!empty($file)) {
4970
                    $columns = isset($file[0]) ? $file[0] : NULL;
4971
                    
4972
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4973
                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4974
                        wp_send_json( $json );
4975
                    }
4976
                    
4977
                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4978
                    $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' );

geodirectory-admin/admin_hooks_actions.php 1 location

@@ 1741-1745 (lines=5) @@
1738
        $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
1739
        $customKeyarray = $columns;
1740
1741
        if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
1742
            $return['error'] = CSV_INVAILD_FILE;
1743
            echo json_encode($return);
1744
            exit;
1745
        }
1746
1747
        for ($i = 1; $i <= $importlimit; $i++) {
1748
            $current_index = $tmpCnt + $i;