sizeof() -> count()

pull/5635/head
Aleksander Machniak 7 years ago
parent d04cc14018
commit dfd19206a4

@ -165,7 +165,7 @@ class rcube_sieve
$rawErrorMessage = $result->getMessage();
$errMessages = preg_split("/$name:/", $rawErrorMessage);
if (sizeof($errMessages) > 0) {
if (count($errMessages) > 0) {
foreach ($errMessages as $singleError) {
$matches = array();
$res = preg_match('/line (\d+):(.*)/i', $singleError, $matches);

@ -506,7 +506,7 @@ class rcube_sieve_engine
if ($result === false) {
$this->rc->output->show_message('managesieve.filtersaveerror', 'error');
$errorLines = $this->sieve->get_error_lines();
if (sizeof($errorLines) > 0) {
if (count($errorLines) > 0) {
$this->rc->output->set_env("sieve_errors", $errorLines);
}
}
@ -1432,7 +1432,7 @@ class rcube_sieve_engine
// 'any' flag
if ((!isset($this->form) && empty($scr['tests']) && !empty($scr))
|| (sizeof($scr['tests']) == 1 && $scr['tests'][0]['test'] == 'true' && !$scr['tests'][0]['not'])
|| (count($scr['tests']) == 1 && $scr['tests'][0]['test'] == 'true' && !$scr['tests'][0]['not'])
) {
$any = true;
}
@ -1493,7 +1493,7 @@ class rcube_sieve_engine
$out .= $input_join . html::label($field_id, rcube::Q($this->plugin->gettext('filterany')));
$rows_num = !empty($scr['tests']) ? sizeof($scr['tests']) : 1;
$rows_num = !empty($scr['tests']) ? count($scr['tests']) : 1;
$out .= '<div id="rules"'.($any ? ' style="display: none"' : '').'>';
for ($x=0; $x<$rows_num; $x++)
@ -1505,7 +1505,7 @@ class rcube_sieve_engine
// actions
$out .= '<fieldset><legend>' . rcube::Q($this->plugin->gettext('messagesactions')) . "</legend>\n";
$rows_num = isset($scr) ? sizeof($scr['actions']) : 1;
$rows_num = isset($scr) ? count($scr['actions']) : 1;
$out .= '<div id="actions">';
for ($x=0; $x<$rows_num; $x++)
@ -1531,7 +1531,7 @@ class rcube_sieve_engine
function rule_div($fid, $id, $div=true)
{
$rule = isset($this->form) ? $this->form['tests'][$id] : $this->script[$fid]['tests'][$id];
$rows_num = isset($this->form) ? sizeof($this->form['tests']) : sizeof($this->script[$fid]['tests']);
$rows_num = isset($this->form) ? count($this->form['tests']) : count($this->script[$fid]['tests']);
// headers select
$select_header = new html_select(array('name' => "_header[]", 'id' => 'header'.$id,
@ -1935,7 +1935,7 @@ class rcube_sieve_engine
function action_div($fid, $id, $div=true)
{
$action = isset($this->form) ? $this->form['actions'][$id] : $this->script[$fid]['actions'][$id];
$rows_num = isset($this->form) ? sizeof($this->form['actions']) : sizeof($this->script[$fid]['actions']);
$rows_num = isset($this->form) ? count($this->form['actions']) : count($this->script[$fid]['actions']);
$out = $div ? '<div class="actionrow" id="actionrow' .$id .'">'."\n" : '';

@ -85,21 +85,22 @@ class rcube_sieve_script
{
// TODO: check this->supported
array_push($this->content, $content);
return sizeof($this->content)-1;
return count($this->content) - 1;
}
public function delete_rule($index)
{
if(isset($this->content[$index])) {
if (isset($this->content[$index])) {
unset($this->content[$index]);
return true;
}
return false;
}
public function size()
{
return sizeof($this->content);
return count($this->content);
}
public function update_rule($index, $content)
@ -109,6 +110,7 @@ class rcube_sieve_script
$this->content[$index] = $content;
return $index;
}
return false;
}

@ -185,7 +185,7 @@ class zipdownload extends rcube_plugin
if ($rcmail->config->get('zipdownload_selection') && !empty($_POST['_uid'])) {
$messageset = rcmail::get_uids();
if (sizeof($messageset)) {
if (count($messageset)) {
$this->_download_messages($messageset);
}
}

@ -806,7 +806,7 @@ class rcube
{
static $sa_languages = array();
if (!sizeof($sa_languages)) {
if (!count($sa_languages)) {
@include(RCUBE_LOCALIZATION_DIR . 'index.inc');
if ($dh = @opendir(RCUBE_LOCALIZATION_DIR)) {

@ -865,7 +865,7 @@ class rcube_message
}
// if this was a related part try to resolve references
if (preg_match('/^multipart\/(related|relative)/', $mimetype) && sizeof($this->inline_parts)) {
if (preg_match('/^multipart\/(related|relative)/', $mimetype) && count($this->inline_parts)) {
$a_replaces = array();
$img_regexp = '/^image\/(gif|jpe?g|png|tiff|bmp|svg)/';

@ -101,7 +101,7 @@ class rcube_spellcheck_enchant extends rcube_spellcheck_engine
else if (!enchant_dict_check($this->enchant_dictionary, $word)) {
$suggestions = enchant_dict_suggest($this->enchant_dictionary, $word);
if (sizeof($suggestions) > self::MAX_SUGGESTIONS) {
if (count($suggestions) > self::MAX_SUGGESTIONS) {
$suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
}
@ -130,7 +130,7 @@ class rcube_spellcheck_enchant extends rcube_spellcheck_engine
$suggestions = enchant_dict_suggest($this->enchant_dictionary, $word);
if (sizeof($suggestions) > self::MAX_SUGGESTIONS)
if (count($suggestions) > self::MAX_SUGGESTIONS)
$suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
return is_array($suggestions) ? $suggestions : array();

@ -141,7 +141,7 @@ class rcube_spellcheck_googie extends rcube_spellcheck_engine
if ($matches[0][4]) {
$suggestions = explode("\t", $matches[0][4]);
if (sizeof($suggestions) > self::MAX_SUGGESTIONS) {
if (count($suggestions) > self::MAX_SUGGESTIONS) {
$suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
}

@ -107,7 +107,7 @@ class rcube_spellcheck_pspell extends rcube_spellcheck_engine
else if (!pspell_check($this->plink, $word)) {
$suggestions = pspell_suggest($this->plink, $word);
if (sizeof($suggestions) > self::MAX_SUGGESTIONS) {
if (count($suggestions) > self::MAX_SUGGESTIONS) {
$suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
}
@ -136,7 +136,7 @@ class rcube_spellcheck_pspell extends rcube_spellcheck_engine
$suggestions = pspell_suggest($this->plink, $word);
if (sizeof($suggestions) > self::MAX_SUGGESTIONS)
if (count($suggestions) > self::MAX_SUGGESTIONS)
$suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
return is_array($suggestions) ? $suggestions : array();

@ -399,7 +399,7 @@ class rcube_user
$sql = "INSERT INTO ".$this->db->table_name('identities', true).
" (`changed`, ".join(', ', $insert_cols).")".
" VALUES (".$this->db->now().", ".join(', ', array_pad(array(), sizeof($insert_values), '?')).")";
" VALUES (".$this->db->now().", ".join(', ', array_pad(array(), count($insert_values), '?')).")";
call_user_func_array(array($this->db, 'query'),
array_merge(array($sql), $insert_values));
@ -832,7 +832,7 @@ class rcube_user
$sql = "INSERT INTO ".$this->db->table_name('searches', true)
." (".join(', ', $insert_cols).")"
." VALUES (".join(', ', array_pad(array(), sizeof($insert_values), '?')).")";
." VALUES (".join(', ', array_pad(array(), count($insert_values), '?')).")";
call_user_func_array(array($this->db, 'query'),
array_merge(array($sql), $insert_values));

@ -98,7 +98,7 @@ class rcube_utils
// If not an IP address
$domain_array = explode('.', $domain_part);
// Not enough parts to be a valid domain
if (sizeof($domain_array) < 2) {
if (count($domain_array) < 2) {
return false;
}

@ -1161,7 +1161,7 @@ function rcmail_create_draft_body($body, $bodyIsHtml)
global $MESSAGE, $COMPOSE;
// add attachments
// sizeof($MESSAGE->mime_parts can be 1 - e.g. attachment, but no text!
// count($MESSAGE->mime_parts) can be 1 - e.g. attachment, but no text!
if (empty($COMPOSE['forward_attachments'])
&& is_array($MESSAGE->mime_parts)
&& count($MESSAGE->mime_parts) > 0

@ -1248,7 +1248,7 @@ function rcmail_message_body($attrib)
if (!empty($MESSAGE->parts)) {
foreach ($MESSAGE->parts as $part) {
if ($part->type == 'headers') {
$out .= html::div('message-partheaders', rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : null, $part->headers));
$out .= html::div('message-partheaders', rcmail_message_headers(count($header_attrib) ? $header_attrib : null, $part->headers));
}
else if ($part->type == 'content') {
// unsupported (e.g. encrypted)
@ -1636,7 +1636,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
$a_parts = rcube_mime::decode_address_list($input, null, true, $default_charset);
if (!sizeof($a_parts)) {
if (!count($a_parts)) {
return $input;
}

@ -183,7 +183,7 @@ function rcmail_message_attachments($attrib)
$out = $ol = '';
$attachments = array();
if (sizeof($MESSAGE->attachments)) {
if (count($MESSAGE->attachments)) {
foreach ($MESSAGE->attachments as $attach_prop) {
$filename = rcmail_attachment_name($attach_prop, true);
$filesize = $RCMAIL->message_part_size($attach_prop);

Loading…
Cancel
Save