Code Duplication    Length = 4-5 lines in 5 locations

geodirectory-admin/admin_functions.php 4 locations

@@ 4355-4359 (lines=5) @@
4352
                    
4353
                    $columns = isset($file[0]) ? $file[0] : NULL;
4354
                    
4355
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4356
                        $json['error'] = CSV_INVAILD_FILE;
4357
                        wp_send_json( $json );
4358
                        exit;
4359
                    }
4360
4361
                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4362
                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
@@ 4108-4112 (lines=5) @@
4105
                if (!empty($file)) {
4106
                    $columns = isset($file[0]) ? $file[0] : NULL;
4107
                    
4108
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4109
                        $json['error'] = CSV_INVAILD_FILE;
4110
                        wp_send_json( $json );
4111
                        exit;
4112
                    }
4113
                    
4114
                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
4115
                    
@@ 4945-4948 (lines=4) @@
4942
                if (!empty($file)) {
4943
                    $columns = isset($file[0]) ? $file[0] : NULL;
4944
                    
4945
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4946
                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4947
                        wp_send_json( $json );
4948
                    }
4949
                    
4950
                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4951
                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
@@ 5041-5044 (lines=4) @@
5038
                if (!empty($file)) {
5039
                    $columns = isset($file[0]) ? $file[0] : NULL;
5040
                    
5041
                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5042
                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
5043
                        wp_send_json( $json );
5044
                    }
5045
                    
5046
                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
5047
                    $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

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