87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
|
|
class APIgoatDoc extends APIgoatTemplate
|
|
{
|
|
|
|
static function getExamples(array $data, array $headers)
|
|
{
|
|
$content = '';
|
|
$menu = '';
|
|
|
|
foreach ($data as $row) {
|
|
if (!empty($row['name'])) {
|
|
$menu .= li(href($row['name'], '#' . $row['name']), "class='page_item wd-state-closed'");
|
|
$content .= div(
|
|
anchor($row['name'])
|
|
. h2($row['name'], "class='entry-title'")
|
|
. p(trim($row['text']))
|
|
. ((!empty($row['json'])) ? div(span("Example:") . $row['json']) : ''),
|
|
"",
|
|
"class='doc-item'"
|
|
);
|
|
}
|
|
}
|
|
|
|
foreach ($headers as $name => $header) {
|
|
$menu = h3($header) . $menu;
|
|
}
|
|
|
|
|
|
return div(
|
|
div(
|
|
ul($menu, "class='doc-nav-list'"),
|
|
'',
|
|
"class='wedocs-sidebar wedocs-hide-mobile'"
|
|
) . div(
|
|
$content,
|
|
'',
|
|
"class='wedocs-single-content'"
|
|
),
|
|
'',
|
|
"class='wedocs-single-wrap'"
|
|
);
|
|
}
|
|
|
|
static function getDocs(array $data, array $headers)
|
|
{
|
|
$content = '';
|
|
$menu = '';
|
|
|
|
foreach ($data as $row) {
|
|
if (!empty($row['name'])) {
|
|
$menu .= li(href($row['name'], '#' . $row['title']), "class='page_item wd-state-closed'");
|
|
$content .= div(
|
|
anchor($row['title'])
|
|
. h2($row['title'], "class='entry-title'")
|
|
. h3($row['name'])
|
|
. h4($row['group'])
|
|
. span($row['type'] . " " . $row['value'])
|
|
. p(trim($row['text']))
|
|
. ((!empty($row['example'])) ? div(span("Example:") . pre(htmlentities($row['example']))) : ''),
|
|
"",
|
|
"class='doc-item'"
|
|
);
|
|
}
|
|
}
|
|
|
|
foreach ($headers as $name => $header) {
|
|
$menu = h3($header) . $menu;
|
|
}
|
|
|
|
|
|
return div(
|
|
div(
|
|
ul($menu, "class='doc-nav-list'"),
|
|
'',
|
|
"class='wedocs-sidebar wedocs-hide-mobile'"
|
|
) . div(
|
|
$content,
|
|
'',
|
|
"class='wedocs-single-content'"
|
|
),
|
|
'',
|
|
"class='wedocs-single-wrap'"
|
|
);
|
|
}
|
|
}
|