From 998a39940b27561d7a2e98b68c8929dab68fe62f Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 3 Nov 2010 19:46:47 +0000 Subject: Refs #1320. Updated core to use elgg_echo()'s native string replacement. git-svn-id: http://code.elgg.org/elgg/trunk@7227 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/actions.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'engine/lib/actions.php') diff --git a/engine/lib/actions.php b/engine/lib/actions.php index bcd7e759e..35f9dc4b3 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -100,7 +100,7 @@ function action($action, $forwarder = "") { // @todo make this better! if ($event_result) { if (!include($CONFIG->actions[$action]['file'])) { - register_error(sprintf(elgg_echo('actionnotfound'), $action)); + register_error(elgg_echo('actionnotfound', array($action))); } } } else { @@ -110,7 +110,7 @@ function action($action, $forwarder = "") { register_error(elgg_echo('actionunauthorized')); } } else { - register_error(sprintf(elgg_echo('actionundefined'), $action)); + register_error(elgg_echo('actionundefined', array($action))); } forward($forwarder); @@ -359,26 +359,26 @@ function elgg_action_exist($action) { function actions_init() { register_action('security/refreshtoken', TRUE); - + elgg_view_register_simplecache('js/languages/en'); - + register_plugin_hook('action', 'all', 'ajax_action_hook'); register_plugin_hook('forward', 'all', 'ajax_forward_hook'); } /** * Checks whether the request was requested via ajax - * + * * @return bool whether page was requested via ajax */ function elgg_is_xhr() { - return isset($_SERVER['HTTP_X_REQUESTED_WITH']) - && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; + return isset($_SERVER['HTTP_X_REQUESTED_WITH']) + && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; } /** * Catch calls to forward() in ajax request and force an exit. - * + * * Forces response is json of the following form: *
  * {
@@ -392,18 +392,18 @@ function elgg_is_xhr() {
  * }
  * 
* where "system_messages" is all message registers at the point of forwarding - * + * * @param string $hook - * @param string $type + * @param string $type * @param string $reason * @param array $params - * + * */ function ajax_forward_hook($hook, $type, $reason, $params) { if (elgg_is_xhr()) { //grab any data echo'd in the action $output = ob_get_clean(); - + //Avoid double-encoding in case data is json $json = json_decode($output); if (isset($json)) { @@ -411,16 +411,16 @@ function ajax_forward_hook($hook, $type, $reason, $params) { } else { $params['output'] = $output; } - + //Grab any system messages so we can inject them via ajax too $params['system_messages'] = system_messages(NULL, ""); - + if (isset($params['system_messages']['errors'])) { $params['status'] = -1; } else { $params['status'] = 0; } - + header("Content-type: application/json"); echo json_encode($params); exit; -- cgit v1.2.3