SILENT KILLERPanel

Current Path: > home > codekrsu > > escapematrixonline.com > wp-includes >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//escapematrixonline.com/wp-includes/

NameTypeSizeLast ModifiedActions
ID3 Directory - -
IXR Directory - -
PHPMailer Directory - -
Requests Directory - -
SimplePie Directory - -
Text Directory - -
assets Directory - -
block-bindings Directory - -
block-patterns Directory - -
block-supports Directory - -
blocks Directory - -
certificates Directory - -
css Directory - -
customize Directory - -
fonts Directory - -
html-api Directory - -
images Directory - -
interactivity-api Directory - -
js Directory - -
l10n Directory - -
php-compat Directory - -
pomo Directory - -
rest-api Directory - -
sitemaps Directory - -
sodium_compat Directory - -
style-engine Directory - -
theme-compat Directory - -
widgets Directory - -
admin-bar.php File 37106 bytes April 28 2025 19:12:28.
atomlib.php File 12078 bytes September 19 2024 01:20:16.
author-template.php File 18951 bytes May 14 2023 21:58:24.
block-bindings.php File 5594 bytes June 12 2024 16:44:14.
block-editor.php File 28797 bytes March 17 2025 17:03:30.
block-i18n.json File 316 bytes August 11 2021 13:08:02.
block-patterns.php File 13213 bytes November 30 2024 03:46:22.
block-template-utils.php File 61907 bytes March 07 2025 22:55:24.
block-template.php File 15356 bytes March 19 2025 02:08:26.
blocks.php File 113051 bytes July 08 2025 13:01:26.
bookmark-template.php File 12768 bytes March 20 2025 03:15:36.
bookmark.php File 15427 bytes March 23 2024 18:20:12.
cache-compat.php File 5969 bytes October 10 2022 22:22:12.
cache.php File 13474 bytes October 10 2022 22:22:12.
canonical.php File 34523 bytes August 23 2024 03:47:16.
capabilities.php File 42718 bytes October 15 2024 18:13:20.
category-template.php File 57003 bytes September 26 2023 04:27:12.
category.php File 12829 bytes January 25 2025 04:28:24.
class-IXR.php File 2616 bytes January 23 2025 00:48:26.
class-avif-info.php File 29615 bytes April 26 2024 19:02:14.
class-feed.php File 539 bytes October 01 2024 02:50:20.
class-http.php File 367 bytes June 17 2022 15:20:14.
class-json.php File 43684 bytes February 03 2023 18:35:20.
class-oembed.php File 401 bytes June 17 2022 15:20:14.
class-phpass.php File 6771 bytes September 18 2024 01:08:16.
class-phpmailer.php File 664 bytes July 21 2020 16:58:02.
class-pop3.php File 21121 bytes October 26 2024 00:26:20.
class-requests.php File 2237 bytes April 05 2023 17:12:26.
class-simplepie.php File 453 bytes October 01 2024 02:50:20.
class-smtp.php File 457 bytes January 26 2021 18:45:58.
class-snoopy.php File 37715 bytes February 03 2023 18:35:20.
class-walker-category-dropdown.php File 2469 bytes September 14 2023 16:46:20.
class-walker-category.php File 8477 bytes September 08 2023 13:32:24.
class-walker-comment.php File 14221 bytes March 18 2024 19:46:14.
class-walker-nav-menu.php File 12044 bytes January 22 2025 02:26:24.
class-walker-page-dropdown.php File 2710 bytes September 14 2023 16:46:20.
class-walker-page.php File 7612 bytes September 14 2023 16:46:20.
class-wp-admin-bar.php File 17874 bytes July 18 2024 04:52:18.
class-wp-ajax-response.php File 5266 bytes September 12 2022 19:47:14.
class-wp-application-passwords.php File 17099 bytes April 03 2025 18:38:28.
class-wp-block-bindings-registry.php File 8463 bytes September 23 2024 16:35:16.
class-wp-block-bindings-source.php File 2992 bytes September 03 2024 20:33:16.
class-wp-block-editor-context.php File 1350 bytes September 12 2022 19:47:14.
class-wp-block-list.php File 4757 bytes November 02 2023 04:04:24.
class-wp-block-metadata-registry.php File 11895 bytes March 06 2025 03:17:24.
class-wp-block-parser-block.php File 2555 bytes June 27 2023 04:45:38.
class-wp-block-parser-frame.php File 2017 bytes September 20 2024 05:55:36.
class-wp-block-parser.php File 11532 bytes May 03 2024 00:09:16.
class-wp-block-pattern-categories-registry.php File 5371 bytes September 12 2022 19:47:14.
class-wp-block-patterns-registry.php File 10783 bytes September 27 2024 13:20:18.
class-wp-block-styles-registry.php File 6403 bytes February 04 2025 13:42:26.
class-wp-block-supports.php File 5626 bytes March 04 2025 18:06:28.
class-wp-block-template.php File 2033 bytes September 20 2024 06:07:12.
class-wp-block-templates-registry.php File 7231 bytes January 31 2025 02:19:26.
class-wp-block-type-registry.php File 5013 bytes October 12 2023 16:34:34.
class-wp-block-type.php File 17265 bytes May 02 2024 04:01:10.
class-wp-block.php File 23041 bytes February 14 2025 23:38:22.
class-wp-classic-to-block-menu-converter.php File 4088 bytes August 21 2023 21:51:20.
class-wp-comment-query.php File 48395 bytes June 21 2024 21:26:14.
class-wp-comment.php File 9437 bytes February 11 2025 18:40:30.
class-wp-customize-control.php File 25851 bytes February 08 2025 17:00:20.
class-wp-customize-manager.php File 202593 bytes February 08 2025 21:00:20.
class-wp-customize-nav-menus.php File 57412 bytes March 07 2025 04:48:24.
class-wp-customize-panel.php File 10710 bytes January 23 2025 00:48:26.
class-wp-customize-section.php File 11209 bytes October 13 2024 23:09:12.
class-wp-customize-setting.php File 29962 bytes January 23 2025 00:48:26.
class-wp-customize-widgets.php File 72210 bytes January 22 2025 03:38:24.
class-wp-date-query.php File 35732 bytes November 27 2024 16:40:18.
class-wp-dependencies.php File 15139 bytes August 26 2024 03:48:14.
class-wp-dependency.php File 2627 bytes November 25 2022 20:12:16.
class-wp-duotone.php File 40783 bytes June 14 2024 16:18:12.
class-wp-editor.php File 72335 bytes April 25 2025 22:28:30.
class-wp-embed.php File 15931 bytes April 14 2025 18:31:24.
class-wp-error.php File 7502 bytes February 21 2023 21:39:20.
class-wp-exception.php File 253 bytes September 27 2024 23:28:14.
class-wp-fatal-error-handler.php File 8150 bytes October 22 2024 14:16:16.
class-wp-feed-cache-transient.php File 3176 bytes October 01 2024 02:50:20.
class-wp-feed-cache.php File 969 bytes October 01 2024 02:50:20.
class-wp-hook.php File 16000 bytes September 18 2023 16:41:18.
class-wp-http-cookie.php File 7389 bytes June 24 2023 21:17:24.
class-wp-http-curl.php File 12541 bytes September 21 2023 22:29:12.
class-wp-http-encoding.php File 6689 bytes June 22 2023 18:57:24.
class-wp-http-ixr-client.php File 3501 bytes September 12 2022 19:47:14.
class-wp-http-proxy.php File 5980 bytes June 22 2023 18:36:26.
class-wp-http-requests-hooks.php File 2022 bytes December 16 2022 02:32:18.
class-wp-http-requests-response.php File 4400 bytes October 11 2023 11:05:26.
class-wp-http-response.php File 2977 bytes September 12 2022 19:47:14.
class-wp-http-streams.php File 16859 bytes September 21 2023 22:29:12.
class-wp-http.php File 41579 bytes January 23 2025 00:48:26.
class-wp-image-editor-gd.php File 20162 bytes November 30 2024 04:48:16.
class-wp-image-editor-imagick.php File 34735 bytes March 19 2025 03:25:32.
class-wp-image-editor.php File 17527 bytes February 22 2025 01:25:24.
class-wp-list-util.php File 7443 bytes February 28 2024 03:38:16.
class-wp-locale-switcher.php File 6776 bytes January 08 2025 17:54:18.
class-wp-locale.php File 16883 bytes February 26 2025 03:40:22.
class-wp-matchesmapregex.php File 1828 bytes February 06 2024 06:25:14.
class-wp-meta-query.php File 30531 bytes April 23 2024 00:25:08.
class-wp-metadata-lazyloader.php File 6833 bytes May 11 2023 15:15:24.
class-wp-navigation-fallback.php File 9211 bytes October 06 2023 18:06:22.
class-wp-network-query.php File 19857 bytes June 21 2024 21:26:14.
class-wp-network.php File 12296 bytes September 14 2024 02:12:16.
class-wp-object-cache.php File 17524 bytes September 19 2024 16:12:16.
class-wp-oembed-controller.php File 6905 bytes March 06 2024 10:05:12.
class-wp-oembed.php File 31606 bytes June 26 2025 23:06:34.
class-wp-paused-extensions-storage.php File 5111 bytes September 03 2024 22:19:14.
class-wp-phpmailer.php File 3802 bytes January 08 2025 17:54:18.
class-wp-plugin-dependencies.php File 25315 bytes March 18 2025 02:40:26.
class-wp-post-type.php File 30680 bytes February 09 2025 16:09:22.
class-wp-post.php File 6488 bytes July 22 2025 14:56:36.
class-wp-query.php File 158023 bytes March 19 2025 03:34:26.
class-wp-recovery-mode-cookie-service.php File 6877 bytes October 04 2022 07:59:14.
class-wp-recovery-mode-email-service.php File 11183 bytes May 02 2023 19:45:22.
class-wp-recovery-mode-key-service.php File 4884 bytes February 17 2025 16:24:22.
class-wp-recovery-mode-link-service.php File 3463 bytes September 12 2022 19:47:14.
class-wp-recovery-mode.php File 11453 bytes February 23 2025 16:11:22.
class-wp-rewrite.php File 63688 bytes October 20 2024 03:54:18.
class-wp-role.php File 2523 bytes September 08 2023 13:32:24.
class-wp-roles.php File 8586 bytes September 03 2024 22:19:14.
class-wp-script-modules.php File 19463 bytes December 11 2024 20:20:18.
class-wp-scripts.php File 28344 bytes August 11 2024 03:00:14.
class-wp-session-tokens.php File 7319 bytes February 11 2025 16:14:22.
class-wp-simplepie-file.php File 3408 bytes October 01 2024 02:50:20.
class-wp-simplepie-sanitize-kses.php File 1910 bytes January 23 2025 00:48:26.
class-wp-site-query.php File 31625 bytes September 11 2024 16:08:20.
class-wp-site.php File 7454 bytes September 12 2022 19:47:14.
class-wp-speculation-rules.php File 7527 bytes February 19 2025 03:32:22.
class-wp-styles.php File 11010 bytes August 11 2024 03:00:14.
class-wp-tax-query.php File 19555 bytes February 17 2024 02:47:12.
class-wp-taxonomy.php File 18559 bytes March 27 2025 02:07:28.
class-wp-term-query.php File 40869 bytes October 31 2024 02:34:20.
class-wp-term.php File 5298 bytes September 12 2022 19:47:14.
class-wp-text-diff-renderer-inline.php File 979 bytes February 15 2024 00:27:10.
class-wp-text-diff-renderer-table.php File 18880 bytes January 23 2025 00:48:26.
class-wp-textdomain-registry.php File 10481 bytes November 20 2024 07:50:24.
class-wp-theme-json-data.php File 1809 bytes June 04 2024 15:55:14.
class-wp-theme-json-resolver.php File 35738 bytes November 04 2024 07:34:16.
class-wp-theme-json-schema.php File 7367 bytes June 06 2024 12:02:16.
class-wp-theme-json.php File 163545 bytes March 19 2025 22:46:30.
class-wp-theme.php File 65810 bytes April 08 2025 18:18:28.
class-wp-token-map.php File 28618 bytes July 20 2024 03:44:16.
class-wp-url-pattern-prefixer.php File 4802 bytes February 19 2025 03:32:22.
class-wp-user-meta-session-tokens.php File 2990 bytes January 09 2019 10:04:50.
class-wp-user-query.php File 43655 bytes December 19 2024 15:24:24.
class-wp-user-request.php File 2305 bytes February 17 2025 16:24:22.
class-wp-user.php File 22994 bytes March 04 2025 19:19:22.
class-wp-walker.php File 13322 bytes July 26 2024 11:56:14.
class-wp-widget-factory.php File 3347 bytes September 12 2022 19:47:14.
class-wp-widget.php File 18429 bytes November 02 2024 19:01:20.
class-wp-xmlrpc-server.php File 215444 bytes February 08 2025 21:00:20.
class-wp.php File 26318 bytes January 29 2025 23:12:26.
class-wpdb.php File 118284 bytes February 11 2025 16:14:22.
class.wp-dependencies.php File 373 bytes September 20 2022 18:17:12.
class.wp-scripts.php File 343 bytes September 20 2022 18:17:12.
class.wp-styles.php File 338 bytes September 20 2022 18:17:12.
comment-template.php File 103104 bytes July 05 2025 10:53:38.
comment.php File 131547 bytes March 12 2025 01:58:24.
compat.php File 16376 bytes February 11 2025 16:14:22.
cron.php File 42658 bytes February 15 2025 00:37:24.
date.php File 400 bytes June 17 2022 15:20:14.
default-constants.php File 11365 bytes October 01 2024 03:58:16.
default-filters.php File 36697 bytes March 25 2025 10:45:28.
default-widgets.php File 2295 bytes January 23 2025 00:48:26.
deprecated.php File 191563 bytes March 14 2025 03:00:32.
embed-template.php File 338 bytes June 17 2022 15:20:14.
embed.php File 38172 bytes January 24 2025 18:32:22.
error-protection.php File 4121 bytes May 02 2023 19:45:22.
feed-atom-comments.php File 5504 bytes March 04 2024 17:41:10.
feed-atom.php File 3121 bytes January 23 2025 00:48:26.
feed-rdf.php File 2668 bytes January 29 2020 05:45:18.
feed-rss.php File 1189 bytes January 29 2020 05:45:18.
feed-rss2-comments.php File 4136 bytes March 04 2024 17:41:10.
feed-rss2.php File 3799 bytes January 29 2020 05:45:18.
feed.php File 23411 bytes November 11 2024 22:50:18.
fonts.php File 9751 bytes October 24 2024 02:39:18.
formatting.php File 342921 bytes July 05 2025 10:35:32.
functions.php File 287546 bytes April 07 2025 02:29:28.
functions.wp-scripts.php File 14558 bytes May 27 2024 00:51:14.
functions.wp-styles.php File 8583 bytes May 27 2024 00:51:14.
general-template.php File 172498 bytes April 08 2025 06:01:30.
global-styles-and-settings.php File 21261 bytes February 14 2025 23:38:22.
http.php File 25312 bytes October 27 2024 23:05:18.
https-detection.php File 5857 bytes February 24 2025 18:43:24.
https-migration.php File 4741 bytes July 11 2023 02:38:26.
kses.php File 74472 bytes January 22 2025 03:59:18.
l10n.php File 68530 bytes January 28 2025 14:46:30.
link-template.php File 157801 bytes February 24 2025 18:43:24.
load.php File 56440 bytes February 11 2025 16:14:22.
locale.php File 162 bytes October 08 2019 21:19:04.
media-template.php File 63060 bytes February 18 2025 03:58:24.
media.php File 220496 bytes July 07 2025 21:09:42.
meta.php File 65243 bytes February 24 2025 02:53:26.
ms-blogs.php File 25845 bytes January 23 2025 00:48:26.
ms-default-constants.php File 4921 bytes June 14 2024 00:50:14.
ms-default-filters.php File 6636 bytes February 24 2023 06:23:20.
ms-deprecated.php File 21759 bytes April 12 2024 21:47:14.
ms-files.php File 2744 bytes April 17 2025 02:23:30.
ms-functions.php File 91582 bytes February 04 2025 00:52:24.
ms-load.php File 19883 bytes March 25 2024 21:19:18.
ms-network.php File 3782 bytes May 02 2023 15:26:24.
ms-settings.php File 4197 bytes January 23 2025 00:48:26.
ms-site.php File 41320 bytes January 17 2025 05:12:26.
nav-menu-template.php File 25990 bytes January 23 2025 00:48:26.
nav-menu.php File 44373 bytes August 05 2024 23:00:20.
option.php File 103065 bytes March 06 2025 03:59:22.
pluggable-deprecated.php File 6324 bytes February 04 2025 00:52:24.
pluggable.php File 122700 bytes February 28 2025 23:53:24.
plugin.php File 35465 bytes June 08 2023 11:54:22.
post-formats.php File 7102 bytes May 27 2024 20:29:16.
post-template.php File 68648 bytes February 04 2025 05:32:24.
post-thumbnail-template.php File 10879 bytes December 21 2024 04:35:24.
post.php File 291712 bytes March 25 2025 10:45:28.
query.php File 37035 bytes August 24 2023 13:01:16.
registration-functions.php File 200 bytes November 12 2020 16:17:08.
registration.php File 200 bytes November 12 2020 16:17:08.
rest-api.php File 100257 bytes March 29 2025 02:44:30.
revision.php File 30741 bytes January 28 2025 04:07:24.
rewrite.php File 19541 bytes September 18 2024 23:08:12.
robots-template.php File 5185 bytes April 06 2022 19:33:04.
rss-functions.php File 255 bytes November 17 2020 03:52:06.
rss.php File 23113 bytes September 19 2024 01:40:12.
script-loader.php File 133262 bytes April 25 2025 22:38:30.
script-modules.php File 7712 bytes October 13 2024 22:49:16.
session.php File 258 bytes February 06 2020 11:33:12.
shortcodes.php File 24051 bytes May 25 2024 07:04:12.
sitemaps.php File 3238 bytes May 15 2021 21:38:06.
speculative-loading.php File 8558 bytes February 28 2025 03:14:26.
spl-autoload-compat.php File 441 bytes November 12 2020 16:17:08.
style-engine.php File 7563 bytes May 03 2024 08:47:12.
taxonomy.php File 176227 bytes February 08 2025 16:44:24.
template-canvas.php File 544 bytes October 01 2023 04:22:28.
template-loader.php File 3012 bytes May 26 2020 13:37:10.
template.php File 24154 bytes February 22 2024 00:26:08.
theme-i18n.json File 1526 bytes January 08 2025 17:36:24.
theme-previews.php File 2832 bytes December 08 2023 11:32:24.
theme-templates.php File 6238 bytes February 17 2025 22:49:20.
theme.json File 8704 bytes June 12 2024 10:11:14.
theme.php File 134303 bytes March 18 2025 16:30:26.
update.php File 37503 bytes March 18 2025 02:40:26.
user.php File 175823 bytes March 04 2025 19:19:22.
vars.php File 6562 bytes January 23 2025 00:48:26.
version.php File 1090 bytes July 15 2025 19:09:38.
widgets.php File 70719 bytes January 25 2025 02:20:24.
wp-db.php File 445 bytes July 22 2022 02:45:12.
wp-diff.php File 799 bytes January 23 2025 00:48:26.

