Example #1
0
function ws_init()
{
    $lib_dir = __DIR__ . "/lib";
    elgg_register_library('elgg:ws', "{$lib_dir}/web_services.php");
    elgg_register_library('elgg:ws:api_user', "{$lib_dir}/api_user.php");
    elgg_register_library('elgg:ws:client', "{$lib_dir}/client.php");
    elgg_register_library('elgg:ws:tokens', "{$lib_dir}/tokens.php");
    elgg_register_library('elgg:ws:core', "{$lib_dir}/core.php");
    elgg_register_library('elgg:ws:user', "{$lib_dir}/user.php");
    elgg_register_library('elgg:ws:message', "{$lib_dir}/message.php");
    elgg_register_library('elgg:ws:likes', "{$lib_dir}/likes.php");
    elgg_register_library('elgg:ws:wire', "{$lib_dir}/wire.php");
    elgg_register_library('elgg:ws:image', "{$lib_dir}/image.php");
    elgg_register_library('elgg:ws:gcm_register', "{$lib_dir}/gcm_register.php");
    elgg_register_library('elgg:ws:file', "{$lib_dir}/file.php");
    elgg_register_library('elgg:ws:site', "{$lib_dir}/site.php");
    elgg_register_library('elgg:ws:auth', "{$lib_dir}/auth.php");
    elgg_register_library('elgg:ws:blog', "{$lib_dir}/blog.php");
    elgg_register_library('elgg:ws:album', "{$lib_dir}/album.php");
    elgg_register_library('elgg:ws:bookmark', "{$lib_dir}/bookmark.php");
    elgg_register_library('elgg:ws:group', "{$lib_dir}/group.php");
    elgg_register_library('elgg:ws:activity', "{$lib_dir}/activity.php");
    elgg_load_library('elgg:ws:api_user');
    elgg_load_library('elgg:ws:tokens');
    elgg_load_library('elgg:ws:core');
    elgg_load_library('elgg:ws:user');
    elgg_load_library('elgg:ws:message');
    elgg_load_library('elgg:ws:likes');
    elgg_load_library('elgg:ws:wire');
    elgg_load_library('elgg:ws:image');
    elgg_load_library('elgg:ws:gcm_register');
    elgg_load_library('elgg:ws:file');
    elgg_load_library('elgg:ws:site');
    elgg_load_library('elgg:ws:auth');
    elgg_load_library('elgg:ws:blog');
    elgg_load_library('elgg:ws:album');
    elgg_load_library('elgg:ws:bookmark');
    elgg_load_library('elgg:ws:group');
    elgg_load_library('elgg:ws:activity');
    elgg_register_page_handler('services', 'ws_page_handler');
    // Register a service handler for the default web services
    // The name rest is a misnomer as they are not RESTful
    elgg_ws_register_service_handler('rest', 'ws_rest_handler');
    // expose the list of api methods
    elgg_ws_expose_function("system.api.list", "list_all_apis", null, elgg_echo("system.api.list"), "GET", false, false);
    // The authentication token api
    elgg_ws_expose_function("auth.gettoken", "auth_gettoken", array('username' => array('type' => 'string'), 'password' => array('type' => 'string')), elgg_echo('auth.gettoken'), 'POST', false, false);
    elgg_register_plugin_hook_handler('unit_test', 'system', 'ws_unit_test');
    elgg_register_plugin_hook_handler('send', 'notification:site', 'mobile_notifications_send');
    elgg_register_plugin_hook_handler('rest:output', 'system.api.list', 'ws_system_api_list_hook');
}
Example #2
0
function ws_init()
{
    $lib_dir = elgg_get_plugins_path() . "web_services/lib";
    elgg_register_library('elgg:ws', "{$lib_dir}/web_services.php");
    elgg_register_library('elgg:ws:api_user', "{$lib_dir}/api_user.php");
    elgg_register_library('elgg:ws:client', "{$lib_dir}/client.php");
    elgg_register_library('elgg:ws:tokens', "{$lib_dir}/tokens.php");
    elgg_load_library('elgg:ws:api_user');
    elgg_load_library('elgg:ws:tokens');
    elgg_register_page_handler('services', 'ws_page_handler');
    // Register a service handler for the default web services
    // The name rest is a misnomer as they are not RESTful
    elgg_ws_register_service_handler('rest', 'ws_rest_handler');
    // expose the list of api methods
    elgg_ws_expose_function("system.api.list", "list_all_apis", null, elgg_echo("system.api.list"), "GET", false, false);
    // The authentication token api
    elgg_ws_expose_function("auth.gettoken", "auth_gettoken", array('username' => array('type' => 'string'), 'password' => array('type' => 'string')), elgg_echo('auth.gettoken'), 'POST', false, false);
    elgg_register_plugin_hook_handler('unit_test', 'system', 'ws_unit_test');
}
Example #3
0
/**
 * Registers a web services handler
 *
 * @param string $handler  Web services type
 * @param string $function Your function name
 * @return bool Depending on success
 * @deprecated 1.9 Enable the web services plugin and use elgg_ws_register_service_handler().
 */
function register_service_handler($handler, $function)
{
    elgg_deprecated_notice("register_service_handler() deprecated for the function elgg_ws_register_service_handler() in web_services plugin", 1.9);
    if (function_exists("elgg_ws_register_service_handler")) {
        return elgg_ws_register_service_handler($handler, $function);
    }
}