Making WordPress.org


Ignore:
Timestamp:
02/04/2015 07:50:02 AM (10 years ago)
Author:
dd32
Message:

Translations API: Ignore any languages passed that are not a string, avoids causing extra queries and emmiting PHP Warnings when clients pass invalid input to the Translation API's.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/translations/lib.php

    r914 r1218  
    130130    $return = array();
    131131    foreach ( $languages as $language ) {
     132        // Skip if an invalid language was provided to the API.
     133        if ( ! is_string( $language ) ) {
     134            continue;
     135        }
    132136
    133137        // Disable LP's for en_US for now, can re-enable later if we have non-en_US native items
    134         if ( 'en_US' == $language )
    135             continue;
     138        if ( 'en_US' == $language ) {
     139            continue;
     140        }
    136141
    137142        $cache_key = "{$type}:{$language}:{$domain}";
Note: See TracChangeset for help on using the changeset viewer.