diff --git wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
index d407c1295..7545b4df3 100644
|
|
class Import { |
362 | 362 | $svn_assets_folder = SVN::ls( self::PLUGIN_SVN_BASE . "/{$plugin_slug}/assets/", true /* verbose */ ); |
363 | 363 | if ( $svn_assets_folder ) { // /assets/ may not exist. |
364 | 364 | foreach ( $svn_assets_folder as $asset ) { |
365 | | // screenshot-0(-rtl).(png|jpg|jpeg|gif) || icon.svg |
366 | | if ( ! preg_match( '!^(?P<type>screenshot|banner|icon)(-(?P<resolution>[\dx]+)(-rtl)?\.(png|jpg|jpeg|gif)|\.svg)$!i', $asset['filename'], $m ) ) { |
| 365 | // screenshot-0(-rtl)(-de_DE).(png|jpg|jpeg|gif) || icon.svg |
| 366 | if ( ! preg_match( '!^(?P<type>screenshot|banner|icon)(-(?P<resolution>[\dx]+)(-rtl)?(-(?P<locale>[a-z]{2}\_[A-Z]{2}))?\.(png|jpg|jpeg|gif)|\.svg)$!i', $asset['filename'], $m ) ) { |
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | |
… |
… |
class Import { |
372 | 372 | $revision = $asset['revision']; |
373 | 373 | $location = 'assets'; |
374 | 374 | $resolution = isset( $m['resolution'] ) ? $m['resolution'] : false; |
| 375 | $locale = isset( $m['locale'] ) ? $m['locale'] : false; |
375 | 376 | |
376 | | $assets[ $type ][ $asset['filename'] ] = compact( 'filename', 'revision', 'resolution', 'location' ); |
| 377 | $assets[ $type ][ $asset['filename'] ] = compact( 'filename', 'revision', 'resolution', 'location', 'locale' ); |
377 | 378 | } |
378 | 379 | } |
379 | 380 | |
diff --git wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php
index 4bfe1400a..edda95b9d 100644
|
|
class Screenshots { |
28 | 28 | |
29 | 29 | ksort( $screen_shots, SORT_NATURAL ); |
30 | 30 | |
| 31 | $displayed_keys = array(); |
| 32 | |
31 | 33 | /* |
32 | 34 | * Find the image that corresponds with the text. |
33 | 35 | * The image numbers are stored within the 'resolution' key. |
| 36 | * The same key can have more than one screenshot with different locales. |
34 | 37 | */ |
35 | 38 | foreach ( $screen_shots as $image ) { |
| 39 | |
| 40 | if ( !empty($image['locale']) && $image['locale'] != get_locale() ){ |
| 41 | continue; |
| 42 | } |
| 43 | |
| 44 | if ( in_array( $image['resolution'], $displayed_keys ) ){ |
| 45 | continue; |
| 46 | } |
| 47 | |
| 48 | $displayed_keys[] = $image['resolution']; |
| 49 | |
36 | 50 | $screen_shot = sprintf( |
37 | 51 | '<a href="%1$s" rel="nofollow"><img class="screenshot" src="%1$s" alt="" /></a>', |
38 | 52 | esc_url( Template::get_asset_url( $plugin, $image ) ) |