Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation generation started when accessing the API with GET, returning a doc page.
- Loading branch information
Andreas Ek
committed
Dec 29, 2012
1 parent
3d8cc4d
commit e209baf
Showing
5 changed files
with
157 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?php | ||
|
||
|
||
class PHPlist_API_Doc{ | ||
|
||
private $classes; | ||
|
||
function __construct() | ||
{ | ||
} | ||
|
||
function addClass( $classname ){ | ||
|
||
$this->classes[] = $classname; | ||
|
||
} | ||
|
||
function output(){ | ||
|
||
$this->header(); | ||
|
||
foreach( $this->classes as $class ){ | ||
|
||
$reflect = new ReflectionClass( $class ); | ||
$methods = $reflect->getMethods(); | ||
foreach( $methods as $method ){ | ||
|
||
echo '<section>'; | ||
echo '<div class="page-header">'; | ||
echo '<h2>' . $method->name . '</h2>'; | ||
echo '</div>'; | ||
echo '<div class="row">'; | ||
echo '<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>', $comment ); | ||
$comment = str_replace( '*', '', $comment ); | ||
//$comment = str_replace( '<br><br>', '', $comment ); | ||
|
||
echo trim($comment); | ||
|
||
echo '</div>'; | ||
echo '</div>'; | ||
echo '<br/>'; | ||
echo '<section>'; | ||
} | ||
|
||
} | ||
|
||
$this->footer(); | ||
|
||
exit; | ||
|
||
} | ||
|
||
|
||
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> </p> | ||
|
||
<header class="jumbotron subhead" id="overview"> | ||
<div class="row"> | ||
<div class="span6"> | ||
<h1>API Plugin to PHPlist</h1> | ||
<p class="lead">Documentation generated <?php echo date('Y-m-d H:i:s'); ?></p> | ||
</div> | ||
</div> | ||
</header> | ||
<div class="row"> | ||
<div class="span12"> | ||
<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/> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
<?php | ||
|
||
} | ||
|
||
function footer(){ | ||
|
||
?> | ||
<footer id="footer"> | ||
<p class="pull-right"><a href="#">Back to top</a></p> | ||
</footer> | ||
</div> | ||
</body> | ||
</html> | ||
|
||
<?php | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters