getID3::HandleAllTags() –

You appear to be a bot. Output may be restricted

Description

Usage

$bool = getID3::HandleAllTags();

Parameters

Returns

bool

Source

File name: wordpress/wp-includes/ID3/getid3.php
Lines:

1 to 100 of 127
  public function HandleAllTags() {

    // key name => array (tag name, character encoding)
    static $tags;
    if (empty($tags)) {
      $tags = array(
        'asf'       => array('asf'           , 'UTF-16LE'),
        'midi'      => array('midi'          , 'ISO-8859-1'),
        'nsv'       => array('nsv'           , 'ISO-8859-1'),
        'ogg'       => array('vorbiscomment' , 'UTF-8'),
        'png'       => array('png'           , 'UTF-8'),
        'tiff'      => array('tiff'          , 'ISO-8859-1'),
        'quicktime' => array('quicktime'     , 'UTF-8'),
        'real'      => array('real'          , 'ISO-8859-1'),
        'vqf'       => array('vqf'           , 'ISO-8859-1'),
        'zip'       => array('zip'           , 'ISO-8859-1'),
        'riff'      => array('riff'          , 'ISO-8859-1'),
        'lyrics3'   => array('lyrics3'       , 'ISO-8859-1'),
        'id3v1'     => array('id3v1'         , $this->encoding_id3v1),
        'id3v2'     => array('id3v2'         , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8
        'ape'       => array('ape'           , 'UTF-8'),
        'cue'       => array('cue'           , 'ISO-8859-1'),
        'matroska'  => array('matroska'      , 'UTF-8'),
        'flac'      => array('vorbiscomment' , 'UTF-8'),
        'divxtag'   => array('divx'          , 'ISO-8859-1'),
        'iptc'      => array('iptc'          , 'ISO-8859-1'),
        'dsdiff'    => array('dsdiff'        , 'ISO-8859-1'),
      );
    }

    // loop through comments array
    foreach ($tags as $comment_name => $tagname_encoding_array) {
      list($tag_name, $encoding) = $tagname_encoding_array;

      // fill in default encoding type if not already present
      if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) {
        $this->info[$comment_name]['encoding'] = $encoding;
      }

      // copy comments if key name set
      if (!empty($this->info[$comment_name]['comments'])) {
        foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) {
          foreach ($valuearray as $key => $value) {
            if (is_string($value)) {
              $value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed!
            }
            if (isset($value) && $value !== "") {
              if (!is_numeric($key)) {
                $this->info['tags'][trim($tag_name)][trim($tag_key)][$key] = $value;
              } else {
                $this->info['tags'][trim($tag_name)][trim($tag_key)][]     = $value;
              }
            }
          }
          if ($tag_key == 'picture') {
            // pictures can take up a lot of space, and we don't need multiple copies of them; let there be a single copy in [comments][picture], and not elsewhere
            unset($this->info[$comment_name]['comments'][$tag_key]);
          }
        }

        if (!isset($this->info['tags'][$tag_name])) {
          // comments are set but contain nothing but empty strings, so skip
          continue;
        }

        $this->getID3::CharConvert($this->info['tags'][$tag_name], $this->info[$comment_name]['encoding']);           // only copy gets converted!

        if ($this->option_tags_html) {
          foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) {
            if ($tag_key == 'picture') {
              // Do not to try to convert binary picture data to HTML
              // https://github.com/JamesHeinrich/getID3/issues/178
              continue;
            }
            $this->info['tags_html'][$tag_name][$tag_key] = getid3_lib::recursiveMultiByteCharString2HTML($valuearray, $this->info[$comment_name]['encoding']);
          }
        }

      }

    }

    // pictures can take up a lot of space, and we don't need multiple copies of them; let there be a single copy in [comments][picture], and not elsewhere
    if (!empty($this->info['tags'])) {
      $unset_keys = array('tags', 'tags_html');
      foreach ($this->info['tags'] as $tagtype => $tagarray) {
        foreach ($tagarray as $tagname => $tagdata) {
          if ($tagname == 'picture') {
            foreach ($tagdata as $key => $tagarray) {
              $this->info['comments']['picture'][] = $tagarray;
              if (isset($tagarray['data']) && isset($tagarray['image_mime'])) {
                if (isset($this->info['tags'][$tagtype][$tagname][$key])) {
                  unset($this->info['tags'][$tagtype][$tagname][$key]);
                }
                if (isset($this->info['tags_html'][$tagtype][$tagname][$key])) {
                  unset($this->info['tags_html'][$tagtype][$tagname][$key]);
                }
              }
            }
          }
 

 View on GitHub View on Trac