mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 21:42:19 +03:00
a25193cc5d
This is lint reported by the new lint-checking functionality in beautify.py. (We can change to a different lint checker if we have a better one, but it would probably still flag these same problems.) Lint checking can help a lot, but only if we get the lint under control.
113 lines
1.9 KiB
PHP
113 lines
1.9 KiB
PHP
<?php
|
|
|
|
function show_header($title)
|
|
{
|
|
echo "
|
|
<html>
|
|
<head>
|
|
<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;charset=utf-8\">
|
|
<title>$title</title>
|
|
</head><body>";
|
|
}
|
|
|
|
function show_heading($text, $size = 1)
|
|
{
|
|
echo "
|
|
<h$size>$text</h$size>";
|
|
}
|
|
|
|
function show_footer()
|
|
{
|
|
echo "
|
|
</body>
|
|
<html>";
|
|
}
|
|
|
|
function end_table()
|
|
{
|
|
echo "
|
|
</table>";
|
|
}
|
|
|
|
function array_to_table_row($odd = true, $data)
|
|
{
|
|
$bgcolor = $odd ? " bgcolor=\"#ccccdd\"" : "";
|
|
echo "
|
|
<tr$bgcolor>";
|
|
foreach ($data as &$item) {
|
|
echo "
|
|
<td style=\"padding-left:8px; padding-right:8px\">$item</td>";
|
|
}
|
|
echo "
|
|
</tr>";
|
|
}
|
|
|
|
function start_table()
|
|
{
|
|
echo '
|
|
<table rules="cols" frame="vsides">';
|
|
}
|
|
|
|
function start_form($action, $method = "get")
|
|
{
|
|
echo "
|
|
<form action=\"$action\" method=\"$method\">";
|
|
}
|
|
|
|
function end_form()
|
|
{
|
|
echo "
|
|
</form>";
|
|
}
|
|
|
|
function show_select_box($items, $name, $selected = "", $onchange_hdl = "")
|
|
{
|
|
$onchange = $onchange_hdl ? " onchange=\"$onchange_hdl\"" : "";
|
|
echo "
|
|
<select name=\"$name\"$onchange>";
|
|
foreach ($items as &$item) {
|
|
$item_selected = $selected == $item ? " selected=\"yes\"" : "";
|
|
echo "
|
|
<option value=\"$item\"$item_selected>$item</option>";
|
|
}
|
|
echo "
|
|
</select>";
|
|
}
|
|
|
|
function get_href($label, $url, $new_window = false)
|
|
{
|
|
$target = $new_window ? " target=\"_blank\"" : "";
|
|
return "<a href=\"$url\"$target>$label</a>";
|
|
}
|
|
|
|
function warn($msg)
|
|
{
|
|
echo "<p><font color=\"red\"><b>$msg</b></font>";
|
|
}
|
|
|
|
function get_current_url()
|
|
{
|
|
return $_SERVER["REQUEST_URI"];
|
|
}
|
|
|
|
function set_var($url, $var, $value)
|
|
{
|
|
$url = cut_var($url, $var);
|
|
if ($url[strlen($url) - 1] == "?") {
|
|
$url .= "$var=$value";
|
|
} elseif (strpos($url, "?") !== false) {
|
|
$url .= "&$var=$value";
|
|
} else {
|
|
$url .= "?$var=$value";
|
|
}
|
|
return $url;
|
|
}
|
|
|
|
function cut_var($url, $var)
|
|
{
|
|
// XXX there is probably a cleaner solution for this
|
|
return preg_replace('/&?' . $var . '=[^&]+/', '', $url);
|
|
}
|
|
|
|
?>
|