Naming_Detector
Samples the media library for sidecars this site is not serving.
Every plugin that writes local WebP or AVIF files next to the original uses one of the two naming strategies this plugin supports, and decides delivery on file existence alone. Matching the naming is therefore the whole of the migration: the files already on disk start being served, and the next conversion run adopts or replaces them in place.
Namespace: WebberZone\Image_Optimizer
Since: 1.0.1
Source: includes/class-naming-detector.php line 27
Methods
get_cached_report() static
The stored report, when one applies to the site as it is now.
Since: 1.0.1
Line: 68
static public function get_cached_report( ): ?array;
Returns: ?array — mixed>|null Report, or null when a scan is needed.
store() static
Keep a report for later requests.
Since: 1.0.1
Line: 90
static public function store( array $report ): void;
| Type | Name | Description |
|---|---|---|
array |
$report |
Returns: void
scan() static
Examine a sample of attachments for sidecars under either naming.
Since: 1.0.1
Line: 101
static public function scan( ): array;
Returns: array — mixed> Report.
get_suggestion() static
Which naming the site should switch to, if any.
Since: 1.0.1
Line: 177
static public function get_suggestion( array $report ): string;
| Type | Name | Description |
|---|---|---|
array |
$report |
Returns: string — Naming slug, or an empty string when no switch is warranted.
forget() static
Discard the cached report.
Since: 1.0.1
Line: 198
static public function forget( ): void;
Returns: void