PATH:
home
/
infinityocean
/
public_html
/
wp-includes
<?php /** * Theme previews using the Site Editor for block themes. * * @package WordPress */ /** * Filters the blog option to return the path for the previewed theme. * * @since 6.3.0 * * @param string $current_stylesheet The current theme's stylesheet or template path. * @return string The previewed theme's stylesheet or template path. */ function wp_get_theme_preview_path( $current_stylesheet = null ) { if ( ! current_user_can( 'switch_themes' ) ) { return $current_stylesheet; } $preview_stylesheet = ! empty( $_GET['wp_theme_preview'] ) ? sanitize_text_field( wp_unslash( $_GET['wp_theme_preview'] ) ) : null; $wp_theme = wp_get_theme( $preview_stylesheet ); if ( ! is_wp_error( $wp_theme->errors() ) ) { if ( current_filter() === 'template' ) { $theme_path = $wp_theme->get_template(); } else { $theme_path = $wp_theme->get_stylesheet(); } return sanitize_text_field( $theme_path ); } return $current_stylesheet; } /** * Adds a middleware to `apiFetch` to set the theme for the preview. * This adds a `wp_theme_preview` URL parameter to API requests from the Site Editor, so they also respond as if the theme is set to the value of the parameter. * * @since 6.3.0 */ function wp_attach_theme_preview_middleware() { // Don't allow non-admins to preview themes. if ( ! current_user_can( 'switch_themes' ) ) { return; } wp_add_inline_script( 'wp-api-fetch', sprintf( 'wp.apiFetch.use( wp.apiFetch.createThemePreviewMiddleware( %s ) );', wp_json_encode( sanitize_text_field( wp_unslash( $_GET['wp_theme_preview'] ) ), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ), 'after' ); } /** * Set a JavaScript constant for theme activation. * * Sets the JavaScript global WP_BLOCK_THEME_ACTIVATE_NONCE containing the nonce * required to activate a theme. For use within the site editor. * * @see https://github.com/WordPress/gutenberg/pull/41836 * * @since 6.3.0 * @access private */ function wp_block_theme_activate_nonce() { $nonce_handle = 'switch-theme_' . wp_get_theme_preview_path(); ?> <script type="text/javascript"> window.WP_BLOCK_THEME_ACTIVATE_NONCE = <?php echo wp_json_encode( wp_create_nonce( $nonce_handle ), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?>; </script> <?php } /** * Add filters and actions to enable Block Theme Previews in the Site Editor. * * The filters and actions should be added after `pluggable.php` is included as they may * trigger code that uses `current_user_can()` which requires functionality from `pluggable.php`. * * @since 6.3.2 */ function wp_initialize_theme_preview_hooks() { if ( ! empty( $_GET['wp_theme_preview'] ) ) { add_filter( 'stylesheet', 'wp_get_theme_preview_path' ); add_filter( 'template', 'wp_get_theme_preview_path' ); add_action( 'init', 'wp_attach_theme_preview_middleware' ); add_action( 'admin_head', 'wp_block_theme_activate_nonce' ); } }
[+]
..
[-] class-wp-image-editor.php
[edit]
[-] class-walker-category.php
[edit]
[-] ms-load.php
[edit]
[+]
block-bindings
[-] https-detection.php
[edit]
[-] theme-i18n.json
[edit]
[+]
abilities-api
[-] class-wp-block-metadata-registry.php
[edit]
[-] class-wp-comment-query.php
[edit]
[+]
html-api
[-] sitemaps.php
[edit]
[-] template-canvas.php
[edit]
[-] embed-template.php
[edit]
[+]
sodium_compat
[-] class-wp-block-editor-context.php
[edit]
[-] class-wp-simplepie-file.php
[edit]
[-] class-wp-theme-json-schema.php
[edit]
[-] compat-utf8.php
[edit]
[-] theme-previews.php
[edit]
[-] speculative-loading.php
[edit]
[-] ms-default-constants.php
[edit]
[-] revision.php
[edit]
[+]
blocks
[-] comment-template.php
[edit]
[-] class-wp-block-processor.php
[edit]
[-] compat.php
[edit]
[+]
widgets
[-] block-i18n.json
[edit]
[+]
SimplePie
[+]
ID3
[-] global-styles-and-settings.php
[edit]
[+]
css
[+]
php-compat
[-] class-wp-hook.php
[edit]
[-] cron.php
[edit]
[-] class-wp-metadata-lazyloader.php
[edit]
[-] class-wp-block-type-registry.php
[edit]
[-] class-wp-text-diff-renderer-inline.php
[edit]
[-] class-avif-info.php
[edit]
[+]
pomo
[-] capabilities.php
[edit]
[-] theme.php
[edit]
[+]
Text
[+]
images
[-] class-wp-block-styles-registry.php
[edit]
[-] class-wp-date-query.php
[edit]
[-] class-wp-recovery-mode-email-service.php
[edit]
[-] class-wp-role.php
[edit]
[-] class-wp-block-parser-frame.php
[edit]
[-] abilities-api.php
[edit]
[-] pluggable.php
[edit]
[-] class-wp-xmlrpc-server.php
[edit]
[-] class-wp-http-requests-response.php
[edit]
[-] class-wp-customize-manager.php
[edit]
[-] spl-autoload-compat.php
[edit]
[-] class-wp-object-cache.php
[edit]
[-] class-wp-block-parser-block.php
[edit]
[-] class-wp-recovery-mode-key-service.php
[edit]
[-] feed-rss2.php
[edit]
[-] class-wp-token-map.php
[edit]
[+]
l10n
[-] feed-atom-comments.php
[edit]
[+]
assets
[+]
block-supports
[-] class-wp-block-parser.php
[edit]
[-] class-wp-navigation-fallback.php
[edit]
[-] l10n.php
[edit]
[+]
interactivity-api
[+]
js
[-] class-wp-http-ixr-client.php
[edit]
[-] blocks.php
[edit]
[-] class-wp-user-meta-session-tokens.php
[edit]
[+]
block-patterns
[-] theme.json
[edit]
[-] class-wp-url-pattern-prefixer.php
[edit]
[-] class-wp-customize-panel.php
[edit]
[-] version.php
[edit]
[-] script-loader.php
[edit]
[-] class-wp-recovery-mode.php
[edit]
[-] category.php
[edit]
[-] canonical.php
[edit]
[+]
PHPMailer
[+]
fonts
[-] class-wp-query.php
[edit]
[+]
Requests
[-] class-wp-http.php
[edit]
[+]
sitemaps
[-] class-wp-application-passwords.php
[edit]
[+]
style-engine
[-] class-wp-image-editor-gd.php
[edit]
[+]
customize
[-] class-IXR.php
[edit]
[+]
certificates
[-] class-wp-theme-json-resolver.php
[edit]
[+]
theme-compat
[-] class-wp-block-bindings-registry.php
[edit]
[+]
rest-api
[-] class-wp-embed.php
[edit]