Reading File: /home/codekrsu//escapematrixonline.com/wp-includes//global-styles-and-settings.php

<?php
/**
 * APIs to interact with global settings & styles.
 *
 * @package WordPress
 */

/**
 * Gets the settings resulting of merging core, theme, and user data.
 *
 * @since 5.9.0
 *
 * @param array $path    Path to the specific setting to retrieve. Optional.
 *                       If empty, will return all settings.
 * @param array $context {
 *     Metadata to know where to retrieve the $path from. Optional.
 *
 *     @type string $block_name Which block to retrieve the settings from.
 *                              If empty, it'll return the settings for the global context.
 *     @type string $origin     Which origin to take data from.
 *                              Valid values are 'all' (core, theme, and user) or 'base' (core and theme).
 *                              If empty or unknown, 'all' is used.
 * }
 * @return mixed The settings array or individual setting value to retrieve.
 */
function wp_get_global_settings( $path = array(), $context = array() ) {
	if ( ! empty( $context['block_name'] ) ) {
		$new_path = array( 'blocks', $context['block_name'] );
		foreach ( $path as $subpath ) {
			$new_path[] = $subpath;
		}
		$path = $new_path;
	}

	/*
	 * This is the default value when no origin is provided or when it is 'all'.
	 *
	 * The $origin is used as part of the cache key. Changes here need to account
	 * for clearing the cache appropriately.
	 */
	$origin = 'custom';
	if (
		! wp_theme_has_theme_json() ||
		( isset( $context['origin'] ) && 'base' === $context['origin'] )
	) {
		$origin = 'theme';
	}

	/*
	 * By using the 'theme_json' group, this data is marked to be non-persistent across requests.
	 * See `wp_cache_add_non_persistent_groups` in src/wp-includes/load.php and other places.
	 *
	 * The rationale for this is to make sure derived data from theme.json
	 * is always fresh from the potential modifications done via hooks
	 * that can use dynamic data (modify the stylesheet depending on some option,
	 * settings depending on user permissions, etc.).
	 * See some of the existing hooks to modify theme.json behavior:
	 * https://make.wordpress.org/core/2022/10/10/filters-for-theme-json-data/
	 *
	 * A different alternative considered was to invalidate the cache upon certain
	 * events such as options add/update/delete, user meta, etc.
	 * It was judged not enough, hence this approach.
	 * See https://github.com/WordPress/gutenberg/pull/45372
	 */
	$cache_group = 'theme_json';
	$cache_key   = 'wp_get_global_settings_' . $origin;

	/*
	 * Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
	 * developer's workflow.
	 */
	$can_use_cached = ! wp_is_development_mode( 'theme' );

	$settings = false;
	if ( $can_use_cached ) {
		$settings = wp_cache_get( $cache_key, $cache_group );
	}

	if ( false === $settings ) {
		$settings = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_settings();
		if ( $can_use_cached ) {
			wp_cache_set( $cache_key, $settings, $cache_group );
		}
	}

	return _wp_array_get( $settings, $path, $settings );
}

