remove long array syntax

This commit is contained in:
msquare 2016-09-30 17:08:20 +02:00
parent 1debe567f5
commit 3738d071f8
12 changed files with 31 additions and 31 deletions

View File

@ -1,8 +1,8 @@
<?php
$locales = array(
$locales = [
'de_DE.UTF-8' => "Deutsch",
'en_US.UTF-8' => "English"
);
];
$default_locale = 'en_US.UTF-8';
@ -61,7 +61,7 @@ function make_langselect() {
global $locales;
$URL = $_SERVER["REQUEST_URI"] . (strpos($_SERVER["REQUEST_URI"], "?") > 0 ? '&' : '?') . "set_locale=";
$items = array();
$items = [];
foreach ($locales as $locale => $name) {
$items[] = toolbar_item_link(htmlspecialchars($URL) . $locale, '', '<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name);
}

View File

@ -71,7 +71,7 @@ function User_tshirts_count() {
* Returns all column names for sorting in an array.
*/
function User_sortable_columns() {
return array(
return [
'Nick',
'Name',
'Vorname',
@ -84,7 +84,7 @@ function User_sortable_columns() {
'force_active',
'Tshirt',
'lastLogIn'
);
];
}
/**

View File

@ -47,7 +47,7 @@ function admin_active() {
WHERE `User`.`Gekommen` = 1 AND `User`.`force_active`=0
GROUP BY `User`.`UID`
ORDER BY `force_active` DESC, `shift_length` DESC" . $limit);
$user_nicks = array();
$user_nicks = [];
foreach ($users as $usr) {
sql_query("UPDATE `User` SET `Aktiv` = 1 WHERE `UID`='" . sql_escape($usr['UID']) . "'");
$user_nicks[] = User_Nick_render($usr);
@ -139,7 +139,7 @@ function admin_active() {
$usr['force_active'] = glyph_bool($usr['force_active'] == 1);
$usr['tshirt'] = glyph_bool($usr['Tshirt'] == 1);
$actions = array();
$actions = [];
if ($usr['Aktiv'] == 0) {
$actions[] = '<a href="' . page_link_to('admin_active') . '&amp;active=' . $usr['UID'] . ($show_all_shifts ? '&amp;show_all_shifts=' : '') . '&amp;search=' . $search . '">' . _("set active") . '</a>';
}

View File

@ -8,10 +8,10 @@ function admin_groups() {
$html = "";
$groups = sql_select("SELECT * FROM `Groups` ORDER BY `Name`");
if (! isset($_REQUEST["action"])) {
$groups_table = array();
$groups_table = [];
foreach ($groups as $group) {
$privileges = sql_select("SELECT * FROM `GroupPrivileges` JOIN `Privileges` ON (`GroupPrivileges`.`privilege_id` = `Privileges`.`id`) WHERE `group_id`='" . sql_escape($group['UID']) . "'");
$privileges_html = array();
$privileges_html = [];
foreach ($privileges as $priv) {
$privileges_html[] = $priv['name'];

View File

@ -22,7 +22,7 @@ function admin_questions() {
global $user;
if (! isset($_REQUEST['action'])) {
$unanswered_questions_table = array();
$unanswered_questions_table = [];
$questions = sql_select("SELECT * FROM `Questions` WHERE `AID` IS NULL");
foreach ($questions as $question) {
$user_source = User($question['UID']);

View File

@ -107,7 +107,7 @@ function admin_rooms() {
}
sql_query("DELETE FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($room_id) . "'");
$needed_angeltype_info = array();
$needed_angeltype_info = [];
foreach ($angeltypes_count as $angeltype_id => $angeltype_count) {
$angeltype = AngelType($angeltype_id);
if ($angeltype === false) {

View File

@ -5,7 +5,7 @@ function guest_stats() {
if (isset($_REQUEST['api_key'])) {
if ($_REQUEST['api_key'] == $api_key) {
$stats = array();
$stats = [];
list($user_count) = sql_select("SELECT count(*) as `user_count` FROM `User`");
$stats['user_count'] = $user_count['user_count'];

View File

@ -660,9 +660,9 @@ function view_user_shifts() {
$style = " text-decoration: line-through;";
}
if (in_array('user_shifts_admin', $privileges)) {
$entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . ' ' . table_buttons(array(
$entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . ' ' . table_buttons([
button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], glyph('trash'), 'btn-xs')
)) . '</span>';
]) . '</span>';
} else {
$entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . "</span>";
}
@ -796,9 +796,9 @@ function view_user_shifts() {
$freeloader = 0;
foreach ($entries as $entry) {
if (in_array('user_shifts_admin', $privileges)) {
$member = User_Nick_render($entry) . ' ' . table_buttons(array(
$member = User_Nick_render($entry) . ' ' . table_buttons([
button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], glyph('trash'), 'btn-xs')
));
]);
} else {
$member = User_Nick_render($entry);
}

View File

@ -17,7 +17,7 @@ function page_link_to_absolute($page) {
function header_toolbar() {
global $page, $privileges, $user, $enable_tshirt_size, $max_freeloadable_shifts;
$toolbar_items = array();
$toolbar_items = [];
if (isset($user)) {
$toolbar_items[] = toolbar_item_link(page_link_to('shifts') . '&amp;action=next', 'time', User_shift_state_render($user));

View File

@ -3,12 +3,12 @@
/**
* Liste der verfügbaren Themes
*/
$themes = array(
$themes = [
'3' => "Engelsystem 32c3",
"2" => "Engelsystem cccamp15",
"0" => "Engelsystem light",
"1" => "Engelsystem dark"
);
];
/**
* Display muted (grey) text.
@ -56,7 +56,7 @@ function heading($content, $number = 1) {
* @param array $items
* @return string
*/
function toolbar($items = array(), $right = false) {
function toolbar($items = [], $right = false) {
return '<ul class="nav navbar-nav' . ($right ? ' navbar-right' : '') . '">' . join("\n", $items) . '</ul>';
}
@ -199,7 +199,7 @@ function form_checkboxes($name, $label, $items, $selected) {
* @param
* disabled Wie selected, nur dass die entsprechenden Checkboxen deaktiviert statt markiert sind
*/
function form_multi_checkboxes($names, $label, $items, $selected, $disabled = array()) {
function form_multi_checkboxes($names, $label, $items, $selected, $disabled = []) {
$html = "<table><thead><tr>";
foreach ($names as $title) {
$html .= "<th>$title</th>";
@ -399,11 +399,11 @@ function button_glyph($href, $glyph, $class = "") {
/**
* Rendert eine Toolbar mit Knöpfen
*/
function buttons($buttons = array ()) {
function buttons($buttons = []) {
return '<div class="form-group">' . table_buttons($buttons) . '</div>';
}
function table_buttons($buttons = array()) {
function table_buttons($buttons = []) {
return '<div class="btn-group">' . join(' ', $buttons) . '</div>';
}

View File

@ -38,17 +38,17 @@ function AngelType_render_membership($user_angeltype) {
}
function AngelType_delete_view($angeltype) {
return page_with_title(sprintf(_("Delete angeltype %s"), $angeltype['name']), array(
return page_with_title(sprintf(_("Delete angeltype %s"), $angeltype['name']), [
info(sprintf(_("Do you want to delete angeltype %s?"), $angeltype['name']), true),
buttons([
button(page_link_to('angeltypes'), _("cancel"), 'cancel'),
button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '&confirmed', _("delete"), 'ok')
])
));
]);
}
function AngelType_edit_view($name, $restricted, $description, $coordinator_mode, $requires_driver_license) {
return page_with_title(sprintf(_("Edit %s"), $name), array(
return page_with_title(sprintf(_("Edit %s"), $name), [
buttons([
button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
]),
@ -62,7 +62,7 @@ function AngelType_edit_view($name, $restricted, $description, $coordinator_mode
form_info("", _("Please use markdown for the description.")),
form_submit('submit', _("Save"))
])
));
]);
}
function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $coordinator, $user_driver_license, $user) {

View File

@ -97,11 +97,11 @@ function Users_view($users, $order_by, $arrived_count, $active_count, $force_act
$user['force_active'] = glyph_bool($user['force_active']);
$user['Tshirt'] = glyph_bool($user['Tshirt']);
$user['lastLogIn'] = date(_('m/d/Y h:i a'), $user['lastLogIn']);
$user['actions'] = table_buttons(array(
$user['actions'] = table_buttons([
button_glyph(page_link_to('admin_user') . '&id=' . $user['UID'], 'edit', 'btn-xs')
));
]);
}
$users[] = array(
$users[] = [
'Nick' => '<strong>' . _('Sum') . '</strong>',
'Gekommen' => $arrived_count,
'got_voucher' => $voucher_count,
@ -110,7 +110,7 @@ function Users_view($users, $order_by, $arrived_count, $active_count, $force_act
'freeloads' => $freeloads_count,
'Tshirt' => $tshirts_count,
'actions' => '<strong>' . count($users) . '</strong>'
);
];
return page_with_title(_('All users'), [
msg(),