Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/Engine/Support/Subscriber.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + declare(strict_types=1);
3 +
4 + namespace WP_Rocket\Engine\Support;
5 +
6 + use WP_Rocket\Event_Management\Subscriber_Interface;
7 +
8 + class Subscriber implements Subscriber_Interface {
9 + /**
10 + * Rest instance
11 + *
12 + * @var Rest
13 + */
14 + private $rest;
15 +
16 + /**
17 + * Meta instance
18 + *
19 + * @var Meta
20 + */
21 + private $meta;
22 +
23 + /**
24 + * Instantiate the class
25 + *
26 + * @param Rest $rest Rest instance.
27 + * @param Meta $meta Meta instance.
28 + */
29 + public function __construct( Rest $rest, Meta $meta ) {
30 + $this->rest = $rest;
31 + $this->meta = $meta;
32 + }
33 +
34 + /**
35 + * Events this subscriber listens to.
36 + *
37 + * @return array
38 + */
39 + public static function get_subscribed_events() {
40 + return [
41 + 'rest_api_init' => 'register_support_route',
42 + 'rocket_buffer' => [ 'add_meta_generator', PHP_INT_MAX ],
43 + ];
44 + }
45 +
46 + /**
47 + * Registers the rest support route
48 + *
49 + * @since 3.7.5
50 + *
51 + * @return void
52 + */
53 + public function register_support_route() {
54 + $this->rest->register_route();
55 + }
56 +
57 + /**
58 + * Add the WP Rocket meta generator tag to the HTML
59 + *
60 + * @param string $html The HTML content.
61 + * @return string
62 + */
63 + public function add_meta_generator( $html ): string {
64 + return $this->meta->add_meta_generator( $html );
65 + }
66 + }
67 +