Revision 868
Added by thorn about 16 years ago
functions.php | ||
---|---|---|
349 | 349 |
return($string); |
350 | 350 |
} |
351 | 351 |
|
352 |
// init utf8-functions -- workaround to prevent functions-utf8.php and charsets_table.php (~140kB) to be loaded more than once |
|
353 |
// functions and arrays from functions-utf8.php and charsets_table.php will be in global name-space |
|
354 |
function init_utf8funcs() { |
|
355 |
static $utf8_ok=0; |
|
356 |
if($utf8_ok == 0) { |
|
357 |
++$utf8_ok; |
|
358 |
require_once(WB_PATH.'/framework/functions-utf8.php'); |
|
359 |
} |
|
360 |
} |
|
361 |
|
|
362 | 352 |
// Convert a string from mixed html-entities/umlauts to pure $charset_out-umlauts |
363 | 353 |
// Will replace all numeric and named entities except > < ' " ' |
364 | 354 |
// In case of error the returned string is unchanged, and a message is emitted. |
365 | 355 |
function entities_to_umlauts($string, $charset_out=DEFAULT_CHARSET) { |
366 |
//init utf8-functions |
|
367 |
init_utf8funcs(); |
|
356 |
require_once(WB_PATH.'/framework/functions-utf8.php'); |
|
368 | 357 |
return entities_to_umlauts2($string, $charset_out); |
369 | 358 |
} |
370 | 359 |
|
371 | 360 |
// Will convert a string in $charset_in encoding to a pure ASCII string with HTML-entities. |
372 | 361 |
// In case of error the returned string is unchanged, and a message is emitted. |
373 | 362 |
function umlauts_to_entities($string, $charset_in=DEFAULT_CHARSET) { |
374 |
//init utf8-functions |
|
375 |
init_utf8funcs(); |
|
363 |
require_once(WB_PATH.'/framework/functions-utf8.php'); |
|
376 | 364 |
return umlauts_to_entities2($string, $charset_in); |
377 | 365 |
} |
378 | 366 |
|
379 | 367 |
// Function to convert a page title to a page filename |
380 | 368 |
function page_filename($string) { |
381 |
//init utf8-functions |
|
382 |
init_utf8funcs(); |
|
369 |
require_once(WB_PATH.'/framework/functions-utf8.php'); |
|
383 | 370 |
$string = entities_to_7bit($string); |
384 | 371 |
// Now remove all bad characters |
385 | 372 |
$bad = array( |
... | ... | |
406 | 393 |
|
407 | 394 |
// Function to convert a desired media filename to a clean filename |
408 | 395 |
function media_filename($string) { |
409 |
//init utf8-functions |
|
410 |
init_utf8funcs(); |
|
396 |
require_once(WB_PATH.'/framework/functions-utf8.php'); |
|
411 | 397 |
$string = entities_to_7bit($string); |
412 | 398 |
// Now remove all bad characters |
413 | 399 |
$bad = array( |
Also available in: Unified diff
removed useless init_utf8funcs()-function