WordPress.org

Making WordPress.org

Changeset 1068


Ignore:
Timestamp:
12/24/2014 12:45:20 PM (7 years ago)
Author:
ocean90
Message:

I18N Teams: Hide download links for locales which have never released a version.

see #340.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php

    r1061 r1068  
    1111        <li>
    1212            <strong><?php _e( 'Locale site:', 'wporg' ); ?></strong>
    13             <a href="<?php echo esc_url( $locale_data['rosetta_site_url'] ); ?>"><?php echo parse_url( $locale_data['rosetta_site_url'], PHP_URL_HOST ); ?></a>
     13            <?php if ( $locale_data['rosetta_site_url'] ) : ?>
     14                <a href="<?php echo esc_url( $locale_data['rosetta_site_url'] ); ?>"><?php echo parse_url( $locale_data['rosetta_site_url'], PHP_URL_HOST ); ?></a>
     15            <?php else : ?>
     16                &mdash;
     17            <?php endif; ?>
    1418        </li>
    1519        <li>
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php

    r1061 r1068  
    132132        $locales_data = $this->get_locales_data();
    133133        $locale_data = $locales_data[ $locale->wp_locale ];
     134        $locale_data['localized_core_url'] = $locale_data['language_pack_url'] = false;
     135
     136        $latest_release = $locale_data['latest_release'];
     137        if ( $latest_release ) {
     138            list( $x, $y ) = explode( '.', $latest_release );
     139            $latest_branch = "$x.$y";
     140            $locale_data['localized_core_url'] = sprintf( '%s/wordpress-%s-%s.zip', $locale_data['rosetta_site_url'], $latest_release, $locale->wp_locale );
     141
     142            if ( version_compare( $latest_release, '4.0', '>=' ) ) {
     143                $locale_data['language_pack_url'] = sprintf( 'https://downloads.wordpress.org/translation/core/%s/%s.zip', $latest_branch, $locale->wp_locale );
     144            }
     145        }
    134146
    135147        $contributors = self::get_contributors( $locale );
    136         $latest_release = $locale_data['latest_release'];
    137         list( $x, $y ) = explode( '.', $latest_release );
    138         $latest_branch = "$x.$y";
    139 
    140         $locale_data['localized_core_url'] = sprintf( '%s/wordpress-%s-%s.zip', $locale_data['rosetta_site_url'], $latest_release, $locale->wp_locale );
    141 
    142         if ( version_compare( $latest_release, '4.0', '>=' ) ) {
    143             $locale_data['language_pack_url'] = sprintf( 'https://downloads.wordpress.org/translation/core/%s/%s.zip', $latest_branch, $locale->wp_locale );
    144         } else {
    145             $locale_data['language_pack_url'] = false;
    146         }
    147 
    148148        $locale_data['validators'] = $contributors['validators'];
    149149        $locale_data['translators'] = $contributors['translators'];
     
    232232
    233233$GLOBALS['wp_i18n_teams'] = new WP_I18n_Teams();
    234 
Note: See TracChangeset for help on using the changeset viewer.