/**
 * Gets the styles resulting of merging core, theme, and user data.
 *
 * @since 5.9.0
 * @since 6.3.0 the internal link format "var:preset|color|secondary" is resolved
 *              to "var(--wp--preset--font-size--small)" so consumers don't have to.
 * @since 6.3.0 `transforms` is now usable in the `context` parameter. In case [`transforms`]['resolve_variables']
 *              is defined, variables are resolved to their value in the styles.
 *
 * @param array $path    Path to the specific style to retrieve. Optional.
 *                       If empty, will return all styles.
 * @param array $context {
 *     Metadata to know where to retrieve the $path from. Optional.
 *
 *     @type string $block_name Which block to retrieve the styles from.
 *                              If empty, it'll return the styles for the global context.
 *     @type string $origin     Which origin to take data from.
 *                              Valid values are 'all' (core, theme, and user) or 'base' (core and theme).
 *                              If empty or unknown, 'all' is used.
 *     @type array $transforms Which transformation(s) to apply.
 *                              Valid value is array( 'resolve-variables' ).
 *                              If defined, variables are resolved to their value in the styles.
 * }
 * @return mixed The styles array or individual style value to retrieve.
 */
function wp_get_global_styles( $path = array(), $context = array() ) {
	if ( ! empty( $context['block_name'] ) ) {
		$path = array_merge( array( 'blocks', $context['block_name'] ), $path );
	}

	$origin = 'custom';
	if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) {
		$origin = 'theme';
	}

	$resolve_variables = isset( $context['transforms'] )
	&& is_array( $context['transforms'] )
	&& in_array( 'resolve-variables', $context['transforms'], true );

	$merged_data = WP_Theme_JSON_Resolver::get_merged_data( $origin );
	if ( $resolve_variables ) {
		$merged_data = WP_Theme_JSON::resolve_variables( $merged_data );
	}
	$styles = $merged_data->get_raw_data()['styles'];
	return _wp_array_get( $styles, $path, $styles );
}


