Projekt

Allgemein

Profil

GX-Bug #52693 » SortCountriesByNameFix1.patch

Till Tepelmann, 03.08.2017 12:49

Unterschiede anzeigen:

src/inc/xtc_get_countries.inc.php (revision )
67 67
										   'countries_name' => $countries_values['countries_name']);
68 68
			}
69 69
		}
70
		usort($countries_array, 'sortCountriesByCountriesName');
70 71
	}
71 72

  
73

  
72 74
	return $countries_array;
75
}
76

  
77
/**
78
 * @param array $a
79
 * @param array $b
80
 * @return int
81
 */
82
function sortCountriesByCountriesName(array $a, array $b)
83
{
84
	if($a['countries_name'] == $b['countries_name'])
85
	{
86
		return 0;
87
	}
88
	$arr_search  = array("Ä","Ö","Ü");
89
	$arr_replace = array("A","O","U");
90
	$a['countries_name']   = str_replace( $arr_search, $arr_replace, $a['countries_name']);
91
	$b['countries_name']   = str_replace( $arr_search, $arr_replace, $b['countries_name']);
92
	$return = ($a['countries_name'] < $b['countries_name']) ? -1 : +1;
93
	$a['countries_name']   = str_replace( $arr_replace, $arr_search, $a['countries_name']);
94
	$b['countries_name']   = str_replace( $arr_replace, $arr_search, $b['countries_name']);
95
	return $return;
73 96
}
74 97
?>
    (1-1/1)