mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
[ticket/14972] replace all occurrences of sizeof() with the count()
PHPBB3-14972
This commit is contained in:
@@ -336,7 +336,7 @@ function get_context($text, $words, $length = 400)
|
||||
$text = str_replace($entities, $characters, $text);
|
||||
|
||||
$word_indizes = array();
|
||||
if (sizeof($words))
|
||||
if (count($words))
|
||||
{
|
||||
$match = '';
|
||||
// find the starting indizes of all words
|
||||
@@ -361,12 +361,12 @@ function get_context($text, $words, $length = 400)
|
||||
}
|
||||
unset($match);
|
||||
|
||||
if (sizeof($word_indizes))
|
||||
if (count($word_indizes))
|
||||
{
|
||||
$word_indizes = array_unique($word_indizes);
|
||||
sort($word_indizes);
|
||||
|
||||
$wordnum = sizeof($word_indizes);
|
||||
$wordnum = count($word_indizes);
|
||||
// number of characters on the right and left side of each word
|
||||
$sequence_length = (int) ($length / (2 * $wordnum)) - 2;
|
||||
$final_text = '';
|
||||
@@ -434,7 +434,7 @@ function get_context($text, $words, $length = 400)
|
||||
}
|
||||
}
|
||||
|
||||
if (!sizeof($words) || !sizeof($word_indizes))
|
||||
if (!count($words) || !count($word_indizes))
|
||||
{
|
||||
return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text));
|
||||
}
|
||||
@@ -1021,7 +1021,7 @@ function censor_text($text)
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($censors))
|
||||
if (count($censors))
|
||||
{
|
||||
return preg_replace($censors['match'], $censors['replace'], $text);
|
||||
}
|
||||
@@ -1079,7 +1079,7 @@ function smiley_text($text, $force_option = false)
|
||||
*/
|
||||
function parse_attachments($forum_id, &$message, &$attachments, &$update_count_ary, $preview = false)
|
||||
{
|
||||
if (!sizeof($attachments))
|
||||
if (!count($attachments))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a
|
||||
}
|
||||
|
||||
// Grab attachments (security precaution)
|
||||
if (sizeof($attach_ids))
|
||||
if (count($attach_ids))
|
||||
{
|
||||
global $db;
|
||||
|
||||
@@ -1151,7 +1151,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a
|
||||
|
||||
foreach ($attachments as $attachment)
|
||||
{
|
||||
if (!sizeof($attachment))
|
||||
if (!count($attachment))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1443,7 +1443,7 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al
|
||||
$chars = array_map('utf8_htmlspecialchars', $_chars);
|
||||
|
||||
// Now check the length ;)
|
||||
if (sizeof($chars) > $max_length)
|
||||
if (count($chars) > $max_length)
|
||||
{
|
||||
// Cut off the last elements from the array
|
||||
$string = implode('', array_slice($chars, 0, $max_length - utf8_strlen($append)));
|
||||
@@ -1651,7 +1651,7 @@ function phpbb_generate_string_list($items, $user)
|
||||
return '';
|
||||
}
|
||||
|
||||
$count = sizeof($items);
|
||||
$count = count($items);
|
||||
$last_item = array_pop($items);
|
||||
$lang_key = 'STRING_LIST_MULTI';
|
||||
|
||||
|
Reference in New Issue
Block a user