/** * Get author of comment * * @param array * @return string */ function get_author($params = array()) { // Make sure we are not missing any param: $params = array_merge(array('profile_tab' => 'user', 'before' => ' ', 'after' => '#', 'before_user' => '', 'after_user' => '#', 'format' => 'htmlbody', 'link_to' => 'userurl>userpage', 'link_text' => 'preferredname', 'link_rel' => '', 'link_class' => '', 'thumb_size' => 'crop-top-32x32', 'thumb_class' => ''), $params); global $Plugins; global $Blog; if (empty($Blog)) { // Set Blog if it is still not defined $comment_Item = $this->get_Item(); $Blog = $comment_Item->get_Blog(); } if ($Blog->get_setting('allow_comments') != 'any' && $params['after_user'] == '#' && $params['after'] == '#') { // The blog does not allow anonymous comments, Don't display a type of comment author $params['after_user'] = ''; $params['after'] = ''; } if (!$Blog->get_setting('comments_avatars') && $params['link_text'] == 'avatar') { // If avatars are not allowed for this Blog $params['link_text'] = 'name'; } if ($this->get_author_User()) { // Author is a registered user: if ($params['after_user'] == '#') { $params['after_user'] = '******' . T_('Member') . ']</span>'; } $r = $this->author_User->get_identity_link($params); $r = $params['before_user'] . $r . $params['after_user']; } else { // Not a registered user, display info recorded at edit time: if ($params['after'] == '#') { $params['after'] = ' <span class="bUser-anonymous-tag">[' . T_('Visitor') . ']</span>'; } if (utf8_strlen($this->author_url) <= 10) { // URL is too short anyways... $params['link_to'] = ''; } $author_name_params = array(); if (strpos($params['link_text'], 'avatar') !== false) { // Get avatar for anonymous user $author_name_params['before'] = $this->get_avatar($params['thumb_size'], $params['thumb_class']); } // Don't display avatar login name on mode 'only_avatar' $author_name = $params['link_text'] == 'only_avatar' ? $author_name_params['before'] : $this->get_author_name_anonymous($params['format'], $author_name_params); switch ($params['link_to']) { case 'userurl': case 'userurl>userpage': case 'userpage>userurl': // Make a link: $r = $this->get_author_url_link($author_name, $params['before'], $params['after'], true, $params['link_class']); break; default: // Display the name: (NOTE: get_author_url_link( with nolink option ) would NOT handle this correctly when url is empty $r = $params['before'] . $author_name . $params['after']; break; } } $hook_params = array('data' => &$r, 'Comment' => &$this, 'makelink' => !empty($params['link_to'])); $Plugins->trigger_event('FilterCommentAuthor', $hook_params); return $r; }
/** * Template function: display assignee of item * * @param string * @param string * @param string Output format, see {@link format_to_output()} */ function assigned_to($before = '', $after = '', $format = 'htmlbody') { if ($this->get_assigned_User()) { echo $before; echo $this->assigned_User->get_identity_link(array('format' => $format, 'link_text' => 'name')); echo $after; } }