diff options
author | rxu <rxu@mail.ru> | 2017-06-28 00:58:03 +0700 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2018-01-01 13:56:04 +0100 |
commit | f8fbe3793680af1dae2db2829cfc84068831c52f (patch) | |
tree | 54c7108b28fb58688a8695a0b592c163314a09f9 /phpBB/includes/functions_content.php | |
parent | ff18802656e72981f6ecb613d756bc19f2462689 (diff) | |
download | forums-f8fbe3793680af1dae2db2829cfc84068831c52f.tar forums-f8fbe3793680af1dae2db2829cfc84068831c52f.tar.gz forums-f8fbe3793680af1dae2db2829cfc84068831c52f.tar.bz2 forums-f8fbe3793680af1dae2db2829cfc84068831c52f.tar.xz forums-f8fbe3793680af1dae2db2829cfc84068831c52f.zip |
[ticket/14972] replace all occurrences of sizeof() with the count()
PHPBB3-14972
Diffstat (limited to 'phpBB/includes/functions_content.php')
-rw-r--r-- | phpBB/includes/functions_content.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 06223027d8..40d44cfe7b 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -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'; |