SVG ایمن

توضیحات

افزونه امنیت vsg بهترین روش برای اجازه آپلود فایل vsg در وردپرس است!

این امکان را به شما می دهد تا آپلودهای SVG را مجاز کنید و در عین حال مطمئن شوید که برای جلوگیری از آسیب پذیری های SVG/XML که سایت شما را تحت تأثیر قرار می دهند، ضد عفونی شده اند.
همچنین به شما این امکان را می دهد که SVG های آپلود شده خود را در کتابخانه رسانه در همه نماها پیش نمایش کنید.

ویژگی های فعلی

  • Sanitised SVGs – Don’t open up security holes in your WordPress site by allowing uploads of unsanitised files.
  • مشاهده SVG در کتابخانه رسانه – زمان حدس زدن اینکه کدام SVG درست است گذشته است، پیش‌نمایش SVG را در کتابخانه رسانه وردپرس فعال می‌کنیم.

ویژگی های نقشه راه

  • بهینه سازی SVGO – می توانید SVG های خود را از طریق سرور SVGO ما هنگام آپلود اجرا کنید تا در فضای شما صرفه جویی شود.
  • انتخاب چه کسی می‌تواند آپلود کند – آپلودهای SVG را به کاربران خاصی در سایت وردپرس خود محدود کنید یا به هر کسی اجازه آپلود دهید.

در ابتدا یک اثبات مفهوم برای #24251

پاکسازی SVG از طریق کتابخانه زیر انجام می‌شود: https://github.com/darylldoyle/svg-sanitizer

بلوک‌ها

این افزونه 1 بلوک ارائه می‌دهد.

  • Safe SVG Display the SVG icon

نصب

از طریق دایرکتوری وردپرس نصب کنید یا فایل ها را از حالت فشرده خارج کنید و در فهرست /wp-content/plugins/ خود آپلود کنید.

سوالات متداول

آیا می توانیم ویژگی ها و برچسب های مجاز را تغییر دهیم؟

بله، این کار را می توان با استفاده از فیلترهای 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;
} );

بررسی‌ها

30 نوامبر 2022 1 reply
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!
23 فوریه 2022 3 replies
Why Automattic hates SVG has always been a source of confusion to me. Why shouldn't uploading SVG be as easy and straightforward as any other kind of (supported) image? Then again, it's true that you can write malicious code inside a SVG rather easily. The solution? Safe SVG. It cleans up a malformed or malicious SVG during the upload, so that when it arrives in your Media Library, it will already have been sanitised. The plugin is as simple to operate as it is useful. All parts of WP that require opening the Media Library browser will now accept SVGs as well. As others have remarked, there are some outstanding issues when previewing SVGs inside Gutenberg. No surprises there — this plugin has predated Gutenberg, and (at the time of writing) has been abandoned for about two years, during which Automattic has been eagerly upgrading WordPress. The author has not gone away, though. He is still actively developing the sanitising part of the plugin, using a library he has developed and posted on GitHub, and which has accepted several contributions and gone through many code reviews. It's possibly the reference library for SVG sanitation written in PHP. And fortunately he's now back and has released a brand new version as of late February 2022 🙂
14 فوریه 2022 1 reply
Our agency has a talented illustrator who is adept at creating SVGs, particularly with self-contained CSS animations. We would be loading them all manually from the theme folder with no path to easily add new or replace existing SVGs without developer involvement if it weren't for this plugin. We install Safe SVG on pretty much all sites we custom build for our clients. I'm really hoping for some additional features to come to this plugin to better support the Gutenberg editor, since the core image block doesn't handle SVGs well. But that doesn't affect my 5-star review as the most reliable SVG upload plugin.
23 فوریه 2022 4 replies
I used to install this plugin on all clients' websites, but sadly, the plugin has been not upgraded for 2 years! so i replaced it for another one. Updated review, the plugin finally has been updated, so all good now!
خواندن تمامی 66 بررسی‌

توسعه دهندگان و همکاران

“SVG ایمن” نرم افزار متن باز است. افراد زیر در این افزونه مشارکت کرده‌اند.

مشارکت کنندگان

“SVG ایمن” به 16 زبان ترجمه شده است. Thank you to the translators for their contributions.

ترجمه “SVG ایمن” به زبان شما.

علاقه‌ مند به توسعه هستید؟

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

تغییرات

2.1.0 – 2023-03-22

2.0.3 – 2022-09-01

2.0.2 – 2022-06-27

2.0.1 – 2022-04-19

2.0.0 – 2022-04-06

  • Added: New filter, safe_svg_use_width_height_attributes, that can be used to change the order of attributes we use to determine the SVG dimensions (props @dkotter, @peterwilsoncc).
  • Changed: Documentation updates (props @j-hoffmann, @jeffpaul, @Zodiac1978).
  • Fixed: Use the viewBox attributes first for image dimensions. Ensure we don’t use image dimensions that end with percent signs (props @dkotter, @peterwilsoncc).
  • Fixed: Make sure we use the full size SVG dimensions rather than the requested size, to avoid wrong sizes being used and duplicate height and width attributes (props @dkotter, @cadic).
  • Fixed: Ensure the tmp_name and name properties exist before we use them (props @dkotter, @aksld).

