diff options
Diffstat (limited to 'engine/lib')
| -rw-r--r-- | engine/lib/actions.php | 30 | ||||
| -rw-r--r-- | engine/lib/api.php | 38 | ||||
| -rw-r--r-- | engine/lib/cron.php | 2 | ||||
| -rw-r--r-- | engine/lib/database.php | 8 | ||||
| -rw-r--r-- | engine/lib/entities.php | 28 | ||||
| -rw-r--r-- | engine/lib/export.php | 2 | ||||
| -rw-r--r-- | engine/lib/extender.php | 6 | ||||
| -rw-r--r-- | engine/lib/group.php | 10 | ||||
| -rw-r--r-- | engine/lib/notification.php | 12 | ||||
| -rw-r--r-- | engine/lib/objects.php | 2 | ||||
| -rw-r--r-- | engine/lib/output.php | 32 | ||||
| -rw-r--r-- | engine/lib/plugins.php | 8 | ||||
| -rw-r--r-- | engine/lib/relationships.php | 6 | ||||
| -rw-r--r-- | engine/lib/sites.php | 2 | ||||
| -rw-r--r-- | engine/lib/users.php | 8 | ||||
| -rw-r--r-- | engine/lib/xml-rpc.php | 8 | 
16 files changed, 101 insertions, 101 deletions
| 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:   * <pre>   * { @@ -392,18 +392,18 @@ function elgg_is_xhr() {   * }   * </pre>   * 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; diff --git a/engine/lib/api.php b/engine/lib/api.php index 93de88d5b..642449fff 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -82,14 +82,14 @@ $call_method = "GET", $require_api_auth = false, $require_user_auth = false) {  	if ($parameters != NULL) {  		if (!is_array($parameters)) { -			$msg = sprintf(elgg_echo('InvalidParameterException:APIParametersArrayStructure'), $method); +			$msg = elgg_echo('InvalidParameterException:APIParametersArrayStructure', array($method));  			throw new InvalidParameterException($msg);  		}  		// catch common mistake of not setting up param array correctly  		$first = current($parameters);  		if (!is_array($first)) { -			$msg = sprintf(elgg_echo('InvalidParameterException:APIParametersArrayStructure'), $method); +			$msg = elgg_echo('InvalidParameterException:APIParametersArrayStructure', array($method));  			throw new InvalidParameterException($msg);  		}  	} @@ -115,8 +115,8 @@ $call_method = "GET", $require_api_auth = false, $require_user_auth = false) {  			$API_METHODS[$method]["call_method"] = 'GET';  			break;  		default : -			$msg = sprintf(elgg_echo('InvalidParameterException:UnrecognisedHttpMethod'), -			$call_method, $method); +			$msg = elgg_echo('InvalidParameterException:UnrecognisedHttpMethod', +			array($call_method, $method));  			throw new InvalidParameterException($msg);  	} @@ -159,7 +159,7 @@ function authenticate_method($method) {  	// method must be exposed  	if (!isset($API_METHODS[$method])) { -		throw new APIException(sprintf(elgg_echo('APIException:MethodCallNotImplemented'), $method)); +		throw new APIException(elgg_echo('APIException:MethodCallNotImplemented', array($method)));  	}  	// make sure that POST variables are available if needed @@ -201,7 +201,7 @@ function execute_method($method) {  	// method must be exposed  	if (!isset($API_METHODS[$method])) { -		$msg = sprintf(elgg_echo('APIException:MethodCallNotImplemented'), $method); +		$msg = elgg_echo('APIException:MethodCallNotImplemented', array($method));  		throw new APIException($msg);  	} @@ -209,14 +209,14 @@ function execute_method($method) {  	if (!(isset($API_METHODS[$method]["function"]))  	|| !(is_callable($API_METHODS[$method]["function"]))) { -		$msg = sprintf(elgg_echo('APIException:FunctionDoesNotExist'), $method); +		$msg = elgg_echo('APIException:FunctionDoesNotExist', array($method));  		throw new APIException($msg);  	}  	// check http call method  	if (strcmp(get_call_method(), $API_METHODS[$method]["call_method"]) != 0) { -		$msg = sprintf(elgg_echo('CallException:InvalidCallMethod'), $method, -		$API_METHODS[$method]["call_method"]); +		$msg = elgg_echo('CallException:InvalidCallMethod', array($method, +		$API_METHODS[$method]["call_method"]));  		throw new CallException($msg);  	} @@ -242,13 +242,13 @@ function execute_method($method) {  	}  	if ($result === false) { -		$msg = sprintf(elgg_echo('APIException:FunctionParseError'), $function, $serialised_parameters); +		$msg = elgg_echo('APIException:FunctionParseError', array($function, $serialised_parameters));  		throw new APIException($msg);  	}  	if ($result === NULL) {  		// If no value -		$msg = sprintf(elgg_echo('APIException:FunctionNoReturn'), $function, $serialised_parameters); +		$msg = elgg_echo('APIException:FunctionNoReturn', array($function, $serialised_parameters));  		throw new APIException($msg);  	} @@ -365,13 +365,13 @@ function verify_parameters($method, $parameters) {  		// this tests the expose structure: must be array to describe parameter and type must be defined  		if (!is_array($value) || !isset($value['type'])) { -			$msg = sprintf(elgg_echo('APIException:InvalidParameter'), $key, $method); +			$msg = elgg_echo('APIException:InvalidParameter', array($key, $method));  			throw new APIException($msg);  		}  		// Check that the variable is present in the request if required  		if ($value['required'] && !array_key_exists($key, $parameters)) { -			$msg = sprintf(elgg_echo('APIException:MissingParameterInMethod'), $key, $method); +			$msg = elgg_echo('APIException:MissingParameterInMethod', array($key, $method));  			throw new APIException($msg);  		}  	} @@ -433,7 +433,7 @@ function serialise_parameters($method, $parameters) {  			case 'array':  				// we can handle an array of strings, maybe ints, definitely not booleans or other arrays  				if (!is_array($parameters[$key])) { -					$msg = sprintf(elgg_echo('APIException:ParameterNotArray'), $key); +					$msg = elgg_echo('APIException:ParameterNotArray', array($key));  					throw new APIException($msg);  				} @@ -454,7 +454,7 @@ function serialise_parameters($method, $parameters) {  				$serialised_parameters .= $array;  				break;  			default: -				$msg = sprintf(elgg_echo('APIException:UnrecognisedTypeCast'), $value['type'], $key, $method); +				$msg = elgg_echo('APIException:UnrecognisedTypeCast', array($value['type'], $key, $method));  				throw new APIException($msg);  		}  	} @@ -548,8 +548,8 @@ function api_auth_hmac() {  		$calculated_posthash = calculate_posthash($postdata, $api_header->posthash_algo);  		if (strcmp($api_header->posthash, $calculated_posthash) != 0) { -			$msg = sprintf(elgg_echo('SecurityException:InvalidPostHash'), -			$calculated_posthash, $api_header->posthash); +			$msg = elgg_echo('SecurityException:InvalidPostHash', +			array($calculated_posthash, $api_header->posthash));  			throw new SecurityException($msg);  		} @@ -652,7 +652,7 @@ function map_api_hash($algo) {  		return $supported_algos[$algo];  	} -	throw new APIException(sprintf(elgg_echo('APIException:AlgorithmNotSupported'), $algo)); +	throw new APIException(elgg_echo('APIException:AlgorithmNotSupported', array($algo)));  }  /** @@ -1039,7 +1039,7 @@ $content_type = 'application/octet-stream') {  		case 'POST' :  			break;  		default: -			$msg = sprintf(elgg_echo('NotImplementedException:CallMethodNotImplemented'), $method); +			$msg = elgg_echo('NotImplementedException:CallMethodNotImplemented', array($method));  			throw new NotImplementedException($msg);  	} diff --git a/engine/lib/cron.php b/engine/lib/cron.php index 811a4cdda..d51a34bf7 100644 --- a/engine/lib/cron.php +++ b/engine/lib/cron.php @@ -44,7 +44,7 @@ function cron_page_handler($page) {  				set_input('period', $page[0]);  				break;  			default : -				throw new CronException(sprintf(elgg_echo('CronException:unknownperiod'), $page[0])); +				throw new CronException(elgg_echo('CronException:unknownperiod', array($page[0])));  		}  		// Include cron handler diff --git a/engine/lib/database.php b/engine/lib/database.php index 16efb5874..4a99afea1 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -95,13 +95,13 @@ function establish_db_link($dblinkname = "readwrite") {  	// Connect to database  	if (!$dblink[$dblinkname] = mysql_connect($dbhost, $dbuser, $dbpass, true)) { -		$msg = sprintf(elgg_echo('DatabaseException:WrongCredentials'), -				$dbuser, $dbhost, "****"); +		$msg = elgg_echo('DatabaseException:WrongCredentials', +				array($dbuser, $dbhost, "****"));  		throw new DatabaseException($msg);  	}  	if (!mysql_select_db($dbname, $dblink[$dblinkname])) { -		$msg = sprintf(elgg_echo('DatabaseException:NoConnect'), $dbname); +		$msg = elgg_echo('DatabaseException:NoConnect', array($dbname));  		throw new DatabaseException($msg);  	} @@ -640,7 +640,7 @@ function run_sql_script($scriptlocation) {  			throw new DatabaseException($msg);  		}  	} else { -		$msg = sprintf(elgg_echo('DatabaseException:ScriptNotFound'), $scriptlocation); +		$msg = elgg_echo('DatabaseException:ScriptNotFound', array($scriptlocation));  		throw new DatabaseException($msg);  	}  } diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 376133fec..36e9eb115 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -439,7 +439,7 @@ function update_entity($guid, $owner_guid, $access_id, $container_guid = null) {   *   * @param int    $user_guid      The user guid, or 0 for get_loggedin_userid()   * @param int    $container_guid The container, or 0 for the current page owner. - * @param string $type           The type of entity we're looking to write  + * @param string $type           The type of entity we're looking to write   * @param string $subtype        The subtype of the entity we're looking to write   *   * @return bool @@ -619,11 +619,11 @@ function entity_row_to_elggstar($row) {  			$new_entity = new $classname($row);  			if (!($new_entity instanceof ElggEntity)) { -				$msg = sprintf(elgg_echo('ClassException:ClassnameNotClass'), $classname, 'ElggEntity'); +				$msg = elgg_echo('ClassException:ClassnameNotClass', array($classname, 'ElggEntity'));  				throw new ClassException($msg);  			}  		} else { -			error_log(sprintf(elgg_echo('ClassNotFoundException:MissingClass'), $classname)); +			error_log(elgg_echo('ClassNotFoundException:MissingClass', array($classname)));  		}  	} @@ -643,7 +643,7 @@ function entity_row_to_elggstar($row) {  				$new_entity = new ElggSite($row);  				break;  			default: -				$msg = sprintf(elgg_echo('InstallationException:TypeNotSupported'), $row->type); +				$msg = elgg_echo('InstallationException:TypeNotSupported', array($row->type));  				throw new InstallationException($msg);  		}  	} @@ -1317,7 +1317,7 @@ function elgg_get_entity_site_where_sql($table, $site_guids) {   * 	 full_view => BOOL Display full view entities   * 	 view_type_toggle => BOOL Display gallery / list switch   * 	 pagination => BOOL Display pagination links - *  + *   * @param mixed $getter  The entity getter function to use to fetch the entities   *   * @return string @@ -1334,12 +1334,12 @@ function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entiti  		'view_type_toggle' => FALSE,  		'pagination' => TRUE,  	); -	 +  	$options = array_merge($defaults, $options);  	$options['count'] = TRUE;  	$count = $getter($options); -	 +  	$options['count'] = FALSE;  	$entities = $getter($options); @@ -1817,7 +1817,7 @@ function export_entity_plugin_hook($hook, $entity_type, $returnvalue, $params) {  	// Get the entity  	$entity = get_entity($guid);  	if (!($entity instanceof ElggEntity)) { -		$msg = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $guid, get_class()); +		$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));  		throw new InvalidClassException($msg);  	} @@ -1858,11 +1858,11 @@ function oddentity_to_elggentity(ODDEntity $element) {  				$tmp = new $classname();  				if (!($tmp instanceof ElggEntity)) { -					$msg = sprintf(elgg_echo('ClassException:ClassnameNotClass', $classname, get_class())); +					$msg = elgg_echo('ClassException:ClassnameNotClass', array($classname, get_class()));  					throw new ClassException($msg);  				}  			} else { -				error_log(sprintf(elgg_echo('ClassNotFoundException:MissingClass'), $classname)); +				error_log(elgg_echo('ClassNotFoundException:MissingClass', array($classname)));  			}  		} else {  			switch ($class) { @@ -1879,7 +1879,7 @@ function oddentity_to_elggentity(ODDEntity $element) {  					$tmp = new ElggSite($row);  					break;  				default: -					$msg = sprintf(elgg_echo('InstallationException:TypeNotSupported'), $class); +					$msg = elgg_echo('InstallationException:TypeNotSupported', array($class));  					throw new InstallationException($msg);  			}  		} @@ -1887,7 +1887,7 @@ function oddentity_to_elggentity(ODDEntity $element) {  	if ($tmp) {  		if (!$tmp->import($element)) { -			$msg = sprintf(elgg_echo('ImportException:ImportFailed'), $element->getAttribute('uuid')); +			$msg = elgg_echo('ImportException:ImportFailed', array($element->getAttribute('uuid')));  			throw new ImportException($msg);  		} @@ -1925,7 +1925,7 @@ function import_entity_plugin_hook($hook, $entity_type, $returnvalue, $params) {  		if ($tmp) {  			// Make sure its saved  			if (!$tmp->save()) { -				sprintf(elgg_echo('ImportException:ProblemSaving'), $element->getAttribute('uuid')); +				elgg_echo('ImportException:ProblemSaving', array($element->getAttribute('uuid')));  				throw new ImportException($msg);  			} @@ -2141,7 +2141,7 @@ function get_entity_url($entity_guid) {  		if ($url == "") {  			$url = "pg/view/" . $entity_guid;  		} -		 +  		return elgg_normalize_url($url);  	} diff --git a/engine/lib/export.php b/engine/lib/export.php index 3a5c74a0f..1704ef81d 100644 --- a/engine/lib/export.php +++ b/engine/lib/export.php @@ -149,7 +149,7 @@ function exportAsArray($guid) {  	// Sanity check  	if ((!is_array($to_be_serialised)) || (count($to_be_serialised) == 0)) { -		throw new ExportException(sprintf(elgg_echo('ExportException:NoSuchEntity'), $guid)); +		throw new ExportException(elgg_echo('ExportException:NoSuchEntity', array($guid)));  	}  	return $to_be_serialised; diff --git a/engine/lib/extender.php b/engine/lib/extender.php index 845cfd85f..a67f29a68 100644 --- a/engine/lib/extender.php +++ b/engine/lib/extender.php @@ -97,14 +97,14 @@ function import_extender_plugin_hook($hook, $entity_type, $returnvalue, $params)  		$entity_uuid = $element->getAttribute('entity_uuid');  		$entity = get_entity_from_uuid($entity_uuid);  		if (!$entity) { -			throw new ImportException(sprintf(elgg_echo('ImportException:GUIDNotFound'), $entity_uuid)); +			throw new ImportException(elgg_echo('ImportException:GUIDNotFound', array($entity_uuid)));  		}  		oddmetadata_to_elggextender($entity, $element);  		// Save  		if (!$entity->save()) { -			$msg = sprintf(elgg_echo('ImportException:ProblemUpdatingMeta'), $attr_name, $entity_uuid); +			$msg = elgg_echo('ImportException:ProblemUpdatingMeta', array($attr_name, $entity_uuid));  			throw new ImportException($msg);  		} @@ -231,7 +231,7 @@ function get_extender_url(ElggExtender $extender) {  		}  		$url = "export/$view/$guid/$type/$nameid/";  	} -	 +  	return elgg_normalize_url($url);  } diff --git a/engine/lib/group.php b/engine/lib/group.php index 31dc434ab..53053976a 100644 --- a/engine/lib/group.php +++ b/engine/lib/group.php @@ -116,12 +116,12 @@ function add_object_to_group($group_guid, $object_guid) {  	}  	if (!($group instanceof ElggGroup)) { -		$msg = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $group_guid, 'ElggGroup'); +		$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($group_guid, 'ElggGroup'));  		throw new InvalidClassException($msg);  	}  	if (!($object instanceof ElggObject)) { -		$msg = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $object_guid, 'ElggObject'); +		$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($object_guid, 'ElggObject'));  		throw new InvalidClassException($msg);  	} @@ -150,12 +150,12 @@ function remove_object_from_group($group_guid, $object_guid) {  	}  	if (!($group instanceof ElggGroup)) { -		$msg = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $group_guid, 'ElggGroup'); +		$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($group_guid, 'ElggGroup'));  		throw new InvalidClassException($msg);  	}  	if (!($object instanceof ElggObject)) { -		$msg = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $object_guid, 'ElggObject'); +		$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($object_guid, 'ElggObject'));  		throw new InvalidClassException($msg);  	} @@ -390,7 +390,7 @@ function get_entities_from_metadata_groups_multi($group_guid, $meta_array, $enti  $entity_subtype = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "",  $site_guid = 0, $count = false) {  	elgg_deprecated_notice("get_entities_from_metadata_groups_multi was deprecated in 1.8.", 1.8); -	 +  	global $CONFIG;  	if (!is_array($meta_array) || sizeof($meta_array) == 0) { diff --git a/engine/lib/notification.php b/engine/lib/notification.php index cfb79715c..5aef42aad 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -132,7 +132,7 @@ function notify_user($to, $from, $subject, $message, array $params = NULL, $meth  					$handler = $details->handler;  					if ((!$NOTIFICATION_HANDLERS[$method]) || (!$handler)) { -						error_log(sprintf(elgg_echo('NotificationException:NoHandlerFound'), $method)); +						error_log(elgg_echo('NotificationException:NoHandlerFound', array($method)));  					}  					elgg_log("Sending message to $guid using $method"); @@ -238,17 +238,17 @@ array $params = NULL) {  	global $CONFIG;  	if (!$from) { -		$msg = sprintf(elgg_echo('NotificationException:MissingParameter'), 'from'); +		$msg = elgg_echo('NotificationException:MissingParameter', array('from'));  		throw new NotificationException($msg);  	}  	if (!$to) { -		$msg = sprintf(elgg_echo('NotificationException:MissingParameter'), 'to'); +		$msg = elgg_echo('NotificationException:MissingParameter', array('to'));  		throw new NotificationException($msg);  	}  	if ($to->email == "") { -		$msg = sprintf(elgg_echo('NotificationException:NoEmailAddress'), $to->guid); +		$msg = elgg_echo('NotificationException:NoEmailAddress', array($to->guid));  		throw new NotificationException($msg);  	} @@ -287,12 +287,12 @@ function elgg_send_email($from, $to, $subject, $body, array $params = NULL) {  	global $CONFIG;  	if (!$from) { -		$msg = sprintf(elgg_echo('NotificationException:NoEmailAddress'), 'from'); +		$msg = elgg_echo('NotificationException:NoEmailAddress', array('from'));  		throw new NotificationException($msg);  	}  	if (!$to) { -		$msg = sprintf(elgg_echo('NotificationException:NoEmailAddress'), 'to'); +		$msg = elgg_echo('NotificationException:NoEmailAddress', array('to'));  		throw new NotificationException($msg);  	} diff --git a/engine/lib/objects.php b/engine/lib/objects.php index ae30edb13..5b7521922 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -89,7 +89,7 @@ function create_object_entity($guid, $title, $description) {   * @return 1   */  function delete_object_entity($guid) { -	system_message(sprintf(elgg_echo('deprecatedfunction'), 'delete_user_entity')); +	system_message(elgg_echo('deprecatedfunction', array('delete_user_entity')));  	return 1; // Always return that we have deleted one row in order to not break existing code.  } diff --git a/engine/lib/output.php b/engine/lib/output.php index 35ace7c09..84b012631 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -140,31 +140,31 @@ function elgg_format_url($url) {  }  /** - * Converts shorthand urls to absolute urls.   - *  + * Converts shorthand urls to absolute urls. + *   * If the url is already absolute or protocol-relative, no change is made. - *  - * @example  + * + * @example   * elgg_normalize_url('');                   // 'http://my.site.com/'   * elgg_normalize_url('pg/dashboard');       // 'http://my.site.com/pg/dashboard'   * elgg_normalize_url('http://google.com/'); // no change   * elgg_normalize_url('//google.com/');      // no change - *  + *   * @param  string $url The URL to normalize - *  + *   * @return string The absolute url   */  function elgg_normalize_url($url) {  	// 'http://example.com', 'https://example.com', '//example.com'  	if (preg_match("#^(https?:)?//#i", $url)) {  		return $url; -	}  -	 +	} +  	// 'example.com', 'example.com/subpage'  	elseif (preg_match("#[^/]*\.[^/]*/?#i", $url)) {  		return "http://$url"; -	}  -	 +	} +  	// 'pg/page/handler'  	else {  		return elgg_get_site_url().$url; @@ -257,9 +257,9 @@ function elgg_get_friendly_time($time) {  		}  		if ($diff > 1) { -			return sprintf(elgg_echo("friendlytime:minutes"), $diff); +			return elgg_echo("friendlytime:minutes", array($diff));  		} else { -			return sprintf(elgg_echo("friendlytime:minutes:singular"), $diff); +			return elgg_echo("friendlytime:minutes:singular", array($diff));  		}  	} else if ($diff < $day) {  		$diff = round($diff / $hour); @@ -268,9 +268,9 @@ function elgg_get_friendly_time($time) {  		}  		if ($diff > 1) { -			return sprintf(elgg_echo("friendlytime:hours"), $diff); +			return elgg_echo("friendlytime:hours", array($diff));  		} else { -			return sprintf(elgg_echo("friendlytime:hours:singular"), $diff); +			return elgg_echo("friendlytime:hours:singular", array($diff));  		}  	} else {  		$diff = round($diff / $day); @@ -279,9 +279,9 @@ function elgg_get_friendly_time($time) {  		}  		if ($diff > 1) { -			return sprintf(elgg_echo("friendlytime:days"), $diff); +			return elgg_echo("friendlytime:days", array($diff));  		} else { -			return sprintf(elgg_echo("friendlytime:days:singular"), $diff); +			return elgg_echo("friendlytime:days:singular", array($diff));  		}  	}  } diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index d6352cbc6..b6aae9d7d 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -164,7 +164,7 @@ function load_plugins() {  							disable_plugin($mod);  							// register error rather than rendering the site unusable with exception -							register_error(sprintf(elgg_echo('PluginException:MisconfiguredPlugin'), $mod)); +							register_error(elgg_echo('PluginException:MisconfiguredPlugin', array($mod)));  							// continue loading remaining plugins  							continue; @@ -657,7 +657,7 @@ function enable_plugin($plugin, $site_guid = 0) {  	$site = get_entity($site_guid);  	if (!($site instanceof ElggSite)) { -		$msg = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $site_guid, "ElggSite"); +		$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($site_guid, "ElggSite"));  		throw new InvalidClassException($msg);  	} @@ -744,7 +744,7 @@ function disable_plugin($plugin, $site_guid = 0) {  	$site = get_entity($site_guid);  	if (!($site instanceof ElggSite)) { -		$msg = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $site_guid, "ElggSite"); +		$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($site_guid, "ElggSite"));  		throw new InvalidClassException();  	} @@ -826,7 +826,7 @@ function is_plugin_enabled($plugin, $site_guid = 0) {  	if (!$ENABLED_PLUGINS_CACHE) {  		$site = get_entity($site_guid);  		if (!($site instanceof ElggSite)) { -			$msg = sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $site_guid, "ElggSite"); +			$msg = elgg_echo('InvalidClassException:NotValidElggStar', array($site_guid, "ElggSite"));  			throw new InvalidClassException($msg);  		} diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 186e5a595..c9b47df08 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -402,7 +402,7 @@ $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0) {   * Returns a viewable list of entities by relationship   *   * @param array $options - *  + *   * @see elgg_list_entities()   * @see elgg_get_entities_from_relationship()   * @@ -859,8 +859,8 @@ function relationship_notification_hook($event, $object_type, $object) {  		// Notify target user  		return notify_user($object->guid_two, $object->guid_one, -			sprintf(elgg_echo('friend:newfriend:subject'), $user_one->name), -			sprintf(elgg_echo("friend:newfriend:body"), $user_one->name, $user_one->getURL()) +			elgg_echo('friend:newfriend:subject', array($user_one->name)), +			elgg_echo("friend:newfriend:body", array($user_one->name, $user_one->getURL()))  		);  	}  } diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 960e54ee3..8044f8fd2 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -94,7 +94,7 @@ function create_site_entity($guid, $name, $description, $url) {   * @return 1   */  function delete_site_entity($guid) { -	system_message(sprintf(elgg_echo('deprecatedfunction'), 'delete_user_entity')); +	system_message(elgg_echo('deprecatedfunction', array('delete_user_entity')));  	return 1; // Always return that we have deleted one row in order to not break existing code.  } diff --git a/engine/lib/users.php b/engine/lib/users.php index 7533b2af0..ab7e6734d 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -293,7 +293,7 @@ function remove_user_admin($user_guid) {   * @return 1   */  function delete_user_entity($guid) { -	system_message(sprintf(elgg_echo('deprecatedfunction'), 'delete_user_entity')); +	system_message(elgg_echo('deprecatedfunction', array('delete_user_entity')));  	return 1; // Always return that we have deleted one row in order to not break existing code.  } @@ -861,7 +861,7 @@ function send_new_password_request($user_guid) {  		$link = $CONFIG->site->url . "pg/resetpassword?u=$user_guid&c=$code";  		// generate email -		$email = sprintf(elgg_echo('email:resetreq:body'), $user->name, $_SERVER['REMOTE_ADDR'], $link); +		$email = elgg_echo('email:resetreq:body', array($user->name, $_SERVER['REMOTE_ADDR'], $link));  		return notify_user($user->guid, $CONFIG->site->guid,  			elgg_echo('email:resetreq:subject'), $email, NULL, 'email'); @@ -923,7 +923,7 @@ function execute_new_password_request($user_guid, $conf_code) {  		if (force_user_password_reset($user_guid, $password)) {  			remove_private_setting($user_guid, 'passwd_conf_code'); -			$email = sprintf(elgg_echo('email:resetpassword:body'), $user->name, $password); +			$email = elgg_echo('email:resetpassword:body', array($user->name, $password));  			return notify_user($user->guid, $CONFIG->site->guid,  				elgg_echo('email:resetpassword:subject'), $email, NULL, 'email'); @@ -1049,7 +1049,7 @@ function validate_username($username) {  	for ($n = 0; $n < strlen($blacklist2); $n++) {  		if (strpos($username, $blacklist2[$n]) !== false) { -			$msg = sprintf(elgg_echo('registration:invalidchars'), $blacklist2[$n], $blacklist2); +			$msg = elgg_echo('registration:invalidchars', array($blacklist2[$n], $blacklist2));  			throw new RegistrationException($msg);  		}  	} diff --git a/engine/lib/xml-rpc.php b/engine/lib/xml-rpc.php index 251d470a1..6c1084f70 100644 --- a/engine/lib/xml-rpc.php +++ b/engine/lib/xml-rpc.php @@ -119,8 +119,8 @@ function trigger_xmlrpc_handler(XMLRPCCall $parameters) {  		$result  = $handler($parameters);  		if (!($result instanceof XMLRPCResponse)) { -			$msg = sprintf(elgg_echo('InvalidParameterException:UnexpectedReturnFormat'), -				$parameters->getMethodName()); +			$msg = elgg_echo('InvalidParameterException:UnexpectedReturnFormat', +				array($parameters->getMethodName()));  			throw new InvalidParameterException($msg);  		} @@ -129,8 +129,8 @@ function trigger_xmlrpc_handler(XMLRPCCall $parameters) {  	}  	// if no handler then throw exception -	$msg = sprintf(elgg_echo('NotImplementedException:XMLRPCMethodNotImplemented'), -		$parameters->getMethodName()); +	$msg = elgg_echo('NotImplementedException:XMLRPCMethodNotImplemented', +		array($parameters->getMethodName()));  	throw new NotImplementedException($msg);  } | 
