diff --git a/composer.json b/composer.json index 6ff27db..fbedfc1 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "email": "opensource@10up.com", "homepage": "https://10up.com/", "role": "Developer" - }, + }, { "name": "Daryll Doyle", "email": "daryll@enshrined.co.uk", diff --git a/includes/safe-svg-settings.php b/includes/safe-svg-settings.php index 574075c..05239b7 100644 --- a/includes/safe-svg-settings.php +++ b/includes/safe-svg-settings.php @@ -25,6 +25,15 @@ public function __construct() { */ public function settings_init() { register_setting( 'media', 'safe_svg_upload_roles', [ $this, 'sanitize_safe_svg_roles' ] ); + register_setting( + 'media', + 'safe_svg_large_svg', + [ + 'type' => 'integer', + 'default' => 0, + 'sanitize_callback' => 'absint', + ] + ); add_settings_section( 'safe_svg_settings', @@ -40,6 +49,14 @@ public function settings_init() { 'media', 'safe_svg_settings' ); + + add_settings_field( + 'safe_svg_large_svg', + __( 'Large Files', 'safe-svg' ), + [ $this, 'safe_svg_large_svg_cb' ], + 'media', + 'safe_svg_settings' + ); } /** @@ -162,4 +179,15 @@ public function update_capability( $new_roles, $old_roles ) { return $new_roles; } + /** + * Large SVG files field callback function. + */ + public function safe_svg_large_svg_cb() { + ?> + +
+ sanitizer->setAllowHugeFiles( true ); + } + /** * Load extra filters to allow devs to access the safe tags and attrs by themselves. */