Changeset 4657 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
- Timestamp:
- 01/13/2017 08:13:14 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r4622 r4657 363 363 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 364 364 * @param array $asset Assets folder information. 365 * @param bool $cdn Optional. If the url should be CDN'ised. Default true. 365 366 * @return string 366 367 */ 367 public static function get_asset_url( $post, $asset ) {368 public static function get_asset_url( $post, $asset, $cdn = true ) { 368 369 if ( ! empty( $asset['location'] ) && 'plugin' == $asset['location'] ) { 369 370 370 371 // Screenshots in the plugin folder - /plugins/plugin-name/screenshot-1.png. 371 $format = 'https:// i0.wp.com/plugins.svn.wordpress.org/!svn/bc/%1$s/%2$s/trunk/%3$s?strip=all';372 $format = 'https://plugins.svn.wordpress.org/!svn/bc/%1$s/%2$s/trunk/%3$s'; 372 373 } else { 373 374 374 375 // Images in the assets folder - /plugin-name/assets/screenshot-1.png. 375 $format = 'https:// i0.wp.com/plugins.svn.wordpress.org/!svn/bc/%1$s/%2$s/assets/%3$s?strip=all';376 $format = 'https://plugins.svn.wordpress.org/!svn/bc/%1$s/%2$s/assets/%3$s'; 376 377 } 377 378 378 379 // Photon does not support SVG files. https://github.com/Automattic/jetpack/issues/81 379 380 if ( strpos( $asset['filename'], '.svg' ) ) { 380 $ format = str_replace( 'i0.wp.com/', '', $format );381 } 382 383 return esc_url(sprintf(381 $cdn = false; 382 } 383 384 $url = sprintf( 384 385 $format, 385 386 $asset['revision'], 386 387 get_post( $post )->post_name, 387 388 $asset['filename'] 388 ) ); 389 ); 390 391 // Use Jetpacks Photon CDN when available. 392 if ( $cdn && function_exists( 'jetpack_photon_url' ) ) { 393 $url = jetpack_photon_url( $url, array( 'strip' => 'all' ) ); 394 } 395 396 return esc_url( $url ); 389 397 } 390 398
Note: See TracChangeset
for help on using the changeset viewer.