Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 23. október 2026

Rozdiely pre phpPlatonLib/templateSystems/phpTemplate/Attic/phpTemplate.class.php medzi verziami 1.4 a 1.5

verzia 1.4, 2002/04/03 20:01:19 verzia 1.5, 2002/05/10 00:35:01
Riadok 224  class phpTemplate
Riadok 224  class phpTemplate
   
         function getParse()          function getParse()
         {          {
                 $ret .= $this->_tag[begin_striped] . $this->_tag[command_striped];                  $ret .= $this->_tag['begin_striped'] . $this->_tag['command_striped'];
   
                 foreach ($this->_set_vars as $key => $val) {                  foreach ($this->_set_vars as $key => $val) {
                         if (! is_array($val)) {                          if (! is_array($val)) {
                                 $ret .= str_replace("\n", '\'."\n".\'', '$' . $key . '=\''                                  $ret .= str_replace("\n", '\'."\n".\'', '$' . $key . '=\''
                                                 . str_replace("'", "\'", str_replace("\\", "\\\\", $val)) . '\';');                                                  . str_replace("'", "\'",
                                                           str_replace("\\", "\\\\", $val)) . '\';');
                         }                          }
                 }                  }
   
                 $ret .= $this->_tag[end_striped];                  $ret .= $this->_tag['end_striped'];
   
                 for ($i = 0; $i < count($this->_array); $i++) {                  for ($i = 0; $i < count($this->_array); $i++) {
                         // TODO: byte counting (last bit check)                          // TODO: byte counting (last bit check)
                         if ($i % 2) {                          if ($i % 2) {
                                 $ret .= $this->_tag[begin_striped]                                  $ret .= $this->_tag['begin_striped']
                                         . $this->_tag[command_striped]                                          . $this->_tag['command_striped']
                                         . str_replace("\n", '\'."\n".\'',                                          . str_replace("\n", '\'."\n".\'',
                                                         $this->_simpleEchoTransform($this->_array[$i]))                                                          $this->_simpleEchoTransform($this->_array[$i]))
                                         . $this->_tag[end_striped];                                          . $this->_tag['end_striped'];
                         }                          }
                         else {                          else {
                                 $ret .= $this->_array[$i];                                  $ret .= $this->_array[$i];
                         }                          }
                 }                  }
 /*                  /*
                    echo "<pre>getParse():\n";                     echo "<pre>getParse():\n";
                    echo htmlentities($ret);                     echo htmlentities($ret);
                    echo "</pre>";                     echo "</pre>";
                    exit;                     exit;
 */                   */
                 return $ret;                  return $ret;
         }          }
   
         function getCode()          function getCode()
         {          {
                 $ret = '';                  $ret = '';
   /*
                 foreach ($this->_set_vars as $key => $val) {                  foreach ($this->_vars as $key) {
                         if (! is_array($val)) {                          if (isset($this->_set_vars[$key])) {
                                 $ret .= ('$' . $key . '=\''                                  $val = $this->_set_vars[$key];
                                                 . str_replace("'", "\'", str_replace("\\", "\\\\", $val)) . '\';' . "\n");                                  if (! is_array($val)) {
                                           $ret .= ('$' . $key . '=\''
                                                           . str_replace("'", "\'",
                                                                   str_replace("\\", "\\\\", $val)) . '\';'
                                                           . "\n");
                                   }
                           }
                           else {
                                   $ret .= ('if (!isset($'.$key.'))$' . $key . '=\'\';' . "\n");
                         }                          }
                 }                  }
   */
                   /* Note:
                      This was old subtitution code. But I turned on full error reporting
                      in phpMyEzin project and phptemplate causes undefined variable error.
                    */
   
                      foreach ($this->_set_vars as $key => $val) {
                      if (! is_array($val)) {
                      $ret .= ('$' . $key . '=\''
                      . str_replace("'", "\'", str_replace("\\", "\\\\", $val)) . '\';' . "\n");
                      }
                      }
   
   
                 for ($i = 0; $i < count($this->_array); $i++) {                  for ($i = 0; $i < count($this->_array); $i++) {
                         // TODO: byte counting (last bit check)                          // TODO: byte counting (last bit check)
Riadok 274  class phpTemplate
Riadok 296  class phpTemplate
                                 $ret .= $this->_simpleEchoTransform($this->_array[$i]);                                  $ret .= $this->_simpleEchoTransform($this->_array[$i]);
                         }                          }
                         else {                          else {
                                 $ret .= ('echo(\'' . str_replace("'", "\'", str_replace("\\", "\\\\", $this->_array[$i]))                                  $ret .= ('echo(\'' .
                                                           str_replace("'", "\'",
                                                                   str_replace("\\", "\\\\", $this->_array[$i]))
                                                         . '\');');                                                          . '\');');
                         }                          }
                         $ret .= "\n";                          $ret .= "\n";
Riadok 293  class phpTemplate
Riadok 317  class phpTemplate
                 if (preg_match_all('/echo[(]\s*\$(\w[\w\d_]*)\s*[)];/', $str, $matches)) {                  if (preg_match_all('/echo[(]\s*\$(\w[\w\d_]*)\s*[)];/', $str, $matches)) {
                         foreach ($matches[1] as $val) {                          foreach ($matches[1] as $val) {
                                 //echo "<b>than matched $val</b><br>";                                  //echo "<b>than matched $val</b><br>";
                                 if (is_array($this->_set_vars[$val])) {                                  if (isset($this->_set_vars[$val]) && is_array($this->_set_vars[$val])) {
                                         //echo "<b>and array founded containing [".$this->_set_vars[$val][0]."]</b><br>";                                          //echo "<b>and array founded containing [".$this->_set_vars[$val][0]."]</b><br>";
                                         $replacement = $this->_simpleEchoTransform($this->_set_vars[$val][0]);                                          $replacement = $this->_simpleEchoTransform($this->_set_vars[$val][0]);
                                         $str = preg_replace('/echo[(]\s*\$'.$val.'\s*[)];/', $replacement, $str);                                          $str = preg_replace('/echo[(]\s*\$'.$val.'\s*[)];/', $replacement, $str);

Legend:
Odstranené z verzie1.4  
zmenené riadky
  Pridané vo verzii1.5

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok