Making WordPress.org

Changeset 4441


Ignore:
Timestamp:
11/28/2016 07:24:05 PM (8 years ago)
Author:
ocean90
Message:

WP i18n teams: Avoid notices if a locale doesn't exist.

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/all-locales.php

    r4430 r4441  
    128128                    </td>
    129129
    130                     <td>
     130                    <td class="center">
    131131                        <a href="<?php echo esc_url( add_query_arg( 'locale', $locale->wp_locale ) ); ?>">
    132132                            <?php _e( 'View Team Page', 'wporg' ); ?>
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php

    r4431 r4441  
    8484            require_once GLOTPRESS_LOCALES_PATH;
    8585            $locale = GP_Locales::by_field( 'wp_locale', $_GET['locale'] );
    86             $locale_data = $this->get_extended_locale_data( $locale );
    87             require( __DIR__ . '/views/locale-details.php' );
     86            if ( $locale ) {
     87                $locale_data = $this->get_extended_locale_data( $locale );
     88                require( __DIR__ . '/views/locale-details.php' );
     89            } else {
     90                printf(
     91                    '<div class="callout callout-warning"><p>%s</p><p><a href="%s">%s</a></p></div>',
     92                    sprintf(
     93                        __( 'Locale %s doesn&#8217;t exists.', 'wporg' ),
     94                        '<code>' . esc_html( $_GET['locale'] ) . '</code>'
     95                    ),
     96                    esc_url( get_permalink() ),
     97                    __( 'Return to All Locales', 'wporg' )
     98                );
     99            }
    88100        }
    89101
Note: See TracChangeset for help on using the changeset viewer.