Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove unused functions #585

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions bin/createNewsEntry
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,6 @@ function getContent(): string {
return $news;
}

function updateArchiveXML(string $id, string $archiveFile): void {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running

git grep -i updateArchiveXML

on current master yields

bin/createNewsEntry:27:$entry->save()->updateArchiveXML();
bin/createNewsEntry:163:function updateArchiveXML(string $id, string $archiveFile): void {
bin/createReleaseEntry:49:$entry->save()->updateArchiveXML();
include/news_entry.inc:175:	public function updateArchiveXML(): self {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, apparently a relict of 7971068.

$arch = new DOMDocument("1.0", "utf-8");
$arch->formatOutput = true;
$arch->preserveWhiteSpace = false;
$arch->load($archiveFile);

$first = $arch->createElementNs("http://www.w3.org/2001/XInclude", "xi:include");
$first->setAttribute("href", "entries/{$id}.xml");

$second = $arch->getElementsByTagNameNs("http://www.w3.org/2001/XInclude", "include")->item(0);
$arch->documentElement->insertBefore($first, $second);
$arch->save($archiveFile);
}

function parseOptions(): Entry {
$opts = getopt('h', [
'help',
Expand Down
60 changes: 0 additions & 60 deletions include/layout.inc
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ function highlight_php_trimmed($code, $return = false)
return null;
}

// Stats pages still need this
function commonHeader($title): void { site_header($title); }

// Stats pages still need this
function commonFooter(): void { site_footer(); }

// Resize the image using the output of make_image()
function resize_image($img, $width = 1, $height = 1)
{
Expand Down Expand Up @@ -160,13 +154,6 @@ function make_popup_link($url, $linktext = false, $target = false, $windowprops
);
}

// print_popup_link()
// print a hyperlink to something, within the site, that pops up a new window
//
function print_popup_link($url, $linktext = false, $windowprops = "", $target = false, $extras = false): void {
echo make_popup_link($url, $linktext, $windowprops, $target, $extras);
}

// Print a link for a downloadable file (including filesize)
function download_link($file, $title): void
{
Expand Down Expand Up @@ -204,20 +191,6 @@ function download_link($file, $title): void
}
}

function sect_to_file($string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running

git grep -i sect_to_file

on current master yields

include/layout.inc:231:function sect_to_file($string) {

$string = strtolower($string);
$string = str_replace([' ', '_'], '-', $string);
$func = "function.$string.php";
$chap = "ref.$string.php";
$feat = "features.$string.php";
$struct = "control-structures.$string.php";
if (@is_file($func)) return $func;
if (@is_file($chap)) return $chap;
if (@is_file($feat)) return $feat;
if (@is_file($struct)) return $struct;
else return "$string.php";
}

function clean($var) {
return htmlspecialchars($var, ENT_QUOTES);
}
Expand Down Expand Up @@ -511,39 +484,6 @@ function get_news_changes()
return false;
}

function news_toc($sections = null): void {
include __DIR__ . "/pregen-news.inc";
$items = [
"news" => [
"title" => "News",
"link" => "/archive/",
"children" => print_news($NEWS_ENTRIES, "frontpage", 3, null, true),
],
"conferences" => [
"title" => "Conferences",
"link" => "/conferences/",
"children" => print_news($NEWS_ENTRIES, "conferences", 3, null, true),
],
"papers" => [
"title" => "Call for Papers",
"link" => "/conferences/",
"children" => print_news($NEWS_ENTRIES, "cfp", 3, null, true),
],
];

foreach ($items as $section => $menu) {

// only print requested sections.
if (is_array($sections) && !in_array($section, $sections, true)) {
continue;
}

echo "<dt><a href='{$menu["link"]}'>{$menu["title"]}</a></dt>\n";
foreach ($menu["children"] as $child) {
echo "<dd><a href='{$child["permlink"]}'>{$child["title"]}</a></dd>\n";
}
}
}
function doc_toc($lang): void {
$file = __DIR__ . "/../manual/$lang/toc/index.inc";
if (!file_exists($file)) {
Expand Down
95 changes: 0 additions & 95 deletions include/results.inc

This file was deleted.

9 changes: 0 additions & 9 deletions include/site.inc
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ function default_language($site = false)
return (isset($MIRRORS[$site]) ? $MIRRORS[$site][6] : false);
}

// Returns true if the current (or specified) mirror
// site is registered to have local search support
function have_search($site = false)
{
global $MIRRORS, $MYSITE;
if (!$site) { $site = $MYSITE; }
return (isset($MIRRORS[$site]) ? $MIRRORS[$site][5] : false);
}

// Returns the current (or specified)
// mirror site's provider's name
function mirror_provider($site = false)
Expand Down
1 change: 0 additions & 1 deletion quickref.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
$_SERVER['BASE_PAGE'] = 'quickref.php';
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/errors.inc';
include __DIR__ . '/include/results.inc';

if (empty($notfound)) {
mirror_redirect("/search.php");
Expand Down
1 change: 0 additions & 1 deletion results.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

$_SERVER['BASE_PAGE'] = 'results.php';
include __DIR__ . '/include/prepend.inc';
include __DIR__ . '/include/results.inc';

// HTTP status line is passed on, signifies an error
site_header(
Expand Down