diff options
Diffstat (limited to 'mod/thewire')
-rw-r--r-- | mod/thewire/actions/add.php | 2 | ||||
-rw-r--r-- | mod/thewire/classes/ElggWire.php | 4 | ||||
-rw-r--r-- | mod/thewire/start.php | 12 | ||||
-rw-r--r-- | mod/thewire/tests/regex.php | 6 |
4 files changed, 15 insertions, 9 deletions
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/classes/ElggWire.php b/mod/thewire/classes/ElggWire.php index 3242dd5cb..9c92dd8f2 100644 --- a/mod/thewire/classes/ElggWire.php +++ b/mod/thewire/classes/ElggWire.php @@ -1,6 +1,10 @@ <?php /** * ElggWire Class + * + * @property string $method The method used to create the wire post (site, sms, api) + * @property bool $reply Whether this wire post was a reply to another post + * @property int $wire_thread The identifier of the thread for this wire post */ class ElggWire extends ElggObject { diff --git a/mod/thewire/start.php b/mod/thewire/start.php index 328e5d46c..ebfe29538 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -18,18 +18,14 @@ 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'); elgg_register_simplecache_view('js/thewire'); elgg_register_js('elgg.thewire', $thewire_js, 'footer'); + elgg_register_ajax_view('thewire/previous'); + // add a site navigation item $item = new ElggMenuItem('thewire', elgg_echo('thewire'), 'thewire/all'); elgg_register_menu_item('site', $item); @@ -66,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"); @@ -217,7 +213,7 @@ function thewire_filter($text) { // usernames $text = preg_replace( - '/(^|[^\w])@([\w.]+)/', + '/(^|[^\w])@([\p{L}\p{Nd}._]+)/u', '$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/$2">@$2</a>', $text); 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); } /** |