Minor improvements (#882)

* Minor improvements

* Updated

* Updated

* Updated

* Update privmsg.php

* Updated

* Update admin_attach_cp.php
This commit is contained in:
Roman Kelesidis 2023-09-04 01:01:01 +07:00 committed by GitHub
commit 4b453de64a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 699 additions and 735 deletions

View file

@ -48,7 +48,7 @@ function get_config()
{
global $bb_cfg;
$attach_config = array();
$attach_config = [];
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
@ -67,7 +67,7 @@ function get_config()
}
// Get Attachment Config
$attach_config = array();
$attach_config = [];
if (!$attach_config = CACHE('bb_cache')->get('attach_config')) {
$attach_config = get_config();

View file

@ -11,11 +11,11 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
$allowed_extensions = array();
$display_categories = array();
$download_modes = array();
$upload_icons = array();
$attachments = array();
$allowed_extensions = [];
$display_categories = [];
$download_modes = [];
$upload_icons = [];
$attachments = [];
/**
* Create needed arrays for Extension Assignments
@ -28,7 +28,7 @@ function init_complete_extensions_data()
$GLOBALS['datastore']->update('attach_extensions');
$extension_informations = get_extension_informations();
}
$allowed_extensions = array();
$allowed_extensions = [];
for ($i = 0, $size = count($extension_informations); $i < $size; $i++) {
$extension = strtolower(trim($extension_informations[$i]['extension']));
@ -116,7 +116,7 @@ function init_display_post_attachments($switch_attachment)
return;
}
$post_id_array = array();
$post_id_array = [];
for ($i = 0; $i < $total_posts; $i++) {
if ($postrow[$i]['post_attachment'] == 1) {
@ -173,7 +173,7 @@ function display_attachments($post_id)
return;
}
$template->assign_block_vars('postrow.attach', array());
$template->assign_block_vars('postrow.attach', []);
for ($i = 0; $i < $num_attachments; $i++) {
// Some basic things...
@ -200,9 +200,7 @@ function display_attachments($post_id)
if (!in_array($attachments['_' . $post_id][$i]['extension'], $allowed_extensions)) {
$denied = true;
$template->assign_block_vars('postrow.attach.denyrow', array(
'L_DENIED' => sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachments['_' . $post_id][$i]['extension']))
);
$template->assign_block_vars('postrow.attach.denyrow', ['L_DENIED' => sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachments['_' . $post_id][$i]['extension'])]);
}
if (!$denied || IS_ADMIN) {
@ -246,13 +244,13 @@ function display_attachments($post_id)
$download_link = false;
}
$template->assign_block_vars('postrow.attach.cat_images', array(
$template->assign_block_vars('postrow.attach.cat_images', [
'DOWNLOAD_NAME' => $display_name,
'S_UPLOAD_IMAGE' => $upload_image,
'IMG_SRC' => $img_source,
'FILESIZE' => $filesize,
'COMMENT' => $comment,
));
'COMMENT' => $comment
]);
// Directly Viewed Image ... update the download count
if (!$download_link) {
@ -274,14 +272,14 @@ function display_attachments($post_id)
$thumb_source = $thumbnail_filename;
}
$template->assign_block_vars('postrow.attach.cat_thumb_images', array(
$template->assign_block_vars('postrow.attach.cat_thumb_images', [
'DOWNLOAD_NAME' => $display_name,
'S_UPLOAD_IMAGE' => $upload_image,
'IMG_SRC' => BB_ROOT . DL_URL . $attachments['_' . $post_id][$i]['attach_id'],
'IMG_THUMB_SRC' => $thumb_source,
'FILESIZE' => $filesize,
'COMMENT' => $comment,
));
'COMMENT' => $comment
]);
}
// bt
@ -291,15 +289,15 @@ function display_attachments($post_id)
$target_blank = ((@(int)$display_categories[$attachments['_' . $post_id][$i]['extension']] == IMAGE_CAT)) ? 'target="_blank"' : '';
// display attachment
$template->assign_block_vars('postrow.attach.attachrow', array(
$template->assign_block_vars('postrow.attach.attachrow', [
'U_DOWNLOAD_LINK' => BB_ROOT . DL_URL . $attachments['_' . $post_id][$i]['attach_id'],
'S_UPLOAD_IMAGE' => $upload_image,
'DOWNLOAD_NAME' => $display_name,
'FILESIZE' => $filesize,
'COMMENT' => $comment,
'TARGET_BLANK' => $target_blank,
'DOWNLOAD_COUNT' => declension((int)$attachments['_' . $post_id][$i]['download_count'], 'times'),
));
'DOWNLOAD_COUNT' => declension((int)$attachments['_' . $post_id][$i]['download_count'], 'times')
]);
}
}
}

View file

@ -28,15 +28,15 @@ $upload_image = '<img src="' . $images['icon_dn'] . '" alt="' . $lang['DL_TORREN
$peers_cnt = $seed_count = 0;
$seeders = $leechers = '';
$tor_info = array();
$tor_info = [];
$template->assign_vars(array(
$template->assign_vars([
'SEED_COUNT' => false,
'LEECH_COUNT' => false,
'TOR_SPEED_UP' => false,
'TOR_SPEED_DOWN' => false,
'SHOW_RATIO_WARN' => false,
));
'SHOW_RATIO_WARN' => false
]);
// Define show peers mode (count only || user names with complete % || full details)
$cfg_sp_mode = $bb_cfg['bt_show_peers_mode'];
@ -90,7 +90,7 @@ if ($tor_auth_reg || $tor_auth_del) {
$display_name = '[' . $bb_cfg['server_name'] . '].t' . $bt_topic_id . '.torrent';
if (!$tor_reged) {
$template->assign_block_vars('postrow.attach.tor_not_reged', array(
$template->assign_block_vars('postrow.attach.tor_not_reged', [
'DOWNLOAD_NAME' => $display_name,
'TRACKER_LINK' => $tracker_link,
'ATTACH_ID' => $attach_id,
@ -101,10 +101,10 @@ if (!$tor_reged) {
'DOWNLOAD_COUNT' => declension((int)$download_count, 'times'),
'POSTED_TIME' => $tor_file_time,
));
]);
if ($comment) {
$template->assign_block_vars('postrow.attach.tor_not_reged.comment', array('COMMENT' => $comment));
$template->assign_block_vars('postrow.attach.tor_not_reged.comment', ['COMMENT' => $comment]);
}
} else {
$sql = "SELECT bt.*, u.user_id, u.username, u.user_rank
@ -126,13 +126,13 @@ if ($tor_reged && !$tor_info) {
}
if ($tor_auth) {
$template->assign_vars(array(
$template->assign_vars([
'TOR_CONTROLS' => true,
'TOR_ATTACH_ID' => $attach_id,
));
'TOR_ATTACH_ID' => $attach_id
]);
if ($t_data['self_moderated'] || $is_auth['auth_mod']) {
$template->assign_vars(array('AUTH_MOVE' => true));
$template->assign_vars(['AUTH_MOVE' => true]);
}
}
@ -175,21 +175,21 @@ if ($tor_reged && $tor_info) {
}
if ((isset($user_ratio, $min_ratio_warn) && $user_ratio < $min_ratio_warn && TR_RATING_LIMITS) || ($bt_userdata['u_down_total'] < MIN_DL_FOR_RATIO)) {
$template->assign_vars(array(
$template->assign_vars([
'SHOW_RATIO_WARN' => true,
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help']),
));
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help'])
]);
}
}
if (!$dl_allowed) {
$template->assign_block_vars('postrow.attach.tor_reged', array());
$template->assign_vars(array(
$template->assign_block_vars('postrow.attach.tor_reged', []);
$template->assign_vars([
'TOR_BLOCKED' => true,
'TOR_BLOCKED_MSG' => sprintf($lang['BT_LOW_RATIO_FOR_DL'], round($user_ratio, 2), "search.php?dlu=$bt_user_id&amp;dlc=1"),
));
]);
} else {
$template->assign_block_vars('postrow.attach.tor_reged', array(
$template->assign_block_vars('postrow.attach.tor_reged', [
'DOWNLOAD_NAME' => $display_name,
'TRACKER_LINK' => $tracker_link,
'ATTACH_ID' => $attach_id,
@ -218,22 +218,22 @@ if ($tor_reged && $tor_info) {
'REGED_DELTA' => delta_time($tor_info['reg_time']),
'TORRENT_SIZE' => humn_size($tor_size),
'COMPLETED' => declension((int)$tor_info['complete_count'], 'times'),
));
]);
if ($comment) {
$template->assign_block_vars('postrow.attach.tor_reged.comment', array('COMMENT' => $comment));
$template->assign_block_vars('postrow.attach.tor_reged.comment', ['COMMENT' => $comment]);
}
}
if ($bb_cfg['show_tor_info_in_dl_list']) {
$template->assign_vars(array(
$template->assign_vars([
'SHOW_DL_LIST' => true,
'SHOW_DL_LIST_TOR_INFO' => true,
'TOR_SIZE' => humn_size($tor_size),
'TOR_LONGEVITY' => delta_time($tor_info['reg_time']),
'TOR_COMPLETED' => declension($tor_info['complete_count'], 'times'),
));
]);
}
// Show peers
@ -250,7 +250,7 @@ if ($tor_reged && $tor_info) {
}
if (isset($_REQUEST['porder'])) {
$peer_orders = array(
$peer_orders = [
'name' => 'u.username',
'ip' => 'tr.ip',
'port' => 'tr.port',
@ -259,8 +259,8 @@ if ($tor_reged && $tor_info) {
'cdown' => 'tr.downloaded',
'sup' => 'tr.speed_up',
'sdown' => 'tr.speed_down',
'time' => 'tr.update_time',
);
'time' => 'tr.update_time'
];
foreach ($peer_orders as $get_key => $order_by_value) {
if ($_REQUEST['porder'] == $get_key) {
@ -299,11 +299,11 @@ if ($tor_reged && $tor_info) {
if ($peers = DB()->fetch_rowset($sql)) {
$peers_cnt = count($peers);
$cnt = $tr = $sp_up = $sp_down = $sp_up_tot = $sp_down_tot = array();
$cnt = $tr = $sp_up = $sp_down = $sp_up_tot = $sp_down_tot = [];
$cnt['s'] = $tr['s'] = $sp_up['s'] = $sp_down['s'] = $sp_up_tot['s'] = $sp_down_tot['s'] = 0;
$cnt['l'] = $tr['l'] = $sp_up['l'] = $sp_down['l'] = $sp_up_tot['l'] = $sp_down_tot['l'] = 0;
$max_up = $max_down = $max_sp_up = $max_sp_down = array();
$max_up = $max_down = $max_sp_up = $max_sp_down = [];
$max_up['s'] = $max_down['s'] = $max_sp_up['s'] = $max_sp_down['s'] = 0;
$max_up['l'] = $max_down['l'] = $max_sp_up['l'] = $max_sp_down['l'] = 0;
$max_up_id['s'] = $max_down_id['s'] = $max_sp_up_id['s'] = $max_sp_down_id['s'] = ($peers_cnt + 1);
@ -348,7 +348,7 @@ if ($tor_reged && $tor_info) {
}
if ($s_mode == 'count') {
$tmp = array();
$tmp = [];
$tmp[0]['seeder'] = $tmp[0]['username'] = $tmp[1]['username'] = 0;
$tmp[1]['seeder'] = 1;
$tmp[0]['username'] = (int)@$peers[0]['leechers'];
@ -357,10 +357,10 @@ if ($tor_reged && $tor_info) {
$tor_speed_down = (int)@$peers[0]['speed_down'];
$peers = $tmp;
$template->assign_vars(array(
$template->assign_vars([
'TOR_SPEED_UP' => ($tor_speed_up) ? humn_size($tor_speed_up, 0, 'KB') . '/s' : '0 KB/s',
'TOR_SPEED_DOWN' => ($tor_speed_down) ? humn_size($tor_speed_down, 0, 'KB') . '/s' : '0 KB/s',
));
'TOR_SPEED_DOWN' => ($tor_speed_down) ? humn_size($tor_speed_down, 0, 'KB') . '/s' : '0 KB/s'
]);
}
foreach ($peers as $pid => $peer) {
@ -384,18 +384,18 @@ if ($tor_reged && $tor_info) {
if (!defined('SEEDER_EXIST')) {
define('SEEDER_EXIST', true);
$seed_order_action = "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#seeders";
$seed_order_action = TOPIC_URL . "$bt_topic_id&amp;spmode=full#seeders";
$template->assign_block_vars((string)$x_full, array(
$template->assign_block_vars((string)$x_full, [
'SEED_ORD_ACT' => $seed_order_action,
'SEEDERS_UP_TOT' => humn_size($sp_up_tot[$x], 0, 'KB') . '/s'
));
]);
if ($ip) {
$template->assign_block_vars("$x_full.iphead", array());
$template->assign_block_vars("$x_full.iphead", []);
}
if ($port !== false) {
$template->assign_block_vars("$x_full.porthead", array());
$template->assign_block_vars("$x_full.porthead", []);
}
}
$compl_perc = ($tor_size) ? round(($p_max_up / $tor_size), 1) : 0;
@ -406,19 +406,19 @@ if ($tor_reged && $tor_info) {
if (!defined('LEECHER_EXIST')) {
define('LEECHER_EXIST', true);
$leech_order_action = "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#leechers";
$leech_order_action = TOPIC_URL . "$bt_topic_id&amp;spmode=full#leechers";
$template->assign_block_vars((string)$x_full, array(
$template->assign_block_vars((string)$x_full, [
'LEECH_ORD_ACT' => $leech_order_action,
'LEECHERS_UP_TOT' => humn_size($sp_up_tot[$x], 0, 'KB') . '/s',
'LEECHERS_DOWN_TOT' => humn_size($sp_down_tot[$x], 0, 'KB') . '/s'
));
]);
if ($ip) {
$template->assign_block_vars("$x_full.iphead", array());
$template->assign_block_vars("$x_full.iphead", []);
}
if ($port !== false) {
$template->assign_block_vars("$x_full.porthead", array());
$template->assign_block_vars("$x_full.porthead", []);
}
}
$compl_size = ($peer['remain'] && $tor_size && $tor_size > $peer['remain']) ? ($tor_size - $peer['remain']) : 0;
@ -437,7 +437,7 @@ if ($tor_reged && $tor_info) {
$row_bgr = ($change_peers_bgr_over) ? " class=\"$bgr_class\" onmouseover=\"this.className='$bgr_class_over';\" onmouseout=\"this.className='$bgr_class';\"" : '';
$tr[$x]++;
$template->assign_block_vars("$x_full.$x_row", array(
$template->assign_block_vars("$x_full.$x_row", [
'ROW_BGR' => $row_bgr,
'NAME' => ($peer['update_time']) ? $name : "<s>$name</s>",
'COMPL_PRC' => $compl_perc,
@ -450,14 +450,14 @@ if ($tor_reged && $tor_info) {
'SPEED_UP_RAW' => $peer['speed_up'],
'SPEED_DOWN_RAW' => $peer['speed_down'],
'UPD_EXP_TIME' => ($peer['update_time']) ? $lang['DL_UPD'] . bb_date($peer['update_time'], 'd-M-y H:i') . ' &middot; ' . delta_time($peer['update_time']) . $lang['TOR_BACK'] : $lang['DL_STOPPED'],
'TOR_RATIO' => ($up_ratio) ? $lang['USER_RATIO'] . "UL/DL: $up_ratio" : '',
));
'TOR_RATIO' => ($up_ratio) ? $lang['USER_RATIO'] . "UL/DL: $up_ratio" : ''
]);
if ($ip) {
$template->assign_block_vars("$x_full.$x_row.ip", array('IP' => $ip));
$template->assign_block_vars("$x_full.$x_row.ip", ['IP' => $ip]);
}
if ($port !== false) {
$template->assign_block_vars("$x_full.$x_row.port", array('PORT' => $port));
$template->assign_block_vars("$x_full.$x_row.port", ['PORT' => $port]);
}
} // Count only & only names modes
else {
@ -478,17 +478,17 @@ if ($tor_reged && $tor_info) {
if ($s_mode != 'full' && $seeders) {
$seeders[strlen($seeders) - 9] = ' ';
$template->assign_vars(array(
$template->assign_vars([
'SEED_LIST' => $seeders,
'SEED_COUNT' => ($seed_count) ?: 0,
));
]);
}
if ($s_mode != 'full' && $leechers) {
$leechers[strlen($leechers) - 9] = ' ';
$template->assign_vars(array(
$template->assign_vars([
'LEECH_LIST' => $leechers,
'LEECH_COUNT' => ($leech_count) ?: 0,
));
]);
}
}
unset($peers);
@ -497,27 +497,27 @@ if ($tor_reged && $tor_info) {
if (($s_mode == 'count' && !$seed_count) || (!$seeders && !defined('SEEDER_EXIST'))) {
$last_seen_time = ($tor_info['seeder_last_seen']) ? delta_time($tor_info['seeder_last_seen']) : $lang['NEVER'];
$template->assign_vars(array(
'SEEDER_LAST_SEEN' => sprintf($lang['SEEDER_LAST_SEEN'], $last_seen_time),
));
$template->assign_vars(['SEEDER_LAST_SEEN' => sprintf($lang['SEEDER_LAST_SEEN'], $last_seen_time)]);
}
}
$template->assign_block_vars('tor_title', array('U_DOWNLOAD_LINK' => $download_link));
$template->assign_block_vars('tor_title', ['U_DOWNLOAD_LINK' => $download_link]);
if ($peers_cnt > $max_peers_before_overflow && $s_mode == 'full') {
$template->assign_vars(array('PEERS_DIV_STYLE' => $peers_div_style_overflow));
$template->assign_vars(array('PEERS_OVERFLOW' => true));
$template->assign_vars([
'PEERS_OVERFLOW' => true,
'PEERS_DIV_STYLE' => $peers_div_style_overflow
]);
} else {
$template->assign_vars(array('PEERS_DIV_STYLE' => $peers_div_style_normal));
$template->assign_vars(['PEERS_DIV_STYLE' => $peers_div_style_normal]);
}
}
if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full') {
$template->assign_vars(array(
$template->assign_vars([
'PEERS_FULL_LINK' => true,
'SPMODE_FULL_HREF' => "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#seeders",
));
'SPMODE_FULL_HREF' => TOPIC_URL . "$bt_topic_id&amp;spmode=full#seeders"
]);
}
$template->assign_vars(array(

View file

@ -55,7 +55,7 @@ function base64_unpack($string)
for ($i = 1; $i <= $length; $i++) {
$pos = $length - $i;
$operand = strpos($chars, (string) $string[$pos]);
$operand = strpos($chars, (string)$string[$pos]);
$exponent = $base ** ($i - 1);
$decValue = $operand * $exponent;
$number += $decValue;
@ -454,7 +454,7 @@ function _set_var(&$result, $var, $type, $multibyte = false)
$result = $var;
if ($type == 'string') {
$result = trim(str_replace(array("\r\n", "\r", '\xFF'), array("\n", "\n", ' '), $result));
$result = trim(str_replace(["\r\n", "\r", '\xFF'], ["\n", "\n", ' '], $result));
// 2.0.x is doing addslashes on all variables
$result = stripslashes($result);
if ($multibyte) {

View file

@ -23,7 +23,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
}
if ($post_id_array === 0 && $attach_id_array !== 0) {
$post_id_array = array();
$post_id_array = [];
if (!is_array($attach_id_array)) {
if (false !== strpos($attach_id_array, ', ')) {
@ -32,7 +32,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
$attach_id_array = explode(',', $attach_id_array);
} else {
$attach_id = (int)$attach_id_array;
$attach_id_array = array();
$attach_id_array = [];
$attach_id_array[] = $attach_id;
}
}
@ -74,7 +74,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
} else {
$post_id = (int)$post_id_array;
$post_id_array = array();
$post_id_array = [];
$post_id_array[] = $post_id;
}
}
@ -85,7 +85,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
// First of all, determine the post id and attach_id
if ($attach_id_array === 0) {
$attach_id_array = array();
$attach_id_array = [];
// Get the attach_ids to fill the array
$whereclause = 'WHERE post_id IN (' . implode(', ', $post_id_array) . ')';
@ -119,7 +119,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
} else {
$attach_id = (int)$attach_id_array;
$attach_id_array = array();
$attach_id_array = [];
$attach_id_array[] = $attach_id;
}
}
@ -147,7 +147,7 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
bb_die($lang['ERROR_DELETED_ATTACHMENTS']);
}
$torrents_sql = array();
$torrents_sql = [];
while ($row = DB()->sql_fetchrow($result)) {
$torrents_sql[] = $row['topic_id'];

View file

@ -109,11 +109,11 @@ function image_getdimension($file)
if (!$error) {
fclose($fp);
return array(
return [
$width,
$height,
6
);
];
}
$error = false;
@ -147,11 +147,11 @@ function image_getdimension($file)
if (!$error) {
fclose($fp);
return array(
return [
$width,
$height,
1
);
];
}
$error = false;
@ -199,11 +199,11 @@ function image_getdimension($file)
if (!$error) {
fclose($fp);
return array(
return [
$width,
$height,
2
);
];
}
$error = false;
@ -245,11 +245,11 @@ function image_getdimension($file)
if (!$error) {
fclose($fp);
return array(
return [
$width,
$height,
7
);
];
}
fclose($fp);

View file

@ -98,10 +98,10 @@ function attachment_quota_settings($admin_mode, $mode, $submit = false)
}
DB()->sql_freeresult($result);
$template->assign_vars(array(
$template->assign_vars([
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('user_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota),
));
'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota)
]);
}
if ($admin_mode == 'user' && $submit && @$_POST['delete_user']) {
@ -148,10 +148,10 @@ function attachment_quota_settings($admin_mode, $mode, $submit = false)
}
DB()->sql_freeresult($result);
$template->assign_vars(array(
$template->assign_vars([
'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota),
'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota),
));
'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota)
]);
}
if ($admin_mode == 'group' && $submit && isset($_POST['group_delete'])) {

View file

@ -120,8 +120,8 @@ function category_select($select_name, $group_id = 0)
}
}
$types = array(NONE_CAT);
$modes = array('none');
$types = [NONE_CAT];
$modes = ['none'];
for ($i = 0, $iMax = count($types_category); $i < $iMax; $i++) {
$types[] = $types_category[$i];
@ -152,8 +152,8 @@ function size_select($select_name, $size_compare)
{
global $lang;
$size_types_text = array($lang['BYTES'], $lang['KB'], $lang['MB']);
$size_types = array('b', 'kb', 'mb');
$size_types_text = [$lang['BYTES'], $lang['KB'], $lang['MB']];
$size_types = ['b', 'kb', 'mb'];
$select_field = '<select name="' . $select_name . '">';

View file

@ -22,16 +22,16 @@ function get_img_size_format($width, $height)
$max_width = 400;
if ($width > $height) {
return array(
return [
round($width * ($max_width / $width)),
round($height * ($max_width / $width))
);
];
}
return array(
return [
round($width * ($max_width / $height)),
round($height * ($max_width / $height))
);
];
}
/**
@ -78,14 +78,14 @@ function get_supported_image_types($type)
break;
}
return array(
return [
'gd' => (bool)$new_type,
'format' => $new_type,
'version' => (function_exists('imagecreatetruecolor')) ? 2 : 1
);
];
}
return array('gd' => false);
return ['gd' => false];
}
/**