/** * Adds some fancy HTML if a comment is too long * * @param integer $id * @param string $comment * * @return string */ public function showShortComment($id, $comment) { $words = explode(' ', nl2br($comment)); $numWords = 0; $comment = ''; foreach ($words as $word) { $comment .= $word . ' '; if (15 === $numWords) { $comment .= '<span class="comment-dots-' . $id . '">... </span>' . '<a onclick="showLongComment(' . $id . ')" class="comment-show-more-' . $id . ' pointer">' . $this->pmfStr['msgShowMore'] . '</a>' . '<span class="comment-more-' . $id . ' hide">'; } $numWords++; } // Convert URLs to HTML anchors return PMF_Utils::parseUrl($comment) . '</span>'; }