Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* @since 6.5.0
*/
final class WP_Interactivity_API {
class WP_Interactivity_API {
/**
* Holds the mapping of directive attribute names to their processor methods.
*
Expand Down Expand Up @@ -1422,7 +1422,7 @@ private function data_wp_text_processor( WP_Interactivity_API_Directives_Process
* @return string The CSS styles for the router's top loading bar animation.
*/
private function get_router_animation_styles(): string {
return <<<CSS
return <<<'CSS'
.wp-interactivity-router-loading-bar {
position: fixed;
top: 0;
Expand Down Expand Up @@ -1475,7 +1475,7 @@ public function print_router_loading_and_screen_reader_markup() {
* @since 6.7.0
*/
public function print_router_markup() {
echo <<<HTML
echo <<<'HTML'
<div
class="wp-interactivity-router-loading-bar"
data-wp-interactive="core/router/private"
Expand Down
22 changes: 19 additions & 3 deletions src/wp-includes/interactivity-api/interactivity-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,27 @@
* @return WP_Interactivity_API The main WP_Interactivity_API instance.
*/
function wp_interactivity(): WP_Interactivity_API {
global $wp_interactivity;
global $wp_interactivity;

if ( ! ( $wp_interactivity instanceof WP_Interactivity_API ) ) {
$wp_interactivity = new WP_Interactivity_API();
$wp_interactivity = new WP_Interactivity_API();

if (
defined( 'WP_INTERACTIVITY_ALLOW_PRIVATE_API' )
&& WP_INTERACTIVITY_ALLOW_PRIVATE_API
) {
$instance = apply_filters(

Check warning on line 32 in src/wp-includes/interactivity-api/interactivity-api.php

View workflow job for this annotation

GitHub Actions / PHP static analysis / Run PHP static analysis

apply_filters() call for hook "wp_interactivity_instance" is not preceded by a docblock documenting the hook, nor by a "This filter/action is documented in <file>" reference comment.
'wp_interactivity_instance',
$wp_interactivity
);

if ( $instance instanceof WP_Interactivity_API ) {
$wp_interactivity = $instance;
}
}
}
return $wp_interactivity;

return $wp_interactivity;
}

/**
Expand Down
7 changes: 6 additions & 1 deletion src/wp-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,12 @@
require ABSPATH . WPINC . '/view-transitions.php';

add_action( 'after_setup_theme', array( wp_script_modules(), 'add_hooks' ) );
add_action( 'after_setup_theme', array( wp_interactivity(), 'add_hooks' ) );
add_action(
'after_setup_theme',
function () {
wp_interactivity()->add_hooks();
}
);

/**
* @since 3.3.0
Expand Down
Loading