Changeset 8729 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php
- Timestamp:
- 05/03/2019 07:03:20 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php
r6287 r8729 16 16 */ 17 17 static function display() { 18 $plugin = get_post();19 18 $output = ''; 20 19 21 // All indexed from 1. 22 $descriptions = get_post_meta( $plugin->ID, 'screenshots', true ) ?: array(); 23 $screen_shots = get_post_meta( $plugin->ID, 'assets_screenshots', true ) ?: array(); 20 $screenshots = Template::get_screenshots(); 24 21 25 if ( empty( $screen_shots )) {22 if ( ! $screenshots ) { 26 23 return ''; 27 24 } 28 25 29 ksort( $screen_shots, SORT_NATURAL ); 30 31 /* 32 * Find the image that corresponds with the text. 33 * The image numbers are stored within the 'resolution' key. 34 */ 35 foreach ( $screen_shots as $image ) { 26 foreach ( $screenshots as $image ) { 36 27 $screen_shot = sprintf( 37 28 '<a href="%1$s" rel="nofollow"><img class="screenshot" src="%1$s" alt="" /></a>', 38 esc_url( Template::get_asset_url( $plugin, $image ))29 esc_url( $image['src'] ) 39 30 ); 40 31 41 if ( $descriptions && ! empty( $descriptions[ (int) $image['resolution'] ] ) ) { 42 $caption = $descriptions[ (int) $image['resolution'] ]; 43 $caption = Plugin_I18n::instance()->translate( 'screenshot-' . $image['resolution'], $caption, [ 'post_id' => $plugin->ID ] ); 44 45 $screen_shot .= '<figcaption>' . $caption . '</figcaption>'; 32 if ( $image['caption'] ) { 33 $screen_shot .= '<figcaption>' . $image['caption'] . '</figcaption>'; 46 34 } 47 35
Note: See TracChangeset
for help on using the changeset viewer.