diff options
Diffstat (limited to 'mod')
79 files changed, 471 insertions, 484 deletions
diff --git a/mod/blog/start.php b/mod/blog/start.php index 1b2e31d03..386870fd4 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -106,7 +106,7 @@ function blog_page_handler($page) {  		}  		set_page_owner($user->getGUID()); -		$crumbs_title = sprintf(elgg_echo('blog:owned_blogs'), $user->name); +		$crumbs_title = elgg_echo('blog:owned_blogs', array($user->name));  		$crumbs_url = "{$CONFIG->site->url}pg/blog/$username/read";  		elgg_push_breadcrumb($crumbs_title, $crumbs_url); @@ -117,7 +117,7 @@ function blog_page_handler($page) {  		switch ($action) {  			case 'read': -				$title = sprintf(elgg_echo('blog:title:user_blogs'), $user->name); +				$title = elgg_echo('blog:title:user_blogs', array($user->name));  				$content_info = blog_get_page_content_read($user->getGUID(), $page2);  				break; diff --git a/mod/blog/views/default/blog/sidebar_menu.php b/mod/blog/views/default/blog/sidebar_menu.php index f69e23e29..120237ac5 100644 --- a/mod/blog/views/default/blog/sidebar_menu.php +++ b/mod/blog/views/default/blog/sidebar_menu.php @@ -50,13 +50,13 @@ if ($page_owner) {  			}  			$link = elgg_get_site_url() . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh; -			$month = sprintf(elgg_echo('date:month:' . substr($date,4,2)), substr($date, 0, 4)); +			$month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4)));  			echo "<li><a href=\"$link\" title=\"$month\">$month</a></li>";  		}  		echo '</ul>';  	} -	 +  	// friends page lists all tags; mine lists owner's  	$owner_guid = ($vars['page'] == 'friends') ? '' : $page_owner->getGUID();  	echo display_tagcloud(0, 50, 'tags', 'object', 'blog', $owner_guid); diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index eaf25d726..7f91ae608 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -21,7 +21,7 @@ $excerpt = $blog->excerpt;  $body = autop($blog->description);  $owner_icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny'));  $owner_blog_link = "<a href=\"".elgg_get_site_url()."pg/blog/$owner->username\">{$owner->name}</a>"; -$author_text = sprintf(elgg_echo('blog:author_by_line'), $owner_blog_link); +$author_text = elgg_echo('blog:author_by_line', array($owner_blog_link));  if($blog->tags){  	$tags = "<p class=\"tags\">" . elgg_view('output/tags', array('tags' => $blog->tags)) . "</p>";  }else{ diff --git a/mod/blog/views/default/river/object/blog/create.php b/mod/blog/views/default/river/object/blog/create.php index 3a521894f..d311c5883 100644 --- a/mod/blog/views/default/river/object/blog/create.php +++ b/mod/blog/views/default/river/object/blog/create.php @@ -9,7 +9,7 @@ $url = $object->getURL();  $contents = strip_tags($object->excerpt);  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -$title = sprintf(elgg_echo('blog:river:create'), $url); +$title = elgg_echo('blog:river:create', array($url));  $string .= $title . " <a href=\"{$object->getURL()}\">{$object->title}</a> <span class='entity_subtext'>" . elgg_view_friendly_time($object->time_created);  if (isloggedin()) { diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index ca367deb2..808f88ede 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -59,7 +59,7 @@ function bookmarks_pagesetup() {  	if (isloggedin()) {  		if ($page_owner instanceof ElggGroup && elgg_get_context() == 'groups') {  			if ($page_owner->bookmarks_enable != "no") { -				//add_submenu_item(sprintf(elgg_echo("bookmarks:group"),$page_owner->name), "pg/bookmarks/" . $page_owner->username . '/items'); +				//add_submenu_item(elgg_echo("bookmarks:group",array($page_owner->name), "pg/bookmarks/" . $page_owner->username . '/items'));  			}  		}  	} @@ -96,7 +96,7 @@ function bookmarks_page_handler($page) {  		$content = elgg_echo("bookmarks:unknown_user");  		$body = elgg_view_layout('one_column_with_sidebar', $content, $sidebar); -		echo elgg_view_page(sprintf(elgg_echo("bookmarks:user"), elgg_get_page_owner()->name), $body); +		echo elgg_view_page(elgg_echo("bookmarks:user", array(elgg_get_page_owner()->name)), $body);  		return FALSE;  	} @@ -112,7 +112,7 @@ function bookmarks_page_handler($page) {  	if ($owner) {  		switch($section) {  			case 'friends': -				elgg_push_breadcrumb(sprintf(elgg_echo('bookmarks:friends'), $owner->name)); +				elgg_push_breadcrumb(elgg_echo('bookmarks:friends', array($owner->name)));  				$content = list_user_friends_objects($owner->getGUID(), 'bookmarks', 10, false, false);  				$context = ($owner == $logged_in_user) ? 'friends' : ''; @@ -120,7 +120,7 @@ function bookmarks_page_handler($page) {  			default:  			case 'items': -				elgg_push_breadcrumb(sprintf(elgg_echo('bookmarks:user'), $owner->name)); +				elgg_push_breadcrumb(elgg_echo('bookmarks:user', array($owner->name)));  				group_gatekeeper();  				$options = array( @@ -240,7 +240,7 @@ function bookmarks_page_handler($page) {  	$content = $header . $content;  	$body = elgg_view_layout('one_column_with_sidebar', $content, $sidebar); -	echo elgg_view_page(sprintf(elgg_echo("bookmarks:user"), elgg_get_page_owner()->name), $body); +	echo elgg_view_page(elgg_echo("bookmarks:user", array(elgg_get_page_owner()->name)), $body);  	return TRUE;  } diff --git a/mod/bookmarks/views/default/bookmarks/bookmarklet.php b/mod/bookmarks/views/default/bookmarks/bookmarklet.php index 5cb8ca6d8..17a304d78 100644 --- a/mod/bookmarks/views/default/bookmarks/bookmarklet.php +++ b/mod/bookmarks/views/default/bookmarks/bookmarklet.php @@ -9,7 +9,7 @@ $page_owner = elgg_get_page_owner();  $bookmarktext = elgg_echo("bookmarks:this");  if ($page_owner instanceof ElggGroup) { -	$bookmarktext = sprintf(elgg_echo("bookmarks:this:group"), $page_owner->name); +	$bookmarktext = elgg_echo("bookmarks:this:group", array($page_owner->name));  	$name = "group:$page_owner->guid";  } else {  	$name = $page_owner->username; diff --git a/mod/bookmarks/views/default/river/object/bookmarks/create.php b/mod/bookmarks/views/default/river/object/bookmarks/create.php index faffdec5d..32434471b 100644 --- a/mod/bookmarks/views/default/river/object/bookmarks/create.php +++ b/mod/bookmarks/views/default/river/object/bookmarks/create.php @@ -8,7 +8,7 @@ $object = get_entity($vars['item']->object_guid);  $is_group = get_entity($object->container_guid);  $url = $object->getURL();  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -$string = sprintf(elgg_echo("bookmarks:river:created"),$url) . " "; +$string = elgg_echo("bookmarks:river:created", array($url)) . " ";  $string .= "<a href=\"" . $object->address . "\">" . $object->title . "</a>";  if (($is_group instanceof ElggGroup) && (elgg_get_context() != 'groups')){  	$string .= " " . elgg_echo('bookmarks:ingroup') . " <a href=\"{$is_group->getURL()}\">" . $is_group->name . "</a>"; diff --git a/mod/categories/listing.php b/mod/categories/listing.php index efbac8551..19fb65069 100644 --- a/mod/categories/listing.php +++ b/mod/categories/listing.php @@ -28,7 +28,7 @@ elgg_push_context('search');  $objects = elgg_list_entities_from_metadata($params);  elgg_pop_context(); -$title = sprintf(elgg_echo('categories:results'), $category); +$title = elgg_echo('categories:results', array($category));  $content = elgg_view_title($title);  $content .= $objects; diff --git a/mod/categories/start.php b/mod/categories/start.php index 2dedb3dc3..35406459a 100644 --- a/mod/categories/start.php +++ b/mod/categories/start.php @@ -60,7 +60,7 @@ function categories_save($event, $object_type, $object) {  function categories_on_enable() {  	if (!$site->categories) {  		global $CONFIG; -		$message = sprintf(elgg_echo('categories:on_enable_reminder'), "{$CONFIG->url}pg/admin/plugin_settings/categories"); +		$message = elgg_echo('categories:on_enable_reminder', array("{$CONFIG->url}pg/admin/plugin_settings/categories"));  		elgg_add_admin_notice('categories_admin_notice_no_categories', $message);  	}  	return TRUE; diff --git a/mod/diagnostics/actions/download.php b/mod/diagnostics/actions/download.php index 32ef5cbed..d429f2592 100644 --- a/mod/diagnostics/actions/download.php +++ b/mod/diagnostics/actions/download.php @@ -1,15 +1,15 @@  <?php  	/**  	 * Elgg diagnostics -	 *  +	 *  	 * @package ElggDiagnostics  	 */  	admin_gatekeeper(); -	 -	$output = sprintf(elgg_echo('diagnostics:header'), date('r'), get_loggedin_user()->name);  + +	$output = elgg_echo('diagnostics:header', array(date('r'), get_loggedin_user()->name));  	$output = trigger_plugin_hook('diagnostics:report', 'system', null, $output); -	 +  	header("Cache-Control: public");  	header("Content-Description: File Transfer");  	header('Content-disposition: attachment; filename=elggdiagnostic.txt'); diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index 52bd8a1d8..46a5e9e10 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -61,7 +61,7 @@ function diagnostics_basic_hook($hook, $entity_type, $returnvalue, $params)  	$version = get_version();  	$release = get_version(true); -	$returnvalue .= sprintf(elgg_echo('diagnostics:report:basic'), $release, $version); +	$returnvalue .= elgg_echo('diagnostics:report:basic', array($release, $version));  	return $returnvalue;  } @@ -76,7 +76,7 @@ function diagnostics_basic_hook($hook, $entity_type, $returnvalue, $params)   */  function diagnostics_plugins_hook($hook, $entity_type, $returnvalue, $params)  { -	$returnvalue .= sprintf(elgg_echo('diagnostics:report:plugins'), print_r(get_installed_plugins(), true)); +	$returnvalue .= elgg_echo('diagnostics:report:plugins', array(print_r(get_installed_plugins(), true)));  	return $returnvalue;  } @@ -122,7 +122,7 @@ function diagnostics_sigs_hook($hook, $entity_type, $returnvalue, $params)  {  	global $CONFIG; -	$returnvalue .= sprintf(elgg_echo('diagnostics:report:md5'), diagnostics_md5_dir($CONFIG->path)); +	$returnvalue .= elgg_echo('diagnostics:report:md5', array(diagnostics_md5_dir($CONFIG->path)));  	return $returnvalue;  } @@ -156,7 +156,7 @@ function diagnostics_phpinfo_hook($hook, $entity_type, $returnvalue, $params)  	} -	$returnvalue .= sprintf(elgg_echo('diagnostics:report:php'), print_r($phpinfo, true)); +	$returnvalue .= elgg_echo('diagnostics:report:php', array(print_r($phpinfo, true)));  	return $returnvalue;  } @@ -175,7 +175,7 @@ function diagnostics_globals_hook($hook, $entity_type, $returnvalue, $params)  	global $CONFIG;  	$output = str_replace($CONFIG->dbpass, '<<DBPASS>>', print_r($GLOBALS, true)); -	$returnvalue .= sprintf(elgg_echo('diagnostics:report:globals'), $output); +	$returnvalue .= elgg_echo('diagnostics:report:globals', array($output));  	return $returnvalue;  } diff --git a/mod/file/friends.php b/mod/file/friends.php index f76c4e692..895105480 100644 --- a/mod/file/friends.php +++ b/mod/file/friends.php @@ -1,40 +1,40 @@  <?php  	/**  	 * Elgg file browser -	 *  +	 *  	 * @package ElggFile  	 */  	require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); -	 +  	if (is_callable('group_gatekeeper')) {  		group_gatekeeper();  	} -	 +  	$owner = elgg_get_page_owner(); -	 -	$title = sprintf(elgg_echo("file:friends"),$owner->name); -	$area1 = elgg_view('page_elements/content_header', array('context' => "friends", 'type' => 'file'));	 + +	$title = elgg_echo("file:friends",array($owner->name)); +	$area1 = elgg_view('page_elements/content_header', array('context' => "friends", 'type' => 'file'));  	elgg_push_context('search');  	// offset is grabbed in list_user_friends_objects  	$content = list_user_friends_objects($owner->guid, 'file', 10, false);  	elgg_pop_context();  	$area1 .= get_filetype_cloud($owner->guid, true); -	 +  	// handle case where friends don't have any files  	if (empty($content)) {  		$area2 .= "<p class='margin_top'>".elgg_echo("file:none")."</p>";  	} else {  		$area2 .= $content;  	} -	 +  	//get the latest comments on all files  	$comments = get_annotations(0, "object", "file", "generic_comment", "", 0, 4, 0, "desc"); -	$area3 = elgg_view('annotation/latest_comments', array('comments' => $comments));	 -	 +	$area3 = elgg_view('annotation/latest_comments', array('comments' => $comments)); +  	$content = "<div class='files'>".$area1.$area2."</div>";  	$body = elgg_view_layout('one_column_with_sidebar', $content, $area3); -	 +  	echo elgg_view_page($title, $body);  ?>
\ No newline at end of file diff --git a/mod/file/index.php b/mod/file/index.php index 2a82ee1e4..21d573b2b 100644 --- a/mod/file/index.php +++ b/mod/file/index.php @@ -1,10 +1,10 @@  <?php  	/**  	 * Elgg file browser -	 *  +	 *  	 * @package ElggFile -	 *  -	 *  +	 * +	 *  	 * TODO: File icons, download & mime types  	 */ @@ -12,16 +12,16 @@  	// access check for closed groups  	group_gatekeeper(); -	 +  	//set the title  	if (elgg_get_page_owner_guid() == get_loggedin_userid()) {  		$title = elgg_echo('file:yours');  		$area1 = elgg_view('page_elements/content_header', array('context' => "mine", 'type' => 'file'));  	} else { -		$title = sprintf(elgg_echo("file:user"),elgg_get_page_owner()->name); +		$title = elgg_echo("file:user",array(elgg_get_page_owner()->name));  		$area1 = elgg_view('page_elements/content_header', array('context' => "friends", 'type' => 'file'));  	} -		 +  	// Get objects  	elgg_push_context('search');  	$offset = (int)get_input('offset', 0); @@ -34,13 +34,13 @@  	} else {  		$area2 .= "<p class='margin_top'>".elgg_echo("file:none")."</p>";  	} -	 +  	//get the latest comments on the current users files  	$comments = get_annotations(0, "object", "file", "generic_comment", "", 0, 4, 0, "desc",0,0,page_owner());  	$area3 = elgg_view('annotation/latest_comments', array('comments' => $comments)); -	 +  	$content = "<div class='files'>".$area1.$area2."</div>";  	$body = elgg_view_layout('one_column_with_sidebar', $content, $area3); -	 +  	echo elgg_view_page($title, $body);  ?>
\ No newline at end of file diff --git a/mod/file/search.php b/mod/file/search.php index e92cf0362..b0120d932 100644 --- a/mod/file/search.php +++ b/mod/file/search.php @@ -2,7 +2,7 @@  	/**  	 * Elgg file search -	 *  +	 *  	 * @package ElggFile  	 */ @@ -10,7 +10,7 @@  	// Load Elgg engine  		require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); -		 +  	// Get input  		$md_type = 'simpletype';  		$tag = get_input('tag'); @@ -31,17 +31,17 @@  			}  		}  		$page_owner = get_input('page_owner',0); -		if ($page_owner) {  +		if ($page_owner) {  			set_page_owner($page_owner);  		} else {  			if ($friends) { -				set_page_owner($friends);				 +				set_page_owner($friends);  			} else {  				if ($owner_guid > 0 && !is_array($owner_guid))  					set_page_owner($owner_guid);  			}  		} -		 +  		if (is_callable('group_gatekeeper')) group_gatekeeper();  		if (empty($tag)) { @@ -49,12 +49,12 @@  			$area2 = elgg_view_title(elgg_echo('file:type:all'));  			$area2 = elgg_view('page_elements/content_header', array('context' => "everyone", 'type' => 'file'));  		} else { -			$title = sprintf(elgg_echo('searchtitle'),$tag); +			$title = elgg_echo('searchtitle',array($tag));  			if (is_array($owner_guid)) {  				//$area2 = elgg_view_title(elgg_echo("file:friends:type:" . $tag));  				$area2 = elgg_view('page_elements/content_header', array('context' => "friends", 'type' => 'file'));  			} else if (elgg_get_page_owner_guid() && elgg_get_page_owner_guid() != get_loggedin_userid()) { -				//$area2 = elgg_view_title(sprintf(elgg_echo("file:user:type:" . $tag),elgg_get_page_owner()->name)); +				//$area2 = elgg_view_title(elgg_echo("file:user:type:" . $tag,array(elgg_get_page_owner()->name)));  				$area2 = elgg_view('page_elements/content_header', array('context' => "mine", 'type' => 'file'));  			} else{  				//$area2 = elgg_view_title(elgg_echo("file:type:" . $tag)); @@ -68,7 +68,7 @@  		} else {  			$area1 = get_filetype_cloud();  		} -		 +  		elgg_push_context('search');  		$offset = (int)get_input('offset', 0); @@ -87,13 +87,13 @@  		} else {  			$area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'file', 'owner_guid' => $owner_guid, 'limit' => $limit, 'offset' => $offset));  		} -		 +  		elgg_pop_context(); -		 +  		$content = "<div class='files'>".$area1.$area2."</div>"; -		 +  		$body = elgg_view_layout('one_column_with_sidebar', $content); -		 +  		echo elgg_view_page($title, $body);  ?>
\ No newline at end of file diff --git a/mod/file/start.php b/mod/file/start.php index 3d66dcc21..64e890626 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -1,50 +1,50 @@  <?php  	/**  	 * Elgg file browser -	 *  +	 *  	 * @package ElggFile  	 */  	/** -	 * Override the ElggFile so that  +	 * Override the ElggFile so that  	 */  	class FilePluginFile extends ElggFile {  		protected function initialise_attributes() {  			parent::initialise_attributes(); -			 +  			$this->attributes['subtype'] = "file";  		} -		 -		public function __construct($guid = null) {			 + +		public function __construct($guid = null) {  			parent::__construct($guid);  		}  	} -	 +  	/**  	 * File plugin initialisation functions.  	 */  	function file_init() {  		global $CONFIG; -				 +  		// Set up menu (tools dropdown)  		add_menu(elgg_echo('files'), "pg/file/"); -				 +  		// Extend CSS  		elgg_extend_view('css', 'file/css'); -		 -	    // extend group main page + +		// extend group main page  		elgg_extend_view('groups/tool_latest','file/groupprofile_files'); -		 +  		// Register a page handler, so we can have nice URLs  		register_page_handler('file','file_page_handler'); -			 +  		// Add a new file widget  		add_widget_type('filerepo',elgg_echo("file"),elgg_echo("file:widget:description")); -		 +  		// Register a URL handler for files  		register_entity_url_handler('file_url','object','file'); -		 +  		// Register granular notification for this object type  		if (is_callable('register_notification_object')) {  			register_notification_object('object', 'file', elgg_echo('file:newupload')); @@ -52,8 +52,8 @@  		// Listen to notification events and supply a more useful message  		register_plugin_hook('notify:entity:message', 'object', 'file_notify_message'); -		 -		// add the group files tool option      + +		// add the group files tool option  		add_group_tool_option('file',elgg_echo('groups:enablefiles'),true);  		// Register entity type @@ -63,24 +63,24 @@  		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'); -		 +  	} -	 +  	/**  	 * Sets up submenus for the file system.  Triggered on pagesetup.  	 *  	 */  	function file_submenus() { -		 +  		global $CONFIG; -		 +  		$page_owner = elgg_get_page_owner(); -		 -		// Group submenu option	 + +		// Group submenu option  			if ($page_owner instanceof ElggGroup && elgg_get_context() == "groups") { -    			if($page_owner->file_enable != "no"){  -				    add_submenu_item(sprintf(elgg_echo("file:group"),$page_owner->name), $CONFIG->wwwroot . "pg/file/" . $page_owner->username); -			    } +				if($page_owner->file_enable != "no"){ +					add_submenu_item(elgg_echo("file:group",array($page_owner->name)), $CONFIG->wwwroot . "pg/file/" . $page_owner->username); +				}  			}  	} @@ -90,37 +90,37 @@  	 * @param array $page Array of page elements, forwarded by the page handling mechanism  	 */  	function file_page_handler($page) { -		 +  		global $CONFIG; -		 +  		// The username should be the file we're getting  		if (isset($page[0])) {  			set_input('username',$page[0]);  		} -		 +  		if (isset($page[1])) { -    		switch($page[1]) { -    			case "read": -    				set_input('guid',$page[2]); +			switch($page[1]) { +				case "read": +					set_input('guid',$page[2]);  					include(dirname(dirname(dirname(__FILE__))) . "/pages/entities/index.php");  				break; -    			case "friends":   -    				include($CONFIG->pluginspath . "file/friends.php"); -          		break; -   				case "world":   -   					include($CONFIG->pluginspath . "file/world.php"); -          		break; -    			case "new":   -    				include($CONFIG->pluginspath . "file/upload.php"); -          		break; -    		} +				case "friends": +					include($CONFIG->pluginspath . "file/friends.php"); +				  break; +				case "world": +					include($CONFIG->pluginspath . "file/world.php"); +				  break; +				case "new": +					include($CONFIG->pluginspath . "file/upload.php"); +				  break; +			}  		} else {  			// Include the standard profile index  			include($CONFIG->pluginspath . "file/index.php");  		} -		 +  	} -	 +  	/**  		 * Returns a more meaningful message  		 * @@ -128,7 +128,7 @@  		 * @param unknown_type $entity_type  		 * @param unknown_type $returnvalue  		 * @param unknown_type $params -    */ +	*/  		function file_notify_message($hook, $entity_type, $returnvalue, $params) {  			$entity = $params['entity'];  			$to_entity = $params['to_entity']; @@ -162,7 +162,7 @@  	 * @return string The overall type  	 */  	function get_general_file_type($mimetype) { -		 +  		switch($mimetype) {  			case "application/msword":  				return "document"; @@ -171,34 +171,34 @@  				return "document";  				break;  		} -		 +  		if (substr_count($mimetype,'text/'))  			return "document"; -			 +  		if (substr_count($mimetype,'audio/'))  			return "audio"; -			 +  		if (substr_count($mimetype,'image/'))  			return "image"; -			 +  		if (substr_count($mimetype,'video/'))  			return "video";  		if (substr_count($mimetype,'opendocument')) -			return "document";	 -			 -		return "general";	 +			return "document"; + +		return "general";  	} -	 +  	/**  	 * Returns a list of filetypes to search specifically on  	 * -	 * @param int|array $owner_guid The GUID(s) of the owner(s) of the files  +	 * @param int|array $owner_guid The GUID(s) of the owner(s) of the files  	 * @param true|false $friends Whether we're looking at the owner or the owner's friends  	 * @return string The typecloud  	 */  	function get_filetype_cloud($owner_guid = "", $friends = false) { -		 +  		if ($friends) {  			if ($friendslist = get_user_friends($user_guid, "", 999999, 0)) {  				$friendguids = array(); @@ -217,7 +217,7 @@  		return elgg_view('file/typecloud',array('owner_guid' => $owner_guid, 'friend_guid' => $friendofguid, 'types' => $types));  	} -	 +  	/**  	 * Register file as an embed type.  	 * @@ -232,10 +232,10 @@  			'layout' => 'list',  			'icon_size' => 'small',  		); -	 +  		return $value;  	} -	 +  	/**  	 * Return a list of files for embedding  	 * @@ -250,22 +250,22 @@  			'type_subtype_pair' => array('object' => 'file'),  			'count' => TRUE  		); -	 +  		if ($count = elgg_get_entities($options)) {  			$value['count'] += $count; -		 +  			unset($options['count']);  			$options['offset'] = $params['offset'];  			$options['limit'] = $params['limit']; -		 +  			$items = elgg_get_entities($options); -		 +  			$value['items'] = array_merge($items, $value['items']);  		} -	 +  		return $value;  	} -	 +  	/**  	 * Register file as an embed type.  	 * @@ -279,11 +279,11 @@  			'name' => elgg_echo('file'),  			'view' => 'file/embed_upload'  		); -	 +  		return $value;  	} -	 -	 + +  	/**  	 * Populates the ->getUrl() method for file objects  	 * @@ -293,13 +293,13 @@  		function file_url($entity) {  			$title = $entity->title;  			$title = elgg_get_friendly_title($title); -			return "pg/file/" . $entity->getOwnerEntity()->username . "/read/" . $entity->getGUID() . "/" . $title;	 +			return "pg/file/" . $entity->getOwnerEntity()->username . "/read/" . $entity->getGUID() . "/" . $title;  		} -	 +  	// Make sure test_init is called on initialisation  	register_elgg_event_handler('init','system','file_init');  	register_elgg_event_handler('pagesetup','system','file_submenus'); -	 +  	// Register actions  	register_action("file/upload", false, $CONFIG->pluginspath . "file/actions/upload.php");  	register_action("file/save", false, $CONFIG->pluginspath . "file/actions/save.php"); @@ -307,5 +307,5 @@  	// temporary - see #2010  	register_action("file/download", false, $CONFIG->pluginspath. "file/actions/download.php"); -	 +  ?> diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php index 5858a1f1e..3da9567a5 100644 --- a/mod/file/views/default/object/file.php +++ b/mod/file/views/default/object/file.php @@ -2,14 +2,14 @@  	/**  	 * Elgg file browser.  	 * File renderer. -	 *  +	 *  	 * @package ElggFile  	 */  	global $CONFIG; -	 +  	$file = $vars['entity']; -	 +  	$file_guid = $file->getGUID();  	$tags = $file->tags;  	$title = $file->title; @@ -17,13 +17,13 @@  	$owner = $vars['entity']->getOwnerEntity();  	$friendlytime = elgg_view_friendly_time($vars['entity']->time_created);  	$mime = $file->mimetype; -	 +  	if (!$title) {  		$title = elgg_echo('untitled');  	} -	 +  	if (elgg_get_context() == "search") { 	// Start search listing version -		 +  		if (get_input('search_viewtype') == "gallery") {  			echo "<div class='filerepo_gallery_item'>";  			if ($vars['entity']->smallthumb) { @@ -34,25 +34,25 @@  				//get the number of comments  				$numcomments = elgg_count_comments($vars['entity']);  				if ($numcomments) -					echo "<p class='filerepo_comments'><a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a></p>"; +					echo "<p class='filerepo_comments'><a href=\"{$file->getURL()}\">" . elgg_echo("comments") . " (" . $numcomments . ")</a></p>"; + -				  				//if the user can edit, display edit and delete links  				if ($file->canEdit()) {  					echo "<div class='filerepo_controls'><p>";  					echo "<a href=\"".elgg_get_site_url()."mod/file/edit.php?file_guid={$file->getGUID()}\">" . elgg_echo('edit') . "</a> ";  					echo elgg_view('output/confirmlink',array( -						 +  							'href' => "action/file/delete?file=" . $file->getGUID(),  							'text' => elgg_echo("delete"),  							'confirm' => elgg_echo("file:delete:confirm"),  							'is_action' => true, -						 +  						));  					echo "</p></div>";  				} -					 -			 + +  			} else {  				echo "<p class='filerepo_title'>{$title}</p>";  				echo "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'large')) . "</a>"; @@ -60,58 +60,58 @@  				//get the number of comments  				$numcomments = elgg_count_comments($file);  				if ($numcomments) -					echo "<p class='filerepo_comments'><a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a></p>"; +					echo "<p class='filerepo_comments'><a href=\"{$file->getURL()}\">" . elgg_echo("comments") . " (" . $numcomments . ")</a></p>";  			}  			echo "</div>"; -			 +  		} else { -		 +  			$info = "<p class='entity_title'> <a href=\"{$file->getURL()}\">{$title}</a></p>";  			$info .= "<p class='entity_subtext'><a href=\"".elgg_get_site_url()."pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}";  			$numcomments = elgg_count_comments($file);  			if ($numcomments) -				$info .= ", <a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; +				$info .= ", <a href=\"{$file->getURL()}\">" . elgg_echo("comments") . " (" . $numcomments . ")</a>";  			$info .= "</p>";  			$icon = "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'small')) . "</a>"; -			 +  			echo elgg_view_listing($icon, $info); -		 +  		} -		 +  	} else { // Start main version -	 +  ?>  	<div class="filerepo_file">  		<div class="filerepo_icon"> -					<a href="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $file_guid; ?>"><?php  -						 -						echo elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid));  -						 -					?></a>					 +					<a href="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $file_guid; ?>"><?php + +						echo elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid)); + +					?></a>  		</div> -		 +  		<div class="filerepo_title_owner_wrapper">  		<?php  			//get the user and a link to their gallery  			$user_gallery = elgg_get_site_url() . "mod/file/search.php?md_type=simpletype&subtype=file&tag=image&owner_guid=" . $owner->guid . "&search_viewtype=gallery";  		?> -		<div class="filerepo_user_gallery_link"><a href="<?php echo $user_gallery; ?>"><?php echo sprintf(elgg_echo("file:user:gallery"),''); ?></a></div> +		<div class="filerepo_user_gallery_link"><a href="<?php echo $user_gallery; ?>"><?php echo elgg_echo("file:user:gallery",array('')); ?></a></div>  		<div class="filerepo_title"><h2><a href="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $file_guid; ?>"><?php echo $title; ?></a></h2></div>  		<div class="filerepo_owner">  				<?php  					echo elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny')); -				 +  				?>  				<p class="filerepo_owner_details"><b><a href="<?php echo elgg_get_site_url(); ?>pg/file/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b><br />  				<small><?php echo $friendlytime; ?></small></p>  		</div>  		</div> -		 +  		<div class="filerepo_maincontent"> -		 +  		<div class="filerepo_description"><?php echo elgg_view('output/longtext', array('value' => $desc)); ?></div>  <?php @@ -129,17 +129,17 @@  		}  ?> -		<?php  +		<?php  			if (elgg_view_exists('file/specialcontent/' . $mime)) {  				echo "<div class='filerepo_specialcontent'>".elgg_view('file/specialcontent/' . $mime, $vars)."</div>";  			} else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) {  				echo "<div class='filerepo_specialcontent'>".elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars)."</div>";  			} -		 +  		?> -		 +  		<div class="filerepo_download"><p><a class="action_button small" href="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $file_guid; ?>"><?php echo elgg_echo("file:download"); ?></a></p></div> -		 +  <?php  	if ($file->canEdit()) { @@ -147,21 +147,21 @@  	<div class="filerepo_controls">  				<p> -					<a href="<?php echo elgg_get_site_url(); ?>mod/file/edit.php?file_guid=<?php echo $file->getGUID(); ?>"><?php echo elgg_echo('edit'); ?></a>   -					<?php  +					<a href="<?php echo elgg_get_site_url(); ?>mod/file/edit.php?file_guid=<?php echo $file->getGUID(); ?>"><?php echo elgg_echo('edit'); ?></a>  +					<?php  						echo elgg_view('output/confirmlink',array( -						 +  							'href' => "action/file/delete?file=" . $file->getGUID(),  							'text' => elgg_echo("delete"),  							'confirm' => elgg_echo("file:delete:confirm"),  							'is_action' => true, -						 -						));   + +						));  					?>  				</p>  	</div> -<?php		 +<?php  	}  ?> @@ -171,9 +171,9 @@  <?php  	if ($vars['full']) { -		 +  		echo elgg_view_comments($file); -		 +  	}  ?> diff --git a/mod/file/views/default/river/object/file/create.php b/mod/file/views/default/river/object/file/create.php index b0e2ca07b..b9b5c4299 100644 --- a/mod/file/views/default/river/object/file/create.php +++ b/mod/file/views/default/river/object/file/create.php @@ -4,14 +4,14 @@  	$object = get_entity($vars['item']->object_guid);  	$url = $object->getURL();  	$container = get_entity($object->container_guid); -	 +  	$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("file:river:created"),$url) . " " . elgg_echo("file:river:item"); +	$string = elgg_echo("file:river:created", array($url)) . " " . elgg_echo("file:river:item");  	$string .= " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";  	if ($container && $container instanceof ElggGroup) {  		$string .= ' ' . elgg_echo('groups:river:togroup') . " <a href=\"" . $container->getURL() ."\">". $container->name . "</a>";  	}  	echo $string; -	 +  ?>
\ No newline at end of file diff --git a/mod/garbagecollector/start.php b/mod/garbagecollector/start.php index 63d8e7f2a..e3f8c030f 100644 --- a/mod/garbagecollector/start.php +++ b/mod/garbagecollector/start.php @@ -1,7 +1,7 @@  <?php  	/**  	 * Elgg garbage collector. -	 *  +	 *  	 * @package ElggGarbageCollector  	 */ @@ -16,15 +16,15 @@  		{  			case 'weekly':  			case 'monthly' : -			case 'yearly' :  +			case 'yearly' :  			break;  			default: $period = 'monthly';  		} -		 +  		// Register cron hook  		register_plugin_hook('cron', $period, 'garbagecollector_cron');  	} -	 +  	/**  	 * Cron job  	 * @@ -32,29 +32,29 @@  	function garbagecollector_cron($hook, $entity_type, $returnvalue, $params)  	{  		global $CONFIG; -		 +  		echo elgg_echo('garbagecollector'); -		 +  		// Garbage collect metastrings  		echo elgg_echo('garbagecollector:gc:metastrings'); -		 +  		if (delete_orphaned_metastrings()!==false) {  			echo elgg_echo('garbagecollector:ok');  		} else  			echo elgg_echo('garbagecollector:error'); -			 +  		echo "\n"; -		 +  		// 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)); -	 +  		// Now we optimize all tables  		$tables = get_db_tables();  		foreach ($tables as $table) { -			echo sprintf(elgg_echo('garbagecollector:optimize'), $table); -			 +			echo elgg_echo('garbagecollector:optimize', array($table)); +  			if (optimize_table($table)!==false)  				echo elgg_echo('garbagecollector:ok');  			else @@ -62,10 +62,10 @@  			echo "\n";  		} -			 +  		echo elgg_echo('garbagecollector:done');  	} -	 +  	// Initialise plugin  	register_elgg_event_handler('init','system','garbagecollector_init');  ?>
\ No newline at end of file diff --git a/mod/groups/actions/addtogroup.php b/mod/groups/actions/addtogroup.php index dab44666d..346b6065e 100644 --- a/mod/groups/actions/addtogroup.php +++ b/mod/groups/actions/addtogroup.php @@ -51,8 +51,8 @@  							// send welcome email  							notify_user($user->getGUID(), $group->owner_guid, -								sprintf(elgg_echo('groups:welcome:subject'), $group->name), -								sprintf(elgg_echo('groups:welcome:body'), $user->name, $group->name, $group->getURL()), +								elgg_echo('groups:welcome:subject', array($group->name)), +								elgg_echo('groups:welcome:body', array($user->name, $group->name, $group->getURL())),  								NULL);  							system_message(elgg_echo('groups:addedtogroup')); @@ -71,8 +71,8 @@  							// Send email  							$url = elgg_get_site_url()."pg/groups/invited?user_guid={$user->guid}&group_guid={$group->guid}";  							if (notify_user($user->getGUID(), $group->owner_guid, -									sprintf(elgg_echo('groups:invite:subject'), $user->name, $group->name), -									sprintf(elgg_echo('groups:invite:body'), $user->name, $logged_in_user->name, $group->name, $url), +									elgg_echo('groups:invite:subject', array($user->name, $group->name)), +									elgg_echo('groups:invite:body', array($user->name, $logged_in_user->name, $group->name, $url)),  									NULL))  								system_message(elgg_echo("groups:userinvited"));  							else diff --git a/mod/groups/actions/invite.php b/mod/groups/actions/invite.php index 9ab4f2440..6fe379fe1 100644 --- a/mod/groups/actions/invite.php +++ b/mod/groups/actions/invite.php @@ -40,8 +40,8 @@ if (sizeof($user_guid))  						// Send email  						$url = "{$CONFIG->url}pg/groups/invitations/{$user->username}";  						if (notify_user($user->getGUID(), $group->owner_guid, -								sprintf(elgg_echo('groups:invite:subject'), $user->name, $group->name), -								sprintf(elgg_echo('groups:invite:body'), $user->name, $logged_in_user->name, $group->name, $url), +								elgg_echo('groups:invite:subject', array($user->name, $group->name)), +								elgg_echo('groups:invite:body', array($user->name, $logged_in_user->name, $group->name, $url)),  								NULL))  							system_message(elgg_echo("groups:userinvited"));  						else diff --git a/mod/groups/actions/joinrequest.php b/mod/groups/actions/joinrequest.php index a3b372e65..f9bdf2f21 100644 --- a/mod/groups/actions/joinrequest.php +++ b/mod/groups/actions/joinrequest.php @@ -67,8 +67,8 @@ if (($group) && ($user) && (!$group->isMember($user)))  			// Send email  			$url = "{$CONFIG->url}mod/groups/membershipreq.php?group_guid={$group->guid}";  			if (notify_user($group->owner_guid, $user->getGUID(), -					sprintf(elgg_echo('groups:request:subject'), $user->name, $group->name), -					sprintf(elgg_echo('groups:request:body'), $group->getOwnerEntity()->name, $user->name, $group->name, $user->getURL(), $url), +					elgg_echo('groups:request:subject', array($user->name, $group->name)), +					elgg_echo('groups:request:body', array($group->getOwnerEntity()->name, $user->name, $group->name, $user->getURL(), $url)),  					NULL))  				system_message(elgg_echo("groups:joinrequestmade"));  			else diff --git a/mod/groups/activity.php b/mod/groups/activity.php index 4f436cca7..487af7e8d 100644 --- a/mod/groups/activity.php +++ b/mod/groups/activity.php @@ -50,7 +50,7 @@ if (count($entity_guids) > 0) {  $area1 .= elgg_view_title(elgg_echo('groups:activity'));
  $area1 .= elgg_view("group_activity/extend");
  $area1 .= "<div class='group_listings hide_comments'>".$river_items."</div>";
 -$title = sprintf(elgg_echo("groups:activity"), elgg_get_page_owner()->name);
 +$title = elgg_echo("groups:activity", array(elgg_get_page_owner()->name));
  $body = elgg_view_layout('one_column_with_sidebar', $area1);
  // Finally draw the page
 diff --git a/mod/groups/all.php b/mod/groups/all.php index da884bac7..1e7b93b65 100644 --- a/mod/groups/all.php +++ b/mod/groups/all.php @@ -54,7 +54,7 @@  	$objects = "<div class='group_listings'>".$objects."</div>"; -	$title = sprintf(elgg_echo("groups:all"), elgg_get_page_owner()->name); +	$title = elgg_echo("groups:all", array(elgg_get_page_owner()->name));  	if(isloggedin()){  		$area1 .= elgg_view('page_elements/content_header', array('context' => "everyone", 'type' => 'groups', 'new_link' => "pg/groups/new"));  	} diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php index fb67797d3..4250e9aff 100644 --- a/mod/groups/views/default/object/groupforumtopic.php +++ b/mod/groups/views/default/object/groupforumtopic.php @@ -27,53 +27,53 @@ $u = get_user($last_user);  if (elgg_get_context() == "search") {  	var_export($counter);  	if($counter == 1){ -    	$info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) .  "<br />"; +		$info = "<p class='entity_subtext groups'>" . elgg_echo('groups:forum:created:single', array($forum_created, $counter)) .  "<br />";  	}else{ -		$info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) .  "<br />"; +		$info = "<p class='entity_subtext groups'>" . elgg_echo('groups:forum:created', array($forum_created, $counter)) .  "<br />";  	} -    if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), elgg_view_friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>"); -    $info .= '</p>'; +	if (($last_time) && ($u)) $info.= elgg_echo('groups:lastupdated', array(elgg_view_friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>")); +	$info .= '</p>';  	//get the group avatar  	$icon = elgg_view("profile/icon",array('entity' => $u, 'size' => 'tiny')); -    //get the group and topic title -    $info .= "<p class='entity_subtext'><b>" . elgg_echo('groups:topic') . ":</b> <a href=\"".elgg_get_site_url()."mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>"; -    if ($group instanceof ElggGroup) { -    	$info .= "<p class='entity_title'><b>" . elgg_echo('group') . ":</b> <a href=\"{$group->getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."</a></p>"; -    } +	//get the group and topic title +	$info .= "<p class='entity_subtext'><b>" . elgg_echo('groups:topic') . ":</b> <a href=\"".elgg_get_site_url()."mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>"; +	if ($group instanceof ElggGroup) { +		$info .= "<p class='entity_title'><b>" . elgg_echo('group') . ":</b> <a href=\"{$group->getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."</a></p>"; +	}  } else {  	if($counter == 1){ -		$info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) . "</p>"; +		$info = "<p class='entity_subtext groups'>" . elgg_echo('groups:forum:created:single', array($forum_created, $counter)) . "</p>";  	}else{ -		$info = "<p class='entity_subtext groups'>" . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) . "</p>"; +		$info = "<p class='entity_subtext groups'>" . elgg_echo('groups:forum:created', array($forum_created, $counter)) . "</p>";  	} -    $info .= "<p class='entity_title'>" . elgg_echo('groups:started') . " " . $topic_owner->name . ": <a href=\"".elgg_get_site_url()."mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>"; +	$info .= "<p class='entity_title'>" . elgg_echo('groups:started') . " " . $topic_owner->name . ": <a href=\"".elgg_get_site_url()."mod/groups/topicposts.php?topic={$vars['entity']->guid}&group_guid={$group->guid}\">{$title}</a></p>"; -    if (groups_can_edit_discussion($vars['entity'], elgg_get_page_owner()->owner_guid)) { -        	// display the delete link to those allowed to delete -          	$info .= "<div class='entity_metadata'>"; +	if (groups_can_edit_discussion($vars['entity'], elgg_get_page_owner()->owner_guid)) { +			// display the delete link to those allowed to delete +			$info .= "<div class='entity_metadata'>";  			$info .= '<span class="entity_edit">' . elgg_view("output/url", array( -               																'href' => "mod/groups/edittopic.php?group={$vars['entity']->container_guid}&topic={$vars['entity']->guid}", -               																'text' => elgg_echo('edit'), -               															)); +																			'href' => "mod/groups/edittopic.php?group={$vars['entity']->container_guid}&topic={$vars['entity']->guid}", +																			'text' => elgg_echo('edit'), +																		));  			$info .= '</span>'; -			 -        	// display the delete link to those allowed to delete -          	$info .= '<span class="delete_button">' . elgg_view("output/confirmlink", array( -               																'href' => "action/groups/deletetopic?topic=" . $vars['entity']->guid . "&group=" . $vars['entity']->container_guid, -               																'text' => elgg_echo('delete'), -               																'confirm' => elgg_echo('deleteconfirm'), -               															)); + +			// display the delete link to those allowed to delete +			$info .= '<span class="delete_button">' . elgg_view("output/confirmlink", array( +																			'href' => "action/groups/deletetopic?topic=" . $vars['entity']->guid . "&group=" . $vars['entity']->container_guid, +																			'text' => elgg_echo('delete'), +																			'confirm' => elgg_echo('deleteconfirm'), +																		));  			$info .= "</span></div>"; -   } +}  	if (($last_time) && ($u)) {  		$commenter_link = "<a href\"{$u->getURL()}\">$u->name</a>"; -		$text = sprintf(elgg_echo('groups:lastcomment'), elgg_view_friendly_time($last_time), $commenter_link); +		$text = elgg_echo('groups:lastcomment', array(elgg_view_friendly_time($last_time), $commenter_link));  		$info .= "<p class='entity_subtext'>$text</p>";  	} -    //get the user avatar +	//get the user avatar  	$icon = elgg_view("profile/icon",array('entity' => $topic_owner, 'size' => 'tiny'));  } diff --git a/mod/groups/views/default/river/forum/create.php b/mod/groups/views/default/river/forum/create.php index ce3638f15..69481e97e 100644 --- a/mod/groups/views/default/river/forum/create.php +++ b/mod/groups/views/default/river/forum/create.php @@ -11,12 +11,12 @@  	$group_guid = $object->container_guid;  	//grab the annotation, if one exists  	if($vars['item']->annotation_id != 0) { -		$comment = get_annotation($vars['item']->annotation_id)->value;  +		$comment = get_annotation($vars['item']->annotation_id)->value;  	}  	$comment = strip_tags($comment);//this is so we don't get large images etc in the activity river  	$url = elgg_get_site_url() . "mod/groups/topicposts.php?topic=" . $forumtopic . "&group_guid=" . $group_guid;  	$url_user = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("groupforum:river:posted"),$url_user) . " "; +	$string = elgg_echo("groupforum:river:posted", array($url_user)) . " ";  	$string .= elgg_echo("groupforum:river:annotate:create") . " | <a href=\"" . $url . "\">" . $object->title . "</a> <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created) ."<a class='river_comment_form_button link' href=\"{$object_url}\">Visit discussion</a>";  	$string .= elgg_view('likes/forms/link', array('entity' => $object));  	$string .= "</span>"; diff --git a/mod/groups/views/default/river/forum/topic/create.php b/mod/groups/views/default/river/forum/topic/create.php index bb38e1cf3..e595b1fdc 100644 --- a/mod/groups/views/default/river/forum/topic/create.php +++ b/mod/groups/views/default/river/forum/topic/create.php @@ -7,13 +7,13 @@  	$group_guid = $object->container_guid;  	$group = get_entity($group_guid);  	$url = elgg_get_site_url() . "mod/groups/topicposts.php?topic=" . $forumtopic . "&group_guid=" . $group_guid; -	//$comment = $object->getAnnotations("group_topic_post", 1, 0, "asc");  +	//$comment = $object->getAnnotations("group_topic_post", 1, 0, "asc");  	//foreach($comment as $c){  	$contents = $object->description;  	//}  	$contents = strip_tags($contents);//this is so we don't get large images etc in the activity river  	$url_user = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("groupforum:river:postedtopic"),$url_user) . ": "; +	$string = elgg_echo("groupforum:river:postedtopic", array($url_user)) . ": ";  	$string .= "<a href=\"" . $url . "\">" . $object->title . "</a>";  	$string .= " " . elgg_echo('groups:ingroup') . " <a href=\"{$group->getURL()}\">" . $group->name . "</a>";  	$string .= " <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created); @@ -25,5 +25,5 @@  	$string .= "<div class=\"river_content_display\">";  	$string .= elgg_get_excerpt($contents, 200);  	$string .= "</div>"; -	 +  	echo $string;
