Changeset 25018 for trunk/include


Ignore:
Timestamp:
Oct 19, 2013, 7:43:04 PM (11 years ago)
Author:
mistic100
Message:

remove all array_push (50% slower than []) + some changes missing for feature:2978

Location:
trunk/include
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/calendar_monthly.class.php

    r19703 r25018  
    389389      }
    390390
    391       array_push( $wday_labels, array_shift($wday_labels) );
     391      $wday_labels[] = array_shift($wday_labels);
    392392    }
    393393
  • trunk/include/calendar_weekly.class.php

    r25005 r25018  
    6969      $this->calendar_levels[CWEEK]['sql'] = pwg_db_get_week($this->date_field, 5).'+1';
    7070      $this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field);
    71       array_push( $this->calendar_levels[CDAY]['labels'],
    72                   array_shift( $this->calendar_levels[CDAY]['labels'] ) );
     71      $this->calendar_levels[CDAY]['labels'][] = array_shift($this->calendar_levels[CDAY]['labels']);
    7372    }
    7473  }
  • trunk/include/category_cats.inc.php

    r25005 r25018  
    208208          if (isset($image_id) and !in_array($image_id, $image_ids))
    209209          {
    210             array_push($new_image_ids, $image_id);
     210            $new_image_ids[] = $image_id;
    211211          }
    212212
  • trunk/include/dblayer/functions_mysql.inc.php

    r21088 r25018  
    329329          $column.= " collate '".$row['Collation']."'";
    330330        }
    331         array_push($columns, $column);
     331        $columns[] = $column;
    332332      }
    333333    }
     
    565565  while ($row = pwg_db_fetch_row($result))
    566566  {
    567     array_push($all_tables, $row[0]);
     567    $all_tables[] = $row[0];
    568568  }
    569569
     
    583583      if ($row['Key'] == 'PRI')
    584584      {
    585         array_push($all_primary_key, $row['Field']);
     585        $all_primary_key[] = $row['Field'];
    586586      }
    587587    }
     
    599599  if ($mysql_rc)
    600600  {
    601     array_push(
    602           $page['infos'],
    603           l10n('All optimizations have been successfully completed.')
    604           );
     601    $page['infos'][] = l10n('All optimizations have been successfully completed.');
    605602  }
    606603  else
    607604  {
    608     array_push(
    609           $page['errors'],
    610           l10n('Optimizations have been completed with some errors.')
    611           );
     605    $page['errors'][] = l10n('Optimizations have been completed with some errors.');
    612606  }
    613607}
  • trunk/include/dblayer/functions_mysqli.inc.php

    r24346 r25018  
    366366          $column.= " collate '".$row['Collation']."'";
    367367        }
    368         array_push($columns, $column);
     368        $columns[] = $column;
    369369      }
    370370    }
     
    602602  while ($row = pwg_db_fetch_row($result))
    603603  {
    604     array_push($all_tables, $row[0]);
     604    $all_tables[] = $row[0];
    605605  }
    606606
     
    620620      if ($row['Key'] == 'PRI')
    621621      {
    622         array_push($all_primary_key, $row['Field']);
     622        $all_primary_key[] = $row['Field'];
    623623      }
    624624    }
     
    636636  if ($mysqli_rc)
    637637  {
    638     array_push(
    639           $page['infos'],
    640           l10n('All optimizations have been successfully completed.')
    641           );
     638    $page['infos'][] = l10n('All optimizations have been successfully completed.');
    642639  }
    643640  else
    644641  {
    645     array_push(
    646           $page['errors'],
    647           l10n('Optimizations have been completed with some errors.')
    648           );
     642    $page['errors'][] = l10n('Optimizations have been completed with some errors.');
    649643  }
    650644}
  • trunk/include/filter.inc.php

    r19703 r25018  
    124124  if (get_filter_page_value('add_notes'))
    125125  {
    126     $header_notes[] = l10n_dec('Photos posted within the last %d day.', 'Photos posted within the last %d days.', $filter['recent_period']);
     126    $header_notes[] = l10n_dec(
     127      'Photos posted within the last %d day.', 'Photos posted within the last %d days.',
     128      $filter['recent_period']
     129      );
    127130  }
    128131  include_once(PHPWG_ROOT_PATH.'include/functions_filter.inc.php');
  • trunk/include/functions.inc.php

    r25005 r25018  
    879879  foreach ($caddiables as $caddiable)
    880880  {
    881     array_push($datas, array('element_id' => $caddiable,
    882                              'user_id' => $user['id']));
     881    $datas[] = array(
     882      'element_id' => $caddiable,
     883      'user_id' => $user['id'],
     884      );
    883885  }
    884886
  • trunk/include/functions_calendar.inc.php

    r19703 r25018  
    213213            if ( isset($page['chronology_date'][0]) )
    214214            {
    215               array_push($chronology_date, $page['chronology_date'][0]);
     215              $chronology_date[] = $page['chronology_date'][0];
    216216            }
    217217          }
  • trunk/include/functions_comment.inc.php

    r21817 r25018  
    9494      if ($conf['comments_author_mandatory'])
    9595      {
    96         array_push($infos, l10n('Username is mandatory') );
     96        $infos[] = l10n('Username is mandatory');
    9797        $comment_action='reject';
    9898      }
     
    111111      if ( $row['user_exists'] == 1 )
    112112      {
    113         array_push($infos, l10n('This login is already used by another user') );
     113        $infos[] = l10n('This login is already used by another user');
    114114        $comment_action='reject';
    115115      }
     
    142142    if (!url_check_format($comm['website_url']))
    143143    {
    144       array_push($infos, l10n('Your website URL is invalid'));
     144      $infos[] = l10n('Your website URL is invalid');
    145145      $comment_action='reject';
    146146    }
     
    156156    else if ($conf['comments_email_mandatory'])
    157157    {
    158       array_push($infos, l10n('Email address is missing. Please specify an email address.') );
     158      $infos[] = l10n('Email address is missing. Please specify an email address.');
    159159      $comment_action='reject';
    160160    }
     
    162162  else if (!email_check_format($comm['email']))
    163163  {
    164     array_push($infos, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'));
     164    $infos[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)');
    165165    $comment_action='reject';
    166166  }
     
    193193    if ( $counter > 0 )
    194194    {
    195       array_push( $infos, l10n('Anti-flood system : please wait for a moment before trying to post another comment') );
     195      $infos[] = l10n('Anti-flood system : please wait for a moment before trying to post another comment');
    196196      $comment_action='reject';
    197197    }
  • trunk/include/functions_mail.inc.php

    r24966 r25018  
    294294      if (!empty($admin['mail_address']))
    295295      {
    296         array_push($admins, format_email($admin['username'], $admin['mail_address']));
     296        $admins[] = format_email($admin['username'], $admin['mail_address']);
    297297      }
    298298    }
     
    420420          if (!empty($row['mail_address']))
    421421          {
    422             array_push($Bcc, format_email(stripslashes($row['username']), $row['mail_address']));
     422            $Bcc[] = format_email(stripslashes($row['username']), $row['mail_address']);
    423423          }
    424424        }
  • trunk/include/functions_notification.inc.php

    r19703 r25018  
    207207    while ($row = pwg_db_fetch_assoc($result))
    208208    {
    209       array_push($infos, $row);
     209      $infos[] = $row;
    210210    }
    211211
     
    370370      $line = '<a href="'.$url.'">'.$line.'</a>';
    371371    }
    372     array_push($news, $line);
     372    $news[] = $line;
    373373  }
    374374}
     
    451451  while ($row = pwg_db_fetch_assoc($result))
    452452  {
    453     array_push($dates, $row);
     453    $dates[] = $row;
    454454  }
    455455
     
    470470      while ($row = pwg_db_fetch_assoc($result))
    471471      {
    472         array_push($dates[$i]['elements'], $row);
     472        $dates[$i]['elements'][] = $row;
    473473      }
    474474    }
     
    490490      while ($row = pwg_db_fetch_assoc($result))
    491491      {
    492         array_push($dates[$i]['categories'], $row);
     492        $dates[$i]['categories'][] = $row;
    493493      }
    494494    }
     
    547547  $description .=
    548548        '<li>'
    549         .l10n_dec('%d album updated', '%d albums updated',
    550                   $date_detail['nb_cats'])
     549        .l10n_dec('%d album updated', '%d albums updated', $date_detail['nb_cats'])
    551550        .'</li>';
    552551
     
    558557          .get_cat_display_name_cache($cat['uppercats'])
    559558          .' ('.
    560           l10n_dec('%d new photo',
    561                    '%d new photos', $cat['img_count']).')'
     559          l10n_dec('%d new photo', '%d new photos', $cat['img_count']).')'
    562560          .'</li>';
    563561  }
  • trunk/include/functions_plugins.inc.php

    r24160 r25018  
    221221  while ($row = pwg_db_fetch_assoc($result))
    222222  {
    223     array_push($plugins, $row);
     223    $plugins[] = $row;
    224224  }
    225225  return $plugins;
  • trunk/include/functions_search.inc.php

    r22175 r25018  
    6969      foreach ($search['fields'][$textfield]['words'] as $word)
    7070      {
    71         array_push($local_clauses, $textfield." LIKE '%".$word."%'");
     71        $local_clauses[] = $textfield." LIKE '%".$word."%'";
    7272      }
    7373
     
    7575      $local_clauses = prepend_append_array_items($local_clauses, '(', ')');
    7676
    77       array_push(
    78         $clauses,
    79         implode(
    80           ' '.$search['fields'][$textfield]['mode'].' ',
    81           $local_clauses
    82           )
     77      $clauses[] = implode(
     78        ' '.$search['fields'][$textfield]['mode'].' ',
     79        $local_clauses
    8380        );
    8481    }
     
    10198      foreach ($fields as $field)
    10299      {
    103         array_push($field_clauses, $field." LIKE '%".$word."%'");
     100        $field_clauses[] = $field." LIKE '%".$word."%'";
    104101      }
    105102      // adds brackets around where clauses
    106       array_push(
    107         $word_clauses,
    108         implode(
    109           "\n          OR ",
    110           $field_clauses
    111           )
     103      $word_clauses[] = implode(
     104        "\n          OR ",
     105        $field_clauses
    112106        );
    113107    }
     
    118112      );
    119113
    120     array_push(
    121       $clauses,
    122       "\n         ".
     114    $clauses[] = "\n         ".
    123115      implode(
    124         "\n         ".
    125               $search['fields']['allwords']['mode'].
    126         "\n         ",
     116        "\n         ". $search['fields']['allwords']['mode']. "\n         ",
    127117        $word_clauses
    128         )
    129       );
     118        );
    130119  }
    131120
     
    134123    if (isset($search['fields'][$datefield]))
    135124    {
    136       array_push(
    137         $clauses,
    138         $datefield." = '".$search['fields'][$datefield]['date']."'"
    139         );
     125      $clauses[] = $datefield." = '".$search['fields'][$datefield]['date']."'"
    140126    }
    141127
     
    146132      if (isset($search['fields'][$key]))
    147133      {
    148         array_push(
    149           $clauses,
    150 
    151           $datefield.
     134        $clauses[] = $datefield.
    152135          ($suffix == 'after'             ? ' >' : ' <').
    153136          ($search['fields'][$key]['inc'] ? '='  : '').
    154           " '".$search['fields'][$key]['date']."'"
    155 
    156           );
     137          " '".$search['fields'][$key]['date']."'";
    157138      }
    158139    }
     
    172153
    173154    $local_clause = 'category_id IN ('.implode(',', $cat_ids).')';
    174     array_push($clauses, $local_clause);
     155    $clauses[] = $local_clause;
    175156  }
    176157
  • trunk/include/functions_tag.inc.php

    r21817 r25018  
    333333  while ($row = pwg_db_fetch_assoc($result))
    334334  {
    335     array_push($tags, $row);
     335    $tags[] = $row;
    336336  }
    337337  return $tags;
  • trunk/include/functions_url.inc.php

    r23822 r25018  
    467467          if (empty($maybe_permalinks))
    468468          {
    469             array_push($maybe_permalinks, $tokens[$current_token]);
     469            $maybe_permalinks[] = $tokens[$current_token];
    470470          }
    471471          else
    472472          {
    473             array_push($maybe_permalinks,
     473            $maybe_permalinks[] =
    474474                $maybe_permalinks[count($maybe_permalinks)-1]
    475                 . '/' . $tokens[$current_token]
    476               );
     475                . '/' . $tokens[$current_token];
    477476          }
    478477          $current_token++;
     
    528527      if ( $conf['tag_url_style'] != 'tag' and preg_match('/^(\d+)(?:-(.*)|)$/', $tokens[$i], $matches) )
    529528      {
    530         array_push($requested_tag_ids, $matches[1]);
     529        $requested_tag_ids[] = $matches[1];
    531530      }
    532531      else
    533532      {
    534         array_push($requested_tag_url_names, $tokens[$i]);
     533        $requested_tag_url_names[] = $tokens[$i];
    535534      }
    536535      $i++;
     
    598597    {
    599598      // Add dummy element list
    600       array_push($page['list'], -1);
     599      $page['list'][] = -1;
    601600    }
    602601    // With pictures list
     
    609608      foreach (explode(',', $tokens[$next_token]) as $image_id)
    610609      {
    611         array_push($page['list'], $image_id);
     610        $page['list'][] = $image_id;
    612611      }
    613612    }
  • trunk/include/picture_comment.inc.php

    r19703 r25018  
    6161  {
    6262    case 'moderate':
    63       array_push($page['infos'], l10n('An administrator must authorize your comment before it is visible.') );
     63      $page['infos'][] = l10n('An administrator must authorize your comment before it is visible.');
    6464    case 'validate':
    65       array_push($page['infos'], l10n('Your comment has been registered'));
     65      $page['infos'][] = l10n('Your comment has been registered');
    6666      break;
    6767    case 'reject':
    6868      set_status_header(403);
    69       array_push($page['errors'], l10n('Your comment has NOT been registered because it did not pass the validation rules') );
     69      $page['errors'][] = l10n('Your comment has NOT been registered because it did not pass the validation rules');
    7070      break;
    7171    default:
  • trunk/include/section_init.inc.php

    r22283 r25018  
    340340    foreach ($page['tags'] as $tag)
    341341    {
    342       array_push($page['tag_ids'], $tag['id']);
     342      $page['tag_ids'][] = $tag['id'];
    343343    }
    344344
  • trunk/include/ws_functions.inc.php

    r25005 r25018  
    402402  foreach ( array_from_query($query, 'id') as $id )
    403403  {
    404     array_push($datas, array('element_id'=>$id, 'user_id'=>$user['id']) );
     404    $datas[] = array('element_id'=>$id, 'user_id'=>$user['id']);
    405405  }
    406406  if (count($datas))
     
    794794            if (isset($image_id) and !in_array($image_id, $image_ids))
    795795            {
    796               array_push($new_image_ids, $image_id);
     796              $new_image_ids[] = $image_id;
    797797            }
    798798
     
    833833    foreach ($user_representative_updates_for as $cat_id => $image_id)
    834834    {
    835       array_push(
    836         $updates,
    837         array(
    838           'user_id' => $user['id'],
    839           'cat_id' => $cat_id,
    840           'user_representative_picture_id' => $image_id,
    841           )
     835      $updates[] = array(
     836        'user_id' => $user['id'],
     837        'cat_id' => $cat_id,
     838        'user_representative_picture_id' => $image_id,
    842839        );
    843840    }
     
    995992  {
    996993    case 'reject':
    997       array_push($infos, l10n('Your comment has NOT been registered because it did not pass the validation rules') );
     994      $infos[] = l10n('Your comment has NOT been registered because it did not pass the validation rules');
    998995      return new PwgError(403, implode("; ", $infos) );
    999996    case 'validate':
    1000997    case 'moderate':
    1001998      $ret = array(
    1002           'id' => $comm['id'],
    1003           'validation' => $comment_action=='validate',
     999        'id' => $comm['id'],
     1000        'validation' => $comment_action=='validate',
    10041001        );
    10051002      return array( 'comment' =>  new PwgNamedStruct($ret) );
     
    10721069      );
    10731070    $row['id']=(int)$row['id'];
    1074     array_push($related_categories, $row);
     1071    $related_categories[] = $row;
    10751072  }
    10761073  usort($related_categories, 'global_rank_compare');
     
    15451542      {
    15461543        ws_logfile($file);
    1547         array_push($chunks, $upload_dir.'/'.$file);
     1544        $chunks[] = $upload_dir.'/'.$file;
    15481545      }
    15491546    }
     
    16021599      if (preg_match($pattern, $file))
    16031600      {
    1604         array_push($chunks, $upload_dir.'/'.$file);
     1601        $chunks[] = $upload_dir.'/'.$file;
    16051602      }
    16061603    }
     
    19591956      foreach ($params['tags'] as $tag_name)
    19601957      {
    1961         $tag_id = tag_id_from_tag_name($tag_name);
    1962         array_push($tag_ids, $tag_id);
     1958        $tag_ids[] = tag_id_from_tag_name($tag_name);
    19631959      }
    19641960    }
     
    19681964      foreach ($tag_names as $tag_name)
    19691965      {
    1970         $tag_id = tag_id_from_tag_name(preg_replace('#\\\\*,#', ',', $tag_name));
    1971         array_push($tag_ids, $tag_id);
     1966        $tag_ids[] = tag_id_from_tag_name(preg_replace('#\\\\*,#', ',', $tag_name));
    19721967      }
    19731968    }
     
    26632658    if ($image_id > 0)
    26642659    {
    2665       array_push($image_ids, $image_id);
     2660      $image_ids[] = $image_id;
    26662661    }
    26672662  }
     
    26952690    }
    26962691
    2697     array_push($cat_ids, $cat_id);
     2692    $cat_ids[] = $cat_id;
    26982693
    26992694    if (!isset($rank))
     
    28042799  foreach ($new_cat_ids as $cat_id)
    28052800  {
    2806     array_push(
    2807       $inserts,
    2808       array(
    2809         'image_id' => $image_id,
    2810         'category_id' => $cat_id,
    2811         'rank' => $rank_on_category[$cat_id],
    2812         )
     2801    $inserts[] = array(
     2802      'image_id' => $image_id,
     2803      'category_id' => $cat_id,
     2804      'rank' => $rank_on_category[$cat_id],
    28132805      );
    28142806  }
     
    29962988    if ($category_id > 0)
    29972989    {
    2998       array_push($category_ids, $category_id);
     2990      $category_ids[] = $category_id;
    29992991    }
    30002992  }
     
    30543046    if ($category_id > 0)
    30553047    {
    3056       array_push($category_ids, $category_id);
     3048      $category_ids[] = $category_id;
    30573049    }
    30583050  }
     
    34213413  if (!in_array($params['id'], $conf['updates_ignored'][$params['type']]))
    34223414  {
    3423     array_push($conf['updates_ignored'][$params['type']], $params['id']);
     3415    $conf['updates_ignored'][ $params['type'] ][] = $params['id'];
    34243416  }
    34253417  conf_update_param('updates_ignored', pwg_db_real_escape_string(serialize($conf['updates_ignored'])));
  • trunk/include/ws_protocols/rest_encoder.php

    r22729 r25018  
    6767    $this->_output( '<'.$name );
    6868    $this->_lastTagOpen = true;
    69     array_push( $this->_elementStack, $name);
     69    $this->_elementStack[] = $name;
    7070  }
    7171
Note: See TracChangeset for help on using the changeset viewer.