devgeniem/wp-sanitize-accented-uploads 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

devgeniem/wp-sanitize-accented-uploads

最新稳定版本:1.2.1

Composer 安装命令:

composer require devgeniem/wp-sanitize-accented-uploads

包简介

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

README 文档

README

geniem-github-banner

WP Plugin: Sanitize Accented Uploads

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

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.

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.

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.

This plugin and wp-cli command are WordPress multisite compatible.

Installation

Composer

Install with composer by running:

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

OR add it into your composer.json:

{ "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.

Wordpress.org

You can also download the plugin from wordpress.org:

https://wordpress.org/plugins/wp-sanitize-accented-uploads/

Contributing

Contributions are welcome! If you add new functionality remember to add new unit tests too.

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.

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

# 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. 

统计信息

  • 总下载量: 95.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 27
  • 点击次数: 3
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 27
  • Watchers: 9
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固