1: <?php
2:
3: /**
4: * Translates characters with diacritical marks to simple equivalents
5: * @package plugins
6: * @subpackage seo
7: */
8: $plugin_is_filter = 5 | ADMIN_PLUGIN;
9: $plugin_description = gettext("SEO filter to translate extended characters into their basic alpha-numeric equivalents.");
10: $plugin_author = "Stephen Billard (sbillard)";
11: $plugin_disable = (zp_has_filter('seoFriendly') && !extensionEnabled('seo_zenphoto')) ? sprintf(gettext('Only one SEO filter plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('seoFriendly'))) : '';
12:
13: $option_interface = 'zenphoto_seo';
14:
15: if ($plugin_disable) {
16: enableExtension('zenphoto_seo', 0);
17: } else {
18: zp_register_filter('seoFriendly', 'zenphoto_seo::filter');
19: zp_register_filter('seoFriendly_js', 'zenphoto_seo::js');
20: }
21:
22: /**
23: * Option handler class
24: *
25: */
26: class zenphoto_seo {
27:
28: /**
29: * class instantiation function
30: *
31: * @return zenphoto_seo
32: */
33: function __construct() {
34: setOptionDefault('zenphoto_seo_lowercase', 1);
35: }
36:
37: /**
38: * Reports the supported options
39: *
40: * @return array
41: */
42: function getOptionsSupported() {
43: return array(gettext('Lowercase only') => array('key' => 'zenphoto_seo_lowercase', 'type' => OPTION_TYPE_CHECKBOX,
44: 'desc' => gettext('When set, all characters are converted to lower case.')));
45: }
46:
47: function handleOption($option, $currentValue) {
48:
49: }
50:
51: private static $specialchars = array(
52: "À" => "A",
53: "Á" => "A",
54: "Â" => "A",
55: "Ã" => "A",
56: "Å" => "A",
57: "Ā" => "A",
58: "Ă" => "A",
59: "Ą" => "A",
60: "Ǟ" => "A",
61: "Ǡ" => "A",
62: "Ǻ" => "A",
63: "Ȁ" => "A",
64: "Ȃ" => "A",
65: "Ȧ" => "A",
66: "Ḁ" => "A",
67: "Ả" => "A",
68: "Ấ" => "A",
69: "Ầ" => "A",
70: "Ẩ" => "A",
71: "Ẫ" => "A",
72: "Ậ" => "A",
73: "Ắ" => "A",
74: "Ằ" => "A",
75: "Ẳ" => "A",
76: "Ẵ" => "A",
77: "Ặ" => "A",
78: "Å" => "A",
79: "Ä" => "AE",
80: "Æ" => "AE",
81: "Ǽ" => "AE",
82: "Ǣ" => "AE",
83: "Ḃ" => "B",
84: "Ɓ" => "B",
85: "Ḅ" => "B",
86: "Ḇ" => "B",
87: "Ƃ" => "B",
88: "Ƅ" => "B",
89: "Ć" => "C",
90: "Ĉ" => "C",
91: "Ċ" => "C",
92: "Č" => "C",
93: "Ƈ" => "C",
94: "Ç" => "C",
95: "Ḉ" => "C",
96: "Ḋ" => "D",
97: "Ɗ" => "D",
98: "Ḍ" => "D",
99: "Ḏ" => "D",
100: "Ḑ" => "D",
101: "Ḓ" => "D",
102: "Ď" => "D",
103: "Đ" => "D",
104: "Ɖ" => "D",
105: "È" => "E",
106: "É" => "E",
107: "Ê" => "E",
108: "Ẽ" => "E",
109: "Ē" => "E",
110: "Ĕ" => "E",
111: "Ė" => "E",
112: "Ë" => "E",
113: "Ẻ" => "E",
114: "Ě" => "E",
115: "Ȅ" => "E",
116: "Ȇ" => "E",
117: "Ẹ" => "E",
118: "Ȩ" => "E",
119: "Ę" => "E",
120: "Ḙ" => "E",
121: "Ḛ" => "E",
122: "Ề" => "E",
123: "Ế" => "E",
124: "Ễ" => "E",
125: "Ể" => "E",
126: "Ḕ" => "E",
127: "Ḗ" => "E",
128: "Ệ" => "E",
129: "Ḝ" => "E",
130: "Ǝ" => "E",
131: "Ɛ" => "E",
132: "Ḟ" => "F",
133: "Ƒ" => "F",
134: "Ǵ" => "G",
135: "Ĝ" => "G",
136: "Ḡ" => "G",
137: "Ğ" => "G",
138: "Ġ" => "G",
139: "Ǧ" => "G",
140: "Ɠ" => "G",
141: "Ģ" => "G",
142: "Ǥ" => "G",
143: "Ĥ" => "H",
144: "Ḣ" => "H",
145: "Ḧ" => "H",
146: "Ȟ" => "H",
147: "Ƕ" => "H",
148: "Ḥ" => "H",
149: "Ḩ" => "H",
150: "Ḫ" => "H",
151: "Ħ" => "H",
152: "Ì" => "I",
153: "Í" => "I",
154: "Î" => "I",
155: "Ĩ" => "I",
156: "Ī" => "I",
157: "Ĭ" => "I",
158: "İ" => "I",
159: "Ï" => "I",
160: "Ỉ" => "I",
161: "Ǐ" => "I",
162: "Ị" => "I",
163: "Į" => "I",
164: "Ȋ" => "I",
165: "Ḭ" => "I",
166: "Ḭ" => "I",
167: "Ɨ" => "I",
168: "Ḯ" => "I",
169: "Ĵ" => "J",
170: "Ḱ" => "K",
171: "Ǩ" => "K",
172: "Ḵ" => "K",
173: "Ƙ" => "K",
174: "Ḳ" => "K",
175: "Ķ" => "K",
176: "Ḻ" => "L",
177: "Ḷ" => "L",
178: "Ḷ" => "L",
179: "Ļ" => "L",
180: "Ḽ" => "L",
181: "Ľ" => "L",
182: "Ŀ" => "L",
183: "Ł" => "L",
184: "Ḹ" => "L",
185: "Ḿ" => "M",
186: "Ṁ" => "M",
187: "Ṃ" => "M",
188: "Ɯ" => "M",
189: "Ǹ" => "N",
190: "Ń" => "N",
191: "Ñ" => "N",
192: "Ṅ" => "N",
193: "Ň" => "N",
194: "Ŋ" => "N",
195: "Ɲ" => "N",
196: "Ṇ" => "N",
197: "Ņ" => "N",
198: "Ṋ" => "N",
199: "Ṉ" => "N",
200: "Ƞ" => "N",
201: "Ò" => "O",
202: "Ó" => "O",
203: "Ô" => "O",
204: "Õ" => "O",
205: "Ō" => "O",
206: "Ŏ" => "O",
207: "Ȍ" => "O",
208: "Ȏ" => "OE",
209: "Ơ" => "O",
210: "Ǫ" => "O",
211: "Ọ" => "O",
212: "Ɵ" => "O",
213: "Ồ" => "O",
214: "Ố" => "O",
215: "Ỗ" => "O",
216: "Ổ" => "O",
217: "Ȱ" => "O",
218: "Ȫ" => "O",
219: "Ȭ" => "O",
220: "Ṍ" => "O",
221: "Ṏ" => "O",
222: "Ṑ" => "O",
223: "Ṓ" => "O",
224: "Ờ" => "O",
225: "Ớ" => "O",
226: "Ỡ" => "O",
227: "Ở" => "O",
228: "Ǭ" => "O",
229: "Ộ" => "O",
230: "Ɔ" => "O",
231: "Ø" => "OE",
232: "Ǿ" => "OE",
233: "Œ" => "OE",
234: "Ṕ" => "P",
235: "Ṗ" => "P",
236: "Ƥ" => "P",
237: "Ŕ" => "R",
238: "Ṙ" => "R",
239: "Ř" => "R",
240: "Ȑ" => "R",
241: "Ȓ" => "R",
242: "Ṛ" => "R",
243: "Ŗ" => "R",
244: "Ṟ" => "R",
245: "Ṝ" => "R",
246: "Ʀ" => "R",
247: "Ś" => "S",
248: "Ŝ" => "S",
249: "Ṡ" => "S",
250: "Š" => "S",
251: "Ṣ" => "S",
252: "Ș" => "S",
253: "Ş" => "S",
254: "Ṥ" => "S",
255: "Ṧ" => "S",
256: "Ṩ" => "S",
257: "Ṫ" => "T",
258: "Ť" => "T",
259: "Ƭ" => "T",
260: "Ʈ" => "T",
261: "Ṭ" => "T",
262: "Ț" => "T",
263: "Ţ" => "T",
264: "Ṱ" => "T",
265: "Ṯ" => "T",
266: "Ŧ" => "T",
267: "Ù" => "U",
268: "Ú" => "U",
269: "Û" => "U",
270: "Ũ" => "U",
271: "Ū" => "U",
272: "Ŭ" => "U",
273: "Ủ" => "U",
274: "Ů" => "U",
275: "Ű" => "U",
276: "Ǔ" => "U",
277: "Ȕ" => "U",
278: "Ȗ" => "U",
279: "Ư" => "U",
280: "Ụ" => "U",
281: "Ṳ" => "U",
282: "Ų" => "U",
283: "Ṷ" => "U",
284: "Ṵ" => "U",
285: "Ṹ" => "U",
286: "Ṻ" => "U",
287: "Ǜ" => "U",
288: "Ǘ" => "U",
289: "Ǖ" => "U",
290: "Ǚ" => "U",
291: "Ừ" => "U",
292: "Ứ" => "U",
293: "Ữ" => "U",
294: "Ử" => "U",
295: "Ự" => "U",
296: "Ü" => "UE",
297: "Ṽ" => "V",
298: "Ṿ" => "V",
299: "Ʋ" => "V",
300: "Ẁ" => "W",
301: "Ẃ" => "W",
302: "Ŵ" => "W",
303: "Ẇ" => "W",
304: "Ẅ" => "W",
305: "Ẉ" => "W",
306: "Ẋ" => "X",
307: "Ẍ" => "X",
308: "Ỳ" => "Y",
309: "Ý" => "Y",
310: "Ŷ" => "Y",
311: "Ỹ" => "Y",
312: "Ȳ" => "Y",
313: "Ẏ" => "Y",
314: "Ÿ" => "Y",
315: "Ỷ" => "Y",
316: "Ƴ" => "Y",
317: "Ỵ" => "Y",
318: "Ź" => "Z",
319: "Ẑ" => "Z",
320: "Ż" => "Z",
321: "Ž" => "Z",
322: "Ȥ" => "Z",
323: "Ẓ" => "Z",
324: "Ẕ" => "Z",
325: "Ƶ" => "Z",
326: "à" => "a",
327: "á" => "a",
328: "â" => "a",
329: "ã" => "a",
330: "ā" => "a",
331: "ă" => "a",
332: "ȧ" => "a",
333: "ả" => "a",
334: "å" => "a",
335: "ǎ" => "a",
336: "ȁ" => "a",
337: "ȃ" => "a",
338: "ạ" => "a",
339: "ḁ" => "a",
340: "ẚ" => "a",
341: "ầ" => "a",
342: "ấ" => "a",
343: "ẫ" => "a",
344: "ẩ" => "a",
345: "ằ" => "a",
346: "ắ" => "a",
347: "ẵ" => "a",
348: "ẳ" => "a",
349: "ǡ" => "a",
350: "ǟ" => "a",
351: "ǻ" => "a",
352: "ậ" => "a",
353: "ặ" => "a",
354: "ǽ" => "ae",
355: "ä" => "ae",
356: "ḃ" => "b",
357: "ɓ" => "b",
358: "ḅ" => "b",
359: "ḇ" => "b",
360: "ƀ" => "b",
361: "ƃ" => "b",
362: "ƅ" => "b",
363: "c" => "c",
364: "ć" => "c",
365: "ĉ" => "c",
366: "ċ" => "c",
367: "č" => "c",
368: "ƈ" => "c",
369: "ç" => "c",
370: "ḉ" => "c",
371: "ḍ" => "d",
372: "ḏ" => "d",
373: "ḑ" => "d",
374: "ḓ" => "d",
375: "ď" => "d",
376: "đ" => "d",
377: "ƌ" => "d",
378: "ȡ" => "d",
379: "è" => "e",
380: "é" => "e",
381: "ê" => "e",
382: "ẽ" => "e",
383: "ē" => "e",
384: "ĕ" => "e",
385: "ė" => "e",
386: "ë" => "e",
387: "ě" => "e",
388: "ȅ" => "e",
389: "ȇ" => "e",
390: "ẹ" => "e",
391: "ȩ" => "e",
392: "ę" => "e",
393: "ḙ" => "e",
394: "ề" => "e",
395: "ế" => "e",
396: "ễ" => "e",
397: "ể" => "e",
398: "ḕ" => "e",
399: "ḗ" => "e",
400: "ệ" => "e",
401: "ḝ" => "e",
402: "ǝ" => "e",
403: "ɛ" => "e",
404: "ḟ" => "f",
405: "ƒ" => "f",
406: "ǵ" => "g",
407: "ĝ" => "g",
408: "ḡ" => "g",
409: "ğ" => "g",
410: "ġ" => "g",
411: "ǧ" => "g",
412: "ɠ" => "g",
413: "ģ" => "g",
414: "ǥ" => "g",
415: "ĥ" => "h",
416: "ḣ" => "h",
417: "ḧ" => "h",
418: "ȟ" => "h",
419: "ƕ" => "h",
420: "ḥ" => "h",
421: "ḩ" => "h",
422: "ḫ" => "h",
423: "ẖ" => "h",
424: "ħ" => "h",
425: "ì" => "i",
426: "í" => "i",
427: "î" => "i",
428: "ĩ" => "i",
429: "ī" => "i",
430: "ĭ" => "i",
431: "ı" => "i",
432: "ï" => "i",
433: "ỉ" => "i",
434: "ǐ" => "i",
435: "ị" => "i",
436: "į" => "i",
437: "ȉ" => "i",
438: "ȋ" => "i",
439: "ḭ" => "i",
440: "ɨ" => "i",
441: "ḯ" => "i",
442: "ĵ" => "j",
443: "ǰ" => "j",
444: "ḱ" => "k",
445: "ǩ" => "k",
446: "ḵ" => "k",
447: "ƙ" => "k",
448: "ḳ" => "k",
449: "ķ" => "k",
450: "ĺ" => "l",
451: "ḻ" => "l",
452: "ḷ" => "l",
453: "ļ" => "l",
454: "ḽ" => "l",
455: "ľ" => "l",
456: "ŀ" => "l",
457: "ł" => "l",
458: "ƚ" => "l",
459: "ḹ" => "l",
460: "ȴ" => "l",
461: "ḿ" => "m",
462: "ṁ" => "m",
463: "ṃ" => "m",
464: "ɯ" => "m",
465: "ǹ" => "n",
466: "ń" => "n",
467: "ñ" => "n",
468: "ṅ" => "n",
469: "ň" => "n",
470: "ŋ" => "n",
471: "ɲ" => "n",
472: "ṇ" => "n",
473: "ņ" => "n",
474: "ṋ" => "n",
475: "ṉ" => "n",
476: "ʼn" => "n",
477: "ƞ" => "n",
478: "ȵ" => "n",
479: "ò" => "o",
480: "ó" => "o",
481: "ô" => "o",
482: "õ" => "o",
483: "ō" => "o",
484: "ŏ" => "o",
485: "ȯ" => "o",
486: "ỏ" => "o",
487: "ő" => "o",
488: "ǒ" => "o",
489: "ȍ" => "o",
490: "ȏ" => "o",
491: "ơ" => "o",
492: "ǫ" => "o",
493: "ọ" => "o",
494: "ɵ" => "o",
495: "ồ" => "o",
496: "ố" => "o",
497: "ỗ" => "o",
498: "ổ" => "o",
499: "ȱ" => "o",
500: "ȫ" => "o",
501: "ȭ" => "o",
502: "ṍ" => "o",
503: "ṏ" => "o",
504: "ṑ" => "o",
505: "ṓ" => "o",
506: "ờ" => "o",
507: "ớ" => "o",
508: "ỡ" => "o",
509: "ở" => "o",
510: "ợ" => "o",
511: "ǭ" => "o",
512: "ộ" => "o",
513: "ǿ" => "o",
514: "ɔ" => "o",
515: "ø" => "oe",
516: "œ" => "oe",
517: "ṕ" => "p",
518: "ṗ" => "p",
519: "ƥ" => "p",
520: "ŕ" => "p",
521: "ṙ" => "p",
522: "ř" => "p",
523: "ȑ" => "p",
524: "ȓ" => "p",
525: "ṛ" => "p",
526: "ŗ" => "p",
527: "ṟ" => "p",
528: "ṝ" => "p",
529: "ś" => "s",
530: "ŝ" => "s",
531: "ṡ" => "s",
532: "š" => "s",
533: "ṣ" => "s",
534: "ș" => "s",
535: "ş" => "s",
536: "ṥ" => "s",
537: "ṧ" => "s",
538: "ṩ" => "s",
539: "ß" => "ss",
540: "ẛ" => "t",
541: "ṫ" => "t",
542: "ẗ" => "t",
543: "ť" => "t",
544: "ƭ" => "t",
545: "ʈ" => "t",
546: "ƫ" => "t",
547: "ṭ" => "t",
548: "ț" => "t",
549: "ţ" => "t",
550: "ṱ" => "t",
551: "ṯ" => "t",
552: "ŧ" => "t",
553: "ȶ" => "t",
554: "ù" => "u",
555: "ú" => "u",
556: "û" => "u",
557: "ũ" => "u",
558: "ū" => "u",
559: "ŭ" => "u",
560: "ủ" => "u",
561: "ů" => "u",
562: "ű" => "u",
563: "ǔ" => "u",
564: "ȕ" => "u",
565: "ȗ" => "u",
566: "ư" => "u",
567: "ụ" => "u",
568: "ṳ" => "u",
569: "ų" => "u",
570: "ṷ" => "u",
571: "ṵ" => "u",
572: "ṹ" => "u",
573: "ṻ" => "u",
574: "ǖ" => "u",
575: "ǜ" => "u",
576: "ǘ" => "u",
577: "ǖ" => "u",
578: "ǚ" => "u",
579: "ừ" => "u",
580: "ứ" => "u",
581: "ữ" => "u",
582: "ử" => "u",
583: "ự" => "u",
584: "ṿ" => "u",
585: "ü" => "ue",
586: "ṽ" => "v",
587: "ẁ" => "w",
588: "ẃ" => "w",
589: "ŵ" => "w",
590: "ẇ" => "w",
591: "ẅ" => "w",
592: "ẘ" => "w",
593: "ẉ" => "w",
594: "ẋ" => "x",
595: "ẍ" => "x",
596: "ỳ" => "y",
597: "ý" => "y",
598: "ŷ" => "y",
599: "ỹ" => "y",
600: "ȳ" => "y",
601: "ẏ" => "y",
602: "ÿ" => "y",
603: "ỷ" => "y",
604: "ẙ" => "y",
605: "ƴ" => "y",
606: "ỵ" => "y",
607: "ź" => "z",
608: "ẑ" => "z",
609: "ż" => "z",
610: "ž" => "z",
611: "ȥ" => "z",
612: "ẓ" => "z",
613: "ẕ" => "z",
614: "ƶ" => "z",
615: "¨" => "",
616: "'" => "-",
617: "’" => "-",
618: "΅" => "",
619: "΄" => "",
620: "ͺ" => "",
621: "–" => "-",
622: "᾿" => "",
623: "῾" => "",
624: "῍" => "",
625: "῝" => "",
626: "῎" => "",
627: "῞" => "",
628: "῏" => "",
629: "῟" => "",
630: "῀" => "",
631: "῁" => "",
632: "΅" => "",
633: "`" => "",
634: "῭" => "",
635: "᾽" => "",
636: "ἀ" => "a",
637: "ἁ" => "a",
638: "ἂ" => "a",
639: "ἃ" => "a",
640: "ἄ" => "a",
641: "ἅ" => "a",
642: "ἆ" => "a",
643: "ἇ" => "a",
644: "ᾀ" => "a",
645: "ᾁ" => "a",
646: "ᾂ" => "a",
647: "ᾃ" => "a",
648: "ᾄ" => "a",
649: "ᾅ" => "a",
650: "ᾆ" => "a",
651: "ᾇ" => "a",
652: "ὰ" => "a",
653: "ά" => "a",
654: "ᾰ" => "a",
655: "ᾱ" => "a",
656: "ᾲ" => "a",
657: "ᾳ" => "a",
658: "ᾴ" => "a",
659: "ᾶ" => "a",
660: "ᾷ" => "a",
661: "ა" => "a",
662: "Ἀ" => "A",
663: "Ἁ" => "A",
664: "Ἂ" => "A",
665: "Ἃ" => "A",
666: "Ἄ" => "A",
667: "Ἅ" => "A",
668: "Ἆ" => "A",
669: "Ἇ" => "A",
670: "ᾈ" => "A",
671: "ᾉ" => "A",
672: "ᾊ" => "A",
673: "ᾋ" => "A",
674: "ᾌ" => "A",
675: "ᾍ" => "A",
676: "ᾎ" => "A",
677: "ᾏ" => "A",
678: "Ᾰ" => "A",
679: "Ᾱ" => "A",
680: "Ὰ" => "A",
681: "Ά" => "A",
682: "ᾼ" => "A",
683: "ą" => "a",
684: "æ" => "ae",
685: "ბ" => "b",
686: "ჩ" => "ch",
687: "ჭ" => "ch",
688: "დ" => "d",
689: "ð" => "d",
690: "Ð" => "D",
691: "ძ" => "dz",
692: "ἐ" => "e",
693: "ἑ" => "e",
694: "ἒ" => "e",
695: "ἓ" => "e",
696: "ἔ" => "e",
697: "ἕ" => "e",
698: "ὲ" => "e",
699: "έ" => "e",
700: "ე" => "e",
701: "Ἐ" => "E",
702: "Ἑ" => "E",
703: "Ἒ" => "E",
704: "Ἓ" => "E",
705: "Ἔ" => "E",
706: "Ἕ" => "E",
707: "Έ" => "E",
708: "Ὲ" => "E",
709: "გ" => "g",
710: "ღ" => "gh",
711: "ჰ" => "h",
712: "Ħ" => "H",
713: "ἠ" => "i",
714: "ἡ" => "i",
715: "ἢ" => "i",
716: "ἣ" => "i",
717: "ἤ" => "i",
718: "ἥ" => "i",
719: "ἦ" => "i",
720: "ἧ" => "i",
721: "ᾐ" => "i",
722: "ᾑ" => "i",
723: "ᾒ" => "i",
724: "ᾓ" => "i",
725: "ᾔ" => "i",
726: "ᾕ" => "i",
727: "ᾖ" => "i",
728: "ᾗ" => "i",
729: "ὴ" => "i",
730: "ή" => "i",
731: "ῂ" => "i",
732: "ῃ" => "i",
733: "ῄ" => "i",
734: "ῆ" => "i",
735: "ῇ" => "i",
736: "ἰ" => "i",
737: "ἱ" => "i",
738: "ἲ" => "i",
739: "ἳ" => "i",
740: "ἴ" => "i",
741: "ἵ" => "i",
742: "ἶ" => "i",
743: "ἷ" => "i",
744: "ὶ" => "i",
745: "ί" => "i",
746: "ῐ" => "i",
747: "ῑ" => "i",
748: "ῒ" => "i",
749: "ΐ" => "i",
750: "ῖ" => "i",
751: "ῗ" => "i",
752: "ი" => "i",
753: "Ἠ" => "I",
754: "Ἡ" => "I",
755: "Ἢ" => "I",
756: "Ἣ" => "I",
757: "Ἤ" => "I",
758: "Ἥ" => "I",
759: "Ἦ" => "I",
760: "Ἧ" => "I",
761: "ᾘ" => "I",
762: "ᾙ" => "I",
763: "ᾚ" => "I",
764: "ᾛ" => "I",
765: "ᾜ" => "I",
766: "ᾝ" => "I",
767: "ᾞ" => "I",
768: "ᾟ" => "I",
769: "Ὴ" => "I",
770: "Ή" => "I",
771: "ῌ" => "I",
772: "Ἰ" => "I",
773: "Ἱ" => "I",
774: "Ἲ" => "I",
775: "Ἳ" => "I",
776: "Ἴ" => "I",
777: "Ἵ" => "I",
778: "Ἶ" => "I",
779: "Ἷ" => "I",
780: "Ῐ" => "I",
781: "Ῑ" => "I",
782: "Ὶ" => "I",
783: "Ί" => "I",
784: "ij" => "ij",
785: "IJ" => "IJ",
786: "ჯ" => "j",
787: "კ" => "k",
788: "ქ" => "k",
789: "ხ" => "kh",
790: "ĸ" => "k",
791: "ლ" => "l",
792: "Ĺ" => "K",
793: "Ľ" => "K",
794: "Ŀ" => "K",
795: "Ļ" => "K",
796: "მ" => "m",
797: "ნ" => "n",
798: "ὀ" => "o",
799: "ὁ" => "o",
800: "ὂ" => "o",
801: "ὃ" => "o",
802: "ὄ" => "o",
803: "ὅ" => "o",
804: "ὸ" => "o",
805: "ό" => "o",
806: "ὠ" => "o",
807: "ὡ" => "o",
808: "ὢ" => "o",
809: "ὣ" => "o",
810: "ὤ" => "o",
811: "ὥ" => "o",
812: "ὦ" => "o",
813: "ὧ" => "o",
814: "ᾠ" => "o",
815: "ᾡ" => "o",
816: "ᾢ" => "o",
817: "ᾣ" => "o",
818: "ᾤ" => "o",
819: "ᾥ" => "o",
820: "ᾦ" => "o",
821: "ᾧ" => "o",
822: "ὼ" => "o",
823: "ώ" => "o",
824: "ῲ" => "o",
825: "ῳ" => "o",
826: "ῴ" => "o",
827: "ῶ" => "o",
828: "ῷ" => "o",
829: "ო" => "o",
830: "Ὀ" => "O",
831: "Ὁ" => "O",
832: "Ὂ" => "O",
833: "Ὃ" => "O",
834: "Ὄ" => "O",
835: "Ὅ" => "O",
836: "Ὸ" => "O",
837: "Ό" => "O",
838: "Ὠ" => "O",
839: "Ὡ" => "O",
840: "Ὢ" => "O",
841: "Ὣ" => "O",
842: "Ὤ" => "O",
843: "Ὥ" => "O",
844: "Ὦ" => "O",
845: "Ὧ" => "O",
846: "ᾨ" => "O",
847: "ᾩ" => "O",
848: "ᾪ" => "O",
849: "ᾫ" => "O",
850: "ᾬ" => "O",
851: "ᾭ" => "O",
852: "ᾮ" => "O",
853: "ᾯ" => "O",
854: "Ὼ" => "O",
855: "Ώ" => "O",
856: "ῼ" => "O",
857: "Ő" => "O",
858: "ø" => "o",
859: "Ø" => "O",
860: "ö" => "oe",
861: "Ö" => "Oe",
862: "პ" => "p",
863: "ფ" => "p",
864: "ყ" => "q",
865: "ῤ" => "r",
866: "ῥ" => "r",
867: "რ" => "r",
868: "Ῥ" => "R",
869: "ŕ" => "r",
870: "ř" => "r",
871: "ŗ" => "r",
872: "ს" => "s",
873: "შ" => "sh",
874: "ſ" => "ss",
875: "თ" => "t",
876: "ტ" => "t",
877: "ც" => "ts",
878: "წ" => "ts",
879: "უ" => "u",
880: "ü" => "u",
881: "ü" => "u",
882: "Ü" => "Ue",
883: "ვ" => "v",
884: "ὐ" => "y",
885: "ὑ" => "y",
886: "ὒ" => "y",
887: "ὓ" => "y",
888: "ὔ" => "y",
889: "ὕ" => "y",
890: "ὖ" => "y",
891: "ὗ" => "y",
892: "ὺ" => "y",
893: "ύ" => "y",
894: "ῠ" => "y",
895: "ῡ" => "y",
896: "ῢ" => "y",
897: "ΰ" => "y",
898: "ῦ" => "y",
899: "ῧ" => "y",
900: "Ὑ" => "Y",
901: "Ὓ" => "Y",
902: "Ὕ" => "Y",
903: "Ὗ" => "Y",
904: "Ῠ" => "Y",
905: "Ῡ" => "Y",
906: "Ὺ" => "Y",
907: "Ύ" => "Y",
908: "ზ" => "z",
909: "ჟ" => "zh",
910: "Þ" => "TH",
911: "Α" => "A",
912: "α" => "a",
913: "Ά" => "A",
914: "ά" => "a",
915: "Β" => "B",
916: "β" => "b",
917: "Γ" => "G",
918: "γ" => "g",
919: "Δ" => "D",
920: "δ" => "d",
921: "Ε" => "E",
922: "ε" => "e",
923: "Έ" => "E",
924: "έ" => "e",
925: "Ζ" => "Z",
926: "ζ" => "z",
927: "Η" => "I",
928: "η" => "i",
929: "Ή" => "I",
930: "ή" => "i",
931: "Θ" => "TH",
932: "θ" => "th",
933: "Ι" => "I",
934: "ι" => "i",
935: "Ί" => "I",
936: "ί" => "i",
937: "Ϊ" => "I",
938: "ϊ" => "i",
939: "ΐ" => "i",
940: "Κ" => "K",
941: "κ" => "k",
942: "Λ" => "L",
943: "λ" => "l",
944: "Μ" => "M",
945: "μ" => "m",
946: "Ν" => "N",
947: "ν" => "n",
948: "Ξ" => "KS",
949: "ξ" => "ks",
950: "Ο" => "O",
951: "ο" => "o",
952: "Ό" => "O",
953: "ό" => "o",
954: "Π" => "P",
955: "π" => "p",
956: "ρ" => "r",
957: "Ρ" => "R",
958: "Σ" => "S",
959: "σ" => "s",
960: "ς" => "s",
961: "Τ" => "T",
962: "τ" => "t",
963: "Υ" => "Y",
964: "υ" => "y",
965: "Ύ" => "Y",
966: "ύ" => "y",
967: "Ϋ" => "Y",
968: "ϋ" => "y",
969: "ΰ" => "y",
970: "Φ" => "F",
971: "φ" => "f",
972: "Χ" => "X",
973: "χ" => "x",
974: "Ψ" => "PS",
975: "ψ" => "ps",
976: "Ω" => "O",
977: "ω" => "o",
978: "Ώ" => "O",
979: "ώ" => "o",
980: "а" => "A",
981: "А" => "A",
982: "б" => "B",
983: "Б" => "B",
984: "в" => "V",
985: "В" => "V",
986: "г" => "G",
987: "Г" => "G",
988: "д" => "D",
989: "Д" => "D",
990: "е" => "E",
991: "Е" => "E",
992: "ё" => "E",
993: "Ё" => "E",
994: "ж" => "ZH",
995: "Ж" => "ZH",
996: "з" => "Z",
997: "З" => "Z",
998: "и" => "I",
999: "И" => "I",
1000: "й" => "I",
1001: "Й" => "I",
1002: "к" => "K",
1003: "К" => "K",
1004: "л" => "L",
1005: "Л" => "L",
1006: "м" => "M",
1007: "М" => "M",
1008: "н" => "N",
1009: "Н" => "N",
1010: "о" => "O",
1011: "О" => "O",
1012: "п" => "P",
1013: "П" => "P",
1014: "р" => "R",
1015: "Р" => "R",
1016: "с" => "S",
1017: "С" => "S",
1018: "т" => "T",
1019: "Т" => "T",
1020: "у" => "U",
1021: "У" => "U",
1022: "ф" => "F",
1023: "Ф" => "F",
1024: "х" => "KH",
1025: "Х" => "KH",
1026: "ц" => "TS",
1027: "Ц" => "TS",
1028: "ч" => "CH",
1029: "Ч" => "CH",
1030: "ш" => "SH",
1031: "Ш" => "SH",
1032: "щ" => "SHCH",
1033: "Щ" => "SHCH",
1034: "ъ" => "",
1035: "Ъ" => "",
1036: "ы" => "Y",
1037: "Ы" => "Y",
1038: "ь" => "",
1039: "Ь" => "",
1040: "э" => "E",
1041: "Э" => "E",
1042: "ю" => "YU",
1043: "Ю" => "YU",
1044: "я" => "YA",
1045: "Я" => "YA",
1046: "א" => "A",
1047: "ב" => "B",
1048: "ג" => "G",
1049: "ד" => "D",
1050: "ה" => "Ha",
1051: "ו" => "V",
1052: "ז" => "Z",
1053: "ח" => "H",
1054: "ט" => "T",
1055: "י" => "I",
1056: "כ" => "K",
1057: "ך" => "H",
1058: "ל" => "L",
1059: "מ" => "M",
1060: "ם" => "M",
1061: "נ" => "N",
1062: "ן" => "N",
1063: "ס" => "S",
1064: "פ" => "P",
1065: "ף" => "F",
1066: "ק" => "K",
1067: "ר" => "R",
1068: "ש" => "SH",
1069: "ע" => "O",
1070: "צ" => "TZ",
1071: "ץ" => "TZ"
1072: );
1073:
1074: /**
1075: * translates characters with diacritical marks to simple ones
1076: *
1077: * @param string $string
1078: * @return string
1079: */
1080: static function filter($string) {
1081: // strip/convert a few specific characters
1082: $string = strtr($string, zenphoto_seo::$specialchars);
1083: if (getOption('zenphoto_seo_lowercase'))
1084: $string = strtolower($string);
1085: $string = preg_replace("/\s+/", "-", $string);
1086: $string = preg_replace("/[^a-zA-Z0-9_.-]/", "-", $string);
1087: $string = str_replace(array('---', '--'), '-', $string);
1088: return $string;
1089: }
1090:
1091: static function js($string) {
1092: $xlate = array();
1093: foreach (zenphoto_seo::$specialchars as $from => $to) {
1094: if (array_key_exists($to, $xlate)) {
1095: $xlate[$to] .= $from;
1096: } else {
1097: $xlate[$to] = $from;
1098: }
1099: }
1100: $js = '
1101: function seoFriendlyJS(fname) {
1102: fname=fname.trim();
1103: fname=fname.replace(/\s+\.\s*/,".");
1104: ';
1105:
1106: foreach ($xlate as $to => $from) {
1107: $js .= " fname = fname.replace(/[" . $from . "]/g, '" . $to . "');\n";
1108: }
1109:
1110: if (getOption('zenphoto_seo_lowercase')) {
1111: $js .= " fname = fname.toLowerCase();\n";
1112: }
1113: $js .= "
1114: fname = fname.replace(/\s+/g, '-');
1115: fname = fname.replace(/[^a-zA-Z0-9_.-]/g, '-');
1116: fname = fname.replace(/--*/g, '-');
1117: return fname;
1118: }\n";
1119: return $js;
1120: }
1121:
1122: }
1123:
1124: ?>