Normalizes UTF-8 input to Normalization Form C.
Author: | gitlost (profile at wordpress.org) |
WordPress version required: | 3.9.13 |
WordPress version tested: | 4.7.1 |
Plugin version: | 1.0.6 |
Added to WordPress repository: | 02-08-2016 |
Last updated: | 19-01-2017
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 100 |
Rated by: | 2 |
Plugin URI: | https://github.com/gitlost/unfc-normalize |
Total downloads: | 1 913 |
Active installs: | 100+ |
Click to start download
|
Screenshots
Before and after: pasting non-normalized text into a post's title and content.
Before: uploading a file on macOS with Firefox and then viewing with Safari (broken in Safari).
After: uploading a file on macOS with Firefox and then viewing with Safari (whee it works).
Front page of the database scan administration tool.
FAQ
How can I normalize extra stuff?
You can add normalization to anything that passes its content through a filter. The canonical way is to use the unfc_extra_filters
filter which returns an array of filter names – for instance, in your theme’s functions.php
file, add:
function mytheme_unfc_extra_filters( $extra_filters ) {
$extra_filters[] = 'myfilter';
return $extra_filters;
}
add_filter( 'unfc_extra_filters', 'mytheme_unfc_extra_filters' );
Note that the unfc_extra_filters
filter is only called in the administration backend. You can also add a filter directly, to be called in the frontend or backend, by referencing the global PHP variable unfc_normalize
, but you should ensure that the Normalizer
polyfill is loaded if you don’t have the PHP Intl
extension installed:
global $unfc_normalize;
if ( $unfc_normalize ) {
if ( ! function_exists( 'normalizer_is_normalized' ) ) { // If the "Intl" extension is not installed...
$unfc_normalize->load_unfc_normalizer_class(); // ...load the polyfill.
}
add_filter( 'myfilter', array( $unfc_normalize, 'normalize' ), 6 /* Or whatever priority you choose */ );
}
Does it have a tool to normalize the filenames of files uploaded prior to its enabling?
No, it doesn’t. Alas, such files would have to re-uploaded. However if (enough – or more like any) interest were expressed…
ChangeLog
1.0.6
- Require explicit define of UNFC_DEBUG. Move load of debug file to ‘init’.
- Safari submit workaround.
- WP 4.7.1 compatible.
1.0.5
- Do load of normalizer in slugs list constructor not items list. Fixes slugs listing crash when Intl extension not installed.
- Ignore case when checking charset (UNFC_Normalize::is_blog_utf8()).
- WP coding standards (yoda style in unfc_utf8_4range()).
- Add screenshots.
- Some extra unittests.
- WP 4.7.0 compatible.
1.0.4
- Add _wp_old_slug on normalizing slugs.
- Escape title in screen reader label in db check.
1.0.3
- For PHP 5 performance do preliminary preg_match on isNormalized.
- Improve comments in Normalizer.php, tabs -> 4 spaces, UNFC_REGEX_IS_INVALID_UTF8_XXX invert & rename.
- Fix untested admin notice and adjust tests. Fix some test bleed ($wp_scripts).
1.0.2
- Move all .php files bar main to includes subdir. Remove unused ajax.
- Fix single-byte trie. Move regex alts to tools/functions.php.
- Fix untested admin notice. Adjust tests for untested admin_notice change. Fix some test bleed ($wp_scripts).
- WP 4.6 compatible.
1.0.1
- First release for wordpress.org repository.
- Add assets.
- Include “class-unfc-list_table.php” in .pot file (for forward/backward compat).
- Remove unused variable in UNFC_DB_Check_Slugs_List_Table.
1.0.0
0.9.1
- Fix bad serialized data corruption on db check.
- Fix text domain tag.
0.9.0
- Initial version after renaming from tl-normalize.