/**
 * Returns the stylesheet resulting of merging core, theme, and user data.
 *
 * @since 5.9.0
 * @since 6.1.0 Added 'base-layout-styles' support.
 * @since 6.6.0 Resolves relative paths in theme.json styles to theme absolute paths.
 *
 * @param array $types Optional. Types of styles to load.
 *                     See {@see 'WP_Theme_JSON::get_stylesheet'} for all valid types.
 *                     If empty, it'll load the following:
 *                     - for themes without theme.json: 'variables', 'presets', 'base-layout-styles'.
 *                     - for themes with theme.json: 'variables', 'presets', 'styles'.
 * @return string Stylesheet.
 */
function wp_get_global_stylesheet( $types = array() ) {
	/*
	 * Ignore cache when the development mode is set to 'theme', so it doesn't interfere with the theme
	 * developer's workflow.
	 */
	$can_use_cached = empty( $types ) && ! wp_is_development_mode( 'theme' );

	/*
	 * By using the 'theme_json' group, this data is marked to be non-persistent across requests.
	 * @see `wp_cache_add_non_persistent_groups()`.
	 *
	 * The rationale for this is to make sure derived data from theme.json
	 * is always fresh from the potential modifications done via hooks
	 * that can use dynamic data (modify the stylesheet depending on some option,
	 * settings depending on user permissions, etc.).
	 * See some of the existing hooks to modify theme.json behavior:
	 * @see https://make.wordpress.org/core/2022/10/10/filters-for-theme-json-data/
	 *
	 * A different alternative considered was to invalidate the cache upon certain
	 * events such as options add/update/delete, user meta, etc.
	 * It was judged not enough, hence this approach.
	 * @see https://github.com/WordPress/gutenberg/pull/45372
	 */
	$cache_group = 'theme_json';
	$cache_key   = 'wp_get_global_stylesheet';
	if ( $can_use_cached ) {
		$cached = wp_cache_get( $cache_key, $cache_group );
		if ( $cached ) {
			return $cached;
		}
	}

	$tree                = WP_Theme_JSON_Resolver::resolve_theme_file_uris( WP_Theme_JSON_Resolver::get_merged_data() );
	$supports_theme_json = wp_theme_has_theme_json();

	if ( empty( $types ) && ! $supports_theme_json ) {
		$types = array( 'variables', 'presets', 'base-layout-styles' );
	} elseif ( empty( $types ) ) {
		$types = array( 'variables', 'styles', 'presets' );
	}

	/*
	 * If variables are part of the stylesheet, then add them.
	 * This is so themes without a theme.json still work as before 5.9:
	 * they can override the default presets.
	 * See https://core.trac.wordpress.org/ticket/54782
	 */
	$styles_variables = '';
	if ( in_array( 'variables', $types, true ) ) {
		/*
		 * Only use the default, theme, and custom origins. Why?
		 * Because styles for `blocks` origin are added at a later phase
		 * (i.e. in the render cycle). Here, only the ones in use are rendered.
		 * @see wp_add_global_styles_for_blocks
		 */
		$origins          = array( 'default', 'theme', 'custom' );
		$styles_variables = $tree->get_stylesheet( array( 'variables' ), $origins );
		$types            = array_diff( $types, array( 'variables' ) );
	}

	/*
	 * For the remaining types (presets, styles), we do consider origins:
	 *
	 * - themes without theme.json: only the classes for the presets defined by core
	 * - themes with theme.json: the presets and styles classes, both from core and the theme
	 */
	$styles_rest = '';
	if ( ! empty( $types ) ) {
		/*
		 * Only use the default, theme, and custom origins. Why?
		 * Because styles for `blocks` origin are added at a later phase
		 * (i.e. in the render cycle). Here, only the ones in use are rendered.
		 * @see wp_add_global_styles_for_blocks
		 */
		$origins = array( 'default', 'theme', 'custom' );
		/*
		 * If the theme doesn't have theme.json but supports both appearance tools and color palette,
		 * the 'theme' origin should be included so color palette presets are also output.
		 */
		if ( ! $supports_theme_json && ( current_theme_supports( 'appearance-tools' ) || current_theme_supports( 'border' ) ) && current_theme_supports( 'editor-color-palette' ) ) {
			$origins = array( 'default', 'theme' );
		} elseif ( ! $supports_theme_json ) {
			$origins = array( 'default' );
		}
		$styles_rest = $tree->get_stylesheet( $types, $origins );
	}

	$stylesheet = $styles_variables . $styles_rest;
	if ( $can_use_cached ) {
		wp_cache_set( $cache_key, $stylesheet, $cache_group );
	}

	return $stylesheet;
}

