Ignore:
Timestamp:
12/14/12 14:30:35 (11 years ago)
Author:
douglasz
Message:

Ticket #3236 - Melhorias de performance no codigo do Expresso.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/smarty/Smarty_Compiler.class.php

    r795 r7655  
    277277 
    278278        /* loop through text blocks */ 
    279         for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) { 
     279        for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; ++$curr_tb) { 
    280280            /* match anything resembling php tags */ 
    281281            if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?\s*php\s*[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) { 
     
    283283                $sp_match[1] = array_unique($sp_match[1]); 
    284284                usort($sp_match[1], '_smarty_sort_length'); 
    285                 for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { 
     285                for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; ++$curr_sp) { 
    286286                    $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]); 
    287287                } 
    288288                /* process each one */ 
    289                 for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { 
     289                for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; ++$curr_sp) { 
    290290                    if ($this->php_handling == SMARTY_PHP_PASSTHRU) { 
    291291                        /* echo php contents */ 
     
    308308        /* Compile the template tags into PHP code. */ 
    309309        $compiled_tags = array(); 
    310         for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) { 
     310        for ($i = 0, $for_max = count($template_tags); $i < $for_max; ++$i) { 
    311311            $this->_current_line_no += substr_count($text_blocks[$i], "\n"); 
    312312            $compiled_tags[] = $this->_compile_tag($template_tags[$i]); 
     
    331331            if ($strip) { 
    332332                /* strip all $text_blocks before the next '/strip' */ 
    333                 for ($j = $i + 1; $j < $for_max; $j++) { 
     333                for ($j = $i + 1; $j < $for_max; ++$j) { 
    334334                    /* remove leading and trailing whitespaces of each line */ 
    335335                    $text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $text_blocks[$j]); 
     
    354354         
    355355        /* Interleave the compiled contents and text blocks to get the final result. */ 
    356         for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) { 
     356        for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; ++$i) { 
    357357            if ($compiled_tags[$i] == '') { 
    358358                // tag result empty, remove first newline from following text block 
     
    12791279 
    12801280        $is_arg_stack = array(); 
    1281  
    1282         for ($i = 0; $i < count($tokens); $i++) { 
     1281        $tokens_count = count($tokens); 
     1282         
     1283        for ($i = 0; $i < $tokens_count; ++$i) { 
    12831284 
    12841285            $token = &$tokens[$i]; 
     
    14701471            case 'even': 
    14711472                if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') { 
    1472                     $expr_end++; 
     1473                    ++$expr_end; 
    14731474                    $expr_arg = $tokens[$expr_end++]; 
    14741475                    $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; 
     
    14791480            case 'odd': 
    14801481                if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') { 
    1481                     $expr_end++; 
     1482                    ++$expr_end; 
    14821483                    $expr_arg = $tokens[$expr_end++]; 
    14831484                    $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; 
     
    14881489            case 'div': 
    14891490                if (@$tokens[$expr_end] == 'by') { 
    1490                     $expr_end++; 
     1491                    ++$expr_end; 
    14911492                    $expr_arg = $tokens[$expr_end++]; 
    14921493                    $expr = "!($is_arg % " . $this->_parse_var_props($expr_arg) . ")"; 
     
    18431844        $this->_parse_vars_props($match); 
    18441845        $replace = array(); 
    1845         for ($i = 0, $count = count($match); $i < $count; $i++) { 
     1846        for ($i = 0, $count = count($match); $i < $count; ++$i) { 
    18461847            $replace[$orig_vals[$i]] = $match[$i]; 
    18471848        } 
     
    19051906        list(, $_modifiers, $modifier_arg_strings) = $_match; 
    19061907 
    1907         for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) { 
     1908        for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; ++$_i) { 
    19081909            $_modifier_name = $_modifiers[$_i]; 
    19091910 
Note: See TracChangeset for help on using the changeset viewer.