41                if (!empty($this->filename) && (is_writeable($this->filename) || (!file_exists($this->filename) && is_writeable(dirname($this->filename))))) {
 
   44                        $OldThisFileInfo = $getID3->
analyze($this->filename);
 
   46                                $this->errors[] = 
'Unable to write ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).
'GB';
 
   50                        if ($this->merge_existing_data) {
 
   52                                if (!empty($OldThisFileInfo[
'id3v2'])) {
 
   53                                        $this->tag_data = $this->
array_join_merge($OldThisFileInfo[
'id3v2'], $this->tag_data);
 
   56                        $this->paddedlength = (isset($OldThisFileInfo[
'id3v2'][
'headerlength']) ? max($OldThisFileInfo[
'id3v2'][
'headerlength'], $this->paddedlength) : 
$this->paddedlength);
 
   60                                if (file_exists($this->filename) && is_writeable($this->filename) && isset($OldThisFileInfo[
'id3v2'][
'headerlength']) && ($OldThisFileInfo[
'id3v2'][
'headerlength'] == strlen($NewID3v2Tag))) {
 
   63                                        if (file_exists($this->filename)) {
 
   65                                                if (is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 
'r+b'))) {
 
   67                                                        fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag));
 
   70                                                        $this->errors[] = 
'Could not fopen("'.$this->filename.
'", "r+b")';
 
   75                                                if (is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 
'wb'))) {
 
   77                                                        fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag));
 
   80                                                        $this->errors[] = 
