Skip to content

Commit

Permalink
return documentation content, for better page rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
michield committed Nov 19, 2015
1 parent 57f28af commit 0d05538
Showing 1 changed file with 30 additions and 44 deletions.
74 changes: 30 additions & 44 deletions plugins/restapi/doc/doc.php
Expand Up @@ -16,100 +16,86 @@ public function addClass($classname)

public function output()
{
$this->header();
$output = $this->header();

foreach ($this->classes as $class) {
$reflect = new \ReflectionClass($class);
$methods = $reflect->getMethods();
foreach ($methods as $method) {
if (Common::method_allowed($reflect->getShortName(),$method->name)) {
echo '<section>';
echo '<div class="page-header">';
# echo '<h2>'.$reflect->getShortName().'</h2>';
echo '<h2>'.$method->name.'</h2>';
echo '</div>';
echo '<div class="row">';
echo '<div class="span12">';
$output .= '<section>';
$output .= '<div class="page-header">';
# $output .= '<h2>'.$reflect->getShortName().'</h2>';
$output .= '<h2>'.$method->name.'</h2>';
$output .= '</div>';
$output .= '<div class="row">';
$output .= '<div class="span12">';

$comment = $method->getDocComment();

$comment = str_replace('/**', '', $comment);
$comment = str_replace('*/', '', $comment);
$comment = str_replace('[*', '<span class="label label-warning">', $comment);
$comment = str_replace('[', '<span class="label label-success">', $comment);
$comment = str_replace('[*', '<span class="restapi-param param-required">', $comment);
$comment = str_replace('[', '<span class="restapi-param param-optional">', $comment);
$comment = str_replace(']', '</span>', $comment);
$comment = str_replace('{', '<span class="badge">', $comment);
$comment = str_replace('{', '<span class="restapi-datatype">', $comment);
$comment = str_replace('}', '</span>', $comment);
$comment = str_replace('*', '', $comment);
//$comment = str_replace( '<br><br>', '', $comment );

echo trim($comment);
$output .= trim($comment);

echo '</div>';
echo '</div>';
echo '<br/>';
echo '</section>';
$output .= '</div>';
$output .= '</div>';
$output .= '<br/>';
$output .= '</section>';
}
}
}

$this->footer();
$output .= $this->footer();

exit;
return $output;
}

public function header()
{
?>

<!DOCTYPE html>
<html>
<head>
<title>API Plugin to phpList</title>
<!-- Bootstrap -->
<link href="http://netdna.bootstrapcdn.com/bootswatch/2.1.1/cerulean/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="container">

<p>&nbsp;</p>
return '
<header class="jumbotron subhead" id="overview">
<div class="row">
<div class="span6">
<div class="xspan6">
<h1>API Plugin to phpList</h1>
<p class="lead">Documentation generated <?php echo date('Y-m-d H:i:s');
?></p>
<p class="lead">Documentation generated '. date('Y-m-d H:i:s').'
</p>
</div>
</div>
</header>
<div class="row">
<div class="span12">
<div class="xspan12">
<div class="well">
The following methods is called by Body Param [cmd] to the plugin URL via request method POST.
<p>
<span class="label label-warning">Required body parameter</span><br/>
<span class="label label-success">Optional body parameter</span><br/>
<span class="badge">Datatype</span><br/>
<span class="restapi-param param-required">Required body parameter</span><br/>
<span class="restapi-param param-optional">Optional body parameter</span><br/>
<span class="restapi-datatype">Datatype</span><br/>
</p>
</div>
</div>
</div>
<?php
';

}

public function footer()
{
?>
return '
<footer id="footer">
<p class="pull-right"><a href="#">Back to top</a></p>
</footer>
</div>
</body>
</html>
<?php
';

}
}

0 comments on commit 0d05538

Please sign in to comment.