| @@ -21,13 +21,15 @@ | ||
| 21 | 21 | /** |
| 22 | 22 | * Process a document: detect every web-font source, host them locally as a |
| 23 | 23 | * single consolidated stylesheet, and return the rewritten HTML. |
| 24 | 24 | * |
| 25 | - * @param string $html Full HTML. | |
| 26 | - * @param bool $force Force a full pass (probe mode). | |
| 25 | + * @param string $html Full HTML. | |
| 26 | + * @param bool $force Force a full pass (probe mode). | |
| 27 | + * @param array<string,bool> $scope_out Confirmed loaded-but-unused families on this route (lowercased => true). | |
| 28 | + * @param bool $measured Route has beacon data (enables scoping). | |
| 27 | 29 | * @return string |
| 28 | 30 | */ |
| 29 | - public function process( string $html, bool $force = false ): string { | |
| 31 | + public function process( string $html, bool $force = false, array $scope_out = array(), bool $measured = false ): string { | |
| 30 | 32 | /** |
| 31 | 33 | * Filter the consolidator instance, allowing advanced replacement. |
| 32 | 34 | * |
| 33 | 35 | * @param Consolidator $consolidator |
| @@ -32,8 +34,12 @@ | ||
| 32 | 34 | * |
| 33 | 35 | * @param Consolidator $consolidator |
| 34 | 36 | */ |
| 35 | 37 | $consolidator = apply_filters( 'easyfonts_consolidator', new Consolidator() ); |
| 38 | + | |
| 39 | + if ( method_exists( $consolidator, 'set_page_scope' ) ) { | |
| 40 | + $consolidator->set_page_scope( $scope_out, $measured ); | |
| 41 | + } | |
| 36 | 42 | |
| 37 | 43 | return $consolidator->run( $html, $force ); |
| 38 | 44 | } |
| 39 | 45 | |