*/ // No direct access defined('_HZEXEC_') or die; $comment = $this->comment; $newComment = $this->model->member()->lastvisit && $this->model->member()->lastvisit <= $comment->created ? true : false; // Is user allowed to delete item? $deletable = ($comment->created_by == $this->uid or $this->model->member()->role == 1) ? 1 : 0; $longComment = stripslashes($comment->comment); $longComment = str_replace('<!-- {FORMAT:HTML} -->', '', $longComment); $shorten = strlen($longComment) > 250 ? 1 : 0; $shortComment = $shorten ? \Hubzero\Utility\String::truncate($longComment, 250, array('html' => true)) : $longComment; $longComment = \Components\Projects\Helpers\Html::replaceUrls($longComment, 'external'); $shortComment = \Components\Projects\Helpers\Html::replaceUrls($shortComment, 'external'); // Emotions (new) $longComment = \Components\Projects\Helpers\Html::replaceEmoIcons($longComment); $shortComment = \Components\Projects\Helpers\Html::replaceEmoIcons($shortComment); $creator = \Hubzero\User\Profile::getInstance($comment->created_by); ?> <li class="quote <?php echo $newComment ? ' newitem' : ''; ?> " id="c_<?php echo $comment->id; ?> "> <?php if ($this->edit && $deletable && $this->model->access('content')) { ?> <span class="m_options"> <span class="delit" id="pu_<?php echo $comment->id;
/** * Display 'more' link if text is too long * * @param string $body Text body to shorten * @return mixed */ public function drawBodyText($body = NULL) { if (!$body) { return false; } $isHtml = false; if (preg_match('/^(<([a-z]+)[^>]*>.+<\\/([a-z]+)[^>]*>|<(\\?|%|([a-z]+)[^>]*).*(\\?|%|)>)/is', $body)) { $isHtml = true; } $shorten = $body && strlen($body) > 250 ? 1 : 0; $shortBody = $shorten ? \Hubzero\Utility\String::truncate($body, 250, array('html' => true)) : $body; // Embed links $body = \Components\Projects\Helpers\Html::replaceUrls($body, 'external'); $shortBody = \Components\Projects\Helpers\Html::replaceUrls($shortBody, 'external'); // Emotions (new) $body = \Components\Projects\Helpers\Html::replaceEmoIcons($body); $shortBody = \Components\Projects\Helpers\Html::replaceEmoIcons($shortBody); // Style body text if (!$isHtml) { $shortBody = preg_replace("/\n/", '<br />', trim($shortBody)); } $ebody = '<div class="body'; $ebody .= strlen($shortBody) > 50 || $isHtml ? ' newline' : ' sameline'; $ebody .= '">' . $shortBody; if ($shorten) { $ebody .= ' <a href="#" class="more-content">' . Lang::txt('COM_PROJECTS_MORE') . '</a>'; } $ebody .= '</div>'; if ($shorten) { if (!$isHtml) { $body = preg_replace("/\n/", '<br />', trim($body)); } $ebody .= '<div class="fullbody hidden">' . $body . '</div>'; } return $ebody; }
/** * Display 'more' link if text is too long * * @param string $body Text body to shorten * @param object $activity Individual activity * @return HTML */ public function drawBodyText($body = NULL) { if (!$body) { return false; } $shorten = $body && strlen($body) > 250 ? 1 : 0; $shortBody = $shorten ? \Hubzero\Utility\String::truncate($body, 250) : $body; // Embed links $body = \Components\Projects\Helpers\Html::replaceUrls($body, 'external'); $shortBody = \Components\Projects\Helpers\Html::replaceUrls($shortBody, 'external'); // Emotions (new) $body = \Components\Projects\Helpers\Html::replaceEmoIcons($body); $shortBody = \Components\Projects\Helpers\Html::replaceEmoIcons($shortBody); // Style body text $ebody = '<div class="body'; $ebody .= strlen($shortBody) > 50 ? ' newline' : ' sameline'; $ebody .= '">' . preg_replace("/\n/", '<br />', trim($shortBody)); if ($shorten) { $ebody .= ' <a href="#" class="more-content">' . Lang::txt('COM_PROJECTS_MORE') . '</a>'; } $ebody .= '</div>'; if ($shorten) { $ebody .= '<div class="fullbody hidden">' . preg_replace("/\n/", '<br />', trim($body)) . '</div>'; } return $ebody; }