Making WordPress.org

Changeset 7909


Ignore:
Timestamp:
11/27/2018 08:28:49 PM (8 years ago)
Author:
coreymckrill
Message:

WordCamp Genderize client: Apply coding standards, improve readability

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/utilities/class-genderize-client.php

    r7882 r7909  
    1313 */
    1414class Genderize_Client extends API_Client {
    15 
     15        /**
     16         * @var string The option key where the cache is saved in the database.
     17         */
    1618        const CACHE_KEY = 'genderize_cached_data';
    1719
    … …  
    7072
    7173                if ( true === $this->options->reset_cache ) {
    72                         $this->cache = [];
    73                         $this->save_cached_data();
     74                        delete_option( self::CACHE_KEY );
    7475                }
    7576        }
    … …  
    8485         */
    8586        public function get_gender_data( array $names, $locale ) {
     87                $names     = array_unique( array_map( 'strtolower', $names ) );
     88                $lang_code = $this->get_lang_code_from_locale( $locale );
     89
    8690                // Bail if there are errors.
    8791                if ( ! empty( $this->error->get_error_messages() ) ) {
    … …  
    9195                $data         = [];
    9296                $needs_update = [];
    93 
    94                 $names     = array_unique( array_map( 'strtolower', $names ) );
    95                 $lang_code = $this->get_lang_code_from_locale( $locale );
    9697
    9798                foreach ( $names as $name ) {
    … …  
    173174                }
    174175
    175                 return $cache[ $lang_code ][ $name ];
     176                return $item;
    176177        }
    177178
Note: See TracChangeset for help on using the changeset viewer.