Changeset 48278 for trunk/src/wp-includes/ID3/getid3.lib.php
- Timestamp:
- 07/02/2020 03:46:17 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/getid3.lib.php
r47737 r48278 682 682 public static function array_max($arraydata, $returnkey=false) { 683 683 $maxvalue = false; 684 $maxkey = false;684 $maxkey = false; 685 685 foreach ($arraydata as $key => $value) { 686 686 if (!is_array($value)) { 687 if ( $value > $maxvalue) {687 if (($maxvalue === false) || ($value > $maxvalue)) { 688 688 $maxvalue = $value; 689 689 $maxkey = $key; … … 702 702 public static function array_min($arraydata, $returnkey=false) { 703 703 $minvalue = false; 704 $minkey = false;704 $minkey = false; 705 705 foreach ($arraydata as $key => $value) { 706 706 if (!is_array($value)) { 707 if ( $value > $minvalue) {707 if (($minvalue === false) || ($value < $minvalue)) { 708 708 $minvalue = $value; 709 709 $minkey = $key; … … 1530 1530 /** 1531 1531 * @param array $ThisFileInfo 1532 * @param bool $option_tags_html default true (just as in the main getID3 class) 1532 1533 * 1533 1534 * @return bool 1534 1535 */ 1535 public static function CopyTagsToComments(&$ThisFileInfo) { 1536 1536 public static function CopyTagsToComments(&$ThisFileInfo, $option_tags_html=true) { 1537 1537 // Copy all entries from ['tags'] into common ['comments'] 1538 1538 if (!empty($ThisFileInfo['tags'])) { 1539 if (isset($ThisFileInfo['tags']['id3v1'])) { 1540 // bubble ID3v1 to the end, if present to aid in detecting bad ID3v1 encodings 1541 $ID3v1 = $ThisFileInfo['tags']['id3v1']; 1542 unset($ThisFileInfo['tags']['id3v1']); 1543 $ThisFileInfo['tags']['id3v1'] = $ID3v1; 1544 unset($ID3v1); 1545 } 1539 1546 foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) { 1540 1547 foreach ($tagarray as $tagname => $tagdata) { … … 1555 1562 } 1556 1563 } 1564 if (function_exists('mb_convert_encoding')) { 1565 if (trim($value) == trim(substr(mb_convert_encoding($existingvalue, $ThisFileInfo['id3v1']['encoding'], $ThisFileInfo['encoding']), 0, 30))) { 1566 // value stored in ID3v1 appears to be probably the multibyte value transliterated (badly) into ISO-8859-1 in ID3v1. 1567 // 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 1568 break 2; 1569 } 1570 } 1557 1571 1558 1572 } elseif (!is_array($value)) { … … 1563 1577 if ((strlen($existingvalue) > 10) && ($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) { 1564 1578 $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value); 1565 //break 2;1566 1579 break; 1567 1580 } … … 1598 1611 } 1599 1612 1600 // Copy to ['comments_html'] 1601 if (!empty($ThisFileInfo['comments'])) { 1602 foreach ($ThisFileInfo['comments'] as $field => $values) { 1603 if ($field == 'picture') { 1604 // pictures can take up a lot of space, and we don't need multiple copies of them 1605 // let there be a single copy in [comments][picture], and not elsewhere 1606 continue; 1607 } 1608 foreach ($values as $index => $value) { 1609 if (is_array($value)) { 1610 $ThisFileInfo['comments_html'][$field][$index] = $value; 1611 } else { 1612 $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding'])); 1613 if ($option_tags_html) { 1614 // Copy ['comments'] to ['comments_html'] 1615 if (!empty($ThisFileInfo['comments'])) { 1616 foreach ($ThisFileInfo['comments'] as $field => $values) { 1617 if ($field == 'picture') { 1618 // pictures can take up a lot of space, and we don't need multiple copies of them 1619 // let there be a single copy in [comments][picture], and not elsewhere 1620 continue; 1621 } 1622 foreach ($values as $index => $value) { 1623 if (is_array($value)) { 1624 $ThisFileInfo['comments_html'][$field][$index] = $value; 1625 } else { 1626 $ThisFileInfo['comments_html'][$field][$index] = str_replace('�', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding'])); 1627 } 1613 1628 } 1614 1629 }
Note: See TracChangeset
for help on using the changeset viewer.