99 if (!empty($this->filename) && (is_writeable($this->filename) || (!file_exists($this->filename) && is_writeable(dirname($this->filename))))) {
102 $OldThisFileInfo = $getID3->analyze($this->filename);
104 $this->errors[] =
'Unable to write ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).
'GB';
109 if ($this->merge_existing_data) {
111 if (!empty($OldThisFileInfo[
'id3v2'])) {
112 $this->tag_data = $this->
array_join_merge($OldThisFileInfo[
'id3v2'], $this->tag_data);
115 $this->paddedlength = (isset($OldThisFileInfo[
'id3v2'][
'headerlength']) ? max($OldThisFileInfo[
'id3v2'][
'headerlength'], $this->paddedlength) : $this->paddedlength);
119 if (file_exists($this->filename) && is_writeable($this->filename) && isset($OldThisFileInfo[
'id3v2'][
'headerlength']) && ($OldThisFileInfo[
'id3v2'][
'headerlength'] == strlen($NewID3v2Tag))) {
122 if (file_exists($this->filename)) {
124 if (is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename,
'r+b'))) {
126 fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag));
129 $this->errors[] =
'Could not fopen("'.$this->filename.
'", "r+b")';
134 if (is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename,
'wb'))) {
136 fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag));
139 $this->errors[] =
'Could not fopen("'.$this->filename.
'", "wb")';
147 if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename,
'rb'))) {
148 if (is_writable($tempfilename) && is_file($tempfilename) && ($fp_temp = fopen($tempfilename,
'wb'))) {
150 fwrite($fp_temp, $NewID3v2Tag, strlen($NewID3v2Tag));
153 if (!empty($OldThisFileInfo[
'avdataoffset'])) {
154 fseek($fp_source, $OldThisFileInfo[
'avdataoffset'], SEEK_SET);
157 while ($buffer =
fread($fp_source, $this->fread_buffer_size)) {
158 fwrite($fp_temp, $buffer, strlen($buffer));
163 copy($tempfilename, $this->filename);
164 unlink($tempfilename);
169 $this->errors[] =
'Could not fopen("'.$tempfilename.
'", "wb")';
174 $this->errors[] =
'Could not fopen("'.$this->filename.
'", "rb")';
184 $this->errors[] =
'$this->GenerateID3v2Tag() failed';
188 if (!empty($this->errors)) {
194 $this->errors[] =
'WriteID3v2() failed: !is_writeable('.$this->filename.
')';
204 if (is_writeable(dirname($this->filename))) {
208 if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename,
'rb'))) {
212 $OldThisFileInfo = $getID3->analyze($this->filename);
214 $this->errors[] =
'Unable to remove ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).
'GB';
220 if ($OldThisFileInfo[
'avdataoffset'] !==
false) {
221 fseek($fp_source, $OldThisFileInfo[
'avdataoffset'], SEEK_SET);
223 if (is_writable($this->filename) && is_file($this->filename) && ($fp_temp = fopen($this->filename.
'getid3tmp',
'w+b'))) {
224 while ($buffer =
fread($fp_source, $this->fread_buffer_size)) {
225 fwrite($fp_temp, $buffer, strlen($buffer));
229 $this->errors[] =
'Could not fopen("'.$this->filename.
'getid3tmp", "w+b")';
233 $this->errors[] =
'Could not fopen("'.$this->filename.
'", "rb")';
235 if (file_exists($this->filename)) {
236 unlink($this->filename);
238 rename($this->filename.
'getid3tmp', $this->filename);
240 } elseif (is_writable($this->filename)) {
244 if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename,
'rb'))) {
248 $OldThisFileInfo = $getID3->analyze($this->filename);
250 $this->errors[] =
'Unable to remove ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).
'GB';
256 if ($OldThisFileInfo[
'avdataoffset'] !==
false) {
257 fseek($fp_source, $OldThisFileInfo[
'avdataoffset'], SEEK_SET);
259 if ($fp_temp = tmpfile()) {
260 while ($buffer =
fread($fp_source, $this->fread_buffer_size)) {
261 fwrite($fp_temp, $buffer, strlen($buffer));
264 if (is_writable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename,
'wb'))) {
266 while ($buffer =
fread($fp_temp, $this->fread_buffer_size)) {
267 fwrite($fp_source, $buffer, strlen($buffer));
269 fseek($fp_temp, -128, SEEK_END);
272 $this->errors[] =
'Could not fopen("'.$this->filename.
'", "wb")';
276 $this->errors[] =
'Could not create tmpfile()';
279 $this->errors[] =
'Could not fopen("'.$this->filename.
'", "rb")';
284 $this->errors[] =
'Directory and file both not writeable';
288 if (!empty($this->errors)) {
302 switch ($this->majorversion) {
305 $flag = (!empty($flags[
'unsynchronisation']) ?
'1' :
'0');
306 $flag .= (!empty($flags[
'extendedheader'] ) ?
'1' :
'0');
307 $flag .= (!empty($flags[
'experimental'] ) ?
'1' :
'0');
308 $flag .= (!empty($flags[
'footer'] ) ?
'1' :
'0');
314 $flag = (!empty($flags[
'unsynchronisation']) ?
'1' :
'0');
315 $flag .= (!empty($flags[
'extendedheader'] ) ?
'1' :
'0');
316 $flag .= (!empty($flags[
'experimental'] ) ?
'1' :
'0');
322 $flag = (!empty($flags[
'unsynchronisation']) ?
'1' :
'0');
323 $flag .= (!empty($flags[
'compression'] ) ?
'1' :
'0');
332 return chr(bindec($flag));
347 public function GenerateID3v2FrameFlags($TagAlter=
false, $FileAlter=
false, $ReadOnly=
false, $Compression=
false, $Encryption=
false, $GroupingIdentity=
false, $Unsynchronisation=
false, $DataLengthIndicator=
false)
349 switch ($this->majorversion) {
353 $flag1 .= $TagAlter ?
'1' :
'0';
354 $flag1 .= $FileAlter ?
'1' :
'0';
355 $flag1 .= $ReadOnly ?
'1' :
'0';
359 $flag2 .= $GroupingIdentity ?
'1' :
'0';
361 $flag2 .= $Compression ?
'1' :
'0';
362 $flag2 .= $Encryption ?
'1' :
'0';
363 $flag2 .= $Unsynchronisation ?
'1' :
'0';
364 $flag2 .= $DataLengthIndicator ?
'1' :
'0';
369 $flag1 = $TagAlter ?
'1' :
'0';
370 $flag1 .= $FileAlter ?
'1' :
'0';
371 $flag1 .= $ReadOnly ?
'1' :
'0';
374 $flag2 = $Compression ?
'1' :
'0';
375 $flag2 .= $Encryption ?
'1' :
'0';
376 $flag2 .= $GroupingIdentity ?
'1' :
'0';
386 return chr(bindec($flag1)).chr(bindec($flag2));
402 if (($this->majorversion < 3) || ($this->majorversion > 4)) {
404 $this->errors[] =
'Only ID3v2.3 and ID3v2.4 are supported in GenerateID3v2FrameData()';
408 switch ($frame_name) {
413 if (strlen($source_data_array[
'data']) > 64) {
414 $this->errors[] =
'Identifier not allowed to be longer than 64 bytes in '.$frame_name.
' (supplied data was '.strlen($source_data_array[
'data']).
' bytes long)';
416 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'ownerid']).
"\x00";
417 $framedata .= substr($source_data_array[
'data'], 0, 64);
426 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
428 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
430 $framedata .= chr($source_data_array[
'encodingid']);
431 $framedata .= $source_data_array[
'description'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
432 $framedata .= $source_data_array[
'data'];
441 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
443 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
444 } elseif (!isset($source_data_array[
'data']) || !$this->
IsValidURL($source_data_array[
'data'],
false,
false)) {
447 $this->warnings[] =
'Invalid URL in '.$frame_name.
' ('.$source_data_array[
'data'].
')';
449 $framedata .= chr($source_data_array[
'encodingid']);
450 $framedata .= $source_data_array[
'description'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
451 $framedata .= $source_data_array[
'data'];
459 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
461 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
463 $framedata .= chr($source_data_array[
'encodingid']);
464 $framedata .= $source_data_array[
'data'];
471 $framedata .= $source_data_array[
'data'];
485 if (($source_data_array[
'timestampformat'] > 2) || ($source_data_array[
'timestampformat'] < 1)) {
486 $this->errors[] =
'Invalid Time Stamp Format byte in '.$frame_name.
' ('.$source_data_array[
'timestampformat'].
')';
488 $framedata .= chr($source_data_array[
'timestampformat']);
489 foreach ($source_data_array as $key => $val) {
491 $this->errors[] =
'Invalid Event Type byte in '.$frame_name.
' ('.$val[
'typeid'].
')';
492 } elseif (($key !=
'timestampformat') && ($key !=
'flags')) {
493 if (($val[
'timestamp'] > 0) && ($previousETCOtimestamp >= $val[
'timestamp'])) {
496 $this->errors[] =
'Out-of-order timestamp in '.$frame_name.
' ('.$val[
'timestamp'].
') for Event Type ('.$val[
'typeid'].
')';
498 $framedata .= chr($val[
'typeid']);
516 if (($source_data_array[
'framesbetweenreferences'] > 0) && ($source_data_array[
'framesbetweenreferences'] <= 65535)) {
519 $this->errors[] =
'Invalid MPEG Frames Between References in '.$frame_name.
' ('.$source_data_array[
'framesbetweenreferences'].
')';
521 if (($source_data_array[
'bytesbetweenreferences'] > 0) && ($source_data_array[
'bytesbetweenreferences'] <= 16777215)) {
524 $this->errors[] =
'Invalid bytes Between References in '.$frame_name.
' ('.$source_data_array[
'bytesbetweenreferences'].
')';
526 if (($source_data_array[
'msbetweenreferences'] > 0) && ($source_data_array[
'msbetweenreferences'] <= 16777215)) {
529 $this->errors[] =
'Invalid Milliseconds Between References in '.$frame_name.
' ('.$source_data_array[
'msbetweenreferences'].
')';
531 if (!$this->
IsWithinBitRange($source_data_array[
'bitsforbytesdeviation'], 8,
false)) {
532 if (($source_data_array[
'bitsforbytesdeviation'] % 4) == 0) {
533 $framedata .= chr($source_data_array[
'bitsforbytesdeviation']);
535 $this->errors[] =
'Bits For Bytes Deviation in '.$frame_name.
' ('.$source_data_array[
'bitsforbytesdeviation'].
') must be a multiple of 4.';
538 $this->errors[] =
'Invalid Bits For Bytes Deviation in '.$frame_name.
' ('.$source_data_array[
'bitsforbytesdeviation'].
')';
540 if (!$this->
IsWithinBitRange($source_data_array[
'bitsformsdeviation'], 8,
false)) {
541 if (($source_data_array[
'bitsformsdeviation'] % 4) == 0) {
542 $framedata .= chr($source_data_array[
'bitsformsdeviation']);
544 $this->errors[] =
'Bits For Milliseconds Deviation in '.$frame_name.
' ('.$source_data_array[
'bitsforbytesdeviation'].
') must be a multiple of 4.';
547 $this->errors[] =
'Invalid Bits For Milliseconds Deviation in '.$frame_name.
' ('.$source_data_array[
'bitsformsdeviation'].
')';
549 foreach ($source_data_array as $key => $val) {
550 if (($key !=
'framesbetweenreferences') && ($key !=
'bytesbetweenreferences') && ($key !=
'msbetweenreferences') && ($key !=
'bitsforbytesdeviation') && ($key !=
'bitsformsdeviation') && ($key !=
'flags')) {
551 $unwrittenbitstream .= str_pad(
Helper::Dec2Bin($val[
'bytedeviation']), $source_data_array[
'bitsforbytesdeviation'],
'0', STR_PAD_LEFT);
552 $unwrittenbitstream .= str_pad(
Helper::Dec2Bin($val[
'msdeviation']), $source_data_array[
'bitsformsdeviation'],
'0', STR_PAD_LEFT);
555 for ($i = 0; $i < strlen($unwrittenbitstream); $i += 8) {
556 $highnibble = bindec(substr($unwrittenbitstream, $i, 4)) << 4;
557 $lownibble = bindec(substr($unwrittenbitstream, $i + 4, 4));
558 $framedata .= chr($highnibble & $lownibble);
569 if (($source_data_array[
'timestampformat'] > 2) || ($source_data_array[
'timestampformat'] < 1)) {
570 $this->errors[] =
'Invalid Time Stamp Format byte in '.$frame_name.
' ('.$source_data_array[
'timestampformat'].
')';
572 $framedata .= chr($source_data_array[
'timestampformat']);
573 foreach ($source_data_array as $key => $val) {
575 $this->errors[] =
'Invalid Event Type byte in '.$frame_name.
' ('.$val[
'typeid'].
')';
576 } elseif (($key !=
'timestampformat') && ($key !=
'flags')) {
577 if (($val[
'tempo'] < 0) || ($val[
'tempo'] > 510)) {
578 $this->errors[] =
'Invalid Tempo (max = 510) in '.$frame_name.
' ('.$val[
'tempo'].
') at timestamp ('.$val[
'timestamp'].
')';
580 if ($val[
'tempo'] > 255) {
581 $framedata .= chr(255);
582 $val[
'tempo'] -= 255;
584 $framedata .= chr($val[
'tempo']);
598 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
600 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
602 $this->errors[] =
'Invalid Language in '.$frame_name.
' ('.$source_data_array[
'language'].
')';
604 $framedata .= chr($source_data_array[
'encodingid']);
605 $framedata .= strtolower($source_data_array[
'language']);
606 $framedata .= $source_data_array[
'description'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
607 $framedata .= $source_data_array[
'data'];
623 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
625 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
627 $this->errors[] =
'Invalid Language in '.$frame_name.
' ('.$source_data_array[
'language'].
')';
628 } elseif (($source_data_array[
'timestampformat'] > 2) || ($source_data_array[
'timestampformat'] < 1)) {
629 $this->errors[] =
'Invalid Time Stamp Format byte in '.$frame_name.
' ('.$source_data_array[
'timestampformat'].
')';
631 $this->errors[] =
'Invalid Content Type byte in '.$frame_name.
' ('.$source_data_array[
'contenttypeid'].
')';
632 } elseif (!is_array($source_data_array[
'data'])) {
633 $this->errors[] =
'Invalid Lyric/Timestamp data in '.$frame_name.
' (must be an array)';
635 $framedata .= chr($source_data_array[
'encodingid']);
636 $framedata .= strtolower($source_data_array[
'language']);
637 $framedata .= chr($source_data_array[
'timestampformat']);
638 $framedata .= chr($source_data_array[
'contenttypeid']);
639 $framedata .= $source_data_array[
'description'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
640 ksort($source_data_array[
'data']);
641 foreach ($source_data_array[
'data'] as $key => $val) {
642 $framedata .= $val[
'data'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
654 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
656 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
658 $this->errors[] =
'Invalid Language in '.$frame_name.
' ('.$source_data_array[
'language'].
')';
660 $framedata .= chr($source_data_array[
'encodingid']);
661 $framedata .= strtolower($source_data_array[
'language']);
662 $framedata .= $source_data_array[
'description'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
663 $framedata .= $source_data_array[
'data'];
677 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'description']).
"\x00";
678 foreach ($source_data_array as $key => $val) {
679 if ($key !=
'description') {
680 $framedata .= chr($val[
'channeltypeid']);
682 if (!$this->
IsWithinBitRange($source_data_array[
'bitspeakvolume'], 8,
false)) {
683 $framedata .= chr($val[
'bitspeakvolume']);
684 if ($val[
'bitspeakvolume'] > 0) {
688 $this->errors[] =
'Invalid Bits Representing Peak Volume in '.$frame_name.
' ('.$val[
'bitspeakvolume'].
') (range = 0 to 255)';
711 $this->errors[] =
'Invalid Bits For Volume Description byte in '.$frame_name.
' ('.$source_data_array[
'bitsvolume'].
') (range = 1 to 255)';
714 $incdecflag .= $source_data_array[
'incdec'][
'right'] ?
'1' :
'0';
715 $incdecflag .= $source_data_array[
'incdec'][
'left'] ?
'1' :
'0';
716 $incdecflag .= $source_data_array[
'incdec'][
'rightrear'] ?
'1' :
'0';
717 $incdecflag .= $source_data_array[
'incdec'][
'leftrear'] ?
'1' :
'0';
718 $incdecflag .= $source_data_array[
'incdec'][
'center'] ?
'1' :
'0';
719 $incdecflag .= $source_data_array[
'incdec'][
'bass'] ?
'1' :
'0';
720 $framedata .= chr(bindec($incdecflag));
721 $framedata .= chr($source_data_array[
'bitsvolume']);
722 $framedata .=
Helper::BigEndian2String($source_data_array[
'volumechange'][
'right'], ceil($source_data_array[
'bitsvolume'] / 8),
false);
723 $framedata .=
Helper::BigEndian2String($source_data_array[
'volumechange'][
'left'], ceil($source_data_array[
'bitsvolume'] / 8),
false);
724 $framedata .=
Helper::BigEndian2String($source_data_array[
'peakvolume'][
'right'], ceil($source_data_array[
'bitsvolume'] / 8),
false);
725 $framedata .=
Helper::BigEndian2String($source_data_array[
'peakvolume'][
'left'], ceil($source_data_array[
'bitsvolume'] / 8),
false);
726 if ($source_data_array[
'volumechange'][
'rightrear'] || $source_data_array[
'volumechange'][
'leftrear'] ||
727 $source_data_array[
'peakvolume'][
'rightrear'] || $source_data_array[
'peakvolume'][
'leftrear'] ||
728 $source_data_array[
'volumechange'][
'center'] || $source_data_array[
'peakvolume'][
'center'] ||
729 $source_data_array[
'volumechange'][
'bass'] || $source_data_array[
'peakvolume'][
'bass']) {
730 $framedata .=
Helper::BigEndian2String($source_data_array[
'volumechange'][
'rightrear'], ceil($source_data_array[
'bitsvolume']/8),
false);
731 $framedata .=
Helper::BigEndian2String($source_data_array[
'volumechange'][
'leftrear'], ceil($source_data_array[
'bitsvolume']/8),
false);
732 $framedata .=
Helper::BigEndian2String($source_data_array[
'peakvolume'][
'rightrear'], ceil($source_data_array[
'bitsvolume']/8),
false);
733 $framedata .=
Helper::BigEndian2String($source_data_array[
'peakvolume'][
'leftrear'], ceil($source_data_array[
'bitsvolume']/8),
false);
735 if ($source_data_array[
'volumechange'][
'center'] || $source_data_array[
'peakvolume'][
'center'] ||
736 $source_data_array[
'volumechange'][
'bass'] || $source_data_array[
'peakvolume'][
'bass']) {
737 $framedata .=
Helper::BigEndian2String($source_data_array[
'volumechange'][
'center'], ceil($source_data_array[
'bitsvolume']/8),
false);
738 $framedata .=
Helper::BigEndian2String($source_data_array[
'peakvolume'][
'center'], ceil($source_data_array[
'bitsvolume']/8),
false);
740 if ($source_data_array[
'volumechange'][
'bass'] || $source_data_array[
'peakvolume'][
'bass']) {
741 $framedata .=
Helper::BigEndian2String($source_data_array[
'volumechange'][
'bass'], ceil($source_data_array[
'bitsvolume']/8),
false);
742 $framedata .=
Helper::BigEndian2String($source_data_array[
'peakvolume'][
'bass'], ceil($source_data_array[
'bitsvolume']/8),
false);
756 if (($source_data_array[
'interpolationmethod'] < 0) || ($source_data_array[
'interpolationmethod'] > 1)) {
757 $this->errors[] =
'Invalid Interpolation Method byte in '.$frame_name.
' ('.$source_data_array[
'interpolationmethod'].
') (valid = 0 or 1)';
759 $framedata .= chr($source_data_array[
'interpolationmethod']);
760 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'description']).
"\x00";
761 foreach ($source_data_array[
'data'] as $key => $val) {
778 $this->errors[] =
'Invalid Adjustment Bits byte in '.$frame_name.
' ('.$source_data_array[
'bitsvolume'].
') (range = 1 to 255)';
780 $framedata .= chr($source_data_array[
'adjustmentbits']);
781 foreach ($source_data_array as $key => $val) {
782 if ($key !=
'bitsvolume') {
783 if (($key > 32767) || ($key < 0)) {
784 $this->errors[] =
'Invalid Frequency in '.$frame_name.
' ('.$key.
') (range = 0 to 32767)';
811 $this->errors[] =
'Invalid Reverb Left in '.$frame_name.
' ('.$source_data_array[
'left'].
') (range = 0 to 65535)';
812 } elseif (!$this->
IsWithinBitRange($source_data_array[
'right'], 16,
false)) {
813 $this->errors[] =
'Invalid Reverb Left in '.$frame_name.
' ('.$source_data_array[
'right'].
') (range = 0 to 65535)';
814 } elseif (!$this->
IsWithinBitRange($source_data_array[
'bouncesL'], 8,
false)) {
815 $this->errors[] =
'Invalid Reverb Bounces, Left in '.$frame_name.
' ('.$source_data_array[
'bouncesL'].
') (range = 0 to 255)';
816 } elseif (!$this->
IsWithinBitRange($source_data_array[
'bouncesR'], 8,
false)) {
817 $this->errors[] =
'Invalid Reverb Bounces, Right in '.$frame_name.
' ('.$source_data_array[
'bouncesR'].
') (range = 0 to 255)';
818 } elseif (!$this->
IsWithinBitRange($source_data_array[
'feedbackLL'], 8,
false)) {
819 $this->errors[] =
'Invalid Reverb Feedback, Left-To-Left in '.$frame_name.
' ('.$source_data_array[
'feedbackLL'].
') (range = 0 to 255)';
820 } elseif (!$this->
IsWithinBitRange($source_data_array[
'feedbackLR'], 8,
false)) {
821 $this->errors[] =
'Invalid Reverb Feedback, Left-To-Right in '.$frame_name.
' ('.$source_data_array[
'feedbackLR'].
') (range = 0 to 255)';
822 } elseif (!$this->
IsWithinBitRange($source_data_array[
'feedbackRR'], 8,
false)) {
823 $this->errors[] =
'Invalid Reverb Feedback, Right-To-Right in '.$frame_name.
' ('.$source_data_array[
'feedbackRR'].
') (range = 0 to 255)';
824 } elseif (!$this->
IsWithinBitRange($source_data_array[
'feedbackRL'], 8,
false)) {
825 $this->errors[] =
'Invalid Reverb Feedback, Right-To-Left in '.$frame_name.
' ('.$source_data_array[
'feedbackRL'].
') (range = 0 to 255)';
826 } elseif (!$this->
IsWithinBitRange($source_data_array[
'premixLR'], 8,
false)) {
827 $this->errors[] =
'Invalid Premix, Left-To-Right in '.$frame_name.
' ('.$source_data_array[
'premixLR'].
') (range = 0 to 255)';
828 } elseif (!$this->
IsWithinBitRange($source_data_array[
'premixRL'], 8,
false)) {
829 $this->errors[] =
'Invalid Premix, Right-To-Left in '.$frame_name.
' ('.$source_data_array[
'premixRL'].
') (range = 0 to 255)';
833 $framedata .= chr($source_data_array[
'bouncesL']);
834 $framedata .= chr($source_data_array[
'bouncesR']);
835 $framedata .= chr($source_data_array[
'feedbackLL']);
836 $framedata .= chr($source_data_array[
'feedbackLR']);
837 $framedata .= chr($source_data_array[
'feedbackRR']);
838 $framedata .= chr($source_data_array[
'feedbackRL']);
839 $framedata .= chr($source_data_array[
'premixLR']);
840 $framedata .= chr($source_data_array[
'premixRL']);
851 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
853 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
855 $this->errors[] =
'Invalid Picture Type byte in '.$frame_name.
' ('.$source_data_array[
'picturetypeid'].
') for ID3v2.'.$this->majorversion;
857 $this->errors[] =
'Invalid MIME Type in '.$frame_name.
' ('.$source_data_array[
'mime'].
') for ID3v2.'.$this->majorversion;
858 } elseif (($source_data_array[
'mime'] ==
'-->') && (!$this->
IsValidURL($source_data_array[
'data'],
false,
false))) {
861 $this->warnings[] =
'Invalid URL in '.$frame_name.
' ('.$source_data_array[
'data'].
')';
863 $framedata .= chr($source_data_array[
'encodingid']);
864 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'mime']).
"\x00";
865 $framedata .= chr($source_data_array[
'picturetypeid']);
866 $framedata .= (!empty($source_data_array[
'description']) ? $source_data_array[
'description'] :
'').Tag\
Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
867 $framedata .= $source_data_array[
'data'];
878 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
880 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
882 $this->errors[] =
'Invalid MIME Type in '.$frame_name.
' ('.$source_data_array[
'mime'].
')';
883 } elseif (!$source_data_array[
'description']) {
884 $this->errors[] =
'Missing Description in '.$frame_name;
886 $framedata .= chr($source_data_array[
'encodingid']);
887 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'mime']).
"\x00";
888 $framedata .= $source_data_array[
'filename'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
889 $framedata .= $source_data_array[
'description'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
890 $framedata .= $source_data_array[
'data'];
910 $this->errors[] =
'Invalid Rating byte in '.$frame_name.
' ('.$source_data_array[
'rating'].
') (range = 0 to 255)';
911 } elseif (!IsValidEmail($source_data_array[
'email'])) {
912 $this->errors[] =
'Invalid Email in '.$frame_name.
' ('.$source_data_array[
'email'].
')';
914 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'email']).
"\x00";
915 $framedata .= chr($source_data_array[
'rating']);
925 if (!$this->
IsWithinBitRange($source_data_array[
'buffersize'], 24,
false)) {
926 $this->errors[] =
'Invalid Buffer Size in '.$frame_name;
927 } elseif (!$this->
IsWithinBitRange($source_data_array[
'nexttagoffset'], 32,
false)) {
928 $this->errors[] =
'Invalid Offset To Next Tag in '.$frame_name;
932 $flag .= $source_data_array[
'flags'][
'embededinfo'] ?
'1' :
'0';
933 $framedata .= chr(bindec($flag));
944 if (!$this->
IsWithinBitRange($source_data_array[
'previewstart'], 16,
false)) {
945 $this->errors[] =
'Invalid Preview Start in '.$frame_name.
' ('.$source_data_array[
'previewstart'].
')';
946 } elseif (!$this->
IsWithinBitRange($source_data_array[
'previewlength'], 16,
false)) {
947 $this->errors[] =
'Invalid Preview Length in '.$frame_name.
' ('.$source_data_array[
'previewlength'].
')';
949 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'ownerid']).
"\x00";
952 $framedata .= $source_data_array[
'encryptioninfo'];
962 $this->errors[] =
'Invalid Frame Identifier in '.$frame_name.
' ('.$source_data_array[
'frameid'].
')';
963 } elseif (!$this->
IsValidURL($source_data_array[
'data'],
true,
false)) {
966 $this->warnings[] =
'Invalid URL in '.$frame_name.
' ('.$source_data_array[
'data'].
')';
967 } elseif ((($source_data_array[
'frameid'] ==
'AENC') || ($source_data_array[
'frameid'] ==
'APIC') || ($source_data_array[
'frameid'] ==
'GEOB') || ($source_data_array[
'frameid'] ==
'TXXX')) && ($source_data_array[
'additionaldata'] ==
'')) {
968 $this->errors[] =
'Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array[
'frameid'].
' in '.$frame_name;
969 } elseif (($source_data_array[
'frameid'] ==
'USER') && (Tag\
Id3v2::LanguageLookup($source_data_array[
'additionaldata'],
true) ==
'')) {
970 $this->errors[] =
'Language must be specified as additional data for Frame Identifier of '.$source_data_array[
'frameid'].
' in '.$frame_name;
971 } elseif (($source_data_array[
'frameid'] ==
'PRIV') && ($source_data_array[
'additionaldata'] ==
'')) {
972 $this->errors[] =
'Owner Identifier must be specified as additional data for Frame Identifier of '.$source_data_array[
'frameid'].
' in '.$frame_name;
973 } elseif ((($source_data_array[
'frameid'] ==
'COMM') || ($source_data_array[
'frameid'] ==
'SYLT') || ($source_data_array[
'frameid'] ==
'USLT')) && ((Tag\
Id3v2::LanguageLookup(substr($source_data_array[
'additionaldata'], 0, 3),
true) ==
'') || (substr($source_data_array[
'additionaldata'], 3) ==
''))) {
974 $this->errors[] =
'Language followed by Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array[
'frameid'].
' in '.$frame_name;
976 $framedata .= $source_data_array[
'frameid'];
977 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'data']).
"\x00";
978 switch ($source_data_array[
'frameid']) {
988 $framedata .= $source_data_array[
'additionaldata'];
1005 if ($this->majorversion == 3) {
1008 $this->errors[] = $source_data_array[
'frameid'].
' is not a valid Frame Identifier in '.$frame_name.
' (in ID3v2.'.$this->majorversion.
')';
1012 if ((substr($source_data_array[
'frameid'], 0, 1) ==
'T') || (substr($source_data_array[
'frameid'], 0, 1) ==
'W')) {
1015 $this->errors[] = $source_data_array[
'frameid'].
' is not a valid Frame Identifier in '.$frame_name.
' (in ID3v2.'.$this->majorversion.
')';
1026 if (($source_data_array[
'timestampformat'] < 1) || ($source_data_array[
'timestampformat'] > 2)) {
1027 $this->errors[] =
'Invalid Time Stamp Format in '.$frame_name.
' ('.$source_data_array[
'timestampformat'].
') (valid = 1 or 2)';
1028 } elseif (!$this->
IsWithinBitRange($source_data_array[
'position'], 32,
false)) {
1029 $this->errors[] =
'Invalid Position in '.$frame_name.
' ('.$source_data_array[
'position'].
') (range = 0 to 4294967295)';
1031 $framedata .= chr($source_data_array[
'timestampformat']);
1041 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
1043 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
')';
1045 $this->errors[] =
'Invalid Language in '.$frame_name.
' ('.$source_data_array[
'language'].
')';
1047 $framedata .= chr($source_data_array[
'encodingid']);
1048 $framedata .= strtolower($source_data_array[
'language']);
1049 $framedata .= $source_data_array[
'data'];
1059 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
1061 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
')';
1062 } elseif (!$this->
IsANumber($source_data_array[
'pricepaid'][
'value'],
false)) {
1063 $this->errors[] =
'Invalid Price Paid in '.$frame_name.
' ('.$source_data_array[
'pricepaid'][
'value'].
')';
1065 $this->errors[] =
'Invalid Date Of Purchase in '.$frame_name.
' ('.$source_data_array[
'purchasedate'].
') (format = YYYYMMDD)';
1067 $framedata .= chr($source_data_array[
'encodingid']);
1068 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'pricepaid'][
'value']).
"\x00";
1069 $framedata .= $source_data_array[
'purchasedate'];
1070 $framedata .= $source_data_array[
'seller'];
1085 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
1087 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
')';
1089 $this->errors[] =
'Invalid Valid Until date in '.$frame_name.
' ('.$source_data_array[
'pricevaliduntil'].
') (format = YYYYMMDD)';
1090 } elseif (!$this->
IsValidURL($source_data_array[
'contacturl'],
false,
true)) {
1091 $this->errors[] =
'Invalid Contact URL in '.$frame_name.
' ('.$source_data_array[
'contacturl'].
') (allowed schemes: http, https, ftp, mailto)';
1093 $this->errors[] =
'Invalid Received As byte in '.$frame_name.
' ('.$source_data_array[
'contacturl'].
') (range = 0 to 8)';
1095 $this->errors[] =
'Invalid MIME Type in '.$frame_name.
' ('.$source_data_array[
'mime'].
')';
1097 $framedata .= chr($source_data_array[
'encodingid']);
1098 unset($pricestring);
1099 foreach ($source_data_array[
'price'] as $key => $val) {
1101 $pricestrings[] = $key.$val[
'value'];
1103 $this->errors[] =
'Invalid Price String in '.$frame_name.
' ('.$key.$val[
'value'].
')';
1106 $framedata .= implode(
'/', $pricestrings);
1107 $framedata .= $source_data_array[
'pricevaliduntil'];
1108 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'contacturl']).
"\x00";
1109 $framedata .= chr($source_data_array[
'receivedasid']);
1110 $framedata .= $source_data_array[
'sellername'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
1111 $framedata .= $source_data_array[
'description'].Tag\Id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
1112 $framedata .= $source_data_array[
'mime'].
"\x00";
1113 $framedata .= $source_data_array[
'logo'];
1122 if (!$this->
IsWithinBitRange($source_data_array[
'methodsymbol'], 8,
false)) {
1123 $this->errors[] =
'Invalid Group Symbol in '.$frame_name.
' ('.$source_data_array[
'methodsymbol'].
') (range = 0 to 255)';
1125 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'ownerid']).
"\x00";
1126 $framedata .= ord($source_data_array[
'methodsymbol']);
1127 $framedata .= $source_data_array[
'data'];
1136 if (!$this->
IsWithinBitRange($source_data_array[
'groupsymbol'], 8,
false)) {
1137 $this->errors[] =
'Invalid Group Symbol in '.$frame_name.
' ('.$source_data_array[
'groupsymbol'].
') (range = 0 to 255)';
1139 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'ownerid']).
"\x00";
1140 $framedata .= ord($source_data_array[
'groupsymbol']);
1141 $framedata .= $source_data_array[
'data'];
1149 $framedata .= str_replace(
"\x00",
'', $source_data_array[
'ownerid']).
"\x00";
1150 $framedata .= $source_data_array[
'data'];
1157 if (!$this->
IsWithinBitRange($source_data_array[
'groupsymbol'], 8,
false)) {
1158 $this->errors[] =
'Invalid Group Symbol in '.$frame_name.
' ('.$source_data_array[
'groupsymbol'].
') (range = 0 to 255)';
1160 $framedata .= ord($source_data_array[
'groupsymbol']);
1161 $framedata .= $source_data_array[
'data'];
1169 $this->errors[] =
'Invalid Minimum Offset in '.$frame_name.
' ('.$source_data_array[
'data'].
') (range = 0 to 4294967295)';
1183 if (!$this->
IsWithinBitRange($source_data_array[
'datastart'], 32,
false)) {
1184 $this->errors[] =
'Invalid Indexed Data Start in '.$frame_name.
' ('.$source_data_array[
'datastart'].
') (range = 0 to 4294967295)';
1185 } elseif (!$this->
IsWithinBitRange($source_data_array[
'datalength'], 32,
false)) {
1186 $this->errors[] =
'Invalid Indexed Data Length in '.$frame_name.
' ('.$source_data_array[
'datalength'].
') (range = 0 to 4294967295)';
1187 } elseif (!$this->
IsWithinBitRange($source_data_array[
'indexpoints'], 16,
false)) {
1188 $this->errors[] =
'Invalid Number Of Index Points in '.$frame_name.
' ('.$source_data_array[
'indexpoints'].
') (range = 0 to 65535)';
1189 } elseif (!$this->
IsWithinBitRange($source_data_array[
'bitsperpoint'], 8,
false)) {
1190 $this->errors[] =
'Invalid Bits Per Index Point in '.$frame_name.
' ('.$source_data_array[
'bitsperpoint'].
') (range = 0 to 255)';
1191 } elseif ($source_data_array[
'indexpoints'] != count($source_data_array[
'indexes'])) {
1192 $this->errors[] =
'Number Of Index Points does not match actual supplied data in '.$frame_name;
1198 foreach ($source_data_array[
'indexes'] as $key => $val) {
1215 if (($source_data_array[
'track_adjustment'] > 51) || ($source_data_array[
'track_adjustment'] < -51)) {
1216 $this->errors[] =
'Invalid Track Adjustment in '.$frame_name.
' ('.$source_data_array[
'track_adjustment'].
') (range = -51.0 to +51.0)';
1217 } elseif (($source_data_array[
'album_adjustment'] > 51) || ($source_data_array[
'album_adjustment'] < -51)) {
1218 $this->errors[] =
'Invalid Album Adjustment in '.$frame_name.
' ('.$source_data_array[
'album_adjustment'].
') (range = -51.0 to +51.0)';
1220 $this->errors[] =
'Invalid Track Name Code in '.$frame_name.
' ('.$source_data_array[
'raw'][
'track_name'].
') (range = 0 to 2)';
1222 $this->errors[] =
'Invalid Album Name Code in '.$frame_name.
' ('.$source_data_array[
'raw'][
'album_name'].
') (range = 0 to 2)';
1224 $this->errors[] =
'Invalid Track Originator Code in '.$frame_name.
' ('.$source_data_array[
'raw'][
'track_originator'].
') (range = 0 to 3)';
1226 $this->errors[] =
'Invalid Album Originator Code in '.$frame_name.
' ('.$source_data_array[
'raw'][
'album_originator'].
') (range = 0 to 3)';
1229 $framedata .=
Helper::RGADgainString($source_data_array[
'raw'][
'track_name'], $source_data_array[
'raw'][
'track_originator'], $source_data_array[
'track_adjustment']);
1230 $framedata .=
Helper::RGADgainString($source_data_array[
'raw'][
'album_name'], $source_data_array[
'raw'][
'album_originator'], $source_data_array[
'album_adjustment']);
1235 if ((($this->majorversion == 2) && (strlen($frame_name) != 3)) || (($this->majorversion > 2) && (strlen($frame_name) != 4))) {
1236 $this->errors[] =
'Invalid frame name "'.$frame_name.
'" for ID3v2.'.$this->majorversion;
1237 } elseif ($frame_name{0} ==
'T') {
1241 $source_data_array[
'encodingid'] = (isset($source_data_array[
'encodingid']) ? $source_data_array[
'encodingid'] : $this->id3v2_default_encodingid);
1243 $this->errors[] =
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.$this->majorversion;
1245 $framedata .= chr($source_data_array[
'encodingid']);
1246 $framedata .= $source_data_array[
'data'];
1248 } elseif ($frame_name{0} ==
'W') {
1251 if (!$this->
IsValidURL($source_data_array[
'data'],
false,
false)) {
1254 $this->warnings[] =
'Invalid URL in '.$frame_name.
' ('.$source_data_array[
'data'].
')';
1256 $framedata .= $source_data_array[
'data'];
1259 $this->errors[] = $frame_name.
' not yet supported in $this->GenerateID3v2FrameData()';
1264 if (!empty($this->errors)) {
1273 static $PreviousFrames =
array();
1275 if ($frame_name === null) {
1278 $PreviousFrames =
array();
1283 if ($this->majorversion == 4) {
1284 switch ($frame_name) {
1289 if (!isset($source_data_array[
'ownerid'])) {
1290 $this->errors[] =
'[ownerid] not specified for '.$frame_name;
1291 } elseif (in_array($frame_name.$source_data_array[
'ownerid'], $PreviousFrames)) {
1292 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same OwnerID ('.$source_data_array[
'ownerid'].
')';
1294 $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'];
1304 if (!isset($source_data_array[
'description'])) {
1305 $this->errors[] =
'[description] not specified for '.$frame_name;
1306 } elseif (in_array($frame_name.$source_data_array[
'description'], $PreviousFrames)) {
1307 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Description ('.$source_data_array[
'description'].
')';
1309 $PreviousFrames[] = $frame_name.$source_data_array[
'description'];
1314 if (!isset($source_data_array[
'language'])) {
1315 $this->errors[] =
'[language] not specified for '.$frame_name;
1316 } elseif (in_array($frame_name.$source_data_array[
'language'], $PreviousFrames)) {
1317 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Language ('.$source_data_array[
'language'].
')';
1319 $PreviousFrames[] = $frame_name.$source_data_array[
'language'];
1326 if (!isset($source_data_array[
'language'])) {
1327 $this->errors[] =
'[language] not specified for '.$frame_name;
1328 } elseif (!isset($source_data_array[
'description'])) {
1329 $this->errors[] =
'[description] not specified for '.$frame_name;
1330 } elseif (in_array($frame_name.$source_data_array[
'language'].$source_data_array[
'description'], $PreviousFrames)) {
1331 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Language + Description ('.$source_data_array[
'language'].
' + '.$source_data_array[
'description'].
')';
1333 $PreviousFrames[] = $frame_name.$source_data_array[
'language'].$source_data_array[
'description'];
1338 if (!isset($source_data_array[
'email'])) {
1339 $this->errors[] =
'[email] not specified for '.$frame_name;
1340 } elseif (in_array($frame_name.$source_data_array[
'email'], $PreviousFrames)) {
1341 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Email ('.$source_data_array[
'email'].
')';
1343 $PreviousFrames[] = $frame_name.$source_data_array[
'email'];
1360 if (in_array($frame_name, $PreviousFrames)) {
1361 $this->errors[] =
'Only one '.$frame_name.
' tag allowed';
1363 $PreviousFrames[] = $frame_name;
1370 if (!isset($source_data_array[
'frameid'])) {
1371 $this->errors[] =
'[frameid] not specified for '.$frame_name;
1372 } elseif (in_array($frame_name.$source_data_array[
'frameid'], $PreviousFrames)) {
1373 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same FrameID ('.$source_data_array[
'frameid'].
')';
1374 } elseif (in_array($source_data_array[
'frameid'], $PreviousFrames)) {
1376 $this->errors[] =
'Cannot specify a '.$frame_name.
' tag to a singleton tag that already exists ('.$source_data_array[
'frameid'].
')';
1378 $PreviousFrames[] = $frame_name.$source_data_array[
'frameid'];
1379 $PreviousFrames[] = $source_data_array[
'frameid'];
1390 if (!isset($source_data_array[
'ownerid'])) {
1391 $this->errors[] =
'[ownerid] not specified for '.$frame_name;
1392 } elseif (!isset($source_data_array[
'data'])) {
1393 $this->errors[] =
'[data] not specified for '.$frame_name;
1394 } elseif (in_array($frame_name.$source_data_array[
'ownerid'].$source_data_array[
'data'], $PreviousFrames)) {
1395 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same OwnerID + Data ('.$source_data_array[
'ownerid'].
' + '.$source_data_array[
'data'].
')';
1397 $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'].$source_data_array[
'data'];
1402 if (($frame_name{0} !=
'T') && ($frame_name{0} !=
'W')) {
1403 $this->errors[] =
'Frame not allowed in ID3v2.'.$this->majorversion.
': '.$frame_name;
1408 } elseif ($this->majorversion == 3) {
1410 switch ($frame_name) {
1415 if (!isset($source_data_array[
'ownerid'])) {
1416 $this->errors[] =
'[ownerid] not specified for '.$frame_name;
1417 } elseif (in_array($frame_name.$source_data_array[
'ownerid'], $PreviousFrames)) {
1418 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same OwnerID ('.$source_data_array[
'ownerid'].
')';
1420 $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'];
1428 if (!isset($source_data_array[
'description'])) {
1429 $this->errors[] =
'[description] not specified for '.$frame_name;
1430 } elseif (in_array($frame_name.$source_data_array[
'description'], $PreviousFrames)) {
1431 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Description ('.$source_data_array[
'description'].
')';
1433 $PreviousFrames[] = $frame_name.$source_data_array[
'description'];
1438 if (!isset($source_data_array[
'language'])) {
1439 $this->errors[] =
'[language] not specified for '.$frame_name;
1440 } elseif (in_array($frame_name.$source_data_array[
'language'], $PreviousFrames)) {
1441 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Language ('.$source_data_array[
'language'].
')';
1443 $PreviousFrames[] = $frame_name.$source_data_array[
'language'];
1450 if (!isset($source_data_array[
'language'])) {
1451 $this->errors[] =
'[language] not specified for '.$frame_name;
1452 } elseif (!isset($source_data_array[
'description'])) {
1453 $this->errors[] =
'[description] not specified for '.$frame_name;
1454 } elseif (in_array($frame_name.$source_data_array[
'language'].$source_data_array[
'description'], $PreviousFrames)) {
1455 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Language + Description ('.$source_data_array[
'language'].
' + '.$source_data_array[
'description'].
')';
1457 $PreviousFrames[] = $frame_name.$source_data_array[
'language'].$source_data_array[
'description'];
1462 if (!isset($source_data_array[
'email'])) {
1463 $this->errors[] =
'[email] not specified for '.$frame_name;
1464 } elseif (in_array($frame_name.$source_data_array[
'email'], $PreviousFrames)) {
1465 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Email ('.$source_data_array[
'email'].
')';
1467 $PreviousFrames[] = $frame_name.$source_data_array[
'email'];
1484 if (in_array($frame_name, $PreviousFrames)) {
1485 $this->errors[] =
'Only one '.$frame_name.
' tag allowed';
1487 $PreviousFrames[] = $frame_name;
1494 if (!isset($source_data_array[
'frameid'])) {
1495 $this->errors[] =
'[frameid] not specified for '.$frame_name;
1496 } elseif (in_array($frame_name.$source_data_array[
'frameid'], $PreviousFrames)) {
1497 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same FrameID ('.$source_data_array[
'frameid'].
')';
1498 } elseif (in_array($source_data_array[
'frameid'], $PreviousFrames)) {
1500 $this->errors[] =
'Cannot specify a '.$frame_name.
' tag to a singleton tag that already exists ('.$source_data_array[
'frameid'].
')';
1502 $PreviousFrames[] = $frame_name.$source_data_array[
'frameid'];
1503 $PreviousFrames[] = $source_data_array[
'frameid'];
1513 if (!isset($source_data_array[
'ownerid'])) {
1514 $this->errors[] =
'[ownerid] not specified for '.$frame_name;
1515 } elseif (!isset($source_data_array[
'data'])) {
1516 $this->errors[] =
'[data] not specified for '.$frame_name;
1517 } elseif (in_array($frame_name.$source_data_array[
'ownerid'].$source_data_array[
'data'], $PreviousFrames)) {
1518 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same OwnerID + Data ('.$source_data_array[
'ownerid'].
' + '.$source_data_array[
'data'].
')';
1520 $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'].$source_data_array[
'data'];
1525 if (($frame_name{0} !=
'T') && ($frame_name{0} !=
'W')) {
1526 $this->errors[] =
'Frame not allowed in ID3v2.'.$this->majorversion.
': '.$frame_name;
1531 } elseif ($this->majorversion == 2) {
1533 switch ($frame_name) {
1537 if (!isset($source_data_array[
'ownerid'])) {
1538 $this->errors[] =
'[ownerid] not specified for '.$frame_name;
1539 } elseif (in_array($frame_name.$source_data_array[
'ownerid'], $PreviousFrames)) {
1540 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same OwnerID ('.$source_data_array[
'ownerid'].
')';
1542 $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'];
1550 if (!isset($source_data_array[
'description'])) {
1551 $this->errors[] =
'[description] not specified for '.$frame_name;
1552 } elseif (in_array($frame_name.$source_data_array[
'description'], $PreviousFrames)) {
1553 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Description ('.$source_data_array[
'description'].
')';
1555 $PreviousFrames[] = $frame_name.$source_data_array[
'description'];
1562 if (!isset($source_data_array[
'language'])) {
1563 $this->errors[] =
'[language] not specified for '.$frame_name;
1564 } elseif (!isset($source_data_array[
'description'])) {
1565 $this->errors[] =
'[description] not specified for '.$frame_name;
1566 } elseif (in_array($frame_name.$source_data_array[
'language'].$source_data_array[
'description'], $PreviousFrames)) {
1567 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Language + Description ('.$source_data_array[
'language'].
' + '.$source_data_array[
'description'].
')';
1569 $PreviousFrames[] = $frame_name.$source_data_array[
'language'].$source_data_array[
'description'];
1574 if (!isset($source_data_array[
'email'])) {
1575 $this->errors[] =
'[email] not specified for '.$frame_name;
1576 } elseif (in_array($frame_name.$source_data_array[
'email'], $PreviousFrames)) {
1577 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same Email ('.$source_data_array[
'email'].
')';
1579 $PreviousFrames[] = $frame_name.$source_data_array[
'email'];
1593 if (in_array($frame_name, $PreviousFrames)) {
1594 $this->errors[] =
'Only one '.$frame_name.
' tag allowed';
1596 $PreviousFrames[] = $frame_name;
1603 if (!isset($source_data_array[
'frameid'])) {
1604 $this->errors[] =
'[frameid] not specified for '.$frame_name;
1605 } elseif (in_array($frame_name.$source_data_array[
'frameid'], $PreviousFrames)) {
1606 $this->errors[] =
'Only one '.$frame_name.
' tag allowed with the same FrameID ('.$source_data_array[
'frameid'].
')';
1607 } elseif (in_array($source_data_array[
'frameid'], $PreviousFrames)) {
1609 $this->errors[] =
'Cannot specify a '.$frame_name.
' tag to a singleton tag that already exists ('.$source_data_array[
'frameid'].
')';
1611 $PreviousFrames[] = $frame_name.$source_data_array[
'frameid'];
1612 $PreviousFrames[] = $source_data_array[
'frameid'];
1617 if (($frame_name{0} !=
'T') && ($frame_name{0} !=
'W')) {
1618 $this->errors[] =
'Frame not allowed in ID3v2.'.$this->majorversion.
': '.$frame_name;
1624 if (!empty($this->errors)) {
1641 if (is_array($this->tag_data)) {
1642 foreach ($this->tag_data as $frame_name => $frame_rawinputdata) {
1643 foreach ($frame_rawinputdata as $irrelevantindex => $source_data_array) {
1645 unset($frame_length);
1646 unset($frame_flags);
1647 $frame_data =
false;
1650 $FrameUnsynchronisation =
false;
1651 if ($this->majorversion >= 4) {
1653 $unsynchdata = $frame_data;
1654 if ($this->id3v2_use_unsynchronisation) {
1657 if (strlen($unsynchdata) != strlen($frame_data)) {
1659 $FrameUnsynchronisation =
true;
1660 $frame_data = $unsynchdata;
1661 if (isset($TagUnsynchronisation) && $TagUnsynchronisation ===
false) {
1664 $TagUnsynchronisation =
true;
1667 if (isset($TagUnsynchronisation)) {
1668 $TagUnsynchronisation =
false;
1671 unset($unsynchdata);
1680 $this->errors[] =
'Frame "'.$frame_name.
'" is NOT allowed';
1682 if ($frame_data ===
false) {
1683 $this->errors[] =
'$this->GenerateID3v2FrameData() failed for "'.$frame_name.
'"';
1684 if ($noerrorsonly) {
1692 $this->warnings[] =
'Ignoring invalid ID3v2 frame type: "'.$frame_name.
'"';
1694 unset($frame_length);
1695 unset($frame_flags);
1698 if (isset($frame_name) && isset($frame_length) && isset($frame_flags) && isset($frame_data)) {
1699 $tagstring .= $frame_name.$frame_length.$frame_flags.$frame_data;
1704 if (!isset($TagUnsynchronisation)) {
1705 $TagUnsynchronisation =
false;
1707 if (($this->majorversion <= 3) && $this->id3v2_use_unsynchronisation) {
1710 if (strlen($unsynchdata) != strlen($tagstring)) {
1712 $TagUnsynchronisation =
true;
1713 $tagstring = $unsynchdata;
1718 $this->paddedlength += 1024;
1722 if (!$footer && ($this->paddedlength > (strlen($tagstring) + Tag\
Id3v2::ID3v2HeaderLength($this->majorversion)))) {
1726 $tagstring .= str_repeat(
"\x00", $this->paddedlength - strlen($tagstring) - Tag\
Id3v2::ID3v2HeaderLength($this->majorversion));
1729 if ($this->id3v2_use_unsynchronisation && (substr($tagstring, strlen($tagstring) - 1, 1) ==
"\xFF")) {
1732 $TagUnsynchronisation =
true;
1733 $tagstring .=
"\x00";
1737 $tagheader .= chr($this->majorversion);
1738 $tagheader .= chr($this->minorversion);
1742 return $tagheader.$tagstring;
1744 $this->errors[] =
'tag_data is not an array in GenerateID3v2Tag()';
1758 } elseif (!$this->
IsANumber(substr($pricestring, 3),
true)) {
1773 switch ($framename) {
1792 switch ($framename) {
1810 if (($eventid < 0) || ($eventid > 0xFF)) {
1813 } elseif (($eventid >= 0xF0) && ($eventid <= 0xFC)) {
1816 } elseif (($eventid >= 0x17) && ($eventid <= 0xDF)) {
1819 } elseif (($eventid >= 0x0E) && ($eventid <= 0x16) && ($this->majorversion == 2)) {
1822 } elseif (($eventid >= 0x15) && ($eventid <= 0x16) && ($this->majorversion == 3)) {
1837 if (($contenttype >= 0) && ($contenttype <= 8) && ($this->majorversion == 4)) {
1839 } elseif (($contenttype >= 0) && ($contenttype <= 6) && ($this->majorversion == 3)) {
1853 if (($channeltype >= 0) && ($channeltype <= 8) && ($this->majorversion == 4)) {
1867 if (($picturetype >= 0) && ($picturetype <= 0x14) && ($this->majorversion >= 2) && ($this->majorversion <= 4)) {
1881 if ($imageformat ==
'-->') {
1883 } elseif ($this->majorversion == 2) {
1884 if ((strlen($imageformat) == 3) && ($imageformat == strtoupper($imageformat))) {
1887 } elseif (($this->majorversion == 3) || ($this->majorversion == 4)) {
1903 if (($this->majorversion >= 3) && ($receivedas >= 0) && ($receivedas <= 8)) {
1917 if (($RGADname >= 0) && ($RGADname <= 2)) {
1931 if (($RGADoriginator >= 0) && ($RGADoriginator <= 3)) {
1946 static $ID3v2IsValidTextEncoding_cache =
array(
1947 2 =>
array(
true,
true),
1948 3 =>
array(
true,
true),
1949 4 =>
array(
true,
true,
true,
true));
1951 return isset($ID3v2IsValidTextEncoding_cache[$this->majorversion][$textencodingbyte]);
1973 $data = str_replace(
"\xFF\x00",
"\xFF\x00\x00",
$data);
1974 $unsyncheddata =
'';
1975 $datalength = strlen(
$data);
1976 for ($i = 0; $i < $datalength; $i++) {
1977 $thischar =
$data{$i};
1978 $unsyncheddata .= $thischar;
1979 if ($thischar ==
"\xFF") {
1980 $nextchar = ord(
$data{$i + 1});
1981 if (($nextchar & 0xE0) == 0xE0) {
1983 $unsyncheddata .=
"\x00";
1988 return $unsyncheddata;
2000 if (is_array($var)) {
2001 $keys = array_keys($var);
2003 for ($i = 0; $i < count($keys); $i++) {
2004 if (is_string($keys[$i])) {
2023 if (is_array($arr1) && is_array($arr2)) {
2025 $new_array =
array();
2029 $keys = array_merge(array_keys($arr1), array_keys($arr2));
2030 foreach ($keys as $key) {
2031 $new_array[$key] = $this->
array_join_merge((isset($arr1[$key]) ? $arr1[$key] :
''), (isset($arr2[$key]) ? $arr2[$key] :
''));
2035 $new_array = array_reverse(array_unique(array_reverse(array_merge($arr1, $arr2))));
2041 return $arr2 ? $arr2 : $arr1;
2052 if ((strlen($mimestring) >= 3) && (strpos($mimestring,
'/') > 0) && (strpos($mimestring,
'/') < (strlen($mimestring) - 1))) {
2069 if (($number > (0 - pow(2, $maxbits - 1))) && ($number <= pow(2, $maxbits - 1))) {
2073 if (($number >= 0) && ($number <= pow(2, $maxbits))) {
2088 $parts = @parse_url(
$url);
2089 $parts[
'scheme'] = (isset($parts[
'scheme']) ? $parts[
'scheme'] :
'');
2090 $parts[
'host'] = (isset($parts[
'host']) ? $parts[
'host'] :
'');
2091 $parts[
'user'] = (isset($parts[
'user']) ? $parts[
'user'] :
'');
2092 $parts[
'pass'] = (isset($parts[
'pass']) ? $parts[
'pass'] :
'');
2093 $parts[
'path'] = (isset($parts[
'path']) ? $parts[
'path'] :
'');
2094 $parts[
'query'] = (isset($parts[
'query']) ? $parts[
'query'] :
'');
2110 if ($allowUserPass !==
true) {
2111 if (strstr(
$url,
'@')) {
2118 if (($parts[
'scheme'] !=
'http') && ($parts[
'scheme'] !=
'https') && ($parts[
'scheme'] !=
'ftp') && ($parts[
'scheme'] !=
'gopher')) {
2120 } elseif (!preg_match(
'#^[[:alnum:]]([-.]?[0-9a-z])*\\.[a-z]{2,3}$#i', $parts[
'host'], $regs) && !preg_match(
'#^[0-9]{1,3}(\\.[0-9]{1,3}){3}$#', $parts[
'host'])) {
2122 } elseif (!preg_match(
'#^([[:alnum:]-]|[\\_])*$#i', $parts[
'user'], $regs)) {
2124 } elseif (!preg_match(
'#^([[:alnum:]-]|[\\_])*$#i', $parts[
'pass'], $regs)) {
2126 } elseif (!preg_match(
'#^[[:alnum:]/_\\.@~-]*$#i', $parts[
'path'], $regs)) {
2128 } elseif (!empty($parts[
'query']) && !preg_match(
'#^[[:alnum:]?&=+:;_()%\\#/,\\.-]*$#i', $parts[
'query'], $regs)) {
2147 $long_description = str_replace(
' ',
'_', strtolower(trim($long_description)));
2148 static $ID3v2ShortFrameNameLookup =
array();
2149 if (empty($ID3v2ShortFrameNameLookup)) {
2152 $ID3v2ShortFrameNameLookup[2][
'comment'] =
'COM';
2153 $ID3v2ShortFrameNameLookup[2][
'album'] =
'TAL';
2154 $ID3v2ShortFrameNameLookup[2][
'beats_per_minute'] =
'TBP';
2155 $ID3v2ShortFrameNameLookup[2][
'composer'] =
'TCM';
2156 $ID3v2ShortFrameNameLookup[2][
'genre'] =
'TCO';
2157 $ID3v2ShortFrameNameLookup[2][
'itunescompilation'] =
'TCP';
2158 $ID3v2ShortFrameNameLookup[2][
'copyright'] =
'TCR';
2159 $ID3v2ShortFrameNameLookup[2][
'encoded_by'] =
'TEN';
2160 $ID3v2ShortFrameNameLookup[2][
'language'] =
'TLA';
2161 $ID3v2ShortFrameNameLookup[2][
'length'] =
'TLE';
2162 $ID3v2ShortFrameNameLookup[2][
'original_artist'] =
'TOA';
2163 $ID3v2ShortFrameNameLookup[2][
'original_filename'] =
'TOF';
2164 $ID3v2ShortFrameNameLookup[2][
'original_lyricist'] =
'TOL';
2165 $ID3v2ShortFrameNameLookup[2][
'original_album_title'] =
'TOT';
2166 $ID3v2ShortFrameNameLookup[2][
'artist'] =
'TP1';
2167 $ID3v2ShortFrameNameLookup[2][
'band'] =
'TP2';
2168 $ID3v2ShortFrameNameLookup[2][
'conductor'] =
'TP3';
2169 $ID3v2ShortFrameNameLookup[2][
'remixer'] =
'TP4';
2170 $ID3v2ShortFrameNameLookup[2][
'publisher'] =
'TPB';
2171 $ID3v2ShortFrameNameLookup[2][
'isrc'] =
'TRC';
2172 $ID3v2ShortFrameNameLookup[2][
'tracknumber'] =
'TRK';
2173 $ID3v2ShortFrameNameLookup[2][
'size'] =
'TSI';
2174 $ID3v2ShortFrameNameLookup[2][
'encoder_settings'] =
'TSS';
2175 $ID3v2ShortFrameNameLookup[2][
'description'] =
'TT1';
2176 $ID3v2ShortFrameNameLookup[2][
'title'] =
'TT2';
2177 $ID3v2ShortFrameNameLookup[2][
'subtitle'] =
'TT3';
2178 $ID3v2ShortFrameNameLookup[2][
'lyricist'] =
'TXT';
2179 $ID3v2ShortFrameNameLookup[2][
'user_text'] =
'TXX';
2180 $ID3v2ShortFrameNameLookup[2][
'year'] =
'TYE';
2181 $ID3v2ShortFrameNameLookup[2][
'unique_file_identifier'] =
'UFI';
2182 $ID3v2ShortFrameNameLookup[2][
'unsynchronised_lyrics'] =
'ULT';
2183 $ID3v2ShortFrameNameLookup[2][
'url_file'] =
'WAF';
2184 $ID3v2ShortFrameNameLookup[2][
'url_artist'] =
'WAR';
2185 $ID3v2ShortFrameNameLookup[2][
'url_source'] =
'WAS';
2186 $ID3v2ShortFrameNameLookup[2][
'copyright_information'] =
'WCP';
2187 $ID3v2ShortFrameNameLookup[2][
'url_publisher'] =
'WPB';
2188 $ID3v2ShortFrameNameLookup[2][
'url_user'] =
'WXX';
2191 $ID3v2ShortFrameNameLookup[3][
'audio_encryption'] =
'AENC';
2192 $ID3v2ShortFrameNameLookup[3][
'attached_picture'] =
'APIC';
2193 $ID3v2ShortFrameNameLookup[3][
'comment'] =
'COMM';
2194 $ID3v2ShortFrameNameLookup[3][
'commercial'] =
'COMR';
2195 $ID3v2ShortFrameNameLookup[3][
'encryption_method_registration'] =
'ENCR';
2196 $ID3v2ShortFrameNameLookup[3][
'event_timing_codes'] =
'ETCO';
2197 $ID3v2ShortFrameNameLookup[3][
'general_encapsulated_object'] =
'GEOB';
2198 $ID3v2ShortFrameNameLookup[3][
'group_identification_registration'] =
'GRID';
2199 $ID3v2ShortFrameNameLookup[3][
'linked_information'] =
'LINK';
2200 $ID3v2ShortFrameNameLookup[3][
'music_cd_identifier'] =
'MCDI';
2201 $ID3v2ShortFrameNameLookup[3][
'mpeg_location_lookup_table'] =
'MLLT';
2202 $ID3v2ShortFrameNameLookup[3][
'ownership'] =
'OWNE';
2203 $ID3v2ShortFrameNameLookup[3][
'play_counter'] =
'PCNT';
2204 $ID3v2ShortFrameNameLookup[3][
'popularimeter'] =
'POPM';
2205 $ID3v2ShortFrameNameLookup[3][
'position_synchronisation'] =
'POSS';
2206 $ID3v2ShortFrameNameLookup[3][
'private'] =
'PRIV';
2207 $ID3v2ShortFrameNameLookup[3][
'recommended_buffer_size'] =
'RBUF';
2208 $ID3v2ShortFrameNameLookup[3][
'reverb'] =
'RVRB';
2209 $ID3v2ShortFrameNameLookup[3][
'synchronised_lyrics'] =
'SYLT';
2210 $ID3v2ShortFrameNameLookup[3][
'synchronised_tempo_codes'] =
'SYTC';
2211 $ID3v2ShortFrameNameLookup[3][
'album'] =
'TALB';
2212 $ID3v2ShortFrameNameLookup[3][
'beats_per_minute'] =
'TBPM';
2213 $ID3v2ShortFrameNameLookup[3][
'itunescompilation'] =
'TCMP';
2214 $ID3v2ShortFrameNameLookup[3][
'composer'] =
'TCOM';
2215 $ID3v2ShortFrameNameLookup[3][
'genre'] =
'TCON';
2216 $ID3v2ShortFrameNameLookup[3][
'copyright'] =
'TCOP';
2217 $ID3v2ShortFrameNameLookup[3][
'playlist_delay'] =
'TDLY';
2218 $ID3v2ShortFrameNameLookup[3][
'encoded_by'] =
'TENC';
2219 $ID3v2ShortFrameNameLookup[3][
'lyricist'] =
'TEXT';
2220 $ID3v2ShortFrameNameLookup[3][
'file_type'] =
'TFLT';
2221 $ID3v2ShortFrameNameLookup[3][
'content_group_description'] =
'TIT1';
2222 $ID3v2ShortFrameNameLookup[3][
'title'] =
'TIT2';
2223 $ID3v2ShortFrameNameLookup[3][
'subtitle'] =
'TIT3';
2224 $ID3v2ShortFrameNameLookup[3][
'initial_key'] =
'TKEY';
2225 $ID3v2ShortFrameNameLookup[3][
'language'] =
'TLAN';
2226 $ID3v2ShortFrameNameLookup[3][
'length'] =
'TLEN';
2227 $ID3v2ShortFrameNameLookup[3][
'media_type'] =
'TMED';
2228 $ID3v2ShortFrameNameLookup[3][
'original_album_title'] =
'TOAL';
2229 $ID3v2ShortFrameNameLookup[3][
'original_filename'] =
'TOFN';
2230 $ID3v2ShortFrameNameLookup[3][
'original_lyricist'] =
'TOLY';
2231 $ID3v2ShortFrameNameLookup[3][
'original_artist'] =
'TOPE';
2232 $ID3v2ShortFrameNameLookup[3][
'file_owner'] =
'TOWN';
2233 $ID3v2ShortFrameNameLookup[3][
'artist'] =
'TPE1';
2234 $ID3v2ShortFrameNameLookup[3][
'band'] =
'TPE2';
2235 $ID3v2ShortFrameNameLookup[3][
'conductor'] =
'TPE3';
2236 $ID3v2ShortFrameNameLookup[3][
'remixer'] =
'TPE4';
2237 $ID3v2ShortFrameNameLookup[3][
'part_of_a_set'] =
'TPOS';
2238 $ID3v2ShortFrameNameLookup[3][
'publisher'] =
'TPUB';
2239 $ID3v2ShortFrameNameLookup[3][
'tracknumber'] =
'TRCK';
2240 $ID3v2ShortFrameNameLookup[3][
'internet_radio_station_name'] =
'TRSN';
2241 $ID3v2ShortFrameNameLookup[3][
'internet_radio_station_owner'] =
'TRSO';
2242 $ID3v2ShortFrameNameLookup[3][
'isrc'] =
'TSRC';
2243 $ID3v2ShortFrameNameLookup[3][
'encoder_settings'] =
'TSSE';
2244 $ID3v2ShortFrameNameLookup[3][
'user_text'] =
'TXXX';
2245 $ID3v2ShortFrameNameLookup[3][
'unique_file_identifier'] =
'UFID';
2246 $ID3v2ShortFrameNameLookup[3][
'terms_of_use'] =
'USER';
2247 $ID3v2ShortFrameNameLookup[3][
'unsynchronised_lyrics'] =
'USLT';
2248 $ID3v2ShortFrameNameLookup[3][
'commercial'] =
'WCOM';
2249 $ID3v2ShortFrameNameLookup[3][
'copyright_information'] =
'WCOP';
2250 $ID3v2ShortFrameNameLookup[3][
'url_file'] =
'WOAF';
2251 $ID3v2ShortFrameNameLookup[3][
'url_artist'] =
'WOAR';
2252 $ID3v2ShortFrameNameLookup[3][
'url_source'] =
'WOAS';
2253 $ID3v2ShortFrameNameLookup[3][
'url_station'] =
'WORS';
2254 $ID3v2ShortFrameNameLookup[3][
'payment'] =
'WPAY';
2255 $ID3v2ShortFrameNameLookup[3][
'url_publisher'] =
'WPUB';
2256 $ID3v2ShortFrameNameLookup[3][
'url_user'] =
'WXXX';
2260 $ID3v2ShortFrameNameLookup[4] = $ID3v2ShortFrameNameLookup[3];
2263 $ID3v2ShortFrameNameLookup[3][
'equalisation'] =
'EQUA';
2264 $ID3v2ShortFrameNameLookup[3][
'involved_people_list'] =
'IPLS';
2265 $ID3v2ShortFrameNameLookup[3][
'relative_volume_adjustment'] =
'RVAD';
2266 $ID3v2ShortFrameNameLookup[3][
'date'] =
'TDAT';
2267 $ID3v2ShortFrameNameLookup[3][
'time'] =
'TIME';
2268 $ID3v2ShortFrameNameLookup[3][
'original_release_year'] =
'TORY';
2269 $ID3v2ShortFrameNameLookup[3][
'recording_dates'] =
'TRDA';
2270 $ID3v2ShortFrameNameLookup[3][
'size'] =
'TSIZ';
2271 $ID3v2ShortFrameNameLookup[3][
'year'] =
'TYER';
2274 $ID3v2ShortFrameNameLookup[4][
'audio_seek_point_index'] =
'ASPI';
2275 $ID3v2ShortFrameNameLookup[4][
'equalisation'] =
'EQU2';
2276 $ID3v2ShortFrameNameLookup[4][
'relative_volume_adjustment'] =
'RVA2';
2277 $ID3v2ShortFrameNameLookup[4][
'seek'] =
'SEEK';
2278 $ID3v2ShortFrameNameLookup[4][
'signature'] =
'SIGN';
2279 $ID3v2ShortFrameNameLookup[4][
'encoding_time'] =
'TDEN';
2280 $ID3v2ShortFrameNameLookup[4][
'original_release_time'] =
'TDOR';
2281 $ID3v2ShortFrameNameLookup[4][
'recording_time'] =
'TDRC';
2282 $ID3v2ShortFrameNameLookup[4][
'release_time'] =
'TDRL';
2283 $ID3v2ShortFrameNameLookup[4][
'tagging_time'] =
'TDTG';
2284 $ID3v2ShortFrameNameLookup[4][
'involved_people_list'] =
'TIPL';
2285 $ID3v2ShortFrameNameLookup[4][
'musician_credits_list'] =
'TMCL';
2286 $ID3v2ShortFrameNameLookup[4][
'mood'] =
'TMOO';
2287 $ID3v2ShortFrameNameLookup[4][
'produced_notice'] =
'TPRO';
2288 $ID3v2ShortFrameNameLookup[4][
'album_sort_order'] =
'TSOA';
2289 $ID3v2ShortFrameNameLookup[4][
'performer_sort_order'] =
'TSOP';
2290 $ID3v2ShortFrameNameLookup[4][
'title_sort_order'] =
'TSOT';
2291 $ID3v2ShortFrameNameLookup[4][
'set_subtitle'] =
'TSST';
2294 return (isset($ID3v2ShortFrameNameLookup[
$majorversion][strtolower($long_description)]) ? $ID3v2ShortFrameNameLookup[
$majorversion][strtolower($long_description)] :
'');
static IsValidID3v2FrameName($framename, $id3v2majorversion)
ID3v2IsValidAPICpicturetype($picturetype)
IsWithinBitRange($number, $maxbits, $signed=false)
GenerateID3v2TagFlags($flags)
GenerateID3v2Tag($noerrorsonly=true)
static Float2String($floatvalue, $bits)
static BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false)
static ID3v2ShortFrameNameLookup($majorversion, $long_description)
array $ID3v2ShortFrameNameLookup
$id3v2_default_encodingid
static LanguageLookup($languagecode, $casesensitive=false)
ID3v2IsValidPriceString($pricestring)
ID3v2IsValidCOMRreceivedAs($receivedas)
ID3v2IsValidETCOevent($eventid)
GetId3() by James Heinrich info@getid3.org //.
fseek($bytes, $whence=SEEK_SET)
$id3v2_use_unsynchronisation
ID3v2FrameFlagsLookupFileAlter($framename)
GetId3() by James Heinrich info@getid3.org //.
ID3v2FrameFlagsLookupTagAlter($framename)
static IsValidDateStampString($datestamp)
ID3v2IsValidTextEncoding($textencodingbyte)
array $ID3v2IsValidTextEncoding_cache
static TextEncodingTerminatorLookup($encoding)
array $TextEncodingTerminatorLookup
ID3v2IsValidRVA2channeltype($channeltype)
Create styles array
The data for the language used.
ID3v2IsValidRGADname($RGADname)
GenerateID3v2FrameFlags($TagAlter=false, $FileAlter=false, $ReadOnly=false, $Compression=false, $Encryption=false, $GroupingIdentity=false, $Unsynchronisation=false, $DataLengthIndicator=false)
array_join_merge($arr1, $arr2)
ID3v2IsValidSYLTtype($contenttype)
static RGADgainString($namecode, $originatorcode, $replaygain)
ID3v2FrameIsAllowed($frame_name, $source_data_array)
IsValidURL($url, $allowUserPass=false)
static intValueSupported($num)
null $hasINT64
IsValidMIMEstring($mimestring)
ID3v2IsValidAPICimageformat($imageformat)
GenerateID3v2FrameData($frame_name, $source_data_array)
static IsANumber($numberstring, $allowdecimal=false, $allownegative=false)
static ID3v2HeaderLength($majorversion)
ID3v2IsValidRGADoriginator($RGADoriginator)