Changeset 47122 for trunk/src/wp-includes/theme.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/theme.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r47088 r47122 399 399 400 400 if ( ! file_exists( $directory ) ) { 401 // Try prepending as the theme directory could be relative to the content directory 401 // Try prepending as the theme directory could be relative to the content directory. 402 402 $directory = WP_CONTENT_DIR . '/' . $directory; 403 // If this directory does not exist, return and do not register 403 // If this directory does not exist, return and do not register. 404 404 if ( ! file_exists( $directory ) ) { 405 405 return false; … … 447 447 $relative_theme_roots = array(); 448 448 449 // Set up maybe-relative, maybe-absolute array of theme directories. 450 // We always want to return absolute, but we need to cache relative 451 // to use in get_theme_root(). 449 /* 450 * Set up maybe-relative, maybe-absolute array of theme directories. 451 * We always want to return absolute, but we need to cache relative 452 * to use in get_theme_root(). 453 */ 452 454 foreach ( $wp_theme_directories as $theme_root ) { 453 455 if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) { … … 483 485 } 484 486 if ( ! is_int( $cache_expiration ) ) { 485 $cache_expiration = 1800; // half hour487 $cache_expiration = 30 * MINUTE_IN_SECONDS; 486 488 } 487 489 } else { 488 $cache_expiration = 1800; // half hour490 $cache_expiration = 30 * MINUTE_IN_SECONDS; 489 491 } 490 492 … … 504 506 if ( file_exists( $theme_root . '/' . $dir . '/style.css' ) ) { 505 507 // wp-content/themes/a-single-theme 506 // wp-content/themes is $theme_root, a-single-theme is $dir 508 // wp-content/themes is $theme_root, a-single-theme is $dir. 507 509 $found_themes[ $dir ] = array( 508 510 'theme_file' => $dir . '/style.css', … … 512 514 $found_theme = false; 513 515 // wp-content/themes/a-folder-of-themes/* 514 // wp-content/themes is $theme_root, a-folder-of-themes is $dir, then themes are $sub_dirs 516 // wp-content/themes is $theme_root, a-folder-of-themes is $dir, then themes are $sub_dirs. 515 517 $sub_dirs = @ scandir( $theme_root . '/' . $dir ); 516 518 if ( ! $sub_dirs ) { … … 676 678 $theme_root = false; 677 679 678 // If requesting the root for the current theme, consult options to avoid calling get_theme_roots() 680 // If requesting the root for the current theme, consult options to avoid calling get_theme_roots(). 679 681 if ( ! $skip_cache ) { 680 682 if ( get_option( 'stylesheet' ) == $stylesheet_or_template ) { … … 1278 1280 $header_images = array(); 1279 1281 1280 // @todo caching1282 // @todo Caching. 1281 1283 $headers = get_posts( 1282 1284 array( … … 1985 1987 function get_editor_stylesheets() { 1986 1988 $stylesheets = array(); 1987 // load editor_style.css if the current theme supports it1989 // Load editor_style.css if the current theme supports it. 1988 1990 if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) { 1989 1991 $editor_styles = $GLOBALS['editor_styles']; … … 2122 2124 'url' => home_url( '/' ), 2123 2125 ), 2124 'page_home' => array( // Deprecated in favor of link_home.2126 'page_home' => array( // Deprecated in favor of 'link_home'. 2125 2127 'type' => 'post_type', 2126 2128 'object' => 'page', … … 2302 2304 break; 2303 2305 2304 // All that's left now are posts (besides attachments). Not a default case for the sake of clarity and future work. 2306 // All that's left now are posts (besides attachments). 2307 // Not a default case for the sake of clarity and future work. 2305 2308 case 'posts': 2306 2309 foreach ( $config[ $type ] as $id => $item ) { … … 2492 2495 } 2493 2496 2494 // If a constant was defined, use that value. Otherwise, define the constant to ensure 2495 // the constant is always accurate (and is not defined later, overriding our value). 2496 // As stated above, the first value wins. 2497 // Once we get to wp_loaded (just-in-time), define any constants we haven't already. 2498 // Constants are lame. Don't reference them. This is just for backward compatibility. 2497 /* 2498 * If a constant was defined, use that value. Otherwise, define the constant to ensure 2499 * the constant is always accurate (and is not defined later, overriding our value). 2500 * As stated above, the first value wins. 2501 * Once we get to wp_loaded (just-in-time), define any constants we haven't already. 2502 * Constants are lame. Don't reference them. This is just for backward compatibility. 2503 */ 2499 2504 2500 2505 if ( defined( 'NO_HEADER_TEXT' ) ) { … … 2829 2834 } 2830 2835 2831 // If no args passed then no extra checks need be performed 2836 // If no args passed then no extra checks need be performed. 2832 2837 if ( ! $args ) { 2833 2838 return true; … … 2836 2841 switch ( $feature ) { 2837 2842 case 'post-thumbnails': 2838 // post-thumbnails can be registered for only certain content/post types by passing 2839 // an array of types to add_theme_support(). If no array was passed, then 2840 // any type is accepted 2843 /* 2844 * post-thumbnails can be registered for only certain content/post types 2845 * by passing an array of types to add_theme_support(). 2846 * If no array was passed, then any type is accepted. 2847 */ 2841 2848 if ( true === $_wp_theme_features[ $feature ] ) { // Registered for all types 2842 2849 return true; … … 2847 2854 case 'html5': 2848 2855 case 'post-formats': 2849 // specific post formats can be registered by passing an array of types to 2850 // add_theme_support() 2851 2852 // Specific areas of HTML5 support *must* be passed via an array to add_theme_support() 2853 2856 /* 2857 * Specific post formats can be registered by passing an array of types 2858 * to add_theme_support(). 2859 * 2860 * Specific areas of HTML5 support *must* be passed via an array to add_theme_support(). 2861 */ 2854 2862 $type = $args[0]; 2855 2863 return in_array( $type, $_wp_theme_features[ $feature ][0] ); … … 2942 2950 $old_theme = wp_get_theme( $stylesheet ); 2943 2951 2944 // Prevent widget & menu mapping from running since Customizer already called it up front 2952 // Prevent widget & menu mapping from running since Customizer already called it up front. 2945 2953 if ( get_option( 'theme_switched_via_customizer' ) ) { 2946 2954 remove_action( 'after_switch_theme', '_wp_menus_changed' ); … … 3014 3022 3015 3023 $theme = null; 3016 $ changeset_uuid = false; // Value false indicates UUID should be determined after_setup_theme to either re-use existing saved changeset or else generate a new UUID if none exists.3024 $autosaved = null; 3017 3025 $messenger_channel = null; 3018 $autosaved = null; 3019 $branching = false; // Set initially fo false since defaults to true for back-compat; can be overridden via the customize_changeset_branching filter. 3026 3027 // Value false indicates UUID should be determined after_setup_theme 3028 // to either re-use existing saved changeset or else generate a new UUID if none exists. 3029 $changeset_uuid = false; 3030 3031 // Set initially fo false since defaults to true for back-compat; 3032 // can be overridden via the customize_changeset_branching filter. 3033 $branching = false; 3020 3034 3021 3035 if ( $is_customize_admin_page && isset( $input_vars['changeset_uuid'] ) ) { … … 3250 3264 3251 3265 b[c] = b[c].replace( rcs, ' ' ); 3252 // The customizer requires postMessage and CORS (if the site is cross domain) 3266 // The customizer requires postMessage and CORS (if the site is cross domain). 3253 3267 b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs; 3254 3268 }());
Note: See TracChangeset
for help on using the changeset viewer.