Changeset 7673 for trunk/calendar


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/calendar
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/calendar/inc/class.bocalendar.inc.php

    r7655 r7673  
    12521252                                        $minparts = min($l_participants); 
    12531253                                        $part = Array(); 
    1254                                         for($i=0;$i<count($parts);++$i) 
     1254                    $parts_count = count($parts); 
     1255                                        for($i=0;$i<$parts_count;++$i) 
    12551256                                        { 
    12561257                                                if (($accept_type = substr($parts[$i],-1,1)) == '0' || (int)$accept_type > 0) 
     
    21372138                        { 
    21382139                                $exceptions = explode(',',$exception_str); 
    2139                                 for($exception_count=0;$exception_count<count($exceptions);++$exception_count) 
     2140                $exceptions_count = count($exceptions); 
     2141                                for($exception_count=0;$exception_count<$exceptions_count;++$exception_count) 
    21402142                                { 
    21412143                                        $exception[] = (int)$exceptions[$exception_count]; 
     
    21962198                                } 
    21972199 
    2198                                 for($i=0;$i<count($this->cached_events[$date]);++$i) 
     2200                $cached_events_count = count($this->cached_events[$date]); 
     2201                                for($i=0;$i<$cached_events_count;++$i) 
    21992202                                { 
    22002203                                        if($this->cached_events[$date][$i]['id'] == $event['id'] || $this->cached_events[$date][$i]['reference'] == $event['id']) 
     
    25752578                                        { 
    25762579                                                echo '<!-- Total events found matching '.$search_date.' = '.count($this->cached_events[$search_date]).' -->'."\n"; 
    2577                                                 for($i=0;$i<count($this->cached_events[$search_date]);++$i) 
     2580                        $cached_events_count = count($this->cached_events[$search_date]); 
     2581                                                for($i=0;$i<$cached_events_count;++$i) 
    25782582                                                { 
    25792583                                                        echo '<!-- Date: '.$search_date.' ['.$i.'] = '.$this->cached_events[$search_date][$i]['id'].' -->'."\n"; 
     
    28662870 
    28672871                        //verifica se todos os participantes rejeitaram o evento 
    2868                         for($i = 0; $i < count($sts); ++$i ){ 
     2872            $sts_count = count($sts); 
     2873                        for($i = 0; $i < $sts_count; ++$i ){ 
    28692874                                if( $sts[i] === "R") 
    28702875                                        unset( $sts[i] ); 
     
    44364441                        { 
    44374442                                $cal_grps = ''; 
    4438                                 for($i=0;$i<count($event['groups']);++$i) 
     4443                $event_groups_count = count($event['groups']); 
     4444                                for($i=0;$i<$event_groups_count;++$i) 
    44394445                                { 
    44404446                                        if($GLOBALS['phpgw']->accounts->exists($event['groups'][$i])) 
  • trunk/calendar/inc/class.boholiday.inc.php

    r7655 r7673  
    364364                { 
    365365                        $new_holidays = Array(); 
    366                         for($i=0;$i<count($holidays);++$i) 
     366            $holidays_count = count($holidays); 
     367                        for($i=0;$i<$holidays_count;++$i) 
    367368                        { 
    368369//      echo "Setting Holidays Date : ".date('Ymd',$holidays[$i]['date'])."<br>\n"; 
     
    386387 
    387388                        $temp_locale = $GLOBALS['phpgw_info']['user']['preferences']['common']['country']; 
    388                         for($i=0;$i<count($holidays);++$i) 
     389            $holidays_count = count($holidays); 
     390                        for($i=0;$i<$holidays_count;++$i) 
    389391                        { 
    390392                                $c = $i; 
  • trunk/calendar/inc/class.boicalendar.inc.php

    r7655 r7673  
    14341434                        //$this->debug('parse_parameters array return_value: '._debug_array($return_value,False)); 
    14351435 
    1436                 for ($i = 0; $i < count($return_value); ++$i) { 
     1436        $return_value_count = count($return_value); 
     1437                for ($i = 0; $i < $return_value_count; ++$i) { 
    14371438                                $name = strtolower($return_value[$i]['param']); 
    14381439                                $value = $this->strip_quotes($return_value[$i]['value']); 
     
    16611662                                        if (!empty ($event[$value])) { 
    16621663                                                if ($multiples && $value != 'exdate') { 
    1663                                                         for ($i = 0; $i < count($event[$value]); ++$i) { 
     1664                            $event_value_count = count($event[$value]); 
     1665                                                        for ($i = 0; $i < $event_value_count; ++$i) { 
    16641666                                                                $str .= $this->fold(strtoupper(str_replace('_', '-', $value)) . $this->build_parameters($event[$value][$i], $value)); 
    16651667                                                                } 
     
    16741676                                case 'uri' : 
    16751677                                        if (!empty ($event[$value])) { 
    1676                                                 for ($i = 0; $i < count($event[$value]); ++$i) { 
     1678                        $event_value_count = count($event[$value]); 
     1679                                                for ($i = 0; $i < $event_value_count; ++$i) { 
    16771680                                                        $str .= $this->fold(strtoupper(str_replace('_', '-', $value)) . $this->build_parameters($event[$value][$i], $to_text)); 
    16781681                                                        } 
     
    16821685                                        if (!empty ($event[$value])) { 
    16831686                                                if ($multiples) { 
    1684                                                         for ($i = 0; $i < count($event[$value]); ++$i) { 
     1687                            $event_value_count = count($event[$value]); 
     1688                                                        for ($i = 0; $i < $event_value_count; ++$i) { 
    16851689                                                                $str .= $this->fold(strtoupper(str_replace('_', '-', $value)) . $this->build_parameters($event[$value][$i], $value)); 
    16861690                                                        } 
     
    17121716                                                if (@ $this->parameter[$key]['type'] != 'function') { 
    17131717                                                        if ($multiples && count($event[$value]) > 1) { 
    1714                                                                 for ($i = 0; $i < count($event[$value]); ++$i) { 
     1718                                $event_value_count = count($event[$value]); 
     1719                                                                for ($i = 0; $i < $event_value_count; ++$i) { 
    17151720                                                                        $str .= $this->fold(strtoupper(str_replace('_', '-', $value)) . $this->build_parameters($event[$value][$i], $value)); 
    17161721                                                                } 
     
    17211726                                                                $function = $this->parameter[$value]['function']; 
    17221727                                                        if ($multiples) { 
    1723                                                                 for ($i = 0; $i < count($event[$value]); ++$i) { 
     1728                                $event_value_count = count($event[$value]); 
     1729                                                                for ($i = 0; $i < $event_value_count; ++$i) { 
    17241730                                                                        $str .= $this->fold(strtoupper(str_replace('_', '-', $value)) . ':' . $this-> $function ($event[$value][$i])); 
    17251731                                                                } 
     
    17321738                                case 'cal-address' : 
    17331739                                        if (is_array($event[$value][0])) { 
    1734                                                 for ($j = 0; $j < count($event[$value]); ++$j) { 
     1740                        $event_value_count = count($event[$value]); 
     1741                                                for ($j = 0; $j < $event_value_count; ++$j) { 
    17351742                                                        $temp_output = $this->build_parameters($event[$value][$j], $value); 
    17361743                                                        if ($temp_output) { 
     
    17481755                        } 
    17491756                if (!empty ($event['x_type'])) { 
    1750                         for ($i = 0; $i < count($event['x_type']); ++$i) { 
     1757            $event_x_type_count = count($event['x_type']); 
     1758                        for ($i = 0; $i < $event_x_type_count; ++$i) { 
    17511759                                $str .= $this->build_xtype($event['x_type'][$i], ':'); 
    17521760                                } 
     
    17551763                if ($ical_item == 'vtimezone') { 
    17561764                        if ($event['tzdata']) { 
    1757                                 for ($k = 0; $k < count($event['tzdata']); ++$k) { 
     1765                $event_tzdata_count = count($event['tzdata']); 
     1766                                for ($k = 0; $k < $event_tzdata_count; ++$k) { 
    17581767                                        $str .= 'BEGIN:' . strtoupper($event['tzdata'][$k]['type']) . "\r\n"; 
    17591768                                        $str .= $this->build_card_internals(strtolower($event['tzdata'][$k]['type']), $event['tzdata'][$k]); 
     
    17631772                        } 
    17641773                elseif ($event['alarm']) { 
    1765                         for ($k = 0; $k < count($event['alarm']); ++$k) { 
     1774            $event_alarm_count = count($event['alarm']); 
     1775                        for ($k = 0; $k < $event_alarm_count; ++$k) { 
    17661776                                $str .= 'BEGIN:VALARM' . "\r\n"; 
    17671777                                $str .= $this->build_card_internals('valarm', $event['alarm'][$k]); 
  • trunk/calendar/inc/class.socalendar.inc.php

    r7655 r7673  
    179179                        $events = $this->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay); 
    180180                        $events_cached = Array(); 
    181                         for($i=0;$i<count($events);++$i) 
     181            $events_count = count($events); 
     182                        for($i=0;$i<$events_count;++$i) 
    182183                        { 
    183184                                $events_cached[] = $this->read_entry($events[$i]); 
  • trunk/calendar/inc/class.socalendar_sql.inc.php

    r7655 r7673  
    597597                                { 
    598598                                        $groups = explode(',',$this->stream->f('groups')); 
    599                                         for($j=1;$j<count($groups) - 1;++$j) 
     599                    $groups_count = count($groups) - 1; 
     600                                        for($j=1;$j<$groups_count;++$j) 
    600601                                        { 
    601602                                                $this->add_attribute('groups',$groups[$j],$j-1); 
  • trunk/calendar/inc/class.uicalendar.inc.php

    r7655 r7673  
    328328                                        ); 
    329329                                } 
    330                                 for($l=0;$l<count($var);++$l) 
     330                $var_count = count($var); 
     331                                for($l=0;$l<$var_count;++$l) 
    331332                                { 
    332333                                        $this->output_template_array($mini_cal_tpl,'monthweek_day','mini_day',$var[$l]); 
     
    13311332                        $str = ''; 
    13321333 
    1333                         for($i=0;$i<count($event['recur_exception']);++$i) 
     1334            $event_count = count($event['recur_exception']); 
     1335                        for($i=0;$i<$event_count;++$i) 
    13341336                        { 
    13351337                                $str .= '    <option value="'.$i.'">'.$GLOBALS['phpgw']->common->show_date($event['recur_exception'][$i]).'</option>'."\n"; 
     
    14571459                                // Add participants 
    14581460                                $participants = explode(";", $GLOBALS['phpgw']->session->appsession("participants") ); 
    1459                                 for($_f_part=0; $_f_part<count($participants); ++$_f_part) 
     1461                $participants_count = count($participants); 
     1462                                for($_f_part=0; $_f_part<$participants_count; ++$_f_part) 
    14601463                                { 
    14611464                                        $this->bo->add_attribute('participants','A',$participants[$_f_part]); 
     
    28092812                        $accounts = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,'calendar'); 
    28102813                        $users = Array(); 
    2811                         for($i=0;$i<count($accounts);++$i) 
     2814            $accounts_count = count($accounts); 
     2815                        for($i=0;$i<$accounts_count;++$i) 
    28122816                        { 
    28132817                                $user = $accounts[$i]; 
     
    28202824                                                if($group_members != False) 
    28212825                                                { 
    2822                                                         for($j=0;$j<count($group_members);++$j) 
     2826                            $group_members_count = count($group_members); 
     2827                                                        for($j=0;$j<$group_members_count;++$j) 
    28232828                                                        { 
    28242829                                                                if(!isset($users[$group_members[$j]])) 
     
    28612866                        ); 
    28622867 
    2863                         for($i=0;$i<count($var);++$i) 
     2868            $var_count = count($var); 
     2869                        for($i=0;$i<$var_count;++$i) 
    28642870                        { 
    28652871                                $this->output_template_array($p,'rows','list',$var[$i]); 
     
    36073613 
    36083614                        $description = $this->bo->get_short_field($event,$is_private,'description'); 
    3609                         for($i=0;$i<count($picture);++$i) 
     3615            $picture_count = count($picture); 
     3616                        for($i=0;$i<$picture_count;++$i) 
    36103617                        { 
    36113618                                $var = Array( 
     
    37973804 
    37983805                        $description = $this->bo->get_short_field($event,$is_private,'description'); 
    3799                         for($i=0;$i<count($picture);++$i) 
     3806            $picture_count = count($picture); 
     3807                        for($i=0;$i<$picture_count;++$i) 
    38003808                        { 
    38013809                                $var = Array( 
     
    38683876 
    38693877                        $overlap = ''; 
    3870                         for($i=0;$i<count($overlapping_events);++$i) 
     3878            $overlapping_events_count = count($overlapping_events); 
     3879                        for($i=0;$i<$overlapping_events_count;++$i) 
    38713880                        { 
    38723881                                $overlapped_event = $this->bo->read_entry($overlapping_events[$i],True); 
     
    57345743                        } 
    57355744 
    5736                         for ($i=0; $i<count($control_data['part']); ++$i) 
     5745            $control_data_count = count($control_data['part']); 
     5746                        for ($i=0; $i<$control_data_count; ++$i) 
    57375747                        { 
    57385748                                $id = $control_data['part'][$i]; 
     
    57455755                        if ($control_data['action'] == lang('Delete selected contacts')) 
    57465756                        { 
    5747                                 for ($i=0; $i<count($control_data['delete']); ++$i) 
     5757                $control_data_count = count($control_data['delete']); 
     5758                                for ($i=0; $i<$control_data_count; ++$i) 
    57485759                                { 
    57495760                                        $id = $control_data['delete'][$i]; 
     
    59705981                                if($holidays) 
    59715982                                { 
    5972                                         for($k=0;$k<count($holidays);++$k) 
     5983                    $holidays_count = count($holidays); 
     5984                                        for($k=0;$k<$holidays_count;++$k) 
    59735985                                        { 
    59745986                                                $holiday_name[] = $holidays[$k]['name']; 
  • trunk/calendar/inc/class.uipublicview.inc.php

    r7655 r7673  
    521521 
    522522                        $description = $this->bo->get_short_field($event,$is_private,'description'); 
    523                         for($i=0;$i<count($picture);++$i) 
     523            $picture_count = count($picture); 
     524                        for($i=0;$i<$picture_count;++$i) 
    524525                        { 
    525526                                $var = Array( 
     
    946947                                if($holidays) 
    947948                                { 
    948                                         for($k=0;$k<count($holidays);++$k) 
     949                    $holidays_count = count($holidays); 
     950                                        for($k=0;$k<$holidays_count;++$k) 
    949951                                        { 
    950952                                                $holiday_name[] = $holidays[$k]['name']; 
  • trunk/calendar/templates/default/header.inc.php

    r7655 r7673  
    105105                if(isset($GLOBALS['HTTP_POST_VARS']['participants']) && $GLOBALS['HTTP_POST_VARS']['participants']) 
    106106                { 
    107                         for ($i=0;$i<count($GLOBALS['HTTP_POST_VARS']['participants']);++$i) 
     107            $globals_count = count($GLOBALS['HTTP_POST_VARS']['participants']); 
     108                        for ($i=0;$i<$globals_count;++$i) 
    108109                        { 
    109110                                $base_hidden_vars .= '    <input type="hidden" name="participants[]" value="'.$GLOBALS['HTTP_POST_VARS']['participants'][$i].'">'."\n"; 
Note: See TracChangeset for help on using the changeset viewer.