Safe SVG

Beschreibung

Safe SVG ist der beste Weg, um das Hochladen von SVGs in WordPress zu ermöglichen!

Es ermöglicht, SVG-Uploads zuzulassen und gleichzeitig sicherzustellen, dass sie bereinigt werden, um zu verhindern, dass SVG-/XML-Schwachstellen die Website beeinträchtigen. Außerdem werden die hochgeladenen SVGs in der Medienbibliothek in allen Ansichten in der Vorschau angezeigt.

Aktuelle Funktionen

  • Bereinigte SVGs – Öffne keine Sicherheitslücken in deiner WordPress-Website, indem du den Upload von nicht bereinigten Dateien erlauben.
  • SVGO Optimisation – Runs your SVGs through the SVGO tool on upload to save you space. This feature is disabled by default but can be enabled by adding the following code: add_filter( 'safe_svg_optimizer_enabled', '__return_true' );
  • SVGs in der Mediathek anzeigen – Die Zeiten sind vorbei, in denen man raten musste, welches SVG das richtige ist. Wir aktivieren SVG-Vorschauen in der WordPress-Mediathek.
  • Bestimme, wer hochladen darf – Schränke SVG-Uploads auf bestimmte Benutzer auf deiner WordPress-Website ein oder erlaube jedem, diese hochzuladen.

Ursprünglich ein Proof of Concept für #24251.

Die SVG-Bereinigung wird durch die folgende Bibliothek durchgeführt: https://github.com/darylldoyle/svg-sanitizer.

SVG Optimization is done through the following library: https://github.com/svg/svgo.

Blöcke

Dieses Plugin unterstützt 1 Block.

  • Safe SVG Display the SVG icon

Installation

Install through the WordPress directory or download, unzip and upload the files to your /wp-content/plugins/ directory

FAQ

Können wir die erlaubten Attribute und Tags ändern?

Ja, dies kann mit Hilfe der Filter svg_allowed_attributes und svg_allowed_tags geschehen.
Es wird dafür ein Argument benötigt, das zurückgegeben werden muss. Siehe nachfolgende Beispiele:

add_filter( 'svg_allowed_attributes', function ( $attributes ) {

    // Do what you want here...

    // This should return an array so add your attributes to
    // to the $attributes array before returning it. E.G.

    $attributes[] = 'target'; // This would allow the target="" attribute.

    return $attributes;
} );


add_filter( 'svg_allowed_tags', function ( $tags ) {

    // Do what you want here...

    // This should return an array so add your tags to
    // to the $tags array before returning it. E.G.

    $tags[] = 'use'; // This would allow the <use> element.

    return $tags;
} );

Rezensionen

10. Januar 2024 5 Antworten
Hello everyone,the Plugin does not work for me, I refreshed, logged in and out, checked several different svg files but the uploading is still not possible.After having read so many positive reviews I think I am an exception. Thanks for any advice!
16. August 2023 1 Antwort
I don't understand why this isn't in core wordpress. Plugin integrates flawlessly into the website and causes no issues.
30. November 2022 1 Antwort
Great little plugin that does exactly what it says. And does it easily. (Still not sure why SVGs are not supported natively but that's another discussion) Thank you, job well done!
Alle 70 Rezensionen lesen

Mitwirkende & Entwickler

„Safe SVG“ ist Open-Source-Software. Folgende Menschen haben an diesem Plugin mitgewirkt:

Mitwirkende

„Safe SVG“ wurde in 22 Sprachen übersetzt. Danke an die Übersetzerinnen und Übersetzer für ihre Mitwirkung.

Übersetze „Safe SVG“ in deine Sprache.

Interessiert an der Entwicklung?

Durchstöbere den Code, sieh dir das SVN Repository an oder abonniere das Entwicklungsprotokoll per RSS.

Änderungsprotokoll

2.2.4 – 2024-03-28

2.2.3 – 2024-03-20

2.2.2 – 2023-11-21

2.2.1 – 2023-10-23

2.2.0 – 2023-08-21

2.1.1 – 2023-04-05

2.1.0 – 2023-03-22

Earlier versions

For the changelog of earlier versions, please refer to the changelog on github.com.