From eff4faea7f3c95440f02ea45d0be4f67236e2bf3 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 3 Nov 2010 22:13:10 +0000 Subject: Fixes #1320: Bundled mods use elgg_echo()'s internal string substitution. git-svn-id: http://code.elgg.org/elgg/trunk@7229 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/start.php | 4 +- mod/blog/views/default/blog/sidebar_menu.php | 4 +- mod/blog/views/default/object/blog.php | 2 +- .../views/default/river/object/blog/create.php | 2 +- mod/bookmarks/start.php | 10 +- .../views/default/bookmarks/bookmarklet.php | 2 +- .../default/river/object/bookmarks/create.php | 2 +- mod/categories/listing.php | 2 +- mod/categories/start.php | 2 +- mod/diagnostics/actions/download.php | 8 +- mod/diagnostics/start.php | 10 +- mod/file/friends.php | 22 +-- mod/file/index.php | 18 +- mod/file/search.php | 24 +-- mod/file/start.php | 142 +++++++------- mod/file/views/default/object/file.php | 84 ++++----- .../views/default/river/object/file/create.php | 6 +- mod/garbagecollector/start.php | 28 +-- mod/groups/actions/addtogroup.php | 8 +- mod/groups/actions/invite.php | 4 +- mod/groups/actions/joinrequest.php | 4 +- mod/groups/activity.php | 2 +- mod/groups/all.php | 2 +- .../views/default/object/groupforumtopic.php | 56 +++--- mod/groups/views/default/river/forum/create.php | 4 +- .../views/default/river/forum/topic/create.php | 6 +- mod/groups/views/default/river/group/create.php | 4 +- .../river/object/groupforumtopic/annotate.php | 4 +- .../river/object/groupforumtopic/create.php | 4 +- .../river/object/groupforumtopic/update.php | 8 +- .../default/river/relationship/member/create.php | 2 +- mod/invitefriends/actions/invite.php | 13 +- .../views/default/invitefriends/formitems.php | 2 +- mod/members/index.php | 4 +- mod/messageboard/index.php | 2 +- mod/messageboard/start.php | 11 +- .../default/river/object/messageboard/create.php | 4 +- mod/messages/index.php | 4 +- mod/messages/read.php | 2 +- mod/messages/send.php | 2 +- mod/messages/sent.php | 6 +- mod/messages/start.php | 204 ++++++++++----------- mod/pages/history.php | 5 +- mod/pages/index.php | 6 +- mod/pages/new.php | 2 +- mod/pages/start.php | 2 +- mod/pages/view.php | 1 - mod/pages/views/default/annotation/page.php | 4 +- mod/pages/views/default/pages/pagelisting.php | 4 +- mod/pages/views/default/pages/pageprofile.php | 4 +- mod/pages/views/default/pages/welcome.php | 2 +- .../views/default/river/object/page/annotate.php | 2 +- .../views/default/river/object/page/create.php | 2 +- .../views/default/river/object/page/update.php | 2 +- .../default/river/object/page_top/annotate.php | 2 +- .../views/default/river/object/page_top/create.php | 2 +- .../views/default/river/object/page_top/update.php | 2 +- mod/pages/welcome.php | 2 +- mod/pages/world.php | 4 +- mod/profile/actions/addcomment.php | 33 ++-- mod/profile/actions/edit.php | 4 +- .../views/default/profile/profile_navigation.php | 8 +- .../views/default/profile/profile_ownerblock.php | 2 +- .../river/user/default/profileiconupdate.php | 6 +- .../default/river/user/default/profileupdate.php | 6 +- .../views/default/river/item/wrapper.php | 2 +- .../views/default/riverdashboard/welcome.php | 2 +- mod/search/index.php | 4 +- .../views/default/search/comments/entity.php | 4 +- mod/search/views/default/search/listing.php | 2 +- mod/search/views/default/search/startblurb.php | 2 +- mod/search/views/rss/search/comments/entity.php | 4 +- mod/tagcloud/tagcloud.php | 8 +- mod/thewire/index.php | 30 +-- mod/thewire/views/default/object/thewire.php | 40 ++-- mod/thewire/views/rss/object/thewire.php | 2 +- .../views/rss/search/object/thewire/entity.php | 2 +- mod/uservalidationbyemail/lib/functions.php | 4 +- .../uservalidationbyemail/unvalidated_user.php | 8 +- 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 "
  • $month
  • "; } echo ''; } - + // 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 = "username\">{$owner->name}"; -$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 = "

    " . elgg_view('output/tags', array('tags' => $blog->tags)) . "

    "; }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 = "getURL()}\">{$performed_by->name}"; -$title = sprintf(elgg_echo('blog:river:create'), $url); +$title = elgg_echo('blog:river:create', array($url)); $string .= $title . " getURL()}\">{$object->title} " . 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 = "getURL()}\">{$performed_by->name}"; -$string = sprintf(elgg_echo("bookmarks:river:created"),$url) . " "; +$string = elgg_echo("bookmarks:river:created", array($url)) . " "; $string .= "address . "\">" . $object->title . ""; if (($is_group instanceof ElggGroup) && (elgg_get_context() != 'groups')){ $string .= " " . elgg_echo('bookmarks:ingroup') . " getURL()}\">" . $is_group->name . ""; 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 @@ 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, '<>', 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 @@ 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 .= "

    ".elgg_echo("file:none")."

    "; } 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 = "
    ".$area1.$area2."
    "; $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 @@ "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 .= "

    ".elgg_echo("file:none")."

    "; } - + //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 = "
    ".$area1.$area2."
    "; $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 = "
    ".$area1.$area2."
    "; - + $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 @@ 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 ""; - + } else { - + $info = "

    getURL()}\">{$title}

    "; $info .= "

    username}\">{$owner->name} {$friendlytime}"; $numcomments = elgg_count_comments($file); if ($numcomments) - $info .= ", getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")"; + $info .= ", getURL()}\">" . elgg_echo("comments") . " (" . $numcomments . ")"; $info .= "

    "; $icon = "getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'small')) . ""; - + echo elgg_view_listing($icon, $info); - + } - + } else { // Start main version - + ?>
    - +
    guid . "&search_viewtype=gallery"; ?> - +

    $owner, 'size' => 'tiny')); - + ?>

    name; ?>

    - +
    - +
    $desc)); ?>
    - ".elgg_view('file/specialcontent/' . $mime, $vars)."
    "; } else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) { echo "
    ".elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars)."
    "; } - + ?> - +

    - + canEdit()) { @@ -147,21 +147,21 @@

    -   - mod/file/edit.php?file_guid=getGUID(); ?>">  + "action/file/delete?file=" . $file->getGUID(), 'text' => elgg_echo("delete"), 'confirm' => elgg_echo("file:delete:confirm"), 'is_action' => true, - - )); + + )); ?>

    - @@ -171,9 +171,9 @@ 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 = "getURL()}\">{$performed_by->name}"; - $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 .= " getURL() . "\">" . $object->title . ""; if ($container && $container instanceof ElggGroup) { $string .= ' ' . elgg_echo('groups:river:togroup') . " getURL() ."\">". $container->name . ""; } 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 @@ $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 .= "
    ".$river_items."
    "; -$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 = "
    ".$objects."
    "; - $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 = "

    " . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) . "
    "; + $info = "

    " . elgg_echo('groups:forum:created:single', array($forum_created, $counter)) . "
    "; }else{ - $info = "

    " . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) . "
    "; + $info = "

    " . elgg_echo('groups:forum:created', array($forum_created, $counter)) . "
    "; } - if (($last_time) && ($u)) $info.= sprintf(elgg_echo('groups:lastupdated'), elgg_view_friendly_time($last_time), " getURL() . "\">" . $u->name . ""); - $info .= '

    '; + if (($last_time) && ($u)) $info.= elgg_echo('groups:lastupdated', array(elgg_view_friendly_time($last_time), " getURL() . "\">" . $u->name . "")); + $info .= '

    '; //get the group avatar $icon = elgg_view("profile/icon",array('entity' => $u, 'size' => 'tiny')); - //get the group and topic title - $info .= "

    " . elgg_echo('groups:topic') . ": guid}&group_guid={$group->guid}\">{$title}

    "; - if ($group instanceof ElggGroup) { - $info .= "

    " . elgg_echo('group') . ": getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."

    "; - } + //get the group and topic title + $info .= "

    " . elgg_echo('groups:topic') . ": guid}&group_guid={$group->guid}\">{$title}

    "; + if ($group instanceof ElggGroup) { + $info .= "

    " . elgg_echo('group') . ": getURL()}\">".htmlentities($group->name, ENT_QUOTES, 'UTF-8') ."

    "; + } } else { if($counter == 1){ - $info = "

    " . sprintf(elgg_echo('groups:forum:created:single'), $forum_created, $counter) . "

    "; + $info = "

    " . elgg_echo('groups:forum:created:single', array($forum_created, $counter)) . "

    "; }else{ - $info = "

    " . sprintf(elgg_echo('groups:forum:created'), $forum_created, $counter) . "

    "; + $info = "

    " . elgg_echo('groups:forum:created', array($forum_created, $counter)) . "

    "; } - $info .= "

    " . elgg_echo('groups:started') . " " . $topic_owner->name . ": guid}&group_guid={$group->guid}\">{$title}

    "; + $info .= "

    " . elgg_echo('groups:started') . " " . $topic_owner->name . ": guid}&group_guid={$group->guid}\">{$title}

    "; - if (groups_can_edit_discussion($vars['entity'], elgg_get_page_owner()->owner_guid)) { - // display the delete link to those allowed to delete - $info .= "