Changeset 7673 for trunk/library


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/library
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/library/Mail/Mail/RFC822.php

    r7655 r7673  
    332332        $string = $parts[0]; 
    333333 
    334         for ($i = 0; $i < count($parts); ++$i) { 
     334        $parts_count = count($parts); 
     335        for ($i = 0; $i < $parts_count; ++$i) { 
    335336            if ($this->_hasUnclosedQuotes($string) 
    336337                || $this->_hasUnclosedBrackets($string, '<>') 
     
    426427    { 
    427428        $parts = explode($char, $string); 
    428         for ($i = 0; $i < count($parts); ++$i){ 
     429        $parts_count = count($parts); 
     430        for ($i = 0; $i < $parts_count; ++$i){ 
    429431            if (substr($parts[$i], -1) == '\\' || $this->_hasUnclosedQuotes($parts[$i])) 
    430432                $num--; 
     
    500502        //                         geezer 
    501503        // ... or any other format valid by RFC 822. 
    502         for ($i = 0; $i < count($addresses); ++$i) { 
     504        $addresses_count = count($addresses); 
     505        for ($i = 0; $i < $addresses_count; ++$i) { 
    503506            if (!$this->validateMailbox($addresses[$i])) { 
    504507                if (empty($this->error)) { 
  • trunk/library/Mail/Mail/smtpmx.php

    r5146 r7673  
    436436                return false; 
    437437            } 
    438             for ($i = 0; $i < count($mxHost); ++$i) { 
     438            $mxHost_count = count($mxHost); 
     439            for ($i = 0; $i < $mxHost_count; ++$i) { 
    439440                $mx[$mxHost[$i]] = $mxWeight[$i]; 
    440441            } 
  • trunk/library/Net/Sieve.php

    r7655 r7673  
    929929        $data = preg_split('/\r?\n/', $this->_toUpper($data), -1, PREG_SPLIT_NO_EMPTY); 
    930930 
    931         for ($i = 0; $i < count($data); ++$i) { 
     931        $data_count = count($data); 
     932        for ($i = 0; $i < $data_count; ++$i) { 
    932933            if (!preg_match('/^"([A-Z]+)"( "(.*)")?$/', $data[$i], $matches)) { 
    933934                continue; 
  • trunk/library/PEAR/PEAR/Frontend/CLI.php

    r7655 r7673  
    579579    { 
    580580        $highest = 1; 
    581         for ($i = 0; $i < count($columns); ++$i) { 
     581        $columns_count = count($columns); 
     582        for ($i = 0; $i < $columns_count; ++$i) { 
    582583            $col = &$columns[$i]; 
    583584            if (isset($colparams[$i]) && !empty($colparams[$i]['wrap'])) { 
     
    672673        } 
    673674 
    674         for ($i = 0; $i < count($table_data); ++$i) { 
     675        $table_data_count = count($table_data); 
     676        for ($i = 0; $i < $table_data_count; ++$i) { 
    675677            extract($table_data[$i]); 
    676678            if (!is_array($rowparams)) { 
     
    684686            $rowlines = array(); 
    685687            if ($height > 1) { 
    686                 for ($c = 0; $c < count($data); $c++) { 
     688                $data_count = count($data); 
     689                for ($c = 0; $c < $data_count; $c++) { 
    687690                    $rowlines[$c] = preg_split('/(\r?\n|\r)/', $data[$c]); 
    688691                    if (count($rowlines[$c]) < $height) { 
     
    691694                } 
    692695            } else { 
    693                 for ($c = 0; $c < count($data); ++$c) { 
     696                $data_count = count($data); 
     697                for ($c = 0; $c < $data_count; ++$c) { 
    694698                    $rowlines[$c] = array($data[$c]); 
    695699                } 
     
    698702            for ($r = 0; $r < $height; ++$r) { 
    699703                $rowtext = ''; 
    700                 for ($c = 0; $c < count($data); ++$c) { 
     704                $data_count = count($data); 
     705                for ($c = 0; $c < $data_count; ++$c) { 
    701706                    if (isset($colparams[$c])) { 
    702707                        $attribs = array_merge($rowparams, $colparams); 
  • trunk/library/PEAR/PEAR/PackageFile/v2.php

    r7655 r7673  
    329329        $mymaintainers = $this->getMaintainers(); 
    330330        $yourmaintainers = $pf1->getMaintainers(); 
    331         for ($i1 = 0; $i1 < count($yourmaintainers); ++$i1) { 
     331        $yourmaintainers_count = count($yourmaintainers); 
     332        for ($i1 = 0; $i1 < $yourmaintainers_count; ++$i1) { 
    332333            $reset = false; 
    333             for ($i2 = 0; $i2 < count($mymaintainers); ++$i2) { 
     334            $mymaintainers_count = count($mymaintainers); 
     335            for ($i2 = 0; $i2 < $mymaintainers_count; ++$i2) { 
    334336                if ($mymaintainers[$i2]['handle'] == $yourmaintainers[$i1]['handle']) { 
    335337                    if ($mymaintainers[$i2]['role'] != $yourmaintainers[$i1]['role']) { 
     
    12131215            } 
    12141216 
    1215             for ($i = 0; $i < count($releases['configureoption']); ++$i) { 
     1217            $releases_count = count($releases['configureoption']); 
     1218            for ($i = 0; $i < $releases_count; ++$i) { 
    12161219                $releases['configureoption'][$i] = $releases['configureoption'][$i]['attribs']; 
    12171220            } 
  • trunk/library/ckeditor/plugins/aspell/spellerpages/server-scripts/spellchecker.php

    r7655 r7673  
    8282        # open temp file, add the submitted text. 
    8383        if( $fh = fopen( $tempfile, 'w' )) { 
    84                 for( $i = 0; $i < count( $textinputs ); ++$i ) { 
     84        $textinputs_count = count( $textinputs ); 
     85                for( $i = 0; $i < $textinputs_count; ++$i ) { 
    8586                        $text = urldecode( $textinputs[$i] ); 
    8687                        $text = html_entity_decode ($text , ENT_QUOTES , 'UTF-8'  ); 
  • trunk/library/csstidy/class.csstidy.php

    r7655 r7673  
    419419        $template = explode('|',$content); 
    420420 
    421         for ($i = 0; $i < count($template); ++$i ) 
     421    $template_count = count($template); 
     422        for ($i = 0; $i < $template_count; ++$i ) 
    422423        { 
    423424                $this->template[$i] = $template[$i]; 
  • trunk/library/csstidy/class.csstidy_optimise.php

    r7655 r7673  
    302302            $color_tmp = substr($color,4,strlen($color)-5); 
    303303            $color_tmp = explode(',',$color_tmp); 
    304             for ( $i = 0; $i < count($color_tmp); ++$i ) 
     304            $color_tmp_count = count($color_tmp); 
     305            for ( $i = 0; $i < $color_tmp_count; ++$i ) 
    305306            { 
    306307                $color_tmp[$i] = trim ($color_tmp[$i]); 
     
    383384            $temp = array($subvalue); 
    384385        } 
    385         for ($l = 0; $l < count($temp); ++$l) 
     386        $temp_count = count($temp); 
     387        for ($l = 0; $l < $temp_count; ++$l) 
    386388        { 
    387389            // continue if no numeric value 
     
    665667 
    666668        $str_value = csstidy_optimise::explode_ws(',',$str_value); 
    667         for($i = 0; $i < count($str_value); ++$i) 
     669        $str_value_count = count($str_value); 
     670        for($i = 0; $i < $str_value_count; ++$i) 
    668671        { 
    669672            $have['clip'] = FALSE; $have['pos'] = FALSE; 
     
    672675            $str_value[$i] = csstidy_optimise::explode_ws(' ',trim($str_value[$i])); 
    673676 
    674             for($j = 0; $j < count($str_value[$i]); ++$j) 
     677            $str_value_count = count($str_value[$i]); 
     678            for($j = 0; $j < $str_value_count; ++$j) 
    675679            { 
    676680                if($have['bg'] === FALSE && (substr($str_value[$i][$j],0,4) == 'url(' || $str_value[$i][$j] === 'none')) 
  • trunk/library/csstidy/css_optimiser.php

    r7655 r7673  
    322322                        { 
    323323                                echo '<dt>'.$line.'</dt>'; 
    324                                 for($i = 0; $i < count($array); ++$i) 
     324                $array_count = count($array); 
     325                                for($i = 0; $i < $array_count; ++$i) 
    325326                                { 
    326327                                        echo '<dd class="'.$array[$i]['t'].'">'.$array[$i]['m'].'</dd>'; 
  • trunk/library/mime/mime.php

    r7655 r7673  
    895895        case !$text && !$html && $attachments: 
    896896            $message =& $this->_addMixedPart(); 
    897             for ($i = 0; $i < count($this->_parts); ++$i) { 
     897            $parts_count = count($this->_parts); 
     898            for ($i = 0; $i < $parts_count; ++$i) { 
    898899                $this->_addAttachmentPart($message, $this->_parts[$i]); 
    899900            } 
     
    903904            $message =& $this->_addMixedPart(); 
    904905            $this->_addTextPart($message, $this->_txtbody); 
    905             for ($i = 0; $i < count($this->_parts); ++$i) { 
     906            $parts_count = count($this->_parts); 
     907            for ($i = 0; $i < $parts_count; ++$i) { 
    906908                $this->_addAttachmentPart($message, $this->_parts[$i]); 
    907909            } 
     
    930932                $ht =& $this->_addRelatedPart($message); 
    931933                $this->_addHtmlPart($ht); 
    932                 for ($i = 0; $i < count($this->_html_images); ++$i) { 
     934                $html_images_count = count($this->_html_images); 
     935                for ($i = 0; $i < $html_images_count; ++$i) { 
    933936                    $this->_addHtmlImagePart($ht, $this->_html_images[$i]); 
    934937                } 
     
    939942                $message =& $this->_addRelatedPart($null); 
    940943                $this->_addHtmlPart($message); 
    941                 for ($i = 0; $i < count($this->_html_images); ++$i) { 
     944                $html_images_count = count($this->_html_images); 
     945                for ($i = 0; $i < $html_images_count; ++$i) { 
    942946                    $this->_addHtmlImagePart($message, $this->_html_images[$i]); 
    943947                } 
     
    958962                $this->_addHtmlPart($message); 
    959963            } 
    960             for ($i = 0; $i < count($this->_html_images); ++$i) { 
     964            $html_images_count = count($this->_html_images); 
     965            for ($i = 0; $i < $html_images_count; ++$i) { 
    961966                $this->_addHtmlImagePart($message, $this->_html_images[$i]); 
    962967            } 
     
    973978                $this->_addHtmlPart($message); 
    974979            } 
    975             for ($i = 0; $i < count($this->_parts); ++$i) { 
     980            $parts_count = count($this->_parts); 
     981            for ($i = 0; $i < $parts_count; ++$i) { 
    976982                $this->_addAttachmentPart($message, $this->_parts[$i]); 
    977983            } 
     
    989995            } 
    990996            $this->_addHtmlPart($rel); 
    991             for ($i = 0; $i < count($this->_html_images); ++$i) { 
     997                    $html_images_count = count($this->_html_images); 
     998            for ($i = 0; $i < $html_images_count; ++$i) { 
    992999                $this->_addHtmlImagePart($rel, $this->_html_images[$i]); 
    9931000            } 
    994             for ($i = 0; $i < count($this->_parts); ++$i) { 
     1001                    $parts_count = count($this->_parts); 
     1002            for ($i = 0; $i < $parts_count; ++$i) { 
    9951003                $this->_addAttachmentPart($message, $this->_parts[$i]); 
    9961004            } 
     
    10081016                                $this->_addHtmlPart($message); 
    10091017            } 
    1010                          
    1011             for ($i = 0; $i < count($this->_html_images); ++$i) { 
     1018 
     1019                        $html_images_count = count($this->_html_images); 
     1020            for ($i = 0; $i < $html_images_count; ++$i) { 
    10121021                $this->_addHtmlImagePart($message, $this->_html_images[$i]); 
    10131022            } 
    1014             for ($i = 0; $i < count($this->_parts); ++$i) { 
     1023            $parts_count = count($this->_parts); 
     1024            for ($i = 0; $i < $parts_count; ++$i) { 
    10151025                $this->_addAttachmentPart($message, $this->_parts[$i]); 
    10161026            } 
  • trunk/library/mime/mimeDecode.php

    r7655 r7673  
    326326 
    327327                    $parts = $this->_boundarySplit($body, $content_type['other']['boundary']); 
    328                     for ($i = 0; $i < count($parts); ++$i) { 
     328                    $parts_count = count($parts); 
     329                    for ($i = 0; $i < $parts_count; ++$i) { 
    329330                        list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]); 
    330331                        $part = $this->_decode($part_header, $part_body, $default_ctype); 
     
    386387                $return[$prepend . $mime_number] = &$structure; 
    387388            } 
    388             for ($i = 0; $i < count($structure->parts); ++$i) { 
    389  
     389            $structure_parts_count = count($structure->parts); 
     390            for ($i = 0; $i < $structure_parts_count; ++$i) { 
    390391             
    391392                if (!empty($structure->headers['content-type']) AND substr(strtolower($structure->headers['content-type']), 0, 8) == 'message/') { 
     
    792793        preg_match_all("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", $input, $matches); 
    793794 
    794         for ($j = 0; $j < count($matches[3]); ++$j) { 
     795        $matches_count = count($matches[3]); 
     796        for ($j = 0; $j < $matches_count; ++$j) { 
    795797 
    796798            $str      = $matches[3][$j]; 
     
    943945            // Multiple headers with this name 
    944946            if (is_array($headers[$hdr_name])) { 
    945                 for ($i = 0; $i < count($hdr_value); ++$i) { 
     947                $hdr_value_count = count($hdr_value); 
     948                for ($i = 0; $i < $hdr_value_count; ++$i) { 
    946949                    $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value[$i], $indent); 
    947950                } 
     
    954957 
    955958        if (!empty($input->parts)) { 
    956             for ($i = 0; $i < count($input->parts); ++$i) { 
     959            $parts_count = count($input->parts); 
     960            for ($i = 0; $i < $parts_count; ++$i) { 
    957961                $output .= $crlf . str_repeat($htab, $indent) . '<mimepart>' . $crlf . 
    958962                           Mail_mimeDecode::_getXML($input->parts[$i], $indent+1) . 
  • trunk/library/mime/mimePart.php

    r7655 r7673  
    283283            $encoded['body'] = '';  
    284284 
    285             for ($i = 0; $i < count($this->_subparts); ++$i) { 
     285            $subparts_count = count($this->_subparts); 
     286            for ($i = 0; $i < $subparts_count; ++$i) { 
    286287                $encoded['body'] .= '--' . $boundary . $eol; 
    287288                $tmp = $this->_subparts[$i]->encode(); 
     
    393394 
    394395        if (count($this->_subparts)) { 
    395             for ($i = 0; $i < count($this->_subparts); ++$i) { 
     396            $subparts_count = count($this->_subparts); 
     397            for ($i = 0; $i < $subparts_count; ++$i) { 
    396398                fwrite($fh, $f_eol . '--' . $boundary . $eol); 
    397399                $res = $this->_subparts[$i]->_encodePartToFile($fh); 
Note: See TracChangeset for help on using the changeset viewer.