PluginProbe
EasyFonts – Host Google Fonts Locally, Fast & Auto-Optimize, GDPR Compliant / 2.0.1
EasyFonts – Host Google Fonts Locally, Fast & Auto-Optimize, GDPR Compliant v2.0.1
2.0.4 2.0.3 2.0.2 2.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2 1.3 2.0.0
easyfonts / src / Detect / Pipeline.php

Pipeline.php in EasyFonts – Host Google Fonts Locally, Fast & Auto-Optimize, GDPR Compliant 2.0.1, at src/Detect/Pipeline.php

49 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Detection pipeline.
4 *
5 * Thin entry point that delegates to the Consolidator (the aggregate-and-replace
6 * engine). Kept as a stable seam so the output buffer and any add-ons don't need
7 * to know about the consolidation internals.
8 *
9 * @package EasyFonts
10 */
11
12 namespace EasyFonts\Detect;
13
14 defined( 'ABSPATH' ) || exit;
15
16 /**
17 * Coordinates font detection + local hosting for a document.
18 */
19 class Pipeline {
20
21 /**
22 * Process a document: detect every web-font source, host them locally as a
23 * single consolidated stylesheet, and return the rewritten HTML.
24 *
25 * @param string $html Full HTML.
26 * @param bool $force Force a full pass (probe mode).
27 * @return string
28 */
29 public function process( string $html, bool $force = false ): string {
30 /**
31 * Filter the consolidator instance, allowing advanced replacement.
32 *
33 * @param Consolidator $consolidator
34 */
35 $consolidator = apply_filters( 'easyfonts_consolidator', new Consolidator() );
36
37 return $consolidator->run( $html, $force );
38 }
39
40 /**
41 * Variants hosted during the most recent run (for fallbacks + usage).
42 *
43 * @return array<int,array{family:string,weight:string,style:string}>
44 */
45 public static function touched(): array {
46 return Consolidator::touched();
47 }
48 }
49