thewire.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * View a wire post
  4. *
  5. * @uses $vars['entity']
  6. */
  7. elgg_load_js('elgg.thewire');
  8. $full = elgg_extract('full_view', $vars, FALSE);
  9. $post = elgg_extract('entity', $vars, FALSE);
  10. if (!$post) {
  11. return true;
  12. }
  13. // make compatible with posts created with original Curverider plugin
  14. $thread_id = $post->wire_thread;
  15. if (!$thread_id) {
  16. $post->wire_thread = $post->guid;
  17. }
  18. $owner = $post->getOwnerEntity();
  19. $owner_icon = elgg_view_entity_icon($owner, 'tiny');
  20. $owner_link = elgg_view('output/url', array(
  21. 'href' => "thewire/owner/$owner->username",
  22. 'text' => $owner->name,
  23. 'is_trusted' => true,
  24. ));
  25. $author_text = elgg_echo('byline', array($owner_link));
  26. $date = elgg_view_friendly_time($post->time_created);
  27. $metadata = elgg_view_menu('entity', array(
  28. 'entity' => $post,
  29. 'handler' => 'thewire',
  30. 'sort_by' => 'priority',
  31. 'class' => 'elgg-menu-hz',
  32. ));
  33. $subtitle = "$author_text $date";
  34. // do not show the metadata and controls in widget view
  35. if (elgg_in_context('widgets')) {
  36. $metadata = '';
  37. }
  38. // Add decrypt option
  39. if (strlen(strstr($post->description,"U2FsdGVkX1"))>0) {
  40. $post->description = '<div id="ID' . $post->guid . '" title="' . $post->description . '">' . $post->description . '<blockquote> <a href="javascript:decryptText(\'ID' . $post->guid . '\')">' . elgg_echo("elgg-crypt:decrypt") . '</a></blockquote></div>';
  41. } else {
  42. $post->description = $post->description;
  43. }
  44. $params = array(
  45. 'entity' => $post,
  46. 'metadata' => $metadata,
  47. 'subtitle' => $subtitle,
  48. 'content' => thewire_filter($post->description),
  49. 'tags' => false,
  50. );
  51. $params = $params + $vars;
  52. $list_body = elgg_view('object/elements/summary', $params);
  53. echo elgg_view_image_block($owner_icon, $list_body);
  54. if ($post->reply) {
  55. echo "<div class=\"thewire-parent hidden\" id=\"thewire-previous-{$post->guid}\">";
  56. echo "</div>";
  57. }