$full = elgg_extract('full_view', $vars, FALSE); $post = elgg_extract('entity', $vars, FALSE); if (!$post) { return true; } // make compatible with posts created with original Curverider plugin $thread_id = $post->wire_thread; if (!$thread_id) { $post->wire_thread = $post->guid; } $owner = $post->getOwnerEntity(); $owner_icon = elgg_view_entity_icon($owner, 'tiny'); $owner_link = elgg_view('output/url', array('href' => "wire/owner/{$owner->username}", 'text' => $owner->name, 'is_trusted' => true)); $author_text = elgg_echo('byline', array($owner_link)); $date = elgg_view_friendly_time($post->time_created); $metadata = elgg_view_menu('entity', array('entity' => $post, 'handler' => 'wire', 'sort_by' => 'priority', 'class' => 'elgg-menu-hz')); $subtitle = "{$author_text} {$date}"; // do not show the metadata and controls in widget view if (elgg_in_context('widgets')) { $metadata = ''; } $params = array('entity' => $post, 'metadata' => $metadata, 'subtitle' => $subtitle, 'content' => wire_filter($post->description), 'tags' => false); $params = $params + $vars; $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($owner_icon, $list_body); echo "<div class=\"hidden\" id=\"wire-reply-{$post->guid}\">"; echo "</div>"; if ($post->reply) { echo "<div class=\"wire-parent hidden\" id=\"wire-previous-{$post->guid}\">"; echo "</div>"; }
/** * Links: http://www.example.org/ */ public function testReplaceLinks() { // beginning of text $text = "http://www.test.org"; $expected = $this->getLink('http://www.test.org'); $result = wire_filter($text); $this->assertEqual($result, $expected); // not at beginning of text $text = "test http://www.test.org"; $expected = 'test ' . $this->getLink('http://www.test.org'); $result = wire_filter($text); $this->assertEqual($result, $expected); // followed by comma $text = "test http://www.test.org, test"; $expected = 'test ' . $this->getLink('http://www.test.org') . ', test'; $result = wire_filter($text); $this->assertEqual($result, $expected); // preceeded by comma $text = "test,http://www.test.org test"; $expected = 'test,' . $this->getLink('http://www.test.org') . ' test'; $result = wire_filter($text); $this->assertEqual($result, $expected); // followed by period $text = "test http://www.test.org. test"; $expected = 'test ' . $this->getLink('http://www.test.org') . '. test'; $result = wire_filter($text); $this->assertEqual($result, $expected); // surrounded by parentheses $text = "test (http://www.test.org) test"; $expected = 'test (' . $this->getLink('http://www.test.org') . ') test'; $result = wire_filter($text); $this->assertEqual($result, $expected); // no http:// $text = "test www.test.org test"; $expected = 'test ' . $this->getLink('www.test.org') . ' test'; $result = wire_filter($text); $this->assertEqual($result, $expected); }
<?php /** * File river view. */ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = wire_filter($excerpt); $subject = $vars['item']->getSubjectEntity(); $subject_link = elgg_view('output/url', array('href' => $subject->getURL(), 'text' => $subject->name, 'class' => 'elgg-river-subject', 'is_trusted' => true)); $object_link = elgg_view('output/url', array('href' => "wire/owner/{$subject->username}", 'text' => elgg_echo('wire:wire'), 'class' => 'elgg-river-object', 'is_trusted' => true)); $summary = elgg_echo("river:create:object:wire", array($subject_link, $object_link)); echo elgg_view('river/elements/layout', array('item' => $vars['item'], 'message' => $excerpt, 'summary' => $summary));