| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | Plugin Name: Usernames I18N Fix |
|---|
| 4 | Plugin URI: http://sewar.wordpress.com/bbpress/plugins/usernames_i18n_fix/ |
|---|
| 5 | Description: Allow users to use I18N non-English names. |
|---|
| 6 | Author: Sewar |
|---|
| 7 | Author URI: http://sewar.wordpress.com |
|---|
| 8 | Version: 1.0 |
|---|
| 9 | */ |
|---|
| 10 | |
|---|
| 11 | /* |
|---|
| 12 | Usernames I18N Fix, bbPress plugin allows users to use I18N non-English names. |
|---|
| 13 | Copyright (C) 2006 Sewar |
|---|
| 14 | |
|---|
| 15 | This program is free software; you can redistribute it and/or modify |
|---|
| 16 | it under the terms of the GNU General Public License as published by |
|---|
| 17 | the Free Software Foundation; version 2 of the License. |
|---|
| 18 | |
|---|
| 19 | This program is distributed in the hope that it will be useful, |
|---|
| 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 22 | GNU General Public License for more details. |
|---|
| 23 | |
|---|
| 24 | You should have received a copy of the GNU General Public License |
|---|
| 25 | along with this program; if not, write to the Free Software |
|---|
| 26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 27 | */ |
|---|
| 28 | |
|---|
| 29 | function user_sanitize_i18n_fix($text, $raw, $strict){ |
|---|
| 30 | $new_text = $raw; |
|---|
| 31 | |
|---|
| 32 | if ( $strict ) |
|---|
| 33 | $new_text = preg_replace('|-+|', '-', $new_text); |
|---|
| 34 | |
|---|
| 35 | return $new_text; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | add_filter('user_sanitize', 'user_sanitize_i18n_fix', 10, 3); |
|---|
| 39 | |
|---|
| 40 | ?> |
|---|