'Could not fopen("'.$this->filename.
'", "wb")';
 
   87                                        if ($tempfilename = tempnam(GETID3_TEMP_DIR, 
'getID3')) {
 
   88                                                if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 
'rb'))) {
 
   89                                                        if (is_writable($tempfilename) && is_file($tempfilename) && ($fp_temp = fopen($tempfilename, 
'wb'))) {
 
   91                                                                fwrite($fp_temp, $NewID3v2Tag, strlen($NewID3v2Tag));
 
   94                                                                if (!empty($OldThisFileInfo[
'avdataoffset'])) {
 
   95                                                                        fseek($fp_source, $OldThisFileInfo[
'avdataoffset']);
 
   98                                                                while ($buffer = fread($fp_source, $this->fread_buffer_size)) {
 
   99                                                                        fwrite($fp_temp, $buffer, strlen($buffer));
 
  104                                                                copy($tempfilename, $this->filename);
 
  105                                                                unlink($tempfilename);
 
  109                                                                $this->errors[] = 
'Could not fopen("'.$tempfilename.
'", "wb")';
 
  114                                                        $this->errors[] = 
'Could not fopen("'.$this->filename.
'", "rb")';
 
  123                                $this->errors[] = 
'$this->GenerateID3v2Tag() failed';
 
  127                        if (!empty($this->errors)) {
 
  132                        $this->errors[] = 
'WriteID3v2() failed: !is_writeable('.$this->filename.
')';
 
  140                if (is_writeable(dirname($this->filename))) {
 
  144                        if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 
'rb'))) {
 
  148                                $OldThisFileInfo = $getID3->
analyze($this->filename);
 
  150                                        $this->errors[] = 
'Unable to remove ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).
'GB';
 
  155                                if ($OldThisFileInfo[
'avdataoffset'] !== 
false) {
 
  156                                        fseek($fp_source, $OldThisFileInfo[
'avdataoffset']);
 
  158                                if (is_writable($this->filename) && is_file($this->filename) && ($fp_temp = fopen($this->filename.
'getid3tmp', 
'w+b'))) {
 
  159                                        while ($buffer = fread($fp_source, $this->fread_buffer_size)) {
 
  160                                                fwrite($fp_temp, $buffer, strlen($buffer));
 
  164                                        $this->errors[] = 
'Could not fopen("'.$this->filename.
'getid3tmp", "w+b")';
 
  168                                $this->errors[] = 
'Could not fopen("'.$this->filename.
'", "rb")';
 
  170                        if (file_exists($this->filename)) {
 
  171                                unlink($this->filename);
 
  173                        rename($this->filename.
'getid3tmp', $this->filename);
 
  175                } elseif (is_writable($this->filename)) {
 
  179                        if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 
'rb'))) {
 
  183                                $OldThisFileInfo = $getID3->
analyze($this->filename);
 
  185                                        $this->errors[] = 
'Unable to remove ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).
'GB';
 
  190                                if ($OldThisFileInfo[
'avdataoffset'] !== 
false) {
 
  191                                        fseek($fp_source, $OldThisFileInfo[
'avdataoffset']);
 
  193                                if ($fp_temp = tmpfile()) {
 
  194                                        while ($buffer = fread($fp_source, $this->fread_buffer_size)) {
 
  195                                                fwrite($fp_temp, $buffer, strlen($buffer));
 
  198                                        if (is_writable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 
'wb'))) {
 
  200                                                while ($buffer = fread($fp_temp, $this->fread_buffer_size)) {
 
  201                                                        fwrite($fp_source, $buffer, strlen($buffer));
 
  203                                                fseek($fp_temp, -128, SEEK_END);
 
  206                                                $this->errors[] = 
'Could not fopen("'.$this->filename.
'", "wb")';
 
  210                                        $this->errors[] = 
'Could not create tmpfile()';
 
  213                                $this->errors[] = 
'Could not fopen("'.$this->filename.
'", "rb")';
 
  218                        $this->errors[] = 
'Directory and file both not writeable';
 
  222                if (!empty($this->errors)) {
 
  230                switch ($this->majorversion) {
 
  233                                $flag  = (!empty($flags[
'unsynchronisation']) ? 
'1' : 
'0'); 
 
  234                                $flag .= (!empty($flags[
'extendedheader']   ) ? 
'1' : 
'0'); 
 
  235                                $flag .= (!empty($flags[
'experimental']     ) ? 
'1' : 
'0'); 
 
  236                                $flag .= (!empty($flags[
'footer']           ) ? 
'1' : 
'0'); 
 
  242                                $flag  = (!empty($flags[
'unsynchronisation']) ? 
'1' : 
'0'); 
 
  243                                $flag .= (!empty($flags[
'extendedheader']   ) ? 
'1' : 
'0'); 
 
  244                                $flag .= (!empty($flags[
'experimental']     ) ? 
'1' : 
'0'); 
 
  250                                $flag  = (!empty($flags[
'unsynchronisation']) ? 
'1' : 
'0'); 
 
  251                                $flag .= (!empty($flags[
'compression']      ) ? 
'1' : 
'0'); 
 
  259                return chr(bindec($flag));
 
  263        public function GenerateID3v2FrameFlags($TagAlter=
false, $FileAlter=
false, $ReadOnly=
false, $Compression=
false, $Encryption=
false, $GroupingIdentity=
false, $Unsynchronisation=
false, $DataLengthIndicator=
false) {
 
  264                switch ($this->majorversion) {
 
  268                                $flag1 .= $TagAlter  ? 
'1' : 
'0'; 
 
  269                                $flag1 .= $FileAlter ? 
'1' : 
'0'; 
 
  270                                $flag1 .= $ReadOnly  ? 
'1' : 
'0'; 
 
  274                                $flag2 .= $GroupingIdentity    ? 
'1' : 
'0'; 
 
  276                                $flag2 .= $Compression         ? 
'1' : 
'0'; 
 
  277                                $flag2 .= $Encryption          ? 
'1' : 
'0'; 
 
  278                                $flag2 .= $Unsynchronisation   ? 
'1' : 
'0'; 
 
  279                                $flag2 .= $DataLengthIndicator ? 
'1' : 
'0'; 
 
  284                                $flag1  = $TagAlter  ? 
'1' : 
'0';  
 
  285                                $flag1 .= $FileAlter ? 
'1' : 
'0';  
 
  286                                $flag1 .= $ReadOnly  ? 
'1' : 
'0';  
 
  289                                $flag2  = $Compression      ? 
'1' : 
'0';      
 
  290                                $flag2 .= $Encryption       ? 
'1' : 
'0';      
 
  291                                $flag2 .= $GroupingIdentity ? 
'1' : 
'0';      
 
  300                return chr(bindec($flag1)).chr(bindec($flag2));
 
  309                if (($this->majorversion < 3) || ($this->majorversion > 4)) {
 
  311                        $this->errors[] = 
'Only ID3v2.3 and ID3v2.4 are supported in GenerateID3v2FrameData()';
 
  315                        switch ($frame_name) {
 
  320                                        if (strlen($source_data_array[
'data']) > 64) {
 
  321                                                $this->errors[] = 
'Identifier not allowed to be longer than 64 bytes in '.$frame_name.
' (supplied data was '.strlen($source_data_array[
'data']).
' bytes long)';
 
  323                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'ownerid']).
"\x00";
 
  324                                                $framedata .= substr($source_data_array[
'data'], 0, 64); 
 
  335                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
  337                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  338                                                $framedata .= $source_data_array[
'description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
  339                                                $framedata .= $source_data_array[
'data'];
 
  350                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
  351                                        } elseif (!isset($source_data_array[
'data']) || !$this->
IsValidURL($source_data_array[
'data'], 
false, 
false)) {
 
  354                                                $this->warnings[] = 
'Invalid URL in '.$frame_name.
' ('.$source_data_array[
'data'].
')';
 
  356                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  357                                                $framedata .= $source_data_array[
'description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
  358                                                $framedata .= $source_data_array[
'data'];
 
  368                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
  370                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  371                                                $framedata .= $source_data_array[
'data'];
 
  378                                        $framedata .= $source_data_array[
'data'];
 
  392                                        if (($source_data_array[
'timestampformat'] > 2) || ($source_data_array[
'timestampformat'] < 1)) {
 
  393                                                $this->errors[] = 
'Invalid Time Stamp Format byte in '.$frame_name.
' ('.$source_data_array[
'timestampformat'].
')';
 
  395                                                $framedata .= chr($source_data_array[
'timestampformat']);
 
  396                                                foreach ($source_data_array as 
$key => $val) {
 
  398                                                                $this->errors[] = 
'Invalid Event Type byte in '.$frame_name.
' ('.$val[
'typeid'].
')';
 
  399                                                        } elseif ((
$key != 
'timestampformat') && (
$key != 
'flags')) {
 
  400                                                                if (($val[
'timestamp'] > 0) && ($previousETCOtimestamp >= $val[
'timestamp'])) {
 
  403                                                                        $this->errors[] = 
'Out-of-order timestamp in '.$frame_name.
' ('.$val[
'timestamp'].
') for Event Type ('.$val[
'typeid'].
')';
 
  405                                                                        $framedata .= chr($val[
'typeid']);
 
  423                                        if (($source_data_array[
'framesbetweenreferences'] > 0) && ($source_data_array[
'framesbetweenreferences'] <= 65535)) {
 
  426                                                $this->errors[] = 
'Invalid MPEG Frames Between References in '.$frame_name.
' ('.$source_data_array[
'framesbetweenreferences'].
')';
 
  428                                        if (($source_data_array[
'bytesbetweenreferences'] > 0) && ($source_data_array[
'bytesbetweenreferences'] <= 16777215)) {
 
  431                                                $this->errors[] = 
'Invalid bytes Between References in '.$frame_name.
' ('.$source_data_array[
'bytesbetweenreferences'].
')';
 
  433                                        if (($source_data_array[
'msbetweenreferences'] > 0) && ($source_data_array[
'msbetweenreferences'] <= 16777215)) {
 
  436                                                $this->errors[] = 
'Invalid Milliseconds Between References in '.$frame_name.
' ('.$source_data_array[
'msbetweenreferences'].
')';
 
  438                                        if (!$this->
IsWithinBitRange($source_data_array[
'bitsforbytesdeviation'], 8, 
false)) {
 
  439                                                if (($source_data_array[
'bitsforbytesdeviation'] % 4) == 0) {
 
  440                                                        $framedata .= chr($source_data_array[
'bitsforbytesdeviation']);
 
  442                                                        $this->errors[] = 
'Bits For Bytes Deviation in '.$frame_name.
' ('.$source_data_array[
'bitsforbytesdeviation'].
') must be a multiple of 4.';
 
  445                                                $this->errors[] = 
'Invalid Bits For Bytes Deviation in '.$frame_name.
' ('.$source_data_array[
'bitsforbytesdeviation'].
')';
 
  447                                        if (!$this->
IsWithinBitRange($source_data_array[
'bitsformsdeviation'], 8, 
false)) {
 
  448                                                if (($source_data_array[
'bitsformsdeviation'] % 4) == 0) {
 
  449                                                        $framedata .= chr($source_data_array[
'bitsformsdeviation']);
 
  451                                                        $this->errors[] = 
'Bits For Milliseconds Deviation in '.$frame_name.
' ('.$source_data_array[
'bitsforbytesdeviation'].
') must be a multiple of 4.';
 
  454                                                $this->errors[] = 
'Invalid Bits For Milliseconds Deviation in '.$frame_name.
' ('.$source_data_array[
'bitsformsdeviation'].
')';
 
  456                                        foreach ($source_data_array as 
$key => $val) {
 
  457                                                if ((
$key != 
'framesbetweenreferences') && (
$key != 
'bytesbetweenreferences') && (
$key != 
'msbetweenreferences') && (
$key != 
'bitsforbytesdeviation') && (
$key != 
'bitsformsdeviation') && (
$key != 
'flags')) {
 
  458                                                        $unwrittenbitstream .= str_pad(
getid3_lib::Dec2Bin($val[
'bytedeviation']), $source_data_array[
'bitsforbytesdeviation'], 
'0', STR_PAD_LEFT);
 
  459                                                        $unwrittenbitstream .= str_pad(
getid3_lib::Dec2Bin($val[
'msdeviation']),   $source_data_array[
'bitsformsdeviation'],    
'0', STR_PAD_LEFT);
 
  462                                        for (
$i = 0; 
$i < strlen($unwrittenbitstream); 
$i += 8) {
 
  463                                                $highnibble = bindec(substr($unwrittenbitstream, 
$i, 4)) << 4;
 
  464                                                $lownibble  = bindec(substr($unwrittenbitstream, 
$i + 4, 4));
 
  465                                                $framedata .= chr($highnibble & $lownibble);
 
  476                                        if (($source_data_array[
'timestampformat'] > 2) || ($source_data_array[
'timestampformat'] < 1)) {
 
  477                                                $this->errors[] = 
'Invalid Time Stamp Format byte in '.$frame_name.
' ('.$source_data_array[
'timestampformat'].
')';
 
  479                                                $framedata .= chr($source_data_array[
'timestampformat']);
 
  480                                                foreach ($source_data_array as 
$key => $val) {
 
  482                                                                $this->errors[] = 
'Invalid Event Type byte in '.$frame_name.
' ('.$val[
'typeid'].
')';
 
  483                                                        } elseif ((
$key != 
'timestampformat') && (
$key != 
'flags')) {
 
  484                                                                if (($val[
'tempo'] < 0) || ($val[
'tempo'] > 510)) {
 
  485                                                                        $this->errors[] = 
'Invalid Tempo (max = 510) in '.$frame_name.
' ('.$val[
'tempo'].
') at timestamp ('.$val[
'timestamp'].
')';
 
  487                                                                        if ($val[
'tempo'] > 255) {
 
  488                                                                                $framedata .= chr(255);
 
  489                                                                                $val[
'tempo'] -= 255;
 
  491                                                                        $framedata .= chr($val[
'tempo']);
 
  507                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
  509                                                $this->errors[] = 
'Invalid Language in '.$frame_name.
' ('.$source_data_array[
'language'].
')';
 
  511                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  512                                                $framedata .= strtolower($source_data_array[
'language']);
 
  513                                                $framedata .= $source_data_array[
'description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
  514                                                $framedata .= $source_data_array[
'data'];
 
  532                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
  534                                                $this->errors[] = 
'Invalid Language in '.$frame_name.
' ('.$source_data_array[
'language'].
')';
 
  535                                        } elseif (($source_data_array[
'timestampformat'] > 2) || ($source_data_array[
'timestampformat'] < 1)) {
 
  536                                                $this->errors[] = 
'Invalid Time Stamp Format byte in '.$frame_name.
' ('.$source_data_array[
'timestampformat'].
')';
 
  538                                                $this->errors[] = 
'Invalid Content Type byte in '.$frame_name.
' ('.$source_data_array[
'contenttypeid'].
')';
 
  539                                        } elseif (!is_array($source_data_array[
'data'])) {
 
  540                                                $this->errors[] = 
'Invalid Lyric/Timestamp data in '.$frame_name.
' (must be an array)';
 
  542                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  543                                                $framedata .= strtolower($source_data_array[
'language']);
 
  544                                                $framedata .= chr($source_data_array[
'timestampformat']);
 
  545                                                $framedata .= chr($source_data_array[
'contenttypeid']);
 
  546                                                $framedata .= $source_data_array[
'description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
  547                                                ksort($source_data_array[
'data']);
 
  548                                                foreach ($source_data_array[
'data'] as 
$key => $val) {
 
  549                                                        $framedata .= $val[
'data'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
  563                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
  565                                                $this->errors[] = 
'Invalid Language in '.$frame_name.
' ('.$source_data_array[
'language'].
')';
 
  567                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  568                                                $framedata .= strtolower($source_data_array[
'language']);
 
  569                                                $framedata .= $source_data_array[
'description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
  570                                                $framedata .= $source_data_array[
'data'];
 
  584                                        $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'description']).
"\x00";
 
  585                                        foreach ($source_data_array as 
$key => $val) {
 
  586                                                if (
$key != 
'description') {
 
  587                                                        $framedata .= chr($val[
'channeltypeid']);
 
  589                                                        if (!$this->
IsWithinBitRange($source_data_array[
'bitspeakvolume'], 8, 
false)) {
 
  590                                                                $framedata .= chr($val[
'bitspeakvolume']);
 
  591                                                                if ($val[
'bitspeakvolume'] > 0) {
 
  595                                                                $this->errors[] = 
'Invalid Bits Representing Peak Volume in '.$frame_name.
' ('.$val[
'bitspeakvolume'].
') (range = 0 to 255)';
 
  618                                                $this->errors[] = 
'Invalid Bits For Volume Description byte in '.$frame_name.
' ('.$source_data_array[
'bitsvolume'].
') (range = 1 to 255)';
 
  621                                                $incdecflag .= $source_data_array[
'incdec'][
'right']     ? 
'1' : 
'0';     
 
  622                                                $incdecflag .= $source_data_array[
'incdec'][
'left']      ? 
'1' : 
'0';      
 
  623                                                $incdecflag .= $source_data_array[
'incdec'][
'rightrear'] ? 
'1' : 
'0'; 
 
  624                                                $incdecflag .= $source_data_array[
'incdec'][
'leftrear']  ? 
'1' : 
'0';  
 
  625                                                $incdecflag .= $source_data_array[
'incdec'][
'center']    ? 
'1' : 
'0';    
 
  626                                                $incdecflag .= $source_data_array[
'incdec'][
'bass']      ? 
'1' : 
'0';      
 
  627                                                $framedata .= chr(bindec($incdecflag));
 
  628                                                $framedata .= chr($source_data_array[
'bitsvolume']);
 
  629                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'volumechange'][
'right'], ceil($source_data_array[
'bitsvolume'] / 8), 
false);
 
  630                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'volumechange'][
'left'],  ceil($source_data_array[
'bitsvolume'] / 8), 
false);
 
  631                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'peakvolume'][
'right'], ceil($source_data_array[
'bitsvolume'] / 8), 
false);
 
  632                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'peakvolume'][
'left'],  ceil($source_data_array[
'bitsvolume'] / 8), 
false);
 
  633                                                if ($source_data_array[
'volumechange'][
'rightrear'] || $source_data_array[
'volumechange'][
'leftrear'] ||
 
  634                                                        $source_data_array[
'peakvolume'][
'rightrear'] || $source_data_array[
'peakvolume'][
'leftrear'] ||
 
  635                                                        $source_data_array[
'volumechange'][
'center'] || $source_data_array[
'peakvolume'][
'center'] ||
 
  636                                                        $source_data_array[
'volumechange'][
'bass'] || $source_data_array[
'peakvolume'][
'bass']) {
 
  637                                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'volumechange'][
'rightrear'], ceil($source_data_array[
'bitsvolume']/8), 
false);
 
  638                                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'volumechange'][
'leftrear'],  ceil($source_data_array[
'bitsvolume']/8), 
false);
 
  639                                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'peakvolume'][
'rightrear'], ceil($source_data_array[
'bitsvolume']/8), 
false);
 
  640                                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'peakvolume'][
'leftrear'],  ceil($source_data_array[
'bitsvolume']/8), 
false);
 
  642                                                if ($source_data_array[
'volumechange'][
'center'] || $source_data_array[
'peakvolume'][
'center'] ||
 
  643                                                        $source_data_array[
'volumechange'][
'bass'] || $source_data_array[
'peakvolume'][
'bass']) {
 
  644                                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'volumechange'][
'center'], ceil($source_data_array[
'bitsvolume']/8), 
false);
 
  645                                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'peakvolume'][
'center'], ceil($source_data_array[
'bitsvolume']/8), 
false);
 
  647                                                if ($source_data_array[
'volumechange'][
'bass'] || $source_data_array[
'peakvolume'][
'bass']) {
 
  648                                                                $framedata .= 
getid3_lib::BigEndian2String($source_data_array[
'volumechange'][
'bass'], ceil($source_data_array[
'bitsvolume']/8), 
false);
 
  663                                        if (($source_data_array[
'interpolationmethod'] < 0) || ($source_data_array[
'interpolationmethod'] > 1)) {
 
  664                                                $this->errors[] = 
'Invalid Interpolation Method byte in '.$frame_name.
' ('.$source_data_array[
'interpolationmethod'].
') (valid = 0 or 1)';
 
  666                                                $framedata .= chr($source_data_array[
'interpolationmethod']);
 
  667                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'description']).
"\x00";
 
  668                                                foreach ($source_data_array[
'data'] as 
$key => $val) {
 
  685                                                $this->errors[] = 
'Invalid Adjustment Bits byte in '.$frame_name.
' ('.$source_data_array[
'bitsvolume'].
') (range = 1 to 255)';
 
  687                                                $framedata .= chr($source_data_array[
'adjustmentbits']);
 
  688                                                foreach ($source_data_array as 
$key => $val) {
 
  689                                                        if (
$key != 
'bitsvolume') {
 
  691                                                                        $this->errors[] = 
'Invalid Frequency in '.$frame_name.
' ('.
$key.
') (range = 0 to 32767)';
 
  718                                                $this->errors[] = 
'Invalid Reverb Left in '.$frame_name.
' ('.$source_data_array[
'left'].
') (range = 0 to 65535)';
 
  719                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'right'], 16, 
false)) {
 
  720                                                $this->errors[] = 
'Invalid Reverb Left in '.$frame_name.
' ('.$source_data_array[
'right'].
') (range = 0 to 65535)';
 
  721                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'bouncesL'], 8, 
false)) {
 
  722                                                $this->errors[] = 
'Invalid Reverb Bounces, Left in '.$frame_name.
' ('.$source_data_array[
'bouncesL'].
') (range = 0 to 255)';
 
  723                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'bouncesR'], 8, 
false)) {
 
  724                                                $this->errors[] = 
'Invalid Reverb Bounces, Right in '.$frame_name.
' ('.$source_data_array[
'bouncesR'].
') (range = 0 to 255)';
 
  725                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'feedbackLL'], 8, 
false)) {
 
  726                                                $this->errors[] = 
'Invalid Reverb Feedback, Left-To-Left in '.$frame_name.
' ('.$source_data_array[
'feedbackLL'].
') (range = 0 to 255)';
 
  727                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'feedbackLR'], 8, 
false)) {
 
  728                                                $this->errors[] = 
'Invalid Reverb Feedback, Left-To-Right in '.$frame_name.
' ('.$source_data_array[
'feedbackLR'].
') (range = 0 to 255)';
 
  729                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'feedbackRR'], 8, 
false)) {
 
  730                                                $this->errors[] = 
'Invalid Reverb Feedback, Right-To-Right in '.$frame_name.
' ('.$source_data_array[
'feedbackRR'].
') (range = 0 to 255)';
 
  731                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'feedbackRL'], 8, 
false)) {
 
  732                                                $this->errors[] = 
'Invalid Reverb Feedback, Right-To-Left in '.$frame_name.
' ('.$source_data_array[
'feedbackRL'].
') (range = 0 to 255)';
 
  733                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'premixLR'], 8, 
false)) {
 
  734                                                $this->errors[] = 
'Invalid Premix, Left-To-Right in '.$frame_name.
' ('.$source_data_array[
'premixLR'].
') (range = 0 to 255)';
 
  735                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'premixRL'], 8, 
false)) {
 
  736                                                $this->errors[] = 
'Invalid Premix, Right-To-Left in '.$frame_name.
' ('.$source_data_array[
'premixRL'].
') (range = 0 to 255)';
 
  740                                                $framedata .= chr($source_data_array[
'bouncesL']);
 
  741                                                $framedata .= chr($source_data_array[
'bouncesR']);
 
  742                                                $framedata .= chr($source_data_array[
'feedbackLL']);
 
  743                                                $framedata .= chr($source_data_array[
'feedbackLR']);
 
  744                                                $framedata .= chr($source_data_array[
'feedbackRR']);
 
  745                                                $framedata .= chr($source_data_array[
'feedbackRL']);
 
  746                                                $framedata .= chr($source_data_array[
'premixLR']);
 
  747                                                $framedata .= chr($source_data_array[
'premixRL']);
 
  760                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
  762                                                $this->errors[] = 
'Invalid Picture Type byte in '.$frame_name.
' ('.$source_data_array[
'picturetypeid'].
') for ID3v2.'.
$this->majorversion;
 
  764                                                $this->errors[] = 
'Invalid MIME Type in '.$frame_name.
' ('.$source_data_array[
'mime'].
') for ID3v2.'.
$this->majorversion;
 
  765                                        } elseif (($source_data_array[
'mime'] == 
'-->') && (!$this->
IsValidURL($source_data_array[
'data'], 
false, 
false))) {
 
  768                                                $this->warnings[] = 
'Invalid URL in '.$frame_name.
' ('.$source_data_array[
'data'].
')';
 
  770                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  771                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'mime']).
"\x00";
 
  772                                                $framedata .= chr($source_data_array[
'picturetypeid']);
 
  774                                                $framedata .= $source_data_array[
'data'];
 
  787                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
  789                                                $this->errors[] = 
'Invalid MIME Type in '.$frame_name.
' ('.$source_data_array[
'mime'].
')';
 
  790                                        } elseif (!$source_data_array[
'description']) {
 
  791                                                $this->errors[] = 
'Missing Description in '.$frame_name;
 
  793                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  794                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'mime']).
"\x00";
 
  795                                                $framedata .= $source_data_array[
'filename'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
  796                                                $framedata .= $source_data_array[
'description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
  797                                                $framedata .= $source_data_array[
'data'];
 
  817                                                $this->errors[] = 
'Invalid Rating byte in '.$frame_name.
' ('.$source_data_array[
'rating'].
') (range = 0 to 255)';
 
  818                                        } elseif (!$this->
IsValidEmail($source_data_array[
'email'])) {
 
  819                                                $this->errors[] = 
'Invalid Email in '.$frame_name.
' ('.$source_data_array[
'email'].
')';
 
  821                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'email']).
"\x00";
 
  822                                                $framedata .= chr($source_data_array[
'rating']);
 
  832                                        if (!$this->
IsWithinBitRange($source_data_array[
'buffersize'], 24, 
false)) {
 
  833                                                $this->errors[] = 
'Invalid Buffer Size in '.$frame_name;
 
  834                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'nexttagoffset'], 32, 
false)) {
 
  835                                                $this->errors[] = 
'Invalid Offset To Next Tag in '.$frame_name;
 
  839                                                $flag .= $source_data_array[
'flags'][
'embededinfo'] ? 
'1' : 
'0';
 
  840                                                $framedata .= chr(bindec($flag));
 
  851                                        if (!$this->
IsWithinBitRange($source_data_array[
'previewstart'], 16, 
false)) {
 
  852                                                $this->errors[] = 
'Invalid Preview Start in '.$frame_name.
' ('.$source_data_array[
'previewstart'].
')';
 
  853                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'previewlength'], 16, 
false)) {
 
  854                                                $this->errors[] = 
'Invalid Preview Length in '.$frame_name.
' ('.$source_data_array[
'previewlength'].
')';
 
  856                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'ownerid']).
