Skip to content

Commit 82c8bde

Browse files
committed
some changes
1 parent d760bde commit 82c8bde

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

wcz_utf8_url.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
1-
<?php
2-
3-
// This is a PLUGIN TEMPLATE.
4-
5-
// Copy this file to a new name like abc_myplugin.php. Edit the code, then
6-
// run this file at the command line to produce a plugin for distribution:
7-
// $ php abc_myplugin.php > abc_myplugin-0.1.txt
8-
9-
// Plugin name is optional. If unset, it will be extracted from the current
10-
// file name. Uncomment and edit this line to override:
11-
$plugin['name'] = 'wcz_utf8_url';
12-
13-
$plugin['version'] = '0.1.4';
14-
$plugin['author'] = 'whocarez';
15-
$plugin['author_uri'] = '';
16-
$plugin['description'] = 'Automatic UTF-8 permlinks';
17-
$plugin['type'] = 1; // 0 for regular plugin; 1 if it includes admin-side code
1+
<?php
2+
3+
// This is a PLUGIN TEMPLATE.
4+
5+
// Copy this file to a new name like abc_myplugin.php. Edit the code, then
6+
// run this file at the command line to produce a plugin for distribution:
7+
// $ php abc_myplugin.php > abc_myplugin-0.1.txt
8+
9+
// Plugin name is optional. If unset, it will be extracted from the current
10+
// file name. Uncomment and edit this line to override:
11+
$plugin['name'] = 'wcz_utf8_url';
12+
13+
$plugin['version'] = '0.1.6';
14+
$plugin['author'] = 'whocarez';
15+
$plugin['author_uri'] = '';
16+
$plugin['description'] = 'Automatic UTF-8 permlinks';
17+
$plugin['type'] = 5; // 0 for regular plugin; 1 if it includes admin-side code
1818
$plugin['order'] = 5; # use 5 as a default; ranges from 1 to 9
1919

20-
21-
@include_once('zem_tpl.php');
22-
23-
if (0) {
24-
?>
25-
# --- BEGIN PLUGIN HELP ---
26-
20+
21+
@include_once('zem_tpl.php');
22+
23+
if (0) {
24+
?>
25+
# --- BEGIN PLUGIN HELP ---
26+
2727
Just install and activate.
2828
Adjust Textpattern->Advanced Options->“Maximum URL length (in characters)” to your needs.
29-
30-
# --- END PLUGIN HELP ---
31-
<?php
32-
}
33-
34-
# --- BEGIN PLUGIN CODE ---
29+
30+
# --- END PLUGIN HELP ---
31+
<?php
32+
}
33+
34+
# --- BEGIN PLUGIN CODE ---
3535

3636
/*
3737
wcz_utf8_url - Makes UTF-8 permlinks for SEO
3838
3939
Written by whocarez with help of the Textpattern Community
4040
41-
Released under the GNU General Public License 3
42-
See: http://www.gnu.org/licenses/gpl.html
43-
4441
Version history:
45-
0.1.4 - minor fix of preserving already existing dashes/minuses
46-
0.1.3 - added remove small words
47-
0.1.2 - minor fixes with double dashes and trimming the url string
48-
0.1.1 - minor fixes
42+
0.1.6 Minor fix autodetect charset in mb_strlower
43+
0.1.5 Minor fix for mb_strlower and charset
44+
0.1.4 Minor fix of preserving already existing dashes/minuses
45+
0.1.3 - Added remove small words
46+
0.1.2 - Minor fixes with double dashes and trimming the url string
47+
0.1.1 - Minor fixes
4948
0.1.0 - initial release
5049
5150
*/
@@ -67,7 +66,7 @@ function wcz_utf8_url($event,$step,$text) {
6766
$text = trim(preg_replace("/(^|-)(([\p{Ll}\p{Lu}\p{Lt}\p{Lo}]{1,3})(?<!new|wer|wen|wie|was|wo|wem|how|who|zug|uni|job|gps|bus|tod|tot|eko|öko|eu|dai|gai|hiv|df|ing|ua|upa|oun|omv|otp|ss|umc|twi|tvi|usa|uno|bio|see|kuh|fuß|not|kot|tür|sex|uhu|rat|dvd|cd|tau|rot|tor|tat|bit|sau|ehe|gut|mfg|ard|zdf|rtl|mdr|tee|uhr|zoo|zeh|rss|xml|pdf|axt|fan|nuß|neu|fkk|aal|bug|ost|alt|rom|ddr|fdj|sed|kgb|fbi|cia|sbu|ohr|age|ece|bip|mts|gus|ntn|cme|ntn|iwf|wto|scm|man|uah|eon|nbu|obi|tv|isd|ilo|akw|who|ooo|stb|gas|em))(?=-|$)/ui","", $text),"-");
6867
// Remove all non-whitelisted characters
6968
$text = preg_replace("/[^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\-_]/u","",$text);
70-
$text = trim(mb_strtolower($text),'-');
69+
$text = trim(mb_strtolower($text,mb_detect_encoding($text)),'-');
7170
return $text;
7271
}
7372

@@ -78,6 +77,7 @@ function update_urls() {
7877

7978
}
8079

81-
# --- END PLUGIN CODE ---
82-
83-
?>
80+
81+
# --- END PLUGIN CODE ---
82+
83+
?>

0 commit comments

Comments
 (0)