Making WordPress.org


Ignore:
Timestamp:
12/06/2016 06:12:53 PM (8 years ago)
Author:
ocean90
Message:

Credits API: Add support for language variants.

Fixes #1768.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/credits/wp-credits.php

    r4489 r4490  
    143143        $path = 'wp/' . $path;
    144144
    145         $locale = $gp_locale->slug;
     145        $locale_parts = explode( '/', $gp_locale->slug );
     146        $locale = $locale_parts[0];
     147        $slug   = isset( $locale_parts[1] ) ? $locale_parts[1] : 'default';
    146148
    147149        $path   = $wpdb->escape( like_escape( $path ) . '%' );
    148150        $locale = $wpdb->escape( $locale );
     151        $slug   = $wpdb->escape( $slug );
    149152
    150153        $date = $wpdb->prepare( "AND tt.date_added > %s", $this->get_start_date() );
     
    160163            WHERE tp.path LIKE '$path'
    161164                AND tts.locale = '$locale'
    162                 AND tts.slug = 'default'
     165                AND tts.slug = '$slug'
    163166                AND ( tt.status = 'current' || tt.status = 'old' )
    164167                AND tt.user_id IS NOT NULL
     
    220223        $project_ids[] = '0'; // Global validators
    221224
     225        $locale_parts = explode( '/', $gp_locale->slug );
     226        $locale = $locale_parts[0];
     227
    222228        return $wpdb->get_col( $wpdb->prepare( "
    223229            SELECT `user_id` FROM `translate_translation_editors`
    224230            WHERE `project_id` IN (" . implode( ', ', $project_ids ) . ") AND `locale` = %s
    225         ", $gp_locale->slug ) );
     231        ", $locale ) );
    226232    }
    227233
Note: See TracChangeset for help on using the changeset viewer.