Plugin Directory

Changeset 3746828


Ignore:
Timestamp:
10/14/2026 05:12:53 PM (3 days ago)
Author:
fepo
Message:

1.1.5

  • More honest numbers in the Fonts tab. "Loaded from Google" used to count every file Google offers for a font — including Cyrillic, Greek and Vietnamese character sets that a browser never loads on a German or English page. The savings shown were therefore too high (example: 336 KB instead of the 183 KB actually loaded). Now only what your site really loads is counted. Existing measurements are renewed automatically on the next scan.
Location:
fepo-image-font-optimizer
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • fepo-image-font-optimizer/tags/1.1.5/admin/class-admin-page.php

    r3746773 r3746828  
    17371737            if ( '' === $fam ) { $f['download_bytes'] = null; $f['woff2_count'] = 0; continue; }
    17381738            $cached = $this->manifest->get_google_font_download_size( $fam );
    1739             // Re-measure when never measured OR when a pre-count store entry lacks the count (migration).
    1740             if ( null === $cached || ! isset( $cached['count'] ) ) {
     1739            // Re-measure when never measured, or measured with an older method
     1740            // (no count / counted every Google block — see MESS_VERSION).
     1741            if ( ! Fepo_IO_Font_Size::messung_aktuell( $cached ) ) {
    17411742                $m = Fepo_IO_Font_Size::measure_google_font_woff2( $fam, isset( $f['weights'] ) ? (array) $f['weights'] : array() );
    17421743                $this->manifest->set_google_font_download_size( $fam, $m['bytes'], $m['count'] );
  • fepo-image-font-optimizer/tags/1.1.5/fepo-image-font-optimizer.php

    r3746773 r3746828  
    33 * Plugin Name:       fepo — Image & Font Optimizer
    44 * Description:       Serves modern WebP/AVIF images and subsetted fonts your site already has — added safely, originals kept as fallback. Powered by fepo.
    5  * Version:           1.1.4
     5 * Version:           1.1.5
    66 * Requires at least: 6.0
    77 * Requires PHP:      7.4
    … …  
    2929}
    3030
    31 define( 'FEPO_IO_VERSION',    '1.1.4' );
     31define( 'FEPO_IO_VERSION',    '1.1.5' );
    3232define( 'FEPO_IO_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    3333define( 'FEPO_IO_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
  • fepo-image-font-optimizer/tags/1.1.5/includes/class-font-local.php

    r3746773 r3746828  
    133133
    134134    /** The site language as in <html lang>; outside WordPress "en". */
    135     private static function website_sprache() {
     135    public static function website_sprache() {
    136136        return function_exists( 'get_bloginfo' ) ? (string) get_bloginfo( 'language' ) : 'en';
    137137    }
  • fepo-image-font-optimizer/tags/1.1.5/includes/class-font-size.php

    r3746773 r3746828  
    1919     */
    2020    const MIN_BYTES = 51200;
     21
     22    /**
     23     * Version of the measuring method. 2 = only the character ranges the site
     24     * needs (2026-10-14); cached sizes from version 1 counted every Google
     25     * block and are re-measured.
     26     */
     27    const MESS_VERSION = 2;
     28
     29    /**
     30     * Is a cached measurement still valid?
     31     *
     32     * @param array|null $cached from Fepo_IO_Manifest::get_google_font_download_size().
     33     * @return bool
     34     */
     35    public static function messung_aktuell( $cached ) {
     36        return is_array( $cached ) && isset( $cached['count'] )
     37            && isset( $cached['v'] ) && (int) $cached['v'] >= self::MESS_VERSION;
     38    }
    2139
    2240    /**
    … …  
    7391            return array( 'bytes' => null, 'count' => 0 );
    7492        }
    75         if ( ! preg_match_all( '#url\(\s*[\'"]?(https://[^\'")\s]+\.woff2)[\'"]?\s*\)#i', $css, $m ) ) {
     93        // Only what a browser on THIS site actually loads (2026-10-14): Google's
     94        // CSS also lists cyrillic/greek/vietnamese blocks, which a German or
     95        // English page never fetches (unicode-range). Summing them all made the
     96        // "before" size far too large (Source Sans Pro "336 KB", "−95 %").
     97        // Same filter as the 1:1 local delivery (Fepo_IO_Font_Local).
     98        if ( class_exists( 'Fepo_IO_Font_Local' ) ) {
     99            $faces = Fepo_IO_Font_Local::nach_sprache( Fepo_IO_Font_Local::faces_aus_css( $css ), Fepo_IO_Font_Local::website_sprache() );
     100            $urls  = array_values( array_unique( array_column( $faces, 'url' ) ) );
     101        } else {
     102            $urls = preg_match_all( '#url\(\s*[\'"]?(https://[^\'")\s]+\.woff2)[\'"]?\s*\)#i', $css, $m ) ? array_values( array_unique( $m[1] ) ) : array();
     103        }
     104        if ( empty( $urls ) ) {
    76105            return array( 'bytes' => null, 'count' => 0 );
    77106        }
    78107        $total = 0;
    79108        $any   = false;
    80         foreach ( array_unique( $m[1] ) as $woff2 ) {
     109        foreach ( $urls as $woff2 ) {
    81110            $body = self::http_get_body( $woff2 );
    82111            if ( null === $body ) {
    … …  
    86115            $any    = true;
    87116        }
    88         $count = count( array_unique( $m[1] ) );
     117        $count = count( $urls );
    89118        return $any
    90119            ? array( 'bytes' => $total, 'count' => $count )
  • fepo-image-font-optimizer/tags/1.1.5/includes/class-manifest.php

    r3746773 r3746828  
    542542            'count'       => (int) $count,
    543543            'measured_at' => time(),
     544            'v'           => class_exists( 'Fepo_IO_Font_Size' ) ? Fepo_IO_Font_Size::MESS_VERSION : 1,
    544545        );
    545546        $this->save( $data );
  • fepo-image-font-optimizer/tags/1.1.5/readme.txt

    r3746773 r3746828  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.1.4
     7Stable tag: 1.1.5
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    126126
    127127== Changelog ==
     128= 1.1.5 =
     129* **Ehrlichere Zahlen im Fonts-Tab.** „Loaded from Google“ zählte bisher alle Dateien, die Google für eine Schrift anbietet — auch kyrillische, griechische und vietnamesische Zeichensätze, die ein Browser auf einer deutschen oder englischen Seite nie lädt. Dadurch war die Ersparnis zu hoch angegeben (Beispiel: 336 KB statt tatsächlich 183 KB). Jetzt zählt nur, was Ihre Seite wirklich lädt. Vorhandene Messungen werden beim nächsten Scan automatisch erneuert.
     130
    128131= 1.1.4 =
    129132* **Schriften unter 50 KB kommen jetzt von Ihrem Server statt von Google.** Seit 1.1.3 wurden sie nicht mehr subsettet — dadurch blieben sie bei Google, und die IP-Adressen Ihrer Besucher gingen weiter dorthin. Jetzt kopiert das Plugin die Original-Dateien von Google 1:1 auf Ihren Server und liefert sie von dort aus, ohne Subsetting und ohne Credits.
  • fepo-image-font-optimizer/trunk/admin/class-admin-page.php

    r3746773 r3746828  
    17371737            if ( '' === $fam ) { $f['download_bytes'] = null; $f['woff2_count'] = 0; continue; }
    17381738            $cached = $this->manifest->get_google_font_download_size( $fam );
    1739             // Re-measure when never measured OR when a pre-count store entry lacks the count (migration).
    1740             if ( null === $cached || ! isset( $cached['count'] ) ) {
     1739            // Re-measure when never measured, or measured with an older method
     1740            // (no count / counted every Google block — see MESS_VERSION).
     1741            if ( ! Fepo_IO_Font_Size::messung_aktuell( $cached ) ) {
    17411742                $m = Fepo_IO_Font_Size::measure_google_font_woff2( $fam, isset( $f['weights'] ) ? (array) $f['weights'] : array() );
    17421743                $this->manifest->set_google_font_download_size( $fam, $m['bytes'], $m['count'] );
  • fepo-image-font-optimizer/trunk/fepo-image-font-optimizer.php

    r3746773 r3746828  
    33 * Plugin Name:       fepo — Image & Font Optimizer
    44 * Description:       Serves modern WebP/AVIF images and subsetted fonts your site already has — added safely, originals kept as fallback. Powered by fepo.
    5  * Version:           1.1.4
     5 * Version:           1.1.5
    66 * Requires at least: 6.0
    77 * Requires PHP:      7.4
    … …  
    2929}
    3030
    31 define( 'FEPO_IO_VERSION',    '1.1.4' );
     31define( 'FEPO_IO_VERSION',    '1.1.5' );
    3232define( 'FEPO_IO_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    3333define( 'FEPO_IO_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
  • fepo-image-font-optimizer/trunk/includes/class-font-local.php

    r3746773 r3746828  
    133133
    134134    /** The site language as in <html lang>; outside WordPress "en". */
    135     private static function website_sprache() {
     135    public static function website_sprache() {
    136136        return function_exists( 'get_bloginfo' ) ? (string) get_bloginfo( 'language' ) : 'en';
    137137    }
  • fepo-image-font-optimizer/trunk/includes/class-font-size.php

    r3746773 r3746828  
    1919     */
    2020    const MIN_BYTES = 51200;
     21
     22    /**
     23     * Version of the measuring method. 2 = only the character ranges the site
     24     * needs (2026-10-14); cached sizes from version 1 counted every Google
     25     * block and are re-measured.
     26     */
     27    const MESS_VERSION = 2;
     28
     29    /**
     30     * Is a cached measurement still valid?
     31     *
     32     * @param array|null $cached from Fepo_IO_Manifest::get_google_font_download_size().
     33     * @return bool
     34     */
     35    public static function messung_aktuell( $cached ) {
     36        return is_array( $cached ) && isset( $cached['count'] )
     37            && isset( $cached['v'] ) && (int) $cached['v'] >= self::MESS_VERSION;
     38    }
    2139
    2240    /**
    … …  
    7391            return array( 'bytes' => null, 'count' => 0 );
    7492        }
    75         if ( ! preg_match_all( '#url\(\s*[\'"]?(https://[^\'")\s]+\.woff2)[\'"]?\s*\)#i', $css, $m ) ) {
     93        // Only what a browser on THIS site actually loads (2026-10-14): Google's
     94        // CSS also lists cyrillic/greek/vietnamese blocks, which a German or
     95        // English page never fetches (unicode-range). Summing them all made the
     96        // "before" size far too large (Source Sans Pro "336 KB", "−95 %").
     97        // Same filter as the 1:1 local delivery (Fepo_IO_Font_Local).
     98        if ( class_exists( 'Fepo_IO_Font_Local' ) ) {
     99            $faces = Fepo_IO_Font_Local::nach_sprache( Fepo_IO_Font_Local::faces_aus_css( $css ), Fepo_IO_Font_Local::website_sprache() );
     100            $urls  = array_values( array_unique( array_column( $faces, 'url' ) ) );
     101        } else {
     102            $urls = preg_match_all( '#url\(\s*[\'"]?(https://[^\'")\s]+\.woff2)[\'"]?\s*\)#i', $css, $m ) ? array_values( array_unique( $m[1] ) ) : array();
     103        }
     104        if ( empty( $urls ) ) {
    76105            return array( 'bytes' => null, 'count' => 0 );
    77106        }
    78107        $total = 0;
    79108        $any   = false;
    80         foreach ( array_unique( $m[1] ) as $woff2 ) {
     109        foreach ( $urls as $woff2 ) {
    81110            $body = self::http_get_body( $woff2 );
    82111            if ( null === $body ) {
    … …  
    86115            $any    = true;
    87116        }
    88         $count = count( array_unique( $m[1] ) );
     117        $count = count( $urls );
    89118        return $any
    90119            ? array( 'bytes' => $total, 'count' => $count )
  • fepo-image-font-optimizer/trunk/includes/class-manifest.php

    r3746773 r3746828  
    542542            'count'       => (int) $count,
    543543            'measured_at' => time(),
     544            'v'           => class_exists( 'Fepo_IO_Font_Size' ) ? Fepo_IO_Font_Size::MESS_VERSION : 1,
    544545        );
    545546        $this->save( $data );
  • fepo-image-font-optimizer/trunk/readme.txt

    r3746773 r3746828  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.1.4
     7Stable tag: 1.1.5
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    126126
    127127== Changelog ==
     128= 1.1.5 =
     129* **Ehrlichere Zahlen im Fonts-Tab.** „Loaded from Google“ zählte bisher alle Dateien, die Google für eine Schrift anbietet — auch kyrillische, griechische und vietnamesische Zeichensätze, die ein Browser auf einer deutschen oder englischen Seite nie lädt. Dadurch war die Ersparnis zu hoch angegeben (Beispiel: 336 KB statt tatsächlich 183 KB). Jetzt zählt nur, was Ihre Seite wirklich lädt. Vorhandene Messungen werden beim nächsten Scan automatisch erneuert.
     130
    128131= 1.1.4 =
    129132* **Schriften unter 50 KB kommen jetzt von Ihrem Server statt von Google.** Seit 1.1.3 wurden sie nicht mehr subsettet — dadurch blieben sie bei Google, und die IP-Adressen Ihrer Besucher gingen weiter dorthin. Jetzt kopiert das Plugin die Original-Dateien von Google 1:1 auf Ihren Server und liefert sie von dort aus, ohne Subsetting und ohne Credits.
Note: See TracChangeset for help on using the changeset viewer.