Ignore:
Timestamp:
Dec 29, 2009, 12:58:13 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Tabulka týmů doplněna o položy URL web stránek, identifikaci vůdce týmu a času vytvoření týmu.
  • Opraveno: Vstupování do týmů ze stránky nastavení překladatele.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/import/generatecodeXML.php

    r195 r302  
    55function startElement($parser, $name, $attrs)
    66{
    7     global $depth,$xml_buffer;
    8     for ($i = 0; $i < $depth[$parser]; $i++) {
    9         echo "  ";
    10     }
     7  global $depth, $xml_buffer;
     8 
     9  for ($i = 0; $i < $depth[$parser]; $i++)
     10  {
     11    echo "  ";
     12  }
    1113   // echo "<BR />$name\n";
    1214//    print_r( $attrs);
     
    2022function endElement($parser, $name)
    2123{
    22     global $depth;
    23     $depth[$parser]--;
     24  global $depth;
     25 
     26  $depth[$parser]--;
    2427}
    2528//TODO '.$Config['Web']['GameVersion'].'
     
    2730
    2831$files = scandir($verze);
    29 foreach($files as $file) {
    30 $end = substr($file,strlen($file)-3);
    31 if ($end == 'xml'){
    32         echo '<br />--'.$file.'<br /><br />';
    33         $file = $verze.'/'.$file;       
    34         $xml_buffer = array(); //mazání
    35        
     32foreach($files as $file)
     33{
     34  $end = substr($file, strlen($file) - 3);
     35  if($end == 'xml')
     36  {
     37    echo('<br />--'.$file.'<br /><br />');
     38    $file = $verze.'/'.$file;
     39    $xml_buffer = array(); //mazání
     40 
     41    $xml_parser = xml_parser_create();
     42    xml_set_element_handler($xml_parser, 'startElement', 'endElement');
     43    if (!($fp = fopen($file, 'r')))
     44    {
     45      die('could not open XML input');
     46    }
    3647
    37         $xml_parser = xml_parser_create();
    38         xml_set_element_handler($xml_parser, "startElement", "endElement");
    39         if (!($fp = fopen($file, "r"))) {
    40         die("could not open XML input");
    41         }
    42 
    43         while ($data = fread($fp, 4096)) {
    44         if (!xml_parse($xml_parser, $data, feof($fp))) {
    45                 die(sprintf("XML error: %s at line %d",
     48    while ($data = fread($fp, 4096))
     49    {
     50      if (!xml_parse($xml_parser, $data, feof($fp)))
     51      {
     52        die(sprintf("XML error: %s at line %d",
    4653                    xml_error_string(xml_get_error_code($xml_parser)),
    4754                    xml_get_current_line_number($xml_parser)));
    48         }
    49         }
    50         xml_parser_free($xml_parser);
    51        
    52    for ($i = 0; $i < count($xml_buffer); $i++) {
    53           $line = $xml_buffer[$i];
    54           if (isset($line[1]['TEXT'])) {
    55                 $name = $line[1]['NAME'];
     55      }
     56    }
     57    xml_parser_free($xml_parser);
     58 
     59    for ($i = 0; $i < count($xml_buffer); $i++)
     60    {
     61      $line = $xml_buffer[$i];
     62       if (isset($line[1]['TEXT']))
     63      {
     64        $name = $line[1]['NAME'];
    5665
    57                         if ($name == '') { //u FontString
    58                         $j = 1;
    59                                 while (substr($name,0,1) == '') {
    60                                         if (isset($xml_buffer[$i-$j][1]['NAME'])) {
    61                                                 $name = $xml_buffer[$i-$j][1]['NAME'].$name;
    62                                         }
    63                                         $j++;                           
    64                                 }
    65                         }
     66        if ($name == '')
     67        { //u FontString
     68          $j = 1;
     69          while (substr($name,0,1) == '')
     70          {
     71            if (isset($xml_buffer[$i-$j][1]['NAME']))
     72            {
     73              $name = $xml_buffer[$i-$j][1]['NAME'].$name;
     74            }
     75            $j++;         
     76          }
     77        }
    6678
    67           if (substr($name,0,1) == '$') { //zjišťování potomků
    68                         $j = 1;
    69                                 while (substr($name,0,1) == '$') {
    70                                         if (($xml_buffer[$i-$j][0] < $line[0]) and (isset($xml_buffer[$i-$j][1]['NAME']))) {
    71                                         $name = substr($name,strlen('$parent'));
    72                                                 $name = $xml_buffer[$i-$j][1]['NAME'].$name;
    73                                         }
    74                                         $j++;                           
    75                                 }
    76                         }
    77                         if ((' - ' <> $line[1]['TEXT']) and ('' <> $line[1]['TEXT']))
    78                                 echo $name.':SetText(i["'.$line[1]['TEXT'].'"]);<br />';
    79                 }
     79        if (substr($name,0,1) == '$')
     80        { //zjišťování potomků
     81          $j = 1;
     82          while (substr($name,0,1) == '$')
     83          {
     84            if (($xml_buffer[$i-$j][0] < $line[0]) and (isset($xml_buffer[$i-$j][1]['NAME'])))
     85            {
     86              $name = substr($name,strlen('$parent'));
     87              $name = $xml_buffer[$i-$j][1]['NAME'].$name;
     88            }
     89            $j++;         
     90          }
     91        }
     92        if ((' - ' <> $line[1]['TEXT']) and ('' <> $line[1]['TEXT']))
     93          echo $name.':SetText(i["'.$line[1]['TEXT'].'"]);<br />';
     94      }
     95    }
     96  }
     97}
    8098
    81     }
    82 }
    83 }
    8499?>
Note: See TracChangeset for help on using the changeset viewer.