Safe SVG

Description

Safe SVG – лепшы спосаб рэалізаваць загрузку SVG у WordPress!

Плагін дае магчымасць дазваляць загрузку SVG, у той жа час сачыць за тым, каб яны былі ачышчаны, для прадухілення пагроз SVG/XML, якія патэнцыйна ўплываюць на сайт. Таксама дае магчымасць праглядаць загружаныя SVG-файлы ў медыя-бібліятэцы ва ўсіх памерах.

Бягучыя функціі

  • Sanitised SVGs – Don’t open up security holes in your WordPress site by allowing uploads of unsanitised files.
  • Аптымізацыя SVGO – Пры загрузцы праганяе вашыя SVG праз прыладу SVGO, каб зэканоміць месца. Па змаўчанні гэтая функцыя адключаная, але яе можна ўлучыць, дадаўшы наступны код: add_filter( 'safe_svg_optimizer_enabled', '__return_true' );
  • View SVGs in the Media Library – Gone are the days of guessing which SVG is the correct one, we’ll enable SVG previews in the WordPress media library.
  • Абярыце, хто можа загружаць – Абмяжуйце загрузку SVG пэўным карыстальнікам на вашым WordPress сайце або дазвольце загружаць іх усім жадаючым.

Першапачатковы канцэпт: #24251

SVG Sanitization is done through the following library: https://github.com/darylldoyle/svg-sanitizer.

Аптымізацыя SVG ажыццяўляецца з дапамогай наступнай бібліятэкі: https://github.com/svg/svgo.

Blocks

This plugin provides 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

Ці можна змяніць дазволеныя атрыбуты і тэгі?

Так, гэта магчыма, выкарыстоўваючы фільтры svg_allowed_attributes і svg_allowed_tags. Яны прымаюць адзін аргумэнт, які павінен быць вернуты. Глядзіце прыклады ніжэй:

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;
} );

Reviews

10 студзеня, 2024 5 replies
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 жніўня, 2023 1 reply
I don’t understand why this isn’t in core wordpress. Plugin integrates flawlessly into the website and causes no issues.
Read all 73 reviews

Contributors & Developers

“Safe SVG” is open source software. The following people have contributed to this plugin.

Contributors

“Safe SVG” has been translated into 29 locales. Thank you to the translators for their contributions.

Translate “Safe SVG” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

2.3.1 – 2024-12-05

2.3.0 – 2024-11-25

2.2.6 – 2024-08-28

2.2.5 – 2024-06-27

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

View historical changelog details here.