settings(); $settings->add_section( 'media', 'svg_uploads', __( 'SVG Uploads', 'all-in-one-utilities' ), __( 'Allow SVG files (logos, icons, illustrations) in the Media Library. Every file is cleaned of anything that could run code before it is stored.', 'all-in-one-utilities' ), 40 ); $settings->add_field( 'media', 'svg_uploads', new Field( id: 'enabled', label: __( 'SVG uploads', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Allow SVG uploads, with sanitization', 'all-in-one-utilities' ) ), doc: new Doc( title: __( 'SVG uploads', 'all-in-one-utilities' ), short: __( 'SVG files are code as well as pictures, so WordPress blocks them by default. Each uploaded SVG is rebuilt from a list of known-safe drawing elements; scripts, event handlers, embedded web pages, and links to other sites are removed.', 'all-in-one-utilities' ), detailed: __( 'Files that can\'t be read as SVG, compressed .svgz files, and files declaring XML entities are refused. Uploaded SVGs get their real width and height, so they display properly in the Media Library, as featured images, and in blocks.', 'all-in-one-utilities' ), warnings: array( __( 'Only allow roles you trust. Sanitizing removes known dangers, but an SVG is still a document from whoever uploaded it.', 'all-in-one-utilities' ) ) ), priority: 10 ) ); $settings->add_field( 'media', 'svg_uploads', new Field( id: 'roles', label: __( 'Who can upload SVGs', 'all-in-one-utilities' ), type: 'checklist', default: array( 'administrator' ), args: array( 'choices' => array_map( 'translate_user_role', Roles::all() ), 'depends_on' => 'enabled', ), priority: 20 ) ); ( new Feature() )->register(); } }