"\x00";
 
  859                                                $framedata .= $source_data_array[
'encryptioninfo'];
 
  869                                                $this->errors[] = 
'Invalid Frame Identifier in '.$frame_name.
' ('.$source_data_array[
'frameid'].
')';
 
  870                                        } elseif (!$this->
IsValidURL($source_data_array[
'data'], 
true, 
false)) {
 
  873                                                $this->warnings[] = 
'Invalid URL in '.$frame_name.
' ('.$source_data_array[
'data'].
')';
 
  874                                        } 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'] == 
'')) {
 
  875                                                $this->errors[] = 
'Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array[
'frameid'].
' in '.$frame_name;
 
  876                                        } elseif (($source_data_array[
'frameid'] == 
'USER') && (
getid3_id3v2::LanguageLookup($source_data_array[
'additionaldata'], 
true) == 
'')) {
 
  877                                                $this->errors[] = 
'Language must be specified as additional data for Frame Identifier of '.$source_data_array[
'frameid'].
' in '.$frame_name;
 
  878                                        } elseif (($source_data_array[
'frameid'] == 
'PRIV') && ($source_data_array[
'additionaldata'] == 
'')) {
 
  879                                                $this->errors[] = 
'Owner Identifier must be specified as additional data for Frame Identifier of '.$source_data_array[
'frameid'].
' in '.$frame_name;
 
  880                                        } elseif ((($source_data_array[
'frameid'] == 
'COMM') || ($source_data_array[
'frameid'] == 
'SYLT') || ($source_data_array[
'frameid'] == 
'USLT')) && ((
getid3_id3v2::LanguageLookup(substr($source_data_array[
'additionaldata'], 0, 3), 
true) == 
'') || (substr($source_data_array[
'additionaldata'], 3) == 
''))) {
 
  881                                                $this->errors[] = 
'Language followed by Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array[
'frameid'].
' in '.$frame_name;
 
  883                                                $framedata .= $source_data_array[
'frameid'];
 
  884                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'data']).
