2017 © Pedro Peláez
 

wordpress-muplugin wp-sanitize-accented-uploads

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

image

devgeniem/wp-sanitize-accented-uploads

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  • Saturday, January 14, 2017
  • by devgeniem
  • Repository
  • 8 Watchers
  • 16 Stars
  • 6,603 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 15 Versions
  • 6 % Grown

The README.md

geniem-github-banner, (*1)

WP Plugin: Sanitize Accented Uploads

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

WordPress plugin which removes accented characters like åöä from future uploads and has easy wp-cli command for removing accents from current uploads and attachment links from database. This helps tremendously with current and future migrations of your site and helps you to avoid strange filename encoding bugs. It also turns spaces into dashes ' ' => '-' and removes any other special characters like ™ ¼ so that they don't bother you anymore., (*3)

Sanitize accents from Cyrillic, German, French, Polish, Spanish, Hungarian, Czech, Greek, Swedish. This even removes rare but possible unicode NFD characters from files by using PHP Normalizer class. These usually happen if you have mounted uploads into your vagrant box in OS-X., (*4)

This plugin even tries to fix your files which are already corrupted. For example you can fix situations where you might have uploaded file ääkkönen.png which has corrupted into ääkkönen.png. See more in last section. These encoding errors are taken from http://www.i18nqa.com/debug/utf8-debug.html., (*5)

This plugin and wp-cli command are WordPress multisite compatible., (*6)

Installation

Composer

Install with composer by running:, (*7)

$ composer require devgeniem/wp-sanitize-accented-uploads

OR add it into your composer.json:, (*8)

{
  "require": {
    "devgeniem/sanitize-accented-uploads": "*"
  },
  "extra": {
    "installer-paths": {
      "htdocs/wp-content/mu-plugins/{$name}/": ["type:wordpress-muplugin"]
    }
  }
}

It installs as mu-plugin so that your clients won't accidentally disable it., (*9)

Wordpress.org

You can also download the plugin from wordpress.org:, (*10)

https://wordpress.org/plugins/wp-sanitize-accented-uploads/, (*11)

Contributing

Contributions are welcome! If you add new functionality remember to add new unit tests too., (*12)

Use WP CLI to remove accents from uploads and database

This searches for accented filenames in all of your attachments. If it founds any it looks if these attachments are used in post content and sanitizes all occurences of the the attachment filename path from wp_posts and wp_postmeta., (*13)

Take backup from your files and database before running this. It works for us but we can't give any guarantees., (*14)

# You can analyze before running it:
$ wp sanitize all --verbose --dry-run

# When you are sure go ahead and run it
$ wp sanitize all

# If you have a network you can do network wide replace
$ wp sanitize all --network

Example output

$ wp sanitize all
Found: 5 attachments.
This may take a while...
REPLACING: ääkkönen.png ---> aakkonen.png
----> Checking image:     /var/www/wp/wp-content/uploads/2016/04/ääkkönen.png
----> Replaced file:      ääkkönen.png -> aakkonen.png
----> Checking thumbnail: /var/www/wp/wp-content/uploads/2016/04/ääkkönen-150x68.png
----> Replaced thumbnail: ääkkönen-150x68.png -> aakkonen-150x68.png

Remaining workload: 2 attachments...

Success: Replaced 1 from 5 attachments.

The Versions

14/01 2017

dev-master

9999999-dev http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

14/01 2017

1.2.1

1.2.1.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

20/04 2016

1.2

1.2.0.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

17/04 2016

1.1.1

1.1.1.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

17/04 2016

1.1.0

1.1.0.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

16/04 2016

1.0.8

1.0.8.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

07/04 2016

1.0.7

1.0.7.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

07/04 2016

1.0.6

1.0.6.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

07/04 2016

1.0.4

1.0.4.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

06/04 2016

1.0.3

1.0.3.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

06/04 2016

1.0.2

1.0.2.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

05/04 2016

1.0.1

1.0.1.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

02/03 2016

1.0

1.0.0.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

01/03 2016

0.2

0.2.0.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate

01/03 2016

0.1

0.1.0.0 http://geniem.com

Replaces accents from future uploads and has wp-cli command which you can use to sanitize current content.

  Sources   Download

MIT

The Requires

 

wordpress wp urls escape uploads accents sanitate