mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
Minor improvements (#882)
* Minor improvements * Updated * Updated * Updated * Update privmsg.php * Updated * Update admin_attach_cp.php
This commit is contained in:
parent
2c07660435
commit
4b453de64a
75 changed files with 699 additions and 735 deletions
|
@ -194,7 +194,7 @@ function strip_quotes($text)
|
|||
$lowertext = strtolower($text);
|
||||
|
||||
// find all [quote tags
|
||||
$start_pos = array();
|
||||
$start_pos = [];
|
||||
$curpos = 0;
|
||||
do {
|
||||
$pos = strpos($lowertext, '[quote', $curpos);
|
||||
|
@ -209,7 +209,7 @@ function strip_quotes($text)
|
|||
}
|
||||
|
||||
// find all [/quote] tags
|
||||
$end_pos = array();
|
||||
$end_pos = [];
|
||||
$curpos = 0;
|
||||
do {
|
||||
$pos = strpos($lowertext, '[/quote', $curpos);
|
||||
|
@ -230,7 +230,7 @@ function strip_quotes($text)
|
|||
do {
|
||||
// build a stack that represents when a quote tag is opened
|
||||
// and add non-quote text to the new string
|
||||
$stack = array();
|
||||
$stack = [];
|
||||
$newtext = '[...] ';
|
||||
$substr_pos = 0;
|
||||
foreach ($pos_list as $pos => $type) {
|
||||
|
@ -278,8 +278,8 @@ function strip_quotes($text)
|
|||
*/
|
||||
function strip_bbcode($message, $stripquotes = true, $fast_and_dirty = false, $showlinks = true)
|
||||
{
|
||||
$find = array();
|
||||
$replace = array();
|
||||
$find = [];
|
||||
$replace = [];
|
||||
|
||||
if ($stripquotes) {
|
||||
// [quote=username] and [quote]
|
||||
|
@ -315,7 +315,7 @@ function strip_bbcode($message, $stripquotes = true, $fast_and_dirty = false, $s
|
|||
$message = str_replace($m[0], $m[2], $message);
|
||||
}
|
||||
|
||||
$replace = array('[*]', '[hr]', '[br]', '[align=center]', '[align=left]', '[align=right]');
|
||||
$replace = ['[*]', '[hr]', '[br]', '[align=center]', '[align=left]', '[align=right]'];
|
||||
$message = str_replace($replace, ' ', $message);
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ function extract_search_words($text)
|
|||
$max_word_len = $bb_cfg['search_max_word_len'];
|
||||
|
||||
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
|
||||
$text = str_replace(array('[', ']'), array('[', ']'), $text);
|
||||
$text = str_replace(['[', ']'], ['[', ']'], $text);
|
||||
|
||||
// HTML entities like
|
||||
$text = preg_replace('/(\w*?)&#?[0-9a-z]+;(\w*?)/iu', '', $text);
|
||||
|
@ -348,7 +348,7 @@ function extract_search_words($text)
|
|||
$text = array_unique(explode(' ', str_compact($text)));
|
||||
|
||||
// short & long words 2
|
||||
$text_out = array();
|
||||
$text_out = [];
|
||||
foreach ($text as $word) {
|
||||
if (mb_strlen($word) > $min_word_len && mb_strlen($word) <= $max_word_len) {
|
||||
$text_out[] = $word;
|
||||
|
@ -368,7 +368,7 @@ function add_search_words($post_id, $post_message, $topic_title = '', $only_retu
|
|||
global $bb_cfg;
|
||||
|
||||
$text = $topic_title . ' ' . $post_message;
|
||||
$words = ($text) ? extract_search_words($text) : array();
|
||||
$words = ($text) ? extract_search_words($text) : [];
|
||||
|
||||
if ($only_return_words || $bb_cfg['search_engine_type'] == 'sphinx') {
|
||||
return implode("\n", $words);
|
||||
|
@ -393,8 +393,8 @@ function bbcode2html($text)
|
|||
if (!isset($bbcode)) {
|
||||
$bbcode = new TorrentPier\Legacy\BBCode();
|
||||
}
|
||||
$orig_word = array();
|
||||
$replacement_word = array();
|
||||
$orig_word = [];
|
||||
$replacement_word = [];
|
||||
obtain_word_list($orig_word, $replacement_word);
|
||||
if (count($orig_word)) {
|
||||
$text = preg_replace($orig_word, $replacement_word, $text);
|
||||
|
@ -429,10 +429,10 @@ function get_parsed_post($postrow, $mode = 'full', $return_chars = 600)
|
|||
|
||||
// Posts cache
|
||||
if ($bb_cfg['use_posts_cache']) {
|
||||
DB()->shutdown['post_html'][] = array(
|
||||
DB()->shutdown['post_html'][] = [
|
||||
'post_id' => (int)$postrow['post_id'],
|
||||
'post_html' => (string)$message,
|
||||
);
|
||||
'post_html' => (string)$message
|
||||
];
|
||||
}
|
||||
|
||||
return $message;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue