diff options
Diffstat (limited to 'mod/thewire')
-rw-r--r-- | mod/thewire/activate.php | 10 | ||||
-rw-r--r-- | mod/thewire/deactivate.php | 6 | ||||
-rw-r--r-- | mod/thewire/languages/en.php | 1 | ||||
-rw-r--r-- | mod/thewire/manifest.xml | 2 | ||||
-rw-r--r-- | mod/thewire/pages/thewire/everyone.php | 1 | ||||
-rw-r--r-- | mod/thewire/pages/thewire/friends.php | 2 | ||||
-rw-r--r-- | mod/thewire/pages/thewire/owner.php | 2 | ||||
-rw-r--r-- | mod/thewire/start.php | 94 | ||||
-rw-r--r-- | mod/thewire/views/default/js/thewire.php | 6 | ||||
-rw-r--r-- | mod/thewire/views/default/thewire/profile_status.php | 2 | ||||
-rw-r--r-- | mod/thewire/views/rss/object/thewire.php | 59 |
11 files changed, 98 insertions, 87 deletions
diff --git a/mod/thewire/activate.php b/mod/thewire/activate.php new file mode 100644 index 000000000..1cc64ceb1 --- /dev/null +++ b/mod/thewire/activate.php @@ -0,0 +1,10 @@ +<?php +/** + * Register the ElggWire class for the object/thewire subtype + */ + +if (get_subtype_id('object', 'thewire')) { + update_subtype('object', 'thewire', 'ElggWire'); +} else { + add_subtype('object', 'thewire', 'ElggWire'); +} diff --git a/mod/thewire/deactivate.php b/mod/thewire/deactivate.php new file mode 100644 index 000000000..3e20207a1 --- /dev/null +++ b/mod/thewire/deactivate.php @@ -0,0 +1,6 @@ +<?php +/** + * Deregister the ElggWire class + */ + +update_subtype('object', 'thewire');
\ No newline at end of file diff --git a/mod/thewire/languages/en.php b/mod/thewire/languages/en.php index 9716fc060..3c83d145f 100644 --- a/mod/thewire/languages/en.php +++ b/mod/thewire/languages/en.php @@ -20,6 +20,7 @@ $english = array( 'thewire:noposts' => "No wire posts yet", 'item:object:thewire' => "Wire posts", 'thewire:update' => 'Update', + 'thewire:by' => 'Wire post by %s', 'thewire:previous' => "Previous", 'thewire:hide' => "Hide", diff --git a/mod/thewire/manifest.xml b/mod/thewire/manifest.xml index 9f6b0eaa9..962ed12f1 100644 --- a/mod/thewire/manifest.xml +++ b/mod/thewire/manifest.xml @@ -8,7 +8,7 @@ <description>Microblogging for Elgg</description> <website>http://www.elgg.org/</website> <copyright>See COPYRIGHT.txt</copyright> - <license>GNU Public License version 2</license> + <license>GNU General Public License version 2</license> <requires> <type>elgg_release</type> <version>1.8</version> diff --git a/mod/thewire/pages/thewire/everyone.php b/mod/thewire/pages/thewire/everyone.php index e78395c31..909f0caf2 100644 --- a/mod/thewire/pages/thewire/everyone.php +++ b/mod/thewire/pages/thewire/everyone.php @@ -8,6 +8,7 @@ elgg_push_breadcrumb(elgg_echo('thewire')); $title = elgg_echo('thewire:everyone'); +$content = ''; if (elgg_is_logged_in()) { $form_vars = array('class' => 'thewire-form'); $content .= elgg_view_form('thewire/add', $form_vars); diff --git a/mod/thewire/pages/thewire/friends.php b/mod/thewire/pages/thewire/friends.php index 26ad03da6..e7f5eed59 100644 --- a/mod/thewire/pages/thewire/friends.php +++ b/mod/thewire/pages/thewire/friends.php @@ -14,7 +14,7 @@ elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all"); elgg_push_breadcrumb($owner->name, "thewire/owner/$owner->username"); elgg_push_breadcrumb(elgg_echo('friends')); -if (get_loggedin_userid() == $owner->guid) { +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'); diff --git a/mod/thewire/pages/thewire/owner.php b/mod/thewire/pages/thewire/owner.php index a95786b0a..f544aa655 100644 --- a/mod/thewire/pages/thewire/owner.php +++ b/mod/thewire/pages/thewire/owner.php @@ -14,7 +14,7 @@ $title = elgg_echo('thewire:user', array($owner->name)); elgg_push_breadcrumb(elgg_echo('thewire'), "thewire/all"); elgg_push_breadcrumb($owner->name); -if (get_loggedin_userid() == $owner->guid) { +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'); diff --git a/mod/thewire/start.php b/mod/thewire/start.php index d5e995359..328e5d46c 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -20,6 +20,7 @@ elgg_register_event_handler('init', 'system', 'thewire_init'); 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'); } @@ -84,57 +85,60 @@ function thewire_init() { * thewire/tag/<tag> View wire posts tagged with <tag> * * @param array $page From the page_handler function - * @return true|false Depending on success + * @return bool */ function thewire_page_handler($page) { $base_dir = elgg_get_plugins_path() . 'thewire/pages/thewire'; - // if just /thewire go to global view in the else statement - if (isset($page[0]) && $page[0]) { - - switch ($page[0]) { - case "all": - include "$base_dir/everyone.php"; - break; - - case "friends": - include "$base_dir/friends.php"; - break; - - case "owner": - include "$base_dir/owner.php"; - break; - - case "thread": - if (isset($page[1])) { - set_input('thread_id', $page[1]); - } - include "$base_dir/thread.php"; - break; - case "reply": - if (isset($page[1])) { - set_input('guid', $page[1]); - } - include "$base_dir/reply.php"; - break; - case "tag": - if (isset($page[1])) { - set_input('tag', $page[1]); - } - include "$base_dir/tag.php"; - break; - case "previous": - if (isset($page[1])) { - set_input('guid', $page[1]); - } - include "$base_dir/previous.php"; - break; - } - } else { - include "$base_dir/everyone.php"; + if (!isset($page[0])) { + $page = array('all'); } + switch ($page[0]) { + case "all": + include "$base_dir/everyone.php"; + break; + + case "friends": + include "$base_dir/friends.php"; + break; + + case "owner": + include "$base_dir/owner.php"; + break; + + case "thread": + if (isset($page[1])) { + set_input('thread_id', $page[1]); + } + include "$base_dir/thread.php"; + break; + + case "reply": + if (isset($page[1])) { + set_input('guid', $page[1]); + } + include "$base_dir/reply.php"; + break; + + case "tag": + if (isset($page[1])) { + set_input('tag', $page[1]); + } + include "$base_dir/tag.php"; + break; + + case "previous": + if (isset($page[1])) { + set_input('guid', $page[1]); + } + include "$base_dir/previous.php"; + break; + + default: + return false; + } return true; } @@ -213,7 +217,7 @@ function thewire_filter($text) { // usernames $text = preg_replace( - '/(^|[^\w])@([\w]+)/', + '/(^|[^\w])@([\w.]+)/', '$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/$2">@$2</a>', $text); diff --git a/mod/thewire/views/default/js/thewire.php b/mod/thewire/views/default/js/thewire.php index d9bf6d10e..0a6eba134 100644 --- a/mod/thewire/views/default/js/thewire.php +++ b/mod/thewire/views/default/js/thewire.php @@ -18,7 +18,7 @@ elgg.thewire.init = function() { }); $(".thewire-previous").live('click', elgg.thewire.viewPrevious); -} +}; /** * Update the number of characters left with every keystroke @@ -42,7 +42,7 @@ elgg.thewire.textCounter = function(textarea, status, limit) { $("#thewire-submit-button").removeAttr('disabled', 'disabled'); $("#thewire-submit-button").removeClass('elgg-state-disabled'); } -} +}; /** * Display the previous wire post @@ -81,6 +81,6 @@ elgg.thewire.viewPrevious = function(event) { } event.preventDefault(); -} +}; elgg.register_hook_handler('init', 'system', elgg.thewire.init); diff --git a/mod/thewire/views/default/thewire/profile_status.php b/mod/thewire/views/default/thewire/profile_status.php index ab20b5341..b5d9dbd80 100644 --- a/mod/thewire/views/default/thewire/profile_status.php +++ b/mod/thewire/views/default/thewire/profile_status.php @@ -27,7 +27,7 @@ if ($latest_wire && count($latest_wire) > 0) { $button = elgg_view('output/url', array( 'text' => elgg_echo('thewire:update'), 'href' => $url_to_wire, - 'class' => 'elgg-button elgg-button-action right', + 'class' => 'elgg-button elgg-button-action float-alt', 'is_trusted' => true, )); } diff --git a/mod/thewire/views/rss/object/thewire.php b/mod/thewire/views/rss/object/thewire.php index 8229f46f1..494c2c8dc 100644 --- a/mod/thewire/views/rss/object/thewire.php +++ b/mod/thewire/views/rss/object/thewire.php @@ -2,46 +2,35 @@ /** * Elgg thewire rss view * - * @package Elgg - * @subpackage Core + * @package ElggTheWire */ $owner = $vars['entity']->getOwnerEntity(); -if ($owner) { - $title = elgg_echo('thewire:by', array($owner->name)); -} else { - $subtitle = strip_tags($vars['entity']->description); - $title = elgg_get_excerpt($subtitle, 32); +if (!$owner) { + return true; } -?> +$title = elgg_echo('thewire:by', array($owner->name)); +$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8'); +$pubdate = date('r', $vars['entity']->getTimeCreated()); + +$description = autop($vars['entity']->description); + +$creator = elgg_view('page/components/creator', $vars); +$georss = elgg_view('page/components/georss', $vars); +$extension = elgg_view('extensions/item', $vars); + +$item = <<<__HTML <item> -<guid isPermaLink='false'><?php echo $vars['entity']->getGUID(); ?></guid> -<pubDate><?php echo date("r", $vars['entity']->time_created) ?></pubDate> -<link><?php echo htmlspecialchars($vars['entity']->getURL()); ?></link> -<title><![CDATA[<?php echo $title; ?>]]></title> -<description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description> -<?php -$owner = $vars['entity']->getOwnerEntity(); -if ($owner) { - ?> - <dc:creator><?php echo $owner->name; ?></dc:creator> - <?php -} -?> -<?php -if ( - ($vars['entity'] instanceof Locatable) && - ($vars['entity']->getLongitude()) && - ($vars['entity']->getLatitude()) -) { - ?> - <georss:point> - <?php echo $vars['entity']->getLatitude(); ?> <?php echo $vars['entity']->getLongitude(); ?> - </georss:point> - <?php -} -?> -<?php echo elgg_view('extensions/item'); ?> + <guid isPermaLink="true">$permalink</guid> + <pubDate>$pubdate</pubDate> + <link>$permalink</link> + <title><![CDATA[$title]]></title> + <description><![CDATA[$description]]></description> + $creator$georss$extension </item> + +__HTML; + +echo $item; |