function shoutout_get_view_page($guid) { elgg_extend_view('forms/comments/add', 'shoutout/add_river_flag'); $title = elgg_echo('shoutout:view_title'); $shoutout = get_entity($guid); if (elgg_instanceof($shoutout, 'object', 'shoutout')) { $content = '<div class="shoutout-view-wrapper">' . parse_urls($shoutout->description) . '</div>'; $content .= shoutout_get_attachment_listing($shoutout); $list = shoutout_list_attached_entities($shoutout); if ($list) { $content .= '<br />' . $list; } $content .= elgg_view_comments($shoutout); } else { $content = elgg_echo('shoutout:bad_shoutout'); } elgg_push_breadcrumb(elgg_echo('shoutout:listing_title'), 'shoutout/activity'); $params = array('title' => $title, 'content' => $content, 'filter' => ''); $body = elgg_view_layout("content", $params); return elgg_view_page($title, $body); }
<?php /** * Elgg display long text * Displays a large amount of text, with new lines converted to line breaks * * @package Elgg * @subpackage Core * * @uses $vars['value'] The text to display * @uses $vars['parse_urls'] Whether to turn urls into links. Default is true. * @uses $vars['class'] */ $class = 'elgg-output'; $additional_class = elgg_extract('class', $vars, ''); if ($additional_class) { $vars['class'] = "{$class} {$additional_class}"; } else { $vars['class'] = $class; } $parse_urls = elgg_extract('parse_urls', $vars, true); unset($vars['parse_urls']); $text = $vars['value']; unset($vars['value']); if ($parse_urls) { $text = parse_urls($text); } $text = filter_tags($text); $text = elgg_autop($text); $attributes = elgg_format_attributes($vars); echo "<div {$attributes}>{$text}</div>";
if ($vars['entity']->title) { $title = $vars['entity']->title; } else { if ($vars['entity']->name) { $title = $vars['entity']->name; } } if ($title) { $title = "<h3><a href='{$vars['entity']->getURL()}'>{$title}</a></h3>"; } $owner = get_user($vars['entity']->owner_guid); $time = elgg_view_friendly_time($vars['entity']->time_created); $owner_icon = elgg_view_entity_icon($owner, 'tiny'); $owner_link = "<a href='{$vars['url']}profile/{$owner->username}/'>{$owner->name}</a>"; $desc = $vars['entity']->description; // If entity has an excerpt (blogs) if ($vars['entity']->excerpt) { $desc = $vars['entity']->excerpt; } $desc = parse_urls($desc); // Strip out hashtags $regex = '/#([A-Aa-z0-9_-]+)/is'; $desc = preg_replace($regex, '', $desc); $list_body = <<<HTML \t{$title} \t<div class=\\"elgg-list-content\\">{$desc}</div> \t<span style='display: block' class='elgg-subtext'> \t\tby {$owner_link} {$time} \t</span> HTML; echo elgg_view_image_block($owner_icon, $list_body);
<?php /** * Shoutout river view. */ // TODO: add video view elgg_load_library('elgg:shoutout'); $object = $vars['item']->getObjectEntity(); $excerpt = parse_urls(elgg_get_excerpt($object->description)); if (substr($excerpt, strlen($excerpt) - 3) == '...') { $more_bit = ' <a href="' . $object->getURL() . '">' . elgg_echo('shoutout:more') . '</a>'; $excerpt .= $more_bit; } $excerpt .= shoutout_get_attachment_listing($object); $excerpt .= shoutout_get_video_display($object); echo elgg_view('river/elements/layout', array('item' => $vars['item'], 'message' => $excerpt)); echo shoutout_list_attached_entities($object);
/** * Get the html for a link * * @param string $address URL * @return string */ protected function getLink($address) { return parse_urls($address); }
/** * Replace urls, hash tags, and @'s by links * * @param string $text The text of a post * @return string */ function thewire_filter($text) { global $CONFIG; $text = ' ' . $text; // email addresses $text = preg_replace('/(^|[^\\w])([\\w\\-\\.]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text); // links $text = parse_urls($text); // usernames $text = preg_replace('/(^|[^\\w])@([\\p{L}\\p{Nd}._]+)/u', '$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/$2">@$2</a>', $text); // hashtags $text = preg_replace('/(^|[^\\w])#(\\w*[^\\s\\d!-\\/:-@]+\\w*)/', '$1<a href="' . $CONFIG->wwwroot . 'thewire/tag/$2">#$2</a>', $text); $text = trim($text); return $text; }
/** * Test #5369 -- parse_urls() * https://github.com/Elgg/Elgg/issues/5369 */ public function test_parse_urls() { $cases = array('no.link.here' => 'no.link.here', 'simple link http://example.org test' => 'simple link <a href="http://example.org" rel="nofollow">http:/<wbr />/<wbr />example.org</a> test', 'non-ascii http://ñew.org/ test' => 'non-ascii <a href="http://ñew.org/" rel="nofollow">http:/<wbr />/<wbr />ñew.org/<wbr /></a> test', 'percent encoded http://example.org/a%20b test' => 'percent encoded <a href="http://example.org/a%20b" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />a%20b</a> test', 'reserved characters http://example.org/:/?#[]@!$&*+,;= test' => 'reserved characters <a href="http://example.org/:/?#[]@!$&*+,;=" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />:/<wbr />?#[]@!$&*+,;=</a> test', 'unreserved characters http://example.org/a1-._~ test' => 'unreserved characters <a href="http://example.org/a1-._~" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />a1-._~</a> test', 'parameters http://example.org/?val[]=1&val[]=2 test' => 'parameters <a href="http://example.org/?val[]=1&val[]=2" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />?val[]=1&val[]=2</a> test', 'port http://example.org:80/ test' => 'port <a href="http://example.org:80/" rel="nofollow">http:/<wbr />/<wbr />example.org:80/<wbr /></a> test', 'parentheses (http://www.google.com) test' => 'parentheses (<a href="http://www.google.com" rel="nofollow">http:/<wbr />/<wbr />www.google.com</a>) test', 'comma http://elgg.org, test' => 'comma <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>, test', 'period http://elgg.org. test' => 'period <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>. test', 'exclamation http://elgg.org! test' => 'exclamation <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>! test', 'already anchor <a href="http://twitter.com/">twitter</a> test' => 'already anchor <a href="http://twitter.com/">twitter</a> test', 'ssl https://example.org/ test' => 'ssl <a href="https://example.org/" rel="nofollow">https:/<wbr />/<wbr />example.org/<wbr /></a> test', 'ftp ftp://example.org/ test' => 'ftp <a href="ftp://example.org/" rel="nofollow">ftp:/<wbr />/<wbr />example.org/<wbr /></a> test'); foreach ($cases as $input => $output) { $this->assertEqual($output, parse_urls($input)); } }
// if comment owner, group owner, or site admin - display edit and delete options if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { echo "<div class='entity_metadata'>"; echo "<span class='delete_button'>" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/groups/deletepost?post=" . $vars['entity']->id . "&topic=" . get_input('topic') . "&group=" . get_input('group_guid'), 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</span>"; echo "<a class='link' onclick=\"elgg_slide_toggle(this,'.topic','.edit_comment');\">" . elgg_echo('edit') . "</a>"; echo "</div>"; } echo "<p class='entity_title'>" . $post_owner->name . "</p>"; } else { echo "<div class='entity_listing_icon'><img src=\"" . elgg_view('icon/user/default/tiny') . "\" /></div>"; echo "<div class='entity_listing_info'><p class='entity_title'>" . elgg_echo('profile:deleteduser') . "</p>"; } //display the date of the comment echo "<p class='entity_subtext'>" . friendly_time($vars['entity']->time_created) . "</p>"; //display the actual message posted echo parse_urls(elgg_view("output/longtext", array("value" => $vars['entity']->value))); // if comment owner, group owner, or site admin - display edit-form if (groups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) { //get the edit form and details $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save'))); $text_textarea = elgg_view('input/longtext', array('internalname' => 'postComment' . $vars['entity']->id, 'value' => $vars['entity']->value)); $post = elgg_view('input/hidden', array('internalname' => 'post', 'value' => $vars['entity']->id)); $field = elgg_view('input/hidden', array('internalname' => 'field_num', 'value' => $vars['entity']->id)); $topic = elgg_view('input/hidden', array('internalname' => 'topic', 'value' => get_input('topic'))); $group = elgg_view('input/hidden', array('internalname' => 'group', 'value' => get_input('group_guid'))); $form_body = <<<EOT \t\t \t\t<p class='longtext_editarea'>{$text_textarea}</p> \t\t{$post} \t\t{$topic} \t\t{$group}
/** * Replace urls, hash tags, and @'s by links * * @see thewire_filter() * * @param string $text The text of a post * * @return string */ function thewire_tools_filter($text) { static $mention_display; $site_url = elgg_get_site_url(); if (!isset($mention_display)) { $mention_display = "username"; if (elgg_get_plugin_setting("mention_display", "thewire_tools") == "displayname") { $mention_display = "displayname"; } } $text = ' ' . $text; // email addresses $text = preg_replace('/(^|[^\\w])([\\w\\-\\.]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text); // links $text = parse_urls($text); // usernames if ($mention_display == "displayname") { $matches = array(); $match_count = preg_match_all('/(^|[^\\w])@([\\p{L}\\p{Nd}._]+)/u', $text, $matches, PREG_SET_ORDER); if ($match_count > 0) { $proccessed_usernames = array(); foreach ($matches as $set) { $replaces = 0; if (in_array($set[2], $proccessed_usernames)) { continue; } $user = get_user_by_username($set[2]); if (empty($user)) { continue; } $replace = " " . elgg_view("output/url", array("text" => "@" . $user->name, "href" => "thewire/owner/" . $user->username, "is_trusted" => true)); $text = str_ireplace($set[0], $replace, $text, $replaces); if ($replaces > 0) { $proccessed_usernames[] = $set[2]; } } } } else { $text = preg_replace('/(^|[^\\w])@([\\p{L}\\p{Nd}._]+)/u', '$1<a href="' . $site_url . 'thewire/owner/$2">@$2</a>', $text); } // hashtags $text = preg_replace('/(^|[^\\w])#(\\w*[^\\s\\d!-\\/:-@]+\\w*)/', '$1<a href="' . $site_url . 'thewire/tag/$2">#$2</a>', $text); $text = trim($text); return $text; }
$obs_img = elgg_view('output/img', array('src' => "market/image/{$post->guid}/1/large/{$tu}", 'class' => 'elgg-photo', 'alt' => $post->guid)); $images = unserialize($post->images); if (is_array($images)) { $post_images = ''; foreach ($images as $key => $value) { if ($value) { $post_img = elgg_view('output/img', array('src' => "market/image/{$post->guid}/{$key}/small/{$tu}.jpg", 'class' => 'elgg-photo', 'alt' => $post->guid)); $post_images .= elgg_view('output/url', array('href' => "market/image/{$post->guid}/{$key}/master/{$tu}.jpg", 'text' => $post_img, 'class' => "elgg-lightbox-photo market-thumbnail", 'rel' => 'market-gallery', 'data-colorboxOpts' => "{slideshow: true, rel: 'group'}")); } } } if ($post_images) { $post_body .= "<div>{$post_images}</div>"; } if (elgg_get_plugin_setting('market_allowhtml', 'market') != 'yes') { $post_body .= elgg_autop(parse_urls(strip_tags($post->description))); } else { $post_body .= elgg_view('output/longtext', array('value' => $post->description)); } if (elgg_get_plugin_setting('market_pmbutton', 'market') == 'yes') { if ($owner->guid != elgg_get_logged_in_user_guid()) { $post_body .= elgg_view('output/url', array('class' => 'elgg-button elgg-button-action mtm', 'href' => "messages/compose?send_to={$owner->guid}", 'text' => elgg_echo('market:pmbuttontext'))); } } $marketpost = elgg_view_image_block($img, $post_body, array('class' => 'market-image-block')); $subtitle = "{$author_text} {$date} {$comments_link}"; $subtitle .= "<br>{$category}<br>{$type}{$custom}{$location}"; $params = array('entity' => $post, 'header' => $header, 'metadata' => $metadata, 'subtitle' => $subtitle, 'tags' => $tags); $params = $params + $vars; $list_body = elgg_view('object/elements/summary', $params); $owner_icon = elgg_view_entity_icon($owner, 'small');
?> </div><div class="info event_language"><?php echo get_post_meta(get_the_ID(), 'event_language', true); ?> </div><div class="clearfix"></div></div> <?php } ?> <?php if (get_post_meta(get_the_ID(), 'event_official_sites', true) != '') { ?> <div class="event_list_item icon-link"><div class="title right"><?php _e('Official sites:', 'vh'); ?> </div><div class="info event_official_sites"><?php echo parse_urls(get_post_meta(get_the_ID(), 'event_official_sites', true)); ?> </div><div class="clearfix"></div></div> <?php } ?> </div> <div class="clearfix"></div> </div><!--end of overview-container--> <div class="event_buttons"> <div class="button_red"><a href="#" class="vh_button red icon-ticket hover_right"><?php _e('Rezervasyon', 'vh'); ?> </a></div> <?php $youtube = explode('=', get_post_meta(get_post()->ID, 'event_trailer', true));
/** * Replace urls, hash tags, and @'s by links * * @see thewire_filter() * * @param string $text The text of a post * * @return string */ function thewire_tools_filter($text) { static $mention_display; $site_url = elgg_get_site_url(); if (!isset($mention_display)) { $mention_display = 'username'; if (elgg_get_plugin_setting('mention_display', 'thewire_tools') == 'displayname') { $mention_display = 'displayname'; } } $text = ' ' . $text; // email addresses $text = preg_replace('/(^|[^\\w])([\\w\\-\\.]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text); // links $text = parse_urls($text); $click_url = 'thewire/owner/'; if (elgg_is_active_plugin('profile')) { $click_url = 'profile/'; } // usernames $matches = []; $match_count = preg_match_all('/(^|[^\\w])@([\\p{L}\\p{Nd}._]+)/u', $text, $matches, PREG_SET_ORDER); if ($match_count > 0) { $proccessed_usernames = []; foreach ($matches as $set) { $replaces = 0; if (in_array($set[2], $proccessed_usernames)) { continue; } $user = get_user_by_username($set[2]); if (empty($user)) { continue; } if ($mention_display == 'displayname') { $user_text = $user->name; } else { $user_text = $user->username; } $replace = ' ' . elgg_view('output/url', ['text' => '@' . $user_text, 'href' => $click_url . $user->username, 'is_trusted' => true]); $text = str_ireplace($set[0], $replace, $text, $replaces); if ($replaces > 0) { $proccessed_usernames[] = $set[2]; } } } // hashtags $text = preg_replace('/(^|[^\\w])#(\\w*[^\\s\\d!-\\/:-@]+\\w*)/', '$1<a href="' . $site_url . 'thewire/tag/$2">#$2</a>', $text); $text = trim($text); return $text; }
<?php /** * Elgg display long text, no_p * Displays a large amount of text, with new lines converted to line breaks * * This version modified to remove paragraph wrapper and replace internal * paragraph tags with <br /><br /> * * @package Elgg * @subpackage Core * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider Ltd * @copyright Curverider Ltd 2008-2009 * @link http://elgg.org/ * * @uses $vars['text'] The text to display * */ global $CONFIG; $value = trim(autop(parse_urls(filter_tags($vars['value'])))); // strip off last </p> if any if (substr($value, strlen($value) - 4, 4) == '</p>') { $value = substr($value, 0, strlen($value) - 4); } // eliminate <p> tags $value = str_replace('<p>', '', $value); // replace </p> tags with <br /><br /> $value = str_replace('</p>', '<br /><br />', $value); echo $value;
/** * Replace urls, hash tags, and @'s by links * * @param string $text The text of a post * @return string */ function thewire_filter($text) { global $CONFIG; $text = ' ' . $text; // email addresses $text = preg_replace('/(^|[^\\w])([\\w\\-\\.]+)@(([0-9a-z-]+\\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text); // links $text = parse_urls($text); //echo $text."<br>"; $usernameStart = strpos($text, '@', $usernameStart); $usernameStart += 1; //echo "<br>string length= ".strlen($text); $usernameMiddle = strpos($text, ' ', $usernameStart); $usernameEnd = strpos($text, ' ', $usernameMiddle + 1); $fullname = substr($text, $usernameStart, $usernameEnd - $usernameStart); $text1 = explode(' ', $fullname); $username = $text1[1] . substr($text1[0], 0, 1); $replaceString = '<a href="' . $CONFIG->wwwroot . 'thewire/owner/ongarde_' . $username . '">@' . $fullname . '</a>'; $usernameStart += strlen($replaceString); $text = str_replace('@' . $fullname, $replaceString, $text); // usernames //$text = preg_replace( // '/(^|[^\w])@([\p{L}\p{Nd}._]+)/u', // '$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/ognarde_'.$username.'">@'.$fullname.'</a>', // $text); // hashtags $text = preg_replace('/(^|[^\\w])#(\\w*[^\\s\\d!-\\/:-@]+\\w*)/', '$1<a href="' . $CONFIG->wwwroot . 'thewire/tag/$2">#$2</a>', $text); $text = trim($text); $text = nl2br($text); return $text; }
<?php $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); $object = get_entity($vars['item']->object_guid); $url = $object->getURL(); $string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}:</a> "; $desc .= $object->description; $desc = preg_replace('/\\@([A-Za-z0-9\\_\\.\\-]*)/i', '@<a href="' . $vars['url'] . 'pg/thewire/$1">$1</a>', $desc); $string .= parse_urls($desc); $string .= " <span class='entity_subtext'>" . friendly_time($object->time_created) . "</span> <a href=\"{$vars['url']}mod/thewire/add.php?wire_username={$object->getOwnerEntity()->username}\" class='reply_link'>" . elgg_echo('thewire:reply') . "</a>"; ?> <?php echo $string;
function html_email_handler_make_html_body($subject = "", $body = "") { global $CONFIG; // in some cases when pagesetup isn't done yet this can cause problems // so manualy set is to done $unset = false; if (!isset($CONFIG->pagesetupdone)) { $unset = true; $CONFIG->pagesetupdone = true; } // generate HTML mail body $result = elgg_view("html_email_handler/notification/body", array("title" => $subject, "message" => parse_urls($body))); // do we need to restore pagesetup if ($unset) { unset($CONFIG->pagesetupdone); } if (defined("XML_DOCUMENT_NODE")) { if ($transform = html_email_handler_css_inliner($result)) { $result = $transform; } } return $result; }
<?php /** * bitly plugin settings */ // set default values if (!isset($vars['entity']->username)) { $vars['entity']->username = ''; } // set default values if (!isset($vars['entity']->api_key)) { $vars['entity']->api_key = ''; } echo '<p class="mtm">'; echo parse_urls(elgg_echo('bitly:settings:instructs')); echo '</p>'; echo '<div>'; echo elgg_echo('bitly:settings:username'); echo elgg_view('input/text', array('name' => 'params[username]', 'value' => $vars['entity']->username)); echo '</div>'; echo '<div>'; echo elgg_echo('bitly:settings:api_key'); echo elgg_view('input/text', array('name' => 'params[api_key]', 'value' => $vars['entity']->api_key)); echo '</div>';
<?php /** * Elgg display long text * Displays a large amount of text, with new lines converted to line breaks * * @package Elgg * @subpackage Core * @author Curverider Ltd * @link http://elgg.org/ * * @uses $vars['text'] The text to display * */ global $CONFIG; echo autop(parse_urls(filter_tags($vars['value'])));
<div class="clearfloat"></div> <?php // if the user looking at thewire post can edit, show the delete link if ($vars['entity']->canEdit()) { echo "<div class='delete_note'>" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/thewire/delete?thewirepost=" . $vars['entity']->getGUID(), 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</div>"; } //end of can edit if statement ?> </div> <?php echo "<b>{$user_name}: </b>"; $desc = $vars['entity']->description; $desc = preg_replace('/\\@([A-Za-z0-9\\_\\.\\-]*)/i', '@<a href="' . $vars['url'] . 'pg/thewire/$1">$1</a>', $desc); echo parse_urls($desc); ?> <div class="clearfloat"></div> </div> <div class="note_date"> <?php echo elgg_echo("thewire:wired") . " " . sprintf(elgg_echo("thewire:strapline"), friendly_time($vars['entity']->time_created)); echo " via " . elgg_echo($vars['entity']->method) . "."; ?> </div> </div>
if ($counter == 1 && $comment_count >= 4 || $counter == 0 && $comment_count == 2 || $counter == 1 && $comment_count == 3) { $alt = 'penultimate'; } } //display comment echo "<div class='river_comment {$alt} clearfloat'>"; echo "<span class='river_comment_owner_icon'>"; echo elgg_view("profile/icon", array('entity' => $comment_owner, 'size' => 'tiny')); echo "</span>"; //truncate comment to 150 characters if (strlen($gc->value) > 150) { $gc->value = substr($gc->value, 0, strpos($gc->value, ' ', 150)) . "..."; } $contents = strip_tags($gc->value); echo "<div class='river_comment_contents'>"; echo "<a href=\"{$comment_owner_url}\">" . $comment_owner->name . "</a> " . parse_urls($contents); echo "<span class='entity_subtext'>" . friendly_time($gc->time_created) . "</span>"; echo "</div></div>"; $counter++; } echo "</div>"; } //display the comment link if ($vars['item']->type != 'user') { //for now don't display the comment link on bookmarks and wire messages if ($vars['item']->subtype != 'thewire' && $vars['item']->subtype != 'conversations' && $vars['item']->subtype != 'bookmarks' && $vars['item']->subtype != '') { echo "<a class='comment_link' href=\"{$object_url}\">Comment</a>"; } } ?> </div>
<div class="message_sender"> <?php echo elgg_view("profile/icon", array('entity' => get_entity($vars['annotation']->owner_guid), 'size' => 'tiny')); ?> </div> <!-- display the user's name who posted and the date/time --> <p class="message_item_timestamp"> <?php echo get_entity($vars['annotation']->owner_guid)->name . " " . friendly_time($vars['annotation']->time_created); ?> </p> <!-- output the actual comment --> <div class="message"><?php echo elgg_view("output/longtext", array("value" => parse_urls($vars['annotation']->value))); ?> </div> <div class="message_buttons"> <?php // if the user looking at the comment can edit, show the delete link if (issuperadminloggedin() || $vars['user']->guid == $vars['annotation']->owner_guid) { echo "<div class='delete_message'>" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/messageboard/delete?annotation_id=" . $vars['annotation']->id, 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</div>"; } //end of can edit if statement ?> <?php //if the message being looked at is owned by the current user, don't show the reply if ($vars['annotation']->owner_guid != $_SESSION['guid']) { //get the message owner
<?php /** * Display comment view */ if (isset($vars['entity'])) { $comment = $vars['entity']; $owner = get_user($comment->owner_guid); $canedit = answers_can_edit_comment($comment); $markdown = is_callable('markdown_text'); if ($comment && $owner) { $full_comment_text = parse_urls(filter_tags($comment->value)) . ($markdown ? "\n" : " ") . "— " . "<span class=\"answers_comment_owner\">" . "<a href=\"" . $owner->getURL() . "\">" . $owner->name . "</a>" . " " . elgg_view_friendly_time($comment->time_created) . "</span>"; if ($canedit) { $full_comment_text .= " " . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/answers/comment/delete?comment_id=" . $comment->id, 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'), 'class' => '', 'is_action' => true)); $edit = elgg_echo('edit'); $full_comment_text .= " <a class=\"collapsibleboxlink\">{$edit}</a>"; } if ($markdown) { $full_comment_text = markdown_text($full_comment_text); } else { $full_comment_text = autop($full_comment_text); } ?> <div class="answers_comment"> <a name="<?php echo $comment->id; ?> "></a> <?php echo $full_comment_text; ?>
/** * Make the HTML body from a $options array * * @param array $options the options * @param string $body the message body * * @return string */ function html_email_handler_make_html_body($options = "", $body = "") { global $CONFIG; if (!is_array($options)) { elgg_deprecated_notice("html_email_handler_make_html_body now takes an array as param, please update your code", "1.9"); $options = array("subject" => $options, "body" => $body); } $defaults = array("subject" => "", "body" => "", "language" => get_current_language()); $options = array_merge($defaults, $options); $options['body'] = parse_urls($options['body']); // in some cases when pagesetup isn't done yet this can cause problems // so manualy set is to done $unset = false; if (!isset($CONFIG->pagesetupdone)) { $unset = true; $CONFIG->pagesetupdone = true; } // generate HTML mail body $result = elgg_view("html_email_handler/notification/body", $options); // do we need to restore pagesetup if ($unset) { unset($CONFIG->pagesetupdone); } if (defined("XML_DOCUMENT_NODE")) { if ($transform = html_email_handler_css_inliner($result)) { $result = $transform; } } return $result; }
/** * Test #5369 -- parse_urls() * https://github.com/Elgg/Elgg/issues/5369 */ public function test_parse_urls() { $cases = array('no.link.here' => 'no.link.here', 'simple link http://example.org test' => 'simple link <a href="http://example.org" rel="nofollow">http:/<wbr />/<wbr />example.org</a> test', 'non-ascii http://ñew.org/ test' => 'non-ascii <a href="http://ñew.org/" rel="nofollow">http:/<wbr />/<wbr />ñew.org/<wbr /></a> test', 'percent encoded http://example.org/a%20b test' => 'percent encoded <a href="http://example.org/a%20b" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />a%20b</a> test', 'reserved characters http://example.org/:/?#[]@!$&*+,;= test' => 'reserved characters <a href="http://example.org/:/?#[]@!$&*+,;=" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />:/<wbr />?#[]@!$&*+,;=</a> test', 'unreserved characters http://example.org/a1-._~ test' => 'unreserved characters <a href="http://example.org/a1-._~" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />a1-._~</a> test', 'parameters http://example.org/?val[]=1&val[]=2 test' => 'parameters <a href="http://example.org/?val[]=1&val[]=2" rel="nofollow">http:/<wbr />/<wbr />example.org/<wbr />?val[]=1&val[]=2</a> test', 'port http://example.org:80/ test' => 'port <a href="http://example.org:80/" rel="nofollow">http:/<wbr />/<wbr />example.org:80/<wbr /></a> test', 'parentheses (http://www.google.com) test' => 'parentheses (<a href="http://www.google.com" rel="nofollow">http:/<wbr />/<wbr />www.google.com</a>) test', 'comma http://elgg.org, test' => 'comma <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>, test', 'period http://elgg.org. test' => 'period <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>. test', 'exclamation http://elgg.org! test' => 'exclamation <a href="http://elgg.org" rel="nofollow">http:/<wbr />/<wbr />elgg.org</a>! test', 'already anchor <a href="http://twitter.com/">twitter</a> test' => 'already anchor <a href="http://twitter.com/">twitter</a> test', 'ssl https://example.org/ test' => 'ssl <a href="https://example.org/" rel="nofollow">https:/<wbr />/<wbr />example.org/<wbr /></a> test', 'ftp ftp://example.org/ test' => 'ftp <a href="ftp://example.org/" rel="nofollow">ftp:/<wbr />/<wbr />example.org/<wbr /></a> test', 'web archive anchor <a href="http://web.archive.org/web/20000229040250/http://www.google.com/">google</a>' => 'web archive anchor <a href="http://web.archive.org/web/20000229040250/http://www.google.com/">google</a>', 'single quotes already anchor <a href=\'http://www.yahoo.com\'>yahoo</a>' => 'single quotes already anchor <a href=\'http://www.yahoo.com\'>yahoo</a>', 'unquoted already anchor <a href=http://www.yahoo.com>yahoo</a>' => 'unquoted already anchor <a href=http://www.yahoo.com>yahoo</a>', 'parens in uri http://thedailywtf.com/Articles/A-(Long-Overdue)-BuildMaster-Introduction.aspx' => 'parens in uri <a href="http://thedailywtf.com/Articles/A-(Long-Overdue)-BuildMaster-Introduction.aspx" rel="nofollow">http:/<wbr />/<wbr />thedailywtf.com/<wbr />Articles/<wbr />A-(Long-Overdue)-BuildMaster-Introduction.aspx</a>'); foreach ($cases as $input => $output) { $this->assertEqual($output, parse_urls($input)); } }
?> </name> <uri>http://twitter.com/<?php echo $status->user->screen_name; ?> </uri> </author> <updated><?php echo date("c", strtotime($status->created_at)); ?> </updated> <title type="html"><![CDATA[<?php if ($parent) { echo "<a href=\"http://twitter.com/{$parent->user->screen_name}\">{$parent->user->name}</a> "; echo " retweeted "; } echo "<a href=\"http://twitter.com/{$status->user->screen_name}\">@{$status->user->screen_name}</a>"; echo "/{$status->id}"; ?> ]]></title> <content type="html"><![CDATA[<?php echo "<p>" . parse_urls($status->text) . "</p>"; ?> ]]></content> </entry> <?php } ?> </feed> <?php }