/** * Exposes the authentication functions * * @return void */ function ws_pack_auth_expose_functions() { elgg_ws_expose_function("auth.get_api_keys", "ws_pack_auth_get_api_keys", array("application_id" => array("type" => "string", "required" => true), "title" => array("type" => "string", "required" => true), "description" => array("type" => "string", "required" => false, "default" => ""), "icon_url" => array("type" => "string", "required" => false, "default" => ""), "application_info" => array("type" => "array", "required" => false, "default" => array())), elgg_echo("ws_pack:api:auth:get_api_keys"), "GET", false, false); // reregister login function to allow login by email elgg_ws_unexpose_function("auth.gettoken"); elgg_ws_expose_function("auth.gettoken", "ws_pack_auth_gettoken", array("username" => array("type" => "string"), "password" => array("type" => "string")), elgg_echo("auth.gettoken"), "POST", false, false); }
/** * Initialize the plugin */ function customizations_init() { elgg_extend_view('css/elgg', 'customizations/css'); if (function_exists("elgg_ws_unexpose_function")) { elgg_ws_unexpose_function('auth.gettoken'); } // filter certain items from going to the river elgg_register_plugin_hook_handler('creating', 'river', 'customizations_filter_river'); elgg_register_event_handler('delete', 'user', 'customizations_purge_messages'); // convert messageboard to private message interface elgg_register_widget_type('messageboard', elgg_echo("customizations:widget:pm"), elgg_echo("customizations:widget:pm:desc"), array("profile")); elgg_register_plugin_hook_handler('forward', 'system', 'customizations_pm_forward'); // do not want the pages link in hover menu elgg_unextend_view('profile/menu/links', 'pages/menu'); // button for flushing apc cache elgg_register_plugin_hook_handler('register', 'menu:admin_control_panel', 'customizations_control_panel'); // shut googlebot out from search elgg_register_plugin_hook_handler('route', 'search', 'customizations_stop_googlebot'); $action_path = elgg_get_plugins_path() . "community_customizations/actions"; elgg_register_action('comments/edit', "{$action_path}/edit_comment.php", 'admin'); elgg_register_action('admin/flush_apc', "{$action_path}/admin/flush_apc.php", 'admin'); elgg_register_action('comments/disable', "{$action_path}/comments_disable.php", 'admin'); }
forward('http://learn.elgg.org/en/latest/intro/install.html#requirements'); }); elgg_register_page_handler('external.php', function () { http_response_code(301); forward('/plugins'); }); elgg_register_page_handler('license.php', function () { http_response_code(301); forward('http://learn.elgg.org/en/latest/intro/license.html'); }); // TODO(ewinslow): Patch core to make this css registration boilerplate unnecessary elgg_register_css('widgets/messageboard/content', elgg_get_simplecache_url('widgets/messageboard/content.css')); elgg_register_css('cke', elgg_get_simplecache_url('cke.css')); elgg_load_css('cke'); if (function_exists("elgg_ws_unexpose_function")) { elgg_ws_unexpose_function('auth.gettoken'); } // Support for syntax-highlighting elgg_extend_view('elgg.css', 'pre.css'); elgg_extend_view('elgg/wysiwyg.css', 'pre.css'); // Allows elements like <code class="language-php">...</code> // These are generated by the ckeditor "codesnippet" plugin // NB: Won't have any effect until https://github.com/Elgg/Elgg/pull/8805 lands. elgg_register_plugin_hook_handler('spec', 'htmlawed', function ($hook, $type, $result, $params) { return "{$result};code=class(oneof=language-php|language-css|language-javascript)"; }); // Load the JS and CSS to get syntax highlighting for rendered HTML elgg_require_js('hljs-init'); // filter new friendships and new bookmarks from river elgg_register_plugin_hook_handler('creating', 'river', function ($hook, $type, $item) { $view = $item['view'];
/** * Unregister a web services method * * @param string $method The api name that was exposed * @return void * @deprecated 1.9 Enable the web services plugin and use elgg_ws_unexpose_function(). */ function unexpose_function($method) { elgg_deprecated_notice("unexpose_function() deprecated for the function elgg_ws_unexpose_function() in web_services plugin", 1.9); if (function_exists("elgg_ws_unexpose_function")) { return elgg_ws_unexpose_function($method); } }
public function testUnexposeFunction() { global $API_METHODS; $this->registerFunction(); elgg_ws_unexpose_function('test'); $this->assertIdentical(array(), $API_METHODS); }