1.9.10 – 2022-02-23

Note that this release bumps the WordPress minimum version from 4.0 to 4.7 and the PHP minimum version from 5.6 to 7.0.

1.9.9 – 2020-05-07

  • Fixed: Issue where 100% width is accidentally converted to 100px width (props @joehoyle).

1.9.8 – 2020-05-07

  • Changed: Underlying library update.

1.9.7 – 2019-12-10

  • Changed: Underlying library update.

1.9.6 – 2019-11-07

  • Security: Underlying library update that fixes a security issue.

1.9.5 – 2019-11-04

  • Security: Underlying library update that fixes some security issues.

1.9.4 – 2019-08-21

  • رفع اشکالی که باعث می‌شد خروجی‌های گزارش خطای زیادی با safe_svg::fix_direct_image_output() انجام شود، رفع شد.

1.9.3 – 2019-02-19

  • Fixed: Bug causing 0 height and width SVGs.

1.9.2 – 2019-02-14

  • Fixed: Warning about an Illegal string offset.
  • اگر چیزی غیر از یک شی WP_Post از طریق فیلتر wp_get_attachment_image_attributes ارسال شود، مشکل برطرف شد.

1.9.1 – 2019-01-29

  • Fixed: Warning that was being generated by a change made in 1.9.0.

1.9.0 – 2019-01-03

  • Changed: If an image is the correct ratio, allow skipping of the crop popup when setting header/logo images with SVGs.

1.8.1 – 2018-11-22

  • Changed: Don’t let errors break upload if uploading an empty file
  • Fixed: Featured image display in Gutenberg. Props @dmhendricks 🙂

1.8.0 – 2018-11-04

  • Added: Pull SVG dimensions from the width/height or viewbox attributes of the SVG.
  • Added: role=”img” attribute to SVGs.

1.7.1 – 2018-10-01

  • Changed: Underlying lib and added new filters for filtering allowed tags and attributes.

1.7.0 – 2018-10-01

  • Added: Allow devs to filter tags and attrs within WordPress.

1.6.1 – 2018-03-17

  • Changed: Images will now use the size chosen when inserted into the page rather than default to 2000px everytime.

1.6.0 – 2017-12-20

  • Added: Fairly big new feature – The library now allows <use> elements as long as they don’t reference external files!
  • Fixed: You can now also embed safe image types within the SVG and not have them stripped (PNG, GIF, JPG).

1.5.3 – 2017-11-16

  • Fixed: 1.5.2 introduced an issue that can freeze the media library. This fixes that issue. Sorry!

1.5.2 – 2017-11-15

  • Changed: Tested with 4.9.0.
  • Fixed: Issue with SVGs when regenerating media.

1.5.1 – 2017-08-21

  • Fixed: PHP strict standards warning.

1.5.0 – 2017-06-20

  • Changed: Library update.
  • Changed: role, aria- and data- attributes are now whitelisted to improve accessibility.

1.4.5 – 2017-06-18

  • Changed: Library update.
  • Fixed: some issues with defining the size of an SVG.

1.4.4 – 2017-06-07

  • اصلاح شد: SVGها اکنون به عنوان تصاویر برجسته در قسمت مدیریت نمایش داده می شوند.

1.4.3 – 2017-03-06

  • اضافه شده: سازگاری با WordPress 4.7.3.
  • Changed: Expanded SVG previews in media library.

1.4.2 – 2017-02-26

  • Added: Check / fix for when mb_* functions are not available.

1.4.1 – 2017-02-23

  • Changed: Underlying library to allow attributes/tags in all case variations.

1.4.0 – 2017-02-21

  • Added: Ability to preview SVG on both grid and list view in the wp-admin media area
  • Changed: Underlying library version.

1.3.4 – 2017-02-20

  • Fixed: SVGZ uploads failing and not sanitising correctly.

1.3.3 – 2017-02-15

  • Changed: Allow SVGZ uploads.

1.3.2 – 2017-01-27

1.3.1 – 2016-12-01

  • Changed: Underlying library version.

1.3.0 – 2016-10-10

  • Changed: Minify SVGs after cleaning so they can be loaded correctly through file_get_contents.

1.2.0 – 2016-02-27

  • Added: Support for camel case attributes such as viewBox.

1.1.1 – 2016-07-06

  • Fixed: Issue with empty svg elements self-closing.

1.1.0 – 2015-07-04

  • Added: I18n.
  • Added: da, de ,en, es, fr, nl and ru translations.
  • Fixed: Issue with filename not being pulled over on failed uploads.

1.0.0 – 2015-07-03

  • انتشار اولیه.