diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-10 22:22:40 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-10 22:22:40 +0000 |
commit | c8f6c3c934df01bf969e3d91ae67f0887de10da9 (patch) | |
tree | d21179fda1e19d540eb3ea56b31584f86fc1e338 /engine/lib | |
parent | a7801c71ecc6ce0f0d2a8fc82cdc779da9417aa4 (diff) | |
download | elgg-c8f6c3c934df01bf969e3d91ae67f0887de10da9.tar.gz elgg-c8f6c3c934df01bf969e3d91ae67f0887de10da9.tar.bz2 |
Fixes #2367: With fear and trepidation, converting events/plugin hooks to use elgg_ prefixed versions
git-svn-id: http://code.elgg.org/elgg/trunk@7284 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
32 files changed, 219 insertions, 169 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php index 3eddd97ac..7dbd7e876 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -137,7 +137,7 @@ function get_access_array($user_id = 0, $site_id = 0, $flush = false) { } $options = array('user_id' => $user_id, 'site_id' => $site_id); - return trigger_plugin_hook('access:collections:read', 'user', $options, $tmp_access_array); + return elgg_trigger_plugin_hook('access:collections:read', 'user', $options, $tmp_access_array); } /** @@ -404,7 +404,7 @@ function get_write_access_array($user_id = 0, $site_id = 0, $flush = false) { } $options = array('user_id' => $user_id, 'site_id' => $site_id); - $tmp_access_array = trigger_plugin_hook('access:collections:write', 'user', + $tmp_access_array = elgg_trigger_plugin_hook('access:collections:write', 'user', $options, $tmp_access_array); return $tmp_access_array; @@ -456,7 +456,7 @@ function create_access_collection($name, $owner_guid = 0, $site_guid = 0) { 'collection_id' => $id ); - if (!trigger_plugin_hook('access:collections:addcollection', 'collection', $params, true)) { + if (!elgg_trigger_plugin_hook('access:collections:addcollection', 'collection', $params, true)) { return false; } @@ -531,7 +531,7 @@ function delete_access_collection($collection_id) { $collections = get_write_access_array(null, null, TRUE); $params = array('collection_id' => $collection_id); - if (!trigger_plugin_hook('access:collections:deletecollection', 'collection', $params, true)) { + if (!elgg_trigger_plugin_hook('access:collections:deletecollection', 'collection', $params, true)) { return false; } @@ -601,7 +601,7 @@ function add_user_to_access_collection($user_guid, $collection_id) { 'user_guid' => $user_guid ); - if (!trigger_plugin_hook('access:collections:add_user', 'collection', $params, true)) { + if (!elgg_trigger_plugin_hook('access:collections:add_user', 'collection', $params, true)) { return false; } @@ -646,7 +646,7 @@ function remove_user_from_access_collection($user_guid, $collection_id) { 'user_guid' => $user_guid ); - if (!trigger_plugin_hook('access:collections:remove_user', 'collection', $params, true)) { + if (!elgg_trigger_plugin_hook('access:collections:remove_user', 'collection', $params, true)) { return false; } @@ -1033,8 +1033,8 @@ function elgg_override_permissions_hook() { } // This function will let us know when 'init' has finished -register_elgg_event_handler('init', 'system', 'access_init', 9999); +elgg_register_event_handler('init', 'system', 'access_init', 9999); // For overrided permissions -register_plugin_hook('permissions_check', 'all', 'elgg_override_permissions_hook'); -register_plugin_hook('container_permissions_check', 'all', 'elgg_override_permissions_hook');
\ No newline at end of file +elgg_register_plugin_hook_handler('permissions_check', 'all', 'elgg_override_permissions_hook'); +elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'elgg_override_permissions_hook');
\ No newline at end of file diff --git a/engine/lib/actions.php b/engine/lib/actions.php index 35f9dc4b3..35ac224dc 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -92,7 +92,7 @@ function action($action, $forwarder = "") { // Trigger action event // @todo This is only called before the primary action is called. $event_result = true; - $event_result = trigger_plugin_hook('action', $action, null, $event_result); + $event_result = elgg_trigger_plugin_hook('action', $action, null, $event_result); // Include action // Event_result being false doesn't produce an error @@ -228,7 +228,7 @@ function validate_action_token($visibleerrors = TRUE, $token = NULL, $ts = NULL) // else says something to the contry we assume we're ok $returnval = true; - $returnval = trigger_plugin_hook('action_gatekeeper:permissions:check', 'all', array( + $returnval = elgg_trigger_plugin_hook('action_gatekeeper:permissions:check', 'all', array( 'token' => $token, 'time' => $ts ), $returnval); @@ -362,8 +362,8 @@ function actions_init() elgg_view_register_simplecache('js/languages/en'); - register_plugin_hook('action', 'all', 'ajax_action_hook'); - register_plugin_hook('forward', 'all', 'ajax_forward_hook'); + elgg_register_plugin_hook_handler('action', 'all', 'ajax_action_hook'); + elgg_register_plugin_hook_handler('forward', 'all', 'ajax_forward_hook'); } /** @@ -436,4 +436,4 @@ function ajax_action_hook() { } } -register_elgg_event_handler('init', 'system', 'actions_init');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'actions_init');
\ No newline at end of file diff --git a/engine/lib/admin.php b/engine/lib/admin.php index b760adabe..5a9e14498 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -311,5 +311,5 @@ function elgg_admin_notice_exists($id) { } // Register init functions -register_elgg_event_handler('init', 'system', 'admin_init'); -register_elgg_event_handler('pagesetup', 'system', 'admin_pagesetup'); +elgg_register_event_handler('init', 'system', 'admin_init'); +elgg_register_event_handler('pagesetup', 'system', 'admin_pagesetup'); diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 9ed9cf5f6..02e5bc6e0 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -88,7 +88,7 @@ $owner_guid, $access_id = ACCESS_PRIVATE) { $entity = get_entity($entity_guid); - if (trigger_elgg_event('annotate', $entity->type, $entity)) { + if (elgg_trigger_event('annotate', $entity->type, $entity)) { system_log($entity, 'annotate'); // If ok then add it @@ -98,7 +98,7 @@ $owner_guid, $access_id = ACCESS_PRIVATE) { if ($result !== false) { $obj = get_annotation($result); - if (trigger_elgg_event('create', 'annotation', $obj)) { + if (elgg_trigger_event('create', 'annotation', $obj)) { return $result; } else { // plugin returned false to reject annotation @@ -158,7 +158,7 @@ function update_annotation($annotation_id, $name, $value, $value_type, $owner_gu if ($result !== false) { $obj = get_annotation($annotation_id); - if (trigger_elgg_event('update', 'annotation', $obj)) { + if (elgg_trigger_event('update', 'annotation', $obj)) { return true; } else { // @todo add plugin hook that sends old and new annotation information before db access @@ -547,7 +547,7 @@ $viewtypetoggle = false) { * Returns a viewable list of entities from annotations. * * @param array $options - * + * * @see elgg_get_entities_from_annotations() * @see elgg_list_entities() * @@ -1021,7 +1021,7 @@ function delete_annotation($id) { $access = get_access_sql_suffix(); $annotation = get_annotation($id); - if (trigger_elgg_event('delete', 'annotation', $annotation)) { + if (elgg_trigger_event('delete', 'annotation', $annotation)) { remove_from_river_by_annotation($id); return delete_data("DELETE from {$CONFIG->dbprefix}annotations where id=$id and $access"); } @@ -1199,4 +1199,4 @@ function register_annotation_url_handler($function_name, $extender_name = "all") } /** Register the hook */ -register_plugin_hook("export", "all", "export_annotation_plugin_hook", 2); +elgg_register_plugin_hook_handler("export", "all", "export_annotation_plugin_hook", 2); diff --git a/engine/lib/api.php b/engine/lib/api.php index 642449fff..7313fb5e9 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -491,7 +491,7 @@ function api_auth_key() { // can be used for keeping stats // plugin can also return false to fail this authentication method - return trigger_plugin_hook('api_key', 'use', $api_key, true); + return elgg_trigger_plugin_hook('api_key', 'use', $api_key, true); } @@ -1380,7 +1380,7 @@ function api_init() { // Register a page handler, so we can have nice URLs register_service_handler('rest', 'rest_handler'); - register_plugin_hook('unit_test', 'system', 'api_unit_test'); + elgg_register_plugin_hook_handler('unit_test', 'system', 'api_unit_test'); // expose the list of api methods expose_function("system.api.list", "list_all_apis", NULL, @@ -1399,4 +1399,4 @@ function api_init() { } -register_elgg_event_handler('init', 'system', 'api_init'); +elgg_register_event_handler('init', 'system', 'api_init'); diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php index 9b6386c05..b222b6b4f 100644 --- a/engine/lib/configuration.php +++ b/engine/lib/configuration.php @@ -411,4 +411,4 @@ function configuration_boot() { get_all_config(); } -register_elgg_event_handler('boot', 'system', 'configuration_boot', 10);
\ No newline at end of file +elgg_register_event_handler('boot', 'system', 'configuration_boot', 10);
\ No newline at end of file diff --git a/engine/lib/cron.php b/engine/lib/cron.php index d51a34bf7..9d47e95d1 100644 --- a/engine/lib/cron.php +++ b/engine/lib/cron.php @@ -16,7 +16,7 @@ function cron_init() { register_page_handler('cron', 'cron_page_handler'); // register a hook for Walled Garden public pages - register_plugin_hook('public_pages', 'walled_garden', 'cron_public_pages'); + elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'cron_public_pages'); } /** @@ -80,4 +80,4 @@ function cron_public_pages($hook, $type, $return_value, $params) { } // Register a startup event -register_elgg_event_handler('init', 'system', 'cron_init');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'cron_init');
\ No newline at end of file diff --git a/engine/lib/database.php b/engine/lib/database.php index 4a99afea1..3170f3ac1 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -776,4 +776,4 @@ function sanitize_int($int) { /** * @elgg_register_event boot system init_db */ -register_elgg_event_handler('boot', 'system', 'init_db', 0);
\ No newline at end of file +elgg_register_event_handler('boot', 'system', 'init_db', 0);
\ No newline at end of file diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index a4c4caa4f..dc39a6204 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -84,7 +84,7 @@ function forward($location = "") { // return new forward location or false to stop the forward or empty string to exit $current_page = current_page_url(); $params = array('current_url' => $current_page, 'forward_url' => $location); - $location = trigger_plugin_hook('forward', 'system', $params, $location); + $location = elgg_trigger_plugin_hook('forward', 'system', $params, $location); if ($location) { header("Location: {$location}"); @@ -266,10 +266,10 @@ function elgg_get_css() { function elgg_get_external_file($type, $location) { global $CONFIG; - if (isset($CONFIG->externals) && + if (isset($CONFIG->externals) && isset($CONFIG->externals[$type]) && isset($CONFIG->externals[$type][$location])) { - + return array_values($CONFIG->externals[$type][$location]); } return array(); @@ -290,7 +290,7 @@ function elgg_view_likes($entity) { return false; } - if ($likes = trigger_plugin_hook('likes', $entity->getType(), array('entity' => $entity), false)) { + if ($likes = elgg_trigger_plugin_hook('likes', $entity->getType(), array('entity' => $entity), false)) { return $likes; } else { $likes = elgg_view('likes/forms/edit', array('entity' => $entity)); @@ -307,7 +307,7 @@ function elgg_view_likes($entity) { * @since 1.8 */ function elgg_count_likes($entity) { - if ($likeno = trigger_plugin_hook('likes:count', $entity->getType(), + if ($likeno = elgg_trigger_plugin_hook('likes:count', $entity->getType(), array('entity' => $entity), false)) { return $likeno; } else { @@ -323,7 +323,7 @@ function elgg_count_likes($entity) { * @return int Number of comments */ function elgg_count_comments($entity) { - if ($commentno = trigger_plugin_hook('comments:count', $entity->getType(), + if ($commentno = elgg_trigger_plugin_hook('comments:count', $entity->getType(), array('entity' => $entity), false)) { return $commentno; } else { @@ -633,7 +633,7 @@ function register_error($error) { } /** - * Deprecated events core function. Code divided between register_elgg_event_handler() + * Deprecated events core function. Code divided between elgg_register_event_handler() * and trigger_elgg_event(). * * @param string $event The type of event (eg 'init', 'update', 'delete') @@ -653,7 +653,7 @@ $call = false, $object = null) { // leaving this here just in case someone was directly calling this internal function if (!$call) { - return register_elgg_event_handler($event, $object_type, $function, $priority); + return elgg_register_event_handler($event, $object_type, $function, $priority); } else { return trigger_elgg_event($event, $object_type, $object); } @@ -709,7 +709,7 @@ $call = false, $object = null) { * @param string $event The event type * @param string $object_type The object type * @param string $callback The handler callback - * @param int $priority The priority of the event + * @param int $priority The priority - 0 is default, negative before, positive after * * @return bool * @link http://docs.elgg.org/Tutorials/Plugins/Events @@ -718,7 +718,7 @@ $call = false, $object = null) { * callback and halting execution. * @example events/all.php Example of how to use the 'all' keyword. */ -function register_elgg_event_handler($event, $object_type, $callback, $priority = 500) { +function elgg_register_event_handler($event, $object_type, $callback, $priority = 500) { global $CONFIG; if (empty($event) || empty($object_type)) { @@ -739,10 +739,8 @@ function register_elgg_event_handler($event, $object_type, $callback, $priority return FALSE; } - $priority = (int) $priority; - if ($priority < 0) { - $priority = 0; - } + $priority = max((int) $priority, 0); + while (isset($CONFIG->events[$event][$object_type][$priority])) { $priority++; } @@ -752,6 +750,14 @@ function register_elgg_event_handler($event, $object_type, $callback, $priority } /** + * @deprecated 1.8 Use elgg_register_event_handler() instead + */ +function register_elgg_event_handler($event, $object_type, $callback, $priority = 500) { + elgg_deprecated_notice("register_elgg_event_handler() was deprecated by elgg_register_event_handler()", 1.8); + return elgg_register_event_handler($event, $object_type, $callback, $priority); +} + +/** * Unregisters a callback for an event. * * @param string $event The event type @@ -759,9 +765,9 @@ function register_elgg_event_handler($event, $object_type, $callback, $priority * @param string $callback The callback * * @return void - * @since 1.7.0 + * @since 1.7 */ -function unregister_elgg_event_handler($event, $object_type, $callback) { +function elgg_unregister_event_handler($event, $object_type, $callback) { global $CONFIG; foreach ($CONFIG->events[$event][$object_type] as $key => $event_callback) { if ($event_callback == $callback) { @@ -771,6 +777,14 @@ function unregister_elgg_event_handler($event, $object_type, $callback) { } /** + * @deprecated 1.8 Use elgg_unregister_event_handler instead + */ +function unregister_elgg_event_handler($event, $object_type, $callback) { + elgg_deprecated_notice("unregister_elgg_event_handler() was deprecated by elgg_unregister_event_handler()", 1.8); + elgg_unregister_event_handler($event, $object_type, $callback); +} + +/** * Trigger an Elgg Event and run all handler callbacks registered to that event, type. * * This function runs all handlers registered to $event, $object_type or @@ -801,7 +815,7 @@ function unregister_elgg_event_handler($event, $object_type, $callback) { * @link http://docs.elgg.org/Tutorials/Core/Events * @internal @example events/emit.php Basic emitting of an Elgg event. */ -function trigger_elgg_event($event, $object_type, $object = null) { +function elgg_trigger_event($event, $object_type, $object = null) { global $CONFIG; if (!empty($CONFIG->events[$event][$object_type]) && is_array($CONFIG->events[$event][$object_type])) { @@ -840,10 +854,18 @@ function trigger_elgg_event($event, $object_type, $object = null) { } /** + * @deprecated 1.8 Use elgg_trigger_event() instead + */ +function trigger_elgg_event($event, $object_type, $object = null) { + elgg_deprecated_notice('trigger_elgg_event() was deprecated by elgg_trigger_event()', 1.8); + return elgg_trigger_event($event, $object_type, $object); +} + +/** * Register a callback as a plugin hook handler. * * Plugin hooks allow developers to losely couple plugins and features by - * repsonding to and emitting {@link trigger_plugin_hook()} customizable hooks. + * repsonding to and emitting {@link elgg_trigger_plugin_hook()} customizable hooks. * Handler callbacks can respond to the hook, change the details of the hook, or * ignore it. * @@ -851,7 +873,7 @@ function trigger_elgg_event($event, $object_type, $object = null) { * is called in order of priority. If the return value of a handler is not * null, that value is passed to the next callback in the call stack. When all * callbacks have been run, the final value is passed back to the caller - * via {@link trigger_plugin_hook()}. + * via {@link elgg_trigger_plugin_hook()}. * * Similar to Elgg Events, plugin hook handler callbacks are registered by passing * a hook, a type, and a priority. @@ -896,15 +918,16 @@ function trigger_elgg_event($event, $object_type, $object = null) { * @param string $hook The name of the hook * @param string $type The type of the hook * @param callback $callback The name of a valid function or an array with object and method - * @param string $priority The priority - 0 is first, 1000 last, default is 500 + * @param int $priority The priority - 0 is default, negative before, positive after * * @return bool * * @example hooks/register/basic.php Registering for a plugin hook and examining the variables. * @example hooks/register/advanced.php Registering for a plugin hook and changing the params. * @link http://docs.elgg.org/Tutorials/Plugins/Hooks + * @since 1.8 */ -function register_plugin_hook($hook, $type, $callback, $priority = 500) { +function elgg_register_plugin_hook_handler($hook, $type, $callback, $priority = 500) { global $CONFIG; if (empty($hook) || empty($type)) { @@ -929,6 +952,7 @@ function register_plugin_hook($hook, $type, $callback, $priority = 500) { if ($priority < 0) { $priority = 0; } + while (isset($CONFIG->hooks[$hook][$type][$priority])) { $priority++; } @@ -938,6 +962,14 @@ function register_plugin_hook($hook, $type, $callback, $priority = 500) { } /** + * @deprecated 1.8 Use elgg_register_plugin_hook_handler() instead + */ +function register_plugin_hook($hook, $type, $callback, $priority = 500) { + elgg_deprecated_notice("register_plugin_hook() was deprecated by elgg_register_plugin_hook_handler()", 1.8); + return elgg_register_plugin_hook_handler($hook, $type, $callback, $priority); +} + +/** * Unregister a callback as a plugin hook. * * @param string $hook The name of the hook @@ -945,9 +977,9 @@ function register_plugin_hook($hook, $type, $callback, $priority = 500) { * @param callback $callback The PHP callback to be removed * * @return void - * @since 1.7.0 + * @since 1.8 */ -function unregister_plugin_hook($hook, $entity_type, $callback) { +function elgg_unregister_plugin_hook_handler($hook, $entity_type, $callback) { global $CONFIG; foreach ($CONFIG->hooks[$hook][$entity_type] as $key => $hook_callback) { if ($hook_callback == $callback) { @@ -957,6 +989,14 @@ function unregister_plugin_hook($hook, $entity_type, $callback) { } /** + * @deprecated 1.8 Use elgg_unregister_plugin_hook_handler() instead + */ +function unregister_plugin_hook($hook, $entity_type, $callback) { + elgg_deprecated_notice("unregister_plugin_hook() was deprecated by elgg_unregister_plugin_hook_handler()", 1.8); + elgg_unregister_plugin_hook_handler($hook, $entity_type, $callback); +} + +/** * Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. * * This function runs all handlers regsitered to $hook, $type or @@ -978,7 +1018,7 @@ function unregister_plugin_hook($hook, $entity_type, $callback) { * called for all hooks of type $event, regardless of $object_type. If $hook * and $type both are 'all', the handler will be called for all hooks. * - * @see register_plugin_hook() + * @see elgg_register_plugin_hook_handler() * * @param string $hook The name of the hook to trigger ("all" will * trigger for all $types regardless of $hook value) @@ -995,8 +1035,10 @@ function unregister_plugin_hook($hook, $entity_type, $callback) { * the results to populate a menu. * @example hooks/basic.php Trigger and respond to a basic plugin hook. * @link http://docs.elgg.org/Tutorials/Plugins/Hooks + * + * @since 1.8 */ -function trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) { +function elgg_trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) { global $CONFIG; if (!empty($CONFIG->hooks[$hook][$type]) && is_array($CONFIG->hooks[$hook][$type])) { @@ -1043,6 +1085,14 @@ function trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) } /** + * @deprecated 1.8 Use elgg_trigger_plugin_hook() instead + */ +function trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) { + elgg_deprecated_notice("trigger_plugin_hook() was deprecated by elgg_trigger_plugin_hook()", 1.8); + return elgg_trigger_plugin_hook($hook, $type, $params, $returnvalue); +} + +/** * Intercepts, logs, and display uncaught exceptions. * * @warning This function should never be called directly. @@ -1195,7 +1245,7 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { $params = array('level' => $level, 'msg' => $value, 'to_screen' => $to_screen); - if (!trigger_plugin_hook('debug', 'log', $params, true)) { + if (!elgg_trigger_plugin_hook('debug', 'log', $params, true)) { return; } @@ -1438,7 +1488,7 @@ function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = fals /** * Get the URL for the current (or specified) site - * + * * @param int $site_guid The GUID of the site whose URL we want to grab * @return string */ @@ -1447,13 +1497,13 @@ function elgg_get_site_url($site_guid = 0) { global $CONFIG; return $CONFIG->wwwroot; } - + $site = get_entity($site_guid); - + if (!$site instanceof ElggSite) { return false; } - + return $site->url; } @@ -2076,7 +2126,7 @@ function is_ip_in_array() { function _elgg_shutdown_hook() { global $START_MICROTIME; - trigger_elgg_event('shutdown', 'system'); + elgg_trigger_event('shutdown', 'system'); $time = (float)(microtime(TRUE) - $START_MICROTIME); // demoted to NOTICE from DEBUG so javascript is not corrupted @@ -2249,8 +2299,8 @@ define('REFERRER', -1); */ define('REFERER', -1); -register_elgg_event_handler('init', 'system', 'elgg_init'); -register_plugin_hook('unit_test', 'system', 'elgg_api_test'); +elgg_register_event_handler('init', 'system', 'elgg_init'); +elgg_register_plugin_hook_handler('unit_test', 'system', 'elgg_api_test'); -register_elgg_event_handler('init', 'system', 'add_custom_menu_items', 1000); -register_elgg_event_handler('init', 'system', 'elgg_walled_garden', 1000); +elgg_register_event_handler('init', 'system', 'add_custom_menu_items', 1000); +elgg_register_event_handler('init', 'system', 'elgg_walled_garden', 1000); diff --git a/engine/lib/entities.php b/engine/lib/entities.php index b277f6f25..c8886ac50 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -400,7 +400,7 @@ function update_entity($guid, $owner_guid, $access_id, $container_guid = null) { $entity = get_entity($guid); if ($entity && $entity->canEdit()) { - if (trigger_elgg_event('update', $entity->type, $entity)) { + if (elgg_trigger_event('update', $entity->type, $entity)) { $ret = update_data("UPDATE {$CONFIG->dbprefix}entities" . " set owner_guid='$owner_guid', access_id='$access_id'," . " container_guid='$container_guid', time_updated='$time' WHERE guid=$guid"); @@ -481,7 +481,7 @@ function can_write_to_container($user_guid = 0, $container_guid = 0, $type = 'al } // See if anyone else has anything to say - return trigger_plugin_hook('container_permissions_check', $type, + return elgg_trigger_plugin_hook('container_permissions_check', $type, array('container' => $container, 'user' => $user, 'subtype' => $subtype), $return); } @@ -1526,7 +1526,7 @@ function disable_entity($guid, $reason = "", $recursive = true) { $reason = sanitise_string($reason); if ($entity = get_entity($guid)) { - if (trigger_elgg_event('disable', $entity->type, $entity)) { + if (elgg_trigger_event('disable', $entity->type, $entity)) { if ($entity->canEdit()) { if ($reason) { create_metadata($guid, 'disable_reason', $reason, '', 0, ACCESS_PUBLIC); @@ -1584,7 +1584,7 @@ function enable_entity($guid) { access_show_hidden_entities(true); if ($entity = get_entity($guid)) { - if (trigger_elgg_event('enable', $entity->type, $entity)) { + if (elgg_trigger_event('enable', $entity->type, $entity)) { if ($entity->canEdit()) { access_show_hidden_entities($access_status); @@ -1629,7 +1629,7 @@ function delete_entity($guid, $recursive = true) { $guid = (int)$guid; if ($entity = get_entity($guid)) { - if (trigger_elgg_event('delete', $entity->type, $entity)) { + if (elgg_trigger_event('delete', $entity->type, $entity)) { if ($entity->canEdit()) { // delete cache @@ -1956,7 +1956,7 @@ function can_edit_entity($entity_guid, $user_guid = 0) { } } - return trigger_plugin_hook('permissions_check', $entity->type, + return elgg_trigger_plugin_hook('permissions_check', $entity->type, array('entity' => $entity, 'user' => $user), $return); } else { @@ -1977,7 +1977,7 @@ function can_edit_entity($entity_guid, $user_guid = 0) { * @param ElggMetadata $metadata The metadata to specifically check (if any; default null) * * @return bool - * @see register_plugin_hook() + * @see elgg_register_plugin_hook_handler() */ function can_edit_entity_metadata($entity_guid, $user_guid = 0, $metadata = null) { if ($entity = get_entity($entity_guid)) { @@ -1993,7 +1993,7 @@ function can_edit_entity_metadata($entity_guid, $user_guid = 0, $metadata = null $user = get_entity($user_guid); $params = array('entity' => $entity, 'user' => $user, 'metadata' => $metadata); - $return = trigger_plugin_hook('permissions_check:metadata', $entity->type, $parms, $return); + $return = elgg_trigger_plugin_hook('permissions_check:metadata', $entity->type, $parms, $return); return $return; } else { return false; @@ -2048,7 +2048,7 @@ function get_entity_icon_url(ElggEntity $entity, $size = 'medium') { // Step one, see if anyone knows how to render this in the current view $params = array('entity' => $entity, 'viewtype' => $viewtype, 'size' => $size); - $url = trigger_plugin_hook('entity:icon:url', $entity->getType(), $params, $url); + $url = elgg_trigger_plugin_hook('entity:icon:url', $entity->getType(), $params, $url); // Fail, so use default if (!$url) { @@ -2565,27 +2565,27 @@ function entities_test($hook, $type, $value, $params) { function entities_init() { register_page_handler('view', 'entities_page_handler'); - register_plugin_hook('unit_test', 'system', 'entities_test'); + elgg_register_plugin_hook_handler('unit_test', 'system', 'entities_test'); // Allow a permission override for recursive entity deletion // @todo Can this be done better? - register_plugin_hook('permissions_check', 'all', 'recursive_delete_permissions_check'); - register_plugin_hook('permissions_check:metadata', 'all', 'recursive_delete_permissions_check'); + elgg_register_plugin_hook_handler('permissions_check', 'all', 'recursive_delete_permissions_check'); + elgg_register_plugin_hook_handler('permissions_check:metadata', 'all', 'recursive_delete_permissions_check'); - register_plugin_hook('gc', 'system', 'entities_gc'); + elgg_register_plugin_hook_handler('gc', 'system', 'entities_gc'); } /** Register the import hook */ -register_plugin_hook("import", "all", "import_entity_plugin_hook", 0); +elgg_register_plugin_hook_handler("import", "all", "import_entity_plugin_hook", 0); /** Register the hook, ensuring entities are serialised first */ -register_plugin_hook("export", "all", "export_entity_plugin_hook", 0); +elgg_register_plugin_hook_handler("export", "all", "export_entity_plugin_hook", 0); /** Hook to get certain named bits of volatile data about an entity */ -register_plugin_hook('volatile', 'metadata', 'volatile_data_export_plugin_hook'); +elgg_register_plugin_hook_handler('volatile', 'metadata', 'volatile_data_export_plugin_hook'); /** Hook for rendering a default icon for entities */ -register_plugin_hook('entity:icon:url', 'all', 'default_entity_icon_hook', 1000); +elgg_register_plugin_hook_handler('entity:icon:url', 'all', 'default_entity_icon_hook', 1000); /** Register init system event **/ -register_elgg_event_handler('init', 'system', 'entities_init');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'entities_init');
\ No newline at end of file diff --git a/engine/lib/export.php b/engine/lib/export.php index 1704ef81d..4de10330f 100644 --- a/engine/lib/export.php +++ b/engine/lib/export.php @@ -117,7 +117,7 @@ function _process_element(ODD $odd) { // See if anyone handles this element, return true if it is. if ($odd) { - $handled = trigger_plugin_hook("import", "all", array("element" => $odd), $to_be_serialised); + $handled = elgg_trigger_plugin_hook("import", "all", array("element" => $odd), $to_be_serialised); } // If not, then see if any of its sub elements are handled @@ -145,7 +145,7 @@ function exportAsArray($guid) { $guid = (int)$guid; // Trigger a hook to - $to_be_serialised = trigger_plugin_hook("export", "all", array("guid" => $guid), array()); + $to_be_serialised = elgg_trigger_plugin_hook("export", "all", array("guid" => $guid), array()); // Sanity check if ((!is_array($to_be_serialised)) || (count($to_be_serialised) == 0)) { @@ -218,4 +218,4 @@ function export_init() { } // Register a startup event -register_elgg_event_handler('init', 'system', 'export_init', 100); +elgg_register_event_handler('init', 'system', 'export_init', 100); diff --git a/engine/lib/extender.php b/engine/lib/extender.php index a67f29a68..b894c5e59 100644 --- a/engine/lib/extender.php +++ b/engine/lib/extender.php @@ -155,7 +155,7 @@ function can_edit_extender($extender_id, $type, $user_guid = 0) { // Trigger plugin hooks $params = array('entity' => $entity, 'user' => $user); - return trigger_plugin_hook('permissions_check', $type, $params, false); + return elgg_trigger_plugin_hook('permissions_check', $type, $params, false); } /** @@ -236,4 +236,4 @@ function get_extender_url(ElggExtender $extender) { } /** Register the hook */ -register_plugin_hook("import", "all", "import_extender_plugin_hook", 2);
\ No newline at end of file +elgg_register_plugin_hook_handler("import", "all", "import_extender_plugin_hook", 2);
\ No newline at end of file diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index 23b10c24c..9bdc26845 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -505,7 +505,7 @@ function filestore_test($hook, $type, $value, $params) { // Register a startup event -register_elgg_event_handler('init', 'system', 'filestore_init', 100); +elgg_register_event_handler('init', 'system', 'filestore_init', 100); // Unit testing -register_plugin_hook('unit_test', 'system', 'filestore_test');
\ No newline at end of file +elgg_register_plugin_hook_handler('unit_test', 'system', 'filestore_test');
\ No newline at end of file diff --git a/engine/lib/group.php b/engine/lib/group.php index 85c5e79bf..e554a44c5 100644 --- a/engine/lib/group.php +++ b/engine/lib/group.php @@ -52,7 +52,7 @@ function create_group_entity($guid, $name, $description) { if ($result != false) { // Update succeeded, continue $entity = get_entity($guid); - if (trigger_elgg_event('update', $entity->type, $entity)) { + if (elgg_trigger_event('update', $entity->type, $entity)) { return $guid; } else { $entity->delete(); @@ -66,7 +66,7 @@ function create_group_entity($guid, $name, $description) { $result = insert_data($query); if ($result !== false) { $entity = get_entity($guid); - if (trigger_elgg_event('create', $entity->type, $entity)) { + if (elgg_trigger_event('create', $entity->type, $entity)) { return $guid; } else { $entity->delete(); @@ -568,7 +568,7 @@ function join_group($group_guid, $user_guid) { $result = add_entity_relationship($user_guid, 'member', $group_guid); $param = array('group' => get_entity($group_guid), 'user' => get_entity($user_guid)); - trigger_elgg_event('join', 'group', $params); + elgg_trigger_event('join', 'group', $params); return $result; } @@ -585,7 +585,7 @@ function leave_group($group_guid, $user_guid) { // event needs to be triggered while user is still member of group to have access to group acl $params = array('group' => get_entity($group_guid), 'user' => get_entity($user_guid)); - trigger_elgg_event('leave', 'group', $params); + elgg_trigger_event('leave', 'group', $params); $result = remove_entity_relationship($user_guid, 'member', $group_guid); return $result; } @@ -784,4 +784,4 @@ function group_init() { register_entity_type('group', ''); } -register_elgg_event_handler('init', 'system', 'group_init'); +elgg_register_event_handler('init', 'system', 'group_init'); diff --git a/engine/lib/input.php b/engine/lib/input.php index 4ba6f500c..76daf5fa3 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -83,7 +83,7 @@ function set_input($variable, $value) { * @return mixed The filtered result - everything will be strings */ function filter_tags($var) { - return trigger_plugin_hook('validate', 'input', null, $var); + return elgg_trigger_plugin_hook('validate', 'input', null, $var); } /** @@ -330,4 +330,4 @@ function input_init() { } } -register_elgg_event_handler('init', 'system', 'input_init'); +elgg_register_event_handler('init', 'system', 'input_init'); diff --git a/engine/lib/location.php b/engine/lib/location.php index f3aae709b..d5d6b7309 100644 --- a/engine/lib/location.php +++ b/engine/lib/location.php @@ -38,7 +38,7 @@ function elgg_geocode_location($location) { // Trigger geocode event if not cached $return = false; - $return = trigger_plugin_hook('geocode', 'location', array('location' => $location), $return); + $return = elgg_trigger_plugin_hook('geocode', 'location', array('location' => $location), $return); // If returned, cache and return value if (($return) && (is_array($return))) { diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index af366f99a..ffa7b74e0 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -161,7 +161,7 @@ function create_metadata($entity_guid, $name, $value, $value_type, $owner_guid, if ($id !== false) { $obj = get_metadata($id); - if (trigger_elgg_event('create', 'metadata', $obj)) { + if (elgg_trigger_event('create', 'metadata', $obj)) { return $id; } else { delete_metadata($id); @@ -245,7 +245,7 @@ function update_metadata($id, $name, $value, $value_type, $owner_guid, $access_i $result = update_data($query); if ($result !== false) { $obj = get_metadata($id); - if (trigger_elgg_event('update', 'metadata', $obj)) { + if (elgg_trigger_event('update', 'metadata', $obj)) { return true; } else { delete_metadata($id); @@ -308,7 +308,7 @@ function delete_metadata($id) { $metabyname_memcache->delete("{$metadata->entity_guid}:{$metadata->name_id}"); } - if (($metadata->canEdit()) && (trigger_elgg_event('delete', 'metadata', $metadata))) { + if (($metadata->canEdit()) && (elgg_trigger_event('delete', 'metadata', $metadata))) { return delete_data("DELETE from {$CONFIG->dbprefix}metadata where id=$id"); } } @@ -1342,13 +1342,13 @@ function register_metadata_url_handler($function_name, $extender_name = "all") { } /** Register the hook */ -register_plugin_hook("export", "all", "export_metadata_plugin_hook", 2); +elgg_register_plugin_hook_handler("export", "all", "export_metadata_plugin_hook", 2); /** Call a function whenever an entity is updated **/ -register_elgg_event_handler('update', 'all', 'metadata_update'); +elgg_register_event_handler('update', 'all', 'metadata_update'); // unit testing -register_plugin_hook('unit_test', 'system', 'metadata_test'); +elgg_register_plugin_hook_handler('unit_test', 'system', 'metadata_test'); /** * Metadata unit test diff --git a/engine/lib/notification.php b/engine/lib/notification.php index 5aef42aad..8908dcfab 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -305,7 +305,7 @@ function elgg_send_email($from, $to, $subject, $body, array $params = NULL) { 'params' => $params ); - $result = trigger_plugin_hook('email', 'system', $mail_params, NULL); + $result = elgg_trigger_plugin_hook('email', 'system', $mail_params, NULL); if ($result !== NULL) { return $result; } @@ -362,7 +362,7 @@ function notification_init() { // Add settings view to user settings & register action extend_elgg_settings_page('notifications/settings/usersettings', 'usersettings/user'); - register_plugin_hook('usersettings:save', 'user', 'notification_user_settings_save'); + elgg_register_plugin_hook_handler('usersettings:save', 'user', 'notification_user_settings_save'); } /** @@ -449,7 +449,7 @@ function object_notifications($event, $object_type, $object) { // Get config data global $CONFIG, $SESSION, $NOTIFICATION_HANDLERS; - $hookresult = trigger_plugin_hook('object:notifications', $object_type, array( + $hookresult = elgg_trigger_plugin_hook('object:notifications', $object_type, array( 'event' => $event, 'object_type' => $object_type, 'object' => $object, @@ -489,7 +489,7 @@ function object_notifications($event, $object_type, $object) { if ($user instanceof ElggUser && !$user->isBanned()) { if (($user->guid != $SESSION['user']->guid) && has_access_to_entity($object, $user) && $object->access_id != ACCESS_PRIVATE) { - $methodstring = trigger_plugin_hook('notify:entity:message', $object->getType(), array( + $methodstring = elgg_trigger_plugin_hook('notify:entity:message', $object->getType(), array( 'entity' => $object, 'to_entity' => $user, 'method' => $method), $string); @@ -510,5 +510,5 @@ function object_notifications($event, $object_type, $object) { } // Register a startup event -register_elgg_event_handler('init', 'system', 'notification_init', 0); -register_elgg_event_handler('create', 'object', 'object_notifications');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'notification_init', 0); +elgg_register_event_handler('create', 'object', 'object_notifications');
\ No newline at end of file diff --git a/engine/lib/objects.php b/engine/lib/objects.php index 5b7521922..51b47df2a 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -51,7 +51,7 @@ function create_object_entity($guid, $title, $description) { if ($result != false) { // Update succeeded, continue $entity = get_entity($guid); - if (trigger_elgg_event('update', $entity->type, $entity)) { + if (elgg_trigger_event('update', $entity->type, $entity)) { return $guid; } else { $entity->delete(); @@ -65,7 +65,7 @@ function create_object_entity($guid, $title, $description) { $result = insert_data($query); if ($result !== false) { $entity = get_entity($guid); - if (trigger_elgg_event('create', $entity->type, $entity)) { + if (elgg_trigger_event('create', $entity->type, $entity)) { return $guid; } else { $entity->delete(); @@ -224,5 +224,5 @@ function search_list_objects_by_name($hook, $user, $returnvalue, $tag) { } } -register_elgg_event_handler('init', 'system', 'objects_init', 0); -register_plugin_hook('unit_test', 'system', 'objects_test');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'objects_init', 0); +elgg_register_plugin_hook_handler('unit_test', 'system', 'objects_test');
\ No newline at end of file diff --git a/engine/lib/output.php b/engine/lib/output.php index 2c3324b49..dd5c4cf59 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -203,7 +203,7 @@ function elgg_get_friendly_title($title) { // return a URL friendly title to short circuit normal title formatting $params = array('title' => $title); - $result = trigger_plugin_hook('format', 'friendly:title', $params, NULL); + $result = elgg_trigger_plugin_hook('format', 'friendly:title', $params, NULL); if ($result) { return $result; } @@ -244,7 +244,7 @@ function elgg_get_friendly_time($time) { // return a time string to short circuit normal time formatting $params = array('time' => $time); - $result = trigger_plugin_hook('format', 'friendly:time', $params, NULL); + $result = elgg_trigger_plugin_hook('format', 'friendly:time', $params, NULL); if ($result) { return $result; } @@ -306,7 +306,7 @@ function elgg_strip_tags($string) { $params['original_string'] = $string; $string = strip_tags($string); - $string = trigger_plugin_hook('format', 'strip_tags', $params, $string); + $string = elgg_trigger_plugin_hook('format', 'strip_tags', $params, $string); return $string; } diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php index 6cd4f8e95..649e77e40 100644 --- a/engine/lib/pageowner.php +++ b/engine/lib/pageowner.php @@ -26,7 +26,7 @@ function elgg_get_page_owner_guid($guid = 0) { return $page_owner_guid; } - $guid = trigger_plugin_hook('page_owner', 'system', NULL, 0); + $guid = elgg_trigger_plugin_hook('page_owner', 'system', NULL, 0); $page_owner_guid = $guid; @@ -292,10 +292,10 @@ function get_context() { function page_owner_boot() { global $CONFIG; - register_plugin_hook('page_owner', 'system', 'default_page_owner_handler'); + elgg_register_plugin_hook_handler('page_owner', 'system', 'default_page_owner_handler'); // initial context - will be replaced by page handler $CONFIG->context = array('main'); } -register_elgg_event_handler('boot', 'system', 'page_owner_boot');
\ No newline at end of file +elgg_register_event_handler('boot', 'system', 'page_owner_boot');
\ No newline at end of file diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index b6aae9d7d..3649fddb7 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -432,7 +432,7 @@ function set_plugin_usersetting($name, $value, $user_guid = 0, $plugin_name = "" //$user->save(); // Hook to validate setting - $value = trigger_plugin_hook('plugin:usersetting', 'user', array( + $value = elgg_trigger_plugin_hook('plugin:usersetting', 'user', array( 'user' => $user, 'plugin' => $plugin_name, 'name' => $name, @@ -530,7 +530,7 @@ function set_plugin_setting($name, $value, $plugin_name = "") { if ($name != 'title') { // Hook to validate setting - $value = trigger_plugin_hook('plugin:setting', 'plugin', array( + $value = elgg_trigger_plugin_hook('plugin:setting', 'plugin', array( 'plugin' => $plugin_name, 'name' => $name, 'value' => $value @@ -681,7 +681,7 @@ function enable_plugin($plugin, $site_guid = 0) { // for other plugins that want to hook into this. $params = array('plugin' => $plugin, 'manifest' => $plugin_info); - if ($return && !trigger_elgg_event('enable', 'plugin', $params)) { + if ($return && !elgg_trigger_event('enable', 'plugin', $params)) { $return = FALSE; } @@ -775,7 +775,7 @@ function disable_plugin($plugin, $site_guid = 0) { if ($return) { // for other plugins that want to hook into this. $params = array('plugin' => $plugin, 'manifest' => $plugin_info); - if ($return && !trigger_elgg_event('disable', 'plugin', $params)) { + if ($return && !elgg_trigger_event('disable', 'plugin', $params)) { $return = FALSE; } @@ -879,4 +879,4 @@ function plugin_init() { } // Register a startup event -register_elgg_event_handler('init', 'system', 'plugin_init'); +elgg_register_event_handler('init', 'system', 'plugin_init'); diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index e09493c74..0b6b9b607 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -52,7 +52,7 @@ function delete_relationship($id) { $relationship = get_relationship($id); - if (trigger_elgg_event('delete', 'relationship', $relationship)) { + if (elgg_trigger_event('delete', 'relationship', $relationship)) { return delete_data("delete from {$CONFIG->dbprefix}entity_relationships where id=$id"); } @@ -90,7 +90,7 @@ function add_entity_relationship($guid_one, $relationship, $guid_two) { if ($result !== false) { $obj = get_relationship($result); - if (trigger_elgg_event('create', $relationship, $obj)) { + if (elgg_trigger_event('create', $relationship, $obj)) { return true; } else { delete_relationship($result); @@ -151,7 +151,7 @@ function remove_entity_relationship($guid_one, $relationship, $guid_two) { return false; } - if (trigger_elgg_event('delete', $relationship, $obj)) { + if (elgg_trigger_event('delete', $relationship, $obj)) { $query = "DELETE from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one and relationship='$relationship' @@ -867,10 +867,10 @@ function relationship_notification_hook($event, $object_type, $object) { } /** Register the import hook */ -register_plugin_hook("import", "all", "import_relationship_plugin_hook", 3); +elgg_register_plugin_hook_handler("import", "all", "import_relationship_plugin_hook", 3); /** Register the hook, ensuring entities are serialised first */ -register_plugin_hook("export", "all", "export_relationship_plugin_hook", 3); +elgg_register_plugin_hook_handler("export", "all", "export_relationship_plugin_hook", 3); /** Register event to listen to some events **/ -register_elgg_event_handler('create', 'friend', 'relationship_notification_hook'); +elgg_register_event_handler('create', 'friend', 'relationship_notification_hook'); diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php index 05258243f..b4722d38c 100644 --- a/engine/lib/sessions.php +++ b/engine/lib/sessions.php @@ -306,7 +306,7 @@ function login(ElggUser $user, $persistent = false) { setcookie("elggperm", $code, (time() + (86400 * 30)), "/"); } - if (!$user->save() || !trigger_elgg_event('login', 'user', $user)) { + if (!$user->save() || !elgg_trigger_event('login', 'user', $user)) { unset($_SESSION['username']); unset($_SESSION['name']); unset($_SESSION['code']); @@ -336,7 +336,7 @@ function logout() { global $CONFIG; if (isset($_SESSION['user'])) { - if (!trigger_elgg_event('logout', 'user', $_SESSION['user'])) { + if (!elgg_trigger_event('logout', 'user', $_SESSION['user'])) { return false; } $_SESSION['user']->code = ""; @@ -651,4 +651,4 @@ function _elgg_session_gc($maxlifetime) { return true; } -register_elgg_event_handler("boot", "system", "session_init", 20); +elgg_register_event_handler("boot", "system", "session_init", 20); diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 8044f8fd2..79b71d901 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -53,7 +53,7 @@ function create_site_entity($guid, $name, $description, $url) { if ($result != false) { // Update succeeded, continue $entity = get_entity($guid); - if (trigger_elgg_event('update', $entity->type, $entity)) { + if (elgg_trigger_event('update', $entity->type, $entity)) { return $guid; } else { $entity->delete(); @@ -68,7 +68,7 @@ function create_site_entity($guid, $name, $description, $url) { if ($result !== false) { $entity = get_entity($guid); - if (trigger_elgg_event('create', $entity->type, $entity)) { + if (elgg_trigger_event('create', $entity->type, $entity)) { return $guid; } else { $entity->delete(); @@ -412,7 +412,7 @@ function get_site_domain($guid) { function sites_boot($event, $object_type, $object) { global $CONFIG; - $site = trigger_plugin_hook("siteid", "system"); + $site = elgg_trigger_plugin_hook("siteid", "system"); if ($site === null || $site === false) { $CONFIG->site_id = (int) datalist_get('default_site'); } else { @@ -425,10 +425,10 @@ function sites_boot($event, $object_type, $object) { } // Register event handlers -register_elgg_event_handler('boot', 'system', 'sites_boot', 2); +elgg_register_event_handler('boot', 'system', 'sites_boot', 2); // Register with unit test -register_plugin_hook('unit_test', 'system', 'sites_test'); +elgg_register_plugin_hook_handler('unit_test', 'system', 'sites_test'); /** * Unit tests for sites diff --git a/engine/lib/statistics.php b/engine/lib/statistics.php index 0067f3672..62f4ca508 100644 --- a/engine/lib/statistics.php +++ b/engine/lib/statistics.php @@ -119,4 +119,4 @@ function statistics_init() { } /// Register init function -register_elgg_event_handler('init', 'system', 'statistics_init');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'statistics_init');
\ No newline at end of file diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index 05e3985eb..5e4a145bb 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -266,14 +266,14 @@ function system_log_default_logger($event, $object_type, $object) { */ function system_log_listener($event, $object_type, $object) { if (($object_type != 'systemlog') && ($event != 'log')) { - trigger_elgg_event('log', 'systemlog', array('object' => $object, 'event' => $event)); + elgg_trigger_event('log', 'systemlog', array('object' => $object, 'event' => $event)); } return true; } /** Register event to listen to all events **/ -register_elgg_event_handler('all', 'all', 'system_log_listener', 400); +elgg_register_event_handler('all', 'all', 'system_log_listener', 400); /** Register a default system log handler */ -register_elgg_event_handler('log', 'systemlog', 'system_log_default_logger', 999);
\ No newline at end of file +elgg_register_event_handler('log', 'systemlog', 'system_log_default_logger', 999);
\ No newline at end of file diff --git a/engine/lib/users.php b/engine/lib/users.php index 02974eec6..1e49c5926 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -69,7 +69,7 @@ function create_user_entity($guid, $name, $username, $password, $salt, $email, $ if ($result != false) { // Update succeeded, continue $entity = get_entity($guid); - if (trigger_elgg_event('update', $entity->type, $entity)) { + if (elgg_trigger_event('update', $entity->type, $entity)) { return $guid; } else { $entity->delete(); @@ -84,7 +84,7 @@ function create_user_entity($guid, $name, $username, $password, $salt, $email, $ $result = insert_data($query); if ($result !== false) { $entity = get_entity($guid); - if (trigger_elgg_event('create', $entity->type, $entity)) { + if (elgg_trigger_event('create', $entity->type, $entity)) { return $guid; } else { $entity->delete(); //delete_entity($guid); @@ -107,7 +107,7 @@ function disable_user_entities($owner_guid) { global $CONFIG; $owner_guid = (int) $owner_guid; if ($entity = get_entity($owner_guid)) { - if (trigger_elgg_event('disable', $entity->type, $entity)) { + if (elgg_trigger_event('disable', $entity->type, $entity)) { if ($entity->canEdit()) { $query = "UPDATE {$CONFIG->dbprefix}entities set enabled='no' where owner_guid={$owner_guid} @@ -139,7 +139,7 @@ function ban_user($user_guid, $reason = "") { $user = get_entity($user_guid); if (($user) && ($user->canEdit()) && ($user instanceof ElggUser)) { - if (trigger_elgg_event('ban', 'user', $user)) { + if (elgg_trigger_event('ban', 'user', $user)) { // Add reason if ($reason) { create_metadata($user_guid, 'ban_reason', $reason, '', 0, ACCESS_PUBLIC); @@ -185,7 +185,7 @@ function unban_user($user_guid) { $user = get_entity($user_guid); if (($user) && ($user->canEdit()) && ($user instanceof ElggUser)) { - if (trigger_elgg_event('unban', 'user', $user)) { + if (elgg_trigger_event('unban', 'user', $user)) { create_metadata($user_guid, 'ban_reason', '', '', 0, ACCESS_PUBLIC); // invalidate memcache for this user @@ -222,7 +222,7 @@ function make_user_admin($user_guid) { $user = get_entity((int)$user_guid); if (($user) && ($user instanceof ElggUser) && ($user->canEdit())) { - if (trigger_elgg_event('make_admin', 'user', $user)) { + if (elgg_trigger_event('make_admin', 'user', $user)) { // invalidate memcache for this user static $newentity_cache; @@ -258,7 +258,7 @@ function remove_user_admin($user_guid) { $user = get_entity((int)$user_guid); if (($user) && ($user instanceof ElggUser) && ($user->canEdit())) { - if (trigger_elgg_event('remove_admin', 'user', $user)) { + if (elgg_trigger_event('remove_admin', 'user', $user)) { // invalidate memcache for this user static $newentity_cache; @@ -1055,7 +1055,7 @@ function validate_username($username) { } $result = true; - return trigger_plugin_hook('registeruser:validate:username', 'all', + return elgg_trigger_plugin_hook('registeruser:validate:username', 'all', array('username' => $username), $result); } @@ -1075,7 +1075,7 @@ function validate_password($password) { } $result = true; - return trigger_plugin_hook('registeruser:validate:password', 'all', + return elgg_trigger_plugin_hook('registeruser:validate:password', 'all', array('password' => $password), $result); } @@ -1094,7 +1094,7 @@ function validate_email_address($address) { // Got here, so lets try a hook (defaulting to ok) $result = true; - return trigger_plugin_hook('registeruser:validate:email', 'all', + return elgg_trigger_plugin_hook('registeruser:validate:email', 'all', array('email' => $address), $result); } @@ -1475,9 +1475,9 @@ function users_init() { // Register the user type register_entity_type('user', ''); - register_plugin_hook('usersettings:save', 'user', 'users_settings_save'); + elgg_register_plugin_hook_handler('usersettings:save', 'user', 'users_settings_save'); - register_elgg_event_handler('create', 'user', 'user_create_hook_add_site_relationship'); + elgg_register_event_handler('create', 'user', 'user_create_hook_add_site_relationship'); } /** @@ -1548,6 +1548,6 @@ function users_test($hook, $type, $value, $params) { return $value; } -register_elgg_event_handler('init', 'system', 'users_init', 0); -register_elgg_event_handler('pagesetup', 'system', 'users_pagesetup', 0); -register_plugin_hook('unit_test', 'system', 'users_test');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'users_init', 0); +elgg_register_event_handler('pagesetup', 'system', 'users_pagesetup', 0); +elgg_register_plugin_hook_handler('unit_test', 'system', 'users_test');
\ No newline at end of file diff --git a/engine/lib/usersettings.php b/engine/lib/usersettings.php index 396bb6de5..1696dd1cd 100644 --- a/engine/lib/usersettings.php +++ b/engine/lib/usersettings.php @@ -100,5 +100,5 @@ function usersettings_init() { } /// Register init function -register_elgg_event_handler('init', 'system', 'usersettings_init'); -register_elgg_event_handler('pagesetup', 'system', 'usersettings_pagesetup');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'usersettings_init'); +elgg_register_event_handler('pagesetup', 'system', 'usersettings_pagesetup');
\ No newline at end of file diff --git a/engine/lib/version.php b/engine/lib/version.php index 3e4e0e4f7..f4e2ab9f6 100644 --- a/engine/lib/version.php +++ b/engine/lib/version.php @@ -127,7 +127,7 @@ function version_upgrade() { $upgrade_details->from = $dbversion; $upgrade_details->to = get_version(); - trigger_elgg_event('upgrade', 'upgrade', $upgrade_details); + elgg_trigger_event('upgrade', 'upgrade', $upgrade_details); // Update the version datalist_set('version', get_version()); diff --git a/engine/lib/views.php b/engine/lib/views.php index 9d60ec11c..459f84b69 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -239,7 +239,7 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie // Trigger the pagesetup event if (!isset($CONFIG->pagesetupdone)) { - trigger_elgg_event('pagesetup', 'system'); + elgg_trigger_event('pagesetup', 'system'); $CONFIG->pagesetupdone = true; } @@ -326,12 +326,12 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie $content = ob_get_clean(); // Plugin hook - $content = trigger_plugin_hook('view', $view_orig, + $content = elgg_trigger_plugin_hook('view', $view_orig, array('view' => $view_orig, 'vars' => $vars), $content); // backward compatibility with less grandular hook will be gone in 2.0 $params = array('view' => $view_orig, 'vars' => $vars); - $content_tmp = trigger_plugin_hook('display', 'view', $params, $content); + $content_tmp = elgg_trigger_plugin_hook('display', 'view', $params, $content); if ($content_tmp != $content) { $content = $content_tmp; @@ -903,7 +903,7 @@ function elgg_view_entity_annotations(ElggEntity $entity, $full = true) { $entity_type = $entity->getType(); - $annotations = trigger_plugin_hook('entity:annotate', $entity_type, + $annotations = elgg_trigger_plugin_hook('entity:annotate', $entity_type, array( 'entity' => $entity, 'full' => $full, @@ -1003,7 +1003,7 @@ function elgg_view_comments($entity, $add_comment = true) { return false; } - $comments = trigger_plugin_hook('comments', $entity->getType(), array('entity' => $entity), false); + $comments = elgg_trigger_plugin_hook('comments', $entity->getType(), array('entity' => $entity), false); if ($comemnts) { return $comments; } else { @@ -1290,7 +1290,7 @@ function elgg_view_page($title, $body, $page_shell = 'page_shells/default', $var $vars['page_shell'] = $page_shell; // Allow plugins to mod output - return trigger_plugin_hook('output', 'page', $vars, $output); + return elgg_trigger_plugin_hook('output', 'page', $vars, $output); } /** @@ -1356,7 +1356,7 @@ function elgg_views_boot() { elgg_register_js("{$base}vendors/jquery/jquery-ui-1.7.2.min.js", 'jquery-ui'); elgg_register_js("{$base}vendors/jquery/jquery.form.js", 'jquery.form'); - register_elgg_event_handler('pagesetup', 'system', 'elgg_views_register_core_head_elements'); + elgg_register_event_handler('pagesetup', 'system', 'elgg_views_register_core_head_elements'); // discover the built-in view types // @todo cache this @@ -1372,4 +1372,4 @@ function elgg_views_boot() { } } -register_elgg_event_handler('boot', 'system', 'elgg_views_boot', 1000);
\ No newline at end of file +elgg_register_event_handler('boot', 'system', 'elgg_views_boot', 1000);
\ No newline at end of file diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 02ab3af69..e3ab07227 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -504,7 +504,7 @@ function widgets_init() { } // Register event -register_elgg_event_handler('init', 'system', 'widgets_init'); +elgg_register_event_handler('init', 'system', 'widgets_init'); // Use widgets on the dashboard use_widgets('dashboard');
\ No newline at end of file |