From 9fe063022e08a4b6fa5f5935f8f185d5d95814a4 Mon Sep 17 00:00:00 2001 From: Sem Date: Wed, 25 Apr 2012 19:09:22 +0200 Subject: Upgraded to Elgg 1.8.4. --- mod/thewire/actions/add.php | 2 +- mod/thewire/pages/thewire/owner.php | 4 +++- mod/thewire/start.php | 12 +++--------- mod/thewire/tests/regex.php | 6 ++++++ 4 files changed, 13 insertions(+), 11 deletions(-) (limited to 'mod/thewire') diff --git a/mod/thewire/actions/add.php b/mod/thewire/actions/add.php index 97b630678..6b3d8d5ba 100644 --- a/mod/thewire/actions/add.php +++ b/mod/thewire/actions/add.php @@ -17,7 +17,7 @@ if (empty($body)) { forward(REFERER); } -$guid = thewire_save_post($body, get_loggedin_userid(), $access_id, $parent_guid, $method); +$guid = thewire_save_post($body, elgg_get_logged_in_user_guid(), $access_id, $parent_guid, $method); if (!$guid) { register_error(elgg_echo("thewire:error")); forward(REFERER); diff --git a/mod/thewire/pages/thewire/owner.php b/mod/thewire/pages/thewire/owner.php index f544aa655..6246c1770 100644 --- a/mod/thewire/pages/thewire/owner.php +++ b/mod/thewire/pages/thewire/owner.php @@ -14,10 +14,12 @@ $title = elgg_echo('thewire:user', array($owner->name)); elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all"); elgg_push_breadcrumb($owner->name); +$context = ''; if (elgg_get_logged_in_user_guid() == $owner->guid) { $form_vars = array('class' => 'thewire-form'); $content = elgg_view_form('thewire/add', $form_vars); $content .= elgg_view('input/urlshortener'); + $context = 'mine'; } $content .= elgg_list_entities(array( @@ -28,7 +30,7 @@ $content .= elgg_list_entities(array( )); $body = elgg_view_layout('content', array( - 'filter_context' => 'mine', + 'filter_context' => $context, 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('thewire/sidebar'), diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 202e3d1d6..5d5786e2f 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -18,12 +18,6 @@ elgg_register_event_handler('init', 'system', 'thewire_init'); * The Wire initialization */ function thewire_init() { - global $CONFIG; - - // this can be removed in favor of activate/deactivate scripts - if (!update_subtype('object', 'thewire', 'ElggWire')) { - add_subtype('object', 'thewire', 'ElggWire'); - } // register the wire's JavaScript $thewire_js = elgg_get_simplecache_url('js', 'thewire'); @@ -68,7 +62,7 @@ function thewire_init() { elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'thewire_notify_message'); // Register actions - $action_base = $CONFIG->pluginspath . 'thewire/actions'; + $action_base = elgg_get_plugins_path() . 'thewire/actions'; elgg_register_action("thewire/add", "$action_base/add.php"); elgg_register_action("thewire/delete", "$action_base/delete.php"); @@ -219,7 +213,7 @@ function thewire_filter($text) { // usernames $text = preg_replace( - '/(^|[^\w])@([\w.]+)/', + '/(^|[^\w])@([\p{L}\p{Nd}._]+)/u', '$1@$2', $text); @@ -310,7 +304,7 @@ function thewire_save_post($text, $userid, $access_id, $parent_guid = 0, $method */ function thewire_send_response_notification($guid, $parent_guid, $user) { $parent_owner = get_entity($parent_guid)->getOwnerEntity(); - $user = get_loggedin_user(); + $user = elgg_get_logged_in_user_entity(); // check to make sure user is not responding to self if ($parent_owner->guid != $user->guid) { diff --git a/mod/thewire/tests/regex.php b/mod/thewire/tests/regex.php index f5487a422..c73e06bdc 100644 --- a/mod/thewire/tests/regex.php +++ b/mod/thewire/tests/regex.php @@ -127,6 +127,12 @@ class TheWireRegexTest extends ElggCoreUnitTest { $expected = "test (" . $this->getUserWireLink('user') . ") test"; $result = thewire_filter($text); $this->assertEqual($result, $expected); + + // utf8 characters + $text = "@tyúkanyó"; + $expected = $this->getUserWireLink('tyúkanyó'); + $result = thewire_filter($text); + $this->assertEqual($result, $expected); } /** -- cgit v1.2.3