Skip to content

Commit

Permalink
Merge branch 'develop' into 6-svg-height-and-width-attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Nov 20, 2024
2 parents 6c701db + fa36531 commit dfdbc87
Show file tree
Hide file tree
Showing 13 changed files with 2,320 additions and 1,809 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
core:
- {name: 'WP latest', version: 'latest'}
- {name: 'WP minimum', version: 'WordPress/WordPress#6.4'}
- {name: 'WP minimum', version: 'WordPress/WordPress#6.5'}
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}

steps:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Safe SVG

> Enable SVG uploads and sanitize them to stop XML/SVG vulnerabilities in your WordPress website.
![Safe SVG](https://github.com/10up/safe-svg/blob/develop/.wordpress-org/banner-1544x500.png)

[![Support Level](https://img.shields.io/badge/support-stable-blue.svg)](#support-level) ![WordPress tested up to version](https://img.shields.io/wordpress/plugin/tested/safe-svg?label=WordPress) [![GPL-2.0-or-later License](https://img.shields.io/github/license/10up/safe-svg.svg)](https://github.com/10up/safe-svg/blob/develop/LICENSE.md) [![WordPress Playground Demo](https://img.shields.io/wordpress/plugin/v/safe-svg?logo=wordpress&logoColor=FFFFFF&label=Playground%20Demo&labelColor=3858E9&color=3858E9)](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/10up/safe-svg/update/badges/.wordpress-org/blueprints/blueprint.json)
[![Support Level](https://img.shields.io/badge/support-stable-blue.svg)](#support-level) ![Required PHP Version](https://img.shields.io/wordpress/plugin/required-php/safe-svg?label=Requires%20PHP) ![Required WP Version](https://img.shields.io/wordpress/plugin/wp-version/safe-svg?label=Requires%20WordPress) ![WordPress tested up to version](https://img.shields.io/wordpress/plugin/tested/safe-svg?label=WordPress) [![GPL-2.0-or-later License](https://img.shields.io/github/license/10up/safe-svg.svg)](https://github.com/10up/safe-svg/blob/develop/LICENSE.md) [![Dependency Review](https://github.com/10up/safe-svg/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/dependency-review.yml) [![E2E test](https://github.com/10up/safe-svg/actions/workflows/cypress.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/cypress.yml) [![PHP Compatibility](https://github.com/10up/safe-svg/actions/workflows/php-compatibility.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/php-compatibility.yml) [![PHPCS](https://github.com/10up/safe-svg/actions/workflows/phpcs.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/phpcs.yml) [![PHPUnit](https://github.com/10up/safe-svg/actions/workflows/phpunit.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/phpunit.yml) [![CodeQL](https://github.com/10up/safe-svg/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/github-code-scanning/codeql) [![WordPress Playground Demo](https://img.shields.io/wordpress/plugin/v/safe-svg?logo=wordpress&logoColor=FFFFFF&label=Playground%20Demo&labelColor=3858E9&color=3858E9)](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/10up/safe-svg/update/badges/.wordpress-org/blueprints/blueprint.json)

[![E2E test](https://github.com/10up/safe-svg/actions/workflows/cypress.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/cypress.yml) [![PHP Compatibility](https://github.com/10up/safe-svg/actions/workflows/php-compatibility.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/php-compatibility.yml) [![PHPCS](https://github.com/10up/safe-svg/actions/workflows/phpcs.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/phpcs.yml) [![PHPUnit](https://github.com/10up/safe-svg/actions/workflows/phpunit.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/phpunit.yml) [![Dependency Review](https://github.com/10up/safe-svg/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/10up/safe-svg/actions/workflows/dependency-review.yml)
> Enable SVG uploads and sanitize them to stop XML/SVG vulnerabilities in your WordPress website.
## Overview

Expand All @@ -28,7 +28,7 @@ SVG Optimization is done through the following library: [https://github.com/svg/
## Requirements

* PHP 7.4+
* [WordPress](http://wordpress.org/) 6.4+
* [WordPress](http://wordpress.org/) 6.5+

## Installation

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"email": "opensource@10up.com",
"homepage": "https://10up.com/",
"role": "Developer"
},
},
{
"name": "Daryll Doyle",
"email": "daryll@enshrined.co.uk",
Expand Down
2 changes: 1 addition & 1 deletion includes/blocks/safe-svg/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Display the SVG icon",
"textdomain": "safe-svg",
"name": "safe-svg/svg-icon",
"category": "safe-svg-blocks",
"category": "design",
"attributes": {
"svgURL": {
"type": "string",
Expand Down
28 changes: 28 additions & 0 deletions includes/safe-svg-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'
);
}

/**
Expand Down Expand Up @@ -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() {
?>
<label>
<input type="checkbox" name="safe_svg_large_svg" value="1" <?php checked( get_option( 'safe_svg_large_svg' ), 1 ); ?> /> <?php esc_html_e( 'Allow large SVG files', 'safe-svg' ); ?>
</label>
<p class="description"><?php esc_html_e( 'Turning this on will allow SVG files larger than 10MB to be uploaded. This can impact performance and is not recommended unless needed.', 'safe-svg' ); ?></p>
<?php
}
}
Loading

0 comments on commit dfdbc87

Please sign in to comment.