Code Duplication    Length = 23-23 lines in 2 locations

geodirectory-functions/general_functions.php 2 locations

@@ 4102-4124 (lines=23) @@
4099
        $location_single = $gd_country;
4100
    }
4101
4102
    if (!empty($location_array)) {
4103
4104
        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4105
        $location_array = array_reverse($location_array);
4106
4107
        foreach ($location_array as $location_type => $location) {
4108
            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4109
            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4110
4111
            $location_name = geodir_ucwords($gd_location_link_text);
4112
            $location_name = __($location_name, 'geodirectory');
4113
4114
            if ($actual_location_name) {
4115
                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4116
                $location_name = get_actual_location_name($location_type, $location, true);
4117
            }
4118
4119
            $location_titles[] = $location_name;
4120
        }
4121
        if (!empty($location_titles)) {
4122
            $location_titles = array_unique($location_titles);
4123
        }
4124
    }
4125
4126
4127
    if(!empty($location_titles)) {
@@ 4393-4415 (lines=23) @@
4390
        $location_single = $gd_country;
4391
    }
4392
4393
    if (!empty($location_array)) {
4394
4395
        $actual_location_name = function_exists('get_actual_location_name') ? true : false;
4396
        $location_array = array_reverse($location_array);
4397
4398
        foreach ($location_array as $location_type => $location) {
4399
            $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
4400
            $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
4401
4402
            $location_name = geodir_ucwords($gd_location_link_text);
4403
            $location_name = __($location_name, 'geodirectory');
4404
4405
            if ($actual_location_name) {
4406
                $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
4407
                $location_name = get_actual_location_name($location_type, $location, true);
4408
            }
4409
4410
            $location_titles[] = $location_name;
4411
        }
4412
        if (!empty($location_titles)) {
4413
            $location_titles = array_unique($location_titles);
4414
        }
4415
    }
4416
4417
4418
    if(strpos($title,'%%location%%') !== false){