\ No newline at end of file diff --git a/mod/groups/views/default/river/group/create.php b/mod/groups/views/default/river/group/create.php index aa9fef47a..ef0aaab1b 100644 --- a/mod/groups/views/default/river/group/create.php +++ b/mod/groups/views/default/river/group/create.php @@ -3,9 +3,9 @@  	$performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();  	$object = get_entity($vars['item']->object_guid);  	$objecturl = $object->getURL(); -	 +  	$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("groups:river:create"), $url) . " "; +	$string = elgg_echo("groups:river:create", array($url)) . " ";  	$string .= " <a href=\"" . $object->getURL() . "\">" . $object->name . "</a>";  	$string .= " <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created);  	if (isloggedin()) { diff --git a/mod/groups/views/default/river/object/groupforumtopic/annotate.php b/mod/groups/views/default/river/object/groupforumtopic/annotate.php index c6aa1e5ab..5456b8302 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/annotate.php +++ b/mod/groups/views/default/river/object/groupforumtopic/annotate.php @@ -3,9 +3,9 @@  	$statement = $vars['statement'];  	$performed_by = $statement->getSubject();  	$object = $statement->getObject(); -	 +  	$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("groupforum:river:posted"),$url) . " "; +	$string = elgg_echo("groupforum:river:posted", array($url)) . " ";  	$string .= elgg_echo("groupforum:river:annotate:create") . " | <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";  	//$string .= "<div class=\"river_content\">Title: " . $object->title . "</div>"; diff --git a/mod/groups/views/default/river/object/groupforumtopic/create.php b/mod/groups/views/default/river/object/groupforumtopic/create.php index 7c7d89bad..d9bebc003 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/create.php +++ b/mod/groups/views/default/river/object/groupforumtopic/create.php @@ -3,9 +3,9 @@  	$statement = $vars['statement'];  	$performed_by = $statement->getSubject();  	$object = $statement->getObject(); -	 +  	$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("groupforum:river:created"),$url) . " "; +	$string = elgg_echo("groupforum:river:created", array($url)) . " ";  	$string .= elgg_echo("groupforum:river:create") . " | <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";  	//$string .= "<div class=\"river_content\">Discussion topic: " . $object->title . "</div>"; diff --git a/mod/groups/views/default/river/object/groupforumtopic/update.php b/mod/groups/views/default/river/object/groupforumtopic/update.php index d13c2b61f..ba9b91d2c 100644 --- a/mod/groups/views/default/river/object/groupforumtopic/update.php +++ b/mod/groups/views/default/river/object/groupforumtopic/update.php @@ -3,11 +3,11 @@  	$statement = $vars['statement'];  	$performed_by = $statement->getSubject();  	$object = $statement->getObject(); -	 +  	$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("groupforum:river:updated"),$url) . " "; -    $string .= elgg_echo("groupforum:river:update") . " | <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; -     +	$string = elgg_echo("groupforum:river:updated", array($url)) . " "; +	$string .= elgg_echo("groupforum:river:update") . " | <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; +  ?>  <?php echo $string; ?>
\ No newline at end of file diff --git a/mod/groups/views/default/river/relationship/member/create.php b/mod/groups/views/default/river/relationship/member/create.php index a568920cc..3ba191676 100644 --- a/mod/groups/views/default/river/relationship/member/create.php +++ b/mod/groups/views/default/river/relationship/member/create.php @@ -5,7 +5,7 @@  	$objecturl = $object->getURL();  	$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("groups:river:member"),$url) . " "; +	$string = elgg_echo("groups:river:member", array($url)) . " ";  	$string .= " <a href=\"" . $object->getURL() . "\">" . $object->name . "</a>";  	$string .= " <span class='entity_subtext'>". elgg_view_friendly_time($vars['item']->posted);  	$string .= "</span>"; diff --git a/mod/invitefriends/actions/invite.php b/mod/invitefriends/actions/invite.php index bb6b71385..a1a6241f0 100644 --- a/mod/invitefriends/actions/invite.php +++ b/mod/invitefriends/actions/invite.php @@ -46,14 +46,15 @@ foreach ($emails as $email) {  	}  	$link = elgg_get_site_url() . 'pg/register?friend_guid=' . $current_user->guid . '&invitecode=' . generate_invite_code($current_user->username); -	$message = sprintf(elgg_echo('invitefriends:email'), +	$message = elgg_echo('invitefriends:email', array(  					$CONFIG->site->name,  					$current_user->name,  					$emailmessage,  					$link +				)  	); -	$subject = sprintf(elgg_echo('invitefriends:subject'), $CONFIG->site->name); +	$subject = elgg_echo('invitefriends:subject', array($CONFIG->site->name));  	// create the from address  	$site = get_entity($CONFIG->site_guid); @@ -68,16 +69,16 @@ foreach ($emails as $email) {  }  if ($error) { -	register_error(sprintf(elgg_echo('invitefriends:invitations_sent'), $sent_total)); +	register_error(elgg_echo('invitefriends:invitations_sent', array($sent_total)));  	if (count($bad_emails) > 0) { -		register_error(sprintf(elgg_echo('invitefriends:email_error'), implode(', ', $bad_emails))); +		register_error(elgg_echo('invitefriends:email_error', array(implode(', ', $bad_emails))));  	}  	if (count($already_members) > 0) { -		register_error(sprintf(elgg_echo('invitefriends:already_members'), implode(', ', $already_members))); +		register_error(elgg_echo('invitefriends:already_members', array(implode(', ', $already_members))));  	} -	 +  } else {  	system_message(elgg_echo('invitefriends:success'));  } diff --git a/mod/invitefriends/views/default/invitefriends/formitems.php b/mod/invitefriends/views/default/invitefriends/formitems.php index 68296460a..8bf397d54 100644 --- a/mod/invitefriends/views/default/invitefriends/formitems.php +++ b/mod/invitefriends/views/default/invitefriends/formitems.php @@ -10,7 +10,7 @@ if ($CONFIG->allow_registration) {  	$invite = elgg_echo('friends:invite');  	$introduction = elgg_echo('invitefriends:introduction');  	$message = elgg_echo('invitefriends:message'); -	$default = sprintf(elgg_echo('invitefriends:message:default'), $CONFIG->site->name); +	$default = elgg_echo('invitefriends:message:default', array($CONFIG->site->name));  	echo <<< HTML  <h2>$invite</h2> diff --git a/mod/members/index.php b/mod/members/index.php index 8e6c3ddf9..4df2c10fe 100644 --- a/mod/members/index.php +++ b/mod/members/index.php @@ -1,7 +1,7 @@  <?php  /**   * Elgg members index page - *  + *   * @package ElggMembers   */ @@ -77,4 +77,4 @@ $area2 .= elgg_view('page_elements/elgg_content', array('body' => elgg_view("mem  $body = elgg_view_layout("one_column_with_sidebar", $area2, $area1);  // Display page -echo elgg_view_page(sprintf(elgg_echo('members:members'), $page_owner->name), $body);
\ No newline at end of file +echo elgg_view_page(elgg_echo('members:members', array($page_owner->name)), $body);
\ No newline at end of file diff --git a/mod/messageboard/index.php b/mod/messageboard/index.php index 816f9480f..e0ab13f0e 100644 --- a/mod/messageboard/index.php +++ b/mod/messageboard/index.php @@ -30,5 +30,5 @@ if (isloggedin()) {  $body = elgg_view_layout("two_column_left_sidebar", '', $area2);  // Display page -echo elgg_view_page(sprintf(elgg_echo('messageboard:user'),$entity->name),$body); +echo elgg_view_page(elgg_echo('messageboard:user', array($entity->name)), $body); diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php index 88d7c72f3..f97e77999 100644 --- a/mod/messageboard/start.php +++ b/mod/messageboard/start.php @@ -4,7 +4,7 @@   * Elgg Message board   * This plugin allows users and groups to attach a message board to their profile for other users   * to post comments. - *  + *   * @package ElggMessageBoard   */ @@ -36,7 +36,7 @@ function messageboard_page_handler($page) {  	if (isset($page[0])) {  		set_input('username', $page[0]);  	} -	 +  	// Include the standard messageboard index  	include($CONFIG->pluginspath . "messageboard/index.php");  } @@ -52,7 +52,7 @@ function messageboard_page_handler($page) {   */  function messageboard_add($poster, $owner, $message, $access_id = ACCESS_PUBLIC) {  	global $CONFIG; -	 +  	$result = $owner->annotate('messageboard', $message, $access_id, $poster->guid);  	if (!$result) {  		return FALSE; @@ -69,14 +69,13 @@ function messageboard_add($poster, $owner, $message, $access_id = ACCESS_PUBLIC)  	// only send notification if not self  	if ($poster->guid != $owner->guid) {  		$subject = elgg_echo('messageboard:email:subject'); -		$body = sprintf( -						elgg_echo('messageboard:email:body'), +		$body = elgg_echo('messageboard:email:body', array(  						$poster->name,  						$message,  						elgg_get_site_url() . "pg/messageboard/" . $owner->username,  						$poster->name,  						$poster->getURL() -						); +						));  		notify_user($owner->guid, $poster->guid, $subject, $body);  	} diff --git a/mod/messageboard/views/default/river/object/messageboard/create.php b/mod/messageboard/views/default/river/object/messageboard/create.php index 88bbd56aa..3bdf595d1 100644 --- a/mod/messageboard/views/default/river/object/messageboard/create.php +++ b/mod/messageboard/views/default/river/object/messageboard/create.php @@ -4,7 +4,7 @@ $performed_by = get_entity($vars['item']->subject_guid);  $performed_on = get_entity($vars['item']->object_guid);  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -$string = sprintf(elgg_echo("messageboard:river:added"),$url)  . " <a href=\"{$performed_on->getURL()}\">" . $performed_on->name . "'s</a> " . elgg_echo("messageboard:river:messageboard"); +$string = elgg_echo("messageboard:river:added", array($url))  . " <a href=\"{$performed_on->getURL()}\">" . $performed_on->name . "'s</a> " . elgg_echo("messageboard:river:messageboard"); -echo $string;  +echo $string; diff --git a/mod/messages/index.php b/mod/messages/index.php index 5f4a483be..16049f918 100644 --- a/mod/messages/index.php +++ b/mod/messages/index.php @@ -18,7 +18,7 @@ $page_owner = get_loggedin_user();  set_page_owner($page_owner->getGUID());  // Get the user's inbox, this will be all messages where the 'toId' field matches their guid -// @todo - fix hack where limit + 1 messages are requested  +// @todo - fix hack where limit + 1 messages are requested  $messages = elgg_get_entities_from_metadata(array(  	'type' => 'object',  	'subtype' => 'messages', @@ -46,4 +46,4 @@ $body = elgg_view_layout("one_column_with_sidebar", $area2);  // Draw page -echo elgg_view_page(sprintf(elgg_echo('messages:user'),$page_owner->name),$body); +echo elgg_view_page(elgg_echo('messages:user', array($page_owner->name)), $body); diff --git a/mod/messages/read.php b/mod/messages/read.php index 2bbae1c71..740011c3e 100644 --- a/mod/messages/read.php +++ b/mod/messages/read.php @@ -51,4 +51,4 @@ $sidebar = elgg_view("messages/menu_options");  $body = elgg_view_layout("one_column_with_sidebar", $content, $sidebar);  // Display page -echo elgg_view_page(sprintf(elgg_echo('messages:message')),$body);
\ No newline at end of file +echo elgg_view_page(elgg_echo('messages:message'), $body);
\ No newline at end of file diff --git a/mod/messages/send.php b/mod/messages/send.php index 92563c91d..359c38ae1 100644 --- a/mod/messages/send.php +++ b/mod/messages/send.php @@ -35,4 +35,4 @@ $area3 = elgg_view("messages/menu_options");  $body = elgg_view_layout("one_column_with_sidebar", $area2, $area3);  // Draw page -echo elgg_view_page(sprintf(elgg_echo('messages:send'),$page_owner->name),$body);
\ No newline at end of file +echo elgg_view_page(elgg_echo('messages:send', array($page_owner->name)), $body);
\ No newline at end of file diff --git a/mod/messages/sent.php b/mod/messages/sent.php index e2b22502d..bb0746c80 100644 --- a/mod/messages/sent.php +++ b/mod/messages/sent.php @@ -1,7 +1,7 @@  <?php  /**  * Elgg sent messages page -*  +*  * @package ElggMessages  */ @@ -22,7 +22,7 @@ $limit = 10;  // Display all the messages a user owns, these will make up the sentbox  // @todo - fix hack where limit + 1 is passed -$messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => get_loggedin_userid(), 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit + 1, 'offset' => $offset));  +$messages = elgg_get_entities_from_metadata(array('metadata_name' => 'fromId', 'metadata_value' => get_loggedin_userid(), 'types' => 'object', 'subtypes' => 'messages', 'owner_guid' => $page_owner->guid, 'limit' => $limit + 1, 'offset' => $offset));  // Set the page title @@ -37,4 +37,4 @@ $area2 .= elgg_view("messages/forms/view",array('entity' => $messages, 'page_vie  $body = elgg_view_layout("one_column_with_sidebar", $area2);  // Draw page -echo elgg_view_page(sprintf(elgg_echo('messages:sentMessages'),$page_owner->name),$body); +echo elgg_view_page(elgg_echo('messages:sentMessages', array($page_owner->name)), $body); diff --git a/mod/messages/start.php b/mod/messages/start.php index 07698d893..7f5f2c647 100644 --- a/mod/messages/start.php +++ b/mod/messages/start.php @@ -3,7 +3,7 @@  /**  * Elgg internal messages plugin  * This plugin lets user send each other messages. -*  +*  * @package ElggMessages  */ @@ -11,45 +11,45 @@  * Messages 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  */  function messages_init() { -     -    // Load system configuration + +	// Load system configuration  		global $CONFIG; -		 +  	//add submenu options  		if (elgg_get_context() == "messages") {  			add_submenu_item(elgg_echo('messages:inbox'), "pg/messages/" . get_loggedin_user()->username);  			add_submenu_item(elgg_echo('messages:sentmessages'), "mod/messages/sent.php");  		} -		 +  	// Extend system CSS with our own styles, which are defined in the shouts/css view  		elgg_extend_view('css','messages/css'); -		 +  	// Extend the elgg topbar  		elgg_extend_view('elgg_topbar/extend','messages/topbar'); -	 +  	// Register a page handler, so we can have nice URLs  		register_page_handler('messages','messages_page_handler'); -		 +  	// Register a URL handler for shouts posts  		register_entity_url_handler('messages_url','object','messages'); -		 -    // Extend avatar user-menu	 + +	// Extend avatar user-menu  		elgg_extend_view('profile/menu/links','messages/menu'); -		 +  	// 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');  		register_notification_object('object','messages',elgg_echo('messages:new')); -			     +  	// Override metadata permissions -	    register_plugin_hook('permissions_check:metadata','object','messages_can_edit_metadata'); -	     +		register_plugin_hook('permissions_check:metadata','object','messages_can_edit_metadata'); +  	// ecml  	register_plugin_hook('get_views', 'ecml', 'messages_ecml_views_hook'); @@ -62,16 +62,16 @@ function messages_init() {  function messages_can_edit_metadata($hook_name, $entity_type, $return_value, $parameters) {  	global $messagesendflag; -	 +  	if ($messagesendflag == 1) {  		$entity = $parameters['entity'];  		if ($entity->getSubtype() == "messages") {  			return true;  		}  	} -	 +  	return $return_value; -	 +  }  /** @@ -79,18 +79,18 @@ function messages_can_edit_metadata($hook_name, $entity_type, $return_value, $pa   *   */  function messages_can_edit($hook_name, $entity_type, $return_value, $parameters) { -	 +  	global $messagesendflag; -	 +  	if ($messagesendflag == 1) {  		$entity = $parameters['entity'];  		if ($entity->getSubtype() == "messages") {  			return true;  		}  	} -	 +  	return $return_value; -	 +  }  /** @@ -100,27 +100,16 @@ function messages_can_edit($hook_name, $entity_type, $return_value, $parameters)  function messages_notification_msg($hook_name, $entity_type, $return_value, $parameters) {  	global $CONFIG, $messages_pm; -	 +  	if ($parameters['entity'] instanceof ElggEntity) { -		 +  		if ($parameters['entity']->getSubtype() == 'messages') { -			 +  			return false; -			/*if (!$messages_pm) return false; -			if ($parameters['method'] == 'email') { -				return sprintf( -							elgg_echo('messages:email:body'), -							get_loggedin_user()->name, -							strip_tags($parameters['entity']->description), -							elgg_get_site_url() . "pg/messages/" . $user->username, -							get_loggedin_user()->name, -							elgg_get_site_url() . "mod/messages/send.php?send_to=" . get_loggedin_userid() -						); -			} else if ($parameters['method'] == 'site') return false;*/  		}  	}  	return null; -	 +  }  /** @@ -128,15 +117,15 @@ function messages_notification_msg($hook_name, $entity_type, $return_value, $par   *   */  function messages_can_edit_container($hook_name, $entity_type, $return_value, $parameters) { -	 +  	global $messagesendflag; -	 +  	if ($messagesendflag == 1) {  		return true;  	} -	 +  	return $return_value; -	 +  }  /** @@ -152,22 +141,22 @@ function messages_can_edit_container($hook_name, $entity_type, $return_value, $p   * @return true|false Depending on success   */  function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify = true, $add_to_sent = true) { -	 +  		global $messagesendflag;  		$messagesendflag = 1; -		 +  		global $messages_pm;  		if ($notify) {  			$messages_pm = 1;  		} else {  			$messages_pm = 0;  		} -		 +  	// If $from == 0, set to current user  			if ($from == 0)  				$from = (int) get_loggedin_userid(); -				 -    // Initialise a new ElggObject + +	// Initialise a new ElggObject  			$message_to = new ElggObject();  			$message_sent = new ElggObject();  	// Tell the system it's a message @@ -187,59 +176,58 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify  			$message_to->description = $body;  			$message_sent->title = $subject;  			$message_sent->description = $body; -    // set the metadata -            $message_to->toId = $send_to; // the user receiving the message -            $message_to->fromId = $from; // the user receiving the message -            $message_to->readYet = 0; // this is a toggle between 0 / 1 (1 = read) -            $message_to->hiddenFrom = 0; // this is used when a user deletes a message in their sentbox, it is a flag -            $message_to->hiddenTo = 0; // this is used when a user deletes a message in their inbox -            $message_sent->toId = $send_to; // the user receiving the message -            $message_sent->fromId = $from; // the user receiving the message -            $message_sent->readYet = 0; // this is a toggle between 0 / 1 (1 = read) -            $message_sent->hiddenFrom = 0; // this is used when a user deletes a message in their sentbox, it is a flag -            $message_sent->hiddenTo = 0; // this is used when a user deletes a message in their inbox -             -            $message_to->msg = 1; -            $message_sent->msg = 1; -             -	    // Save the copy of the message that goes to the recipient +	// set the metadata +			$message_to->toId = $send_to; // the user receiving the message +			$message_to->fromId = $from; // the user receiving the message +			$message_to->readYet = 0; // this is a toggle between 0 / 1 (1 = read) +			$message_to->hiddenFrom = 0; // this is used when a user deletes a message in their sentbox, it is a flag +			$message_to->hiddenTo = 0; // this is used when a user deletes a message in their inbox +			$message_sent->toId = $send_to; // the user receiving the message +			$message_sent->fromId = $from; // the user receiving the message +			$message_sent->readYet = 0; // this is a toggle between 0 / 1 (1 = read) +			$message_sent->hiddenFrom = 0; // this is used when a user deletes a message in their sentbox, it is a flag +			$message_sent->hiddenTo = 0; // this is used when a user deletes a message in their inbox + +			$message_to->msg = 1; +			$message_sent->msg = 1; + +		// Save the copy of the message that goes to the recipient  			$success = $message_to->save(); -			 +  		// Save the copy of the message that goes to the sender  			if ($add_to_sent) $success2 = $message_sent->save(); -			 +  			$message_to->access_id = ACCESS_PRIVATE;  			$message_to->save(); -			 +  			if ($add_to_sent) {  				$message_sent->access_id = ACCESS_PRIVATE;  				$message_sent->save();  			} -			 -	    // if the new message is a reply then create a relationship link between the new message -	    // and the message it is in reply to -	        if($reply && $success){ -    	        $create_relationship = add_entity_relationship($message_sent->guid, "reply", $reply);		    	         -	        } -	         -	         -	        global $CONFIG; + +		// if the new message is a reply then create a relationship link between the new message +		// and the message it is in reply to +			if($reply && $success){ +				$create_relationship = add_entity_relationship($message_sent->guid, "reply", $reply); +			} + + +			global $CONFIG;  			$message_contents = strip_tags($body);  			if ($send_to != get_loggedin_user() && $notify) -			notify_user($send_to, get_loggedin_userid(), elgg_echo('messages:email:subject'),  -				sprintf( -							elgg_echo('messages:email:body'), -							get_loggedin_user()->name, -							$message_contents, -							elgg_get_site_url() . "pg/messages/" . $user->username, -							get_loggedin_user()->name, -							elgg_get_site_url() . "mod/messages/send.php?send_to=" . get_loggedin_userid() -						) +			notify_user($send_to, get_loggedin_userid(), elgg_echo('messages:email:subject'), +				elgg_echo('messages:email:body', array( +						get_loggedin_user()->name, +						$message_contents, +						elgg_get_site_url() . "pg/messages/" . $user->username, +						get_loggedin_user()->name, +						elgg_get_site_url() . "mod/messages/send.php?send_to=" . get_loggedin_userid() +					))  			); -			 -	    	$messagesendflag = 0;     -	        return $success; -	 + +			$messagesendflag = 0; +			return $success; +  }  /** @@ -249,12 +237,12 @@ function messages_send($subject, $body, $send_to, $from = 0, $reply = 0, $notify   * @return true|false Depending on success   */  function messages_page_handler($page) { -	 +  	// The first component of a messages URL is the username  	if (isset($page[0])) {  		set_input('username',$page[0]);  	} -	 +  	// The second part dictates what we're doing  	if (isset($page[1])) {  		switch($page[1]) { @@ -268,9 +256,9 @@ function messages_page_handler($page) {  		include(dirname(__FILE__) . "/index.php");  		return true;  	} -	 +  	return false; -	 +  }  function messages_url($message) { @@ -279,39 +267,39 @@ function messages_url($message) {  // A simple function to count the number of messages that are unread in a user's inbox  function count_unread_messages() { -     -    //get the users inbox messages -    //$num_messages = get_entities_from_metadata("toId", get_loggedin_userid(), "object", "messages", 0, 10, 0, "", 0, false); -   $num_messages = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => array( -    							'toId' => get_loggedin_userid(), -    							'readYet' => 0, -    							'msg' => 1 -    						), 'owner_guid' => get_loggedin_userid())); + +	//get the users inbox messages +	//$num_messages = get_entities_from_metadata("toId", get_loggedin_userid(), "object", "messages", 0, 10, 0, "", 0, false); +$num_messages = elgg_get_entities_from_metadata(array('metadata_name_value_pairs' => array( +								'toId' => get_loggedin_userid(), +								'readYet' => 0, +								'msg' => 1 +							), 'owner_guid' => get_loggedin_userid()));  	if (is_array($num_messages))  		$counter = sizeof($num_messages);  	else  		$counter = 0; -		 -    return $counter; -     + +	return $counter; +  }  function messages_site_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL)  {  	global $CONFIG; -	 +  	if (!$from) -		throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'from')); -		  +		throw new NotificationException(elgg_echo('NotificationException:MissingParameter', array('from'))); +  	if (!$to) -		throw new NotificationException(sprintf(elgg_echo('NotificationException:MissingParameter'), 'to')); -		 +		throw new NotificationException(elgg_echo('NotificationException:MissingParameter', array('to'))); +  	global $messages_pm;  	if (!$messages_pm)  		return messages_send($subject,$message,$to->guid,$from->guid,0,false,false);  	else return true; -	 +  }  /**   * Register messages with ECML. diff --git a/mod/pages/history.php b/mod/pages/history.php index 6070a3fd0..d39bf7ae0 100644 --- a/mod/pages/history.php +++ b/mod/pages/history.php @@ -25,7 +25,8 @@ $offset = (int)get_input('offset');  $page_guid = get_input('page_guid');  $pages = get_entity($page_guid); -add_submenu_item(sprintf(elgg_echo("pages:user"), elgg_get_page_owner()->name), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral'); +add_submenu_item(elgg_echo("pages:user", array(elgg_get_page_owner()->name)), +	"pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral');  $title = $pages->title . ": " . elgg_echo("pages:history");  $content = elgg_view_title($title); @@ -36,4 +37,4 @@ $sidebar = elgg_view('pages/sidebar/tree');  $body = elgg_view_layout('one_column_with_sidebar', $content, $sidebar); -echo elgg_view_page($title, $body);
\ No newline at end of file +echo elgg_view_page($title, $body); diff --git a/mod/pages/index.php b/mod/pages/index.php index e3d440692..31f76f625 100644 --- a/mod/pages/index.php +++ b/mod/pages/index.php @@ -12,7 +12,7 @@ global $CONFIG;  // Add menus  $owner = elgg_get_page_owner();  if (!($owner instanceof ElggGroup)) { -		add_submenu_item(sprintf(elgg_echo("pages:user"), elgg_get_page_owner()->name), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral'); +		add_submenu_item(elgg_echo("pages:user", array(elgg_get_page_owner()->name)), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral');  		add_submenu_item(elgg_echo('pages:all'), "mod/pages/world.php", 'pageslinksgeneral');  }  	if (($owner instanceof ElggEntity) && (can_write_to_container(0,$owner->guid))){ @@ -27,9 +27,9 @@ $limit = get_input("limit", 10);  $offset = get_input("offset", 0);  if($owner instanceof ElggGroup){ -	$title = sprintf(elgg_echo("pages:group"),$owner->name); +	$title = elgg_echo("pages:group",array($owner->name));  }else{ -	$title = sprintf(elgg_echo("pages:user"),$owner->name); +	$title = elgg_echo("pages:user",array($owner->name));  } diff --git a/mod/pages/new.php b/mod/pages/new.php index 0d467d449..af1443d0a 100644 --- a/mod/pages/new.php +++ b/mod/pages/new.php @@ -28,7 +28,7 @@ if(get_input('parent_guid')){  	}  	global $CONFIG; -add_submenu_item(sprintf(elgg_echo("pages:user"), elgg_get_page_owner()->name), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral'); +add_submenu_item(elgg_echo("pages:user", array(elgg_get_page_owner()->name)), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral');  $title = elgg_echo("pages:new");  $area2 .= elgg_view_title($title); diff --git a/mod/pages/start.php b/mod/pages/start.php index 0f0af0a80..074e2a771 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -86,7 +86,7 @@ function pages_submenus() {  	// Group submenu option  		if ($page_owner instanceof ElggGroup && elgg_get_context() == 'groups') {  			if($page_owner->pages_enable != "no"){ -				add_submenu_item(sprintf(elgg_echo("pages:group"),$page_owner->name), "pg/pages/owned/" . $page_owner->username); +				add_submenu_item(elgg_echo("pages:group", array($page_owner->name)), "pg/pages/owned/" . $page_owner->username);  			}  		}  } diff --git a/mod/pages/view.php b/mod/pages/view.php index 2600de5c8..83b8d69c1 100644 --- a/mod/pages/view.php +++ b/mod/pages/view.php @@ -28,7 +28,6 @@ if ($container) {  }  global $CONFIG; -// add_submenu_item(sprintf(elgg_echo("pages:user"), elgg_get_page_owner()->name), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral');  if ($pages->canEdit()) {  	add_submenu_item(elgg_echo('pages:newchild'), "pg/pages/new/?parent_guid={$pages->getGUID()}&container_guid=" . elgg_get_page_owner_guid(), 'pagesactions'); diff --git a/mod/pages/views/default/annotation/page.php b/mod/pages/views/default/annotation/page.php index cc0f67746..53f38831f 100644 --- a/mod/pages/views/default/annotation/page.php +++ b/mod/pages/views/default/annotation/page.php @@ -18,8 +18,8 @@ $icon = elgg_view(  $owner_guid = $annotation->owner_guid;  $owner = get_entity($owner_guid); -$rev = sprintf(elgg_echo('pages:revision'), -	elgg_view_friendly_time($annotation->time_created), +$rev = elgg_echo('pages:revision', +	array(elgg_view_friendly_time($annotation->time_created)),  	"<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"  ); diff --git a/mod/pages/views/default/pages/pagelisting.php b/mod/pages/views/default/pages/pagelisting.php index 419fc8d23..0c4a411fb 100644 --- a/mod/pages/views/default/pages/pagelisting.php +++ b/mod/pages/views/default/pages/pagelisting.php @@ -23,8 +23,8 @@ if ($latest) {  	$owner = get_entity($owner_guid); -	$info .= "<p class=\"owner_timestamp\">".sprintf(elgg_echo("pages:strapline"), -					elgg_view_friendly_time($time_updated), +	$info .= "<p class=\"owner_timestamp\">" . elgg_echo("pages:strapline", +					array(elgg_view_friendly_time($time_updated)),  					"<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"  	) . "</p>";  } diff --git a/mod/pages/views/default/pages/pageprofile.php b/mod/pages/views/default/pages/pageprofile.php index 5702ec415..7008e668c 100644 --- a/mod/pages/views/default/pages/pageprofile.php +++ b/mod/pages/views/default/pages/pageprofile.php @@ -62,8 +62,8 @@ if ($rev) {  			$owner_guid = $latest->owner_guid;  			$owner = get_entity($owner_guid); -			echo sprintf(elgg_echo("pages:strapline"), -							elgg_view_friendly_time($time_updated), +			echo elgg_echo("pages:strapline", +							array(elgg_view_friendly_time($time_updated)),  							"<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"  			); diff --git a/mod/pages/views/default/pages/welcome.php b/mod/pages/views/default/pages/welcome.php index 7802fa5af..7dbc6109a 100644 --- a/mod/pages/views/default/pages/welcome.php +++ b/mod/pages/views/default/pages/welcome.php @@ -11,6 +11,6 @@ if($vars['entity']) {  	}  } else {  ?> -<div class="contentWrapper pageswelcome"><p><?php echo sprintf(elgg_echo('pages:welcomemessage'), $vars['config']->sitename); ?></p></div> +<div class="contentWrapper pageswelcome"><p><?php echo elgg_echo('pages:welcomemessage', array($vars['config']->sitename)); ?></p></div>  <?php  } diff --git a/mod/pages/views/default/river/object/page/annotate.php b/mod/pages/views/default/river/object/page/annotate.php index 4f913dbaa..811fc7dea 100644 --- a/mod/pages/views/default/river/object/page/annotate.php +++ b/mod/pages/views/default/river/object/page/annotate.php @@ -10,7 +10,7 @@ $performed_by = $statement->getSubject();  $object = $statement->getObject();  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -$string = sprintf(elgg_echo("pages:river:posted"),$url) . " "; +$string = elgg_echo("pages:river:posted", array($url)) . " ";  $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("pages:river:annotate:create") . "</a> " . $object->title;  //$string .= "<div class=\"river_content\">" . $object->title . "</div>"; diff --git a/mod/pages/views/default/river/object/page/create.php b/mod/pages/views/default/river/object/page/create.php index d182a1ebe..f85e4d42e 100644 --- a/mod/pages/views/default/river/object/page/create.php +++ b/mod/pages/views/default/river/object/page/create.php @@ -12,7 +12,7 @@ $url = $object->getURL();  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";  $contents = strip_tags($object->description); //strip tags from the contents to stop large images etc blowing out the river view -$string = sprintf(elgg_echo("pages:river:created"),$url) . " "; +$string = elgg_echo("pages:river:created", array($url)) . " ";  $string .= elgg_echo("pages:river:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a> <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created) ."</span> <a class='river_comment_form_button link'>Comment</a>";  $string .= elgg_view('likes/forms/link', array('entity' => $object));  $string .= "<div class=\"river_content_display\">"; diff --git a/mod/pages/views/default/river/object/page/update.php b/mod/pages/views/default/river/object/page/update.php index 82b38f315..8ae506a51 100644 --- a/mod/pages/views/default/river/object/page/update.php +++ b/mod/pages/views/default/river/object/page/update.php @@ -10,7 +10,7 @@ $object = get_entity($vars['item']->object_guid);  $url = $object->getURL();  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -$string = sprintf(elgg_echo("pages:river:updated"),$url) . " "; +$string = elgg_echo("pages:river:updated", array($url)) . " ";  $string .= elgg_echo("pages:river:update") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";  echo $string; diff --git a/mod/pages/views/default/river/object/page_top/annotate.php b/mod/pages/views/default/river/object/page_top/annotate.php index 43270f736..e12eb55f9 100644 --- a/mod/pages/views/default/river/object/page_top/annotate.php +++ b/mod/pages/views/default/river/object/page_top/annotate.php @@ -10,7 +10,7 @@ $performed_by = $statement->getSubject();  $object = $statement->getObject();  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -$string = sprintf(elgg_echo("pages:river:posted"),$url) . " "; +$string = elgg_echo("pages:river:posted", array($url)) . " ";  $string .= elgg_echo("pages:river:annotate:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";  echo $string; diff --git a/mod/pages/views/default/river/object/page_top/create.php b/mod/pages/views/default/river/object/page_top/create.php index d49f3d5c4..d951a2f6a 100644 --- a/mod/pages/views/default/river/object/page_top/create.php +++ b/mod/pages/views/default/river/object/page_top/create.php @@ -10,6 +10,6 @@ $performed_by = $statement->getSubject();  $object = $statement->getObject();  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -$string = sprintf(elgg_echo("pages:river:created"),$url) . " "; +$string = elgg_echo("pages:river:created", array($url)) . " ";  $string .= elgg_echo("pages:river:create") . "<a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";  echo $string;
\ No newline at end of file diff --git a/mod/pages/views/default/river/object/page_top/update.php b/mod/pages/views/default/river/object/page_top/update.php index 6187f54bc..611cd21e9 100644 --- a/mod/pages/views/default/river/object/page_top/update.php +++ b/mod/pages/views/default/river/object/page_top/update.php @@ -10,7 +10,7 @@ $performed_by = $statement->getSubject();  $object = $statement->getObject();  $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -$string = sprintf(elgg_echo("pages:river:updated"),$url) . " "; +$string = elgg_echo("pages:river:updated", array($url)) . " ";  $string .= elgg_echo("pages:river:update") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>";  echo $string;
\ No newline at end of file diff --git a/mod/pages/welcome.php b/mod/pages/welcome.php index 4386c5228..7a2a43abd 100644 --- a/mod/pages/welcome.php +++ b/mod/pages/welcome.php @@ -24,7 +24,7 @@ if ($page_owner === false || is_null($page_owner)) {  //get the owners welcome message if it exists  $welcome_message = elgg_get_entities(array('types' => 'object', 'subtypes' => 'pages_welcome', 'container_guid' => $page_owner->getGUID(), 'limit' => 1));  global $CONFIG; -add_submenu_item(sprintf(elgg_echo("pages:user"), elgg_get_page_owner()->name), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral'); +add_submenu_item(elgg_echo("pages:user", array(elgg_get_page_owner()->name)), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral');  $title = elgg_echo("pages:welcome");  $area2 .= elgg_view_title($title); diff --git a/mod/pages/world.php b/mod/pages/world.php index 25081e00d..35a17b1e6 100644 --- a/mod/pages/world.php +++ b/mod/pages/world.php @@ -21,7 +21,7 @@ if (($page_owner instanceof ElggEntity) && ($page_owner->canWriteToContainer()))  }  if(isloggedin()) { -	add_submenu_item(sprintf(elgg_echo("pages:user"), elgg_get_page_owner()->name), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral'); +	add_submenu_item(elgg_echo("pages:user", array(elgg_get_page_owner()->name)), "pg/pages/owned/" . elgg_get_page_owner()->username, 'pageslinksgeneral');  }  add_submenu_item(elgg_echo('pages:all'), "mod/pages/world.php", 'pageslinksgeneral'); @@ -29,7 +29,7 @@ add_submenu_item(elgg_echo('pages:all'), "mod/pages/world.php", 'pageslinksgener  $limit = get_input("limit", 10);  $offset = get_input("offset", 0); -$title = sprintf(elgg_echo("pages:all"),elgg_get_page_owner()->name); +$title = elgg_echo("pages:all",array(elgg_get_page_owner()->name));  // Get objects  elgg_push_context('search'); diff --git a/mod/profile/actions/addcomment.php b/mod/profile/actions/addcomment.php index 5817b8e83..07f72ef8e 100644 --- a/mod/profile/actions/addcomment.php +++ b/mod/profile/actions/addcomment.php @@ -5,44 +5,43 @@  // Make sure we're logged in; forward to the front page if not  if (!isloggedin()) forward(); -	 +  // Get input  $message_content = get_input('message_content'); // the actual message  $page_owner = get_input("pageOwner"); // the message board owner  $message_owner = get_input("guid"); // the user posting the message  $user = get_entity($page_owner); // the commentwall owner details -		 +  // Let's see if we can get a user entity from the specified page_owner  if ($user && !empty($message_content)) { -    		 +  	// If posting the comment was successful, say so  	if ($user->annotate('commentwall',$message_content,$user->access_id, get_loggedin_userid())) { -				 +  			global $CONFIG; -				 +  			if ($user->getGUID() != get_loggedin_userid()) -			notify_user($user->getGUID(), get_loggedin_userid(), elgg_echo('profile:comment:subject'),  -			sprintf( -							elgg_echo('profile:comment:body'), +			notify_user($user->getGUID(), get_loggedin_userid(), elgg_echo('profile:comment:subject'), +			elgg_echo('profile:comment:body', array(  							get_loggedin_user()->name,  							$message_content,  							elgg_get_site_url() . "pg/profile/" . $user->username,  							get_loggedin_user()->name,  							get_loggedin_user()->getURL() -						) -			);  -					 -   			system_message(elgg_echo("profile:commentwall:posted")); -   			// add to river -		    add_to_river('river/object/profile/commentwall/create','commentwall',get_loggedin_userid(),$user->guid); -				 +						)) +			); + +			system_message(elgg_echo("profile:commentwall:posted")); +			// add to river +			add_to_river('river/object/profile/commentwall/create','commentwall',get_loggedin_userid(),$user->guid); +  	} else {  		register_error(elgg_echo("profile:commentwall:failure"));  	} -		 +  } else {  	register_error(elgg_echo("profile:commentwall:blank"));  } -		 +  // Forward back to the messageboard  forward(REFERER);
\ No newline at end of file diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php index c91e5e5a7..f3c928cef 100644 --- a/mod/profile/actions/edit.php +++ b/mod/profile/actions/edit.php @@ -46,7 +46,7 @@ foreach($CONFIG->profile as $shortname => $valuetype) {  	// limit to reasonable sizes.  	if (!is_array($value) && $valuetype != 'longtext' && elgg_strlen($value) > 250) { -		$error = sprintf(elgg_echo('profile:field_too_long'), elgg_echo("profile:{$shortname}")); +		$error = elgg_echo('profile:field_too_long', array(elgg_echo("profile:{$shortname}")));  		register_error($error);  		forward(REFERER);  	} @@ -103,7 +103,7 @@ if (sizeof($input) > 0) {  	//add to river if edited by self  	if (get_loggedin_userid() == $user->guid) {  		add_to_river('river/user/default/profileupdate','update',get_loggedin_userid(),get_loggedin_userid(),get_default_access(get_loggedin_user())); - 	} +	}  	system_message(elgg_echo("profile:saved"));  } diff --git a/mod/profile/views/default/profile/profile_navigation.php b/mod/profile/views/default/profile/profile_navigation.php index b441b949f..a27cf789d 100755 --- a/mod/profile/views/default/profile/profile_navigation.php +++ b/mod/profile/views/default/profile/profile_navigation.php @@ -8,7 +8,7 @@ if (isset($vars['section'])) {  $user = $vars['entity'];  if (!$user) {  	// no user so no profile -	echo sprintf(elgg_echo('viewfailure'), __FILE__); +	echo elgg_echo('viewfailure', array(__FILE__));  	return TRUE;  } @@ -20,7 +20,7 @@ $twitter = '';  $url = "{$user->getURL()}/"; -//select section  +//select section  switch($section){  	case 'friends':  		$friends = 'class="selected"'; @@ -35,7 +35,7 @@ switch($section){  	case 'twitter':  		$twitter = 'class="selected"';  		break; -		 +  	case 'commentwall':  		$commentwall = 'class="selected"';  		break; @@ -60,7 +60,7 @@ switch($section){  			<li <?php echo $twitter; ?>><a href="<?php echo $url . 'twitter'; ?>">Twitter</a></li>  	<?php  		} -		 +  		//insert a view which others can extend  		echo elgg_view('profile_navigation/extend', array('entity' => $user));  	?> diff --git a/mod/profile/views/default/profile/profile_ownerblock.php b/mod/profile/views/default/profile/profile_ownerblock.php index fd3ff6b11..bfed3aec1 100755 --- a/mod/profile/views/default/profile/profile_ownerblock.php +++ b/mod/profile/views/default/profile/profile_ownerblock.php @@ -16,7 +16,7 @@ if ($vars['entity']) {  }  if (!$user) {  	// no user so we quit view -	echo sprintf(elgg_echo('viewfailure'), __FILE__); +	echo elgg_echo('viewfailure', array(__FILE__));  	return TRUE;  } diff --git a/mod/profile/views/default/river/user/default/profileiconupdate.php b/mod/profile/views/default/river/user/default/profileiconupdate.php index b1e5baf88..9e617573b 100644 --- a/mod/profile/views/default/river/user/default/profileiconupdate.php +++ b/mod/profile/views/default/river/user/default/profileiconupdate.php @@ -1,8 +1,8 @@  <?php  	$performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); -	 +  	$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("profile:river:update"),$url) ." <span class='entity_subtext'>" . elgg_view_friendly_time($vars['item']->posted) . "</span>"; -	 +	$string = elgg_echo("profile:river:update", array($url)) ." <span class='entity_subtext'>" . elgg_view_friendly_time($vars['item']->posted) . "</span>"; +  	echo $string;
\ No newline at end of file diff --git a/mod/profile/views/default/river/user/default/profileupdate.php b/mod/profile/views/default/river/user/default/profileupdate.php index 5da11c4b3..156aa8b1b 100644 --- a/mod/profile/views/default/river/user/default/profileupdate.php +++ b/mod/profile/views/default/river/user/default/profileupdate.php @@ -1,10 +1,10 @@  <?php  	$performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); -	 +  	$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; -	$string = sprintf(elgg_echo("profile:river:update"),$url) ." <span class='entity_subtext'>" . elgg_view_friendly_time($vars['item']->posted) . "</span>"; -	 +	$string = elgg_echo("profile:river:update", array($url)) ." <span class='entity_subtext'>" . elgg_view_friendly_time($vars['item']->posted) . "</span>"; +  ?>  <?php echo $string; ?>
\ No newline at end of file diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php index 98c240de5..0413775d6 100644 --- a/mod/riverdashboard/views/default/river/item/wrapper.php +++ b/mod/riverdashboard/views/default/river/item/wrapper.php @@ -77,7 +77,7 @@ if ($comments){  	// display appropriate comment link  	if ($more_comments_count > 0) {  		echo "<a class=\"river_more_comments show_more_button link\">" . -		sprintf(elgg_echo('riverdashboard:n_more_comments'), $more_comments_count) . '</a>'; +		elgg_echo('riverdashboard:n_more_comments', array($more_comments_count)) . '</a>';  		echo "<a style=\"display: none\" class=\"river_more_comments show_less_button link\">" . elgg_echo('riverdashboard:show_less') . '</a>';  	} diff --git a/mod/riverdashboard/views/default/riverdashboard/welcome.php b/mod/riverdashboard/views/default/riverdashboard/welcome.php index 3c9778eda..f5152135e 100644 --- a/mod/riverdashboard/views/default/riverdashboard/welcome.php +++ b/mod/riverdashboard/views/default/riverdashboard/welcome.php @@ -5,4 +5,4 @@   */  ?> -<h2><?php echo sprintf(elgg_echo('welcome:user'), get_loggedin_user()->name); ?></h2>
\ No newline at end of file +<h2><?php echo elgg_echo('welcome:user'), array(get_loggedin_user()->name); ?></h2>
\ No newline at end of file diff --git a/mod/search/index.php b/mod/search/index.php index c68fb4a0f..b042d596f 100644 --- a/mod/search/index.php +++ b/mod/search/index.php @@ -244,7 +244,7 @@ if ($search_type != 'entities' || $search_type == 'all') {  $searched_words = search_remove_ignored_words($query, 'array');  $highlighted_query = search_highlight_words($searched_words, $query); -$body = elgg_view_title(sprintf(elgg_echo('search:results'), "\"$highlighted_query\"")); +$body = elgg_view_title(elgg_echo('search:results', array("\"$highlighted_query\"")));  if (!$results_html) {  	$body .= elgg_view('page_elements/contentwrapper', array('body' => elgg_echo('search:no_results'))); @@ -258,6 +258,6 @@ if (!$results_html) {  $layout_view = search_get_search_view($params, 'layout');  $layout = elgg_view($layout_view, array('params' => $params, 'body' => $body)); -$title = sprintf(elgg_echo('search:results'), "\"{$params['query']}\""); +$title = elgg_echo('search:results', array("\"{$params['query']}\""));  echo elgg_view_page($title, $layout); diff --git a/mod/search/views/default/search/comments/entity.php b/mod/search/views/default/search/comments/entity.php index 008455242..0cd760664 100644 --- a/mod/search/views/default/search/comments/entity.php +++ b/mod/search/views/default/search/comments/entity.php @@ -17,7 +17,7 @@ if ($owner instanceof ElggUser) {  // @todo Sometimes we find comments on entities we can't display...  if ($entity->getVolatileData('search_unavailable_entity')) { -	$title = sprintf(elgg_echo('search:comment_on'), elgg_echo('search:unavailable_entity')); +	$title = elgg_echo('search:comment_on', array(elgg_echo('search:unavailable_entity')));  	// keep anchor for formatting.  	$title = "<a>$title</a>";  } else { @@ -35,7 +35,7 @@ if ($entity->getVolatileData('search_unavailable_entity')) {  		$title = elgg_echo('item:' . $entity->getType());  	} -	$title = sprintf(elgg_echo('search:comment_on'), $title); +	$title = elgg_echo('search:comment_on', array($title));  	$url = $entity->getURL() . '#comment_' . $entity->getVolatileData('search_match_annotation_id');  	$title = "<a href=\"$url\">$title</a>";  } diff --git a/mod/search/views/default/search/listing.php b/mod/search/views/default/search/listing.php index c9dda25f0..d84d567d4 100644 --- a/mod/search/views/default/search/listing.php +++ b/mod/search/views/default/search/listing.php @@ -84,7 +84,7 @@ $more = ($more_check > 0) ? $more_check : 0;  if ($more) {  	$title_key = ($more == 1) ? 'comment' : 'comments'; -	$more_str = sprintf(elgg_echo('search:more'), $count, $type_str); +	$more_str = elgg_echo('search:more', array($count, $type_str));  	$more_link = "<div class='search_listing'><a href=\"$url\">$more_str</a></div>";  } else {  	$more_link = ''; diff --git a/mod/search/views/default/search/startblurb.php b/mod/search/views/default/search/startblurb.php index 2b7230709..3ffa39e68 100644 --- a/mod/search/views/default/search/startblurb.php +++ b/mod/search/views/default/search/startblurb.php @@ -4,4 +4,4 @@   * @subpackage Core   */ -echo sprintf(elgg_echo("tag:search:startblurb"), $vars['query']); +echo elgg_echo("tag:search:startblurb", array($vars['query'])); diff --git a/mod/search/views/rss/search/comments/entity.php b/mod/search/views/rss/search/comments/entity.php index 9bdc062c7..46ef87a14 100644 --- a/mod/search/views/rss/search/comments/entity.php +++ b/mod/search/views/rss/search/comments/entity.php @@ -16,7 +16,7 @@ if ($author) {  // @todo Sometimes we find comments on entities we can't display...  if ($entity->getVolatileData('search_unavailable_entity')) { -	$title = sprintf(elgg_echo('search:comment_on'), elgg_echo('search:unavailable_entity')); +	$title = elgg_echo('search:comment_on', array(elgg_echo('search:unavailable_entity')));  } else {  	if ($entity->getType() == 'object') {  		$title = $entity->title; @@ -32,7 +32,7 @@ if ($entity->getVolatileData('search_unavailable_entity')) {  		$title = elgg_echo('item:' . $entity->getType());  	} -	$title = sprintf(elgg_echo('search:comment_on'), $title); +	$title = elgg_echo('search:comment_on', array($title));  	$title .= ' ' . elgg_echo('search:comment_by') . ' ' . $author_name;  	$url = $entity->getURL() . '#annotation-' . $entity->getVolatileData('search_match_annotation_id');  } diff --git a/mod/tagcloud/tagcloud.php b/mod/tagcloud/tagcloud.php index a0bc1502f..de384b25b 100644 --- a/mod/tagcloud/tagcloud.php +++ b/mod/tagcloud/tagcloud.php @@ -2,15 +2,15 @@  /**   * Display sidebar tagcloud   **/ -  +  // Load Elgg engine  require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); -  +  $title = elgg_view_title(elgg_echo('tagcloud:site:title'));  $tags = display_tagcloud(0, 100, 'tags');  //select the correct canvas area  $body = elgg_view_layout("one_column_with_sidebar", $title . $tags, $sidebar); -		 +  // Display page -echo elgg_view_page(sprintf(elgg_echo('tagcloud:site:title'),$page_owner->name),$body);
\ No newline at end of file +echo elgg_view_page(elgg_echo('tagcloud:site:title', array($page_owner->name)), $body);
\ No newline at end of file diff --git a/mod/thewire/index.php b/mod/thewire/index.php index 41b8969aa..a1de242c5 100644 --- a/mod/thewire/index.php +++ b/mod/thewire/index.php @@ -2,37 +2,37 @@  	/**  	 * Elgg thewire index page -	 *  +	 *  	 * @package Elggthewire  	 */  	// Load Elgg engine  		require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); -		 +  	// Get the current page's owner  		$page_owner = elgg_get_page_owner();  		if ($page_owner === false || is_null($page_owner)) {  			$page_owner = get_loggedin_user();  			set_page_owner($page_owner->getGUID());  		} -		 +  	// title  		if (elgg_get_page_owner_guid() == get_loggedin_userid()) { -		    $area2 = elgg_view_title(elgg_echo("thewire:read")); -	    } else { -		    $area2 = elgg_view_title(sprintf(elgg_echo("thewire:user"),$page_owner->name)); -	    } -	     +			$area2 = elgg_view_title(elgg_echo("thewire:read")); +		} else { +			$area2 = elgg_view_title(elgg_echo("thewire:user",array($page_owner->name))); +		} +  	//add form  		$area2 .= elgg_view("thewire/forms/add"); -	     +  	// Display the user's wire  		$area2 .= list_user_objects($page_owner->getGUID(),'thewire'); -		     -    //select the correct canvas area -	    $body = elgg_view_layout("one_column_with_sidebar", $area2); -		 + +	//select the correct canvas area +		$body = elgg_view_layout("one_column_with_sidebar", $area2); +  	// Display page -		echo elgg_view_page(sprintf(elgg_echo('thewire:user'),$page_owner->name),$body); -		 +		echo elgg_view_page(elgg_echo('thewire:user', array($page_owner->name)), $body); +  ?>
\ No newline at end of file diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php index 4ef51cae6..a94d3a4aa 100644 --- a/mod/thewire/views/default/object/thewire.php +++ b/mod/thewire/views/default/object/thewire.php @@ -2,65 +2,65 @@  	/**  	 * Elgg Wire Posts Listings -	 *  +	 *  	 * @package thewire  	 *  	 * @question - do we want users to be able to edit thewire? -	 *  +	 *  	 * @uses $vars['entity'] Optionally, the note to view  	 */  if (isset($vars['entity'])) {  	$user_name = $vars['entity']->getOwnerEntity()->name; -	 +  	//if the note is a reply, we need some more info  	$note_url = ''; -	$note_owner = elgg_echo("thewire:notedeleted");  		 +	$note_owner = elgg_echo("thewire:notedeleted");  ?>  <div class="wire_post">  	<div class="wire_post_contents clearfix radius8"> -	    <div class="wire_post_icon"> -	    <?php -		        echo elgg_view("profile/icon",array('entity' => $vars['entity']->getOwnerEntity(), 'size' => 'tiny')); -	    ?> -	    </div> +		<div class="wire_post_icon"> +		<?php +				echo elgg_view("profile/icon",array('entity' => $vars['entity']->getOwnerEntity(), 'size' => 'tiny')); +		?> +		</div>  		<div class="wire_post_options">  		<?php  			if(isloggedin()){  		?>  			<a href="<?php echo elgg_get_site_url(); ?>mod/thewire/add.php?wire_username=<?php echo $vars['entity']->getOwnerEntity()->username; ?>" class="action_button reply small"><?php echo elgg_echo('thewire:reply'); ?></a> -    		<?php +			<?php  			}//close reply if statement  			// if the user looking at thewire post can edit, show the delete link  			if ($vars['entity']->canEdit()) { -			   echo "<span class='delete_button'>" . elgg_view("output/confirmlink",array( +			echo "<span class='delete_button'>" . elgg_view("output/confirmlink",array(  					'href' => "action/thewire/delete?thewirepost=" . $vars['entity']->getGUID(),  					'text' => elgg_echo('delete'),  					'confirm' => elgg_echo('deleteconfirm'),  				)) . "</span>";  			}  		?> -	    </div> -		 +		</div> +  		<div class="wire_post_info">  			<a href="<?php echo elgg_get_site_url(); ?>pg/thewire/<?php echo $vars['entity']->getOwnerEntity()->username; ?>"><?php echo $user_name; ?></a>  			<?php -			    $desc = $vars['entity']->description; -			    //$desc = preg_replace('/\@([A-Za-z0-9\_\.\-]*)/i','@<a href="' . elgg_get_site_url() . 'pg/thewire/$1">$1</a>',$desc); +				$desc = $vars['entity']->description; +				//$desc = preg_replace('/\@([A-Za-z0-9\_\.\-]*)/i','@<a href="' . elgg_get_site_url() . 'pg/thewire/$1">$1</a>',$desc);  				echo parse_urls($desc);  			?> -			<p class="entity_subtext">		 +			<p class="entity_subtext">  			<?php -				echo elgg_echo("thewire:wired") . " " . sprintf(elgg_echo("thewire:strapline"), -								elgg_view_friendly_time($vars['entity']->time_created) +				echo elgg_echo("thewire:wired") . " " . elgg_echo("thewire:strapline", +								array(elgg_view_friendly_time($vars['entity']->time_created))  				);  				echo ' '; -				echo sprintf(elgg_echo('thewire:via_method'), elgg_echo($vars['entity']->method)); +				echo elgg_echo('thewire:via_method', array(elgg_echo($vars['entity']->method)));  				echo '.';  			?> -			</p>		 +			</p>  		</div>  	</div>  </div> diff --git a/mod/thewire/views/rss/object/thewire.php b/mod/thewire/views/rss/object/thewire.php index 23a11a9d3..fbbb670b7 100644 --- a/mod/thewire/views/rss/object/thewire.php +++ b/mod/thewire/views/rss/object/thewire.php @@ -8,7 +8,7 @@  $owner = $vars['entity']->getOwnerEntity();  if ($owner) { -	$title = sprintf(elgg_echo('thewire:by'), $owner->name); +	$title = elgg_echo('thewire:by', array($owner->name));  } else {  	$subtitle = strip_tags($vars['entity']->description);  	$title = substr($subtitle,0,32); diff --git a/mod/thewire/views/rss/search/object/thewire/entity.php b/mod/thewire/views/rss/search/object/thewire/entity.php index 3d4a17b78..d9ea81ad1 100644 --- a/mod/thewire/views/rss/search/object/thewire/entity.php +++ b/mod/thewire/views/rss/search/object/thewire/entity.php @@ -12,7 +12,7 @@ if (!array_key_exists('entity', $vars)) {  $owner = $vars['entity']->getOwnerEntity();  if ($owner) { -	$title = sprintf(elgg_echo('thewire:by'), $owner->name); +	$title = elgg_echo('thewire:by', array($owner->name));  }  $description = $vars['entity']->getVolatileData('search_matched_description'); diff --git a/mod/uservalidationbyemail/lib/functions.php b/mod/uservalidationbyemail/lib/functions.php index 92b37c843..b7ca30bcc 100644 --- a/mod/uservalidationbyemail/lib/functions.php +++ b/mod/uservalidationbyemail/lib/functions.php @@ -40,8 +40,8 @@ function uservalidationbyemail_request_validation($user_guid) {  		$site = $CONFIG->site;  		// Send validation email -		$subject = sprintf(elgg_echo('email:validate:subject'), $user->name, $site->name); -		$body = sprintf(elgg_echo('email:validate:body'), $user->name, $site->name, $link, $site->name, $site->url); +		$subject = elgg_echo('email:validate:subject', array($user->name, $site->name)); +		$body = elgg_echo('email:validate:body', array($user->name, $site->name, $link, $site->name, $site->url));  		$result = notify_user($user->guid, $CONFIG->site->guid, $subject, $body, NULL, 'email');  		if ($result) { diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php index 9e9efa29a..5844fb5f4 100644 --- a/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php +++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php @@ -16,22 +16,22 @@ $user = elgg_get_array_value('user', $vars);  $checkbox = "<label><input type=\"checkbox\" value=\"$user->guid\" class=\"input_checkboxes\" name=\"user_guids[]\">"  	. "$user->username - \"$user->name\" <$user->email></label>"; -$created = sprintf(elgg_echo('uservalidationbyemail:admin:user_created'), elgg_view_friendly_time($user->time_created)); +$created = elgg_echo('uservalidationbyemail:admin:user_created', array(elgg_view_friendly_time($user->time_created)));  $validate = elgg_view('output/confirmlink', array( -	'confirm' => sprintf(elgg_echo('uservalidationbyemail:confirm_validate_user'), $user->username), +	'confirm' => elgg_echo('uservalidationbyemail:confirm_validate_user', array($user->username)),  	'href' => "action/uservalidationbyemail/validate/?user_guids[]=$user->guid",  	'text' => elgg_echo('uservalidationbyemail:admin:validate')  ));  $resend_email = elgg_view('output/confirmlink', array( -	'confirm' => sprintf(elgg_echo('uservalidationbyemail:confirm_resend_validation'), $user->username), +	'confirm' => elgg_echo('uservalidationbyemail:confirm_resend_validation', array($user->username)),  	'href' => "action/uservalidationbyemail/resend_validation/?user_guids[]=$user->guid",  	'text' => elgg_echo('uservalidationbyemail:admin:resend_validation')  ));  $delete = elgg_view('output/confirmlink', array( -	'confirm' => sprintf(elgg_echo('uservalidationbyemail:confirm_delete'), $user->username), +	'confirm' => elgg_echo('uservalidationbyemail:confirm_delete', array($user->username)),  	'href' => "action/uservalidationbyemail/delete/?user_guids[]=$user->guid",  	'text' => elgg_echo('uservalidationbyemail:admin:delete')  ));  | 
