diff options
102 files changed, 462 insertions, 412 deletions
diff --git a/actions/login.php b/actions/login.php index 67a2052b6..936d0a7d9 100644 --- a/actions/login.php +++ b/actions/login.php @@ -56,7 +56,7 @@ if ($result) {  	//	// Returning FALSE to this function will generate a standard  	//	// "Could not log you in" message.  	//	// Plugins should use this hook to provide details, and then return TRUE. -	//	if (!trigger_plugin_hook('failed_login', 'user', $params, FALSE)) { +	//	if (!elgg_trigger_plugin_hook('failed_login', 'user', $params, FALSE)) {  	//		register_error(elgg_echo('loginerror'));  	//	}  } diff --git a/actions/plugins/settings/save.php b/actions/plugins/settings/save.php index b67fa401f..2edf58e5b 100644 --- a/actions/plugins/settings/save.php +++ b/actions/plugins/settings/save.php @@ -41,7 +41,7 @@ if (elgg_action_exist("settings/$plugin/save")) {  system_message(elgg_echo('plugins:settings:save:ok', array($plugin_name)));  forward(REFERER);  // -//$trigger = trigger_plugin_hook('plugin:save_settings', $plugin, $options, NULL); +//$trigger = elgg_trigger_plugin_hook('plugin:save_settings', $plugin, $options, NULL);  //if ($trigger === NULL) {  //	foreach ($params as $k => $v) {  //		if (!$result = set_plugin_setting($k, $v, $plugin)) { diff --git a/actions/register.php b/actions/register.php index 3a45cb69b..566f6b1d4 100644 --- a/actions/register.php +++ b/actions/register.php @@ -44,7 +44,7 @@ if ($CONFIG->allow_registration) {  			);  			// @todo should registration be allowed no matter what the plugins return? -			if (!trigger_plugin_hook('register', 'user', $params, TRUE)) { +			if (!elgg_trigger_plugin_hook('register', 'user', $params, TRUE)) {  				$new_user->delete();  				// @todo this is a generic messages. We could have plugins  				// throw a RegistrationException, but that is very odd diff --git a/actions/usersettings/save.php b/actions/usersettings/save.php index 3e0117f06..6ee33ecd7 100644 --- a/actions/usersettings/save.php +++ b/actions/usersettings/save.php @@ -10,6 +10,6 @@ global $CONFIG;  gatekeeper(); -trigger_plugin_hook('usersettings:save', 'user'); +elgg_trigger_plugin_hook('usersettings:save', 'user');  forward(REFERER); diff --git a/documentation/examples/events/advanced.php b/documentation/examples/events/advanced.php index c6fc2d0fb..f566e0006 100644 --- a/documentation/examples/events/advanced.php +++ b/documentation/examples/events/advanced.php @@ -1,6 +1,6 @@  <?php -register_elgg_event_handler('create', 'object', 'example_event_handler'); +elgg_register_event_handler('create', 'object', 'example_event_handler');  function example_event_handler($event, $type, $params) {  	// Don't allow any non-admin users to create objects diff --git a/documentation/examples/events/all.php b/documentation/examples/events/all.php index 63959a9d2..238178312 100644 --- a/documentation/examples/events/all.php +++ b/documentation/examples/events/all.php @@ -1,6 +1,6 @@  <?php -register_elgg_event_handler('all', 'object', 'example_event_handler'); +elgg_register_event_handler('all', 'object', 'example_event_handler');  // This function will be called for any event of type 'object'  function example_event_handler($event, $type, $params) { diff --git a/documentation/examples/events/basic.php b/documentation/examples/events/basic.php index b274137b8..91704e60b 100644 --- a/documentation/examples/events/basic.php +++ b/documentation/examples/events/basic.php @@ -1,6 +1,6 @@  <?php -register_elgg_event_handler('init', 'system', 'example_event_handler'); +elgg_register_event_handler('init', 'system', 'example_event_handler');  function example_event_handler($event, $type, $params) {  	var_dump($event); diff --git a/documentation/examples/events/emit.php b/documentation/examples/events/emit.php index f4cd1b127..b917c6dc0 100644 --- a/documentation/examples/events/emit.php +++ b/documentation/examples/events/emit.php @@ -1,7 +1,7 @@  <?php  $params = new ElggObject(); -trigger_elgg_event('test', 'example', $params); +elgg_trigger_event('test', 'example', $params);  // handlers would be registered by saying -register_elgg_event_handler('test', 'example', 'example_event_handler'); +elgg_register_event_handler('test', 'example', 'example_event_handler'); diff --git a/documentation/examples/hooks/basic.php b/documentation/examples/hooks/basic.php index d9055a4aa..71076ee96 100644 --- a/documentation/examples/hooks/basic.php +++ b/documentation/examples/hooks/basic.php @@ -1,10 +1,10 @@  <?php -register_plugin_hook('get_items', 'example', 'example_plugin_hook'); -register_plugin_hook('get_items', 'example', 'example_plugin_hook_2'); +elgg_register_plugin_hook_handler('get_items', 'example', 'example_plugin_hook'); +elgg_register_plugin_hook_handler('get_items', 'example', 'example_plugin_hook_2');  $params = array('username' => 'Joe'); -$items = trigger_plugin_hook('get_items', 'example', $params, $default); +$items = elgg_trigger_plugin_hook('get_items', 'example', $params, $default);  var_dump($items); diff --git a/documentation/examples/hooks/register/advanced.php b/documentation/examples/hooks/register/advanced.php index 627bb5454..e3951c19c 100644 --- a/documentation/examples/hooks/register/advanced.php +++ b/documentation/examples/hooks/register/advanced.php @@ -1,20 +1,20 @@  <?php  // the output:page hook is triggered by elgg_view_page(). -register_plugin_hook('output', 'page', 'example_plugin_hook_handler', 600); -register_plugin_hook('output', 'page', 'example_plugin_hook_handler_2', 601); +elgg_register_plugin_hook_handler('output', 'page', 'example_plugin_hook_handler', 600); +elgg_register_plugin_hook_handler('output', 'page', 'example_plugin_hook_handler_2', 601);  function example_plugin_hook_handler($event, $type, $value, $params) {  	// change A to @  	$value = str_replace('A', '@', $value); -	 +  	return $value;  }  function example_plugin_hook_handler_2($event, $type, $value, $params) {  	// change S to $  	$value = str_replace('S', '$', $value); -	 +  	return $value;  } diff --git a/documentation/examples/hooks/register/all.php b/documentation/examples/hooks/register/all.php index 6c23ed56b..0ff19bc86 100644 --- a/documentation/examples/hooks/register/all.php +++ b/documentation/examples/hooks/register/all.php @@ -1,6 +1,6 @@  <?php -register_plugin_hook('all', 'system', 'example_plugin_hook_handler'); +elgg_register_plugin_hook_handler('all', 'system', 'example_plugin_hook_handler');  // This function will be called for any hook of type 'system'  function example_plugin_hook_handler($hook, $type, $value, $params) { diff --git a/documentation/examples/hooks/register/basic.php b/documentation/examples/hooks/register/basic.php index 4cedbf0fd..20493e200 100644 --- a/documentation/examples/hooks/register/basic.php +++ b/documentation/examples/hooks/register/basic.php @@ -1,6 +1,6 @@  <?php -register_plugin_hook('forward', 'system', 'example_plugin_hook_handler'); +elgg_register_plugin_hook_handler('forward', 'system', 'example_plugin_hook_handler');  function example_plugin_hook_handler($event, $type, $value, $params) {  	var_dump($event); diff --git a/documentation/examples/hooks/register/emit.php b/documentation/examples/hooks/register/emit.php index d0ea2c4ad..8382d72ca 100644 --- a/documentation/examples/hooks/register/emit.php +++ b/documentation/examples/hooks/register/emit.php @@ -1,7 +1,7 @@  <?php  // @todo this is an event, not a hook -register_elgg_event_handler('test', 'example', 'example_init_system_callback'); +elgg_register_event_handler('test', 'example', 'example_init_system_callback');  $params = new ElggObject(); -trigger_elgg_event('test', 'example', $params); +elgg_trigger_event('test', 'example', $params); diff --git a/documentation/examples/hooks/trigger/advanced.php b/documentation/examples/hooks/trigger/advanced.php index de33e7a10..5901a06e0 100644 --- a/documentation/examples/hooks/trigger/advanced.php +++ b/documentation/examples/hooks/trigger/advanced.php @@ -2,7 +2,7 @@  $default = array('Entry 1', 'Entry 2', 'Entry 3'); -$menu = trigger_plugin_hook('get_menu_items', 'menu', null, $default); +$menu = elgg_trigger_plugin_hook('get_menu_items', 'menu', null, $default);  foreach ($menu as $item) {  	var_dump($item); diff --git a/documentation/examples/hooks/trigger/basic.php b/documentation/examples/hooks/trigger/basic.php index a32bf9296..ea27a8a98 100644 --- a/documentation/examples/hooks/trigger/basic.php +++ b/documentation/examples/hooks/trigger/basic.php @@ -1,6 +1,6 @@  <?php -$result = trigger_plugin_hook('get_status', 'example', null, true); +$result = elgg_trigger_plugin_hook('get_status', 'example', null, true);  if ($result) {  	var_dump('Plugin hook says ok!'); diff --git a/documentation/stubs/config.php b/documentation/stubs/config.php index 67aab304d..86ba54e6d 100644 --- a/documentation/stubs/config.php +++ b/documentation/stubs/config.php @@ -11,8 +11,8 @@  /**   * Event information for the events subsystem.   * - * Events are added with {@link register_elgg_event_handler()} and - * can be removed in >= 1.8 with {@link unregister_elgg_event_handler()}. + * Events are added with {@link elgg_register_event_handler()} and + * can be removed in >= 1.8 with {@link elgg_unregister_event_handler()}.   *   * Events are stored as a multidimensional array in the format:   * <code> @@ -22,17 +22,17 @@   * @global array $CONFIG->events   * @name $CONFIG->events   * @see events() - * @see register_elgg_event_handler() - * @see unregister_elgg_event_handler() - * @see trigger_elgg_event() + * @see elgg_register_event_handler() + * @see elgg_unregister_event_handler() + * @see elgg_trigger_event()   */  $CONFIG->events;  /**   * Plugin Hook information for the plugin hooks subsystem.   * - * Hooks are added with {@link register_plugin_hook()} and - * can be removed in >= 1.8 with {@link unregister_plugin_hook()}. + * Hooks are added with {@link elgg_register_plugin_hook_handler()} and + * can be removed in >= 1.8 with {@link elgg_unregister_plugin_hook_handler()}.   *   * Hooks are stored as a multidimensional array in the format:   * <code> @@ -40,9 +40,9 @@ $CONFIG->events;   * </code>   *   * @global array $CONFIG->hooks - * @see register_plugin_hook() - * @see unregister_plugin_hook() - * @see trigger_plugin_hook() + * @see elgg_register_plugin_hook_handler() + * @see elgg_unregister_plugin_hook_handler() + * @see elgg_trigger_plugin_hook()   */  $CONFIG->hooks; diff --git a/engine/classes/ElggSession.php b/engine/classes/ElggSession.php index 1d59aaacc..8a3bed84a 100644 --- a/engine/classes/ElggSession.php +++ b/engine/classes/ElggSession.php @@ -70,7 +70,7 @@ class ElggSession implements ArrayAccess {  		}  		$value = NULL; -		$value = trigger_plugin_hook('session:get', $key, NULL, $value); +		$value = elgg_trigger_plugin_hook('session:get', $key, NULL, $value);  		ElggSession::$__localcache[$key] = $value; diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 0a4c48d8e..70ad395fe 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -321,7 +321,7 @@ class ElggSite extends ElggEntity {  		if ($CONFIG->walled_garden && !isloggedin()) {  			// hook into the index system call at the highest priority -			register_plugin_hook('index', 'system', 'elgg_walled_garden_index', 1); +			elgg_register_plugin_hook_handler('index', 'system', 'elgg_walled_garden_index', 1);  			if (!$this->isPublicPage()) {  				register_error(elgg_echo('loggedinrequired')); @@ -372,7 +372,7 @@ class ElggSite extends ElggEntity {  		);  		// include a hook for plugin authors to include public pages -		$plugins = trigger_plugin_hook('public_pages', 'walled_garden', NULL, array()); +		$plugins = elgg_trigger_plugin_hook('public_pages', 'walled_garden', NULL, array());  		// lookup admin-specific public pages diff --git a/engine/handlers/cron_handler.php b/engine/handlers/cron_handler.php index 939beeaf4..8ca8ac8a9 100644 --- a/engine/handlers/cron_handler.php +++ b/engine/handlers/cron_handler.php @@ -34,7 +34,7 @@ $std_out = "";  $old_stdout = "";  ob_start(); -$old_stdout = trigger_plugin_hook('cron', $period, $params, $old_stdout); +$old_stdout = elgg_trigger_plugin_hook('cron', $period, $params, $old_stdout);  $std_out = ob_get_clean();  // Return event 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 diff --git a/engine/start.php b/engine/start.php index 6a566b158..0ae24aaf5 100644 --- a/engine/start.php +++ b/engine/start.php @@ -120,14 +120,14 @@ set_default_config();  // Trigger boot events for core. Plugins can't hook  // into this because they haven't been loaded yet. -trigger_elgg_event('boot', 'system'); +elgg_trigger_event('boot', 'system');  // Load the plugins that are active  load_plugins(); -trigger_elgg_event('plugins_boot', 'system'); +elgg_trigger_event('plugins_boot', 'system');  // Trigger system init event for plugins -trigger_elgg_event('init', 'system'); +elgg_trigger_event('init', 'system');  // Regenerate the simple cache if expired.  // Don't do it on upgrade because upgrade does it itself. diff --git a/engine/tests/suite.php b/engine/tests/suite.php index 23637b9b1..de344ec17 100644 --- a/engine/tests/suite.php +++ b/engine/tests/suite.php @@ -18,8 +18,8 @@ require_once("$vendor_path/reporter.php");  require_once("$test_path/elgg_unit_test.php");  // turn off system log -unregister_elgg_event_handler('all', 'all', 'system_log_listener'); -unregister_elgg_event_handler('log', 'systemlog', 'system_log_default_logger'); +elgg_unregister_event_handler('all', 'all', 'system_log_listener'); +elgg_unregister_event_handler('log', 'systemlog', 'system_log_default_logger');  // Disable maximum execution time.  // Tests take a while... @@ -28,7 +28,7 @@ set_time_limit(0);  $suite = new TestSuite('Elgg Core Unit Tests');  // emit a hook to pull in all tests -$test_files = trigger_plugin_hook('unit_test', 'system', null, array()); +$test_files = elgg_trigger_plugin_hook('unit_test', 'system', null, array());  foreach ($test_files as $file) {  	$suite->addTestFile($file);  } diff --git a/engine/tests/test_skeleton.php b/engine/tests/test_skeleton.php index f26e0f6f9..e5ff557e5 100644 --- a/engine/tests/test_skeleton.php +++ b/engine/tests/test_skeleton.php @@ -5,7 +5,7 @@   * Plugin authors: copy this file to your plugin's test directory. Register an Elgg   * plugin hook and function similar to:   * - * register_plugin_hook('unit_test', 'system', 'my_new_unit_test'); + * elgg_register_plugin_hook_handler('unit_test', 'system', 'my_new_unit_test');   *   * function my_new_unit_test($hook, $type, $value, $params) {   *   $value[] = "path/to/my/unit_test.php"; @@ -11,7 +11,7 @@   */  require_once(dirname(__FILE__) . "/engine/start.php"); -if (!trigger_plugin_hook('index', 'system', null, FALSE)) { +if (!elgg_trigger_plugin_hook('index', 'system', null, FALSE)) {  	if (isloggedin()) {  		forward('pg/dashboard/');  	} diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php index 46c2309d5..de2cccf58 100644 --- a/install/ElggInstaller.php +++ b/install/ElggInstaller.php @@ -718,7 +718,7 @@ class ElggInstaller {  			// install has its own session handling before the db created and set up  			session_name('Elgg');  			session_start(); -			unregister_elgg_event_handler('boot', 'system', 'session_init'); +			elgg_unregister_event_handler('boot', 'system', 'session_init');  		}  		if ($stepIndex > $dbIndex) { @@ -757,8 +757,8 @@ class ElggInstaller {  			set_default_config(); -			trigger_elgg_event('boot', 'system'); -			trigger_elgg_event('init', 'system'); +			elgg_trigger_event('boot', 'system'); +			elgg_trigger_event('init', 'system');  		}  	} diff --git a/mod/blog/start.php b/mod/blog/start.php index 386870fd4..92ddf65c8 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -30,17 +30,17 @@ function blog_init() {  	elgg_extend_view('css', 'blog/css'); -	register_elgg_event_handler('pagesetup', 'system', 'blog_page_setup'); +	elgg_register_event_handler('pagesetup', 'system', 'blog_page_setup');  	register_page_handler('blog', 'blog_page_handler');  	register_entity_url_handler('blog_url_handler', 'object', 'blog');  	// notifications  	register_notification_object('object', 'blog', elgg_echo('blog:newpost')); -	register_plugin_hook('notify:entity:message', 'object', 'blog_notify_message'); +	elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'blog_notify_message');  	// pingbacks -	//register_elgg_event_handler('create', 'object', 'blog_incoming_ping'); -	//register_plugin_hook('pingback:object:subtypes', 'object', 'blog_pingback_subtypes'); +	//elgg_register_event_handler('create', 'object', 'blog_incoming_ping'); +	//elgg_register_plugin_hook_handler('pingback:object:subtypes', 'object', 'blog_pingback_subtypes');  	// Register for search.  	register_entity_type('object', 'blog'); @@ -54,10 +54,10 @@ function blog_init() {  	register_action('blog/delete', FALSE, "$action_path/delete.php");  	// ecml -	register_plugin_hook('get_views', 'ecml', 'blog_ecml_views_hook'); +	elgg_register_plugin_hook_handler('get_views', 'ecml', 'blog_ecml_views_hook');  	// Register profile menu hook -	register_plugin_hook('profile_menu', 'profile', 'blog_profile_menu'); +	elgg_register_plugin_hook_handler('profile_menu', 'profile', 'blog_profile_menu');  }  /** @@ -204,4 +204,4 @@ function blog_profile_menu($hook, $entity_type, $return_value, $params) {  	return $return_value;  } -register_elgg_event_handler('init', 'system', 'blog_init'); +elgg_register_event_handler('init', 'system', 'blog_init'); diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 808f88ede..b0a2369d3 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -25,7 +25,7 @@ function bookmarks_init() {  	}  	// Listen to notification events and supply a more useful message -	register_plugin_hook('notify:entity:message', 'object', 'bookmarks_notify_message'); +	elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'bookmarks_notify_message');  	// Register a URL handler for shared items  	register_entity_url_handler('bookmark_url','object','bookmarks'); @@ -43,7 +43,7 @@ function bookmarks_init() {  	elgg_extend_view('groups/tool_latest','bookmarks/group_bookmarks');  	// Register profile menu hook -	register_plugin_hook('profile_menu', 'profile', 'bookmarks_profile_menu'); +	elgg_register_plugin_hook_handler('profile_menu', 'profile', 'bookmarks_profile_menu');  }  /** @@ -327,8 +327,8 @@ function bookmarks_profile_menu($hook, $entity_type, $return_value, $params) {  }  // Make sure the initialisation function is called on initialisation -register_elgg_event_handler('init','system','bookmarks_init'); -register_elgg_event_handler('pagesetup','system','bookmarks_pagesetup'); +elgg_register_event_handler('init','system','bookmarks_init'); +elgg_register_event_handler('pagesetup','system','bookmarks_pagesetup');  // Register actions  global $CONFIG; diff --git a/mod/captcha/start.php b/mod/captcha/start.php index 0c3f17c60..3458e02a5 100644 --- a/mod/captcha/start.php +++ b/mod/captcha/start.php @@ -21,15 +21,15 @@ function captcha_init() {  	$CONFIG->captcha_length = 5;  	// Register a function that provides some default override actions -	register_plugin_hook('actionlist', 'captcha', 'captcha_actionlist_hook'); +	elgg_register_plugin_hook_handler('actionlist', 'captcha', 'captcha_actionlist_hook');  	// Register actions to intercept  	$actions = array(); -	$actions = trigger_plugin_hook('actionlist', 'captcha', NULL, $actions); +	$actions = elgg_trigger_plugin_hook('actionlist', 'captcha', NULL, $actions);  	if (($actions) && (is_array($actions))) {  		foreach ($actions as $action) { -			register_plugin_hook("action", $action, "captcha_verify_action_hook"); +			elgg_register_plugin_hook_handler("action", $action, "captcha_verify_action_hook");  		}  	}  } @@ -133,4 +133,4 @@ function captcha_actionlist_hook($hook, $entity_type, $returnvalue, $params) {  	return $returnvalue;  } -register_elgg_event_handler('init', 'system', 'captcha_init'); +elgg_register_event_handler('init', 'system', 'captcha_init'); diff --git a/mod/categories/start.php b/mod/categories/start.php index 35406459a..b717294f7 100644 --- a/mod/categories/start.php +++ b/mod/categories/start.php @@ -19,8 +19,8 @@ function categories_init() {  	register_page_handler('categories', 'categories_page_handler'); -	register_elgg_event_handler('update','all','categories_save'); -	register_elgg_event_handler('create','all','categories_save'); +	elgg_register_event_handler('update','all','categories_save'); +	elgg_register_event_handler('create','all','categories_save');  } @@ -73,4 +73,4 @@ function categories_on_disable() {  	elgg_delete_admin_notice('categories_admin_notice_no_categories');  } -register_elgg_event_handler('init','system','categories_init');
\ No newline at end of file +elgg_register_event_handler('init','system','categories_init');
\ No newline at end of file diff --git a/mod/crontrigger/start.php b/mod/crontrigger/start.php index 93d72de46..379fe1978 100644 --- a/mod/crontrigger/start.php +++ b/mod/crontrigger/start.php @@ -16,10 +16,10 @@  	 */  	function crontrigger_init()  	{ -		register_elgg_event_handler('shutdown', 'system', 'crontrigger_shutdownhook'); +		elgg_register_event_handler('shutdown', 'system', 'crontrigger_shutdownhook');  	} -	function crontrigger_trigger($period) { trigger_plugin_hook('cron', $period); } +	function crontrigger_trigger($period) { elgg_trigger_plugin_hook('cron', $period); }  	function crontrigger_minute() { crontrigger_trigger('minute'); } @@ -76,5 +76,5 @@  	// Initialise plugin -	register_elgg_event_handler('init','system','crontrigger_init'); +	elgg_register_event_handler('init','system','crontrigger_init');  ?>
\ No newline at end of file diff --git a/mod/defaultwidgets/start.php b/mod/defaultwidgets/start.php index 2e52f78be..9e86a1625 100644 --- a/mod/defaultwidgets/start.php +++ b/mod/defaultwidgets/start.php @@ -3,12 +3,12 @@   * Elgg default_widgets plugin.   *   * @package DefaultWidgets - *  + *   * Code based on the work of:   * @link http://www.tastyseed.com   * @link http://www.chadsowald.com   * @links http://www.somosmas.org - *  + *   */  global $CONFIG; @@ -17,7 +17,7 @@ global $CONFIG;   * Default widgets initialisation   *   * These parameters are required for the event API, but we won't use them: - *  + *   * @param unknown_type $event   * @param unknown_type $object_type   * @param unknown_type $object @@ -25,12 +25,12 @@ global $CONFIG;  function defaultwidgets_init() {  	// register create user event hook  	register_elgg_event_handler ( 'create', 'user', 'defaultwidgets_newusers' ); -	 +  	// set the widget access to the default access on validation if this is not an admin-created user  	if (!isadminloggedin()) { -		register_elgg_event_handler('validate', 'user', 'defaultwidgets_reset_access'); +		elgg_register_event_handler('validate', 'user', 'defaultwidgets_reset_access');  	} -	 +  	// @todo These submenu pages should be DRYed up  	elgg_add_admin_submenu_item('default_profile_widgets', elgg_echo('defaultwidgets:menu:profile'), 'appearance');  	elgg_add_admin_submenu_item('default_dashboard_widgets', elgg_echo('defaultwidgets:menu:dashboard'), 'appearance'); @@ -38,11 +38,11 @@ function defaultwidgets_init() {  /**   * Overrides default permissions for the default widgets context - *  + *   */  function defaultwidgets_can_edit($hook_name, $entity_type, $return_value, $parameters) {  	global $defaultwidget_access; -	 +  	if ($defaultwidget_access) {  		return true;  	} @@ -55,7 +55,7 @@ function defaultwidgets_can_edit($hook_name, $entity_type, $return_value, $param   */  function defaultwidgets_can_edit_metadata($hook_name, $entity_type, $return_value, $parameters) {  	global $defaultwidget_access; -	 +  	if ($defaultwidget_access) {  		return true;  	} @@ -69,7 +69,7 @@ function defaultwidgets_can_edit_metadata($hook_name, $entity_type, $return_valu   */  function defaultwidgets_can_edit_container($hook_name, $entity_type, $return_value, $parameters) {  	global $defaultwidget_access; -	 +  	if ($defaultwidget_access) {  		return true;  	} @@ -80,14 +80,14 @@ function defaultwidgets_can_edit_container($hook_name, $entity_type, $return_val   * Extends the create user event to add admin defined widgets to the dashboard/profile context   */  function defaultwidgets_newusers($event, $object_type, $object) { -	 +  	// turn on permissions override  	global $defaultwidget_access, $CONFIG;  	$defaultwidget_access = true; -	 +  	// get the new user guid  	$guid = $object->guid; -	 +  	if (isadminloggedin()) {  		// this is an admin-created user  		// no permissions problems, so set proper access now @@ -99,37 +99,37 @@ function defaultwidgets_newusers($event, $object_type, $object) {  		// to avoid Elgg permissions problems  		$widget_access = ACCESS_PUBLIC;  	} -	 +  	// check if it's set  	if (! empty ( $guid )) { -		 +  		// get the user entity  		if ($user = get_entity ( $guid )) { -			 +  			// can this user edit  			if ($user->canEdit ()) { -				 +  				// each of the contexts to add widgets for  				$contexts = array ('profile', 'dashboard' ); -				 +  				// get the entities for the module  				$entities = elgg_get_entities (array('type' => 'object', 'subtype' => 'moddefaultwidgets', 'limit' => 9999)); -				 +  				// check if the entity exists  				if (isset ( $entities [0] )) { -					 +  					// get the widgets for the context  					$entity = $entities [0]; -					 +  					foreach ( $contexts as $context ) {  						$current_widgets = $entity->$context;  						list ( $left, $middle, $right ) = split ( '%%', $current_widgets ); -						 +  						// split columns into seperate widgets  						$area1widgets = split ( '::', $left );  						$area2widgets = split ( '::', $middle );  						$area3widgets = split ( '::', $right ); -						 +  						// clear out variables if no widgets are available  						if ($area1widgets [0] == "")  							$area1widgets = false; @@ -137,21 +137,21 @@ function defaultwidgets_newusers($event, $object_type, $object) {  							$area2widgets = false;  						if ($area3widgets [0] == "")  							$area3widgets = false; -							 -						// generate left column widgets for a new user  + +						// generate left column widgets for a new user  						if ($area1widgets) {  							foreach ( $area1widgets as $i => $widget ) {  								add_widget ( $guid, $widget, $context, ($i + 1), 1, $widget_access );  							}  						} -						 +  						// generate middle column widgets for a new user  						if ($area2widgets) {  							foreach ( $area2widgets as $i => $widget ) {  								add_widget ( $guid, $widget, $context, ($i + 1), 2, $widget_access );  							}  						} -						 +  						// generate right column widgets for a new user  						if ($area3widgets) {  							foreach ( $area3widgets as $i => $widget ) { @@ -163,45 +163,45 @@ function defaultwidgets_newusers($event, $object_type, $object) {  			}  		}  	} -	 +  	// turn off permissions override  	$defaultwidget_access = false;  }  function defaultwidgets_reset_access($event, $object_type, $object) { -	 +  	global $defaultwidget_access; -	 +  	// turn on permissions override  	$defaultwidget_access = true; -	 +  	// the widgets are disabled, so turn on the ability to see disabled entities -	 +  	$access_status = access_get_show_hidden_status();  	access_show_hidden_entities(true); -	 +  	$widgets = elgg_get_entities(array('type' => 'object', 'subtype' => 'widget', 'owner_guid' => $object->getGUID())); -	 +  	if ($widgets) {  		foreach($widgets as $widget) {  			$widget->access_id = get_default_access();  			$widget->save();  		}  	} -	 +  	access_show_hidden_entities($access_status); -	 +  	// turn off permissions override  	$defaultwidget_access = false; -	 +  	return true;  }  // Make sure the status initialisation function is called on initialisation -register_elgg_event_handler ( 'init', 'system', 'defaultwidgets_init' ); +elgg_register_event_handler('init', 'system', 'defaultwidgets_init'); -register_plugin_hook ( 'permissions_check', 'user', 'defaultwidgets_can_edit' ); -register_plugin_hook ( 'permissions_check', 'object', 'defaultwidgets_can_edit' ); -register_plugin_hook ( 'container_permissions_check', 'user', 'defaultwidgets_can_edit_container' ); +elgg_register_plugin_hook_handler('permissions_check', 'user', 'defaultwidgets_can_edit'); +elgg_register_plugin_hook_handler('permissions_check', 'object', 'defaultwidgets_can_edit'); +elgg_register_plugin_hook_handler('container_permissions_check', 'user', 'defaultwidgets_can_edit_container'); -register_action ( "defaultwidgets/update", false, $CONFIG->pluginspath . "defaultwidgets/actions/update.php" ); +register_action("defaultwidgets/update", false, $CONFIG->pluginspath . "defaultwidgets/actions/update.php"); diff --git a/mod/diagnostics/actions/download.php b/mod/diagnostics/actions/download.php index d429f2592..3c096eb0a 100644 --- a/mod/diagnostics/actions/download.php +++ b/mod/diagnostics/actions/download.php @@ -8,7 +8,7 @@  	admin_gatekeeper();  	$output = elgg_echo('diagnostics:header', array(date('r'), get_loggedin_user()->name)); -	$output = trigger_plugin_hook('diagnostics:report', 'system', null, $output); +	$output = elgg_trigger_plugin_hook('diagnostics:report', 'system', null, $output);  	header("Cache-Control: public");  	header("Content-Description: File Transfer"); diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 46a5e9e10..8895a2eec 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -181,13 +181,13 @@ function diagnostics_globals_hook($hook, $entity_type, $returnvalue, $params)  }  // Initialise log browser -register_elgg_event_handler('init','system','diagnostics_init'); -register_elgg_event_handler('pagesetup','system','diagnostics_pagesetup'); +elgg_register_event_handler('init','system','diagnostics_init'); +elgg_register_event_handler('pagesetup','system','diagnostics_pagesetup'); -register_plugin_hook("diagnostics:report", "system", "diagnostics_basic_hook", 0); // show basics first -register_plugin_hook("diagnostics:report", "system", "diagnostics_plugins_hook", 2); // Now the plugins -register_plugin_hook("diagnostics:report", "system", "diagnostics_sigs_hook", 1); // Now the signatures +elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_basic_hook", 0); // show basics first +elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_plugins_hook", 2); // Now the plugins +elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_sigs_hook", 1); // Now the signatures -register_plugin_hook("diagnostics:report", "system", "diagnostics_globals_hook"); // Global variables -register_plugin_hook("diagnostics:report", "system", "diagnostics_phpinfo_hook"); // PHP info +elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_globals_hook"); // Global variables +elgg_register_plugin_hook_handler("diagnostics:report", "system", "diagnostics_phpinfo_hook"); // PHP info  ?>
\ No newline at end of file diff --git a/mod/ecml/ecml_functions.php b/mod/ecml/ecml_functions.php index 938d003f2..75839aec4 100644 --- a/mod/ecml/ecml_functions.php +++ b/mod/ecml/ecml_functions.php @@ -267,7 +267,7 @@ function ecml_get_keywords($recache = FALSE) {  		return $CONFIG->ecml_keywords;  	} -	$keywords = trigger_plugin_hook('get_keywords', 'ecml', NULL, array()); +	$keywords = elgg_trigger_plugin_hook('get_keywords', 'ecml', NULL, array());  	$CONFIG->ecml_keywords = $keywords;  	return $keywords;  } diff --git a/mod/ecml/start.php b/mod/ecml/start.php index 14031aac4..82bea88ae 100644 --- a/mod/ecml/start.php +++ b/mod/ecml/start.php @@ -45,25 +45,25 @@ function ecml_init() {  	//elgg_extend_view('input/text', 'ecml/input_ext');  	// add parsing for core views. -	register_plugin_hook('get_views', 'ecml', 'ecml_views_hook'); +	elgg_register_plugin_hook_handler('get_views', 'ecml', 'ecml_views_hook');  	// get register the views we want to parse for ecml  	// @todo will need to do profiling to see if it would be faster  	// to foreach through this list and register to specific views or  	// do the check in a single plugin hook.  	// Wants array('view_name' => 'Short Description') -	$CONFIG->ecml_parse_views = trigger_plugin_hook('get_views', 'ecml', NULL, array()); +	$CONFIG->ecml_parse_views = elgg_trigger_plugin_hook('get_views', 'ecml', NULL, array());  	foreach ($CONFIG->ecml_parse_views as $view => $desc) { -		register_plugin_hook('view', $view, 'ecml_parse_view'); +		elgg_register_plugin_hook_handler('view', $view, 'ecml_parse_view');  	}  	// provide a few built-in ecml keywords.  	// @todo could pull this out into an array here to save an API call. -	register_plugin_hook('get_keywords', 'ecml', 'ecml_keyword_hook'); +	elgg_register_plugin_hook_handler('get_keywords', 'ecml', 'ecml_keyword_hook');  	// grab the list of keywords and their views from plugins -	$CONFIG->ecml_keywords = trigger_plugin_hook('get_keywords', 'ecml', NULL, array()); +	$CONFIG->ecml_keywords = elgg_trigger_plugin_hook('get_keywords', 'ecml', NULL, array());  	// grab permissions for specific views/contexts  	// this is a black list. @@ -73,10 +73,10 @@ function ecml_init() {  	$CONFIG->ecml_permissions = unserialize(get_plugin_setting('ecml_permissions', 'ecml'));  	// 3rd party media embed section -	register_plugin_hook('embed_get_sections', 'all', 'ecml_embed_web_services_hook'); +	elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'ecml_embed_web_services_hook');  	// remove ecml when stripping tags -	register_plugin_hook('format', 'strip_tags', 'ecml_strip_tags'); +	elgg_register_plugin_hook_handler('format', 'strip_tags', 'ecml_strip_tags');  }  /** @@ -295,4 +295,4 @@ function ecml_strip_tags($hook, $type, $value, $params) {  }  // be sure to run after other plugins -register_elgg_event_handler('init', 'system', 'ecml_init', 9999);
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'ecml_init', 9999);
\ No newline at end of file diff --git a/mod/embed/start.php b/mod/embed/start.php index b3a6a3feb..5a7076c34 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -44,8 +44,8 @@ function embed_page_handler($page) {  			// default to embed/listing | item if not found.  			// @todo trigger for all right now. If we categorize these later we can trigger  			// for certain categories. -			$sections = trigger_plugin_hook('embed_get_sections', 'all', NULL, array()); -			$upload_sections = trigger_plugin_hook('embed_get_upload_sections', 'all', NULL, array());  +			$sections = elgg_trigger_plugin_hook('embed_get_sections', 'all', NULL, array()); +			$upload_sections = elgg_trigger_plugin_hook('embed_get_upload_sections', 'all', NULL, array());   			elgg_sort_3d_array_by_value($sections, 'name');  			elgg_sort_3d_array_by_value($upload_sections, 'name'); @@ -66,4 +66,4 @@ function embed_page_handler($page) {  	exit;  } -register_elgg_event_handler('init', 'system', 'embed_init');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'embed_init');
\ No newline at end of file diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php index 583ea71e5..2855a5576 100644 --- a/mod/embed/views/default/embed/embed.php +++ b/mod/embed/views/default/embed/embed.php @@ -74,7 +74,7 @@ if (!$sections) {  		if ($section_content = elgg_view("embed/$active_section/content", $params)) {  			// handles its own pagination  			$content .= $section_content; -		} elseif ($embed_info = trigger_plugin_hook('embed_get_items', $active_section, $params, array('items' => array(), 'count' => 0))) { +		} elseif ($embed_info = elgg_trigger_plugin_hook('embed_get_items', $active_section, $params, array('items' => array(), 'count' => 0))) {  			// check if we have an override for this section type.  			$view = "embed/$active_section/item/$layout"; diff --git a/mod/file/start.php b/mod/file/start.php index 64e890626..78790d034 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -51,7 +51,7 @@  		}  		// Listen to notification events and supply a more useful message -		register_plugin_hook('notify:entity:message', 'object', 'file_notify_message'); +		elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'file_notify_message');  		// add the group files tool option  		add_group_tool_option('file',elgg_echo('groups:enablefiles'),true); @@ -60,9 +60,9 @@  		register_entity_type('object','file');  		// embed support -		register_plugin_hook('embed_get_sections', 'all', 'file_embed_get_sections'); -		register_plugin_hook('embed_get_items', 'file', 'file_embed_get_items'); -		register_plugin_hook('embed_get_upload_sections', 'all', 'file_embed_get_upload_sections'); +		elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'file_embed_get_sections'); +		elgg_register_plugin_hook_handler('embed_get_items', 'file', 'file_embed_get_items'); +		elgg_register_plugin_hook_handler('embed_get_upload_sections', 'all', 'file_embed_get_upload_sections');  	} @@ -297,8 +297,8 @@  		}  	// Make sure test_init is called on initialisation -	register_elgg_event_handler('init','system','file_init'); -	register_elgg_event_handler('pagesetup','system','file_submenus'); +	elgg_register_event_handler('init','system','file_init'); +	elgg_register_event_handler('pagesetup','system','file_submenus');  	// Register actions  	register_action("file/upload", false, $CONFIG->pluginspath . "file/actions/upload.php"); diff --git a/mod/friends/start.php b/mod/friends/start.php index b936477b2..fe6a40c75 100644 --- a/mod/friends/start.php +++ b/mod/friends/start.php @@ -11,4 +11,4 @@ function friends_init() {  	add_widget_type('friends', elgg_echo("friends"), elgg_echo('friends:widget:description'));  } -register_elgg_event_handler('init', 'system', 'friends_init'); +elgg_register_event_handler('init', 'system', 'friends_init'); diff --git a/mod/garbagecollector/start.php b/mod/garbagecollector/start.php index e3f8c030f..26a462207 100644 --- a/mod/garbagecollector/start.php +++ b/mod/garbagecollector/start.php @@ -22,7 +22,7 @@  		}  		// Register cron hook -		register_plugin_hook('cron', $period, 'garbagecollector_cron'); +		elgg_register_plugin_hook_handler('cron', $period, 'garbagecollector_cron');  	}  	/** @@ -48,7 +48,7 @@  		// Now, because we are nice, trigger a plugin hook to let other plugins do some GC  		$rv = true;  		$period = get_plugin_setting('period','garbagecollector'); -		trigger_plugin_hook('gc', 'system', array('period' => $period)); +		elgg_trigger_plugin_hook('gc', 'system', array('period' => $period));  		// Now we optimize all tables  		$tables = get_db_tables(); @@ -67,5 +67,5 @@  	}  	// Initialise plugin -	register_elgg_event_handler('init','system','garbagecollector_init'); +	elgg_register_event_handler('init','system','garbagecollector_init');  ?>
\ No newline at end of file diff --git a/mod/groups/start.php b/mod/groups/start.php index 8e5befb74..3e9f228ed 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -52,30 +52,30 @@  		elgg_extend_view('css','groups/css');  		// Access permissions -		register_plugin_hook('access:collections:write', 'all', 'groups_write_acl_plugin_hook'); -		//register_plugin_hook('access:collections:read', 'all', 'groups_read_acl_plugin_hook'); +		elgg_register_plugin_hook_handler('access:collections:write', 'all', 'groups_write_acl_plugin_hook'); +		//elgg_register_plugin_hook_handler('access:collections:read', 'all', 'groups_read_acl_plugin_hook');  		// Notification hooks  		if (is_callable('register_notification_object'))  			register_notification_object('object', 'groupforumtopic', elgg_echo('groupforumtopic:new')); -		register_plugin_hook('object:notifications','object','group_object_notifications_intercept'); +		elgg_register_plugin_hook_handler('object:notifications','object','group_object_notifications_intercept');  		// Listen to notification events and supply a more useful message -		register_plugin_hook('notify:entity:message', 'object', 'groupforumtopic_notify_message'); +		elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'groupforumtopic_notify_message');  		// add the forum tool option  		add_group_tool_option('forum',elgg_echo('groups:enableforum'),true);  		// Now override icons -		register_plugin_hook('entity:icon:url', 'group', 'groups_groupicon_hook'); +		elgg_register_plugin_hook_handler('entity:icon:url', 'group', 'groups_groupicon_hook');  		// Register profile menu hook -		register_plugin_hook('profile_menu', 'profile', 'forum_profile_menu'); -		register_plugin_hook('profile_menu', 'profile', 'activity_profile_menu'); +		elgg_register_plugin_hook_handler('profile_menu', 'profile', 'forum_profile_menu'); +		elgg_register_plugin_hook_handler('profile_menu', 'profile', 'activity_profile_menu');  		// allow ecml in discussion and profiles -		register_plugin_hook('get_views', 'ecml', 'groups_ecml_views_hook'); -		register_plugin_hook('get_views', 'ecml', 'groupprofile_ecml_views_hook'); +		elgg_register_plugin_hook_handler('get_views', 'ecml', 'groups_ecml_views_hook'); +		elgg_register_plugin_hook_handler('get_views', 'ecml', 'groupprofile_ecml_views_hook');  	} @@ -179,7 +179,7 @@  			//'website' => 'url',  		); -		$CONFIG->group = trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults); +		$CONFIG->group = elgg_trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults);  		// register any tag metadata names  		foreach ($CONFIG->group as $name => $type) { @@ -623,18 +623,18 @@  	register_extender_url_handler('group_topicpost_url','annotation', 'group_topic_post');  	// Register a handler for create groups -	register_elgg_event_handler('create', 'group', 'groups_create_event_listener'); +	elgg_register_event_handler('create', 'group', 'groups_create_event_listener');  	// Register a handler for delete groups -	register_elgg_event_handler('delete', 'group', 'groups_delete_event_listener'); +	elgg_register_event_handler('delete', 'group', 'groups_delete_event_listener');  	// Make sure the groups initialisation function is called on initialisation -	register_elgg_event_handler('init','system','groups_init'); -	register_elgg_event_handler('init','system','groups_fields_setup', 10000); // Ensure this runs after other plugins -	register_elgg_event_handler('join','group','groups_user_join_event_listener'); -	register_elgg_event_handler('leave','group','groups_user_leave_event_listener'); -	register_elgg_event_handler('pagesetup','system','groups_submenus'); -	register_elgg_event_handler('annotate','all','group_object_notifications'); +	elgg_register_event_handler('init','system','groups_init'); +	elgg_register_event_handler('init','system','groups_fields_setup', 10000); // Ensure this runs after other plugins +	elgg_register_event_handler('join','group','groups_user_join_event_listener'); +	elgg_register_event_handler('leave','group','groups_user_leave_event_listener'); +	elgg_register_event_handler('pagesetup','system','groups_submenus'); +	elgg_register_event_handler('annotate','all','group_object_notifications');  	// Register actions  	global $CONFIG; diff --git a/mod/htmlawed/start.php b/mod/htmlawed/start.php index 0c5ab6ab0..04c363968 100644 --- a/mod/htmlawed/start.php +++ b/mod/htmlawed/start.php @@ -23,7 +23,7 @@ function htmlawed_init() {  			//. 'style:color,cursor,text-align,font-size,font-weight,font-style,border,margin,padding,float'  	); -	register_plugin_hook('validate', 'input', 'htmlawed_filter_tags', 1); +	elgg_register_plugin_hook_handler('validate', 'input', 'htmlawed_filter_tags', 1);  }  /** @@ -79,7 +79,7 @@ function htmlawed_hook($element, $attribute_array) {  	if ($string = trim($string)) {  		$string = " $string";  	} -	 +  	$r = "<$element$string>";  	return $r;  } @@ -104,7 +104,7 @@ function htmlawed_filter_tags($hook, $entity_type, $returnvalue, $params) {  			$return = "";  			$return = htmLawed($var, $htmlawed_config);  		} else { -			 +  			array_walk_recursive($var, 'htmLawedArray', $htmlawed_config);  			$return = $var; @@ -123,4 +123,4 @@ function htmLawedArray(&$v, $k, $htmlawed_config) { -register_elgg_event_handler('init', 'system', 'htmlawed_init'); +elgg_register_event_handler('init', 'system', 'htmlawed_init'); diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index 19a4c4b55..1ad1d3ca1 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -18,4 +18,4 @@ function invitefriends_pagesetup() {  }  register_action('invitefriends/invite', false, $CONFIG->pluginspath . 'invitefriends/actions/invite.php'); -register_elgg_event_handler('pagesetup', 'system', 'invitefriends_pagesetup'); +elgg_register_event_handler('pagesetup', 'system', 'invitefriends_pagesetup'); diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index 0ed7275a4..70f0c89f8 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -24,4 +24,4 @@ function logbrowser_init() {  }  // Initialise log browser -register_elgg_event_handler('init','system','logbrowser_init'); +elgg_register_event_handler('init','system','logbrowser_init'); diff --git a/mod/logrotate/start.php b/mod/logrotate/start.php index cc2d19b0a..485f53f49 100644 --- a/mod/logrotate/start.php +++ b/mod/logrotate/start.php @@ -22,7 +22,7 @@  		}  		// Register cron hook -		register_plugin_hook('cron', $period, 'logrotate_cron'); +		elgg_register_plugin_hook_handler('cron', $period, 'logrotate_cron');  	}  	/** @@ -52,5 +52,5 @@  	}  	// Initialise plugin -	register_elgg_event_handler('init','system','logrotate_init'); +	elgg_register_event_handler('init','system','logrotate_init');  ?>
\ No newline at end of file diff --git a/mod/members/index.php b/mod/members/index.php index 221df7685..5a461d5e8 100644 --- a/mod/members/index.php +++ b/mod/members/index.php @@ -61,7 +61,7 @@ switch($filter){  		$options['type'] = "user";  		$options['offset'] = $offset;  		$options['limit'] = $limit; -		$results = trigger_plugin_hook('search', 'tags', $options, array()); +		$results = elgg_trigger_plugin_hook('search', 'tags', $options, array());  		$count = $results['count'];  		$users = $results['entities'];  		$filter_content = elgg_view_entity_list($users, $count, $offset, $limit, false, false, true); diff --git a/mod/members/start.php b/mod/members/start.php index 395922219..53f4f3753 100644 --- a/mod/members/start.php +++ b/mod/members/start.php @@ -11,5 +11,5 @@ function members_init() {  }  // @todo - use page handler for members index -register_elgg_event_handler('pagesetup','system','members_pagesetup'); -register_elgg_event_handler('init','system','members_init');
\ No newline at end of file +elgg_register_event_handler('pagesetup','system','members_pagesetup'); +elgg_register_event_handler('init','system','members_init');
\ No newline at end of file diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php index f97e77999..0cd546573 100644 --- a/mod/messageboard/start.php +++ b/mod/messageboard/start.php @@ -85,7 +85,7 @@ function messageboard_add($poster, $owner, $message, $access_id = ACCESS_PUBLIC)  // Register initialisation callback -register_elgg_event_handler('init', 'system', 'messageboard_init'); +elgg_register_event_handler('init', 'system', 'messageboard_init');  // Register actions  register_action("messageboard/add", FALSE, $CONFIG->pluginspath . "messageboard/actions/add.php"); diff --git a/mod/messages/start.php b/mod/messages/start.php index 7f5f2c647..027003284 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -44,14 +44,14 @@ function messages_init() {  	// Register a notification handler for site messages  		register_notification_handler("site", "messages_site_notify_handler"); -		register_plugin_hook('notify:entity:message','object','messages_notification_msg'); +		elgg_register_plugin_hook_handler('notify:entity:message','object','messages_notification_msg');  		register_notification_object('object','messages',elgg_echo('messages:new'));  	// Override metadata permissions -		register_plugin_hook('permissions_check:metadata','object','messages_can_edit_metadata'); +		elgg_register_plugin_hook_handler('permissions_check:metadata','object','messages_can_edit_metadata');  	// ecml -	register_plugin_hook('get_views', 'ecml', 'messages_ecml_views_hook'); +	elgg_register_plugin_hook_handler('get_views', 'ecml', 'messages_ecml_views_hook');  } @@ -317,10 +317,10 @@ function messages_ecml_views_hook($hook, $entity_type, $return_value, $params) {  // Make sure the messages initialisation function is called on initialisation -register_elgg_event_handler('init','system','messages_init'); +elgg_register_event_handler('init','system','messages_init'); -register_plugin_hook('permissions_check','object','messages_can_edit'); -register_plugin_hook('container_permissions_check','object','messages_can_edit_container'); +elgg_register_plugin_hook_handler('permissions_check','object','messages_can_edit'); +elgg_register_plugin_hook_handler('container_permissions_check','object','messages_can_edit_container');  // Register actions  global $CONFIG; diff --git a/mod/notifications/start.php b/mod/notifications/start.php index d98c475d3..093b49b0f 100644 --- a/mod/notifications/start.php +++ b/mod/notifications/start.php @@ -14,19 +14,19 @@ function notifications_plugin_init() {  	register_page_handler('notifications', 'notifications_page_handler'); -	register_elgg_event_handler('pagesetup', 'system', 'notifications_plugin_pagesetup'); +	elgg_register_event_handler('pagesetup', 'system', 'notifications_plugin_pagesetup');  	// Unset the default notification settings -	unregister_plugin_hook('usersettings:save', 'user', 'notification_user_settings_save'); +	elgg_unregister_plugin_hook_handler('usersettings:save', 'user', 'notification_user_settings_save');  	elgg_unextend_view('usersettings/user', 'notifications/settings/usersettings');  	// update notifications based on relationships changing -	register_elgg_event_handler('delete', 'member', 'notifications_relationship_remove'); -	register_elgg_event_handler('delete', 'friend', 'notifications_relationship_remove'); +	elgg_register_event_handler('delete', 'member', 'notifications_relationship_remove'); +	elgg_register_event_handler('delete', 'friend', 'notifications_relationship_remove');  	// update notifications when new friend or access collection membership -	register_elgg_event_handler('create', 'friend', 'notifications_update_friend_notify'); -	register_plugin_hook('access:collections:add_user', 'collection', 'notifications_update_collection_notify'); +	elgg_register_event_handler('create', 'friend', 'notifications_update_friend_notify'); +	elgg_register_plugin_hook_handler('access:collections:add_user', 'collection', 'notifications_update_collection_notify');  }  /** @@ -172,7 +172,7 @@ function notifications_update_collection_notify($event, $object_type, $returnval  	}  } -register_elgg_event_handler('init', 'system', 'notifications_plugin_init', 1000); +elgg_register_event_handler('init', 'system', 'notifications_plugin_init', 1000);  register_action("notificationsettings/save", FALSE, $CONFIG->pluginspath . "notifications/actions/save.php"); diff --git a/mod/pages/start.php b/mod/pages/start.php index 074e2a771..787f0c632 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -42,7 +42,7 @@ function pages_init() {  	}  	// Listen to notification events and supply a more useful message -	register_plugin_hook('notify:entity:message', 'object', 'page_notify_message'); +	elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'page_notify_message');  	// add the group pages tool option  	add_group_tool_option('pages',elgg_echo('groups:enablepages'),true); @@ -64,7 +64,7 @@ function pages_init() {  	);  	// register ecml views to parse -	register_plugin_hook('get_views', 'ecml', 'pages_ecml_views_hook'); +	elgg_register_plugin_hook_handler('get_views', 'ecml', 'pages_ecml_views_hook');  }  function pages_url($entity) { @@ -345,9 +345,9 @@ function pages_ecml_views_hook($hook, $entity_type, $return_value, $params) {  }  // write permission plugin hooks -register_plugin_hook('permissions_check', 'object', 'pages_write_permission_check'); -register_plugin_hook('container_permissions_check', 'object', 'pages_container_permission_check'); +elgg_register_plugin_hook_handler('permissions_check', 'object', 'pages_write_permission_check'); +elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'pages_container_permission_check');  // Make sure the pages initialisation function is called on initialisation -register_elgg_event_handler('init','system','pages_init'); -register_elgg_event_handler('pagesetup','system','pages_submenus');
\ No newline at end of file +elgg_register_event_handler('init','system','pages_init'); +elgg_register_event_handler('pagesetup','system','pages_submenus');
\ No newline at end of file diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php index f3c928cef..312b72a1a 100644 --- a/mod/profile/actions/edit.php +++ b/mod/profile/actions/edit.php @@ -98,7 +98,7 @@ if (sizeof($input) > 0) {  	$profile_owner->save();  	// Notify of profile update -	trigger_elgg_event('profileupdate',$user->type,$user); +	elgg_trigger_event('profileupdate',$user->type,$user);  	//add to river if edited by self  	if (get_loggedin_userid() == $user->guid) { diff --git a/mod/profile/actions/iconupload.php b/mod/profile/actions/iconupload.php index cd842752f..f146316f0 100644 --- a/mod/profile/actions/iconupload.php +++ b/mod/profile/actions/iconupload.php @@ -54,7 +54,7 @@ foreach ($icon_sizes as $name => $size_info) {  }  $profile_owner->icontime = time(); -if (trigger_elgg_event('profileiconupdate', $profile_owner->type, $profile_owner)) { +if (elgg_trigger_event('profileiconupdate', $profile_owner->type, $profile_owner)) {  	// pull this out into the river plugin.  	//add_to_river('river/user/default/profileiconupdate','update',$user->guid,$user->guid);  	system_message(elgg_echo("profile:icon:uploaded")); diff --git a/mod/profile/start.php b/mod/profile/start.php index dab12b12d..6e9a43a68 100644 --- a/mod/profile/start.php +++ b/mod/profile/start.php @@ -45,10 +45,10 @@ function profile_init() {  	elgg_extend_view('js/initialise_elgg', 'profile/javascript');  	// Now override icons -	register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook'); +	elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'profile_usericon_hook');  	// allow ECML in parts of the profile -	register_plugin_hook('get_views', 'ecml', 'profile_ecml_views_hook'); +	elgg_register_plugin_hook_handler('get_views', 'ecml', 'profile_ecml_views_hook');  	// default profile fields admin item  	elgg_add_admin_submenu_item('defaultprofile', elgg_echo('profile:edit:default'), 'appearance'); @@ -97,7 +97,7 @@ function profile_fields_setup() {  		$profile_defaults = $loaded_defaults;  	} -	$CONFIG->profile = trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults); +	$CONFIG->profile = elgg_trigger_plugin_hook('profile:fields', 'profile', NULL, $profile_defaults);  	// register any tag metadata names  	foreach ($CONFIG->profile as $name => $type) { @@ -275,11 +275,11 @@ function profile_ecml_views_hook($hook, $entity_type, $return_value, $params) {  }  // Make sure the profile initialisation function is called on initialisation -register_elgg_event_handler('init','system','profile_init',1); -register_elgg_event_handler('init','system','profile_fields_setup', 10000); // Ensure this runs after other plugins +elgg_register_event_handler('init','system','profile_init',1); +elgg_register_event_handler('init','system','profile_fields_setup', 10000); // Ensure this runs after other plugins -register_elgg_event_handler('pagesetup','system','profile_pagesetup'); -register_elgg_event_handler('profileupdate','all','object_notifications'); +elgg_register_event_handler('pagesetup','system','profile_pagesetup'); +elgg_register_event_handler('profileupdate','all','object_notifications');  // Register actions diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php index 0611f7402..138e66cb9 100644 --- a/mod/reportedcontent/actions/add.php +++ b/mod/reportedcontent/actions/add.php @@ -22,7 +22,7 @@  		    $report->access_id = $access;      		if ($report->save()) { -     			if (!trigger_plugin_hook('reportedcontent:add', 'system', array('report'=>$report), true)) { +     			if (!elgg_trigger_plugin_hook('reportedcontent:add', 'system', array('report'=>$report), true)) {       				$report->delete();       				register_error(elgg_echo('reportedcontent:failed'));       			} else { diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/archive.php index 3bd10f520..231ebdd35 100644 --- a/mod/reportedcontent/actions/archive.php +++ b/mod/reportedcontent/actions/archive.php @@ -15,7 +15,7 @@ $guid = (int) get_input('item');  $report = get_entity($guid);  if ($report->getSubtype() == "reported_content" && $report->canEdit()) {  	// change the state -	if (!trigger_plugin_hook('reportedcontent:archive', 'system', array('report'=>$report), TRUE)) { +	if (!elgg_trigger_plugin_hook('reportedcontent:archive', 'system', array('report'=>$report), TRUE)) {  		system_message(elgg_echo("reportedcontent:notarchived"));  		forward('pg/admin/reportedcontent');  	} diff --git a/mod/reportedcontent/actions/delete.php b/mod/reportedcontent/actions/delete.php index 3e38d2069..fa10c6d7e 100644 --- a/mod/reportedcontent/actions/delete.php +++ b/mod/reportedcontent/actions/delete.php @@ -15,7 +15,7 @@ $guid = (int) get_input('item');  $report = get_entity($guid);  if ($report->getSubtype() == "reported_content" && $report->canEdit()) {  	// Delete it! -	if (!trigger_plugin_hook('reportedcontent:delete', '$system', array('report'=>$report), true)) { +	if (!elgg_trigger_plugin_hook('reportedcontent:delete', '$system', array('report'=>$report), true)) {  		register_error(elgg_echo("reportedcontent:notdeleted"));  		forward('pg/admin/reportedcontent');  	} diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 0a35a33e8..d301a9802 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -30,4 +30,4 @@ function reportedcontent_init() {  }  // Initialise Reported Content -register_elgg_event_handler('init','system','reportedcontent_init'); +elgg_register_event_handler('init','system','reportedcontent_init'); diff --git a/mod/riverdashboard/start.php b/mod/riverdashboard/start.php index 0adc3d653..15d563855 100644 --- a/mod/riverdashboard/start.php +++ b/mod/riverdashboard/start.php @@ -17,9 +17,9 @@ function riverdashboard_init() {  	// add an activity stream ECML keyword  	// we'll restrict it to use in sitepages's custom_frontpage -	register_plugin_hook('get_keywords', 'ecml', 'riverdashboard_ecml_keywords_hook'); +	elgg_register_plugin_hook_handler('get_keywords', 'ecml', 'riverdashboard_ecml_keywords_hook'); -	register_plugin_hook('get_views', 'ecml', 'riverdashboard_ecml_views_hook'); +	elgg_register_plugin_hook_handler('get_views', 'ecml', 'riverdashboard_ecml_views_hook');  }  /** @@ -83,4 +83,4 @@ function riverdashboard_ecml_views_hook($hook, $entity_type, $return_value, $par  	return $return_value;  } -register_elgg_event_handler('init', 'system', 'riverdashboard_init'); +elgg_register_event_handler('init', 'system', 'riverdashboard_init'); diff --git a/mod/search/index.php b/mod/search/index.php index 54054244a..035401640 100644 --- a/mod/search/index.php +++ b/mod/search/index.php @@ -64,7 +64,7 @@ $params = array(  );  $types = get_registered_entity_types(); -$custom_types = trigger_plugin_hook('search_types', 'get_types', $params, array()); +$custom_types = elgg_trigger_plugin_hook('search_types', 'get_types', $params, array());  // add submenu items for all and native types  // @todo should these maintain any existing type / subtype filters or reset? @@ -172,7 +172,7 @@ if ($search_type == 'all' || $search_type == 'entities') {  				$current_params['subtype'] = $subtype;  				$current_params['type'] = $type; -				$results = trigger_plugin_hook('search', "$type:$subtype", $current_params, NULL); +				$results = elgg_trigger_plugin_hook('search', "$type:$subtype", $current_params, NULL);  				if ($results === FALSE) {  					// someone is saying not to display these types in searches.  					continue; @@ -182,7 +182,7 @@ if ($search_type == 'all' || $search_type == 'entities') {  					// no results and not hooked.  use default type search.  					// don't change the params here, since it's really a different subtype.  					// Will be passed to elgg_get_entities(). -					$results = trigger_plugin_hook('search', $type, $current_params, array()); +					$results = elgg_trigger_plugin_hook('search', $type, $current_params, array());  				}  				if (is_array($results['entities']) && $results['count']) { @@ -197,7 +197,7 @@ if ($search_type == 'all' || $search_type == 'entities') {  		$current_params['type'] = $type;  		$current_params['subtype'] = ELGG_ENTITIES_NO_VALUE; -		$results = trigger_plugin_hook('search', $type, $current_params, array()); +		$results = elgg_trigger_plugin_hook('search', $type, $current_params, array());  		if ($results === FALSE) {  			// someone is saying not to display these types in searches.  			continue; @@ -224,7 +224,7 @@ if ($search_type != 'entities' || $search_type == 'all') {  			// custom search types have no subtype.  			unset($current_params['subtype']); -			$results = trigger_plugin_hook('search', $type, $current_params, array()); +			$results = elgg_trigger_plugin_hook('search', $type, $current_params, array());  			if ($results === FALSE) {  				// someone is saying not to display these types in searches. diff --git a/mod/search/start.php b/mod/search/start.php index 791555a99..9369e9221 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -18,19 +18,19 @@ function search_init() {  	register_page_handler('search','search_page_handler');  	// register some default search hooks -	register_plugin_hook('search', 'object', 'search_objects_hook'); -	register_plugin_hook('search', 'user', 'search_users_hook'); +	elgg_register_plugin_hook_handler('search', 'object', 'search_objects_hook'); +	elgg_register_plugin_hook_handler('search', 'user', 'search_users_hook');  	// @todo pull this out into groups -	register_plugin_hook('search', 'group', 'search_groups_hook'); +	elgg_register_plugin_hook_handler('search', 'group', 'search_groups_hook');  	// tags and comments are a bit different.  	// register a search types and a hooks for them. -	register_plugin_hook('search_types', 'get_types', 'search_custom_types_tags_hook'); -	register_plugin_hook('search', 'tags', 'search_tags_hook'); +	elgg_register_plugin_hook_handler('search_types', 'get_types', 'search_custom_types_tags_hook'); +	elgg_register_plugin_hook_handler('search', 'tags', 'search_tags_hook'); -	register_plugin_hook('search_types', 'get_types', 'search_custom_types_comments_hook'); -	register_plugin_hook('search', 'comments', 'search_comments_hook'); +	elgg_register_plugin_hook_handler('search_types', 'get_types', 'search_custom_types_comments_hook'); +	elgg_register_plugin_hook_handler('search', 'comments', 'search_comments_hook');  	// get server min and max allowed chars for ft searching  	$CONFIG->search_info = array(); @@ -491,4 +491,4 @@ function search_get_order_by_sql($entities_table, $type_table, $sort, $order) {  }  /** Register init system event **/ -register_elgg_event_handler('init','system','search_init'); +elgg_register_event_handler('init','system','search_init'); diff --git a/mod/sitepages/start.php b/mod/sitepages/start.php index 82fd0ab72..b98345451 100644 --- a/mod/sitepages/start.php +++ b/mod/sitepages/start.php @@ -39,15 +39,15 @@ function sitepages_init() {  	// Replace the default index page if user has requested and the site is not running walled garden  	if (get_plugin_setting('ownfrontpage', 'sitepages') == 'yes') { -		register_plugin_hook('index', 'system', 'sitepages_custom_index'); +		elgg_register_plugin_hook_handler('index', 'system', 'sitepages_custom_index');  	}  	// define our own ecml keywords and views -	register_plugin_hook('get_keywords', 'ecml', 'sitepages_ecml_keyword_hook'); -	register_plugin_hook('get_views', 'ecml', 'sitepages_ecml_views_hook'); +	elgg_register_plugin_hook_handler('get_keywords', 'ecml', 'sitepages_ecml_keyword_hook'); +	elgg_register_plugin_hook_handler('get_views', 'ecml', 'sitepages_ecml_views_hook');  	// hook into the walled garden pages -	register_plugin_hook('public_pages', 'walled_garden', 'sitepages_public_pages'); +	elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'sitepages_public_pages');  	register_action('settings/sitepages/save', FALSE, "{$CONFIG->pluginspath}sitepages/actions/edit_settings.php"); @@ -208,4 +208,4 @@ function sitepages_public_pages($hook, $type, $return_value, $params) {  	return $return_value;  } -register_elgg_event_handler('init', 'system', 'sitepages_init'); +elgg_register_event_handler('init', 'system', 'sitepages_init'); diff --git a/mod/tagcloud/start.php b/mod/tagcloud/start.php index a2e4f5143..a6b573d90 100644 --- a/mod/tagcloud/start.php +++ b/mod/tagcloud/start.php @@ -9,4 +9,4 @@ function tagcloud_init() {  	elgg_extend_view('css','tagcloud/css');  } -register_elgg_event_handler('init', 'system', 'tagcloud_init'); +elgg_register_event_handler('init', 'system', 'tagcloud_init'); diff --git a/mod/thewire/start.php b/mod/thewire/start.php index ca13acc9c..31bad5809 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -44,14 +44,14 @@  				register_entity_type('object','thewire');  			// Listen for SMS create event -			register_elgg_event_handler('create','object','thewire_incoming_sms'); +			elgg_register_event_handler('create','object','thewire_incoming_sms');  			// Register granular notification for this type  			if (is_callable('register_notification_object'))  				register_notification_object('object', 'thewire', elgg_echo('thewire:newpost'));  			// Listen to notification events and supply a more useful message for SMS' -			register_plugin_hook('notify:entity:message', 'object', 'thewire_notify_message'); +			elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'thewire_notify_message');  		}  		function thewire_pagesetup() { @@ -194,8 +194,8 @@  		}  	// Make sure the thewire initialisation function is called on initialisation -		register_elgg_event_handler('init','system','thewire_init'); -		register_elgg_event_handler('pagesetup','system','thewire_pagesetup'); +		elgg_register_event_handler('init','system','thewire_init'); +		elgg_register_event_handler('pagesetup','system','thewire_pagesetup');  	// Register actions  		global $CONFIG; diff --git a/mod/tinymce/start.php b/mod/tinymce/start.php index fd5c4176b..b605f92f6 100644 --- a/mod/tinymce/start.php +++ b/mod/tinymce/start.php @@ -12,4 +12,4 @@ function tinymce_init() {  	elgg_extend_view('embed/custom_insert_js', 'tinymce/embed_custom_insert_js');  } -register_elgg_event_handler('init', 'system', 'tinymce_init', 9999); +elgg_register_event_handler('init', 'system', 'tinymce_init', 9999); diff --git a/mod/twitter/start.php b/mod/twitter/start.php index a1d2228ed..fc8c44ae8 100644 --- a/mod/twitter/start.php +++ b/mod/twitter/start.php @@ -17,6 +17,6 @@  		} -		register_elgg_event_handler('init','system','twitter_init'); +		elgg_register_event_handler('init','system','twitter_init');  ?>
\ No newline at end of file diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index b0f621a84..3bc0febae 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -17,25 +17,25 @@ function uservalidationbyemail_init() {  	register_page_handler('uservalidationbyemail', 'uservalidationbyemail_page_handler');  	// mark users as unvalidated and disable when they register -	register_plugin_hook('register', 'user', 'uservalidationbyemail_disable_new_user'); +	elgg_register_plugin_hook_handler('register', 'user', 'uservalidationbyemail_disable_new_user');  	// canEdit override to allow not logged in code to disable a user -	register_plugin_hook('permissions_check', 'user', 'uservalidationbyemail_allow_new_user_can_edit'); +	elgg_register_plugin_hook_handler('permissions_check', 'user', 'uservalidationbyemail_allow_new_user_can_edit');  	// prevent users from logging in if they aren't validated -	register_plugin_hook('action', 'login', 'uservalidationbyemail_check_login_attempt'); +	elgg_register_plugin_hook_handler('action', 'login', 'uservalidationbyemail_check_login_attempt');  	// when requesting a new password -	register_plugin_hook('action', 'user/requestnewpassword', 'uservalidationbyemail_check_request_password'); +	elgg_register_plugin_hook_handler('action', 'user/requestnewpassword', 'uservalidationbyemail_check_request_password');  	// prevent the engine from logging in users via login() -	register_elgg_event_handler('login', 'user', 'uservalidationbyemail_check_manual_login'); +	elgg_register_event_handler('login', 'user', 'uservalidationbyemail_check_manual_login');  	// make admin users always validated -	register_elgg_event_handler('make_admin', 'user', 'uservalidationbyemail_validate_new_admin_user'); +	elgg_register_event_handler('make_admin', 'user', 'uservalidationbyemail_validate_new_admin_user');  	// register Walled Garden public pages -	register_plugin_hook('public_pages', 'walled_garden', 'uservalidationbyemail_public_pages'); +	elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'uservalidationbyemail_public_pages');  	// admin interface to manually validate users  	elgg_add_admin_submenu_item('unvalidated', elgg_echo('uservalidationbyemail:admin:unvalidated'), 'users'); @@ -269,4 +269,4 @@ function uservalidationbyemail_check_request_password($hook, $type, $value, $par  	return $value;  } -register_elgg_event_handler('init', 'system', 'uservalidationbyemail_init');
\ No newline at end of file +elgg_register_event_handler('init', 'system', 'uservalidationbyemail_init');
\ No newline at end of file diff --git a/mod/zaudio/start.php b/mod/zaudio/start.php index 35a4c33dd..551fd479a 100644 --- a/mod/zaudio/start.php +++ b/mod/zaudio/start.php @@ -13,6 +13,6 @@       }       // Make sure the status initialisation function is called on initialisation -		register_elgg_event_handler('init','system','zaudio_init',999); +		elgg_register_event_handler('init','system','zaudio_init',999);  ?>
\ No newline at end of file diff --git a/services/api/rest_api.php b/services/api/rest_api.php index 0f693117c..4cee374d6 100644 --- a/services/api/rest_api.php +++ b/services/api/rest_api.php @@ -26,7 +26,7 @@ if ((isset($CONFIG->disable_api)) && ($CONFIG->disable_api == true)) {  }  // plugins should return true to control what API and user authentication handlers are registered -if (trigger_plugin_hook('rest', 'init', null, false) == false) { +if (elgg_trigger_plugin_hook('rest', 'init', null, false) == false) {  	// for testing from a web browser, you can use the session PAM  	// do not use for production sites!!  	//register_pam_handler('pam_auth_session'); diff --git a/services/export/handler.php b/services/export/handler.php index 9ce1419df..81d4222e5 100644 --- a/services/export/handler.php +++ b/services/export/handler.php @@ -73,7 +73,7 @@ if (($guid != "") && ($type == "") && ($id_or_name == "")) {  			$r = get_relationship($id_or_name);  			break;  		case 'volatile' : -			$m = trigger_plugin_hook('volatile', 'metadata', +			$m = elgg_trigger_plugin_hook('volatile', 'metadata',  				array('guid' => $guid, 'varname' => $id_or_name));  			break; diff --git a/views/default/page_elements/owner_block.php b/views/default/page_elements/owner_block.php index ab1344b21..9962e2962 100644 --- a/views/default/page_elements/owner_block.php +++ b/views/default/page_elements/owner_block.php @@ -49,7 +49,7 @@ if(is_plugin_enabled('profile')) {  		// Trigger owner block menu  		$params = array('owner' => $owner); -		$links = trigger_plugin_hook('profile_menu', 'profile', $params, array()); +		$links = elgg_trigger_plugin_hook('profile_menu', 'profile', $params, array());  		if (is_array($links) && !empty($links)) {  			// sort the links by name  			usort($links, create_function(  | 