/**
 * Adds global style rules to the inline style for each block.
 *
 * @since 6.1.0
 * @since 6.7.0 Resolve relative paths in block styles.
 *
 * @global WP_Styles $wp_styles
 */
function wp_add_global_styles_for_blocks() {
	global $wp_styles;

	$tree        = WP_Theme_JSON_Resolver::get_merged_data();
	$tree        = WP_Theme_JSON_Resolver::resolve_theme_file_uris( $tree );
	$block_nodes = $tree->get_styles_block_nodes();

	$can_use_cached = ! wp_is_development_mode( 'theme' );
	$update_cache   = false;

	if ( $can_use_cached ) {
		// Hash the merged WP_Theme_JSON data to bust cache on settings or styles change.
		$cache_hash = md5( wp_json_encode( $tree->get_raw_data() ) );
		$cache_key  = 'wp_styles_for_blocks';
		$cached     = get_transient( $cache_key );

		// Reset the cached data if there is no value or if the hash has changed.
		if ( ! is_array( $cached ) || $cached['hash'] !== $cache_hash ) {
			$cached = array(
				'hash'   => $cache_hash,
				'blocks' => array(),
			);

			// Update the cache if the hash has changed.
			$update_cache = true;
		}
	}

	foreach ( $block_nodes as $metadata ) {

		if ( $can_use_cached ) {
			// Use the block name as the key for cached CSS data. Otherwise, use a hash of the metadata.
			$cache_node_key = isset( $metadata['name'] ) ? $metadata['name'] : md5( wp_json_encode( $metadata ) );

			if ( isset( $cached['blocks'][ $cache_node_key ] ) ) {
				$block_css = $cached['blocks'][ $cache_node_key ];
			} else {
				$block_css                           = $tree->get_styles_for_block( $metadata );
				$cached['blocks'][ $cache_node_key ] = $block_css;

				// Update the cache if the cache contents have changed.
				$update_cache = true;
			}
		} else {
			$block_css = $tree->get_styles_for_block( $metadata );
		}

		if ( ! wp_should_load_block_assets_on_demand() ) {
			wp_add_inline_style( 'global-styles', $block_css );
			continue;
		}

		$stylesheet_handle = 'global-styles';

		/*
		 * When `wp_should_load_block_assets_on_demand()` is true, block styles are
		 * enqueued for each block on the page in class WP_Block's render function.
		 * This means there will be a handle in the styles queue for each of those blocks.
		 * Block-specific global styles should be attached to the global-styles handle, but
		 * only for blocks on the page, thus we check if the block's handle is in the queue
		 * before adding the inline style.
		 * This conditional loading only applies to core blocks.
		 * TODO: Explore how this could be expanded to third-party blocks as well.
		 */
		if ( isset( $metadata['name'] ) ) {
			if ( str_starts_with( $metadata['name'], 'core/' ) ) {
				$block_name   = str_replace( 'core/', '', $metadata['name'] );
				$block_handle = 'wp-block-' . $block_name;
				if ( in_array( $block_handle, $wp_styles->queue, true ) ) {
					wp_add_inline_style( $stylesheet_handle, $block_css );
				}
			} else {
				wp_add_inline_style( $stylesheet_handle, $block_css );
			}
		}

		// The likes of block element styles from theme.json do not have  $metadata['name'] set.
		if ( ! isset( $metadata['name'] ) && ! empty( $metadata['path'] ) ) {
			$block_name = wp_get_block_name_from_theme_json_path( $metadata['path'] );
			if ( $block_name ) {
				if ( str_starts_with( $block_name, 'core/' ) ) {
					$block_name   = str_replace( 'core/', '', $block_name );
					$block_handle = 'wp-block-' . $block_name;
					if ( in_array( $block_handle, $wp_styles->queue, true ) ) {
						wp_add_inline_style( $stylesheet_handle, $block_css );
					}
				} else {
					wp_add_inline_style( $stylesheet_handle, $block_css );
				}
			}
		}
	}

	if ( $update_cache ) {
		set_transient( $cache_key, $cached );
	}
}

