diff options
Diffstat (limited to 'engine/lib/web_services.php')
| -rw-r--r-- | engine/lib/web_services.php | 35 | 
1 files changed, 23 insertions, 12 deletions
diff --git a/engine/lib/web_services.php b/engine/lib/web_services.php index 39fb0dc44..c8e4a13cc 100644 --- a/engine/lib/web_services.php +++ b/engine/lib/web_services.php @@ -1195,6 +1195,8 @@ $ERRORS = array();   *   * @return void   * @access private + *  + * @throws Exception   */  function _php_api_error_handler($errno, $errmsg, $filename, $linenum, $vars) {  	global $ERRORS; @@ -1300,6 +1302,7 @@ function service_handler($handler, $request) {   */  function register_service_handler($handler, $function) {  	global $CONFIG; +  	if (!isset($CONFIG->servicehandler)) {  		$CONFIG->servicehandler = array();  	} @@ -1318,11 +1321,13 @@ function register_service_handler($handler, $function) {   *   * @param string $handler web services type   * - * @return 1.7.0 + * @return void + * @since 1.7.0   */  function unregister_service_handler($handler) {  	global $CONFIG; -	if (isset($CONFIG->servicehandler) && isset($CONFIG->servicehandler[$handler])) { + +	if (isset($CONFIG->servicehandler, $CONFIG->servicehandler[$handler])) {  		unset($CONFIG->servicehandler[$handler]);  	}  } @@ -1332,6 +1337,8 @@ function unregister_service_handler($handler) {   *   * @return void   * @access private + * + * @throws SecurityException|APIException   */  function rest_handler() {  	global $CONFIG; @@ -1386,7 +1393,7 @@ function rest_handler() {  /**   * Unit tests for API   * - * @param sting  $hook   unit_test + * @param string  $hook   unit_test   * @param string $type   system   * @param mixed  $value  Array of tests   * @param mixed  $params Params @@ -1396,6 +1403,7 @@ function rest_handler() {   */  function api_unit_test($hook, $type, $value, $params) {  	global $CONFIG; +  	$value[] = $CONFIG->path . 'engine/tests/services/api.php';  	return $value;  } @@ -1417,15 +1425,18 @@ function api_init() {  	elgg_echo("system.api.list"), "GET", false, false);  	// The authentication token api -	expose_function("auth.gettoken", -					"auth_gettoken", array( -											'username' => array ('type' => 'string'), -											'password' => array ('type' => 'string'), -											), -					elgg_echo('auth.gettoken'), -					'POST', -					false, -					false); +	expose_function( +		"auth.gettoken", +		"auth_gettoken", +		array( +			'username' => array ('type' => 'string'), +			'password' => array ('type' => 'string'), +		), +		elgg_echo('auth.gettoken'), +		'POST', +		false, +		false +	);  }  | 
