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

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

Location:
trunk/workflow/inc/smarty
Files:
13 edited

Legend:

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

    r795 r7655  
    282282        preg_match_all('!^.*\r?\n?!m', $contents, $match); 
    283283        $lines = $match[0]; 
    284         for ($i=0, $count=count($lines); $i<$count; $i++) { 
     284        for ($i=0, $count=count($lines); $i<$count; ++$i) { 
    285285            $line = $lines[$i]; 
    286286            if (empty($line)) continue; 
  • 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 
  • trunk/workflow/inc/smarty/internals/core.process_cached_inserts.php

    r795 r7655  
    1818    list($cached_inserts, $insert_args) = $match; 
    1919 
    20     for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) { 
     20    for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; ++$i) { 
    2121        if ($smarty->debugging) { 
    2222            $_params = array(); 
  • trunk/workflow/inc/smarty/internals/core.write_cache_file.php

    r795 r7655  
    4444        $level = 0; 
    4545        $j = 0; 
    46         for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) { 
     46        for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; ++$i) { 
    4747            if ($results[$i] == $match[0][$j]) { 
    4848                // nocache tag 
     
    5353                    if ($level++ > 0) unset($results[$i]); 
    5454                } 
    55                 $j++; 
     55                ++$j; 
    5656            } elseif ($level > 0) { 
    5757                unset($results[$i]); 
  • trunk/workflow/inc/smarty/internals/core.write_compiled_include.php

    r795 r7655  
    3838 
    3939    $this_varname = ((double)phpversion() >= 5.0) ? '_smarty' : 'this'; 
    40     for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) { 
     40    for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; ++$_i) { 
    4141        $_match =& $_match_source[$_i]; 
    4242        $source = $_match[4]; 
     
    5757            } 
    5858 
    59             for ($i=0, $count = count($tokens); $i < $count; $i++) { 
     59            for ($i=0, $count = count($tokens); $i < $count; ++$i) { 
    6060                if (is_array($tokens[$i])) { 
    6161                    if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') { 
  • trunk/workflow/inc/smarty/plugins/block.textformat.php

    r795 r7655  
    7676    $_output = ''; 
    7777 
    78     for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { 
     78    for($_x = 0, $_y = count($_paragraphs); $_x < $_y; ++$_x) { 
    7979        if ($_paragraphs[$_x] == '') { 
    8080            continue; 
  • trunk/workflow/inc/smarty/plugins/function.config_load.php

    r795 r7655  
    121121                $smarty->_config[1]['files'][$_file] = true; 
    122122        } else if ($_scope == 'global') { 
    123             for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) { 
     123            for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; ++$i) { 
    124124                $smarty->_config[$i]['vars'] = @array_merge($smarty->_config[$i]['vars'], $_config_vars); 
    125125                $smarty->_config[$i]['files'][$_file] = true; 
  • trunk/workflow/inc/smarty/plugins/function.html_select_date.php

    r795 r7655  
    181181    $field_separator_count = -1; 
    182182    if ($display_months) { 
    183         $field_separator_count++; 
     183        ++$field_separator_count; 
    184184        $month_names = array(); 
    185185        $month_values = array(); 
     
    188188            $month_values[''] = ''; 
    189189        } 
    190         for ($i = 1; $i <= 12; $i++) { 
     190        for ($i = 1; $i <= 12; ++$i) { 
    191191            $month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000)); 
    192192            $month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000)); 
     
    225225            $day_values[''] = ''; 
    226226        } 
    227         for ($i = 1; $i <= 31; $i++) { 
     227        for ($i = 1; $i <= 31; ++$i) { 
    228228            $days[] = sprintf($day_format, $i); 
    229229            $day_values[] = sprintf($day_value_format, $i); 
     
    255255 
    256256    if ($display_years) { 
    257         $field_separator_count++; 
     257        ++$field_separator_count; 
    258258        if (null !== $field_array){ 
    259259            $year_name = $field_array . '[' . $prefix . 'Year]'; 
     
    303303 
    304304    // Loop thru the field_order field 
    305     for ($i = 0; $i <= 2; $i++){ 
     305    for ($i = 0; $i <= 2; ++$i){ 
    306306        $c = substr($field_order, $i, 1); 
    307307        switch ($c){ 
  • trunk/workflow/inc/smarty/plugins/function.html_select_time.php

    r795 r7655  
    8585        $hours       = $use_24_hours ? range(0, 23) : range(1, 12); 
    8686        $hour_fmt = $use_24_hours ? '%H' : '%I'; 
    87         for ($i = 0, $for_max = count($hours); $i < $for_max; $i++) 
     87        for ($i = 0, $for_max = count($hours); $i < $for_max; ++$i) 
    8888            $hours[$i] = sprintf('%02d', $hours[$i]); 
    8989        $html_result .= '<select name='; 
  • trunk/workflow/inc/smarty/plugins/function.html_table.php

    r795 r7655  
    128128        $output .= "<thead><tr>\n"; 
    129129 
    130         for ($r=0; $r<$cols_count; $r++) { 
     130        for ($r=0; $r<$cols_count; ++$r) { 
    131131            $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>'; 
    132132            $output .= $cols[$r]; 
     
    137137 
    138138    $output .= "<tbody>\n"; 
    139     for ($r=0; $r<$rows; $r++) { 
     139    for ($r=0; $r<$rows; ++$r) { 
    140140        $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n"; 
    141141        $rx =  ($vdir == 'down') ? $r*$cols_count : ($rows-1-$r)*$cols_count; 
    142142 
    143         for ($c=0; $c<$cols_count; $c++) { 
     143        for ($c=0; $c<$cols_count; ++$c) { 
    144144            $x =  ($hdir == 'right') ? $rx+$c : $rx+$cols_count-1-$c; 
    145145            if ($inner!='cols') { 
  • trunk/workflow/inc/smarty/plugins/function.mailto.php

    r795 r7655  
    8989 
    9090    $mail_parm_vals = ''; 
    91     for ($i=0; $i<count($mail_parms); $i++) { 
     91    $mail_parms_count = count($mail_parms); 
     92    for ($i=0; $i<$mail_parms_count; ++$i) { 
    9293        $mail_parm_vals .= (0==$i) ? '?' : '&'; 
    9394        $mail_parm_vals .= $mail_parms[$i]; 
     
    105106 
    106107        $js_encode = ''; 
    107         for ($x=0; $x < strlen($string); $x++) { 
     108        for ($x=0; $x < strlen($string); ++$x) { 
    108109            $js_encode .= '%' . bin2hex($string[$x]); 
    109110        } 
     
    114115        $string = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>'; 
    115116 
    116         for($x = 0, $y = strlen($string); $x < $y; $x++ ) { 
     117        for($x = 0, $y = strlen($string); $x < $y; ++$x ) { 
    117118            $ord[] = ord($string[$x]);    
    118119        } 
     
    138139        } 
    139140        $address_encode = ''; 
    140         for ($x=0; $x < strlen($address); $x++) { 
     141        for ($x=0; $x < strlen($address); ++$x) { 
    141142            if(preg_match('!\w!',$address[$x])) { 
    142143                $address_encode .= '%' . bin2hex($address[$x]); 
     
    146147        } 
    147148        $text_encode = ''; 
    148         for ($x=0; $x < strlen($text); $x++) { 
     149        for ($x=0; $x < strlen($text); ++$x) { 
    149150            $text_encode .= '&#x' . bin2hex($text[$x]).';'; 
    150151        } 
  • trunk/workflow/inc/smarty/plugins/modifier.escape.php

    r795 r7655  
    4242            // escape every character into hex 
    4343            $return = ''; 
    44             for ($x=0; $x < strlen($string); $x++) { 
     44            for ($x=0; $x < strlen($string); ++$x) { 
    4545                $return .= '%' . bin2hex($string[$x]); 
    4646            } 
     
    4949        case 'hexentity': 
    5050            $return = ''; 
    51             for ($x=0; $x < strlen($string); $x++) { 
     51            for ($x=0; $x < strlen($string); ++$x) { 
    5252                $return .= '&#x' . bin2hex($string[$x]) . ';'; 
    5353            } 
     
    5656        case 'decentity': 
    5757            $return = ''; 
    58             for ($x=0; $x < strlen($string); $x++) { 
     58            for ($x=0; $x < strlen($string); ++$x) { 
    5959                $return .= '&#' . ord($string[$x]) . ';'; 
    6060            } 
     
    7272           // escape non-standard chars, such as ms document quotes 
    7373           $_res = ''; 
    74            for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) { 
     74           for($_i = 0, $_len = strlen($string); $_i < $_len; ++$_i) { 
    7575               $_ord = ord(substr($string, $_i, 1)); 
    7676               // non-standard char, escape it 
  • trunk/workflow/inc/smarty/plugins/outputfilter.trimwhitespace.php

    r795 r7655  
    6565    $_len = strlen($search_str); 
    6666    $_pos = 0; 
    67     for ($_i=0, $_count=count($replace); $_i<$_count; $_i++) 
     67    for ($_i=0, $_count=count($replace); $_i<$_count; ++$_i) 
    6868        if (($_pos=strpos($subject, $search_str, $_pos))!==false) 
    6969            $subject = substr_replace($subject, $replace[$_i], $_pos, $_len); 
Note: See TracChangeset for help on using the changeset viewer.