mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
Fix: Remove unused functions (#585)
This commit is contained in:
@@ -161,20 +161,6 @@ function getContent(): string {
|
||||
return $news;
|
||||
}
|
||||
|
||||
function updateArchiveXML(string $id, string $archiveFile): void {
|
||||
$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',
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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
|
||||
{
|
||||
@@ -204,20 +191,6 @@ function download_link($file, $title): void
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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)) {
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
<?php
|
||||
|
||||
function search_results($res, $q, $profile = 'all', $per_page = 10, $s = 0, $l = 'en', $show_title = true, $show_foot = true, $show_attrib = true): void {
|
||||
$start_result = $s;
|
||||
$end_result = $s + $res['ResultSet']['totalResultsReturned'] - 1;
|
||||
|
||||
$results_count = ($res['ResultSet']['totalResultsAvailable'] < 100 ? $res['ResultSet']['totalResultsAvailable'] : 'more than 100');
|
||||
|
||||
$disp_start_result = $start_result + 1;
|
||||
$disp_end_result = $end_result + 1;
|
||||
if($show_title) echo "<h2>Showing results $disp_start_result to $disp_end_result of $results_count</h2>\n";
|
||||
echo '<ul id="search-results">' . "\n";
|
||||
$pos = $res['ResultSet']['firstResultPosition'];
|
||||
|
||||
$php_img_dir = 'http://www.php.net/images';
|
||||
$types = [
|
||||
'pear' => '<img src="' . $php_img_dir . '/pear_item.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
|
||||
'pecl' => '<img src="' . $php_img_dir . '/pecl_item.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
|
||||
'pecl4win' => '<img src="' . $php_img_dir . '/pecl_item_win.gif" height="22" width="21" style="float:left; margin-left:-31px;"/>',
|
||||
'peclbugs' => '<img src="' . $php_img_dir . '/pecl_item_bug.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
|
||||
'pearbugs' => '<img src="' . $php_img_dir . '/pear_item_bug.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
|
||||
'talks' => '<img src="' . $php_img_dir . '/ele-icon.gif" height="20" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
'snaps' => '<img src="' . $php_img_dir . '/logos/php_xpstyle_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
'cvsweb' => '<img src="' . $php_img_dir . '/logos/php_script_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
'viewcvs' => '<img src="' . $php_img_dir . '/logos/php_script_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
'news' => '<img src="' . $php_img_dir . '/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
'php' => '<img src="' . $php_img_dir . '/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
'doc' => '<img src="' . $php_img_dir . '/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
'bugs' => '<img src="' . $php_img_dir . '/php_bug.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
'gtk' => '<img src="' . $php_img_dir . '/logos/php-gtk-white.gif" height="26" width="32" style="float:left; margin-left:-40px;"/>',
|
||||
];
|
||||
|
||||
foreach($res['ResultSet']['Result'] as $i => $hit) {
|
||||
$cnt = $pos + $i;
|
||||
|
||||
$d = date('j M Y', $hit['ModificationDate']);
|
||||
$cachelink = '';
|
||||
if (isset($hit['Cache'])) {
|
||||
$cachelink = " - <a href=\"{$hit['Cache']}\">Cached</a>";
|
||||
}
|
||||
|
||||
// rewrite mirrors urls (\w\w\d? or www, but not qa, doc, gtk and ~/user)
|
||||
$real_url = preg_replace('@^http://(?!doc|qa|gtk)\w{2,3}\.php\.net(?!/~)(.*)$@', '$1', $hit['Url']);
|
||||
$displayurl = preg_replace('@^http://(?:(?!doc|qa|php|gtk)\w{2,3}\.)?(.+[^/])/?$@', '$1', $hit['Url']);
|
||||
$type = substr($displayurl,0,strpos($displayurl,'.'));
|
||||
if($type == 'pecl' && strstr($displayurl,"/bugs/")) $type = "peclbugs";
|
||||
if($type == 'pear' && strstr($displayurl,"/bugs/")) $type = "pearbugs";
|
||||
if($type == 'smarty') continue;
|
||||
$display_title = str_replace(['PHP:', '&'], ['', '&'], $hit['Title']);
|
||||
|
||||
// Fall back to the PHP logo for unknown hits
|
||||
if (!isset($types[$type])) {
|
||||
$type = "php";
|
||||
}
|
||||
|
||||
// Fix &gt; double escaping
|
||||
$summary = str_replace('&', '&', $hit['Summary']);
|
||||
$summary = htmlspecialchars($summary, ENT_QUOTES, 'UTF-8');
|
||||
echo <<<EOB
|
||||
<li>
|
||||
<p class="result">{$types[$type]}<a href="{$real_url}">{$display_title}</a></p>
|
||||
<p class="summary">{$summary}</p>
|
||||
<p class="meta">{$displayurl} - {$d} {$cachelink}</p>
|
||||
</li>
|
||||
EOB;
|
||||
}
|
||||
echo "</ul>\n";
|
||||
if($show_attrib):
|
||||
echo <<<EOB
|
||||
<span style="margin-left: 3em; margin-top: 1em; float: right; font-family: Verdana, Tahoma, Helvetica, Arial;
|
||||
font-size: 11px; color:#555;">results by <img style="margin-bottom:4px;" src="/images/bing.png" align="center"/></span>
|
||||
EOB;
|
||||
endif;
|
||||
if($show_foot):
|
||||
echo <<<EOB
|
||||
<div id="results_nav"><h4>Results Page:</h4>
|
||||
<ul id="results_nav_list">
|
||||
EOB;
|
||||
$start = 0;
|
||||
for($z = 1; $z < 11; $z++) {
|
||||
if($start > $res['ResultSet']['totalResultsAvailable']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$class = '';
|
||||
if ($start == $start_result) {
|
||||
$class = 'current';
|
||||
}
|
||||
|
||||
printf('<li class="%s"><a href="/results.php?q=%s&start=%d&p=%s&l=%s">%d</a></li>', $class, urlencode($q), $start, $profile, urlencode($l), $z);
|
||||
$start += $per_page;
|
||||
}
|
||||
echo '</ul></div>';
|
||||
endif;
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user