Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezcodepage.php
Go to the documentation of this file.
1 <?php
18 class eZCodePage
19 {
20 public $ReadExtraMap;
21 const CACHE_CODE_DATE = 1028204478;
22
29 public function __construct( $charset_code, $use_cache = true )
30 {
31 $this->RequestedCharsetCode = $charset_code;
32 $this->CharsetCode = eZCharsetInfo::realCharsetCode( $charset_code );
33 $this->CharsetEncodingScheme = eZCharsetInfo::characterEncodingScheme( $charset_code );
34 $this->Valid = false;
35 $this->SubstituteChar = 63; // the ? character
36 $this->MinCharValue = 0;
37 $this->MaxCharValue = 0;
38
39 $this->load( $use_cache );
40 }
41
42 function convertString( $str )
43 {
44 $len = strlen( $str );
45 $chars = '';
46 $utf8_codec = eZUTF8Codec::instance();
47 for ( $i = 0; $i < $len; )
48 {
49 $charLen = 1;
50 $char = $this->charToUTF8( $str, $i, $charLen );
51 if ( $char !== null )
52 $chars .= $char;
53 else
54 $chars .= $utf8_codec->toUtf8( $this->SubstituteChar );
55 $i += $charLen;
56 }
57 return $chars;
58 }
59
60 function convertStringToUnicode( $str )
61 {
62 $len = strlen( $str );
63 $unicodeValues = array();
64 for ( $i = 0; $i < $len; )
65 {
66 $charLen = 1;
67 $unicodeValue = $this->charToUnicode( $str, $i, $charLen );
68 if ( $unicodeValue !== null )
69 $unicodeValues[] = $unicodeValue;
70 $i += $charLen;
71 }
72 return $unicodeValues;
73 }
74
75 function convertUnicodeToString( $unicodeValues )
76 {
77 if ( !is_array( $unicodeValues ) )
78 return false;
79 $text = '';
80 foreach ( $unicodeValues as $unicodeValue )
81 {
82 $char = $this->unicodeToChar( $unicodeValue );
83 $text .= $char;
84 }
85 return $text;
86 }
87
88 function convertStringFromUTF8( $multi_char )
89 {
90 $strlen = strlen( $multi_char );
91 $text = '';
92 $codeMap = $this->CodeMap;
93 $subChar = $this->SubstituteChar;
94 for ( $offs = 0; $offs < $strlen; )
95 {
96 // The following code has been copied from lib/ezi18n/classes/ezutf8codec.php
97 // It has been optimized a bit from the original code due to inlining
98
99 $char_code = false;
100 if ( ( ord( $multi_char[$offs + 0] ) & 0x80 ) == 0x00 ) // 7 bit, 1 char
101 {
102 $char_code = ord( $multi_char[$offs + 0] );
103 $offs += 1;
104 }
105 else if ( ( ord( $multi_char[$offs + 0] ) & 0xe0 ) == 0xc0 ) // 11 bit, 2 chars
106 {
107 if ( ( ord( $multi_char[$offs + 1] ) & 0xc0 ) != 0x80 )
108 {
109 $offs += 2;
110 continue;
111 }
112 $char_code = ( (( ord( $multi_char[$offs + 0] ) & 0x1f ) << 6) +
113 (( ord( $multi_char[$offs + 1] ) & 0x3f )) );
114 $offs += 2;
115 if ( $char_code < 128 ) // Illegal multibyte, should use less than 2 chars
116 continue;
117 }
118 else if ( ( ord( $multi_char[$offs + 0] ) & 0xf0 ) == 0xe0 ) // 16 bit, 3 chars
119 {
120 if ( ( ord( $multi_char[$offs + 1] ) & 0xc0 ) != 0x80 or
121 ( ord( $multi_char[$offs + 2] ) & 0xc0 ) != 0x80 )
122 {
123 $offs += 3;
124 continue;
125 }
126 $char_code = ( (( ord( $multi_char[$offs + 0] ) & 0x0f ) << 12) +
127 (( ord( $multi_char[$offs + 1] ) & 0x3f ) << 6) +
128 (( ord( $multi_char[$offs + 2] ) & 0x3f )) );
129 $offs += 3;
130 if ( $char_code < 2048 ) // Illegal multibyte, should use less than 3 chars
131 continue;
132 }
133 else if ( ( ord( $multi_char[$offs + 0] ) & 0xf8 ) == 0xf0 ) // 21 bit, 4 chars
134 {
135 if ( ( ord( $multi_char[$offs + 1] ) & 0xc0 ) != 0x80 or
136 ( ord( $multi_char[$offs + 2] ) & 0xc0 ) != 0x80 or
137 ( ord( $multi_char[$offs + 3] ) & 0xc0 ) != 0x80 )
138 {
139 $offs += 4;
140 continue;
141 }
142 $char_code = ( (( ord( $multi_char[$offs + 0] ) & 0x07 ) << 18) +
143 (( ord( $multi_char[$offs + 1] ) & 0x3f ) << 12) +
144 (( ord( $multi_char[$offs + 2] ) & 0x3f ) << 6) +
145 (( ord( $multi_char[$offs + 3] ) & 0x3f )) );
146 $offs += 4;
147 if ( $char_code < 65536 ) // Illegal multibyte, should use less than 4 chars
148 continue;
149 }
150 else if ( ( ord( $multi_char[$offs + 0] ) & 0xfc ) == 0xf8 ) // 26 bit, 5 chars
151 {
152 if ( ( ord( $multi_char[$offs + 1] ) & 0xc0 ) != 0x80 or
153 ( ord( $multi_char[$offs + 2] ) & 0xc0 ) != 0x80 or
154 ( ord( $multi_char[$offs + 3] ) & 0xc0 ) != 0x80 or
155 ( ord( $multi_char[$offs + 4] ) & 0xc0 ) != 0x80 )
156 {
157 $offs += 5;
158 continue;
159 }
160 $char_code = ( (( ord( $multi_char[$offs + 0] ) & 0x03 ) << 24) +
161 (( ord( $multi_char[$offs + 1] ) & 0x3f ) << 18) +
162 (( ord( $multi_char[$offs + 2] ) & 0x3f ) << 12) +
163 (( ord( $multi_char[$offs + 3] ) & 0x3f ) << 6) +
164 (( ord( $multi_char[$offs + 4] ) & 0x3f )) );
165 $offs += 5;
166 if ( $char_code < 2097152 ) // Illegal multibyte, should use less than 5 chars
167 continue;
168 }
169 else if ( ( ord( $multi_char[$offs + 0] ) & 0xfe ) == 0xfc ) // 31 bit, 6 chars
170 {
171 if ( ( ord( $multi_char[$offs + 1] ) & 0xc0 ) != 0x80 or
172 ( ord( $multi_char[$offs + 2] ) & 0xc0 ) != 0x80 or
173 ( ord( $multi_char[$offs + 3] ) & 0xc0 ) != 0x80 or
174 ( ord( $multi_char[$offs + 4] ) & 0xc0 ) != 0x80 or
175 ( ord( $multi_char[$offs + 5] ) & 0xc0 ) != 0x80 )
176 {
177 $offs += 6;
178 continue;
179 }
180 $char_code = ( (( ord( $multi_char[$offs + 0] ) & 0x01 ) << 30) +
181 (( ord( $multi_char[$offs + 1] ) & 0x3f ) << 24) +
182 (( ord( $multi_char[$offs + 2] ) & 0x3f ) << 18) +
183 (( ord( $multi_char[$offs + 3] ) & 0x3f ) << 12) +
184 (( ord( $multi_char[$offs + 4] ) & 0x3f ) << 6) +
185 (( ord( $multi_char[$offs + 5] ) & 0x3f )) );
186 $offs += 6;
187 if ( $char_code < 67108864 ) // Illegal multibyte, should use less than 6 chars
188 continue;
189 }
190 else // Unknown state, just increase one to make sure we don't get stuck
191 {
192 $offs += 1;
193 continue;
194 }
195
196 // The following code has been copied from the member function unicodeToChar
197 if ( isset( $codeMap[$char_code] ) )
198 {
199 $code = $codeMap[$char_code];
200 if ( $code <= 0xff )
201 $text .= chr( $code );
202 else
203 $text .= chr( ( $code >> 8 ) & 0xff ) . chr( $code & 0xff );
204 }
205 else
206 $text .= chr( $subChar );
207 }
208 return $text;
209 }
210
211 function strlen( $str )
212 {
213 if ( $this->CharsetEncodingScheme == "doublebyte" )
214 {
215 $len = strlen( $str );
216 $strlen = 0;
217 for ( $i = 0; $i < $len; )
218 {
219 $charLen = 1;
220 $code = ord( $str[$i] );
221 if ( isset( $this->ReadExtraMap[$code] ) )
222 $charLen = 2;
223 ++$strlen;
224 $i += $charLen;
225 }
226 return $strlen;
227 }
228 else
229 return strlen( $str );
230 }
231
232 function strlenFromUTF8( $str )
233 {
234 return eZUTF8Codec::instance()->strlen( $str );
235 }
236
237 function charToUtf8( $str, $pos, &$charLen )
238 {
239 $code = ord( $str[$pos] );
240 $charLen = 1;
241 if ( isset( $this->ReadExtraMap[$code] ) )
242 {
243 $code = ( $code << 8 ) | ord( $str[$pos+1] );
244 $charLen = 2;
245 }
246 if ( isset( $this->UTF8Map[$code] ) )
247 return $this->UTF8Map[$code];
248 return null;
249 }
250
251 function charToUnicode( $str, $pos, &$charLen )
252 {
253 $code = ord( $str[$pos] );
254 $charLen = 1;
255 if ( isset( $this->ReadExtraMap[$code] ) )
256 {
257 $code = ( $code << 8 ) | ord( $str[$pos+1] );
258 $charLen = 2;
259 }
260 if ( isset( $this->UnicodeMap[$code] ) )
261 return $this->UnicodeMap[$code];
262 return null;
263 }
264
265 function codeToUtf8( $code )
266 {
267 return $this->UTF8Map[$code];
268 }
269
270 function codeToUnicode( $code )
271 {
272 if ( isset( $this->UnicodeMap[$code] ) )
273 {
274 return $this->UnicodeMap[$code];
275 }
276 return null;
277 }
278
279 function utf8ToChar( $ucode )
280 {
281 if ( isset( $this->UTF8CodeMap[$ucode] ) )
282 {
283 $code = $this->UTF8CodeMap[$ucode];
284 if ( $code <= 0xff )
285 return chr( $code );
286 else
287 return chr( ( $code >> 8 ) & 0xff ) . chr( $code & 0xff );
288 }
289 else
290 return chr( $this->SubstituteChar );
291 }
292
293 function unicodeToChar( $ucode )
294 {
295 if ( isset( $this->CodeMap[$ucode] ) )
296 {
297 $code = $this->CodeMap[$ucode];
298 if ( $code <= 0xff )
299 return chr( $code );
300 else
301 return chr( ( $code >> 8 ) & 0xff ) . chr( $code & 0xff );
302 }
303 else
304 return chr( $this->SubstituteChar );
305 }
306
307 function utf8ToCode( $ucode )
308 {
309 if ( isset( $this->UTF8CodeMap[$ucode] ) )
310 return $this->UTF8CodeMap[$ucode];
311 return null;
312 }
313
314 function unicodeToCode( $ucode )
315 {
316 if ( isset( $this->CodeMap[$ucode] ) )
317 return $this->CodeMap[$ucode];
318 return null;
319 }
320
321 function substituteChar()
322 {
323 return $this->SubstituteChar;
324 }
325
326 function setSubstituteChar( $char )
327 {
328 $this->SubstituteChar = $char;
329 }
330
335 static function exists( $charset_code )
336 {
337 $file = eZCodePage::fileName( $charset_code );
338 return file_exists( $file );
339 }
340
345 static function fileName( $charset_code )
346 {
347 $charset_code = eZCharsetInfo::realCharsetCode( $charset_code );
348 $file = "share/codepages/" . $charset_code;
349 return $file;
350 }
351
352 function cacheFileName( $charset_code )
353 {
354 $permissionArray = eZCodePage::permissionSetting();
355
356 if ( $permissionArray === false )
357 return false;
358 $charset_code = eZCharsetInfo::realCharsetCode( $charset_code );
359 $cache_dir = $permissionArray['var_directory'] . "/codepages/";
360 $cache_filename = md5( $charset_code );
361 $cache = $cache_dir . $cache_filename . ".php";
362 return $cache;
363 }
364
365 function fileModification( $charset_code )
366 {
367 $file = eZCodePage::fileName( $charset_code );
368 if ( !file_exists( $file ) )
369 return false;
370 return filemtime( $file );
371 }
372
373 function codepageList()
374 {
375 $list = array();
376 $dir = "share/codepages/";
377 $dh = opendir( $dir );
378 while ( ( $file = readdir( $dh ) ) !== false )
379 {
380 if ( $file == "." or
381 $file == ".." or
382 preg_match( "/^\./", $file ) or
383 preg_match( "/~$/", $file ) )
384 continue;
385 $list[] = $file;
386 }
387 closedir( $dh );
388 sort( $list );
389 return $list;
390 }
391
392
396 function storeCacheObject( $filename, $permissionArray )
397 {
398 $dir = dirname( $filename );
399 $file = basename( $filename );
400 $php = new eZPHPCreator( $dir, $file );
401
402 $php->addVariable( "umap", array() );
403 $php->addVariable( "utf8map", array() );
404 $php->addVariable( "cmap", array() );
405 $php->addVariable( "utf8cmap", array() );
406
407 reset( $this->UnicodeMap );
408 while ( ( $key = key( $this->UnicodeMap ) ) !== null )
409 {
410 $item = $this->UnicodeMap[$key];
411 $php->addVariable( "umap[$key]", $item );
412 next( $this->UnicodeMap );
413 }
414
415 reset( $this->UTF8Map );
416 while ( ( $key = key( $this->UTF8Map ) ) !== null )
417 {
418 $item = $this->UTF8Map[$key];
419 if ( $item == 0 )
420 {
421 $php->addCodePiece( "\$utf8map[0] = chr(0);\n" );
422 }
423 else
424 {
425 $val = str_replace( array( "\\", "'" ),
426 array( "\\\\", "\\'" ),
427 $item );
428 $php->addVariable( "utf8map[$key]", $val );
429 }
430 next( $this->UTF8Map );
431 }
432
433 reset( $this->CodeMap );
434 while ( ( $key = key( $this->CodeMap ) ) !== null )
435 {
436 $item = $this->CodeMap[$key];
437 $php->addVariable( "cmap[$key]", $item );
438 next( $this->CodeMap );
439 }
440
441 reset( $this->UTF8CodeMap );
442 while ( ( $key = key( $this->UTF8CodeMap ) ) !== null )
443 {
444 $item = $this->UTF8CodeMap[$key];
445 if ( $item == 0 )
446 {
447 $php->addVariable( "utf8cmap[chr(0)]", 0 );
448 }
449 else
450 {
451 $val = str_replace( array( "\\", "'" ),
452 array( "\\\\", "\\'" ),
453 $key );
454 $php->addVariable( "utf8cmap['$val']", $item );
455 }
456 next( $this->UTF8CodeMap );
457 }
458
459 reset( $this->ReadExtraMap );
460 while ( ( $key = key( $this->ReadExtraMap ) ) !== null )
461 {
462 $item = $this->ReadExtraMap[$key];
463 $php->addVariable( "read_extra[$key]", $item );
464 next( $this->ReadExtraMap );
465 }
466
467 $php->addVariable( "eZCodePageCacheCodeDate", self::CACHE_CODE_DATE );
468 $php->addVariable( "min_char", $this->MinCharValue );
469 $php->addVariable( "max_char", $this->MaxCharValue );
470 $php->store( true );
471
472 if ( file_exists( $filename ) )
473 {
474 // Store the old umask and set a new one.
475 $oldPermissionSetting = umask( 0 );
476
477 // Change the permission setting.
478 @chmod( $filename, $permissionArray['file_permission'] );
479
480 // Restore the old umask.
481 umask( $oldPermissionSetting );
482 }
483 }
484
485
486 function cacheFilepath()
487 {
488 $permissionArray = eZCodePage::permissionSetting();
489
490 if ( $permissionArray === false )
491 return false;
492 $cache_dir = $permissionArray['var_directory'] . "/codepages/";
493 $cache_filename = md5( $this->CharsetCode );
494 $cache = $cache_dir . $cache_filename . ".php";
495
496 return $cache;
497 }
498
499
500
506 function load( $use_cache = true )
507 {
508 // temporarely hide the cache display problem
509 // http://ez.no/community/bugs/char_transform_cache_file_is_not_valid_php
510 //$use_cache = false;
511 $file = "share/codepages/" . $this->CharsetCode;
512 // eZDebug::writeDebug( "ezcodepage::load was called for $file..." );
513
514 $permissionArray = self::permissionSetting();
515 if ( $permissionArray !== false )
516 {
517 $cache_dir = $permissionArray['var_directory'] . "/codepages/";
518 $cache_filename = md5( $this->CharsetCode );
519 $cache = $cache_dir . $cache_filename . ".php";
520 }
521 else
522 {
523 $cache = false;
524 }
525
526 if ( !file_exists( $file ) )
527 {
528 eZDebug::writeWarning( "Couldn't load codepage file $file", "eZCodePage" );
529 return;
530 }
531 $file_m = filemtime( $file );
532 $this->Valid = false;
533 if ( isset( $GLOBALS['eZSiteBasics'] ) )
534 {
535 $siteBasics = $GLOBALS['eZSiteBasics'];
536 if ( isset( $siteBasics['no-cache-adviced'] ) and
537 $siteBasics['no-cache-adviced'] )
538 $use_cache = false;
539 }
540 if ( $cache && file_exists( $cache ) and $use_cache )
541 {
542 $cache_m = filemtime( $cache );
543 if ( $file_m <= $cache_m )
544 {
545 unset( $eZCodePageCacheCodeDate );
546 $umap = $utf8map = $cmap = $utf8cmap = $min_char = $max_char = $read_extra = null;
547 include( $cache );
548 $this->UnicodeMap = $umap;
549 $this->UTF8Map = $utf8map;
550 $this->CodeMap = $cmap;
551 $this->UTF8CodeMap = $utf8cmap;
552 $this->MinCharValue = $min_char;
553 $this->MaxCharValue = $max_char;
554 $this->ReadExtraMap = $read_extra;
555
556 if ( isset( $eZCodePageCacheCodeDate ) and
557 $eZCodePageCacheCodeDate == self::CACHE_CODE_DATE )
558 {
559 $this->Valid = true;
560 return;
561 }
562 }
563 }
564
565 $utf8_codec = eZUTF8Codec::instance();
566
567 $this->UnicodeMap = array();
568 $this->UTF8Map = array();
569 $this->CodeMap = array();
570 $this->UTF8CodeMap = array();
571 $this->ReadExtraMap = array();
572 for ( $i = 0; $i < 32; ++$i )
573 {
574 $code = $i;
575 $ucode = $i;
576 $utf8_code = $utf8_codec->toUtf8( $ucode );
577 $this->UnicodeMap[$code] = $ucode;
578 $this->UTF8Map[$code] = $utf8_code;
579 $this->CodeMap[$ucode] = $code;
580 $this->UTF8CodeMap[$utf8_code] = $code;
581 }
582 $this->MinCharValue = 0;
583 $this->MaxCharValue = 31;
584
585 $lines = file( $file );
586 reset( $lines );
587 while ( ( $key = key( $lines ) ) !== null )
588 {
589 if ( preg_match( "/^#/", $lines[$key] ) )
590 {
591 next( $lines );
592 continue;
593 }
594 $line = trim( $lines[$key] );
595 $items = explode( "\t", $line );
596 if ( count( $items ) == 3 )
597 {
598 $code = false;
599 $ucode = false;
600 $desc = $items[2];
601 if ( preg_match( "/(=|0x)([0-9a-fA-F]{4})/", $items[0], $args ) )
602 {
603 $code = hexdec( $args[2] );
604 // eZDebug::writeNotice( $args, "doublebyte" );
605 }
606 else if ( preg_match( "/(=|0x)([0-9a-fA-F]{2})/", $items[0], $args ) )
607 {
608 $code = hexdec( $args[2] );
609 // eZDebug::writeNotice( $args, "singlebyte" );
610 }
611 if ( preg_match( "/(U\+|0x)([0-9a-fA-F]{4})/", $items[1], $args ) )
612 {
613 $ucode = hexdec( $args[2] );
614 }
615
616 if ( $code !== false and
617 $ucode !== false )
618 {
619 $utf8_code = $utf8_codec->toUtf8( $ucode );
620 $this->UnicodeMap[$code] = $ucode;
621 $this->UTF8Map[$code] = $utf8_code;
622 $this->CodeMap[$ucode] = $code;
623 $this->UTF8CodeMap[$utf8_code] = $code;
624 $this->MinCharValue = min( $this->MinCharValue, $code );
625 $this->MaxCharValue = max( $this->MaxCharValue, $code );
626 }
627 else if ( $code !== false )
628 {
629 $this->ReadExtraMap[$code] = true;
630 }
631 }
632 next( $lines );
633 }
634
635 $this->Valid = true;
636 $this->MinCharValue = min( $this->MinCharValue, $code );
637 $this->MaxCharValue = max( $this->MaxCharValue, $code );
638
639 if ( $use_cache )
640 {
641 // If there is no setting; do nothing:
642 if ( $permissionArray === false )
643 {
644 if ( !isset ( $GLOBALS['EZCODEPAGECACHEOBJECTLIST'] ) )
645 {
646 $GLOBALS['EZCODEPAGECACHEOBJECTLIST'] = array();
647 }
648
649 // The array already exists; we simply append to it.
650 $GLOBALS['EZCODEPAGECACHEOBJECTLIST'][] = $this;
651 }
652 // Else: a permission setting exists:
653 else
654 {
655 // Store the cache object with the correct permission setting.
656 $this->storeCacheObject( $cache, $permissionArray );
657
658 // Check if the global array for codepage cache objects exist:
659 }
660 }
661 }
662
668 function charsetCode()
669 {
670 return $this->CharsetCode;
671 }
672
676 function requestedCharsetCode()
677 {
678 return $this->RequestedCharsetCode;
679 }
680
684 function minCharValue()
685 {
686 return $this->MinCharValue;
687 }
688
692 function maxCharValue()
693 {
694 return $this->MaxCharValue;
695 }
696
700 function isValid()
701 {
702 return $this->Valid;
703 }
704
713 static function instance( $charset_code, $use_cache = true )
714 {
715 if ( empty( $GLOBALS["eZCodePage-$charset_code"] ) )
716 {
717 $GLOBALS["eZCodePage-$charset_code"] = new eZCodePage( $charset_code, $use_cache );
718 }
719 return $GLOBALS["eZCodePage-$charset_code"];
720 }
721
728 static function permissionSetting()
729 {
730 // eZDebug::writeDebug( "permissionSetting was called..." );
731
732 if ( isset( $GLOBALS['EZCODEPAGEPERMISSIONS'] ) )
733 {
734 return $GLOBALS['EZCODEPAGEPERMISSIONS'];
735 }
736 else
737 {
738 return false;
739 }
740 }
741
747 static function setPermissionSetting( $permissionArray )
748 {
749 // eZDebug::writeDebug( "setPermissionSetting was called..." );
750
751 $GLOBALS['EZCODEPAGEPERMISSIONS'] = $permissionArray;
752
753 if ( $permissionArray !== false )
754 {
755 eZCodePage::flushCacheObject();
756 }
757 }
758
762 static function flushCacheObject()
763 {
764 // eZDebug::writeDebug("flushCacheObject is called... ","");
765 if ( !isset( $GLOBALS['EZCODEPAGECACHEOBJECTLIST'] ) )
766 {
767 return false;
768 }
769
770 // Grab the permission setting for codepage cache files.
771 $permissionArray = self::permissionSetting();
772
773 // If we were unable to extract the permission setting:
774 if ( $permissionArray === false )
775 {
776 // eZDebug::writeDebug( "permissionSetting: unable to grab permission setting from global array..." );
777
778 // Bail with false.
779 return false;
780 }
781 // Else: permission setting is available:
782 else
783 {
784 // eZDebug::writeDebug( "permissionSetting: grabbed permission setting from global array..." );
785
786 // For all the cache objects:
787 foreach( array_keys( $GLOBALS['EZCODEPAGECACHEOBJECTLIST'] ) as $codePageKey )
788 {
789 $codePage = $GLOBALS['EZCODEPAGECACHEOBJECTLIST'][$codePageKey];
790
791 $filename = $codePage->cacheFilepath();
792
793 // Store __FIX_ME__
794 $codePage->storeCacheObject( $filename, $permissionArray );
795 }
796
797 //
798 unset( $GLOBALS['EZCODEPAGECACHEOBJECTLIST'] );
799 }
800 }
801
804 public $RequestedCharsetCode;
806 public $CharsetCode;
808 public $CharsetEncodingScheme;
810 public $UnicodeMap;
812 public $UTF8Map;
814 public $CodeMap;
816 public $UTF8CodeMap;
818 public $MinCharValue;
820 public $MaxCharValue;
822 public $Valid;
824 public $SubstituteChar;
825 }
826
827 // Checks if index.php or any other script has set any codepage permissions
828 if ( isset( $GLOBALS['EZCODEPAGEPERMISSIONS'] ) and
829 $GLOBALS['EZCODEPAGEPERMISSIONS'] !== false )
830 {
831 eZCodePage::flushCacheObject();
832 }
833
834 ?>
eZCharsetInfo\realCharsetCode
static realCharsetCode( $charsetCode)
Definition: ezcharsetinfo.php:186
eZCharsetInfo\characterEncodingScheme
static characterEncodingScheme( $charsetCode, $isRealCharset=false)
Definition: ezcharsetinfo.php:206
eZCodePage
Handles codepage files for charset mapping.
Definition: ezcodepage.php:19
eZCodePage\setSubstituteChar
setSubstituteChar( $char)
Definition: ezcodepage.php:326
eZCodePage\setPermissionSetting
static setPermissionSetting( $permissionArray)
Definition: ezcodepage.php:747
eZCodePage\convertStringFromUTF8
convertStringFromUTF8( $multi_char)
Definition: ezcodepage.php:88
eZCodePage\$Valid
$Valid
Whether the codepage is valid or not.
Definition: ezcodepage.php:822
eZCodePage\cacheFilepath
cacheFilepath()
Definition: ezcodepage.php:486
eZCodePage\cacheFileName
cacheFileName( $charset_code)
Definition: ezcodepage.php:352
eZCodePage\utf8ToCode
utf8ToCode( $ucode)
Definition: ezcodepage.php:307
eZCodePage\maxCharValue
maxCharValue()
Definition: ezcodepage.php:692
eZCodePage\unicodeToChar
unicodeToChar( $ucode)
Definition: ezcodepage.php:293
eZCodePage\requestedCharsetCode
requestedCharsetCode()
Definition: ezcodepage.php:676
eZCodePage\CACHE_CODE_DATE
const CACHE_CODE_DATE
Definition: ezcodepage.php:21
eZCodePage\codeToUnicode
codeToUnicode( $code)
Definition: ezcodepage.php:270
eZCodePage\$CharsetCode
$CharsetCode
The read charset code, may differ from $RequestedCharsetCode.
Definition: ezcodepage.php:806
eZCodePage\fileName
static fileName( $charset_code)
Definition: ezcodepage.php:345
eZCodePage\codeToUtf8
codeToUtf8( $code)
Definition: ezcodepage.php:265
eZCodePage\load
load( $use_cache=true)
Definition: ezcodepage.php:506
eZCodePage\strlen
strlen( $str)
Definition: ezcodepage.php:211
eZCodePage\$SubstituteChar
$SubstituteChar
The character to use when an alternative doesn't exist.
Definition: ezcodepage.php:824
eZCodePage\$CodeMap
$CodeMap
Maps unicode to normal codes.
Definition: ezcodepage.php:814
eZCodePage\instance
static instance( $charset_code, $use_cache=true)
Definition: ezcodepage.php:713
eZCodePage\storeCacheObject
storeCacheObject( $filename, $permissionArray)
Definition: ezcodepage.php:396
eZCodePage\$MaxCharValue
$MaxCharValue
The maximum key value for the mapping tables.
Definition: ezcodepage.php:820
eZCodePage\$ReadExtraMap
$ReadExtraMap
Definition: ezcodepage.php:20
eZCodePage\charToUnicode
charToUnicode( $str, $pos, &$charLen)
Definition: ezcodepage.php:251
eZCodePage\convertString
convertString( $str)
Definition: ezcodepage.php:42
eZCodePage\strlenFromUTF8
strlenFromUTF8( $str)
Definition: ezcodepage.php:232
eZCodePage\$UTF8Map
$UTF8Map
Maps normal codes to utf8.
Definition: ezcodepage.php:812
eZCodePage\$RequestedCharsetCode
$RequestedCharsetCode
Definition: ezcodepage.php:804
eZCodePage\flushCacheObject
static flushCacheObject()
Definition: ezcodepage.php:762
eZCodePage\utf8ToChar
utf8ToChar( $ucode)
Definition: ezcodepage.php:279
eZCodePage\charsetCode
charsetCode()
Definition: ezcodepage.php:668
eZCodePage\convertUnicodeToString
convertUnicodeToString( $unicodeValues)
Definition: ezcodepage.php:75
eZCodePage\$CharsetEncodingScheme
$CharsetEncodingScheme
Encoding scheme for current charset, for instance utf-8, singlebyte, multibyte.
Definition: ezcodepage.php:808
eZCodePage\fileModification
fileModification( $charset_code)
Definition: ezcodepage.php:365
eZCodePage\unicodeToCode
unicodeToCode( $ucode)
Definition: ezcodepage.php:314
eZCodePage\codepageList
codepageList()
Definition: ezcodepage.php:373
eZCodePage\__construct
__construct( $charset_code, $use_cache=true)
Definition: ezcodepage.php:29
eZCodePage\exists
static exists( $charset_code)
Definition: ezcodepage.php:335
eZCodePage\$UnicodeMap
$UnicodeMap
Maps normal codes to unicode.
Definition: ezcodepage.php:810
eZCodePage\minCharValue
minCharValue()
Definition: ezcodepage.php:684
eZCodePage\$MinCharValue
$MinCharValue
The minimum key value for the mapping tables.
Definition: ezcodepage.php:818
eZCodePage\permissionSetting
static permissionSetting()
Definition: ezcodepage.php:728
eZCodePage\charToUtf8
charToUtf8( $str, $pos, &$charLen)
Definition: ezcodepage.php:237
eZCodePage\convertStringToUnicode
convertStringToUnicode( $str)
Definition: ezcodepage.php:60
eZCodePage\isValid
isValid()
Definition: ezcodepage.php:700
eZCodePage\substituteChar
substituteChar()
Definition: ezcodepage.php:321
eZCodePage\$UTF8CodeMap
$UTF8CodeMap
Maps utf8 to normal codes.
Definition: ezcodepage.php:816
eZDebug\writeWarning
static writeWarning( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:502
eZPHPCreator
eZPHPCreator provides a simple interface for creating and executing PHP code.
eZUTF8Codec\instance
static instance()
Definition: ezutf8codec.php:239
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.