Linux 软件免费装
Banner图

UNFC Nörmalize

开发者 gitlost
zodiac1978
更新时间 2017年1月19日 18:33
PHP版本: 3.9.13 及以上
WordPress版本: 4.7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

Unicode Normalization Form C Unicode Normalization Form C Normalize Normalizer NFC UTF-8

下载

1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6

详情介绍:

This is a souped-up version of the Normalizer plugin by Torsten Landsiedel. It adds WP filters to normalize UTF-8 data coming into the system to the de facto web standard Normalization Form C. The Unicode Consortium report is at Unicode Normalization Forms. Polyfills For best performance install (if possible) the PHP Internationalization extension Intl, which includes the PHP class Normalizer. However the plugin works without the PHP Intl extension being installed, as it uses (a modified version of) the Symfony Normalizer polyfill. Also text pasted into (most) inputs is normalized immediately using the JavaScript normalize() method. For browsers without normalization support, the unorm polyfill is used. Background For further info, see the WP Trac ticket #30130 Normalize characters with combining marks to precomposed characters and this Make WP Core comment. The plugin also works around the Safari-specific issues raised by the WP Trac ticket #22363 Accents in attachment filenames should be sanitized. Scanner For existing data, the plugin includes an administration tool to scan and normalize the database. Important: before using this tool to normalize, please backup your database. This is especially important if your database contains non-normalized serialized data, as this plugin uses the same suck-and-see technique as interconnect/it's Database Search and Replace Script in PHP to deal with serialized data, and is fallible. And A google-cheating schoolboy French translation is supplied. The plugin should run on PHP 5.2.17 to 7.1, and on WP 3.9.13 to 4.7.1. The project is on github.

安装:

Install in the standard way via the 'Plugins' menu in WordPress and then activate. No further action is needed.

屏幕截图:

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

升级注意事项:

1.0.6 Less noisy when WP_DEBUG set. 1.0.5 Fixes fatal error on check slugs listing in DB check tool when Intl extension not available. 1.0.4 Now adds _wp_old_slug on normalizing slugs so old links will work. 1.0.3 Improved PHP 5 performance on isNormalized() check.

常见问题:

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

更新日志:

1.0.6 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0 0.9.1 0.9.0