Making WordPress.org


Ignore:
Timestamp:
06/19/2016 12:15:28 PM (10 years ago)
Author:
ocean90
Message:

Plugin Directory: Pass the post object to Plugin_I18n::translate().

Fixes missing translations for excerpts on the front page.

See #1691.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-i18n.php

    r3391 r3468  
    268268                }
    269269
    270                 if ( !empty( $args['post_id'] ) && is_numeric( $args['post_id'] ) ) {
    271                         $topic = get_post( $args['post_id'] );
    272                 } else {
    273                         global $post;
    274                 }
    275 
    276                 if ( empty( $post ) ) {
    277                         return $content;
    278                 }
    279 
    280                 if ( !empty( $args['locale'] ) ) {
     270                $args = wp_parse_args( $args, [
     271                        'post_id' => null,
     272                        'locale'  => '',
     273                ] );
     274
     275                $post = get_post( $args['post_id'] );
     276
     277                if ( ! $post ) {
     278                        return $content;
     279                }
     280
     281                if ( ! empty( $args['locale'] ) ) {
    281282                        $wp_locale = $args['locale'];
    282283                } else {
Note: See TracChangeset for help on using the changeset viewer.