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

getid3_lib::CopyTagsToComments() public WP 1.0

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

Хуков нет.

Возвращает

true/false.

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

$result = getid3_lib::CopyTagsToComments( $ThisFileInfo, $option_tags_html );
$ThisFileInfo(массив) (обязательный) (передается по ссылке — &)
$option_tags_html(true/false)
default true (just as in the main getID3 class)
По умолчанию: true

Код getid3_lib::CopyTagsToComments() WP 5.5.1

wp-includes/ID3/getid3.lib.php
<?php
public static function CopyTagsToComments(&$ThisFileInfo, $option_tags_html=true) {
	// Copy all entries from ['tags'] into common ['comments']
	if (!empty($ThisFileInfo['tags'])) {
		if (isset($ThisFileInfo['tags']['id3v1'])) {
			// bubble ID3v1 to the end, if present to aid in detecting bad ID3v1 encodings
			$ID3v1 = $ThisFileInfo['tags']['id3v1'];
			unset($ThisFileInfo['tags']['id3v1']);
			$ThisFileInfo['tags']['id3v1'] = $ID3v1;
			unset($ID3v1);
		}
		foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) {
			foreach ($tagarray as $tagname => $tagdata) {
				foreach ($tagdata as $key => $value) {
					if (!empty($value)) {
						if (empty($ThisFileInfo['comments'][$tagname])) {

							// fall through and append value

						} elseif ($tagtype == 'id3v1') {

							$newvaluelength = strlen(trim($value));
							foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
								$oldvaluelength = strlen(trim($existingvalue));
								if (($newvaluelength <= $oldvaluelength) && (substr($existingvalue, 0, $newvaluelength) == trim($value))) {
									// new value is identical but shorter-than (or equal-length to) one already in comments - skip
									break 2;
								}
							}
							if (function_exists('mb_convert_encoding')) {
								if (trim($value) == trim(substr(mb_convert_encoding($existingvalue, $ThisFileInfo['id3v1']['encoding'], $ThisFileInfo['encoding']), 0, 30))) {
									// value stored in ID3v1 appears to be probably the multibyte value transliterated (badly) into ISO-8859-1 in ID3v1.
									// As an example, Foobar2000 will do this if you tag a file with Chinese or Arabic or Cyrillic or something that doesn't fit into ISO-8859-1 the ID3v1 will consist of mostly "?" characters, one per multibyte unrepresentable character
									break 2;
								}
							}

						} elseif (!is_array($value)) {

							$newvaluelength = strlen(trim($value));
							foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
								$oldvaluelength = strlen(trim($existingvalue));
								if ((strlen($existingvalue) > 10) && ($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {
									$ThisFileInfo['comments'][$tagname][$existingkey] = trim($value);
									break;
								}
							}

						}
						if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) {
							$value = (is_string($value) ? trim($value) : $value);
							if (!is_int($key) && !ctype_digit($key)) {
								$ThisFileInfo['comments'][$tagname][$key] = $value;
							} else {
								if (!isset($ThisFileInfo['comments'][$tagname])) {
									$ThisFileInfo['comments'][$tagname] = array($value);
								} else {
									$ThisFileInfo['comments'][$tagname][] = $value;
								}
							}
						}
					}
				}
			}
		}

		// attempt to standardize spelling of returned keys
		$StandardizeFieldNames = array(
			'tracknumber' => 'track_number',
			'track'       => 'track_number',
		);
		foreach ($StandardizeFieldNames as $badkey => $goodkey) {
			if (array_key_exists($badkey, $ThisFileInfo['comments']) && !array_key_exists($goodkey, $ThisFileInfo['comments'])) {
				$ThisFileInfo['comments'][$goodkey] = $ThisFileInfo['comments'][$badkey];
				unset($ThisFileInfo['comments'][$badkey]);
			}
		}

		if ($option_tags_html) {
			// Copy ['comments'] to ['comments_html']
			if (!empty($ThisFileInfo['comments'])) {
				foreach ($ThisFileInfo['comments'] as $field => $values) {
					if ($field == 'picture') {
						// pictures can take up a lot of space, and we don't need multiple copies of them
						// let there be a single copy in [comments][picture], and not elsewhere
						continue;
					}
					foreach ($values as $index => $value) {
						if (is_array($value)) {
							$ThisFileInfo['comments_html'][$field][$index] = $value;
						} else {
							$ThisFileInfo['comments_html'][$field][$index] = str_replace('&#0;', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding']));
						}
					}
				}
			}
		}

	}
	return true;
}