Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../ID3
File: getid3.lib.php
$newcharstring = '';
[1000] Fix | Delete
if ($bom) {
[1001] Fix | Delete
$newcharstring .= "\xFE\xFF";
[1002] Fix | Delete
}
[1003] Fix | Delete
$offset = 0;
[1004] Fix | Delete
$stringlength = strlen($string);
[1005] Fix | Delete
while ($offset < $stringlength) {
[1006] Fix | Delete
if ((ord($string[$offset]) | 0x07) == 0xF7) {
[1007] Fix | Delete
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
[1008] Fix | Delete
$charval = ((ord($string[($offset + 0)]) & 0x07) << 18) &
[1009] Fix | Delete
((ord($string[($offset + 1)]) & 0x3F) << 12) &
[1010] Fix | Delete
((ord($string[($offset + 2)]) & 0x3F) << 6) &
[1011] Fix | Delete
(ord($string[($offset + 3)]) & 0x3F);
[1012] Fix | Delete
$offset += 4;
[1013] Fix | Delete
} elseif ((ord($string[$offset]) | 0x0F) == 0xEF) {
[1014] Fix | Delete
// 1110bbbb 10bbbbbb 10bbbbbb
[1015] Fix | Delete
$charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) &
[1016] Fix | Delete
((ord($string[($offset + 1)]) & 0x3F) << 6) &
[1017] Fix | Delete
(ord($string[($offset + 2)]) & 0x3F);
[1018] Fix | Delete
$offset += 3;
[1019] Fix | Delete
} elseif ((ord($string[$offset]) | 0x1F) == 0xDF) {
[1020] Fix | Delete
// 110bbbbb 10bbbbbb
[1021] Fix | Delete
$charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) &
[1022] Fix | Delete
(ord($string[($offset + 1)]) & 0x3F);
[1023] Fix | Delete
$offset += 2;
[1024] Fix | Delete
} elseif ((ord($string[$offset]) | 0x7F) == 0x7F) {
[1025] Fix | Delete
// 0bbbbbbb
[1026] Fix | Delete
$charval = ord($string[$offset]);
[1027] Fix | Delete
$offset += 1;
[1028] Fix | Delete
} else {
[1029] Fix | Delete
// error? throw some kind of warning here?
[1030] Fix | Delete
$charval = false;
[1031] Fix | Delete
$offset += 1;
[1032] Fix | Delete
}
[1033] Fix | Delete
if ($charval !== false) {
[1034] Fix | Delete
$newcharstring .= (($charval < 65536) ? self::BigEndian2String($charval, 2) : "\x00".'?');
[1035] Fix | Delete
}
[1036] Fix | Delete
}
[1037] Fix | Delete
return $newcharstring;
[1038] Fix | Delete
}
[1039] Fix | Delete
[1040] Fix | Delete
/**
[1041] Fix | Delete
* UTF-8 => UTF-16LE
[1042] Fix | Delete
*
[1043] Fix | Delete
* @param string $string
[1044] Fix | Delete
* @param bool $bom
[1045] Fix | Delete
*
[1046] Fix | Delete
* @return string
[1047] Fix | Delete
*/
[1048] Fix | Delete
public static function iconv_fallback_utf8_utf16le($string, $bom=false) {
[1049] Fix | Delete
$newcharstring = '';
[1050] Fix | Delete
if ($bom) {
[1051] Fix | Delete
$newcharstring .= "\xFF\xFE";
[1052] Fix | Delete
}
[1053] Fix | Delete
$offset = 0;
[1054] Fix | Delete
$stringlength = strlen($string);
[1055] Fix | Delete
while ($offset < $stringlength) {
[1056] Fix | Delete
if ((ord($string[$offset]) | 0x07) == 0xF7) {
[1057] Fix | Delete
// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
[1058] Fix | Delete
$charval = ((ord($string[($offset + 0)]) & 0x07) << 18) &
[1059] Fix | Delete
((ord($string[($offset + 1)]) & 0x3F) << 12) &
[1060] Fix | Delete
((ord($string[($offset + 2)]) & 0x3F) << 6) &
[1061] Fix | Delete
(ord($string[($offset + 3)]) & 0x3F);
[1062] Fix | Delete
$offset += 4;
[1063] Fix | Delete
} elseif ((ord($string[$offset]) | 0x0F) == 0xEF) {
[1064] Fix | Delete
// 1110bbbb 10bbbbbb 10bbbbbb
[1065] Fix | Delete
$charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) &
[1066] Fix | Delete
((ord($string[($offset + 1)]) & 0x3F) << 6) &
[1067] Fix | Delete
(ord($string[($offset + 2)]) & 0x3F);
[1068] Fix | Delete
$offset += 3;
[1069] Fix | Delete
} elseif ((ord($string[$offset]) | 0x1F) == 0xDF) {
[1070] Fix | Delete
// 110bbbbb 10bbbbbb
[1071] Fix | Delete
$charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) &
[1072] Fix | Delete
(ord($string[($offset + 1)]) & 0x3F);
[1073] Fix | Delete
$offset += 2;
[1074] Fix | Delete
} elseif ((ord($string[$offset]) | 0x7F) == 0x7F) {
[1075] Fix | Delete
// 0bbbbbbb
[1076] Fix | Delete
$charval = ord($string[$offset]);
[1077] Fix | Delete
$offset += 1;
[1078] Fix | Delete
} else {
[1079] Fix | Delete
// error? maybe throw some warning here?
[1080] Fix | Delete
$charval = false;
[1081] Fix | Delete
$offset += 1;
[1082] Fix | Delete
}
[1083] Fix | Delete
if ($charval !== false) {
[1084] Fix | Delete
$newcharstring .= (($charval < 65536) ? self::LittleEndian2String($charval, 2) : '?'."\x00");
[1085] Fix | Delete
}
[1086] Fix | Delete
}
[1087] Fix | Delete
return $newcharstring;
[1088] Fix | Delete
}
[1089] Fix | Delete
[1090] Fix | Delete
/**
[1091] Fix | Delete
* UTF-8 => UTF-16LE (BOM)
[1092] Fix | Delete
*
[1093] Fix | Delete
* @param string $string
[1094] Fix | Delete
*
[1095] Fix | Delete
* @return string
[1096] Fix | Delete
*/
[1097] Fix | Delete
public static function iconv_fallback_utf8_utf16($string) {
[1098] Fix | Delete
return self::iconv_fallback_utf8_utf16le($string, true);
[1099] Fix | Delete
}
[1100] Fix | Delete
[1101] Fix | Delete
/**
[1102] Fix | Delete
* UTF-16BE => UTF-8
[1103] Fix | Delete
*
[1104] Fix | Delete
* @param string $string
[1105] Fix | Delete
*
[1106] Fix | Delete
* @return string
[1107] Fix | Delete
*/
[1108] Fix | Delete
public static function iconv_fallback_utf16be_utf8($string) {
[1109] Fix | Delete
if (substr($string, 0, 2) == "\xFE\xFF") {
[1110] Fix | Delete
// strip BOM
[1111] Fix | Delete
$string = substr($string, 2);
[1112] Fix | Delete
}
[1113] Fix | Delete
$newcharstring = '';
[1114] Fix | Delete
for ($i = 0; $i < strlen($string); $i += 2) {
[1115] Fix | Delete
$charval = self::BigEndian2Int(substr($string, $i, 2));
[1116] Fix | Delete
$newcharstring .= self::iconv_fallback_int_utf8($charval);
[1117] Fix | Delete
}
[1118] Fix | Delete
return $newcharstring;
[1119] Fix | Delete
}
[1120] Fix | Delete
[1121] Fix | Delete
/**
[1122] Fix | Delete
* UTF-16LE => UTF-8
[1123] Fix | Delete
*
[1124] Fix | Delete
* @param string $string
[1125] Fix | Delete
*
[1126] Fix | Delete
* @return string
[1127] Fix | Delete
*/
[1128] Fix | Delete
public static function iconv_fallback_utf16le_utf8($string) {
[1129] Fix | Delete
if (substr($string, 0, 2) == "\xFF\xFE") {
[1130] Fix | Delete
// strip BOM
[1131] Fix | Delete
$string = substr($string, 2);
[1132] Fix | Delete
}
[1133] Fix | Delete
$newcharstring = '';
[1134] Fix | Delete
for ($i = 0; $i < strlen($string); $i += 2) {
[1135] Fix | Delete
$charval = self::LittleEndian2Int(substr($string, $i, 2));
[1136] Fix | Delete
$newcharstring .= self::iconv_fallback_int_utf8($charval);
[1137] Fix | Delete
}
[1138] Fix | Delete
return $newcharstring;
[1139] Fix | Delete
}
[1140] Fix | Delete
[1141] Fix | Delete
/**
[1142] Fix | Delete
* UTF-16BE => ISO-8859-1
[1143] Fix | Delete
*
[1144] Fix | Delete
* @param string $string
[1145] Fix | Delete
*
[1146] Fix | Delete
* @return string
[1147] Fix | Delete
*/
[1148] Fix | Delete
public static function iconv_fallback_utf16be_iso88591($string) {
[1149] Fix | Delete
if (substr($string, 0, 2) == "\xFE\xFF") {
[1150] Fix | Delete
// strip BOM
[1151] Fix | Delete
$string = substr($string, 2);
[1152] Fix | Delete
}
[1153] Fix | Delete
$newcharstring = '';
[1154] Fix | Delete
for ($i = 0; $i < strlen($string); $i += 2) {
[1155] Fix | Delete
$charval = self::BigEndian2Int(substr($string, $i, 2));
[1156] Fix | Delete
$newcharstring .= (($charval < 256) ? chr($charval) : '?');
[1157] Fix | Delete
}
[1158] Fix | Delete
return $newcharstring;
[1159] Fix | Delete
}
[1160] Fix | Delete
[1161] Fix | Delete
/**
[1162] Fix | Delete
* UTF-16LE => ISO-8859-1
[1163] Fix | Delete
*
[1164] Fix | Delete
* @param string $string
[1165] Fix | Delete
*
[1166] Fix | Delete
* @return string
[1167] Fix | Delete
*/
[1168] Fix | Delete
public static function iconv_fallback_utf16le_iso88591($string) {
[1169] Fix | Delete
if (substr($string, 0, 2) == "\xFF\xFE") {
[1170] Fix | Delete
// strip BOM
[1171] Fix | Delete
$string = substr($string, 2);
[1172] Fix | Delete
}
[1173] Fix | Delete
$newcharstring = '';
[1174] Fix | Delete
for ($i = 0; $i < strlen($string); $i += 2) {
[1175] Fix | Delete
$charval = self::LittleEndian2Int(substr($string, $i, 2));
[1176] Fix | Delete
$newcharstring .= (($charval < 256) ? chr($charval) : '?');
[1177] Fix | Delete
}
[1178] Fix | Delete
return $newcharstring;
[1179] Fix | Delete
}
[1180] Fix | Delete
[1181] Fix | Delete
/**
[1182] Fix | Delete
* UTF-16 (BOM) => ISO-8859-1
[1183] Fix | Delete
*
[1184] Fix | Delete
* @param string $string
[1185] Fix | Delete
*
[1186] Fix | Delete
* @return string
[1187] Fix | Delete
*/
[1188] Fix | Delete
public static function iconv_fallback_utf16_iso88591($string) {
[1189] Fix | Delete
$bom = substr($string, 0, 2);
[1190] Fix | Delete
if ($bom == "\xFE\xFF") {
[1191] Fix | Delete
return self::iconv_fallback_utf16be_iso88591(substr($string, 2));
[1192] Fix | Delete
} elseif ($bom == "\xFF\xFE") {
[1193] Fix | Delete
return self::iconv_fallback_utf16le_iso88591(substr($string, 2));
[1194] Fix | Delete
}
[1195] Fix | Delete
return $string;
[1196] Fix | Delete
}
[1197] Fix | Delete
[1198] Fix | Delete
/**
[1199] Fix | Delete
* UTF-16 (BOM) => UTF-8
[1200] Fix | Delete
*
[1201] Fix | Delete
* @param string $string
[1202] Fix | Delete
*
[1203] Fix | Delete
* @return string
[1204] Fix | Delete
*/
[1205] Fix | Delete
public static function iconv_fallback_utf16_utf8($string) {
[1206] Fix | Delete
$bom = substr($string, 0, 2);
[1207] Fix | Delete
if ($bom == "\xFE\xFF") {
[1208] Fix | Delete
return self::iconv_fallback_utf16be_utf8(substr($string, 2));
[1209] Fix | Delete
} elseif ($bom == "\xFF\xFE") {
[1210] Fix | Delete
return self::iconv_fallback_utf16le_utf8(substr($string, 2));
[1211] Fix | Delete
}
[1212] Fix | Delete
return $string;
[1213] Fix | Delete
}
[1214] Fix | Delete
[1215] Fix | Delete
/**
[1216] Fix | Delete
* @param string $in_charset
[1217] Fix | Delete
* @param string $out_charset
[1218] Fix | Delete
* @param string $string
[1219] Fix | Delete
*
[1220] Fix | Delete
* @return string
[1221] Fix | Delete
* @throws Exception
[1222] Fix | Delete
*/
[1223] Fix | Delete
public static function iconv_fallback($in_charset, $out_charset, $string) {
[1224] Fix | Delete
[1225] Fix | Delete
if ($in_charset == $out_charset) {
[1226] Fix | Delete
return $string;
[1227] Fix | Delete
}
[1228] Fix | Delete
[1229] Fix | Delete
// mb_convert_encoding() available
[1230] Fix | Delete
if (function_exists('mb_convert_encoding')) {
[1231] Fix | Delete
if ((strtoupper($in_charset) == 'UTF-16') && (substr($string, 0, 2) != "\xFE\xFF") && (substr($string, 0, 2) != "\xFF\xFE")) {
[1232] Fix | Delete
// if BOM missing, mb_convert_encoding will mishandle the conversion, assume UTF-16BE and prepend appropriate BOM
[1233] Fix | Delete
$string = "\xFF\xFE".$string;
[1234] Fix | Delete
}
[1235] Fix | Delete
if ((strtoupper($in_charset) == 'UTF-16') && (strtoupper($out_charset) == 'UTF-8')) {
[1236] Fix | Delete
if (($string == "\xFF\xFE") || ($string == "\xFE\xFF")) {
[1237] Fix | Delete
// if string consists of only BOM, mb_convert_encoding will return the BOM unmodified
[1238] Fix | Delete
return '';
[1239] Fix | Delete
}
[1240] Fix | Delete
}
[1241] Fix | Delete
if ($converted_string = @mb_convert_encoding($string, $out_charset, $in_charset)) {
[1242] Fix | Delete
switch ($out_charset) {
[1243] Fix | Delete
case 'ISO-8859-1':
[1244] Fix | Delete
$converted_string = rtrim($converted_string, "\x00");
[1245] Fix | Delete
break;
[1246] Fix | Delete
}
[1247] Fix | Delete
return $converted_string;
[1248] Fix | Delete
}
[1249] Fix | Delete
return $string;
[1250] Fix | Delete
[1251] Fix | Delete
// iconv() available
[1252] Fix | Delete
} elseif (function_exists('iconv')) {
[1253] Fix | Delete
if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) {
[1254] Fix | Delete
switch ($out_charset) {
[1255] Fix | Delete
case 'ISO-8859-1':
[1256] Fix | Delete
$converted_string = rtrim($converted_string, "\x00");
[1257] Fix | Delete
break;
[1258] Fix | Delete
}
[1259] Fix | Delete
return $converted_string;
[1260] Fix | Delete
}
[1261] Fix | Delete
[1262] Fix | Delete
// iconv() may sometimes fail with "illegal character in input string" error message
[1263] Fix | Delete
// and return an empty string, but returning the unconverted string is more useful
[1264] Fix | Delete
return $string;
[1265] Fix | Delete
}
[1266] Fix | Delete
[1267] Fix | Delete
[1268] Fix | Delete
// neither mb_convert_encoding or iconv() is available
[1269] Fix | Delete
static $ConversionFunctionList = array();
[1270] Fix | Delete
if (empty($ConversionFunctionList)) {
[1271] Fix | Delete
$ConversionFunctionList['ISO-8859-1']['UTF-8'] = 'iconv_fallback_iso88591_utf8';
[1272] Fix | Delete
$ConversionFunctionList['ISO-8859-1']['UTF-16'] = 'iconv_fallback_iso88591_utf16';
[1273] Fix | Delete
$ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be';
[1274] Fix | Delete
$ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le';
[1275] Fix | Delete
$ConversionFunctionList['UTF-8']['ISO-8859-1'] = 'iconv_fallback_utf8_iso88591';
[1276] Fix | Delete
$ConversionFunctionList['UTF-8']['UTF-16'] = 'iconv_fallback_utf8_utf16';
[1277] Fix | Delete
$ConversionFunctionList['UTF-8']['UTF-16BE'] = 'iconv_fallback_utf8_utf16be';
[1278] Fix | Delete
$ConversionFunctionList['UTF-8']['UTF-16LE'] = 'iconv_fallback_utf8_utf16le';
[1279] Fix | Delete
$ConversionFunctionList['UTF-16']['ISO-8859-1'] = 'iconv_fallback_utf16_iso88591';
[1280] Fix | Delete
$ConversionFunctionList['UTF-16']['UTF-8'] = 'iconv_fallback_utf16_utf8';
[1281] Fix | Delete
$ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591';
[1282] Fix | Delete
$ConversionFunctionList['UTF-16LE']['UTF-8'] = 'iconv_fallback_utf16le_utf8';
[1283] Fix | Delete
$ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591';
[1284] Fix | Delete
$ConversionFunctionList['UTF-16BE']['UTF-8'] = 'iconv_fallback_utf16be_utf8';
[1285] Fix | Delete
}
[1286] Fix | Delete
if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) {
[1287] Fix | Delete
$ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)];
[1288] Fix | Delete
return self::$ConversionFunction($string);
[1289] Fix | Delete
}
[1290] Fix | Delete
throw new Exception('PHP does not has mb_convert_encoding() or iconv() support - cannot convert from '.$in_charset.' to '.$out_charset);
[1291] Fix | Delete
}
[1292] Fix | Delete
[1293] Fix | Delete
/**
[1294] Fix | Delete
* @param mixed $data
[1295] Fix | Delete
* @param string $charset
[1296] Fix | Delete
*
[1297] Fix | Delete
* @return mixed
[1298] Fix | Delete
*/
[1299] Fix | Delete
public static function recursiveMultiByteCharString2HTML($data, $charset='ISO-8859-1') {
[1300] Fix | Delete
if (is_string($data)) {
[1301] Fix | Delete
return self::MultiByteCharString2HTML($data, $charset);
[1302] Fix | Delete
} elseif (is_array($data)) {
[1303] Fix | Delete
$return_data = array();
[1304] Fix | Delete
foreach ($data as $key => $value) {
[1305] Fix | Delete
$return_data[$key] = self::recursiveMultiByteCharString2HTML($value, $charset);
[1306] Fix | Delete
}
[1307] Fix | Delete
return $return_data;
[1308] Fix | Delete
}
[1309] Fix | Delete
// integer, float, objects, resources, etc
[1310] Fix | Delete
return $data;
[1311] Fix | Delete
}
[1312] Fix | Delete
[1313] Fix | Delete
/**
[1314] Fix | Delete
* @param string|int|float $string
[1315] Fix | Delete
* @param string $charset
[1316] Fix | Delete
*
[1317] Fix | Delete
* @return string
[1318] Fix | Delete
*/
[1319] Fix | Delete
public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') {
[1320] Fix | Delete
$string = (string) $string; // in case trying to pass a numeric (float, int) string, would otherwise return an empty string
[1321] Fix | Delete
$HTMLstring = '';
[1322] Fix | Delete
[1323] Fix | Delete
switch (strtolower($charset)) {
[1324] Fix | Delete
case '1251':
[1325] Fix | Delete
case '1252':
[1326] Fix | Delete
case '866':
[1327] Fix | Delete
case '932':
[1328] Fix | Delete
case '936':
[1329] Fix | Delete
case '950':
[1330] Fix | Delete
case 'big5':
[1331] Fix | Delete
case 'big5-hkscs':
[1332] Fix | Delete
case 'cp1251':
[1333] Fix | Delete
case 'cp1252':
[1334] Fix | Delete
case 'cp866':
[1335] Fix | Delete
case 'euc-jp':
[1336] Fix | Delete
case 'eucjp':
[1337] Fix | Delete
case 'gb2312':
[1338] Fix | Delete
case 'ibm866':
[1339] Fix | Delete
case 'iso-8859-1':
[1340] Fix | Delete
case 'iso-8859-15':
[1341] Fix | Delete
case 'iso8859-1':
[1342] Fix | Delete
case 'iso8859-15':
[1343] Fix | Delete
case 'koi8-r':
[1344] Fix | Delete
case 'koi8-ru':
[1345] Fix | Delete
case 'koi8r':
[1346] Fix | Delete
case 'shift_jis':
[1347] Fix | Delete
case 'sjis':
[1348] Fix | Delete
case 'win-1251':
[1349] Fix | Delete
case 'windows-1251':
[1350] Fix | Delete
case 'windows-1252':
[1351] Fix | Delete
$HTMLstring = htmlentities($string, ENT_COMPAT, $charset);
[1352] Fix | Delete
break;
[1353] Fix | Delete
[1354] Fix | Delete
case 'utf-8':
[1355] Fix | Delete
$strlen = strlen($string);
[1356] Fix | Delete
for ($i = 0; $i < $strlen; $i++) {
[1357] Fix | Delete
$char_ord_val = ord($string[$i]);
[1358] Fix | Delete
$charval = 0;
[1359] Fix | Delete
if ($char_ord_val < 0x80) {
[1360] Fix | Delete
$charval = $char_ord_val;
[1361] Fix | Delete
} elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i+3 < $strlen) {
[1362] Fix | Delete
$charval = (($char_ord_val & 0x07) << 18);
[1363] Fix | Delete
$charval += ((ord($string[++$i]) & 0x3F) << 12);
[1364] Fix | Delete
$charval += ((ord($string[++$i]) & 0x3F) << 6);
[1365] Fix | Delete
$charval += (ord($string[++$i]) & 0x3F);
[1366] Fix | Delete
} elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i+2 < $strlen) {
[1367] Fix | Delete
$charval = (($char_ord_val & 0x0F) << 12);
[1368] Fix | Delete
$charval += ((ord($string[++$i]) & 0x3F) << 6);
[1369] Fix | Delete
$charval += (ord($string[++$i]) & 0x3F);
[1370] Fix | Delete
} elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i+1 < $strlen) {
[1371] Fix | Delete
$charval = (($char_ord_val & 0x1F) << 6);
[1372] Fix | Delete
$charval += (ord($string[++$i]) & 0x3F);
[1373] Fix | Delete
}
[1374] Fix | Delete
if (($charval >= 32) && ($charval <= 127)) {
[1375] Fix | Delete
$HTMLstring .= htmlentities(chr($charval));
[1376] Fix | Delete
} else {
[1377] Fix | Delete
$HTMLstring .= '&#'.$charval.';';
[1378] Fix | Delete
}
[1379] Fix | Delete
}
[1380] Fix | Delete
break;
[1381] Fix | Delete
[1382] Fix | Delete
case 'utf-16le':
[1383] Fix | Delete
for ($i = 0; $i < strlen($string); $i += 2) {
[1384] Fix | Delete
$charval = self::LittleEndian2Int(substr($string, $i, 2));
[1385] Fix | Delete
if (($charval >= 32) && ($charval <= 127)) {
[1386] Fix | Delete
$HTMLstring .= chr($charval);
[1387] Fix | Delete
} else {
[1388] Fix | Delete
$HTMLstring .= '&#'.$charval.';';
[1389] Fix | Delete
}
[1390] Fix | Delete
}
[1391] Fix | Delete
break;
[1392] Fix | Delete
[1393] Fix | Delete
case 'utf-16be':
[1394] Fix | Delete
for ($i = 0; $i < strlen($string); $i += 2) {
[1395] Fix | Delete
$charval = self::BigEndian2Int(substr($string, $i, 2));
[1396] Fix | Delete
if (($charval >= 32) && ($charval <= 127)) {
[1397] Fix | Delete
$HTMLstring .= chr($charval);
[1398] Fix | Delete
} else {
[1399] Fix | Delete
$HTMLstring .= '&#'.$charval.';';
[1400] Fix | Delete
}
[1401] Fix | Delete
}
[1402] Fix | Delete
break;
[1403] Fix | Delete
[1404] Fix | Delete
default:
[1405] Fix | Delete
$HTMLstring = 'ERROR: Character set "'.$charset.'" not supported in MultiByteCharString2HTML()';
[1406] Fix | Delete
break;
[1407] Fix | Delete
}
[1408] Fix | Delete
return $HTMLstring;
[1409] Fix | Delete
}
[1410] Fix | Delete
[1411] Fix | Delete
/**
[1412] Fix | Delete
* @param int $namecode
[1413] Fix | Delete
*
[1414] Fix | Delete
* @return string
[1415] Fix | Delete
*/
[1416] Fix | Delete
public static function RGADnameLookup($namecode) {
[1417] Fix | Delete
static $RGADname = array();
[1418] Fix | Delete
if (empty($RGADname)) {
[1419] Fix | Delete
$RGADname[0] = 'not set';
[1420] Fix | Delete
$RGADname[1] = 'Track Gain Adjustment';
[1421] Fix | Delete
$RGADname[2] = 'Album Gain Adjustment';
[1422] Fix | Delete
}
[1423] Fix | Delete
[1424] Fix | Delete
return (isset($RGADname[$namecode]) ? $RGADname[$namecode] : '');
[1425] Fix | Delete
}
[1426] Fix | Delete
[1427] Fix | Delete
/**
[1428] Fix | Delete
* @param int $originatorcode
[1429] Fix | Delete
*
[1430] Fix | Delete
* @return string
[1431] Fix | Delete
*/
[1432] Fix | Delete
public static function RGADoriginatorLookup($originatorcode) {
[1433] Fix | Delete
static $RGADoriginator = array();
[1434] Fix | Delete
if (empty($RGADoriginator)) {
[1435] Fix | Delete
$RGADoriginator[0] = 'unspecified';
[1436] Fix | Delete
$RGADoriginator[1] = 'pre-set by artist/producer/mastering engineer';
[1437] Fix | Delete
$RGADoriginator[2] = 'set by user';
[1438] Fix | Delete
$RGADoriginator[3] = 'determined automatically';
[1439] Fix | Delete
}
[1440] Fix | Delete
[1441] Fix | Delete
return (isset($RGADoriginator[$originatorcode]) ? $RGADoriginator[$originatorcode] : '');
[1442] Fix | Delete
}
[1443] Fix | Delete
[1444] Fix | Delete
/**
[1445] Fix | Delete
* @param int $rawadjustment
[1446] Fix | Delete
* @param int $signbit
[1447] Fix | Delete
*
[1448] Fix | Delete
* @return float
[1449] Fix | Delete
*/
[1450] Fix | Delete
public static function RGADadjustmentLookup($rawadjustment, $signbit) {
[1451] Fix | Delete
$adjustment = (float) $rawadjustment / 10;
[1452] Fix | Delete
if ($signbit == 1) {
[1453] Fix | Delete
$adjustment *= -1;
[1454] Fix | Delete
}
[1455] Fix | Delete
return $adjustment;
[1456] Fix | Delete
}
[1457] Fix | Delete
[1458] Fix | Delete
/**
[1459] Fix | Delete
* @param int $namecode
[1460] Fix | Delete
* @param int $originatorcode
[1461] Fix | Delete
* @param int $replaygain
[1462] Fix | Delete
*
[1463] Fix | Delete
* @return string
[1464] Fix | Delete
*/
[1465] Fix | Delete
public static function RGADgainString($namecode, $originatorcode, $replaygain) {
[1466] Fix | Delete
if ($replaygain < 0) {
[1467] Fix | Delete
$signbit = '1';
[1468] Fix | Delete
} else {
[1469] Fix | Delete
$signbit = '0';
[1470] Fix | Delete
}
[1471] Fix | Delete
$storedreplaygain = intval(round($replaygain * 10));
[1472] Fix | Delete
$gainstring = str_pad(decbin($namecode), 3, '0', STR_PAD_LEFT);
[1473] Fix | Delete
$gainstring .= str_pad(decbin($originatorcode), 3, '0', STR_PAD_LEFT);
[1474] Fix | Delete
$gainstring .= $signbit;
[1475] Fix | Delete
$gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT);
[1476] Fix | Delete
[1477] Fix | Delete
return $gainstring;
[1478] Fix | Delete
}
[1479] Fix | Delete
[1480] Fix | Delete
/**
[1481] Fix | Delete
* @param float $amplitude
[1482] Fix | Delete
*
[1483] Fix | Delete
* @return float
[1484] Fix | Delete
*/
[1485] Fix | Delete
public static function RGADamplitude2dB($amplitude) {
[1486] Fix | Delete
return 20 * log10($amplitude);
[1487] Fix | Delete
}
[1488] Fix | Delete
[1489] Fix | Delete
/**
[1490] Fix | Delete
* @param string $imgData
[1491] Fix | Delete
* @param array $imageinfo
[1492] Fix | Delete
*
[1493] Fix | Delete
* @return array|false
[1494] Fix | Delete
*/
[1495] Fix | Delete
public static function GetDataImageSize($imgData, &$imageinfo=array()) {
[1496] Fix | Delete
if (PHP_VERSION_ID >= 50400) {
[1497] Fix | Delete
$GetDataImageSize = @getimagesizefromstring($imgData, $imageinfo);
[1498] Fix | Delete
if ($GetDataImageSize === false || !isset($GetDataImageSize[0], $GetDataImageSize[1])) {
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function