/**
 * Gets the block name from a given theme.json path.
 *
 * @since 6.3.0
 * @access private
 *
 * @param array $path An array of keys describing the path to a property in theme.json.
 * @return string Identified block name, or empty string if none found.
 */
function wp_get_block_name_from_theme_json_path( $path ) {
	// Block name is expected to be the third item after 'styles' and 'blocks'.
	if (
		count( $path ) >= 3
		&& 'styles' === $path[0]
		&& 'blocks' === $path[1]
		&& str_contains( $path[2], '/' )
	) {
		return $path[2];
	}

	/*
	 * As fallback and for backward compatibility, allow any core block to be
	 * at any position.
	 */
	$result = array_values(
		array_filter(
			$path,
			static function ( $item ) {
				if ( str_contains( $item, 'core/' ) ) {
					return true;
				}
				return false;
			}
		)
	);
	if ( isset( $result[0] ) ) {
		return $result[0];
	}
	return '';
}

/**
 * Checks whether a theme or its parent has a theme.json file.
 *
 * @since 6.2.0
 *
 * @return bool Returns true if theme or its parent has a theme.json file, false otherwise.
 */
function wp_theme_has_theme_json() {
	static $theme_has_support = array();

	$stylesheet = get_stylesheet();

	if (
		isset( $theme_has_support[ $stylesheet ] ) &&
		/*
		 * Ignore static cache when the development mode is set to 'theme', to avoid interfering with
		 * the theme developer's workflow.
		 */
		! wp_is_development_mode( 'theme' )
	) {
		return $theme_has_support[ $stylesheet ];
	}

	$stylesheet_directory = get_stylesheet_directory();
	$template_directory   = get_template_directory();

	// This is the same as get_theme_file_path(), which isn't available in load-styles.php context
	if ( $stylesheet_directory !== $template_directory && file_exists( $stylesheet_directory . '/theme.json' ) ) {
		$path = $stylesheet_directory . '/theme.json';
	} else {
		$path = $template_directory . '/theme.json';
	}

	/** This filter is documented in wp-includes/link-template.php */
	$path = apply_filters( 'theme_file_path', $path, 'theme.json' );

	$theme_has_support[ $stylesheet ] = file_exists( $path );

	return $theme_has_support[ $stylesheet ];
}

