From 3738d071f86aa5016ce326a009a278085b41fb48 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 30 Sep 2016 17:08:20 +0200 Subject: remove long array syntax --- includes/helper/internationalization_helper.php | 6 +++--- includes/model/User_model.php | 4 ++-- includes/pages/admin_active.php | 4 ++-- includes/pages/admin_groups.php | 4 ++-- includes/pages/admin_questions.php | 2 +- includes/pages/admin_rooms.php | 2 +- includes/pages/guest_stats.php | 2 +- includes/pages/user_shifts.php | 8 ++++---- includes/sys_menu.php | 2 +- includes/sys_template.php | 12 ++++++------ includes/view/AngelTypes_view.php | 8 ++++---- includes/view/User_view.php | 8 ++++---- 12 files changed, 31 insertions(+), 31 deletions(-) (limited to 'includes') diff --git a/includes/helper/internationalization_helper.php b/includes/helper/internationalization_helper.php index 1f4f3558..60451197 100644 --- a/includes/helper/internationalization_helper.php +++ b/includes/helper/internationalization_helper.php @@ -1,8 +1,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, '', '' . $name . ' ' . $name); } diff --git a/includes/model/User_model.php b/includes/model/User_model.php index 7f9170df..576bb3f5 100644 --- a/includes/model/User_model.php +++ b/includes/model/User_model.php @@ -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' - ); + ]; } /** diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index 733bd506..8d71b147 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -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[] = '' . _("set active") . ''; } diff --git a/includes/pages/admin_groups.php b/includes/pages/admin_groups.php index 69b6bf39..388e2c68 100644 --- a/includes/pages/admin_groups.php +++ b/includes/pages/admin_groups.php @@ -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']; diff --git a/includes/pages/admin_questions.php b/includes/pages/admin_questions.php index f67c6ce8..8e7507da 100644 --- a/includes/pages/admin_questions.php +++ b/includes/pages/admin_questions.php @@ -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']); diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php index 155fd7b3..d34d4386 100644 --- a/includes/pages/admin_rooms.php +++ b/includes/pages/admin_rooms.php @@ -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) { diff --git a/includes/pages/guest_stats.php b/includes/pages/guest_stats.php index aec2d7d4..71fde137 100644 --- a/includes/pages/guest_stats.php +++ b/includes/pages/guest_stats.php @@ -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']; diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index b6a3c9f5..52167f14 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -660,9 +660,9 @@ function view_user_shifts() { $style = " text-decoration: line-through;"; } if (in_array('user_shifts_admin', $privileges)) { - $entry_list[] = "" . User_Nick_render($entry) . ' ' . table_buttons(array( + $entry_list[] = "" . User_Nick_render($entry) . ' ' . table_buttons([ button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], glyph('trash'), 'btn-xs') - )) . ''; + ]) . ''; } else { $entry_list[] = "" . User_Nick_render($entry) . ""; } @@ -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); } diff --git a/includes/sys_menu.php b/includes/sys_menu.php index 42376019..112c490f 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -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') . '&action=next', 'time', User_shift_state_render($user)); diff --git a/includes/sys_template.php b/includes/sys_template.php index 43ca66f2..829d45bc 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -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 ''; } @@ -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 = ""; foreach ($names as $title) { $html .= ""; @@ -399,11 +399,11 @@ function button_glyph($href, $glyph, $class = "") { /** * Rendert eine Toolbar mit Knöpfen */ -function buttons($buttons = array ()) { +function buttons($buttons = []) { return '
' . table_buttons($buttons) . '
'; } -function table_buttons($buttons = array()) { +function table_buttons($buttons = []) { return '
' . join(' ', $buttons) . '
'; } diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index 65abe0f3..7e8663a1 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -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) { diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 5c258fc7..3e365ea2 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -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' => '' . _('Sum') . '', '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' => '' . count($users) . '' - ); + ]; return page_with_title(_('All users'), [ msg(), -- cgit v1.2.3-54-g00ecf
$title