/** * Displays link for replying to the Comment if blog's setting allows this action * * @param string to display before link * @param string to display after link * @param string link text * @param string link title * @param string class name */ function reply_link($before = ' ', $after = ' ', $text = '#', $title = '#', $class = '') { if (!is_logged_in(false)) { return false; } if (empty($this->ID)) { // Happens in Preview return false; } $this->get_Item(); $this->Item->load_Blog(); if (!$this->Item->Blog->get_setting('threaded_comments')) { // A blog's setting is OFF for replying to the comment return false; } if (!$this->Item->can_comment()) { // The comments are disabled return false; } // ID of a replying comment $comment_reply_ID = param('reply_ID', 'integer', 0); if ($text == '#') { // Use default text $text = $this->ID == $comment_reply_ID ? T_('You are currently replying to this comment') : T_('Reply to this comment'); } if ($title == '#') { // Use default title $title = T_('Reply to this comment'); } $class .= ' comment_reply'; if ($this->ID == $comment_reply_ID) { // This comment is using for replying now $class .= ' active'; } $class = ' class="' . trim($class) . '"'; $url = url_add_param($this->Item->get_permanent_url(), 'reply_ID=' . $this->ID . '&redir=no') . '#form_p' . $this->Item->ID; echo $before; // Display a link echo '<a href="' . $url . '" title="' . $title . '"' . $class . ' rel="' . $this->ID . '">' . $text . '</a>'; echo $after; return true; }