Version 5.0.0 beta 5
This commit is contained in:
1 parent
2f24f9de48
commit
57d9db6ce2
218 files changed
+5331
-7416
No files matched your search
+21
-10
@@ -13,8 +13,10 @@ namespace IPS\Api;
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use DirectoryIterator;
|
||||
use ErrorException;
|
||||
use IPS\Application;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Log;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Settings;
|
||||
@@ -281,22 +283,31 @@ abstract class Controller
|
||||
{
|
||||
$controllerName = mb_substr( $file, 0, -4 );
|
||||
$class = 'IPS\\' . $app->directory . '\\api\\' . $controllerName;
|
||||
if( class_exists( $class ) )
|
||||
{
|
||||
$reflection = new ReflectionClass( $class );
|
||||
foreach ( $reflection->getMethods() as $method )
|
||||
{
|
||||
if ( $method->getName() != 'execute' and !$method->isStatic() and $method->isPublic() and mb_substr( $method->getName(), 0, 1 ) != '_' )
|
||||
{
|
||||
$details = static::decodeDocblock( $method->getDocComment() );
|
||||
|
||||
if ( ( $type !== 'client' or !isset( $details['details']['apimemberonly'] ) ) and ( $type !== 'member' or !isset( $details['details']['apiclientonly'] ) ) )
|
||||
try
|
||||
{
|
||||
if( class_exists( $class ) )
|
||||
{
|
||||
$reflection = new ReflectionClass( $class );
|
||||
foreach ( $reflection->getMethods() as $method )
|
||||
{
|
||||
if ( $method->getName() != 'execute' and !$method->isStatic() and $method->isPublic() and mb_substr( $method->getName(), 0, 1 ) != '_' )
|
||||
{
|
||||
$return[ $app->directory . '/' . $controllerName . '/' . $method->getName() ] = $details;
|
||||
$details = static::decodeDocblock( $method->getDocComment() );
|
||||
|
||||
if ( ( $type !== 'client' or !isset( $details['details']['apimemberonly'] ) ) and ( $type !== 'member' or !isset( $details['details']['apiclientonly'] ) ) )
|
||||
{
|
||||
$return[ $app->directory . '/' . $controllerName . '/' . $method->getName() ] = $details;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( ErrorException $e )
|
||||
{
|
||||
/* This can happen if we have legacy files floating around */
|
||||
Log::debug( "BAD_API_CLASS", 'api' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user