"\x00";
 
  885                                                switch ($source_data_array[
'frameid']) {
 
  895                                                                $framedata .= $source_data_array[
'additionaldata'];
 
  912                                                                if ($this->majorversion == 3) {
 
  915                                                                        $this->errors[] = $source_data_array[
'frameid'].
' is not a valid Frame Identifier in '.$frame_name.
' (in ID3v2.'.$this->majorversion.
')';
 
  919                                                                if ((substr($source_data_array[
'frameid'], 0, 1) == 
'T') || (substr($source_data_array[
'frameid'], 0, 1) == 
'W')) {
 
  922                                                                        $this->errors[] = $source_data_array[
'frameid'].
' is not a valid Frame Identifier in '.$frame_name.
' (in ID3v2.'.$this->majorversion.
')';
 
  933                                        if (($source_data_array[
'timestampformat'] < 1) || ($source_data_array[
'timestampformat'] > 2)) {
 
  934                                                $this->errors[] = 
'Invalid Time Stamp Format in '.$frame_name.
' ('.$source_data_array[
'timestampformat'].
') (valid = 1 or 2)';
 
  935                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'position'], 32, 
false)) {
 
  936                                                $this->errors[] = 
'Invalid Position in '.$frame_name.
' ('.$source_data_array[
'position'].
') (range = 0 to 4294967295)';
 
  938                                                $framedata .= chr($source_data_array[
'timestampformat']);
 
  950                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
')';
 
  952                                                $this->errors[] = 
'Invalid Language in '.$frame_name.
' ('.$source_data_array[
'language'].
')';
 
  954                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  955                                                $framedata .= strtolower($source_data_array[
'language']);
 
  956                                                $framedata .= $source_data_array[
'data'];
 
  968                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
')';
 
  969                                        } elseif (!$this->IsANumber($source_data_array[
'pricepaid'][
'value'], 
false)) {
 
  970                                                $this->errors[] = 
'Invalid Price Paid in '.$frame_name.
' ('.$source_data_array[
'pricepaid'][
'value'].
')';
 
  971                                        } elseif (!$this->IsValidDateStampString($source_data_array[
'purchasedate'])) {
 
  972                                                $this->errors[] = 
'Invalid Date Of Purchase in '.$frame_name.
' ('.$source_data_array[
'purchasedate'].
') (format = YYYYMMDD)';
 
  974                                                $framedata .= chr($source_data_array[
'encodingid']);
 
  975                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'pricepaid'][
'value']).
"\x00";
 
  976                                                $framedata .= $source_data_array[
'purchasedate'];
 
  977                                                $framedata .= $source_data_array[
'seller'];
 
  994                                                $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
')';
 
  995                                        } elseif (!$this->IsValidDateStampString($source_data_array[
'pricevaliduntil'])) {
 
  996                                                $this->errors[] = 
'Invalid Valid Until date in '.$frame_name.
' ('.$source_data_array[
'pricevaliduntil'].
') (format = YYYYMMDD)';
 
  997                                        } elseif (!$this->
IsValidURL($source_data_array[
'contacturl'], 
false, 
true)) {
 
  998                                                $this->errors[] = 
'Invalid Contact URL in '.$frame_name.
' ('.$source_data_array[
'contacturl'].
') (allowed schemes: http, https, ftp, mailto)';
 
 1000                                                $this->errors[] = 
'Invalid Received As byte in '.$frame_name.
' ('.$source_data_array[
'contacturl'].
') (range = 0 to 8)';
 
 1002                                                $this->errors[] = 
'Invalid MIME Type in '.$frame_name.
' ('.$source_data_array[
'mime'].
')';
 
 1004                                                $framedata .= chr($source_data_array[
'encodingid']);
 
 1005                                                unset($pricestring);
 
 1006                                                foreach ($source_data_array[
'price'] as 
$key => $val) {
 
 1008                                                                $pricestrings[] = 
$key.$val[
'value'];
 
 1010                                                                $this->errors[] = 
'Invalid Price String in '.$frame_name.
' ('.
$key.$val[
'value'].
')';
 
 1013                                                $framedata .= implode(
'/', $pricestrings);
 
 1014                                                $framedata .= $source_data_array[
'pricevaliduntil'];
 
 1015                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'contacturl']).
"\x00";
 
 1016                                                $framedata .= chr($source_data_array[
'receivedasid']);
 
 1017                                                $framedata .= $source_data_array[
'sellername'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
 1018                                                $framedata .= $source_data_array[
'description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array[
'encodingid']);
 
 1019                                                $framedata .= $source_data_array[
'mime'].
"\x00";
 
 1020                                                $framedata .= $source_data_array[
'logo'];
 
 1029                                        if (!$this->
IsWithinBitRange($source_data_array[
'methodsymbol'], 8, 
false)) {
 
 1030                                                $this->errors[] = 
'Invalid Group Symbol in '.$frame_name.
' ('.$source_data_array[
'methodsymbol'].
') (range = 0 to 255)';
 
 1032                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'ownerid']).
"\x00";
 
 1033                                                $framedata .= ord($source_data_array[
'methodsymbol']);
 
 1034                                                $framedata .= $source_data_array[
'data'];
 
 1043                                        if (!$this->
IsWithinBitRange($source_data_array[
'groupsymbol'], 8, 
false)) {
 
 1044                                                $this->errors[] = 
'Invalid Group Symbol in '.$frame_name.
' ('.$source_data_array[
'groupsymbol'].
') (range = 0 to 255)';
 
 1046                                                $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'ownerid']).
"\x00";
 
 1047                                                $framedata .= ord($source_data_array[
'groupsymbol']);
 
 1048                                                $framedata .= $source_data_array[
'data'];
 
 1056                                        $framedata .= str_replace(
"\x00", 
'', $source_data_array[
'ownerid']).
"\x00";
 
 1057                                        $framedata .= $source_data_array[
'data'];
 
 1064                                        if (!$this->
IsWithinBitRange($source_data_array[
'groupsymbol'], 8, 
false)) {
 
 1065                                                $this->errors[] = 
'Invalid Group Symbol in '.$frame_name.
' ('.$source_data_array[
'groupsymbol'].
') (range = 0 to 255)';
 
 1067                                                $framedata .= ord($source_data_array[
'groupsymbol']);
 
 1068                                                $framedata .= $source_data_array[
'data'];
 
 1076                                                $this->errors[] = 
'Invalid Minimum Offset in '.$frame_name.
' ('.$source_data_array[
'data'].
') (range = 0 to 4294967295)';
 
 1090                                        if (!$this->
IsWithinBitRange($source_data_array[
'datastart'], 32, 
false)) {
 
 1091                                                $this->errors[] = 
'Invalid Indexed Data Start in '.$frame_name.
' ('.$source_data_array[
'datastart'].
') (range = 0 to 4294967295)';
 
 1092                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'datalength'], 32, 
false)) {
 
 1093                                                $this->errors[] = 
'Invalid Indexed Data Length in '.$frame_name.
' ('.$source_data_array[
'datalength'].
') (range = 0 to 4294967295)';
 
 1094                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'indexpoints'], 16, 
