2017 © Pedro Peláez
 

library wp-svg-upload

image

digimix/wp-svg-upload

  • Sunday, March 4, 2018
  • by digimix
  • Repository
  • 1 Watchers
  • 2 Stars
  • 180 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

Installation Instructions

Install with Composer composer require digimix/wp-svg-upload, (*1)

Install manually 1. Clone or copy the files into your WordPress plugins directory 2. Activate the plugin from the dashboard or using WP CLI, (*2)

Once the plugin is activated, you're good to go. Your WordPress media library will support uploading SVG files., (*3)

Logic Breakdown

  • 1) We need the whole page, but only if we are in the backend (hence admin_init hook)
  • 2) We would like to grab all output (ob_start within admin_init as nothing should echo before that, we should not interfere with things that do)
  • 3) We want to grab the content on shutdown, concatenate all output buffers, then filter
  • 4) Search for placeholders which should exist and replace the text
  • Downsides
  • 1) Not permanent fix (for perma fix WP core would need to be editable or native filtering added)
  • 2) A bit resource munchy (it's locked to the admin side, so IMHO who cares)
  • 3) This is just to get SVG into WP core... Luckily the find replace is that simple in /wp-includes/media-template.php (Patch it Mullweng & Co!)

## Changes... * Re-factored function declaration and calls to make compatible with lesser PHP versions, despite believing anyone using such versions is dangerous * Added param for mime-types to filter_mimes function * Moved into a namespace and class to make the whole thing less hack-and-slash * Updated to use short-array syntax (Breaking change update your PHP or don't use) * Deleted some dead code I never noticed before, (*4)

## Credits * Originally forked from https://gist.github.com/digimix/01a2e5b38596ea83369a, https://gist.github.com/Lewiscowles1986/44f059876ec205dd4d27 * Maintained by the WordPress Developer Team at Digimix Studios, (*5)

The Versions

04/03 2018

v1.0

1.0.0.0

  Sources   Download

31/05 2016

dev-master

9999999-dev http://digimix.github.io/wp-svg-upload

Adds full SVG media support to WordPress.

  Sources   Download

MIT

The Requires

 

wordpress

27/05 2016

v1.0.2

1.0.2.0 https://roots.io/plugins/soil/

Adds full SVG media support to WordPress.

  Sources   Download

MIT

The Requires

 

wordpress

27/05 2016

v1.0.1

1.0.1.0 https://roots.io/plugins/soil/

Adds full SVG media support to WordPress.

  Sources   Download

MIT

The Requires

 

wordpress