Changeset 3341
- Timestamp:
- 06/12/2016 11:54:09 AM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r3326 r3341 20 20 21 21 $count = get_post_meta( $post->ID, 'active_installs', true ); 22 22 23 23 if ( $count <= 10 ) { 24 24 $text = __( 'Less than 10', 'wporg-plugins' ); … … 266 266 return false; 267 267 } 268 269 $banner = $banner_2x = false; 268 270 $plugin_slug = $plugin->post_name; 269 270 271 $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true ); 271 272 272 $banner = $banner_2x = false; 273 foreach ( $raw_banners as $file => $info ) { 273 // Split in rtl and non-rtl banners. 274 $rtl_banners = array_filter( $raw_banners, function( $info ) { 275 return (bool) stristr( $info['filename'], '-rtl' ); 276 } ); 277 $raw_banners = array_diff_key( $raw_banners, $rtl_banners ); 278 279 // Default are non-rtl banners. 280 foreach ( $raw_banners as $info ) { 274 281 switch ( $info['resolution'] ) { 275 282 case '1544x500': … … 280 287 $banner = self::get_asset_url( $plugin_slug, $info ); 281 288 break; 289 } 290 } 291 292 if ( is_rtl() ) { 293 foreach ( $rtl_banners as $info ) { 294 switch ( $info['resolution'] ) { 295 case '1544x500': 296 $banner_2x = self::get_asset_url( $plugin_slug, $info ); 297 break; 298 299 case '772x250': 300 $banner = self::get_asset_url( $plugin_slug, $info ); 301 break; 302 } 282 303 } 283 304 } … … 292 313 $html = "<style type='text/css'>"; 293 314 $html .= "#{$id} { background-image: url('{$banner}'); }"; 294 if ( ! empty( $ icon_2x ) ) {315 if ( ! empty( $banner_2x ) ) { 295 316 $html .= "@media only screen and (-webkit-min-device-pixel-ratio: 1.5) { #{$id} { background-image: url('{$banner_2x}'); } }"; 296 317 } … … 300 321 return $html; 301 322 break; 323 302 324 case 'raw': 303 325 default: -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r3335 r3341 292 292 if ( $svn_assets_folder ) { // /assets/ may not exist. 293 293 foreach ( $svn_assets_folder as $asset ) { 294 // screenshot-0 .(png|jpg|jpeg|gif) || icon.svg295 if ( ! preg_match( '!^(?P<type>screenshot|banner|icon)(-(?P<resolution>[\dx]+) \.(png|jpg|jpeg|gif)|\.svg)$!i', $asset['filename'], $m ) ) {294 // screenshot-0(-rtl).(png|jpg|jpeg|gif) || icon.svg 295 if ( ! preg_match( '!^(?P<type>screenshot|banner|icon)(-(?P<resolution>[\dx]+)(-rtl)?\.(png|jpg|jpeg|gif)|\.svg)$!i', $asset['filename'], $m ) ) { 296 296 continue; 297 297 }
Note: See TracChangeset
for help on using the changeset viewer.