public static function renderURLHTML($url) { $favicon = "http://g.etfv.co/{$url}"; if (class_exists('UFCOE\\Elgg\\Url')) { $sniffer = new Url(); $guid = $sniffer->getGuid($url); if ($entity = get_entity($guid)) { $favicon = $entity->getIconURL('tiny'); if (elgg_instanceof($entity->user)) { $text = "@{$entity->username}"; } else { $text = isset($entity->name) ? $entity->name : $entity->title; } } } if (!$text) { $embedder = new Embedder($url); $meta = $embedder->extractMeta('oembed'); if ($meta->title) { $text = $meta->title; } else { $text = elgg_get_excerpt($url, 35); } } return elgg_view('output/url', array('text' => "<span class=\"favicon\" style=\"background-image:url({$favicon})\"></span><span class=\"link\">{$text}</span>", 'href' => $url, 'class' => 'extractor-link')); }
public function generateTitle($river) { $subject = $river->getSubjectEntity(); $object = $river->getObjectEntity(); if ($object) { $container = $object->getContainerEntity(); if ($object->title) { $objectTitle = html_entity_decode($object->title, ENT_QUOTES); } else { $objectTitle = elgg_get_excerpt(html_entity_decode($object->description, ENT_QUOTES), 60); } } switch ($river->action_type) { case "create": $title = $subject->name . " heeft " . $objectTitle . " geplaatst in " . $container->name; break; case "update": $title = $subject->name . " heeft " . $objectTitle . " vernieuwd in " . $container->name; break; case "join": $title = $subject->name . " is lid geworden van " . $objectTitle; break; case "reply": $title = $subject->name . " heeft gereageerd op " . $objectTitle; break; default: $title = ""; break; } return $title; }
/** * Get the excerpt for this blog post * * @param int $length Length of the excerpt (optional) * @return string * @since 1.9.0 */ public function getExcerpt($length = 250) { if ($this->excerpt) { return $this->excerpt; } else { return elgg_get_excerpt($this->description, $length); } }
/** * Get the URL for this entity * * @see ElggEntity::getURL() * * @return string */ public function getURL() { $title = $this->title; if (strlen($title) > 50) { $title = elgg_get_excerpt($title, 50); } $title = str_replace("...", "", $title); return elgg_normalize_url("user_support/support_ticket/" . $this->getGUID() . "/" . elgg_get_friendly_title($title)); }
protected function renderTable($limit, $offset = 0) { static $count; static $iterator; $options = ['query' => sanitize_string($this->option('keyword')), 'guids' => $this->option('guid') ?: ELGG_ENTITIES_ANY_VALUE, 'types' => $this->option('type') ?: 'object', 'subtypes' => $this->option('subtype') ?: ELGG_ENTITIES_ANY_VALUE, 'limit' => $limit, 'offset' => (int) $offset, 'order_by' => 'e.guid ASC']; if ($this->option('keyword')) { $results = elgg_trigger_plugin_hook('search', $this->option('type') ?: 'object', $options, []); $count = $results['count']; $batch = $results['entities']; } else { $options['count'] = true; if (!$count) { $count = elgg_get_entities($options); } unset($options['count']); $batch = new ElggBatch('elgg_get_entities', $options); } if (!$count) { $this->write('<comment>No entities to display</comment>'); return; } $headers = ['#', 'GUID', 'Type', 'Title/name', 'Description', 'Owner', 'Container', 'Access']; if ($this->option('full-view')) { $headers[] = 'Metadata'; } $table = new Table($this->output); $table->setHeaders($headers); foreach ($batch as $entity) { /* @var $entity \ElggEntity */ $row = [$iterator, $entity->guid, ($subtype = $entity->getSubtype()) ? elgg_echo("item:{$entity->type}:{$subtype}") : elgg_echo("item:{$entity->type}"), elgg_get_excerpt($entity->getDisplayName(), 25), elgg_get_excerpt($entity->description, 25), ($owner = $entity->getOwnerEntity()) ? '[' . $owner->guid . '] ' . elgg_get_excerpt($owner->getDisplayName(), 25) : '', ($container = $entity->getContainerEntity()) ? '[' . $container->guid . '] ' . elgg_get_excerpt($container->getDisplayName(), 25) : '', '[' . $entity->access_id . '] ' . elgg_get_excerpt(get_readable_access_level($entity->access_id), 25)]; if ($this->option('full-view')) { $metadata = new \ElggBatch('elgg_get_metadata', ['guids' => $entity->guid, 'limit' => 0]); $metatable = []; foreach ($metadata as $md) { $name = $md->name; $values = (array) $md->value; foreach ($values as $value) { $metatable[] = "{$name}: {$value}"; } } $row[] = implode("\n", $metatable); } $table->addRow($row); $table->addRow(new TableSeparator()); $iterator++; } $table->render(); if ($count > $limit + $offset) { $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('Load next batch [y,n]?', true); if (!$helper->ask($this->input, $this->output, $question)) { return; } $this->renderTable($limit, $limit + $offset); } }
/** * Get display name of the notification target * * @return string $name Display name */ public function getTargetName() { $name = elgg_echo('unknown'); $target = $this->getTarget(); if (!$target) { // This may happen if the target owner changes the ACL // after the notification has already been created return $name; } $name = $target->getDisplayName(); if (empty($name) && $target->description) { $name = elgg_get_excerpt($target->description, 20); } return $name; }
/** * Change the notification contents * * @param string $hook the name of the hook * @param string $type the type of the hook * @param \Elgg\Notifications\Notification $return_value current return value * @param array $params supplied params * * @return void|\Elgg\Notifications\Notification */ public static function createPoll($hook, $type, $return_value, $params) { if (empty($params) || !is_array($params)) { return; } $event = elgg_extract('event', $params); if (!$event instanceof \Elgg\Notifications\Event) { return; } $entity = $event->getObject(); $actor = $event->getActor(); $language = elgg_extract('language', $params); $return_value->subject = elgg_echo('poll:notification:create:subject', [$entity->title], $language); $return_value->summary = elgg_echo('poll:notification:create:summary', [$entity->title], $language); $return_value->body = elgg_echo('poll:notification:create:body', [$actor->name, $entity->title, elgg_get_excerpt($entity->description), $entity->getURL()], $language); return $return_value; }
/** * Prepare a notification message about a created event * * @param string $hook Hook name * @param string $type Hook type * @param Elgg_Notifications_Notification $notification The notification to prepare * @param array $params Hook parameters * * @return Elgg_Notifications_Notification */ public static function prepareCreateEventNotification($hook, $type, $notification, $params) { $entity = $params['event']->getObject(); $owner = $params['event']->getActor(); $language = $params['language']; $subject = elgg_echo('event_manager:notification:subject', [], $language); $summary = elgg_echo('event_manager:notification:summary', [], $language); $body = elgg_echo('event_manager:notification:body', [$owner->name, $entity->title], $language); if ($description = $entity->description) { $body .= PHP_EOL . PHP_EOL . elgg_get_excerpt($description); } $body .= PHP_EOL . PHP_EOL . $entity->getURL(); $notification->subject = $subject; $notification->body = $body; $notification->summary = $summary; return $notification; }
/** * Notify $user that $sharer shared his $entity. * * @param type $user * @param type $sharer * @param type $entity */ function share_notify_user(ElggUser $user, ElggUser $sharer, ElggEntity $entity) { if (!$user instanceof ElggUser) { return false; } if (!$sharer instanceof ElggUser) { return false; } if (!$entity instanceof ElggEntity) { return false; } $title_str = $entity->title; if (!$title_str) { $title_str = elgg_get_excerpt($entity->description); } $site = get_config('site'); $subject = elgg_echo('share:notifications:subject', array($sharer->name, $title_str)); $body = elgg_echo('share:notifications:body', array($user->name, $sharer->name, $title_str, $site->name, $entity->getURL(), $sharer->getURL())); notify_user($user->guid, $sharer->guid, $subject, $body); }
/** * {@inheritdoc} */ public function post(ParameterBag $params) { $entity_guid = (int) $params->guid; //check to see if the user has already liked the item if (elgg_annotation_exists($entity_guid, 'likes')) { throw new GraphException(elgg_echo("likes:alreadyliked"), HttpResponse::HTTP_NOT_MODIFIED); } // Let's see if we can get an entity with the specified GUID $entity = get_entity($entity_guid); if (!$entity) { throw new GraphException(elgg_echo("likes:notfound"), HttpResponse::HTTP_NOT_FOUND); } // limit likes through a plugin hook (to prevent liking your own content for example) if (!$entity->canAnnotate(0, 'likes')) { // plugins should register the error message to explain why liking isn't allowed throw new GraphException(elgg_echo("likes:notallowed"), HttpResponse::HTTP_FORBIDDEN); } $user = elgg_get_logged_in_user_entity(); $annotation_id = create_annotation($entity->guid, 'likes', "likes", "", $user->guid, $entity->access_id); // tell user annotation didn't work if that is the case if (!$annotation_id) { throw new GraphException(elgg_echo("likes:failure")); } // notify if poster wasn't owner if ($entity->owner_guid != $user->guid) { $owner = $entity->getOwnerEntity(); $annotation = elgg_get_annotation_from_id($annotation_id); $title_str = $entity->getDisplayName(); if (!$title_str) { $title_str = elgg_get_excerpt($entity->description); } $site = elgg_get_site_entity(); $subject = elgg_echo('likes:notifications:subject', array($user->name, $title_str), $owner->language); $body = elgg_echo('likes:notifications:body', array($owner->name, $user->name, $title_str, $site->name, $entity->getURL(), $user->getURL()), $owner->language); notify_user($entity->owner_guid, $user->guid, $subject, $body, array('action' => 'create', 'object' => $annotation)); } return array('nodes' => array(elgg_get_annotation_from_id($annotation_id))); }
/** * Get exportable entity values * * @param ElggEntity $entity * @return array */ function elgg_tokeninput_export_entity($entity) { if (!elgg_instanceof($entity)) { if ($entity_from_guid = get_entity($entity)) { $entity = $entity_from_guid; } else { return elgg_tokeninput_export_metadata($entity); } } $type = $entity->getType(); $subtype = $entity->getSubtype(); $icon = elgg_view_entity_icon($entity, 'small', array('use_hover' => false)); if (elgg_instanceof($entity, 'user')) { $title = "{$entity->name} ({$entity->username})"; } else { if (elgg_instanceof($entity, 'group')) { $title = $entity->name; } else { $title = $entity->getDisplayName(); if (!$title) { $title = elgg_echo('untitled'); } $metadata[] = elgg_echo('byline', array($entity->getOwnerEntity()->name)); } } if ($entity->description) { $metadata[] = elgg_get_excerpt(elgg_strip_tags($entity->description), 100); } if ($entity->location) { $metadata[] = $entity->location; } $export = array('label' => $title, 'value' => $entity->guid, 'metadata' => $metadata ? implode('<br />', $metadata) : '', 'icon' => $icon, 'type' => $type, 'subtype' => $subtype, 'html_result' => elgg_view_exists("tokeninput/{$type}/{$subtype}") ? elgg_view("tokeninput/{$type}/{$subtype}", array('entity' => $entity, 'for' => 'result')) : null, 'html_token' => elgg_view_exists("tokeninput/{$type}/{$subtype}") ? elgg_view("tokeninput/{$type}/{$subtype}", array('entity' => $entity, 'for' => 'token')) : null); $export = elgg_trigger_plugin_hook('tokeninput:entity:export', $type, array('entity' => $entity), $export); array_walk_recursive($export, function (&$value) { $value = is_string($value) ? html_entity_decode($value, ENT_QUOTES, 'UTF-8') : $value; }); return $export; }
{$anchor} <div class="mbn"> \t{$menu} \t{$commenter_link} \t<span class="elgg-subtext"> \t\t{$friendlytime} \t</span> \t{$comment_text} </div> HTML; if ($moderating) { $html = elgg_view_image_block($commenter_icon, $body); echo elgg_view_image_block($checkbox, $html, array('class' => 'moderated-comment')); } else { echo elgg_view_image_block($commenter_icon, $body); } } else { // brief view $excerpt = elgg_get_excerpt($comment->description, 80); $posted = elgg_echo('generic_comment:on', array($commenter_link, $entity_link)); $body = <<<HTML <span class="elgg-subtext"> \t{$posted} ({$friendlytime}): {$excerpt} </span> HTML; if ($moderating) { echo elgg_view_image_block($commenter_icon, $body, array('class' => 'moderated-comment')); } else { echo elgg_view_image_block($commenter_icon, $body); } }
if ($blogs = elgg_get_entities($blog_options)) { if ($vars['email']) { $title = "<h2 class='email'>" . elgg_echo("blog:blogs") . "</h2>"; $title .= "<h5 class='email'>To view all site blogs visit " . elgg_get_site_url() . "blog/all?filter=newest </h5>"; $latest_blogs = "<div class='email-section'>"; foreach ($blogs as $blog) { $latest_blogs .= "<div class='blog'>"; $latest_blogs .= "<h4 class='email'>" . $blog->title . "</h4>"; $latest_blogs .= "<p>" . elgg_get_excerpt($blog->description) . "</p>"; $latest_blogs .= "</div>"; } $latest_blogs .= "</div>"; echo $title . $latest_blogs; } else { $title = elgg_echo("blog:blogs"); $title .= "<h5>To view all site blogs visit " . elgg_get_site_url() . "blog/all?filter=newest </h5>"; $latest_blogs = ""; foreach ($blogs as $blog) { $latest_blogs .= "<div class='digest-blog'>"; if ($blog->icontime) { $latest_blogs .= "<img src='" . $blog->getIconURL("medium") . "' />"; } $latest_blogs .= "<span>"; $latest_blogs .= "<h4>" . $blog->title . "</h4>"; $latest_blogs .= elgg_get_excerpt($blog->description); $latest_blogs .= "</span>"; $latest_blogs .= "</div>"; } echo elgg_view_module("digest", $title, $latest_blogs); } }
<?php elgg_push_context('activity'); $item = elgg_extract('item', $vars); $subject = $item->getSubjectEntity(); $object = $item->getObjectEntity(); $subject_link = elgg_view('framework/bootstrap/user/elements/name', array('entity' => $subject)); $object_link = elgg_view('framework/bootstrap/object/elements/title', array('entity' => $object)); $breadcrumbs = elgg_view('framework/bootstrap/object/elements/breadcrumbs', array('entity' => $object)); if (!empty($breadcrumbs)) { $breadcrumbs_link = elgg_echo('river:in:forum', array($breadcrumbs)); } $key = "river:create:object:hjforum"; $summary = elgg_echo($key, array($subject_link, $object_link)) . $breadcrumbs_link; echo elgg_view('river/item', array('item' => $item, 'message' => elgg_get_excerpt(strip_tags($object->description)), 'summary' => $summary)); elgg_pop_context();
<?php /** * Short summary of the action that occurred * * @vars['item'] ElggRiverItem */ $item = $vars['item']; $subject = $item->getSubjectEntity(); $object = $item->getObjectEntity(); $target = $object->getContainerEntity(); $subject_link = elgg_view('output/url', array('href' => $subject->getURL(), 'text' => $subject->name, 'class' => 'elgg-river-subject', 'is_trusted' => true)); $object_text = $object->title ? $object->title : $object->name; $object_link = elgg_view('output/url', array('href' => $object->getURL(), 'text' => elgg_get_excerpt($object_text, 100), 'class' => 'elgg-river-object', 'is_trusted' => true)); $action = $item->action_type; $type = $item->type; $subtype = $item->subtype ? $item->subtype : 'default'; $container = $object->getContainerEntity(); if ($container instanceof ElggGroup) { $params = array('href' => $container->getURL(), 'text' => $container->name, 'is_trusted' => true); $group_link = elgg_view('output/url', $params); $group_string = elgg_echo('river:ingroup', array($group_link)); } // check summary translation keys. // will use the $type:$subtype if that's defined, otherwise just uses $type:default $key = "river:{$action}:{$type}:{$subtype}"; $summary = elgg_echo($key, array($subject_link, $object_link)); if ($summary == $key) { $key = "river:{$action}:{$type}:default"; $summary = elgg_echo($key, array($subject_link, $object_link)); }
<?php /** * Event calendar river view. */ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $vars['excerpt'] = elgg_get_excerpt($excerpt); echo elgg_view('page/components/image_block', array('image' => '<img src="' . elgg_get_site_url() . 'mod/event_calendar/images/event_icon.gif" />', 'body' => elgg_view('river/elements/body', $vars), 'class' => 'panel panel-river'));
<?php /** * Simple Kaltura create river item * * @package Simplekaltura * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Jeff Tilson * @copyright THINK Global School 2010 - 2013 * @link http://www.thinkglobalschool.org */ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); echo elgg_view('river/elements/layout', array('item' => $vars['item'], 'message' => $excerpt));
/** * Hook handler to turn titles into 100-character excerpts. To remove this behavior, unregister this * function from the [prepare, breadcrumbs] hook. * * @param string $hook "prepare" * @param string $type "breadcrumbs" * @param array $breadcrumbs Breadcrumbs to be altered * @param array $params Hook parameters * * @return array * @since 1.11 */ function elgg_prepare_breadcrumbs($hook, $type, $breadcrumbs, $params) { foreach (array_keys($breadcrumbs) as $i) { $breadcrumbs[$i]['title'] = elgg_get_excerpt($breadcrumbs[$i]['title'], 100); } return $breadcrumbs; }
* @uses $vars['title'] Title link (optional) false = no title, '' = default * @uses $vars['metadata'] HTML for entity menu and metadata (optional) * @uses $vars['subtitle'] HTML for the subtitle (optional) * @uses $vars['tags'] HTML for the tags (default is tags on entity, pass false for no tags) * @uses $vars['content'] HTML for the entity content (optional) * @uses $vars['icon'] Object icon. If set, the listing will be wrapped with an image block * @uses $vars['class'] Class selector for the image block * @uses $vars['image_block_vars'] Attributes for the image block wrapper */ $entity = elgg_extract('entity', $vars); if (!$entity instanceof ElggEntity) { elgg_log("object/elements/summary expects an ElggEntity in \$vars['entity']", 'ERROR'); } $title = elgg_extract('title', $vars, ''); if ($title === '' && $entity instanceof ElggEntity) { $vars['title'] = elgg_view('output/url', ['text' => elgg_get_excerpt($entity->getDisplayName(), 100), 'href' => $entity->getURL()]); } $tags = elgg_extract('tags', $vars, ''); if ($tags === '') { $tags = elgg_view('output/tags', ['entity' => $entity]); } $metadata = elgg_view('object/elements/summary/metadata', $vars); $title = elgg_view('object/elements/summary/title', $vars); $subtitle = elgg_view('object/elements/summary/subtitle', $vars); $extensions = elgg_view('object/summary/extend', $vars); $content = elgg_view('object/elements/summary/content', $vars); $summary = $metadata . $title . $subtitle . $tags . $extensions . $content; $icon = elgg_extract('icon', $vars); if (isset($icon)) { $params = (array) elgg_extract('image_block_vars', $vars, []); $class = elgg_extract_class($params);
<?php /** * New bookmarks river entry * * @package Bookmarks */ $object = $vars['item']->getObjectEntity(); $excerpt = elgg_get_excerpt($object->description); echo elgg_view('river/item', array('item' => $vars['item'], 'message' => $excerpt, 'attachments' => elgg_view('output/url', array('href' => $object->address))));
/** * Prepare breadcrumbs before display. This turns titles into 100-character excerpts, and also * removes the last crumb if it's not a link. * * @param string $hook "prepare" * @param string $type "breadcrumbs" * @param array $breadcrumbs Breadcrumbs to be altered * @param array $params Hook parameters * * @return array * @since 1.11 */ function elgg_prepare_breadcrumbs($hook, $type, $breadcrumbs, $params) { // remove last crumb if not a link $last_crumb = end($breadcrumbs); if (empty($last_crumb['link'])) { array_pop($breadcrumbs); } // apply excerpt to titles foreach (array_keys($breadcrumbs) as $i) { $breadcrumbs[$i]['title'] = elgg_get_excerpt($breadcrumbs[$i]['title'], 100); } return $breadcrumbs; }
/** * Return the short description * * @param bool $elgg_echo Run the blurb through elgg_echo. * @return string */ public function getBlurb($elgg_echo = true) { $blurb = $this->parser->getAttribute('blurb'); if ($blurb) { if ($elgg_echo) { $blurb = elgg_echo($blurb); } } else { $blurb = elgg_get_excerpt($this->getDescription()); } return $blurb; }
<?php $entity = elgg_extract('entity', $vars); $full_view = elgg_extract('full_view', $vars); if ($full_view) { echo elgg_view('object/static/full', $vars); return; } $icon = ''; $editor = $entity->getLastEditor(); if ($editor) { $icon = elgg_view_entity_icon($editor, 'tiny'); } $metadata = elgg_view_menu('entity', ['entity' => $entity, 'handler' => 'static', 'sort_by' => 'priority', 'class' => 'elgg-menu-hz']); $excerpt = elgg_get_excerpt($entity->description); $params = ['entity' => $entity, 'metadata' => $metadata, 'subtitle' => elgg_view('static/by_line', $vars), 'content' => $excerpt]; $params = $params + $vars; $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($icon, $list_body);
public function testCrumbsAreExcerpted() { $this->markTestIncomplete('Needs DB'); elgg_push_breadcrumb(str_repeat('abcd ', 100)); $this->assertEquals(array(array('title' => elgg_get_excerpt(str_repeat('abcd ', 100), 100), 'link' => null)), elgg_get_breadcrumbs()); }
<?php /** * Post comment on album river view */ elgg_require_js('tidypics/tidypics'); elgg_load_js('lightbox'); elgg_load_css('lightbox'); $item = $vars['item']; $comment = $item->getObjectEntity(); $subject = $item->getSubjectEntity(); $target = $item->getTargetEntity(); $subject_link = elgg_view('output/url', array('href' => $subject->getURL(), 'text' => $subject->name, 'class' => 'elgg-river-subject', 'is_trusted' => true)); $target_link = elgg_view('output/url', array('href' => $target->getURL(), 'text' => $target->getDisplayName(), 'class' => 'elgg-river-target', 'is_trusted' => true)); $attachments = ''; $river_comments_thumbnails = elgg_get_plugin_setting('river_comments_thumbnails', 'tidypics'); if ($river_comments_thumbnails == "show") { $album = $target; $image = $album->getCoverImage(); if ($image) { $preview_size = elgg_get_plugin_setting('river_thumbnails_size', 'tidypics'); if (!$preview_size) { $preview_size = 'tiny'; } $attachments = elgg_view_entity_icon($image, $preview_size, array('href' => $image->getIconURL('master'), 'img_class' => 'tidypics-photo', 'link_class' => 'tidypics-lightbox')); } } $summary = elgg_echo('river:comment:object:album', array($subject_link, $target_link)); echo elgg_view('river/elements/layout', array('item' => $vars['item'], 'attachments' => $attachments, 'message' => elgg_get_excerpt($comment->description), 'summary' => $summary));
<?php /** * Add question river view */ global $jsonexport; $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt, 140); $vars['item']->summary = elgg_view('river/elements/summary', array('item' => $vars['item']), FALSE, FALSE, 'default'); $vars['item']->message = $excerpt; $jsonexport['activity'][] = $vars['item'];
<?php /** * RSS object view * * @package Elgg * @subpackage Core */ $title = $vars['entity']->title; if (empty($title)) { $title = strip_tags($vars['entity']->description); $title = elgg_get_excerpt($title, 32); } $permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8'); $pubdate = date('r', $vars['entity']->getTimeCreated()); $description = elgg_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> \t<guid isPermaLink="true">{$permalink}</guid> \t<pubDate>{$pubdate}</pubDate> \t<link>{$permalink}</link> \t<title><![CDATA[{$title}]]></title> \t<description><![CDATA[{$description}]]></description> \t{$creator}{$georss}{$extension} </item> __HTML; echo $item;
$answer_link = elgg_view("output/url", array("href" => $poster->getURL(), "text" => $poster->name)); $answer_text = elgg_echo("questions:answered:correct", array($answer_link, $answer_time)); } elseif ($latestAnswer = $question->getLatestAnswer()) { $poster = $latestAnswer->getOwnerEntity(); $answer_time = elgg_view_friendly_time($latestAnswer->time_created); $answer_link = elgg_view("output/url", array("href" => $poster->getURL(), "text" => $poster->name)); $answer_text = elgg_echo("questions:answered", array($answer_link, $answer_time)); } else { $answer_text = null; } } $title_text .= elgg_get_excerpt($question->title, 100); if ($workflow) { $title = elgg_view('questions/workflow/status', array('question' => $question)); } $title .= elgg_view("output/url", array("text" => $title_text, "href" => $url, "is_trusted" => true)); $subtitle = "{$poster_text} {$date} {$categories}"; $content = elgg_get_excerpt($question->description); $params = array("entity" => $question, "title" => $title, "subtitle" => $subtitle . "<br />" . $answer_text, "tags" => $tags, "content" => $content); if ($workflow) { $params['metadata'] = elgg_view("questions/workflow/overview", array('question' => $question)); } $list_body = elgg_view("object/elements/summary", $params); if (!$workflow) { $list_body .= elgg_view_menu("ffd_questions_body", array("sort_by" => "priority", "entity" => $question, "class" => "elgg-menu-hz float-alt")); $image_alt = elgg_view_menu("ffd_questions_alt", array("sort_by" => "priority", "entity" => $question)); } else { $image_alt = null; } echo elgg_view_image_block($poster_icon, $list_body, array("image_alt" => $image_alt, "class" => "ffd-question-list-item")); }
} } } else { $entity_url = $entity->getURL(); } $result .= "<li class='elgg-item'>"; if ($display_option == "slim") { // slim if ($index < $num_highlighted) { $icon = ""; if ($show_avatar) { $icon = elgg_view_entity_icon($entity->getOwnerEntity(), "small"); } $text = elgg_view("output/url", array("href" => $entity_url, "text" => $entity->title, "target" => $target)); $text .= "<br />"; $description = elgg_get_excerpt($entity->description, 170); if ($show_timestamp) { $text .= "<span title='" . date("r", $entity->time_created) . "'>" . substr(date("r", $entity->time_created), 0, 16) . "</span>"; if (!empty($description)) { $text .= " - "; } } $text .= $description; if (elgg_substr($description, -3, 3) == '...') { $text .= " <a href=\"{$entity->getURL()}\">" . strtolower(elgg_echo('more')) . '</a>'; } $result .= elgg_view_image_block($icon, $text); } else { $result .= "<div>"; if ($show_timestamp) { $result .= "<span title='" . strftime("%c", $entity->time_created) . "'>" . strftime("%d %b", $entity->time_created) . "</span> - ";
/** * Return the short description * * @return string */ public function getBlurb() { $blurb = $this->parser->getAttribute('blurb'); if (!$blurb) { $blurb = elgg_get_excerpt($this->getDescription()); } return $blurb; }