@@ -189,7 +189,7 @@ public function __construct()
189189 */
190190 protected function _get_data_loc ($ fname )
191191 {
192- if ($ fname{ 0 } == '/ ' || $ fname{ 0 } == '. ' ) {
192+ if ($ fname[ 0 ] == '/ ' || $ fname[ 0 ] == '. ' ) {
193193 // if filename starts with a slash, assume it's an absolute pathname
194194 // and skip whatever is in $this->_data_dir
195195 return $ fname ;
@@ -247,12 +247,6 @@ protected function _readdb($fname)
247247 protected function _checkTrigram ($ trigram )
248248 {
249249 if (!is_array ($ trigram )) {
250- if (ini_get ('magic_quotes_runtime ' )) {
251- throw new Text_LanguageDetect_Exception (
252- 'Error loading database. Try turning magic_quotes_runtime off. ' ,
253- Text_LanguageDetect_Exception::MAGIC_QUOTES
254- );
255- }
256250 throw new Text_LanguageDetect_Exception (
257251 'Language database is not an array. ' ,
258252 Text_LanguageDetect_Exception::DB_NOT_ARRAY
@@ -1470,31 +1464,31 @@ protected function _utf8char2unicode($char)
14701464 case 1 :
14711465 // normal ASCII-7 byte
14721466 // 0xxxxxxx --> 0xxxxxxx
1473- return ord($ char{ 0 } );
1467+ return ord ($ char[ 0 ] );
14741468
14751469 case 2 :
14761470 // 2 byte unicode
14771471 // 110zzzzx 10xxxxxx --> 00000zzz zxxxxxxx
1478- $ z = (ord ($ char{ 0 } ) & 0x000001F ) << 6 ;
1479- $ x = (ord ($ char{ 1 } ) & 0x0000003F );
1472+ $ z = (ord ($ char[ 0 ] ) & 0x000001F ) << 6 ;
1473+ $ x = (ord ($ char[ 1 ] ) & 0x0000003F );
14801474 return ($ z | $ x );
14811475
14821476 case 3 :
14831477 // 3 byte unicode
14841478 // 1110zzzz 10zxxxxx 10xxxxxx --> zzzzzxxx xxxxxxxx
1485- $ z = (ord ($ char{ 0 } ) & 0x0000000F ) << 12 ;
1486- $ x1 = (ord ($ char{ 1 } ) & 0x0000003F ) << 6 ;
1487- $ x2 = (ord ($ char{ 2 } ) & 0x0000003F );
1479+ $ z = (ord ($ char[ 0 ] ) & 0x0000000F ) << 12 ;
1480+ $ x1 = (ord ($ char[ 1 ] ) & 0x0000003F ) << 6 ;
1481+ $ x2 = (ord ($ char[ 2 ] ) & 0x0000003F );
14881482 return ($ z | $ x1 | $ x2 );
14891483
14901484 case 4 :
14911485 // 4 byte unicode
14921486 // 11110zzz 10zzxxxx 10xxxxxx 10xxxxxx -->
14931487 // 000zzzzz xxxxxxxx xxxxxxxx
1494- $ z1 = (ord ($ char{ 0 } ) & 0x00000007 ) << 18 ;
1495- $ z2 = (ord ($ char{ 1 } ) & 0x0000003F ) << 12 ;
1496- $ x1 = (ord ($ char{ 2 } ) & 0x0000003F ) << 6 ;
1497- $ x2 = (ord ($ char{ 3 } ) & 0x0000003F );
1488+ $ z1 = (ord ($ char[ 0 ] ) & 0x00000007 ) << 18 ;
1489+ $ z2 = (ord ($ char[ 1 ] ) & 0x0000003F ) << 12 ;
1490+ $ x1 = (ord ($ char[ 2 ] ) & 0x0000003F ) << 6 ;
1491+ $ x2 = (ord ($ char[ 3 ] ) & 0x0000003F );
14981492 return ($ z1 | $ z2 | $ x1 | $ x2 );
14991493 }
15001494 }
@@ -1514,7 +1508,7 @@ protected function _utf8char2unicode($char)
15141508 */
15151509 protected static function _next_char ($ str , &$ counter , $ special_convert = false )
15161510 {
1517- $ char = $ str{ $ counter ++} ;
1511+ $ char = $ str[ $ counter ++] ;
15181512 $ ord = ord ($ char );
15191513
15201514 // for a description of the utf8 system see
@@ -1538,7 +1532,7 @@ protected static function _next_char($str, &$counter, $special_convert = false)
15381532
15391533 } elseif ($ ord >> 5 == 6 ) { // two-byte char
15401534 // multi-byte chars
1541- $ nextchar = $ str{ $ counter ++} ; // get next byte
1535+ $ nextchar = $ str[ $ counter ++] ; // get next byte
15421536
15431537 // lower-casing of non-ascii characters is still incomplete
15441538
@@ -1580,12 +1574,12 @@ protected static function _next_char($str, &$counter, $special_convert = false)
15801574 } elseif ($ ord >> 4 == 14 ) { // three-byte char
15811575
15821576 // tag on next 2 bytes
1583- return $ char . $ str{ $ counter ++} . $ str{ $ counter ++} ;
1577+ return $ char . $ str[ $ counter ++] . $ str[ $ counter ++] ;
15841578
15851579 } elseif ($ ord >> 3 == 30 ) { // four-byte char
15861580
15871581 // tag on next 3 bytes
1588- return $ char . $ str{ $ counter ++} . $ str{ $ counter ++} . $ str{ $ counter ++} ;
1582+ return $ char . $ str[ $ counter ++] . $ str[ $ counter ++] . $ str[ $ counter ++] ;
15891583
15901584 } else {
15911585 // error?
0 commit comments