Replace tabs by four spaces

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-01-17 03:17:26 +00:00
committed by WineHQ
parent 6bf83a0a3b
commit 17de2854e0

View File

@@ -4,69 +4,69 @@ $_indent_level = 0;
function do_indent($str, $v = 0) function do_indent($str, $v = 0)
{ {
global $_indent_level; global $_indent_level;
if($v < 0) if($v < 0)
$_indent_level += $v; $_indent_level += $v;
if($_indent_level > 0) if($_indent_level > 0)
$str = str_repeat(" ", $_indent_level) . $str; $str = str_repeat(" ", $_indent_level) . $str;
if($v > 0) if($v > 0)
$_indent_level += $v; $_indent_level += $v;
return $str . "\n"; return $str . "\n";
} }
function do_html_tr($t, $arr, $class, $extra) function do_html_tr($t, $arr, $class, $extra)
{ {
if(strlen($class)) if(strlen($class))
$class = " class=\"$class\""; $class = " class=\"$class\"";
/* $extra contains parameters to <tr>, such as valign="top" */ /* $extra contains parameters to <tr>, such as valign="top" */
if(strlen($extra)) if(strlen($extra))
$extra = " $extra"; $extra = " $extra";
$str = do_indent("<tr$class$extra>", 1); $str = do_indent("<tr$class$extra>", 1);
for($i = 0; $i < sizeof($arr); $i++) for($i = 0; $i < sizeof($arr); $i++)
{ {
/* If it is not an array, it contains the entire table cell. If it /* If it is not an array, it contains the entire table cell. If it
is an array, [0] holds the main content and [1] the options like is an array, [0] holds the main content and [1] the options like
valign="top" */ valign="top" */
if(is_array($arr[$i])) if(is_array($arr[$i]))
{ {
$val = $arr[$i][0]; $val = $arr[$i][0];
$extra = " ".$arr[$i][1]; $extra = " ".$arr[$i][1];
} }
else else
{ {
$val = $arr[$i]; $val = $arr[$i];
$extra = ""; $extra = "";
} }
if (! $val) if (! $val)
{ {
$val = "&nbsp;"; $val = "&nbsp;";
} }
if(stristr($val, "<$t")) if(stristr($val, "<$t"))
{ {
$str .= do_indent($val); $str .= do_indent($val);
} }
else else
{ {
$str .= do_indent("<$t$class$extra> ".trim($val)." </$t>", 0); $str .= do_indent("<$t$class$extra> ".trim($val)." </$t>", 0);
} }
} }
$str .= do_indent("</tr>", -1); $str .= do_indent("</tr>", -1);
return $str; return $str;
} }
// HTML TR // HTML TR
function html_tr($arr, $class = "", $extra = "") function html_tr($arr, $class = "", $extra = "")
{ {
return do_html_tr("td", $arr, $class, $extra); return do_html_tr("td", $arr, $class, $extra);
} }
function html_tr_highlight_clickable($sUrl, $sClass, $sHighlightColor, $sInactiveColor, function html_tr_highlight_clickable($sUrl, $sClass, $sHighlightColor, $sInactiveColor,
@@ -81,68 +81,68 @@ function html_tr_highlight_clickable($sUrl, $sClass, $sHighlightColor, $sInactiv
// HTML TABLE // HTML TABLE
function html_table_begin($extra = "") function html_table_begin($extra = "")
{ {
return do_indent("<table $extra>", 1); return do_indent("<table $extra>", 1);
} }
function html_table_end() function html_table_end()
{ {
return do_indent("</table>", -1); return do_indent("</table>", -1);
} }
// HTML HTML // HTML HTML
function html_begin() function html_begin()
{ {
return do_indent("<html>", 1); return do_indent("<html>", 1);
} }
function html_end() function html_end()
{ {
return do_indent("</html>", -1); return do_indent("</html>", -1);
} }
// HTML HEAD // HTML HEAD
function html_head($title, $stylesheet = 0) function html_head($title, $stylesheet = 0)
{ {
$str = do_indent("<head>", 1); $str = do_indent("<head>", 1);
$str .= do_indent("<title> $title </title>", 0); $str .= do_indent("<title> $title </title>", 0);
if($stylesheet) if($stylesheet)
$str .= do_indent("<link rel=\"stylesheet\" ". $str .= do_indent("<link rel=\"stylesheet\" ".
"href=\"$stylesheet\" type=\"text/css\">", 0); "href=\"$stylesheet\" type=\"text/css\">", 0);
$str .= do_indent("</head>", -1); $str .= do_indent("</head>", -1);
return $str; return $str;
} }
// HTML BODY // HTML BODY
function html_body_begin() function html_body_begin()
{ {
return do_indent("<body>", 1); return do_indent("<body>", 1);
} }
function html_body_end() function html_body_end()
{ {
return do_indent("</body>", -1); return do_indent("</body>", -1);
} }
// HTML A HREF // HTML A HREF
function html_ahref($label, $url, $extra = "") function html_ahref($label, $url, $extra = "")
{ {
$label = stripslashes($label); $label = stripslashes($label);
if (!$label and $url) if (!$label and $url)
{ {
return do_indent(" <a href=\"$url\" $extra>$url</a> "); return do_indent(" <a href=\"$url\" $extra>$url</a> ");
} }
else if (!$label) else if (!$label)
{ {
return do_indent(" &nbsp; "); return do_indent(" &nbsp; ");
} }
else else
{ {
return do_indent(" <a href=\"$url\" $extra>$label</a> "); return do_indent(" <a href=\"$url\" $extra>$label</a> ");
} }
} }
function html_imagebutton($text, $url, $extra = "") function html_imagebutton($text, $url, $extra = "")
@@ -226,16 +226,16 @@ function html_select($name, $values, $default = null, $descs = null)
{ {
$str = "<select name='$name'>\n"; $str = "<select name='$name'>\n";
while(list($idx, $value) = each($values)) while(list($idx, $value) = each($values))
{ {
$desc = $value; $desc = $value;
if($descs) if($descs)
$desc = $descs[$idx]; $desc = $descs[$idx];
if($value == $default) if($value == $default)
$str .= " <option selected value='$value'>$desc\n"; $str .= " <option selected value='$value'>$desc\n";
else else
$str .= " <option value='$value'>$desc\n"; $str .= " <option value='$value'>$desc\n";
} }
$str .= "</select>\n"; $str .= "</select>\n";
return $str; return $str;
@@ -253,13 +253,13 @@ function html_back_link($howmany = 1, $url = "")
function p() function p()
{ {
return "\n<p>&nbsp;</p>\n"; return "\n<p>&nbsp;</p>\n";
} }
function add_br($text = "") function add_br($text = "")
{ {
$text = ereg_replace("\n","<br>\n",$text); $text = ereg_replace("\n","<br>\n",$text);
return $text; return $text;
} }
function make_dll_option_list($varname, $dllid = -1) function make_dll_option_list($varname, $dllid = -1)
@@ -270,12 +270,12 @@ function make_dll_option_list($varname, $dllid = -1)
//echo "<option value='ALL'>ALL\n"; //echo "<option value='ALL'>ALL\n";
$list = $db->get_dll_names(); $list = $db->get_dll_names();
while(list($name, $id) = each($list)) while(list($name, $id) = each($list))
{ {
if($dllid == $id) if($dllid == $id)
echo "<option value=$id selected>$name ($id)\n"; echo "<option value=$id selected>$name ($id)\n";
else else
echo "<option value=$id>$name ($id)\n"; echo "<option value=$id>$name ($id)\n";
} }
echo "</select>\n"; echo "</select>\n";
} }