/**
  * Reads the data of a style exchange format file.
  * 
  * @param	Tar	$tar
  * @return	array		data
  */
 public static function readStyleData($tar)
 {
     // search style.xml
     $i = $tar->getIndexByFilename(self::INFO_FILE);
     if ($i === false) {
         throw new SystemException("unable to find required file '" . self::INFO_FILE . "' in style archive", 100001);
     }
     // open style.xml
     $styleXML = new XML();
     $styleXML->loadString($tar->extractToString($i));
     $xmlContent = $styleXML->getElementTree('style');
     $data = array('name' => '', 'description' => '', 'version' => '', 'image' => '', 'copyright' => '', 'license' => '', 'authorName' => '', 'authorURL' => '', 'templates' => '', 'images' => '', 'variables' => '', 'date' => '0000-00-00', 'icons' => '');
     foreach ($xmlContent['children'] as $child) {
         switch ($child['name']) {
             case 'general':
                 foreach ($child['children'] as $general) {
                     switch ($general['name']) {
                         case 'stylename':
                             $data['name'] = $general['cdata'];
                             break;
                         case 'description':
                         case 'version':
                         case 'date':
                         case 'image':
                         case 'copyright':
                         case 'license':
                             $data[$general['name']] = $general['cdata'];
                             break;
                     }
                 }
                 break;
             case 'author':
                 foreach ($child['children'] as $author) {
                     switch ($author['name']) {
                         case 'authorname':
                             $data['authorName'] = $author['cdata'];
                             break;
                         case 'authorurl':
                             $data['authorURL'] = $author['cdata'];
                             break;
                     }
                 }
                 break;
             case 'files':
                 foreach ($child['children'] as $files) {
                     switch ($files['name']) {
                         case 'templates':
                         case 'images':
                         case 'variables':
                         case 'icons':
                             $data[$files['name']] = $files['cdata'];
                             break;
                     }
                 }
                 break;
         }
     }
     if (empty($data['name'])) {
         throw new SystemException("required tag 'stylename' is missing in '" . self::INFO_FILE . "'", 100002);
     }
     if (empty($data['variables'])) {
         throw new SystemException("required tag 'variables' is missing in '" . self::INFO_FILE . "'", 100002);
     }
     // search variables.xml
     $i = $tar->getIndexByFilename($data['variables']);
     if ($i === false) {
         throw new SystemException("unable to find required file '" . $data['variables'] . "' in style archive", 100001);
     }
     // open variables.xml
     $data['variables'] = self::readVariablesData($tar->extractToString($i));
     // convert encoding
     if (CHARSET != 'UTF-8') {
         $data['name'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['name']);
         foreach ($data['variables'] as $key => $value) {
             $data['variables'][$key] = StringUtil::convertEncoding('UTF-8', CHARSET, $value);
         }
         $data['description'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['description']);
         $data['version'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['version']);
         $data['date'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['date']);
         $data['image'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['image']);
         $data['copyright'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['copyright']);
         $data['license'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['license']);
         $data['authorName'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['authorName']);
         $data['authorURL'] = StringUtil::convertEncoding('UTF-8', CHARSET, $data['authorURL']);
     }
     return $data;
 }