Changeset 57878
- Timestamp:
- 03/26/2024 01:23:14 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/fonts.php
r57871 r57878 168 168 } 169 169 170 $site_path = '';171 if ( is_multisite() && ! ( is_main_network() && is_main_site() ) ) {172 $site_path = '/sites/' . get_current_blog_id();173 }174 175 170 $font_dir = array( 176 'path' => path_join( WP_CONTENT_DIR, 'fonts' ) . $site_path,177 'url' => untrailingslashit( content_url( 'fonts' ) ) . $site_path,171 'path' => untrailingslashit( $font_dir['basedir'] ) . '/fonts', 172 'url' => untrailingslashit( $font_dir['baseurl'] ) . '/fonts', 178 173 'subdir' => '', 179 'basedir' => path_join( WP_CONTENT_DIR, 'fonts' ) . $site_path,180 'baseurl' => untrailingslashit( content_url( 'fonts' ) ) . $site_path,174 'basedir' => untrailingslashit( $font_dir['basedir'] ) . '/fonts', 175 'baseurl' => untrailingslashit( $font_dir['baseurl'] ) . '/fonts', 181 176 'error' => false, 182 177 ); -
trunk/tests/phpunit/tests/fonts/font-library/wpFontsDir.php
r57868 r57878 16 16 public static function set_up_before_class() { 17 17 parent::set_up_before_class(); 18 $upload_dir = wp_get_upload_dir(); 18 19 19 20 static::$dir_defaults = array( 20 'path' => path_join( WP_CONTENT_DIR, 'fonts' ),21 'url' => content_url( 'fonts' ),21 'path' => untrailingslashit( $upload_dir['basedir'] ) . '/fonts', 22 'url' => untrailingslashit( $upload_dir['baseurl'] ) . '/fonts', 22 23 'subdir' => '', 23 'basedir' => path_join( WP_CONTENT_DIR, 'fonts' ),24 'baseurl' => content_url( 'fonts' ),24 'basedir' => untrailingslashit( $upload_dir['basedir'] ) . '/fonts', 25 'baseurl' => untrailingslashit( $upload_dir['baseurl'] ) . '/fonts', 25 26 'error' => false, 26 27 ); 27 28 } 28 29 30 /** 31 * Ensure the font directory is correct. 32 */ 29 33 public function test_fonts_dir() { 30 34 $font_dir = wp_get_font_dir(); … … 33 37 } 34 38 39 /** 40 * Ensure that the fonts directory is correct for a multisite installation. 41 * 42 * The main site will use the default location and others will follow a pattern of `/sites/{$blog_id}/fonts` 43 * 44 * @group multisite 45 * @group ms-required 46 */ 47 public function test_fonts_dir_for_multisite() { 48 $blog_id = self::factory()->blog->create(); 49 $main_site_upload_dir = wp_get_upload_dir(); 50 switch_to_blog( $blog_id ); 51 52 $actual = wp_get_font_dir(); 53 $expected = array( 54 'path' => untrailingslashit( $main_site_upload_dir['basedir'] ) . "/sites/{$blog_id}/fonts", 55 'url' => untrailingslashit( $main_site_upload_dir['baseurl'] ) . "/sites/{$blog_id}/fonts", 56 'subdir' => '', 57 'basedir' => untrailingslashit( $main_site_upload_dir['basedir'] ) . "/sites/{$blog_id}/fonts", 58 'baseurl' => untrailingslashit( $main_site_upload_dir['baseurl'] ) . "/sites/{$blog_id}/fonts", 59 'error' => false, 60 ); 61 62 // Restore blog prior to assertions. 63 restore_current_blog(); 64 $this->assertSameSets( $expected, $actual ); 65 } 66 67 /** 68 * Ensure modifying the font directory via the 'font_dir' filter works. 69 */ 35 70 public function test_fonts_dir_with_filter() { 36 71 // Define a callback function to pass to the filter. … … 72 107 73 108 /** 109 * Ensure infinite loops are not triggered when filtering the font uploads directory. 110 * 74 111 * @ticket 60652 75 112 */
Note: See TracChangeset
for help on using the changeset viewer.