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

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

Location:
trunk/expressoMail1_2/inc
Files:
6 edited

Legend:

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

    r7655 r7673  
    181181 
    182182        function getAddrs($array_addrs) { 
    183                 $array_addrs_final = array();                            
    184  
    185                 for($i = 0; $i < count($array_addrs); ++$i){ 
     183                $array_addrs_final = array(); 
     184 
     185        $array_addrs_count = count($array_addrs); 
     186                for($i = 0; $i < $array_addrs_count; ++$i){ 
    186187                        $j = count($array_addrs_final); 
    187188 
  • 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'; 
  • trunk/expressoMail1_2/inc/class.functions.inc.php

    r7655 r7673  
    126126                                $includeFiles[0] = null; 
    127127                                // End Bug fixed. 
    128                         }                                                                                                                
    129                         for($i = 0; $i < count($files); ++$i) { 
     128                        } 
     129            $files_count = count($files); 
     130                        for($i = 0; $i < $files_count; ++$i) { 
    130131                                if(count(explode('.js',$files[$i])) > 1) { 
    131132                                        if($includeFiles  && array_search(trim($files[$i]),$includeFiles)){      
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r7655 r7673  
    245245                                                                array('filter' => $filter, 'criteria' => array('deepness' => '2')) 
    246246                                                        ); 
    247                                                         for($i=0; $i<count($sort_array_msg); ++$i){ 
     247                            $sort_array_msg_count = count($sort_array_msg); 
     248                                                        for($i=0; $i<$sort_array_msg_count; ++$i){ 
    248249                                                                if(!isset($return[$i]['msg_number'])) 
    249250                                                                        continue; 
     
    518519                        $elements = imap_mime_header_decode($string); 
    519520 
    520                         for($i = 0;$i < count($elements);++$i) 
     521            $elements_count = count($elements); 
     522                        for($i = 0;$i < $elements_count;++$i) 
    521523                        { 
    522524                                $charset = strtolower($elements[$i]->charset); 
     
    785787                        $return = array(); 
    786788                        $array_names_keys = array_keys($sorted_msgs); 
    787                          
    788                         for($i = 0; $i < count($sorted_msgs); ++$i){ 
     789 
     790            $sorted_msgs_count = count($sorted_msgs); 
     791                        for($i = 0; $i < $sorted_msgs_count; ++$i){ 
    789792                         
    790793                                $new_params = array(); 
     
    25592562                }else{ 
    25602563                        $child = $base_path.$this->imap_delimiter; 
    2561                         for($i =0; $i < count($test); ++$i){ 
     2564            $test_count = count($test); 
     2565                        for($i =0; $i < $test_count; ++$i){ 
    25622566                                $child .= ($test[$i] ? $test[$i] : $this->functions->getLang("New Folder")); 
    25632567                                $namebox =  mb_convert_encoding($child, "UTF7-IMAP", "UTF-8"); 
     
    36543658                        return $returns; 
    36553659                }else{ 
    3656                         for($i = 0; $i < count($array_names_keys); ++$i){ 
     3660            $array_names_keys_count = count($array_names_keys); 
     3661                        for($i = 0; $i < $array_names_keys_count; ++$i){ 
    36573662                                $param['folder'] = $array_names_keys[$i]; 
    36583663                                $param['msgs_to_set'] = $sorted_msgs[$array_names_keys[$i]]; 
  • trunk/expressoMail1_2/inc/class.message_components.inc.php

    r7655 r7673  
    107107                } 
    108108 
    109                 for($p = 0, $i = 1; $p < count($parts); ++$n, ++$p, ++$i) 
     109                $parts_count = count($parts); 
     110                for($p = 0, $i = 1; $p < $parts_count; ++$n, ++$p, ++$i) 
    110111                { 
    111112                    // Skip the following... 
  • trunk/expressoMail1_2/inc/class.phpmailer.php

    r7655 r7673  
    472472    function MailSend($header, $body) { 
    473473        $to = ""; 
    474         for($i = 0; $i < count($this->to); ++$i) 
     474        $to_count = count($this->to); 
     475        for($i = 0; $i < $to_count; ++$i) 
    475476        { 
    476477            if($i != 0) { $to .= ", "; } 
     
    533534 
    534535        // Attempt to send attach all recipients 
    535         for($i = 0; $i < count($this->to); ++$i) 
     536        $to_count = count($this->to); 
     537        for($i = 0; $i < $to_count; ++$i) 
    536538        { 
    537539                if(!$this->smtp->Recipient($this->to[$i][0])) 
    538540                        $bad_rcpt[] = $this->to[$i][0]; 
    539541        } 
    540         for($i = 0; $i < count($this->cc); ++$i) 
     542        $cc_count = count($this->cc); 
     543        for($i = 0; $i < $cc_count; ++$i) 
    541544        { 
    542545                if(!$this->smtp->Recipient($this->cc[$i][0])) 
    543546                        $bad_rcpt[] = $this->cc[$i][0]; 
    544547        } 
    545         for($i = 0; $i < count($this->bcc); ++$i) 
     548        $bcc_count = count($this->bcc); 
     549        for($i = 0; $i < $bcc_count; ++$i) 
    546550        { 
    547551                if(!$this->smtp->Recipient($this->bcc[$i][0])) 
     
    563567            //Postfix version 2.1.5-9 
    564568            $array_error = explode(":", $this->smtp->error['smtp_msg']); 
    565              
    566             for($i = 0; $i < count($bad_rcpt); ++$i) 
     569 
     570            $bad_rcpt_count = count($bad_rcpt); 
     571            for($i = 0; $i < $bad_rcpt_count; ++$i) 
    567572            { 
    568573                if($i != 0) { $error .= ", "; } 
     
    826831        if(count($addr) > 1) 
    827832        { 
    828             for($i = 1; $i < count($addr); ++$i) 
     833            $addr_count = count($addr); 
     834            for($i = 1; $i < $addr_count; ++$i) 
    829835                $addr_str .= ", " . $this->AddrFormat($addr[$i]); 
    830836        } 
     
    867873        $line = explode($this->LE, $message); 
    868874        $message = ""; 
    869         for ($i=0 ;$i < count($line); ++$i) 
     875        $line_count = count($line); 
     876        for ($i=0 ;$i < $line_count; ++$i) 
    870877        { 
    871878          $line_part = explode(" ", $line[$i]); 
    872879          $buf = ""; 
    873           for ($e = 0; $e<count($line_part); $e++) 
     880          $line_part_count = count($line_part); 
     881          for ($e = 0; $e<$line_part_count; $e++) 
    874882          { 
    875883              $word = $line_part[$e]; 
     
    10311039 
    10321040        // Add custom headers 
    1033         for($index = 0; $index < count($this->CustomHeader); ++$index) 
     1041        $CustomHeader_count = count($this->CustomHeader); 
     1042        for($index = 0; $index < $CustomHeader_count; ++$index) 
    10341043        { 
    10351044            $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]),  
     
    12651274 
    12661275        // Add all attachments 
    1267         for($i = 0; $i < count($this->attachment); ++$i) 
     1276        $attachment_count = count($this->attachment); 
     1277        for($i = 0; $i < $attachment_count; ++$i) 
    12681278        { 
    12691279            // Check for string attachment 
     
    15401550    function InlineImageExists() { 
    15411551        $result = false; 
    1542         for($i = 0; $i < count($this->attachment); ++$i) 
     1552        $attachment_count = count($this->attachment); 
     1553        for($i = 0; $i < $attachment_count; ++$i) 
    15431554        { 
    15441555            if($this->attachment[$i][6] == "inline") 
Note: See TracChangeset for help on using the changeset viewer.