";
diff --git a/pinc/theme.inc b/pinc/theme.inc
index 5d48358ef..c647dfbee 100644
--- a/pinc/theme.inc
+++ b/pinc/theme.inc
@@ -46,7 +46,7 @@ function output_header(string $nameofpage, bool $show_statsbar = false, array $e
// * A 1% column with the rounded corner
// * A 74% width column for the main page content, and return.
echo "
\n";
@@ -63,10 +63,10 @@ function output_header(string $nameofpage, bool $show_statsbar = false, array $e
// Call output_footer when the main page content has been emitted so we can
// close the table and emit the footer.
- register_shutdown_function('output_footer', $nameofpage, $show_statsbar);
+ register_shutdown_function(output_footer(...), $show_statsbar);
}
-function output_footer(string $nameofpage, bool $show_statsbar = true): void
+function output_footer(bool $show_statsbar = true): void
{
global $code_url, $PAGE_START_TIME;
@@ -82,7 +82,7 @@ function output_footer(string $nameofpage, bool $show_statsbar = true): void
// * A 25% width column with the stats bar in it
echo "\n";
echo "
\n";
}
// Finally close the table, and emit the footer.
@@ -531,7 +531,7 @@ function headerbar_text_array(array $entries): string
return implode($divider, resolve_headerbar_entries($entries));
}
-function html_statsbar(string $nameofpage): void
+function html_statsbar(): void
{
global $code_url, $PG_home_url;
maybe_show_language_selector();
diff --git a/pinc/unicode.inc b/pinc/unicode.inc
index 42ede1ee0..cdc6a944b 100644
--- a/pinc/unicode.inc
+++ b/pinc/unicode.inc
@@ -492,7 +492,7 @@ function get_utf8_to_ascii_codepoints(): array
function get_disallowed_codepoints(): array
{
$invalid_codepoints = [];
- foreach (get_utf8_to_ascii_codepoints() as $ascii => $codepoints) {
+ foreach (get_utf8_to_ascii_codepoints() as $codepoints) {
$invalid_codepoints = array_merge($invalid_codepoints, $codepoints);
}
return $invalid_codepoints;
diff --git a/pinc/upload_file.inc b/pinc/upload_file.inc
index 0a893e6e9..ad36137ae 100644
--- a/pinc/upload_file.inc
+++ b/pinc/upload_file.inc
@@ -109,7 +109,7 @@ function show_upload_form(string $form_content, string $submit_label): void
", get_big_upload_blurb(), "
",
_("File to upload"), ":
",
- "
", sprintf(_("After you click the '%s' button, the browser will appear to be slow getting to the next page. This is because it is uploading the file."), $submit_label), "
",
+ "
", $submit_blurb, "
",
"
";
// if resumable, these are shown instead
diff --git a/pinc/user_project_info.inc b/pinc/user_project_info.inc
index f5e46fed2..9ceda2b40 100644
--- a/pinc/user_project_info.inc
+++ b/pinc/user_project_info.inc
@@ -157,8 +157,7 @@ function set_user_project_event_subscription(string $username, string $projectid
{
assert($bit === 0 || $bit === 1);
- $event_label = get_label_for_event($event);
- // Just to ensure that $event is valid; we don't use $event_label.
+ get_label_for_event($event); // Just to ensure that $event is valid
// Now that we're sure the row exists, we can update it.
$sql = sprintf(
@@ -176,13 +175,12 @@ function set_user_project_event_subscription(string $username, string $projectid
$bit,
$bit
);
- $res = DPDatabase::query($sql);
+ DPDatabase::query($sql);
}
function user_is_subscribed_to_project_event(string $username, string $projectid, string $event): bool
{
- $event_label = get_label_for_event($event);
- // Just to ensure that $event is valid; we don't use $event_label.
+ get_label_for_event($event); // Just to ensure that $event is valid
$sql = sprintf(
"
@@ -315,7 +313,7 @@ function notify_project_event_subscribers(Project $project, string $event, array
$n_subscribers,
DPDatabase::escape($projectid)
);
- $res4 = DPDatabase::query($sql4);
+ DPDatabase::query($sql4);
}
}
diff --git a/pinc/wordcheck_engine.inc b/pinc/wordcheck_engine.inc
index 40b1e029e..f74e193e3 100644
--- a/pinc/wordcheck_engine.inc
+++ b/pinc/wordcheck_engine.inc
@@ -394,7 +394,7 @@ function get_bad_words_via_external_checker($input_words_w_freq, $languages)
// Now merge all misspellings by language script together
$finalMisspellings = [];
- foreach ($misspellings as $lang_script => $words) {
+ foreach ($misspellings as $words) {
$finalMisspellings = array_merge($finalMisspellings, $words);
}
unset($misspellings);
@@ -469,7 +469,7 @@ function get_bad_words_with_diacritical_markup($input_words_w_freq): array
*/
function get_bad_words_via_pattern($input_words_w_freq, $languages)
{
- [$langcode3s, $messages] = get_langcode3s_for_languages($languages);
+ [$langcode3s, $_messages] = get_langcode3s_for_languages($languages);
$badWords = [];
@@ -816,9 +816,7 @@ function load_project_good_word_suggestions(string $projectid, int $start_time =
return $wordsArray;
}
- foreach ($eventArray as $event) {
- [$time, $round, $page, $proofer, $words] = $event;
-
+ foreach ($eventArray as [$_time, $round, $page, $_proofer, $words]) {
if (count($words)) {
if (!isset($wordsArray[$round][$page])) {
$wordsArray[$round][$page] = [];
@@ -836,7 +834,7 @@ function load_project_good_word_suggestions(string $projectid, int $start_time =
function load_site_good_words_given_project(string $projectid): array
{
$languages = get_project_languages($projectid);
- [$langcode3s, $messages] = get_langcode3s_for_languages($languages);
+ [$langcode3s, $_messages] = get_langcode3s_for_languages($languages);
return load_site_good_words($langcode3s);
}
@@ -844,7 +842,7 @@ function load_site_good_words_given_project(string $projectid): array
function load_site_bad_words_given_project(string $projectid): array
{
$languages = get_project_languages($projectid);
- [$langcode3s, $messages] = get_langcode3s_for_languages($languages);
+ [$langcode3s, $_messages] = get_langcode3s_for_languages($languages);
return load_site_bad_words($langcode3s);
}
@@ -852,7 +850,7 @@ function load_site_bad_words_given_project(string $projectid): array
function load_site_possible_bad_words_given_project(string $projectid): array
{
$languages = get_project_languages($projectid);
- [$langcode3s, $messages] = get_langcode3s_for_languages($languages);
+ [$langcode3s, $_messages] = get_langcode3s_for_languages($languages);
return load_site_possible_bad_words($langcode3s);
}
@@ -1274,7 +1272,6 @@ function get_all_words_in_text(string $text, bool $with_offsets = false)
if ($with_offsets) {
$result = [];
foreach ($matches[0] as [$word, $offset_bytes]) {
- $search_offset = 0;
// offsets from preg_match_all() are in bytes, but we need the
// offset in characters
$offset = UTF8::strlen(substr($text, 0, $offset_bytes));
diff --git a/project.php b/project.php
index f8cc36cab..7863c0834 100644
--- a/project.php
+++ b/project.php
@@ -596,7 +596,6 @@ function do_project_info_table(): void
if ($detail_level >= 4) {
// We'll call do_page_table later, so we don't need the "Page Detail" link.
} else {
- $detail = "";
if ($project->pages_table_exists) {
$url = "$code_url/tools/project_manager/page_detail.php?project=$projectid&show_image_size=0";
$blurb = html_safe(_("Images, Pages Proofread, & Differences"));
@@ -670,8 +669,6 @@ function do_project_info_table(): void
// --------
- $comments = $project->comments;
-
// insert e.g. templates and biographies
$comments = parse_project_comments($project);
@@ -1114,7 +1111,7 @@ function do_holds(): void
echo "\n";
$disabled = $project->can_be_managed_by_current_user ? '' : 'disabled';
- foreach (array_chunk(Project::get_holdable_states(), 2) as $set => $states) {
+ foreach (array_chunk(Project::get_holdable_states(), 2) as $states) {
[$round_id] = explode(".", $states[0]);
echo "
\n";
echo "
", $round_id, "
\n";
@@ -2020,15 +2017,10 @@ function do_change_state(): void
// This can leave an extra &, but I suspect browsers can handle it.
foreach ($valid_transitions as $transition) {
- // Used for disabling the button
- $optional_btn_attr = "";
-
// By default say who is allowed to do this transition.
$text_next_to_btn = " [$transition->who_restriction]";
if ($transition->is_disabled($project)) {
- $optional_btn_attr = "disabled";
-
// Gray out the original text and add an explanation why it is disabled
$reason = $transition->why_disabled($project);
$text_next_to_btn = "$text_next_to_btn [$reason]";
@@ -2055,7 +2047,6 @@ function do_change_state(): void
function do_page_summary(): void
{
global $project;
- $projectid = $project->projectid;
if (!$project->pages_table_exists) {
return;
diff --git a/quiz/generic/wizard/output.php b/quiz/generic/wizard/output.php
index b4e292239..7579dac10 100644
--- a/quiz/generic/wizard/output.php
+++ b/quiz/generic/wizard/output.php
@@ -128,7 +128,7 @@ function make_output(): string
}
$out .= "\n\n";
$out .= "// error checks\n\n";
- foreach ($_SESSION['quiz_data']['tests'] as $key => $test) {
+ foreach ($_SESSION['quiz_data']['tests'] as $test) {
$out .= '$tests[] = array("type" => "' . $test['type'] .'"';
if ($test['type'] == 'multioccurrence') {
$out .= ', "searchtext" => "' . ssqs(sdbsn($test['searchtext'])) .'", "case_sensitive" => ';
diff --git a/stats/includes/member.inc b/stats/includes/member.inc
index c752f91f5..5bc55c37e 100644
--- a/stats/includes/member.inc
+++ b/stats/includes/member.inc
@@ -506,7 +506,7 @@ function showMbrNeighbors(User $user, string $tally_name): void
$user,
max($user->u_neigh, 4)
);
- foreach ($neighbors as $rel_posn => $neighbor) {
+ foreach ($neighbors as $neighbor) {
$rank = $neighbor->current_page_tally_rank;
$pagescompleted = number_format($neighbor->current_page_tally);
diff --git a/stats/misc_stats1.php b/stats/misc_stats1.php
index 6f481f627..2f20a07ac 100644
--- a/stats/misc_stats1.php
+++ b/stats/misc_stats1.php
@@ -96,7 +96,6 @@ function show_top_days(int $limit, string $when): void
switch ($when) {
case 'ever':
- $where = '';
$sub_title = sprintf(_('Top %d Proofreading Days Ever'), $limit);
break;
diff --git a/tasks.php b/tasks.php
index c044da2c2..250b73658 100644
--- a/tasks.php
+++ b/tasks.php
@@ -1643,7 +1643,7 @@ function insert_related_task(int $task1, int $task2): void
$task_id_1,
$task_id_2
);
- $result = DPDatabase::query($sql);
+ DPDatabase::query($sql);
}
function remove_related_task(int $task1, int $task2): void
@@ -1661,7 +1661,7 @@ function remove_related_task(int $task1, int $task2): void
$task_id_1,
$task_id_2
);
- $result = DPDatabase::query($sql);
+ DPDatabase::query($sql);
}
function RelatedPostings(int $tid): void
diff --git a/tools/project_manager/add_files.php b/tools/project_manager/add_files.php
index f08890729..30226d828 100644
--- a/tools/project_manager/add_files.php
+++ b/tools/project_manager/add_files.php
@@ -274,7 +274,7 @@ public function analyze(): void
}
foreach (array_keys($db_entries) as $db_image_file) {
- [$base, $ext] = split_filename($db_image_file);
+ [$base, $_ext] = split_filename($db_image_file);
$page_related_bases[$base] = 1;
}
@@ -289,7 +289,7 @@ public function analyze(): void
$page_files = [];
$this->non_page_files = [];
foreach ($loadable_files as $loadable_file) {
- [$base, $ext] = split_filename($loadable_file);
+ [$base, $_ext] = split_filename($loadable_file);
if (array_key_exists($base, $page_related_bases)) {
$page_files[] = $loadable_file;
} else {
@@ -536,7 +536,7 @@ public function _check_file(string $filename): string
$ALLOWED_EXTENSIONS = ['.txt', '.png', '.jpg'];
- [$base, $ext] = split_filename($filename);
+ [$_base, $ext] = split_filename($filename);
if (!in_array($ext, $ALLOWED_EXTENSIONS)) {
return _('filename has unrecognized suffix');
}
diff --git a/tools/project_manager/bad_bytes_explainer.php b/tools/project_manager/bad_bytes_explainer.php
index b6193d502..7efa0d362 100644
--- a/tools/project_manager/bad_bytes_explainer.php
+++ b/tools/project_manager/bad_bytes_explainer.php
@@ -159,8 +159,7 @@ function show_a_table_of_bads(string $desired_badness): void
";
global $_bad_byte_sequences;
- foreach ($_bad_byte_sequences as $raw => $remarks) {
- [$code_point, $why_bad] = $remarks;
+ foreach ($_bad_byte_sequences as $raw => [$_code_point, $why_bad]) {
if (str_starts_with($desired_badness, '/')) {
$matches = preg_match($desired_badness, $why_bad);
} else {
diff --git a/tools/project_manager/diff.php b/tools/project_manager/diff.php
index db2c60216..59e50b9db 100644
--- a/tools/project_manager/diff.php
+++ b/tools/project_manager/diff.php
@@ -335,7 +335,6 @@ function can_see_names_for_page(string $projectid, string $image): bool
function can_navigate_by_proofer(string $projectid, string $L_user): bool
{
global $pguser;
- $answer = false;
// If user isn't logged in, they definitely can't
if ($pguser == '') {
return false;
diff --git a/tools/project_manager/editproject.php b/tools/project_manager/editproject.php
index 4e6e8007c..6bb4283fd 100644
--- a/tools/project_manager/editproject.php
+++ b/tools/project_manager/editproject.php
@@ -480,7 +480,6 @@ public function show_visible_controls(): void
$can_set_difficulty_tofrom_beginner = ($pguser == "BEGIN") || user_is_a_sitemanager();
$can_edit_PPer = true;
- $is_checked_out = false;
if (!empty($this->project->projectid)) {
$this->row(_("Project ID"), html_safe($this->project->projectid));
@@ -490,12 +489,10 @@ public function show_visible_controls(): void
} elseif ($this->project->state == PROJ_POST_FIRST_CHECKED_OUT) {
// once the project is in PP, PPer can only be changed by an SA, PF,
// or if it's checked out to the PM
- $is_checked_out = true;
$can_edit_PPer = (($this->project->username == $this->project->checkedoutby) ||
user_is_a_sitemanager() ||
user_is_proj_facilitator());
} elseif ($this->project->state == PROJ_POST_SECOND_CHECKED_OUT) {
- $is_checked_out = true;
$can_edit_PPer = user_is_a_sitemanager();
}
}
diff --git a/tools/project_manager/handle_bad_page.php b/tools/project_manager/handle_bad_page.php
index 9f39146d5..ff935bf8a 100644
--- a/tools/project_manager/handle_bad_page.php
+++ b/tools/project_manager/handle_bad_page.php
@@ -305,7 +305,6 @@ function update_image(string $projectid, string $image): void
global $projects_dir;
$org_image_ext = substr($image, -4);
- $org_image_basename = basename($image, $org_image_ext);
$tmp_image_ext = substr($_FILES['image_upload']['name'], -4);
if ($tmp_image_ext == ".png" || $tmp_image_ext == ".jpg") {
diff --git a/tools/project_manager/show_current_flagged_words.php b/tools/project_manager/show_current_flagged_words.php
index 4054498d2..2a692f1bf 100644
--- a/tools/project_manager/show_current_flagged_words.php
+++ b/tools/project_manager/show_current_flagged_words.php
@@ -139,14 +139,12 @@
/** @return list{array, string[]} */
function _get_current_flagged_word_list(string $projectid): array
{
- $messages = [];
-
// get the latest project text of all pages up to last possible round
$pages_res = page_info_query($projectid, Rounds::get_last()->id, 'LE');
$page_texts = get_page_texts($pages_res);
// now run it through WordCheck
- [$bad_words_w_freq, $languages, $messages] =
+ [$bad_words_w_freq, $_languages, $messages] =
get_bad_word_freqs_for_project_text($page_texts, $projectid, get_project_languages($projectid));
// multisort screws up all-numeric words so we need to preprocess first
diff --git a/tools/project_manager/show_good_word_suggestions.php b/tools/project_manager/show_good_word_suggestions.php
index 0acdead66..f9912f8d6 100644
--- a/tools/project_manager/show_good_word_suggestions.php
+++ b/tools/project_manager/show_good_word_suggestions.php
@@ -277,7 +277,7 @@ function _get_suggestions_word_list(string $projectid, int $timeCutoff): array
// it is in the format: $suggestions[$round][$pagenum]=$wordsArray
foreach ($suggestions as $round => $pageArray) {
$round_suggestions = [];
- foreach ($pageArray as $page => $words) {
+ foreach ($pageArray as $words) {
// add the words to the per-round array
$round_suggestions = array_merge($round_suggestions, $words);
diff --git a/tools/project_manager/show_project_stealth_scannos.php b/tools/project_manager/show_project_stealth_scannos.php
index 44b0e0dac..2061658ce 100644
--- a/tools/project_manager/show_project_stealth_scannos.php
+++ b/tools/project_manager/show_project_stealth_scannos.php
@@ -178,8 +178,6 @@ function _get_stealth_scanno_word_list(string $projectid): array
$ocr_filename = "$temp_dir/{$projectid}_ocr.txt";
$latest_filename = "$temp_dir/{$projectid}_latest.txt";
- $messages = [];
-
// get the OCR text
// Note: If the code is changed to allow selecting of arbitrary round text
// instead of just the OCR round, edit_project_word_lists.php should
@@ -308,7 +306,7 @@ function _get_stealth_scanno_word_list(string $projectid): array
$text_to_check = implode(" ", $possible_scannos);
// run the list through WordCheck to see which it would flag
- [$possible_scannos_via_wordcheck, $languages, $messages] =
+ [$possible_scannos_via_wordcheck, $_languages, $messages] =
get_bad_word_freqs_for_project_text($text_to_check, $projectid, get_project_languages($projectid));
// load site words
diff --git a/tools/project_manager/word_freq_table.inc b/tools/project_manager/word_freq_table.inc
index d0ebd44d9..65c70fcb2 100644
--- a/tools/project_manager/word_freq_table.inc
+++ b/tools/project_manager/word_freq_table.inc
@@ -296,7 +296,7 @@ function _get_word_context_from_text(string $page_text, string $contextWord): ar
$lineNum = 1;
foreach ($lines as $line) {
$words = get_all_words_in_text($line, true);
- foreach ($words as $offset => $word) {
+ foreach ($words as $word) {
if ($word === $contextWord) {
$contexts[$lineNum] = $line;
}
diff --git a/tools/proofers/my_suggestions.php b/tools/proofers/my_suggestions.php
index 217462c3c..104e89e67 100644
--- a/tools/proofers/my_suggestions.php
+++ b/tools/proofers/my_suggestions.php
@@ -18,7 +18,7 @@
}
}
-$round_view_options = get_view_options($username);
+$round_view_options = get_view_options();
// Get changes to the round views. If not set, we
// pull the last selected option from UserSettings.
@@ -84,7 +84,7 @@
echo "
$explain_why
";
}
- output_suggestion_table($projects, $colspecs, $username);
+ output_suggestion_table($projects, $colspecs);
}
if ($verbose) {
@@ -162,7 +162,7 @@ function get_table_column_specs(): array
// to make sure that some projects are displayed, iterate over the view order
/** @return array */
-function get_view_options(string $username): array
+function get_view_options(): array
{
return [
"impact" => [
@@ -213,19 +213,15 @@ function show_page_menu(array $all_view_modes, string $round_view, string $usern
}
/** @param array $colspecs */
-function show_headings(array $colspecs, string $username): void
+function show_headings(array $colspecs): void
{
echo "
\n";
- foreach ($colspecs as $col_id => $colspec) {
+ foreach ($colspecs as $colspec) {
$class = '';
if (isset($colspec['class'])) {
$class = sprintf("class='%s'", $colspec['class']);
}
echo "