APIgoat_API_wordpress_plugin/classes/APIgoatDoc.php

46 lines
1.2 KiB
PHP
Raw Normal View History

2020-09-03 22:10:06 +00:00
<?php
class APIgoatDoc extends APIgoatTemplate
{
static function getDocs(array $data, array $headers)
{
$content = '';
$menu = '';
foreach ($data as $row) {
2020-11-02 00:14:51 +00:00
$menu .= li(href($row['name'], '#' . $row['title']), "class='page_item wd-state-closed'");
2020-09-03 22:10:06 +00:00
$content .= div(
2020-11-02 00:14:51 +00:00
anchor($row['title'])
2020-09-03 22:10:06 +00:00
. h2($row['title'], "class='entry-title'")
2020-11-02 00:14:51 +00:00
. h3($row['name'])
2020-10-27 00:06:31 +00:00
. span($row['type'] . " " . $row['value'])
2020-09-03 22:10:06 +00:00
. p(trim($row['text']))
2020-11-02 00:14:51 +00:00
. ((!empty($row['example'])) ? div(span("Example:") . pre(htmlentities($row['example']))) : ''),
"",
"class='doc-item'"
2020-09-03 22:10:06 +00:00
);
}
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'"
);
}
}