/**
 * Cleans the caches under the theme_json group.
 *
 * @since 6.2.0
 */
function wp_clean_theme_json_cache() {
	wp_cache_delete( 'wp_get_global_stylesheet', 'theme_json' );
	wp_cache_delete( 'wp_get_global_styles_svg_filters', 'theme_json' );
	wp_cache_delete( 'wp_get_global_settings_custom', 'theme_json' );
	wp_cache_delete( 'wp_get_global_settings_theme', 'theme_json' );
	wp_cache_delete( 'wp_get_global_styles_custom_css', 'theme_json' );
	wp_cache_delete( 'wp_get_theme_data_template_parts', 'theme_json' );
	WP_Theme_JSON_Resolver::clean_cached_data();
}

/**
 * Returns the current theme's wanted patterns (slugs) to be
 * registered from Pattern Directory.
 *
 * @since 6.3.0
 *
 * @return string[]
 */
function wp_get_theme_directory_pattern_slugs() {
	return WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_patterns();
}

/**
 * Returns the metadata for the custom templates defined by the theme via theme.json.
 *
 * @since 6.4.0
 *
 * @return array Associative array of `$template_name => $template_data` pairs,
 *               with `$template_data` having "title" and "postTypes" fields.
 */
function wp_get_theme_data_custom_templates() {
	return WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_custom_templates();
}

