@@ -189,7 +189,7 @@ public function __construct()
189
189
*/
190
190
protected function _get_data_loc ($ fname )
191
191
{
192
- if ($ fname{ 0 } == '/ ' || $ fname{ 0 } == '. ' ) {
192
+ if ($ fname[ 0 ] == '/ ' || $ fname[ 0 ] == '. ' ) {
193
193
// if filename starts with a slash, assume it's an absolute pathname
194
194
// and skip whatever is in $this->_data_dir
195
195
return $ fname ;
@@ -247,12 +247,6 @@ protected function _readdb($fname)
247
247
protected function _checkTrigram ($ trigram )
248
248
{
249
249
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
- }
256
250
throw new Text_LanguageDetect_Exception (
257
251
'Language database is not an array. ' ,
258
252
Text_LanguageDetect_Exception::DB_NOT_ARRAY
@@ -1470,31 +1464,31 @@ protected function _utf8char2unicode($char)
1470
1464
case 1 :
1471
1465
// normal ASCII-7 byte
1472
1466
// 0xxxxxxx --> 0xxxxxxx
1473
- return ord($ char{ 0 } );
1467
+ return ord ($ char[ 0 ] );
1474
1468
1475
1469
case 2 :
1476
1470
// 2 byte unicode
1477
1471
// 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 );
1480
1474
return ($ z | $ x );
1481
1475
1482
1476
case 3 :
1483
1477
// 3 byte unicode
1484
1478
// 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 );
1488
1482
return ($ z | $ x1 | $ x2 );
1489
1483
1490
1484
case 4 :
1491
1485
// 4 byte unicode
1492
1486
// 11110zzz 10zzxxxx 10xxxxxx 10xxxxxx -->
1493
1487
// 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 );
1498
1492
return ($ z1 | $ z2 | $ x1 | $ x2 );
1499
1493
}
1500
1494
}
@@ -1514,7 +1508,7 @@ protected function _utf8char2unicode($char)
1514
1508
*/
1515
1509
protected static function _next_char ($ str , &$ counter , $ special_convert = false )
1516
1510
{
1517
- $ char = $ str{ $ counter ++} ;
1511
+ $ char = $ str[ $ counter ++] ;
1518
1512
$ ord = ord ($ char );
1519
1513
1520
1514
// for a description of the utf8 system see
@@ -1538,7 +1532,7 @@ protected static function _next_char($str, &$counter, $special_convert = false)
1538
1532
1539
1533
} elseif ($ ord >> 5 == 6 ) { // two-byte char
1540
1534
// multi-byte chars
1541
- $ nextchar = $ str{ $ counter ++} ; // get next byte
1535
+ $ nextchar = $ str[ $ counter ++] ; // get next byte
1542
1536
1543
1537
// lower-casing of non-ascii characters is still incomplete
1544
1538
@@ -1580,12 +1574,12 @@ protected static function _next_char($str, &$counter, $special_convert = false)
1580
1574
} elseif ($ ord >> 4 == 14 ) { // three-byte char
1581
1575
1582
1576
// tag on next 2 bytes
1583
- return $ char . $ str{ $ counter ++} . $ str{ $ counter ++} ;
1577
+ return $ char . $ str[ $ counter ++] . $ str[ $ counter ++] ;
1584
1578
1585
1579
} elseif ($ ord >> 3 == 30 ) { // four-byte char
1586
1580
1587
1581
// tag on next 3 bytes
1588
- return $ char . $ str{ $ counter ++} . $ str{ $ counter ++} . $ str{ $ counter ++} ;
1582
+ return $ char . $ str[ $ counter ++] . $ str[ $ counter ++] . $ str[ $ counter ++] ;
1589
1583
1590
1584
} else {
1591
1585
// error?
0 commit comments