Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

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