/**
 * Returns the metadata for the template parts defined by the theme.
 *
 * @since 6.4.0
 *
 * @return array Associative array of `$part_name => $part_data` pairs,
 *               with `$part_data` having "title" and "area" fields.
 */
function wp_get_theme_data_template_parts() {
	$cache_group    = 'theme_json';
	$cache_key      = 'wp_get_theme_data_template_parts';
	$can_use_cached = ! wp_is_development_mode( 'theme' );

	$metadata = false;
	if ( $can_use_cached ) {
		$metadata = wp_cache_get( $cache_key, $cache_group );
		if ( false !== $metadata ) {
			return $metadata;
		}
	}

	if ( false === $metadata ) {
		$metadata = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_template_parts();
		if ( $can_use_cached ) {
			wp_cache_set( $cache_key, $metadata, $cache_group );
		}
	}

	return $metadata;
}

/**
 * Determines the CSS selector for the block type and property provided,
 * returning it if available.
 *
 * @since 6.3.0
 *
 * @param WP_Block_Type $block_type The block's type.
 * @param string|array  $target     The desired selector's target, `root` or array path.
 * @param boolean       $fallback   Whether to fall back to broader selector.
 *
 * @return string|null CSS selector or `null` if no selector available.
 */
function wp_get_block_css_selector( $block_type, $target = 'root', $fallback = false ) {
	if ( empty( $target ) ) {
		return null;
	}

	$has_selectors = ! empty( $block_type->selectors );

	// Root Selector.

	// Calculated before returning as it can be used as fallback for
	// feature selectors later on.
	$root_selector = null;

	if ( $has_selectors && isset( $block_type->selectors['root'] ) ) {
		// Use the selectors API if available.
		$root_selector = $block_type->selectors['root'];
	} elseif ( isset( $block_type->supports['__experimentalSelector'] ) && is_string( $block_type->supports['__experimentalSelector'] ) ) {
		// Use the old experimental selector supports property if set.
		$root_selector = $block_type->supports['__experimentalSelector'];
	} else {
		// If no root selector found, generate default block class selector.
		$block_name    = str_replace( '/', '-', str_replace( 'core/', '', $block_type->name ) );
		$root_selector = ".wp-block-{$block_name}";
	}

	// Return selector if it's the root target we are looking for.
	if ( 'root' === $target ) {
		return $root_selector;
	}

	// If target is not `root` we have a feature or subfeature as the target.
	// If the target is a string convert to an array.
	if ( is_string( $target ) ) {
		$target = explode( '.', $target );
	}

	// Feature Selectors ( May fallback to root selector ).
	if ( 1 === count( $target ) ) {
		$fallback_selector = $fallback ? $root_selector : null;

		// Prefer the selectors API if available.
		if ( $has_selectors ) {
			// Look for selector under `feature.root`.
			$path             = array( current( $target ), 'root' );
			$feature_selector = _wp_array_get( $block_type->selectors, $path, null );

			if ( $feature_selector ) {
				return $feature_selector;
			}

			// Check if feature selector is set via shorthand.
			$feature_selector = _wp_array_get( $block_type->selectors, $target, null );

			return is_string( $feature_selector ) ? $feature_selector : $fallback_selector;
		}

		// Try getting old experimental supports selector value.
		$path             = array( current( $target ), '__experimentalSelector' );
		$feature_selector = _wp_array_get( $block_type->supports, $path, null );

		// Nothing to work with, provide fallback or null.
		if ( null === $feature_selector ) {
			return $fallback_selector;
		}

		// Scope the feature selector by the block's root selector.
		return WP_Theme_JSON::scope_selector( $root_selector, $feature_selector );
	}

	// Subfeature selector
	// This may fallback either to parent feature or root selector.
	$subfeature_selector = null;

	// Use selectors API if available.
	if ( $has_selectors ) {
		$subfeature_selector = _wp_array_get( $block_type->selectors, $target, null );
	}

	// Only return if we have a subfeature selector.
	if ( $subfeature_selector ) {
		return $subfeature_selector;
	}

	// To this point we don't have a subfeature selector. If a fallback
	// has been requested, remove subfeature from target path and return
	// results of a call for the parent feature's selector.
	if ( $fallback ) {
		return wp_get_block_css_selector( $block_type, $target[0], $fallback );
	}

	return null;
}

SILENT KILLER Tool