false)) {
 
 1095                                                $this->errors[] = 
'Invalid Number Of Index Points in '.$frame_name.
' ('.$source_data_array[
'indexpoints'].
') (range = 0 to 65535)';
 
 1096                                        } elseif (!$this->
IsWithinBitRange($source_data_array[
'bitsperpoint'], 8, 
false)) {
 
 1097                                                $this->errors[] = 
'Invalid Bits Per Index Point in '.$frame_name.
' ('.$source_data_array[
'bitsperpoint'].
') (range = 0 to 255)';
 
 1098                                        } elseif ($source_data_array[
'indexpoints'] != count($source_data_array[
'indexes'])) {
 
 1099                                                $this->errors[] = 
'Number Of Index Points does not match actual supplied data in '.$frame_name;
 
 1105                                                foreach ($source_data_array[
'indexes'] as 
$key => $val) {
 
 1122                                        if (($source_data_array[
'track_adjustment'] > 51) || ($source_data_array[
'track_adjustment'] < -51)) {
 
 1123                                                $this->errors[] = 
'Invalid Track Adjustment in '.$frame_name.
' ('.$source_data_array[
'track_adjustment'].
') (range = -51.0 to +51.0)';
 
 1124                                        } elseif (($source_data_array[
'album_adjustment'] > 51) || ($source_data_array[
'album_adjustment'] < -51)) {
 
 1125                                                $this->errors[] = 
'Invalid Album Adjustment in '.$frame_name.
' ('.$source_data_array[
'album_adjustment'].
') (range = -51.0 to +51.0)';
 
 1127                                                $this->errors[] = 
'Invalid Track Name Code in '.$frame_name.
' ('.$source_data_array[
'raw'][
'track_name'].
') (range = 0 to 2)';
 
 1129                                                $this->errors[] = 
'Invalid Album Name Code in '.$frame_name.
' ('.$source_data_array[
'raw'][
'album_name'].
') (range = 0 to 2)';
 
 1131                                                $this->errors[] = 
'Invalid Track Originator Code in '.$frame_name.
' ('.$source_data_array[
'raw'][
'track_originator'].
') (range = 0 to 3)';
 
 1133                                                $this->errors[] = 
'Invalid Album Originator Code in '.$frame_name.
' ('.$source_data_array[
'raw'][
'album_originator'].
') (range = 0 to 3)';
 
 1136                                                $framedata .= 
getid3_lib::RGADgainString($source_data_array[
'raw'][
'track_name'], $source_data_array[
'raw'][
'track_originator'], $source_data_array[
'track_adjustment']);
 
 1137                                                $framedata .= 
getid3_lib::RGADgainString($source_data_array[
'raw'][
'album_name'], $source_data_array[
'raw'][
'album_originator'], $source_data_array[
'album_adjustment']);
 
 1142                                        if ((($this->majorversion == 2) && (strlen($frame_name) != 3)) || (($this->majorversion > 2) && (strlen($frame_name) != 4))) {
 
 1144                                        } elseif ($frame_name{0} == 
'T') {
 
 1150                                                        $this->errors[] = 
'Invalid Text Encoding in '.$frame_name.
' ('.$source_data_array[
'encodingid'].
') for ID3v2.'.
$this->majorversion;
 
 1152                                                        $framedata .= chr($source_data_array[
'encodingid']);
 
 1153                                                        $framedata .= $source_data_array[
'data'];
 
 1155                                        } elseif ($frame_name{0} == 
'W') {
 
 1158                                                if (!$this->
IsValidURL($source_data_array[
'data'], 
false, 
false)) {
 
 1161                                                        $this->warnings[] = 
'Invalid URL in '.$frame_name.
' ('.$source_data_array[
'data'].
')';
 
 1163                                                        $framedata .= $source_data_array[
'data'];
 
 1166                                                $this->errors[] = $frame_name.
' not yet supported in $this->GenerateID3v2FrameData()';
 
 1171                if (!empty($this->errors)) {
 
 1178                static $PreviousFrames = array();
 
 1180                if ($frame_name === 
null) {
 
 1183                        $PreviousFrames = array();
 
 1186                if ($this->majorversion == 4) {
 
 1187                        switch ($frame_name) {
 
 1192                                        if (!isset($source_data_array[
'ownerid'])) {
 
 1193                                                $this->errors[] = 
'[ownerid] not specified for '.$frame_name;
 
 1194                                        } elseif (in_array($frame_name.$source_data_array[
'ownerid'], $PreviousFrames)) {
 
 1195                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same OwnerID ('.$source_data_array[
'ownerid'].
')';
 
 1197                                                $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'];
 
 1207                                        if (!isset($source_data_array[
'description'])) {
 
 1208                                                $this->errors[] = 
'[description] not specified for '.$frame_name;
 
 1209                                        } elseif (in_array($frame_name.$source_data_array[
'description'], $PreviousFrames)) {
 
 1210                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Description ('.$source_data_array[
'description'].
')';
 
 1212                                                $PreviousFrames[] = $frame_name.$source_data_array[
'description'];
 
 1217                                        if (!isset($source_data_array[
'language'])) {
 
 1218                                                $this->errors[] = 
'[language] not specified for '.$frame_name;
 
 1219                                        } elseif (in_array($frame_name.$source_data_array[
'language'], $PreviousFrames)) {
 
 1220                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Language ('.$source_data_array[
'language'].
')';
 
 1222                                                $PreviousFrames[] = $frame_name.$source_data_array[
'language'];
 
 1229                                        if (!isset($source_data_array[
'language'])) {
 
 1230                                                $this->errors[] = 
'[language] not specified for '.$frame_name;
 
 1231                                        } elseif (!isset($source_data_array[
'description'])) {
 
 1232                                                $this->errors[] = 
'[description] not specified for '.$frame_name;
 
 1233                                        } elseif (in_array($frame_name.$source_data_array[
'language'].$source_data_array[
'description'], $PreviousFrames)) {
 
 1234                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Language + Description ('.$source_data_array[
'language'].
' + '.$source_data_array[
'description'].
')';
 
 1236                                                $PreviousFrames[] = $frame_name.$source_data_array[
'language'].$source_data_array[
'description'];
 
 1241                                        if (!isset($source_data_array[
'email'])) {
 
 1242                                                $this->errors[] = 
'[email] not specified for '.$frame_name;
 
 1243                                        } elseif (in_array($frame_name.$source_data_array[
'email'], $PreviousFrames)) {
 
 1244                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Email ('.$source_data_array[
'email'].
')';
 
 1246                                                $PreviousFrames[] = $frame_name.$source_data_array[
'email'];
 
 1263                                        if (in_array($frame_name, $PreviousFrames)) {
 
 1264                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed';
 
 1266                                                $PreviousFrames[] = $frame_name;
 
 1273                                        if (!isset($source_data_array[
'frameid'])) {
 
 1274                                                $this->errors[] = 
'[frameid] not specified for '.$frame_name;
 
 1275                                        } elseif (in_array($frame_name.$source_data_array[
'frameid'], $PreviousFrames)) {
 
 1276                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same FrameID ('.$source_data_array[
'frameid'].
')';
 
 1277                                        } elseif (in_array($source_data_array[
'frameid'], $PreviousFrames)) {
 
 1279                                                $this->errors[] = 
'Cannot specify a '.$frame_name.
' tag to a singleton tag that already exists ('.$source_data_array[
'frameid'].
')';
 
 1281                                                $PreviousFrames[] = $frame_name.$source_data_array[
'frameid']; 
 
 1282                                                $PreviousFrames[] = $source_data_array[
'frameid'];             
 
 1293                                        if (!isset($source_data_array[
'ownerid'])) {
 
 1294                                                $this->errors[] = 
'[ownerid] not specified for '.$frame_name;
 
 1295                                        } elseif (!isset($source_data_array[
'data'])) {
 
 1296                                                $this->errors[] = 
'[data] not specified for '.$frame_name;
 
 1297                                        } elseif (in_array($frame_name.$source_data_array[
'ownerid'].$source_data_array[
'data'], $PreviousFrames)) {
 
 1298                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same OwnerID + Data ('.$source_data_array[
'ownerid'].
' + '.$source_data_array[
'data'].
')';
 
 1300                                                $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'].$source_data_array[
'data'];
 
 1305                                        if (($frame_name{0} != 
'T') && ($frame_name{0} != 
'W')) {
 
 1306                                                $this->errors[] = 
'Frame not allowed in ID3v2.'.$this->majorversion.
': '.$frame_name;
 
 1311                } elseif ($this->majorversion == 3) {
 
 1313                        switch ($frame_name) {
 
 1318                                        if (!isset($source_data_array[
'ownerid'])) {
 
 1319                                                $this->errors[] = 
'[ownerid] not specified for '.$frame_name;
 
 1320                                        } elseif (in_array($frame_name.$source_data_array[
'ownerid'], $PreviousFrames)) {
 
 1321                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same OwnerID ('.$source_data_array[
'ownerid'].
')';
 
 1323                                                $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'];
 
 1331                                        if (!isset($source_data_array[
'description'])) {
 
 1332                                                $this->errors[] = 
'[description] not specified for '.$frame_name;
 
 1333                                        } elseif (in_array($frame_name.$source_data_array[
'description'], $PreviousFrames)) {
 
 1334                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Description ('.$source_data_array[
'description'].
')';
 
 1336                                                $PreviousFrames[] = $frame_name.$source_data_array[
'description'];
 
 1341                                        if (!isset($source_data_array[
'language'])) {
 
 1342                                                $this->errors[] = 
'[language] not specified for '.$frame_name;
 
 1343                                        } elseif (in_array($frame_name.$source_data_array[
'language'], $PreviousFrames)) {
 
 1344                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Language ('.$source_data_array[
'language'].
')';
 
 1346                                                $PreviousFrames[] = $frame_name.$source_data_array[
'language'];
 
 1353                                        if (!isset($source_data_array[
'language'])) {
 
 1354                                                $this->errors[] = 
'[language] not specified for '.$frame_name;
 
 1355                                        } elseif (!isset($source_data_array[
'description'])) {
 
 1356                                                $this->errors[] = 
'[description] not specified for '.$frame_name;
 
 1357                                        } elseif (in_array($frame_name.$source_data_array[
'language'].$source_data_array[
'description'], $PreviousFrames)) {
 
 1358                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Language + Description ('.$source_data_array[
'language'].
' + '.$source_data_array[
'description'].
')';
 
 1360                                                $PreviousFrames[] = $frame_name.$source_data_array[
'language'].$source_data_array[
'description'];
 
 1365                                        if (!isset($source_data_array[
'email'])) {
 
 1366                                                $this->errors[] = 
'[email] not specified for '.$frame_name;
 
 1367                                        } elseif (in_array($frame_name.$source_data_array[
'email'], $PreviousFrames)) {
 
 1368                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Email ('.$source_data_array[
'email'].
')';
 
 1370                                                $PreviousFrames[] = $frame_name.$source_data_array[
'email'];
 
 1387                                        if (in_array($frame_name, $PreviousFrames)) {
 
 1388                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed';
 
 1390                                                $PreviousFrames[] = $frame_name;
 
 1397                                        if (!isset($source_data_array[
'frameid'])) {
 
 1398                                                $this->errors[] = 
'[frameid] not specified for '.$frame_name;
 
 1399                                        } elseif (in_array($frame_name.$source_data_array[
'frameid'], $PreviousFrames)) {
 
 1400                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same FrameID ('.$source_data_array[
'frameid'].
')';
 
 1401                                        } elseif (in_array($source_data_array[
'frameid'], $PreviousFrames)) {
 
 1403                                                $this->errors[] = 
'Cannot specify a '.$frame_name.
' tag to a singleton tag that already exists ('.$source_data_array[
'frameid'].
')';
 
 1405                                                $PreviousFrames[] = $frame_name.$source_data_array[
'frameid']; 
 
 1406                                                $PreviousFrames[] = $source_data_array[
'frameid'];             
 
 1416                                        if (!isset($source_data_array[
'ownerid'])) {
 
 1417                                                $this->errors[] = 
'[ownerid] not specified for '.$frame_name;
 
 1418                                        } elseif (!isset($source_data_array[
'data'])) {
 
 1419                                                $this->errors[] = 
'[data] not specified for '.$frame_name;
 
 1420                                        } elseif (in_array($frame_name.$source_data_array[
'ownerid'].$source_data_array[
'data'], $PreviousFrames)) {
 
 1421                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same OwnerID + Data ('.$source_data_array[
'ownerid'].
' + '.$source_data_array[
'data'].
')';
 
 1423                                                $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'].$source_data_array[
'data'];
 
 1428                                        if (($frame_name{0} != 
'T') && ($frame_name{0} != 
'W')) {
 
 1429                                                $this->errors[] = 
'Frame not allowed in ID3v2.'.$this->majorversion.
': '.$frame_name;
 
 1434                } elseif ($this->majorversion == 2) {
 
 1436                        switch ($frame_name) {
 
 1440                                        if (!isset($source_data_array[
'ownerid'])) {
 
 1441                                                $this->errors[] = 
'[ownerid] not specified for '.$frame_name;
 
 1442                                        } elseif (in_array($frame_name.$source_data_array[
'ownerid'], $PreviousFrames)) {
 
 1443                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same OwnerID ('.$source_data_array[
'ownerid'].
')';
 
 1445                                                $PreviousFrames[] = $frame_name.$source_data_array[
'ownerid'];
 
 1453                                        if (!isset($source_data_array[
'description'])) {
 
 1454                                                $this->errors[] = 
'[description] not specified for '.$frame_name;
 
 1455                                        } elseif (in_array($frame_name.$source_data_array[
'description'], $PreviousFrames)) {
 
 1456                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Description ('.$source_data_array[
'description'].
')';
 
 1458                                                $PreviousFrames[] = $frame_name.$source_data_array[
'description'];
 
 1465                                        if (!isset($source_data_array[
'language'])) {
 
 1466                                                $this->errors[] = 
'[language] not specified for '.$frame_name;
 
 1467                                        } elseif (!isset($source_data_array[
'description'])) {
 
 1468                                                $this->errors[] = 
'[description] not specified for '.$frame_name;
 
 1469                                        } elseif (in_array($frame_name.$source_data_array[
'language'].$source_data_array[
'description'], $PreviousFrames)) {
 
 1470                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Language + Description ('.$source_data_array[
'language'].
' + '.$source_data_array[
'description'].
')';
 
 1472                                                $PreviousFrames[] = $frame_name.$source_data_array[
'language'].$source_data_array[
'description'];
 
 1477                                        if (!isset($source_data_array[
'email'])) {
 
 1478                                                $this->errors[] = 
'[email] not specified for '.$frame_name;
 
 1479                                        } elseif (in_array($frame_name.$source_data_array[
'email'], $PreviousFrames)) {
 
 1480                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same Email ('.$source_data_array[
'email'].
')';
 
 1482                                                $PreviousFrames[] = $frame_name.$source_data_array[
'email'];
 
 1496                                        if (in_array($frame_name, $PreviousFrames)) {
 
 1497                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed';
 
 1499                                                $PreviousFrames[] = $frame_name;
 
 1506                                        if (!isset($source_data_array[
'frameid'])) {
 
 1507                                                $this->errors[] = 
'[frameid] not specified for '.$frame_name;
 
 1508                                        } elseif (in_array($frame_name.$source_data_array[
'frameid'], $PreviousFrames)) {
 
 1509                                                $this->errors[] = 
'Only one '.$frame_name.
' tag allowed with the same FrameID ('.$source_data_array[
'frameid'].
')';
 
 1510                                        } elseif (in_array($source_data_array[
'frameid'], $PreviousFrames)) {
 
 1512                                                $this->errors[] = 
'Cannot specify a '.$frame_name.
' tag to a singleton tag that already exists ('.$source_data_array[
'frameid'].
')';
 
 1514                                                $PreviousFrames[] = $frame_name.$source_data_array[
'frameid']; 
 
 1515                                                $PreviousFrames[] = $source_data_array[
'frameid'];             
 
 1520                                        if (($frame_name{0} != 
'T') && ($frame_name{0} != 
'W')) {
 
 1521                                                $this->errors[] = 
'Frame not allowed in ID3v2.'.$this->majorversion.
': '.$frame_name;
 
 1527                if (!empty($this->errors)) {
 
 1537                if (is_array($this->tag_data)) {
 
 1538                        foreach ($this->tag_data as $frame_name => $frame_rawinputdata) {
 
 1539                                foreach ($frame_rawinputdata as $irrelevantindex => $source_data_array) {
 
 1541                                                unset($frame_length);
 
 1542                                                unset($frame_flags);
 
 1543                                                $frame_data = 
false;
 
 1545                                                        if(array_key_exists(
'description', $source_data_array) && array_key_exists(
'encodingid', $source_data_array) && array_key_exists(
'encoding', $this->tag_data)) {
 
 1546                                                                $source_data_array[
'description'] = 
getid3_lib::iconv_fallback($this->tag_data[
'encoding'], $source_data_array[
'encoding'], $source_data_array[
'description']);
 
 1549                                                                $FrameUnsynchronisation = 
false;
 
 1550                                                                if ($this->majorversion >= 4) {
 
 1552                                                                        $unsynchdata = $frame_data;
 
 1553                                                                        if ($this->id3v2_use_unsynchronisation) {
 
 1556                                                                        if (strlen($unsynchdata) != strlen($frame_data)) {
 
 1558                                                                                $FrameUnsynchronisation = 
true;
 
 1559                                                                                $frame_data = $unsynchdata;
 
 1560                                                                                if (isset($TagUnsynchronisation) && $TagUnsynchronisation === 
false) {
 
 1563                                                                                        $TagUnsynchronisation = 
true;
 
 1566                                                                                if (isset($TagUnsynchronisation)) {
 
 1567                                                                                        $TagUnsynchronisation = 
false;
 
 1570                                                                        unset($unsynchdata);
 
 1579                                                        $this->errors[] = 
'Frame "'.$frame_name.
'" is NOT allowed';
 
 1581                                                if ($frame_data === 
false) {
 
 1582                                                        $this->errors[] = 
'$this->GenerateID3v2FrameData() failed for "'.$frame_name.
'"';
 
 1583                                                        if ($noerrorsonly) {
 
 1591                                                $this->warnings[] = 
'Ignoring invalid ID3v2 frame type: "'.$frame_name.
'"';
 
 1593                                                unset($frame_length);
 
 1594                                                unset($frame_flags);
 
 1597                                        if (isset($frame_name) && isset($frame_length) && isset($frame_flags) && isset($frame_data)) {
 
 1598                                                $tagstring .= $frame_name.$frame_length.$frame_flags.$frame_data;
 
 1603                        if (!isset($TagUnsynchronisation)) {
 
 1604                                $TagUnsynchronisation = 
false;
 
 1606                        if (($this->majorversion <= 3) && $this->id3v2_use_unsynchronisation) {
 
 1609                                if (strlen($unsynchdata) != strlen($tagstring)) {
 
 1611                                        $TagUnsynchronisation = 
true;
 
 1612                                        $tagstring = $unsynchdata;
 
 1617                                $this->paddedlength += 1024;
 
 1628                        if ($this->id3v2_use_unsynchronisation && (substr($tagstring, strlen($tagstring) - 1, 1) == 
"\xFF")) {
 
 1631                                $TagUnsynchronisation = 
true;
 
 1632                                $tagstring .= 
"\x00";
 
 1636                        $tagheader .= chr($this->majorversion);
 
 1637                        $tagheader .= chr($this->minorversion);
 
 1641                        return $tagheader.$tagstring;
 
 1643                $this->errors[] = 
'tag_data is not an array in GenerateID3v2Tag()';
 
 1650                } elseif (!$this->IsANumber(substr($pricestring, 3), 
true)) {
 
 1658                switch ($framename) {
 
 1670                switch ($framename) {
 
 1682                if (($eventid < 0) || ($eventid > 0xFF)) {
 
 1685                } elseif (($eventid >= 0xF0) && ($eventid <= 0xFC)) {
 
 1688                } elseif (($eventid >= 0x17) && ($eventid <= 0xDF)) {
 
 1691                } elseif (($eventid >= 0x0E) && ($eventid <= 0x16) && ($this->majorversion == 2)) {
 
 1694                } elseif (($eventid >= 0x15) && ($eventid <= 0x16) && ($this->majorversion == 3)) {
 
 1702                if (($contenttype >= 0) && ($contenttype <= 8) && ($this->majorversion == 4)) {
 
 1704                } elseif (($contenttype >= 0) && ($contenttype <= 6) && ($this->majorversion == 3)) {
 
 1711                if (($channeltype >= 0) && ($channeltype <= 8) && ($this->majorversion == 4)) {
 
 1718                if (($picturetype >= 0) && ($picturetype <= 0x14) && ($this->majorversion >= 2) && ($this->majorversion <= 4)) {
 
 1725                if ($imageformat == 
'-->') {
 
 1727                } elseif ($this->majorversion == 2) {
 
 1728                        if ((strlen($imageformat) == 3) && ($imageformat == strtoupper($imageformat))) {
 
 1731                } elseif (($this->majorversion == 3) || ($this->majorversion == 4)) {
 
 1740                if (($this->majorversion >= 3) && ($receivedas >= 0) && ($receivedas <= 8)) {
 
 1747                if (($RGADname >= 0) && ($RGADname <= 2)) {
 
 1754                if (($RGADoriginator >= 0) && ($RGADoriginator <= 3)) {
 
 1765                static $ID3v2IsValidTextEncoding_cache = array(
 
 1766                        2 => array(
true, 
true),              
 
 1767                        3 => array(
true, 
true),              
 
 1768                        4 => array(
true, 
true, 
true, 
true),  
 
 1770                return isset($ID3v2IsValidTextEncoding_cache[$this->majorversion][$textencodingbyte]);
 
 1786                $data = str_replace(
"\xFF\x00", 
"\xFF\x00\x00", 
$data);
 
 1787                $unsyncheddata = 
'';
 
 1788                $datalength = strlen(
$data);
 
 1789                for (
$i = 0; 
$i < $datalength; 
$i++) {
 
 1791                        $unsyncheddata .= $thischar;
 
 1792                        if ($thischar == 
"\xFF") {
 
 1793                                $nextchar = ord(
$data{
$i + 1});
 
 1794                                if (($nextchar & 0xE0) == 0xE0) {
 
 1796                                        $unsyncheddata .= 
"\x00";
 
 1800                return $unsyncheddata;
 
 1806                if (is_array($var)) {
 
 1807                        $keys = array_keys($var);
 
 1821                if (is_array($arr1) && is_array($arr2)) {
 
 1823                        $new_array = array();
 
 1827                                $keys = array_merge(array_keys($arr1), array_keys($arr2));
 
 1833                                $new_array = array_reverse(array_unique(array_reverse(array_merge($arr1, $arr2))));
 
 1838                        return $arr2 ? $arr2 : $arr1;
 
 1843                return preg_match(
'#^.+/.+$#', $mimestring);
 
 1848                        if (($number > (0 - pow(2, $maxbits - 1))) && ($number <= pow(2, $maxbits - 1))) {
 
 1852                        if (($number >= 0) && ($number <= pow(2, $maxbits))) {
 
 1860                if (function_exists(
'filter_var')) {
 
 1861                        return filter_var(
$email, FILTER_VALIDATE_EMAIL);
 
 1864                return preg_match(
'#^[^ ]+@[a-z\\-\\.]+\\.[a-z]{2,}$#', 
$email);
 
 1871                if ($allowUserPass !== 
true) {
 
 1872                        if (strstr(
$url, 
'@')) {
 
 1904                $parts = @parse_url(
$url);
 
 1905                $parts[
'scheme'] = (isset($parts[
'scheme']) ? $parts[
'scheme'] : 
'');
 
 1906                $parts[
'host']   = (isset($parts[
'host'])   ? $parts[
'host']   : 
'');
 
 1907                $parts[
'user']   = (isset($parts[
'user'])   ? $parts[
'user']   : 
'');
 
 1908                $parts[
'pass']   = (isset($parts[
'pass'])   ? $parts[
'pass']   : 
'');
 
 1909                $parts[
'path']   = (isset($parts[
'path'])   ? $parts[
'path']   : 
'');
 
 1910                $parts[
'query']  = (isset($parts[
'query'])  ? $parts[
'query']  : 
'');
 
 1915                $long_description = str_replace(
' ', 
'_', strtolower(trim($long_description)));
 
 1916                static $ID3v2ShortFrameNameLookup = array();
 
 1917                if (empty($ID3v2ShortFrameNameLookup)) {
 
 1920                        $ID3v2ShortFrameNameLookup[2][
'recommended_buffer_size']           = 
'BUF';
 
 1921                        $ID3v2ShortFrameNameLookup[2][
'comment']                           = 
'COM';
 
 1922                        $ID3v2ShortFrameNameLookup[2][
'audio_encryption']                  = 
'CRA';
 
 1923                        $ID3v2ShortFrameNameLookup[2][
'encrypted_meta_frame']              = 
'CRM';
 
 1924                        $ID3v2ShortFrameNameLookup[2][
'equalisation']                      = 
'EQU';
 
 1925                        $ID3v2ShortFrameNameLookup[2][
'event_timing_codes']                = 
'ETC';
 
 1926                        $ID3v2ShortFrameNameLookup[2][
'general_encapsulated_object']       = 
'GEO';
 
 1927                        $ID3v2ShortFrameNameLookup[2][
'involved_people_list']              = 
'IPL';
 
 1928                        $ID3v2ShortFrameNameLookup[2][
'linked_information']                = 
'LNK';
 
 1929                        $ID3v2ShortFrameNameLookup[2][
'music_cd_identifier']               = 
'MCI';
 
 1930                        $ID3v2ShortFrameNameLookup[2][
'mpeg_location_lookup_table']        = 
'MLL';
 
 1931                        $ID3v2ShortFrameNameLookup[2][
'attached_picture']                  = 
'PIC';
 
 1932                        $ID3v2ShortFrameNameLookup[2][
'popularimeter']                     = 
'POP';
 
 1933                        $ID3v2ShortFrameNameLookup[2][
'reverb']                            = 
'REV';
 
 1934                        $ID3v2ShortFrameNameLookup[2][
'relative_volume_adjustment']        = 
'RVA';
 
 1935                        $ID3v2ShortFrameNameLookup[2][
'synchronised_lyric']                = 
'SLT';
 
 1936                        $ID3v2ShortFrameNameLookup[2][
'synchronised_tempo_codes']          = 
'STC';
 
 1937                        $ID3v2ShortFrameNameLookup[2][
'album']                             = 
'TAL';
 
 1938                        $ID3v2ShortFrameNameLookup[2][
'beats_per_minute']                  = 
'TBP';
 
 1939                        $ID3v2ShortFrameNameLookup[2][
'bpm']                               = 
'TBP';
 
 1940                        $ID3v2ShortFrameNameLookup[2][
'composer']                          = 
'TCM';
 
 1941                        $ID3v2ShortFrameNameLookup[2][
'genre']                             = 
'TCO';
 
 1942                        $ID3v2ShortFrameNameLookup[2][
'part_of_a_compilation']             = 
'TCP';
 
 1943                        $ID3v2ShortFrameNameLookup[2][
'copyright_message']                 = 
'TCR';
 
 1944                        $ID3v2ShortFrameNameLookup[2][
'date']                              = 
'TDA';
 
 1945                        $ID3v2ShortFrameNameLookup[2][
'playlist_delay']                    = 
'TDY';
 
 1946                        $ID3v2ShortFrameNameLookup[2][
'encoded_by']                        = 
'TEN';
 
 1947                        $ID3v2ShortFrameNameLookup[2][
'file_type']                         = 
'TFT';
 
 1948                        $ID3v2ShortFrameNameLookup[2][
'time']                              = 
'TIM';
 
 1949                        $ID3v2ShortFrameNameLookup[2][
'initial_key']                       = 
'TKE';
 
 1950                        $ID3v2ShortFrameNameLookup[2][
'language']                          = 
'TLA';
 
 1951                        $ID3v2ShortFrameNameLookup[2][
'length']                            = 
'TLE';
 
 1952                        $ID3v2ShortFrameNameLookup[2][
'media_type']                        = 
'TMT';
 
 1953                        $ID3v2ShortFrameNameLookup[2][
'original_artist']                   = 
'TOA';
 
 1954                        $ID3v2ShortFrameNameLookup[2][
'original_filename']                 = 
'TOF';
 
 1955                        $ID3v2ShortFrameNameLookup[2][
'original_lyricist']                 = 
'TOL';
 
 1956                        $ID3v2ShortFrameNameLookup[2][
'original_year']                     = 
'TOR';
 
 1957                        $ID3v2ShortFrameNameLookup[2][
'original_album']                    = 
'TOT';
 
 1958                        $ID3v2ShortFrameNameLookup[2][
'artist']                            = 
'TP1';
 
 1959                        $ID3v2ShortFrameNameLookup[2][
'band']                              = 
'TP2';
 
 1960                        $ID3v2ShortFrameNameLookup[2][
'conductor']                         = 
'TP3';
 
 1961                        $ID3v2ShortFrameNameLookup[2][
'remixer']                           = 
'TP4';
 
 1962                        $ID3v2ShortFrameNameLookup[2][
'part_of_a_set']                     = 
'TPA';
 
 1963                        $ID3v2ShortFrameNameLookup[2][
'publisher']                         = 
'TPB';
 
 1964                        $ID3v2ShortFrameNameLookup[2][
'isrc']                              = 
'TRC';
 
 1965                        $ID3v2ShortFrameNameLookup[2][
'recording_dates']                   = 
'TRD';
 
 1966                        $ID3v2ShortFrameNameLookup[2][
'tracknumber']                       = 
'TRK';
 
 1967                        $ID3v2ShortFrameNameLookup[2][
'track_number']                      = 
'TRK';
 
 1968                        $ID3v2ShortFrameNameLookup[2][
'album_artist_sort_order']           = 
'TS2';
 
 1969                        $ID3v2ShortFrameNameLookup[2][
'album_sort_order']                  = 
'TSA';
 
 1970                        $ID3v2ShortFrameNameLookup[2][
'composer_sort_order']               = 
'TSC';
 
 1971                        $ID3v2ShortFrameNameLookup[2][
'size']                              = 
'TSI';
 
 1972                        $ID3v2ShortFrameNameLookup[2][
'performer_sort_order']              = 
'TSP';
 
 1973                        $ID3v2ShortFrameNameLookup[2][
'encoder_settings']                  = 
'TSS';
 
 1974                        $ID3v2ShortFrameNameLookup[2][
'title_sort_order']                  = 
'TST';
 
 1975                        $ID3v2ShortFrameNameLookup[2][
'content_group_description']         = 
'TT1';
 
 1976                        $ID3v2ShortFrameNameLookup[2][
'title']                             = 
'TT2';
 
 1977                        $ID3v2ShortFrameNameLookup[2][
'subtitle']                          = 
'TT3';
 
 1978                        $ID3v2ShortFrameNameLookup[2][
'lyricist']                          = 
'TXT';
 
 1979                        $ID3v2ShortFrameNameLookup[2][
'text']                              = 
'TXX';
 
 1980                        $ID3v2ShortFrameNameLookup[2][
'year']                              = 
'TYE';
 
 1981                        $ID3v2ShortFrameNameLookup[2][
'unique_file_identifier']            = 
'UFI';
 
 1982                        $ID3v2ShortFrameNameLookup[2][
'unsychronised_lyric']               = 
'ULT';
 
 1983                        $ID3v2ShortFrameNameLookup[2][
'url_file']                          = 
'WAF';
 
 1984                        $ID3v2ShortFrameNameLookup[2][
'url_artist']                        = 
'WAR';
 
 1985                        $ID3v2ShortFrameNameLookup[2][
'url_source']                        = 
'WAS';
 
 1986                        $ID3v2ShortFrameNameLookup[2][
'commercial_information']            = 
'WCM';
 
 1987                        $ID3v2ShortFrameNameLookup[2][
'copyright']                         = 
'WCP';
 
 1988                        $ID3v2ShortFrameNameLookup[2][
'url_publisher']                     = 
'WPB';
 
 1989                        $ID3v2ShortFrameNameLookup[2][
'url_user']                          = 
'WXX';
 
 1992                        $ID3v2ShortFrameNameLookup[3][
'audio_encryption']                  = 
'AENC';
 
 1993                        $ID3v2ShortFrameNameLookup[3][
'attached_picture']                  = 
'APIC';
 
 1994                        $ID3v2ShortFrameNameLookup[3][
'picture']                           = 
'APIC';
 
 1995                        $ID3v2ShortFrameNameLookup[3][
'comment']                           = 
'COMM';
 
 1996                        $ID3v2ShortFrameNameLookup[3][
'commercial_frame']                  = 
'COMR';
 
 1997                        $ID3v2ShortFrameNameLookup[3][
'encryption_method_registration']    = 
'ENCR';
 
 1998                        $ID3v2ShortFrameNameLookup[3][
'event_timing_codes']                = 
'ETCO';
 
 1999                        $ID3v2ShortFrameNameLookup[3][
'general_encapsulated_object']       = 
'GEOB';
 
 2000                        $ID3v2ShortFrameNameLookup[3][
'group_identification_registration'] = 
'GRID';
 
 2001                        $ID3v2ShortFrameNameLookup[3][
'linked_information']                = 
'LINK';
 
 2002                        $ID3v2ShortFrameNameLookup[3][
'music_cd_identifier']               = 
'MCDI';
 
 2003                        $ID3v2ShortFrameNameLookup[3][
'mpeg_location_lookup_table']        = 
'MLLT';
 
 2004                        $ID3v2ShortFrameNameLookup[3][
'ownership_frame']                   = 
'OWNE';
 
 2005                        $ID3v2ShortFrameNameLookup[3][
'play_counter']                      = 
'PCNT';
 
 2006                        $ID3v2ShortFrameNameLookup[3][
'popularimeter']                     = 
'POPM';
 
 2007                        $ID3v2ShortFrameNameLookup[3][
'position_synchronisation_frame']    = 
'POSS';
 
 2008                        $ID3v2ShortFrameNameLookup[3][
'private_frame']                     = 
'PRIV';
 
 2009                        $ID3v2ShortFrameNameLookup[3][
'recommended_buffer_size']           = 
'RBUF';
 
 2010                        $ID3v2ShortFrameNameLookup[3][
'replay_gain_adjustment']            = 
'RGAD';
 
 2011                        $ID3v2ShortFrameNameLookup[3][
'reverb']                            = 
'RVRB';
 
 2012                        $ID3v2ShortFrameNameLookup[3][
'synchronised_lyric']                = 
'SYLT';
 
 2013                        $ID3v2ShortFrameNameLookup[3][
'synchronised_tempo_codes']          = 
'SYTC';
 
 2014                        $ID3v2ShortFrameNameLookup[3][
'album']                             = 
'TALB';
 
 2015                        $ID3v2ShortFrameNameLookup[3][
'beats_per_minute']                  = 
'TBPM';
 
 2016                        $ID3v2ShortFrameNameLookup[3][
'bpm']                               = 
'TBPM';
 
 2017                        $ID3v2ShortFrameNameLookup[3][
'part_of_a_compilation']             = 
'TCMP';
 
 2018                        $ID3v2ShortFrameNameLookup[3][
'composer']                          = 
'TCOM';
 
 2019                        $ID3v2ShortFrameNameLookup[3][
'genre']                             = 
'TCON';
 
 2020                        $ID3v2ShortFrameNameLookup[3][
'copyright_message']                 = 
'TCOP';
 
 2021                        $ID3v2ShortFrameNameLookup[3][
'playlist_delay']                    = 
'TDLY';
 
 2022                        $ID3v2ShortFrameNameLookup[3][
'encoded_by']                        = 
'TENC';
 
 2023                        $ID3v2ShortFrameNameLookup[3][
'lyricist']                          = 
'TEXT';
 
 2024                        $ID3v2ShortFrameNameLookup[3][
'file_type']                         = 
'TFLT';
 
 2025                        $ID3v2ShortFrameNameLookup[3][
'content_group_description']         = 
'TIT1';
 
 2026                        $ID3v2ShortFrameNameLookup[3][
'title']                             = 
'TIT2';
 
 2027                        $ID3v2ShortFrameNameLookup[3][
'subtitle']                          = 
'TIT3';
 
 2028                        $ID3v2ShortFrameNameLookup[3][
'initial_key']                       = 
'TKEY';
 
 2029                        $ID3v2ShortFrameNameLookup[3][
'language']                          = 
'TLAN';
 
 2030                        $ID3v2ShortFrameNameLookup[3][
'length']                            = 
'TLEN';
 
 2031                        $ID3v2ShortFrameNameLookup[3][
'media_type']                        = 
'TMED';
 
 2032                        $ID3v2ShortFrameNameLookup[3][
'original_album']                    = 
'TOAL';
 
 2033                        $ID3v2ShortFrameNameLookup[3][
'original_filename']                 = 
'TOFN';
 
 2034                        $ID3v2ShortFrameNameLookup[3][
'original_lyricist']                 = 
'TOLY';
 
 2035                        $ID3v2ShortFrameNameLookup[3][
'original_artist']                   = 
'TOPE';
 
 2036                        $ID3v2ShortFrameNameLookup[3][
'file_owner']                        = 
'TOWN';
 
 2037                        $ID3v2ShortFrameNameLookup[3][
'artist']                            = 
'TPE1';
 
 2038                        $ID3v2ShortFrameNameLookup[3][
'band']                              = 
'TPE2';
 
 2039                        $ID3v2ShortFrameNameLookup[3][
'conductor']                         = 
'TPE3';
 
 2040                        $ID3v2ShortFrameNameLookup[3][
'remixer']                           = 
'TPE4';
 
 2041                        $ID3v2ShortFrameNameLookup[3][
'part_of_a_set']                     = 
'TPOS';
 
 2042                        $ID3v2ShortFrameNameLookup[3][
'publisher']                         = 
'TPUB';
 
 2043                        $ID3v2ShortFrameNameLookup[3][
'tracknumber']                       = 
'TRCK';
 
 2044                        $ID3v2ShortFrameNameLookup[3][
'track_number']                      = 
'TRCK';
 
 2045                        $ID3v2ShortFrameNameLookup[3][
'internet_radio_station_name']       = 
'TRSN';
 
 2046                        $ID3v2ShortFrameNameLookup[3][
'internet_radio_station_owner']      = 
'TRSO';
 
 2047                        $ID3v2ShortFrameNameLookup[3][
'album_artist_sort_order']           = 
'TSO2';
 
 2048                        $ID3v2ShortFrameNameLookup[3][
'album_sort_order']                  = 
'TSOA';
 
 2049                        $ID3v2ShortFrameNameLookup[3][
'composer_sort_order']               = 
'TSOC';
 
 2050                        $ID3v2ShortFrameNameLookup[3][
'performer_sort_order']              = 
'TSOP';
 
 2051                        $ID3v2ShortFrameNameLookup[3][
'title_sort_order']                  = 
'TSOT';
 
 2052                        $ID3v2ShortFrameNameLookup[3][
'isrc']                              = 
'TSRC';
 
 2053                        $ID3v2ShortFrameNameLookup[3][
'encoder_settings']                  = 
'TSSE';
 
 2054                        $ID3v2ShortFrameNameLookup[3][
'text']                              = 
'TXXX';
 
 2055                        $ID3v2ShortFrameNameLookup[3][
'unique_file_identifier']            = 
'UFID';
 
 2056                        $ID3v2ShortFrameNameLookup[3][
'terms_of_use']                      = 
'USER';
 
 2057                        $ID3v2ShortFrameNameLookup[3][
'unsychronised_lyric']               = 
'USLT';
 
 2058                        $ID3v2ShortFrameNameLookup[3][
'commercial_information']            = 
'WCOM';
 
 2059                        $ID3v2ShortFrameNameLookup[3][
'copyright']                         = 
'WCOP';
 
 2060                        $ID3v2ShortFrameNameLookup[3][
'url_file']                          = 
'WOAF';
 
 2061                        $ID3v2ShortFrameNameLookup[3][
'url_artist']                        = 
'WOAR';
 
 2062                        $ID3v2ShortFrameNameLookup[3][
'url_source']                        = 
'WOAS';
 
 2063                        $ID3v2ShortFrameNameLookup[3][
'url_station']                       = 
'WORS';
 
 2064                        $ID3v2ShortFrameNameLookup[3][
'url_payment']                       = 
'WPAY';
 
 2065                        $ID3v2ShortFrameNameLookup[3][
'url_publisher']                     = 
'WPUB';
 
 2066                        $ID3v2ShortFrameNameLookup[3][
'url_user']                          = 
'WXXX';
 
 2070                        $ID3v2ShortFrameNameLookup[4] = $ID3v2ShortFrameNameLookup[3];
 
 2073                        $ID3v2ShortFrameNameLookup[3][
'equalisation']                      = 
'EQUA';
 
 2074                        $ID3v2ShortFrameNameLookup[3][
'involved_people_list']              = 
'IPLS';
 
 2075                        $ID3v2ShortFrameNameLookup[3][
'relative_volume_adjustment']        = 
'RVAD';
 
 2076                        $ID3v2ShortFrameNameLookup[3][
'date']                              = 
'TDAT';
 
 2077                        $ID3v2ShortFrameNameLookup[3][
'time']                              = 
'TIME';
 
 2078                        $ID3v2ShortFrameNameLookup[3][
'original_year']                     = 
'TORY';
 
 2079                        $ID3v2ShortFrameNameLookup[3][
'recording_dates']                   = 
'TRDA';
 
 2080                        $ID3v2ShortFrameNameLookup[3][
'size']                              = 
'TSIZ';
 
 2081                        $ID3v2ShortFrameNameLookup[3][
'year']                              = 
'TYER';
 
 2085                        $ID3v2ShortFrameNameLookup[4][
'audio_seek_point_index']            = 
'ASPI';
 
 2086                        $ID3v2ShortFrameNameLookup[4][
'equalisation']                      = 
'EQU2';
 
 2087                        $ID3v2ShortFrameNameLookup[4][
'relative_volume_adjustment']        = 
'RVA2';
 
 2088                        $ID3v2ShortFrameNameLookup[4][
'seek_frame']                        = 
'SEEK';
 
 2089                        $ID3v2ShortFrameNameLookup[4][
'signature_frame']                   = 
'SIGN';
 
 2090                        $ID3v2ShortFrameNameLookup[4][
'encoding_time']                     = 
'TDEN';
 
 2091                        $ID3v2ShortFrameNameLookup[4][
'original_release_time']             = 
'TDOR';
 
 2092                        $ID3v2ShortFrameNameLookup[4][
'recording_time']                    = 
'TDRC';
 
 2093                        $ID3v2ShortFrameNameLookup[4][
'release_time']                      = 
'TDRL';
 
 2094                        $ID3v2ShortFrameNameLookup[4][
'tagging_time']                      = 
'TDTG';
 
 2095                        $ID3v2ShortFrameNameLookup[4][
'involved_people_list']              = 
'TIPL';
 
 2096                        $ID3v2ShortFrameNameLookup[4][
'musician_credits_list']             = 
'TMCL';
 
 2097                        $ID3v2ShortFrameNameLookup[4][
'mood']                              = 
'TMOO';
 
 2098                        $ID3v2ShortFrameNameLookup[4][
'produced_notice']                   = 
'TPRO';
 
 2099                        $ID3v2ShortFrameNameLookup[4][
'album_sort_order']                  = 
'TSOA';
 
 2100                        $ID3v2ShortFrameNameLookup[4][
'performer_sort_order']              = 
'TSOP';
 
 2101                        $ID3v2ShortFrameNameLookup[4][
'title_sort_order']                  = 
'TSOT';
 
 2102                        $ID3v2ShortFrameNameLookup[4][
'set_subtitle']                      = 
'TSST';
 
 2104                return (isset($ID3v2ShortFrameNameLookup[
$majorversion][strtolower($long_description)]) ? $ID3v2ShortFrameNameLookup[
$majorversion][strtolower($long_description)] : 
'');
 
An exception for terminatinating execution or to throw for unit testing.
analyze($filename, $filesize=null, $original_filename='')
static IsValidID3v2FrameName($framename, $id3v2majorversion)
static TextEncodingTerminatorLookup($encoding)
static LanguageLookup($languagecode, $casesensitive=false)
static ID3v2HeaderLength($majorversion)
static RGADgainString($namecode, $originatorcode, $replaygain)
static Float2String($floatvalue, $bits)
static intValueSupported($num)
static iconv_fallback($in_charset, $out_charset, $string)
static IncludeDependency($filename, $sourcefile, $DieOnFailure=false)
static BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false)
static Unsynchronise($data)
ID3v2IsValidTextEncoding($textencodingbyte)
array_join_merge($arr1, $arr2)
static ID3v2IsValidRGADname($RGADname)
ID3v2IsValidSYLTtype($contenttype)
$id3v2_use_unsynchronisation
static IsValidEmail($email)
ID3v2IsValidETCOevent($eventid)
ID3v2FrameFlagsLookupFileAlter($framename)
static IsWithinBitRange($number, $maxbits, $signed=false)
static ID3v2ShortFrameNameLookup($majorversion, $long_description)
static ID3v2IsValidRGADoriginator($RGADoriginator)
GenerateID3v2FrameData($frame_name, $source_data_array)
ID3v2IsValidCOMRreceivedAs($receivedas)
GenerateID3v2FrameFlags($TagAlter=false, $FileAlter=false, $ReadOnly=false, $Compression=false, $Encryption=false, $GroupingIdentity=false, $Unsynchronisation=false, $DataLengthIndicator=false)
ID3v2IsValidPriceString($pricestring)
ID3v2IsValidAPICpicturetype($picturetype)
static IsValidURL($url, $allowUserPass=false)
GenerateID3v2TagFlags($flags)
GenerateID3v2Tag($noerrorsonly=true)
static safe_parse_url($url)
ID3v2IsValidRVA2channeltype($channeltype)
static IsValidMIMEstring($mimestring)
ID3v2FrameIsAllowed($frame_name, $source_data_array)
$id3v2_default_encodingid
ID3v2IsValidAPICimageformat($imageformat)
ID3v2FrameFlagsLookupTagAlter($framename)