WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

getid3_lib::iconv_fallback() public WP 1.0

Это метод класса: getid3_lib{}

Хуков нет.

Возвращает

Строку.

Использование

$result = getid3_lib::iconv_fallback( $in_charset, $out_charset, $string );
$in_charset(строка) (обязательный)
$out_charset(строка) (обязательный)
$string(строка) (обязательный)

Код getid3_lib::iconv_fallback() WP 5.5.1

wp-includes/ID3/getid3.lib.php
<?php
public static function iconv_fallback($in_charset, $out_charset, $string) {

	if ($in_charset == $out_charset) {
		return $string;
	}

	// mb_convert_encoding() available
	if (function_exists('mb_convert_encoding')) {
		if ((strtoupper($in_charset) == 'UTF-16') && (substr($string, 0, 2) != "\xFE\xFF") && (substr($string, 0, 2) != "\xFF\xFE")) {
			// if BOM missing, mb_convert_encoding will mishandle the conversion, assume UTF-16BE and prepend appropriate BOM
			$string = "\xFF\xFE".$string;
		}
		if ((strtoupper($in_charset) == 'UTF-16') && (strtoupper($out_charset) == 'UTF-8')) {
			if (($string == "\xFF\xFE") || ($string == "\xFE\xFF")) {
				// if string consists of only BOM, mb_convert_encoding will return the BOM unmodified
				return '';
			}
		}
		if ($converted_string = @mb_convert_encoding($string, $out_charset, $in_charset)) {
			switch ($out_charset) {
				case 'ISO-8859-1':
					$converted_string = rtrim($converted_string, "\x00");
					break;
			}
			return $converted_string;
		}
		return $string;

	// iconv() available
	} elseif (function_exists('iconv')) {
		if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) {
			switch ($out_charset) {
				case 'ISO-8859-1':
					$converted_string = rtrim($converted_string, "\x00");
					break;
			}
			return $converted_string;
		}

		// iconv() may sometimes fail with "illegal character in input string" error message
		// and return an empty string, but returning the unconverted string is more useful
		return $string;
	}


	// neither mb_convert_encoding or iconv() is available
	static $ConversionFunctionList = array();
	if (empty($ConversionFunctionList)) {
		$ConversionFunctionList['ISO-8859-1']['UTF-8']    = 'iconv_fallback_iso88591_utf8';
		$ConversionFunctionList['ISO-8859-1']['UTF-16']   = 'iconv_fallback_iso88591_utf16';
		$ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be';
		$ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le';
		$ConversionFunctionList['UTF-8']['ISO-8859-1']    = 'iconv_fallback_utf8_iso88591';
		$ConversionFunctionList['UTF-8']['UTF-16']        = 'iconv_fallback_utf8_utf16';
		$ConversionFunctionList['UTF-8']['UTF-16BE']      = 'iconv_fallback_utf8_utf16be';
		$ConversionFunctionList['UTF-8']['UTF-16LE']      = 'iconv_fallback_utf8_utf16le';
		$ConversionFunctionList['UTF-16']['ISO-8859-1']   = 'iconv_fallback_utf16_iso88591';
		$ConversionFunctionList['UTF-16']['UTF-8']        = 'iconv_fallback_utf16_utf8';
		$ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591';
		$ConversionFunctionList['UTF-16LE']['UTF-8']      = 'iconv_fallback_utf16le_utf8';
		$ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591';
		$ConversionFunctionList['UTF-16BE']['UTF-8']      = 'iconv_fallback_utf16be_utf8';
	}
	if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) {
		$ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)];
		return self::$ConversionFunction($string);
	}
	throw new Exception('PHP does not has mb_convert_encoding() or iconv() support - cannot convert from '.$in_charset.' to '.$out_charset);
}