/plg_system_jtaldef

Automatic local download external files

Primary LanguagePHPGNU General Public License v3.0GPL-3.0

Joomla! System - Plugin - JT - ALDEF

JoomTools - Automatic local download external files

Joomla 3 Joomla 4
PHP5.6 PHP7.x PHP8.0 PHP8.1

Beschreibung / Description

Deutsch/German

Deutsche Beschreibung

Dieses Plugin lädt extern geladene Dateien oder Schriften in das lokale Dateisystem herunter und stellt sie von der lokalen Domäne aus zur Verfügung.
Zur Zeit werden nur GoogleFonts und FontAwesome unterstützt. Weitere Dienste wie CDNs oder Fontfabriken, auch externe Skripte oder Bilder, sind für die Zukunft geplant.

Zwei Möglichkeiten der Einbindung von GoogleFonts werden unterstützt:

  1. <link href="https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="(lazy-)stylesheet" />

    • @import "https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap";
    • @import url("https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap");
    • @import url(https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap);

Methode 1 wird im Seitenkopf a) erkannt, Methode 2 wird sowohl in den eingebundenen CSS-Dateien der ersten Ebene im Seitenkopf als auch in den Style-Tags im Seitenkopf und im Seiteninhalt b) erkannt.

Google bietet auch zwei Varianten an, die mir derzeit bekannt sind, um die Schriften abzurufen:

  1. https://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700|PT+Sans:400,400i,700,700i
  2. https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700

Beide werden gefunden und ersetzt.

Bei FontAwesome wird aktuell nur die Einbindung von der Originalseite unterstützt (auch Pro), nicht aber CDNs.

Allgemeiner Hinweis

  • Es empfiehlt sich das Plugin als letztes in der Reihenfolge anzuordnen.
  • Nach Änderungen an den CSS-Dateien, sollte der Index zurückgesetzt werden.

___
Legende:
a) Seitenkopf ist der HTML-Bereich zwischen <head> und </head>
b) Seiteninhalt ist der HTML-Bereich zwischen <body> und </body>

Englisch/English

English description

This Plugin downloads external loaded files or fonts to the local file System and serves them from the local Domain.
Currently, only GoogleFonts and FontAwesome are supported. Other services like CDNs or font factories, also external scripts or images, are planed for the future.

Two ways of embedding are supported:

  1. <link href="https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="(lazy-)stylesheet" />

    • @import "https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap";
    • @import url("https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap");
    • @import url(https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap);

Method 1 is recognized in the page header, method 2 is recognized both within the included CSS files of the first level in the page header and in the style tags in the page header and in the page body.

Google also offers two variants, which are currently known to me, to retrieve the fonts:

  1. https://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700|PT+Sans:400,400i,700,700i
  2. https://fonts.googleapis.com/css2?family=PT+Sans+Caption:wght@400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700

Both are found and replaced.

FontAwesome currently only supports embedding from the original site (even Pro), but not CDNs.

General note

  • It is recommended to place the plugin as last in the order.
  • After making changes to the CSS files, the index should be reset.