Clean code slightly

This commit is contained in:
Tom Needham 2012-07-30 12:57:35 +00:00
parent b563dff10a
commit b0dc4383e1
1 changed files with 16 additions and 9 deletions

View File

@ -55,15 +55,7 @@ class OC_API {
public static function call($parameters){
// Get the routes
// TODO cache
foreach(OC_APP::getEnabledApps() as $app){
$file = OC_App::getAppPath($app).'/appinfo/routes.php';
if(file_exists($file)){
require_once($file);
}
}
// include core routes
require_once(OC::$SERVERROOT.'ocs/routes.php');
self::loadRoutes();
$name = $parameters['_name'];
$response = array();
@ -91,6 +83,21 @@ class OC_API {
}
}
/**
* loads the api routes
*/
private static function loadRoutes(){
// TODO cache
foreach(OC_APP::getEnabledApps() as $app){
$file = OC_App::getAppPath($app).'/appinfo/routes.php';
if(file_exists($file)){
require_once($file);
}
}
// include core routes
require_once(OC::$SERVERROOT.'ocs/routes.php');
}
/**
* respond to a call
* @param int|array $response the response