Ignore:
Timestamp:
12/18/12 16:15:29 (11 years ago)
Author:
douglasz
Message:

Ticket #3236 - Correcoes para Performance: Function Within Loop Declaration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.exporteml.inc.php

    r7655 r7673  
    123123                    if (is_array($files)) 
    124124                    { 
    125                         for ($i=0; $i < count($files); ++$i) 
     125                        $files_count = count($files); 
     126                        for ($i=0; $i < $files_count; ++$i) 
    126127                        { 
    127128                            $files[$i] = escapeshellarg($files[$i]); 
     
    315316                         
    316317                        //cria um .zip com as mensagens selecionadas 
    317                         for($i = 0; $i < count($msg_number); ++$i) 
     318            $msg_number_count = count($msg_number); 
     319                        for($i = 0; $i < $msg_number_count; ++$i) 
    318320                        { 
    319321                                $header         = $this-> getHeader($msg_number[$i]);                                                                                    
     
    353355                }else{ 
    354356                        $array_names_keys = array_keys($sorted_msgs); 
    355                          
    356                         for($i = 0; $i < count($array_names_keys); ++$i){ 
     357 
     358            $array_names_keys_count = count($array_names_keys); 
     359                        for($i = 0; $i < $array_names_keys_count; ++$i){ 
    357360                                $this->folder = mb_convert_encoding($array_names_keys[$i], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 
    358361                                $msg_number = explode(',', $sorted_msgs[$array_names_keys[$i]]); 
    359362                                $tempDir = $this->tempDir; 
    360363                                $this->connectImap(); 
    361                                  
    362                                 for($j = 0; $j < count($msg_number); ++$j) 
     364 
     365                $msg_number_count = count($msg_number); 
     366                                for($j = 0; $j < $msg_number_count; ++$j) 
    363367                                { 
    364368                                        $header         = $this-> getHeader($msg_number[$j]);                                                                                    
     
    474478                        } 
    475479 
    476                         for($i = 0; $i < count($array_ids); ++$i) 
     480            $array_ids_count = count($array_ids); 
     481                        for($i = 0; $i < $array_ids_count; ++$i) 
    477482                        { 
    478483                                $header         = $this-> getHeader($array_ids[$i]);                                                                                    
     
    796801                 
    797802                $fileNames = Array(); 
    798                          
    799                 for ($i = 0; $i < count($attachments); ++$i) 
     803                $attachments_count = count($attachments); 
     804                for ($i = 0; $i < $attachments_count; ++$i) 
    800805                { 
    801806                   $attachments[$i]['name'] = $this->remove_accents($attachments[$i]['name']); 
     
    803808                } 
    804809 
    805                 for ($i = 0; $i < count($attachments); ++$i) 
     810                $attachments_count = count($attachments); 
     811                for ($i = 0; $i < $attachments_count; ++$i) 
    806812                { 
    807813                        $fileName = $attachments[$i]['name']; 
     
    811817                        if (count($result) > 1) 
    812818                        { 
    813                             for ($j = 1; $j < count($result); ++$j) 
     819                            $result_count = count($result); 
     820                            for ($j = 1; $j < $result_count; ++$j) 
    814821                            { 
    815822                                $replacement = '('.$j.')$0'; 
Note: See TracChangeset for help on using the changeset viewer.