wppaste
WordPress

getid3_id3v2

Source
wp-includes/ID3/module.tag.id3v2.php:22

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 1

$StartingOffsetpublic

Methods · 28

Source code

class getid3_id3v2 extends getid3_handler{	public $StartingOffset = 0; 	/**	 * @return bool	 */	public function Analyze() {		$info = &$this->getid3->info; 		//    Overall tag structure:		//        +-----------------------------+		//        |      Header (10 bytes)      |		//        +-----------------------------+		//        |       Extended Header       |		//        | (variable length, OPTIONAL) |		//        +-----------------------------+		//        |   Frames (variable length)  |		//        +-----------------------------+		//        |           Padding           |		//        | (variable length, OPTIONAL) |		//        +-----------------------------+		//        | Footer (10 bytes, OPTIONAL) |		//        +-----------------------------+ 		//    Header		//        ID3v2/file identifier      "ID3"		//        ID3v2 version              $04 00		//        ID3v2 flags                (%ab000000 in v2.2, %abc00000 in v2.3, %abcd0000 in v2.4.x)		//        ID3v2 size             4 * %0xxxxxxx  		// shortcuts		$info['id3v2']['header'] = true;		$thisfile_id3v2                  = &$info['id3v2'];		$thisfile_id3v2['flags']         =  array();		$thisfile_id3v2_flags            = &$thisfile_id3v2['flags'];  		$this->fseek($this->StartingOffset);		$header = $this->fread(10);		if (substr($header, 0, 3) == 'ID3'  &&  strlen($header) == 10) { 			$thisfile_id3v2['majorversion'] = ord($header[3]);			$thisfile_id3v2['minorversion'] = ord($header[4]); 			// shortcut			$id3v2_majorversion = &$thisfile_id3v2['majorversion']; 		} else { 			unset($info['id3v2']);			return false; 		} 		if ($id3v2_majorversion > 4) { // this script probably won't correctly parse ID3v2.5.x and above (if it ever exists) 			$this->error('this script only parses up to ID3v2.4.x - this tag is ID3v2.'.$id3v2_majorversion.'.'.$thisfile_id3v2['minorversion']);			return false; 		} 		$id3_flags = ord($header[5]);		switch ($id3v2_majorversion) {			case 2:				// %ab000000 in v2.2				$thisfile_id3v2_flags['unsynch']     = (bool) ($id3_flags & 0x80); // a - Unsynchronisation				$thisfile_id3v2_flags['compression'] = (bool) ($id3_flags & 0x40); // b - Compression				break; 			case 3:				// %abc00000 in v2.3				$thisfile_id3v2_flags['unsynch']     = (bool) ($id3_flags & 0x80); // a - Unsynchronisation				$thisfile_id3v2_flags['exthead']     = (bool) ($id3_flags & 0x40); // b - Extended header				$thisfile_id3v2_flags['experim']     = (bool) ($id3_flags & 0x20); // c - Experimental indicator				break; 			case 4:				// %abcd0000 in v2.4

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/ID3/module.tag.id3v2.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.