private static void Variables(HtmlTagWriter container) { container.EchoTag("h2", "PHP Variables"); using (var table = container.Tag("table")) { using (var tr = table.Tag("tr", new { @class = "h" })) { tr.EchoTag("th", "Variable"); tr.EchoTag("th", "Value"); } Action <string, string> Line = (name, value) => { using (var tr = table.Tag("tr", new { @class = "h" })) { tr.EchoTag("td", name, new { @class = "e" }); using (var td = tr.Tag("td", new { @class = "v" })) { if (string.IsNullOrEmpty(value)) { td.EchoRaw(" "); } else { td.EchoEscaped(value); } } } }; Action <PhpArray, string> DumpArray = (arr, name) => { foreach (var entry in arr.Keys) { Line($"{name}[{entry}]", arr[entry].ToStringOrNull()); } }; DumpArray(container.Context.Cookie, "_COOKIE"); DumpArray(container.Context.Server, "_SERVER"); } }
private static void Env(HtmlTagWriter container) { container.EchoTag("h2", "Environment"); using (var table = container.Tag("table")) { using (var tr = table.Tag("tr", new { @class = "h" })) { tr.EchoTag("th", "Variable"); tr.EchoTag("th", "Value"); } Action <string, string> Line = (name, value) => { using (var tr = table.Tag("tr", new { @class = "h" })) { tr.EchoTag("td", name, new { @class = "e" }); using (var td = tr.Tag("td", new { @class = "v" })) { if (string.IsNullOrEmpty(value)) { td.EchoRaw(" "); } else { td.EchoEscaped(value); } } } }; foreach (var entry in container.Context.Env.Keys) { Line(entry.ToString(), container.Context.Env[entry].ToStringOrNull()); } } }