_wp_timezone_choice_usort_callback

Sort-helper for timezones.

Description

(int) _wp_timezone_choice_usort_callback( (array) $a, (array) $b ); 

Returns (int)

Parameters (2)

0. $a (array)
The a.
1. $b (array)
The b.

Usage

  1. if ( !function_exists( '_wp_timezone_choice_usort_callback' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // The a. 
  5. $a = array(); 
  6.  
  7. // The b. 
  8. $b = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _wp_timezone_choice_usort_callback($a, $b); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function _wp_timezone_choice_usort_callback( $a, $b ) { 
  2. // Don't use translated versions of Etc 
  3. if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) { 
  4. // Make the order of these more like the old dropdown 
  5. if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) { 
  6. return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) ); 
  7. if ( 'UTC' === $a['city'] ) { 
  8. if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) { 
  9. return 1; 
  10. return -1; 
  11. if ( 'UTC' === $b['city'] ) { 
  12. if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) { 
  13. return -1; 
  14. return 1; 
  15. return strnatcasecmp( $a['city'], $b['city'] ); 
  16. if ( $a['t_continent'] == $b['t_continent'] ) { 
  17. if ( $a['t_city'] == $b['t_city'] ) { 
  18. return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] ); 
  19. return strnatcasecmp( $a['t_city'], $b['t_city'] ); 
  20. } else { 
  21. // Force Etc to the bottom of the list 
  22. if ( 'Etc' === $a['continent'] ) { 
  23. return 1; 
  24. if ( 'Etc' === $b['continent'] ) { 
  25. return -1; 
  26. return strnatcasecmp( $a['t_continent'], $b['t_continent'] );