/** * Format and hyperlink mentions * * @param string $p_text The text to process. * @param bool $p_html true for html, false otherwise. * @return string The processed text. */ function mention_format_text($p_text, $p_html = true) { $t_mentioned_users = mention_get_users($p_text); if (empty($t_mentioned_users)) { return $p_text; } $t_mentions_tag = mentions_tag(); $t_formatted_mentions = array(); foreach ($t_mentioned_users as $t_username => $t_user_id) { $t_mention = $t_mentions_tag . $t_username; $t_mention_formatted = $t_mention; if ($p_html) { $t_mention_formatted = string_display_line($t_mention_formatted); $t_mention_formatted = '<a class="user" href="' . string_sanitize_url('view_user_page.php?id=' . $t_user_id, true) . '">' . $t_mention_formatted . '</a>'; if (!user_is_enabled($t_user_id)) { $t_mention_formatted = '<s>' . $t_mention_formatted . '</s>'; } $t_mention_formatted = '<span class="mention">' . $t_mention_formatted . '</span>'; } $t_formatted_mentions[$t_mention] = $t_mention_formatted; } # Replace the mentions, ignoring existing anchor tags (otherwise # previously set mailto links would be processed as mentions, # corrupting the output $t_text = string_process_exclude_anchors($p_text, function ($p_string) use($t_formatted_mentions) { return str_replace(array_keys($t_formatted_mentions), array_values($t_formatted_mentions), $p_string); }); return $t_text; }
<textarea id="reminder" name="body" cols="85" rows="10"></textarea> </span> <span class="label-style"></span> </div> <span class="info-text"> <?php echo lang_get('reminder_explain') . ' '; if (ON == config_get('reminder_recipients_monitor_bug')) { echo lang_get('reminder_monitor') . ' '; } if (ON == config_get('store_reminders')) { echo lang_get('reminder_store'); } if (mention_enabled()) { echo '<br /><br />', sprintf(lang_get('reminder_mentions'), '<strong>' . mentions_tag() . user_get_field(auth_get_current_user_id(), 'username') . '</strong>'); } ?> </span> <span class="submit-button"> <input type="submit" class="button" value="<?php echo lang_get('bug_send_button'); ?> " /> </span> </fieldset> </form> </div>